Apply editor replacement to all .editable_preview elements

This commit is contained in:
Kijin Sung 2018-03-06 21:39:04 +09:00
parent 1728d17867
commit a0ae7a2a30
9 changed files with 63 additions and 75 deletions

View file

@ -107,6 +107,32 @@ a img {
}
}
/* Editable Preview */
.editable_preview {
width: 100%;
min-height: 240px;
max-height: 440px;
box-sizing: border-box;
margin: 0;
padding: 6px;
border: 1px solid #ccc;
border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
overflow-y: auto;
cursor: text;
p {
margin-bottom: @default_paragraph_spacing !important;
}
}
.editable_preview_iframe {
width: 100%;
height: 440px;
box-sizing: border-box;
margin: 0 0 -4px 0;
padding: 0;
border: 0;
}
/* Message */
.message {
position: relative;

View file

@ -281,6 +281,25 @@ jQuery(function($) {
}
});
/* Editor preview replacement */
$(".editable_preview").addClass("xe_content").attr("tabindex", 0);
$(".editable_preview").on("click", function() {
var input = $(this).siblings(".editable_preview_content");
if (input.size()) {
$(this).off("click").off("focus").remove();
input = input.first();
if (input.attr("type") !== "hidden") {
input.hide();
}
var iframe = $('<iframe class="editable_preview_iframe"></iframe>');
iframe.attr("src", current_url.setQuery("module", "editor").setQuery("act", "dispEditorFrame").setQuery("parent_input_id", input.attr("id")).replace(/^https?:/, ''));
iframe.insertAfter(input);
}
});
$(".editable_preview").on("focus", function() {
$(this).triggerHandler("click");
});
/* select - option의 disabled=disabled 속성을 IE에서도 체크하기 위한 함수 */
if(navigator.userAgent.match(/MSIE/)) {
$('select').each(function(i, sels) {