AvocadoAmber/AvocadoEdition_Light/plugin/editor/smarteditor2/config.js

51 lines
2.1 KiB
JavaScript
Raw Normal View History

2024-09-20 20:30:44 +09:00
(function ($) {
$(document).ready(function () {
$(".smarteditor2").each(function (index) {
var get_id = $(this).attr("id");
if (!get_id || $(this).prop("nodeName") != 'TEXTAREA') return true;
nhn.husky.EZCreator.createInIFrame({
oAppRef: oEditors,
elPlaceHolder: get_id,
sSkinURI: g5_editor_url + "/SmartEditor2Skin.html",
htParams: {
2024-09-22 13:51:59 +09:00
bUseToolbar: true,
bUseVerticalResizer: true,
bUseModeChanger: true,
bSkipXssFilter: true,
2024-09-22 15:53:38 +09:00
aAdditionalFontList: editorAdditionalFontList,
2024-09-20 20:30:44 +09:00
fOnBeforeUnload: function () {
2024-09-22 13:51:59 +09:00
// unload
2024-09-20 20:30:44 +09:00
}
}, //boolean
fOnAppLoad: function () {
2024-09-22 13:51:59 +09:00
const extraFont = document.head.querySelector('#extra_font');
if (extraFont) {
const fontStyle = extraFont.textContent || extraFont.innerText;
2024-09-22 15:53:38 +09:00
2024-09-22 13:51:59 +09:00
const editorDocument = oEditors.getById[get_id].getWYSIWYGDocument();
const editorHead = editorDocument.getElementsByTagName("head")[0];
const editorStyle = editorDocument.createElement("style");
editorStyle.appendChild(editorDocument.createTextNode(fontStyle));
editorHead.appendChild(editorStyle);
2024-09-22 15:53:38 +09:00
2024-09-22 13:51:59 +09:00
const iframes = document.getElementsByTagName('iframe');
for (let i = 0; i < iframes.length; i++) {
if (iframes[i].src.indexOf('SmartEditor2Skin.html') !== -1) {
const iframeDocument = iframes[i].contentDocument || iframes[i].contentWindow.document;
const iframeHead = iframeDocument.getElementsByTagName("head")[0];
if (!iframeHead.querySelector("#extra_font")) {
const iframeStyle = iframeDocument.createElement("style");
iframeStyle.id = "extra_font";
iframeStyle.appendChild(iframeDocument.createTextNode(fontStyle));
iframeHead.appendChild(iframeStyle);
}
}
}
}
2024-09-20 20:30:44 +09:00
},
fCreator: "createSEditor2"
});
});
});
})(jQuery);