New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

suneditor

Package Overview
Dependencies
Maintainers
1
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

suneditor - npm Package Compare versions

Comparing version 1.9.0 to 1.10.0

src/img/modify_icon.svg

2

bower.json
{
"name": "suneditor",
"version": "1.9.0",
"version": "1.10.0",
"description": "Pure JavaScript based WYSIWYG web editor",

@@ -5,0 +5,0 @@ "main": "src/suneditor.js",

@@ -64,7 +64,2 @@ /*

url: 'Image URL',
resize100: 'resize 100%',
resize75: 'resize 75%',
resize50: 'resize 50%',
resize25: 'resize 25%',
remove: 'remove image',
caption: 'Insert image description',

@@ -77,3 +72,10 @@ altText: 'Alternative text'

},
resize100: 'resize 100%',
resize75: 'resize 75%',
resize50: 'resize 50%',
resize25: 'resize 25%',
remove: 'remove',
submitButton: 'Submit',
revertButton: 'Revert',
proportion: 'constrain proportions',
width: 'Width',

@@ -90,2 +92,2 @@ height: 'Height',

}
};
};

@@ -64,7 +64,2 @@ /*

url: '이미지 주소',
resize100: '100% 크기',
resize75: '75% 크기',
resize50: '50% 크기',
resize25: '25% 크기',
remove: '이미지 삭제',
caption: '이미지 설명 넣기',

@@ -77,3 +72,10 @@ altText: '대체 문자열'

},
resize100: '100% 크기',
resize75: '75% 크기',
resize50: '50% 크기',
resize25: '25% 크기',
remove: '삭제',
submitButton: '확인',
revertButton: '되돌리기',
proportion: '비율 맞춤',
basic: '기본',

@@ -90,2 +92,2 @@ left: '왼쪽',

}
};
};
{
"name": "suneditor",
"version": "1.9.0",
"version": "1.10.0",
"description": "Pure JavaScript based WYSIWYG web editor",

@@ -5,0 +5,0 @@ "main": "src/suneditor.js",

@@ -11,2 +11,11 @@ /*

const context = _this.context;
context.dialog = {
_resizeClientX: 0,
_resizeClientY: 0,
_resize_parent_t: 0,
_resize_parent_l: 0,
_resize_plugin: '',
_resize_w: 0,
_resize_h: 0
};

@@ -32,5 +41,29 @@ /** dialog */

/** image resize controller, button */
const resize_div_container = eval(this.setController_resize());
context.dialog.resizeContainer = resize_div_container;
context.dialog.resizeDiv = resize_div_container.getElementsByClassName('modal-resize')[0];
context.dialog.resizeDot = resize_div_container.getElementsByClassName('resize-dot')[0];
context.dialog.resizeDisplay = resize_div_container.getElementsByClassName('resize-display')[0];
const resize_button = eval(this.setController_button());;
context.dialog.resizeButton = resize_button;
/** add event listeners */
context.dialog.modal.addEventListener('click', this.onClick_dialog.bind(_this));
context.element.topArea.getElementsByClassName('sun-editor-container')[0].appendChild(dialog_div);
resize_div_container.getElementsByClassName('sun-editor-name-resize-controller')[0].addEventListener('mousedown', this.onMouseDown_resize_ctrl.bind(_this, 'tl'));
resize_div_container.getElementsByClassName('sun-editor-name-resize-controller')[1].addEventListener('mousedown', this.onMouseDown_resize_ctrl.bind(_this, 'tr'));
resize_div_container.getElementsByClassName('sun-editor-name-resize-controller')[2].addEventListener('mousedown', this.onMouseDown_resize_ctrl.bind(_this, 'bl'));
resize_div_container.getElementsByClassName('sun-editor-name-resize-controller')[3].addEventListener('mousedown', this.onMouseDown_resize_ctrl.bind(_this, 'br'));
resize_div_container.getElementsByClassName('sun-editor-name-resize-controller')[4].addEventListener('mousedown', this.onMouseDown_resize_ctrl.bind(_this, 'lw'));
resize_div_container.getElementsByClassName('sun-editor-name-resize-controller')[5].addEventListener('mousedown', this.onMouseDown_resize_ctrl.bind(_this, 'th'));
resize_div_container.getElementsByClassName('sun-editor-name-resize-controller')[6].addEventListener('mousedown', this.onMouseDown_resize_ctrl.bind(_this, 'rw'));
resize_div_container.getElementsByClassName('sun-editor-name-resize-controller')[7].addEventListener('mousedown', this.onMouseDown_resize_ctrl.bind(_this, 'bh'));
resize_button.addEventListener('click', this.onClick_resizeButton.bind(_this));
/** append html */
context.element.relative.appendChild(resize_div_container);
context.element.relative.appendChild(resize_button);
},

@@ -76,3 +109,195 @@

SUNEDITOR.plugin[this.context.dialog.kind].init.call(this);
},
/** resize controller, button (image, iframe) */
setController_resize: function () {
const resize_container = document.createElement('DIV');
resize_container.className = 'modal-resize-container';
resize_container.style.display = 'none';
resize_container.innerHTML = '' +
'<div class="modal-resize">' +
' <div class="resize-display"></div>' +
'</div>' +
'<div class="resize-dot">' +
' <div class="tl sun-editor-name-resize-controller"></div>' +
' <div class="tr sun-editor-name-resize-controller"></div>' +
' <div class="bl sun-editor-name-resize-controller"></div>' +
' <div class="br sun-editor-name-resize-controller"></div>' +
' <div class="lw sun-editor-name-resize-controller"></div>' +
' <div class="th sun-editor-name-resize-controller"></div>' +
' <div class="rw sun-editor-name-resize-controller"></div>' +
' <div class="bh sun-editor-name-resize-controller"></div>' +
'</div>';
return resize_container;
},
setController_button: function () {
const lang = SUNEDITOR.lang;
const resize_button = document.createElement("DIV");
resize_button.className = "image-resize-btn";
resize_button.style.display = "none";
resize_button.innerHTML = '' +
'<div class="btn-group">' +
' <button type="button" data-command="100" title="' + lang.dialogBox.resize100 + '"><span class="note-fontsize-10">100%</span></button>' +
' <button type="button" data-command="75" title="' + lang.dialogBox.resize75 + '"><span class="note-fontsize-10">75%</span></button>' +
' <button type="button" data-command="50" title="' + lang.dialogBox.resize50 + '"><span class="note-fontsize-10">50%</span></button>' +
' <button type="button" data-command="25" title="' + lang.dialogBox.resize25 + '"><span class="note-fontsize-10">25%</span></button>' +
' <button type="button" data-command="update" title="' + lang.toolbar.image + '" style="padding: 6px 10px !important;"><div class="ico_modify"></div></button>' +
'</div>' +
'<div class="btn-group remove">' +
' <button type="button" data-command="delete" title="' + lang.dialogBox.remove + '"><span class="image_remove">x</span></button>' +
'</div>';
return resize_button;
},
call_controller_resize: function (targetElement, plugin) {
/** ie,firefox image resize handle : false*/
this.context.dialog._resize_plugin = plugin;
targetElement.setAttribute('unselectable', 'on');
targetElement.contentEditable = false;
const resizeContainer = this.context.dialog.resizeContainer;
const resizeDiv = this.context.dialog.resizeDiv;
const w = targetElement.offsetWidth;
const h = targetElement.offsetHeight;
let parentElement = targetElement.offsetParent;
let parentT = 0;
let parentL = 0;
while (parentElement) {
parentT += (parentElement.offsetTop + parentElement.clientTop);
parentL += (parentElement.offsetLeft + +parentElement.clientLeft);
parentElement = parentElement.offsetParent;
}
this.context.dialog._resize_parent_t = (this.context.tool.bar.offsetHeight + parentT);
this.context.dialog._resize_parent_l = parentL;
const t = (targetElement.offsetTop + this.context.dialog._resize_parent_t - this.context.element.wysiwygWindow.document.body.scrollTop);
const l = (targetElement.offsetLeft + parentL);
resizeContainer.style.top = t + 'px';
resizeContainer.style.left = l + 'px';
resizeContainer.style.width = w + 'px';
resizeContainer.style.height = h + 'px';
resizeDiv.style.top = '0px';
resizeDiv.style.left = '0px';
resizeDiv.style.width = w + 'px';
resizeDiv.style.height = h + 'px';
this.context.dialog.resizeButton.style.top = (h + t) + 'px';
this.context.dialog.resizeButton.style.left = l + 'px';
SUNEDITOR.dom.changeTxt(this.context.dialog.resizeDisplay, w + ' x ' + h);
this.context.dialog.resizeContainer.style.display = 'block';
this.context.dialog.resizeButton.style.display = 'block';
this.context.dialog.resizeDot.style.display = 'block';
this.context.dialog._resize_w = w;
this.context.dialog._resize_h = h;
this.controllerArray = [this.context.dialog.resizeContainer, this.context.dialog.resizeButton];
return {
w: w,
h: h,
t: t,
l: l
};
},
cancel_controller_resize: function () {
this.context[this.context.dialog._resize_plugin]._resize_element.style.width = this.context.dialog._resize_w + 'px';
this.context[this.context.dialog._resize_plugin]._resize_element.style.height =this.context.dialog._resize_h + 'px';
this.context.element.resizeBackground.style.display = 'none';
this.context.dialog.resizeContainer.style.display = 'none';
this.context.dialog.resizeButton.style.display = 'none';
SUNEDITOR.plugin[this.context.dialog._resize_plugin].init.call(this);
},
onClick_resizeButton: function (e) {
e.stopPropagation();
const command = e.target.getAttribute('data-command') || e.target.parentNode.getAttribute('data-command');
if (!command) return;
e.preventDefault();
if (/^\d+$/.test(command)) {
SUNEDITOR.plugin[this.context.dialog._resize_plugin].setSize.call(this, command + '%', '');
}
else if (/update/.test(command)) {
SUNEDITOR.plugin[this.context.dialog._resize_plugin].openModify.call(this);
}
else if (/delete/.test(command)) {
SUNEDITOR.plugin[this.context.dialog._resize_plugin].destroy.call(this);
}
this.submenuOff();
this.focus();
},
onMouseDown_resize_ctrl: function (direction) {
const e = window.event;
e.stopPropagation();
e.preventDefault();
this.context.dialog.resizeDot.style.display = 'none';
this.context.dialog._resizeClientX = e.clientX;
this.context.dialog._resizeClientY = e.clientY;
this.context.element.resizeBackground.style.display = 'block';
this.context.dialog.resizeButton.style.display = 'none';
this.context.dialog.resizeDiv.style.float = /l/.test(direction) ? 'right' : /r/.test(direction) ? 'left' : 'none';
function closureFunc() {
SUNEDITOR.plugin.dialog.cancel_controller_resize.call(this);
document.removeEventListener('mousemove', resize_element_bind);
document.removeEventListener('mouseup', closureFunc_bind);
}
const resize_element_bind = SUNEDITOR.plugin.dialog.resize_element.bind(this, direction);
const closureFunc_bind = closureFunc.bind(this);
document.addEventListener('mousemove', resize_element_bind);
document.addEventListener('mouseup', closureFunc_bind);
},
resize_element: function (direction) {
const e = window.event;
const clientX = e.clientX;
const clientY = e.clientY;
const plugin = this.context[this.context.dialog._resize_plugin];
let resultW = plugin._element_w;
let resultH = plugin._element_h;
const w = plugin._element_w + (/r/.test(direction) ? clientX - this.context.dialog._resizeClientX : this.context.dialog._resizeClientX - clientX);
const h = plugin._element_h + (/b/.test(direction) ? clientY - this.context.dialog._resizeClientY : this.context.dialog._resizeClientY - clientY);
const wh = ((plugin._element_h / plugin._element_w) * w);
if (/t/.test(direction)) this.context.dialog.resizeDiv.style.top = (plugin._element_h - (/h/.test(direction) ? h : wh)) + 'px';
if (/l/.test(direction)) this.context.dialog.resizeDiv.style.left = (plugin._element_w - w) + 'px';
if (/r|l/.test(direction)) {
this.context.dialog.resizeDiv.style.width = w + 'px';
resultW =w;
}
if (/^(?:t|b)[^h]$/.test(direction)) {
this.context.dialog.resizeDiv.style.height = wh + 'px';
resultH = wh;
}
else if (/^(?:t|b)h$/.test(direction)) {
this.context.dialog.resizeDiv.style.height = h + 'px';
resultH = h;
}
this.context.dialog._resize_w = resultW;
this.context.dialog._resize_h = resultH;
SUNEDITOR.dom.changeTxt(this.context.dialog.resizeDisplay, Math.round(resultW) + ' x ' + Math.round(resultH));
}
};
};

@@ -12,11 +12,11 @@ /*

context.image = {
_imageElementLink: null,
_imageElement: null,
_imageElement_w: 1,
_imageElement_h: 1,
_imageElement_l: 0,
_imageElement_t: 0,
_imageClientX: 0,
_imageResize_parent_t: 0,
_imageResize_parent_l: 0,
_elementLink: null,
_element: null,
_resize_element: null,
_element_w: 1,
_element_h: 1,
_element_l: 0,
_element_t: 0,
_origin_w: context.user.imageSize,
_origin_h: 0,
_altText: '',

@@ -26,3 +26,5 @@ _imageCaption: null,

_align: 'none',
_captionChecked: false
_captionChecked: false,
_proportionChecked: true,
_onCaption: false
};

@@ -33,4 +35,4 @@

context.image.modal = image_dialog;
context.image.focusElement = image_dialog.getElementsByClassName('sun-editor-id-image-url')[0];
context.image.imgInputFile = image_dialog.getElementsByClassName('sun-editor-id-image-file')[0];
context.image.imgUrlFile = image_dialog.getElementsByClassName('sun-editor-id-image-url')[0];
context.image.imgInputFile = context.image.focusElement = image_dialog.getElementsByClassName('sun-editor-id-image-file')[0];
context.image.altText = image_dialog.getElementsByClassName('sun-editor-id-image-alt')[0];

@@ -40,2 +42,3 @@ context.image.imgLink = image_dialog.getElementsByClassName('sun-editor-id-image-link')[0];

context.image.caption = image_dialog.querySelector('#suneditor_image_check_caption');
context.image.proportion = image_dialog.querySelector('#suneditor_image_check_proportion');
context.image.imageX = image_dialog.getElementsByClassName('sun-editor-id-image-x')[0];

@@ -46,23 +49,11 @@ context.image.imageY = image_dialog.getElementsByClassName('sun-editor-id-image-y')[0];

/** image resize controller, button */
const resize_img_div = eval(this.setController_ImageResizeController());
context.image.imageResizeDiv = resize_img_div;
context.image.imageResizeDisplay = resize_img_div.getElementsByClassName('sun-editor-id-img-display')[0];
const resize_img_button = eval(this.setController_ImageButton());
context.image.imageResizeBtn = resize_img_button;
/** add event listeners */
context.image.modal.getElementsByClassName('sun-editor-tab-button')[0].addEventListener('click', this.openTab.bind(_this));
context.image.modal.getElementsByClassName('btn-primary')[0].addEventListener('click', this.submit_dialog.bind(_this));
resize_img_div.getElementsByClassName('sun-editor-img-controller')[0].addEventListener('mousedown', this.onMouseDown_image_ctrl.bind(_this, 'l'));
resize_img_div.getElementsByClassName('sun-editor-img-controller')[1].addEventListener('mousedown', this.onMouseDown_image_ctrl.bind(_this, 'r'));
context.image.imageResizeBtn.addEventListener('click', this.onClick_imageResizeBtn.bind(_this));
context.image.imageX.addEventListener('change', this.setImageSizeInput.bind(_this, 'x'));
context.image.imageY.addEventListener('change', this.setImageSizeInput.bind(_this, 'y'));
context.image.imageX.addEventListener('change', this.setInputSize.bind(_this, 'x'));
context.image.imageY.addEventListener('change', this.setInputSize.bind(_this, 'y'));
image_dialog.getElementsByClassName('sun-editor-id-image-revert-button')[0].addEventListener('click', this.sizeRevert.bind(_this));
/** append html */
context.dialog.modal.appendChild(image_dialog);
context.element.relative.appendChild(resize_img_div);
context.element.relative.appendChild(resize_img_button);
},

@@ -115,2 +106,4 @@

' <input class="form-size-control sun-editor-id-image-x" type="number" min="1" /><label class="size-x">x</label><input class="form-size-control sun-editor-id-image-y" type="number" min="1" disabled />' +
' <input type="checkbox" id="suneditor_image_check_proportion" style="margin-left: 20px;" checked disabled/><label for="suneditor_image_check_proportion">&nbsp;' + lang.dialogBox.proportion + '</label>' +
' <button type="button" title="' + lang.dialogBox.revertButton + '" class="btn_editor sun-editor-id-image-revert-button" style="float: right;"><div class="ico_revert"></div></button>' +
' </div>' +

@@ -176,3 +169,3 @@ ' <div class="form-group-footer">' +

if (tabName === 'image') {
this.context.image.focusElement.focus();
this.context.image.imgUrlFile.focus();
} else if (tabName === 'url') {

@@ -248,6 +241,6 @@ this.context.image.imgLink.focus();

onRender_imgUrl: function () {
if (this.context.image.focusElement.value.trim().length === 0) return false;
if (this.context.image.imgUrlFile.value.trim().length === 0) return false;
try {
SUNEDITOR.plugin.image.create_image.call(this, this.context.image.focusElement.value, this.context.image._linkValue, this.context.image.imgLinkNewWindowCheck.checked, this.context.image.imageX.value + 'px', this.context.image._align);
SUNEDITOR.plugin.image.create_image.call(this, this.context.image.imgUrlFile.value, this.context.image._linkValue, this.context.image.imgLinkNewWindowCheck.checked, this.context.image.imageX.value + 'px', this.context.image._align);
} catch (e) {

@@ -279,9 +272,11 @@ this.closeLoading();

setImageSizeInput: function (xy) {
setInputSize: function (xy) {
if (!this.context.dialog.updateModal) return;
if (xy === 'x') {
this.context.image.imageY.value = Math.round((this.context.image._imageElement_h / this.context.image._imageElement_w) * this.context.image.imageX.value);
} else {
this.context.image.imageX.value = Math.round((this.context.image._imageElement_w / this.context.image._imageElement_h) * this.context.image.imageY.value);
if (this.context.image.proportion.checked) {
if (xy === 'x') {
this.context.image.imageY.value = Math.round((this.context.image._element_h / this.context.image._element_w) * this.context.image.imageX.value);
} else {
this.context.image.imageX.value = Math.round((this.context.image._element_w / this.context.image._element_h) * this.context.image.imageY.value);
}
}

@@ -300,2 +295,3 @@ },

this.context.image._captionChecked = this.context.image.caption.checked;
this.context.image._proportionChecked = this.context.image.proportion.checked;

@@ -319,3 +315,3 @@ try {

if (update) {
this.context.image._imageElement.src = src;
this.context.image._element.src = src;
return;

@@ -331,2 +327,3 @@ }

oImg.setAttribute('data-align', align);
oImg.setAttribute('data-proportion', this.context.image._proportionChecked);
oImg.alt = this.context.image._altText;

@@ -341,5 +338,4 @@ oImg = SUNEDITOR.plugin.image.onRender_link(oImg, linkValue, linkNewWindow);

const caption = document.createElement('FIGCAPTION');
caption.innerHTML = '<p>&#65279</p>';
caption.setAttribute('contenteditable', true);
cover.appendChild(caption);
this.context.image._imageCaption = SUNEDITOR.plugin.image.create_caption.call(this);
cover.appendChild(this.context.image._imageCaption);
}

@@ -365,7 +361,7 @@

const linkValue = contextImage._linkValue;
const container = SUNEDITOR.dom.getParentNode(contextImage._imageElement, '.sun-editor-id-image-container') || contextImage._imageElement;
const cover = SUNEDITOR.dom.getParentNode(contextImage._imageElement, '.sun-editor-image-cover');
const container = SUNEDITOR.dom.getParentNode(contextImage._element, '.sun-editor-id-image-container') || contextImage._element;
const cover = SUNEDITOR.dom.getParentNode(contextImage._element, '.sun-editor-image-cover');
let newEl;
if (contextImage.imgInputFile.value.length === 0 && contextImage.focusElement.value.trim().length === 0) {
if (contextImage.imgInputFile.value.length === 0 && contextImage.imgUrlFile.value.trim().length === 0) {
SUNEDITOR.dom.removeItem(container);

@@ -379,6 +375,7 @@ return;

// src, size
contextImage._imageElement.src = contextImage.focusElement.value;
contextImage._imageElement.alt = contextImage._altText;
contextImage._imageElement.style.width = contextImage.imageX.value + 'px';
contextImage._imageElement.style.height = contextImage.imageY.value + 'px';
contextImage._element.src = contextImage.imgUrlFile.value;
contextImage._element.alt = contextImage._altText;
contextImage._element.setAttribute('data-proportion', contextImage._proportionChecked);;
contextImage._element.style.width = contextImage.imageX.value + 'px';
contextImage._element.style.height = contextImage.imageY.value + 'px';

@@ -388,6 +385,4 @@ // caption

if (contextImage._imageCaption === null) {
const caption = document.createElement('FIGCAPTION');
caption.innerHTML = '<p>&#65279</p>';
caption.setAttribute('contenteditable', true);
cover.appendChild(caption);
contextImage._imageCaption = SUNEDITOR.plugin.image.create_caption.call(this);
cover.appendChild(contextImage._imageCaption);
}

@@ -409,12 +404,12 @@ } else {

contextImage._imageElement.setAttribute('data-align', contextImage._align);
contextImage._element.setAttribute('data-align', contextImage._align);
// link
if (linkValue.trim().length > 0) {
if (contextImage._imageElementLink !== null) {
contextImage._imageElementLink.href = linkValue;
contextImage._imageElementLink.target = this.context.image.imgLinkNewWindowCheck.checked;
contextImage._imageElement.setAttribute('data-image-link', linkValue);
if (contextImage._elementLink !== null) {
contextImage._elementLink.href = linkValue;
contextImage._elementLink.target = this.context.image.imgLinkNewWindowCheck.checked;
contextImage._element.setAttribute('data-image-link', linkValue);
} else {
newEl = SUNEDITOR.plugin.image.onRender_link(contextImage._imageElement.cloneNode(true), linkValue, this.context.image.imgLinkNewWindowCheck.checked);
newEl = SUNEDITOR.plugin.image.onRender_link(contextImage._element.cloneNode(true), linkValue, this.context.image.imgLinkNewWindowCheck.checked);
cover.innerHTML = '';

@@ -424,4 +419,4 @@ cover.appendChild(newEl);

}
else if (contextImage._imageElementLink !== null) {
const imageElement = contextImage._imageElement;
else if (contextImage._elementLink !== null) {
const imageElement = contextImage._element;

@@ -439,188 +434,92 @@ imageElement.setAttribute('data-image-link', '');

init: function () {
this.context.image.imgInputFile.value = '';
this.context.image.focusElement.value = '';
this.context.image.altText.value = '';
this.context.image.imgLink.value = '';
this.context.image.imgLinkNewWindowCheck.checked = false;
this.context.image.modal.querySelector('#suneditor_image_radio_none').checked = true;
this.context.image.caption.checked = false;
this.context.image.imageX.value = this.context.user.imageSize;
this.context.image.imageY.value = '';
this.context.image.imageY.disabled = true;
SUNEDITOR.plugin.image.openTab.call(this, 'init');
},
create_caption: function () {
const caption = document.createElement('FIGCAPTION');
caption.innerHTML = '<p>' + SUNEDITOR.lang.dialogBox.imageBox.caption + '</p>';
caption.addEventListener('click', SUNEDITOR.plugin.image.toggle_caption_contenteditable.bind(this, true));
/** image resize controller, button*/
setController_ImageResizeController: function () {
const resize_img_div = document.createElement('DIV');
resize_img_div.className = 'modal-image-resize';
resize_img_div.style.display = 'none';
resize_img_div.innerHTML = '' +
'<div class="image-resize-dot tl"></div>' +
'<div class="image-resize-dot tr"></div>' +
'<div class="image-resize-dot bl sun-editor-img-controller"></div>' +
'<div class="image-resize-dot br sun-editor-img-controller"></div>' +
'<div class="image-size-display sun-editor-id-img-display"></div>';
return resize_img_div;
return caption;
},
setController_ImageButton: function () {
const lang = SUNEDITOR.lang;
const resize_img_button = document.createElement("DIV");
resize_img_button.className = "image-resize-btn";
resize_img_button.style.display = "none";
resize_img_button.innerHTML = '' +
'<div class="btn-group">' +
' <button type="button" data-command="100" title="' + lang.dialogBox.imageBox.resize100 + '"><span class="note-fontsize-10">100%</span></button>' +
' <button type="button" data-command="75" title="' + lang.dialogBox.imageBox.resize75 + '"><span class="note-fontsize-10">75%</span></button>' +
' <button type="button" data-command="50" title="' + lang.dialogBox.imageBox.resize50 + '"><span class="note-fontsize-10">50%</span></button>' +
' <button type="button" data-command="25" title="' + lang.dialogBox.imageBox.resize25 + '"><span class="note-fontsize-10">25%</span></button>' +
' <button type="button" data-command="update" title="' + lang.toolbar.image + '" style="padding: 6px 10px !important;"><div class="ico_picture"></div></button>' +
'</div>' +
'<div class="btn-group remove">' +
' <button type="button" data-command="delete" title="' + lang.dialogBox.imageBox.remove + '"><span class="image_remove">x</span></button>' +
'</div>';
return resize_img_button;
toggle_caption_contenteditable: function (on, e) {
this.context.image._onCaption = on;
this.context.image._imageCaption.setAttribute('contenteditable', on);
this.context.image._imageCaption.focus();
},
call_controller_imageResize: function (targetElement) {
/** ie,firefox image resize handle : false*/
targetElement.setAttribute('unselectable', 'on');
targetElement.contentEditable = false;
const resizeDiv = this.context.image.imageResizeDiv;
const w = targetElement.offsetWidth;
const h = targetElement.offsetHeight;
let parentElement = targetElement.offsetParent;
let parentT = 0;
let parentL = 0;
while (parentElement) {
parentT += (parentElement.offsetTop + parentElement.clientTop);
parentL += (parentElement.offsetLeft + +parentElement.clientLeft);
parentElement = parentElement.offsetParent;
sizeRevert: function () {
const contextImage = this.context.image;
if (contextImage._origin_w) {
contextImage.imageX.value = contextImage._element_w = contextImage._origin_w;
contextImage.imageY.value = contextImage._element_h = contextImage._origin_h;
}
this.context.image._imageResize_parent_t = (this.context.tool.bar.offsetHeight + parentT);
this.context._imageResize_parent_l = parentL;
const t = (targetElement.offsetTop + this.context.image._imageResize_parent_t - this.context.element.wysiwygWindow.document.body.scrollTop);
const l = (targetElement.offsetLeft + parentL);
resizeDiv.style.top = t + 'px';
resizeDiv.style.left = l + 'px';
resizeDiv.style.width = w + 'px';
resizeDiv.style.height = h + 'px';
this.context.image.imageResizeBtn.style.top = (h + t) + 'px';
this.context.image.imageResizeBtn.style.left = l + 'px';
SUNEDITOR.dom.changeTxt(this.context.image.imageResizeDisplay, w + ' x ' + h);
this.context.image._imageElementLink = /^A$/i.test(targetElement.parentNode.nodeName) ? targetElement.parentNode : null;
this.context.image._imageElement = targetElement;
this.context.image._imageCaption = targetElement.nextSibling;
this.context.image._imageElement_w = w;
this.context.image._imageElement_h = h;
this.context.image._imageElement_t = t;
this.context.image._imageElement_l = l;
this.context.image.imageResizeDiv.style.display = 'block';
this.context.image.imageResizeBtn.style.display = 'block';
this.controllerArray = [this.context.image.imageResizeDiv, this.context.image.imageResizeBtn];
},
cancel_controller_imageResize: function () {
this.context.element.resizeBackground.style.display = 'none';
this.context.image.imageResizeDiv.style.display = 'none';
this.context.image.imageResizeBtn.style.display = 'none';
this.context.image._imageElement = null;
},
onClick_imageResizeBtn: function (e) {
e.stopPropagation();
const command = e.target.getAttribute('data-command') || e.target.parentNode.getAttribute('data-command');
if (!command) return;
e.preventDefault();
onModifyMode: function (element, size) {
const contextImage = this.context.image;
contextImage._elementLink = /^A$/i.test(element.parentNode.nodeName) ? element.parentNode : null;
contextImage._element = contextImage._resize_element = element;
contextImage._imageCaption = element.nextSibling;
if (/^\d+$/.test(command)) {
contextImage._imageElement.style.height = '';
contextImage._imageElement.style.width = command + '%';
}
else if (/update/.test(command)) {
contextImage.focusElement.value = contextImage._imageElement.src;
contextImage.altText.value = contextImage._imageElement.alt;
contextImage.imgLink.value = contextImage._imageElementLink === null ? '' : contextImage._imageElementLink.href;
contextImage.imgLinkNewWindowCheck.checked = !contextImage._imageElementLink || contextImage._imageElementLink.target === '_blank';
contextImage.modal.querySelector('#suneditor_image_radio_' + (contextImage._imageElement.getAttribute('data-align') || 'none')).checked = true;
contextImage._captionChecked = contextImage.caption.checked = !!contextImage._imageCaption;
contextImage.imageX.value = contextImage._imageElement.offsetWidth;
contextImage.imageY.value = contextImage._imageElement.offsetHeight;
this.context.image.imageY.disabled = false;
contextImage._element_w = size.w;
contextImage._element_h = size.h;
contextImage._element_t = size.t;
contextImage._element_l = size.l;
SUNEDITOR.plugin.dialog.openDialog.call(this, 'image', null, true);
let origin = contextImage._element.getAttribute('data-origin');
if (origin) {
origin = origin.split(',');
contextImage._origin_w = origin[0] * 1;
contextImage._origin_h = origin[1] * 1;
} else {
contextImage._origin_w = size.w;
contextImage._origin_h = size.h;
contextImage._element.setAttribute('data-origin', size.w + ',' + size.h);
}
else if (/delete/.test(command)) {
const imageContainer = SUNEDITOR.dom.getParentNode(contextImage._imageElement, '.sun-editor-id-image-container') || contextImage._imageElement;
SUNEDITOR.dom.removeItem(imageContainer);
}
this.submenuOff();
this.focus();
},
onMouseDown_image_ctrl: function (direction) {
const e = window.event;
e.stopPropagation();
e.preventDefault();
openModify: function () {
const contextImage = this.context.image;
contextImage.imgUrlFile.value = contextImage._element.src;
contextImage.altText.value = contextImage._element.alt;
contextImage.imgLink.value = contextImage._elementLink === null ? '' : contextImage._elementLink.href;
contextImage.imgLinkNewWindowCheck.checked = !contextImage._elementLink || contextImage._elementLink.target === '_blank';
contextImage.modal.querySelector('#suneditor_image_radio_' + (contextImage._element.getAttribute('data-align') || 'none')).checked = true;
contextImage._captionChecked = contextImage.caption.checked = !!contextImage._imageCaption;
contextImage.proportion.checked = contextImage._proportionChecked = contextImage._element.getAttribute('data-proportion') === 'true';
contextImage.imageX.value = contextImage._element.offsetWidth;
contextImage.imageY.value = contextImage._element.offsetHeight;
contextImage.imageY.disabled = false;
contextImage.proportion.disabled = false;
this.context.image._imageClientX = e.clientX;
this.context.element.resizeBackground.style.display = 'block';
this.context.image.imageResizeBtn.style.display = 'none';
SUNEDITOR.plugin.dialog.openDialog.call(this, 'image', null, true);
},
function closureFunc() {
SUNEDITOR.plugin.image.cancel_controller_imageResize.call(this);
document.removeEventListener('mousemove', resize_image_bind);
document.removeEventListener('mouseup', closureFunc_bind);
}
setSize: function (x, y) {
this.context.image._resize_element.style.width = x;
this.context.image._resize_element.style.height = y;
},
const resize_image_bind = SUNEDITOR.plugin.image.resize_image.bind(this, direction);
const closureFunc_bind = closureFunc.bind(this);
document.addEventListener('mousemove', resize_image_bind);
document.addEventListener('mouseup', closureFunc_bind);
destroy: function () {
const imageContainer = SUNEDITOR.dom.getParentNode(this.context.image._element, '.sun-editor-id-image-container') || this.context.image._element;
SUNEDITOR.dom.removeItem(imageContainer);
SUNEDITOR.plugin.image.init.call(this);
},
resize_image: function (direction) {
const e = window.event;
const w = this.context.image._imageElement_w + (direction === 'r' ? e.clientX - this.context.image._imageClientX : this.context.image._imageClientX - e.clientX);
const h = ((this.context.image._imageElement_h / this.context.image._imageElement_w) * w);
this.context.image._imageElement.style.width = w + 'px';
this.context.image._imageElement.style.height = h + 'px';
let parentElement = this.context.image._imageElement.offsetParent;
let parentL = 0;
while (parentElement) {
parentL += (parentElement.offsetLeft + parentElement.clientLeft);
parentElement = parentElement.offsetParent;
}
const t = (this.context.image._imageElement.offsetTop + this.context.image._imageResize_parent_t - this.context.element.wysiwygWindow.document.body.scrollTop);
const l = (this.context.image._imageElement.offsetLeft + parentL);
this.context.image.imageResizeDiv.style.top = t + 'px';
this.context.image.imageResizeDiv.style.left = l + 'px';
this.context.image.imageResizeDiv.style.width = w + 'px';
this.context.image.imageResizeDiv.style.height = h + 'px';
SUNEDITOR.dom.changeTxt(this.context.image.imageResizeDisplay, Math.round(w) + ' x ' + Math.round(h));
init: function () {
this.context.image.imgInputFile.value = '';
this.context.image.imgUrlFile.value = '';
this.context.image.altText.value = '';
this.context.image.imgLink.value = '';
this.context.image.imgLinkNewWindowCheck.checked = false;
this.context.image.modal.querySelector('#suneditor_image_radio_none').checked = true;
this.context.image.caption.checked = false;
this.context.image.proportion.checked = false;
this.context.image.imageX.value = this.context.user.imageSize;
this.context.image.imageY.value = '';
this.context.image.imageY.disabled = true;
this.context.image.proportion.disabled = true;
this.context.image._element = null;
SUNEDITOR.plugin.image.openTab.call(this, 'init');
}
};
};

@@ -11,4 +11,24 @@ /*

const context = _this.context;
context.video = {};
context.video = {
_coverElement: null,
_element: null,
_resize_element: null,
_element_w: 1,
_element_h: 1,
_element_l: 0,
_element_t: 0,
_origin_w: context.user.videoX,
_origin_h: context.user.videoY,
_proportionChecked: false,
_innerCover: document.createElement('SPAN')
};
/** Inner node needed to edit video iframe event */
context.video._innerCover.className = 'sun-editor-iframe-inner-cover';
context.video._innerCover.addEventListener('click', function (e) {
const pNode = e.target.parentNode;
const size = SUNEDITOR.plugin.dialog.call_controller_resize.call(this, pNode, 'video');
SUNEDITOR.plugin.video.onModifyMode.call(_this, pNode.children[0], size);
}.bind(_this));
/** video dialog */

@@ -20,2 +40,3 @@ const video_dialog = eval(this.setDialog());

context.video.videoY = video_dialog.getElementsByClassName('sun-editor-id-video-y')[0];
context.video.proportion = video_dialog.querySelector('#suneditor_video_check_proportion');

@@ -28,2 +49,5 @@ /** set user option value */

video_dialog.getElementsByClassName('btn-primary')[0].addEventListener('click', this.submit_dialog.bind(_this));
context.video.videoX.addEventListener('change', this.setInputSize.bind(_this, 'x'));
context.video.videoY.addEventListener('change', this.setInputSize.bind(_this, 'y'));
video_dialog.getElementsByClassName('sun-editor-id-video-revert-button')[0].addEventListener('click', this.sizeRevert.bind(_this));

@@ -56,3 +80,5 @@ /** append html */

' <div class="size-text"><label class="size-w">' + lang.dialogBox.width + '</label><label class="size-x">&nbsp;</label><label class="size-h">' + lang.dialogBox.height + '</label></div>' +
' <input type="text" class="form-size-control sun-editor-id-video-x" /><label class="size-x">x</label><input type="text" class="form-size-control sun-editor-id-video-y" />' +
' <input type="number" class="form-size-control sun-editor-id-video-x" /><label class="size-x">x</label><input type="number" class="form-size-control sun-editor-id-video-y" />' +
' <input type="checkbox" id="suneditor_video_check_proportion" style="margin-left: 20px;" disabled/><label for="suneditor_video_check_proportion">&nbsp;' + lang.dialogBox.proportion + '</label>' +
' <button type="button" title="' + lang.dialogBox.revertButton + '" class="btn_editor sun-editor-id-video-revert-button" style="float: right;"><div class="ico_revert"></div></button>' +
' </div>' +

@@ -68,2 +94,12 @@ ' </div>' +

setInputSize: function (xy) {
if (this.context.video.proportion.checked) {
if (xy === 'x') {
this.context.video.videoY.value = Math.round((this.context.video._element_h / this.context.video._element_w) * this.context.video.videoX.value);
} else {
this.context.video.videoX.value = Math.round((this.context.video._element_w / this.context.video._element_h) * this.context.video.videoY.value);
}
}
},
submit_dialog: function (e) {

@@ -78,26 +114,60 @@ this.showLoading();

let url = this.context.video.focusElement.value.replace(/^https?:/, '');
const oIframe = document.createElement('IFRAME');
const x_v = this.context.video.videoX.value;
const y_v = this.context.video.videoY.value;
const w = (/^\d+$/.test(this.context.video.videoX.value) ? this.context.video.videoX.value : this.context.user.videoX);
const h = (/^\d+$/.test(this.context.video.videoY.value) ? this.context.video.videoY.value : this.context.user.videoY);
let oIframe = null;
let url = this.context.video.focusElement.value.trim();
/** youtube */
if (/youtu\.?be/.test(url)) {
url = url.replace('watch?v=', '');
if (!/^\/\/.+\/embed\//.test(url)) {
url = url.replace(url.match(/^\/\/.+\//)[0], '//www.youtube.com/embed/');
/** iframe source */
if (/^\<iframe.*iframe\>$/.test(url)) {
oIframe = (new DOMParser()).parseFromString(url, 'text/html').getElementsByTagName('iframe')[0]
}
/** url */
else {
oIframe = document.createElement('IFRAME');
/** youtube */
if (/youtu\.?be/.test(url)) {
url = url.replace('watch?v=', '');
if (!/^\/\/.+\/embed\//.test(url)) {
url = url.replace(url.match(/\/\/.+\//)[0], '//www.youtube.com/embed/');
}
}
oIframe.src = url;
}
oIframe.src = url;
oIframe.width = (/^\d+$/.test(x_v) ? x_v : this.context.user.videoX);
oIframe.height = (/^\d+$/.test(y_v) ? y_v : this.context.user.videoY);
/** update */
if (this.context.dialog.updateModal) {
this.context.video._element.src = oIframe.src;
this.context.video._element.setAttribute('data-proportion', this.context.video._proportionChecked);
this.context.video._coverElement.style.width = w + 'px';
this.context.video._coverElement.style.height = h + 'px';
return;
}
/** create */
const coverSpan = document.createElement('SPAN');
coverSpan.className = 'sun-editor-iframe-cover';
coverSpan.style.width = w + 'px';
coverSpan.style.height = h + 'px';
coverSpan.setAttribute('contentEditable', false);
/** cover event */
coverSpan.addEventListener('mouseenter', SUNEDITOR.plugin.video.onMouseEnter_cover.bind(this));
coverSpan.addEventListener('mouseleave', SUNEDITOR.plugin.video.onMouseLeave_cover.bind(this).bind(this));
oIframe.width = '100%';
oIframe.height = '100%';
oIframe.frameBorder = '0';
oIframe.allowFullscreen = true;
oIframe.setAttribute('data-proportion', this.context.video._proportionChecked);
oIframe.contentDocument;
this.insertNode(oIframe);
this.appendP(oIframe);
this.context.video._coverElement = coverSpan;
coverSpan.appendChild(oIframe);
this.insertNode(coverSpan);
this.appendP(coverSpan);
}
try {
this.context.video._proportionChecked = this.context.video.proportion.checked;
submitAction.call(this);

@@ -112,2 +182,70 @@ } finally {

onMouseEnter_cover: function (e) {
const target = e.target;
if (target === this.context.video._innerCover.parentNode) return;
target.appendChild(this.context.video._innerCover);
},
onMouseLeave_cover: function (e) {
const target = e.target;
if (target === this.context.video._innerCover.parentNode) target.removeChild(this.context.video._innerCover);
},
sizeRevert: function () {
const contextVideo = this.context.video;
if (contextVideo._origin_w) {
contextVideo.videoX.value = contextVideo._element_w = contextVideo._origin_w;
contextVideo.videoY.value = contextVideo._element_h = contextVideo._origin_h;
}
},
onModifyMode: function (element, size) {
const videoContext = this.context.video;
const pSpan = videoContext._resize_element = videoContext._coverElement;
videoContext._element = element;
if (pSpan === videoContext._innerCover.parentNode) pSpan.removeChild(videoContext._innerCover);
videoContext._element_w = size.w;
videoContext._element_h = size.h;
videoContext._element_t = size.t;
videoContext._element_l = size.l;
let origin = videoContext._element.getAttribute('data-origin');
if (origin) {
origin = origin.split(',');
videoContext._origin_w = origin[0] * 1;
videoContext._origin_h = origin[1] * 1;
} else {
videoContext._origin_w = size.w;
videoContext._origin_h = size.h;
videoContext._element.setAttribute('data-origin', size.w + ',' + size.h);
}
},
openModify: function () {
const contextVideo = this.context.video;
const pSpan = contextVideo._coverElement;
const frame = pSpan.children[0];
contextVideo.focusElement.value = frame.src;
contextVideo.videoX.value = pSpan.style.width.match(/\d+/)[0];
contextVideo.videoY.value = pSpan.style.height.match(/\d+/)[0];
contextVideo.proportion.checked = contextVideo._proportionChecked = contextVideo._element.getAttribute('data-proportion') === 'true';
contextVideo.proportion.disabled = false;
SUNEDITOR.plugin.dialog.openDialog.call(this, 'video', null, true);
},
setSize: function (x, y) {
this.context.video._resize_element.style.width = x;
this.context.video._resize_element.style.height = y;
},
destroy: function () {
SUNEDITOR.dom.removeItem(this.context.video._coverElement);
SUNEDITOR.plugin.video.init.call(this);
},
init: function () {

@@ -117,3 +255,5 @@ this.context.video.focusElement.value = '';

this.context.video.videoY.value = this.context.user.videoY;
this.context.video.proportion.checked = false;
this.context.video.proportion.disabled = true;
}
};
};
"undefined"===typeof window.SUNEDITOR&&(window.SUNEDITOR={},SUNEDITOR.plugin={});
SUNEDITOR.defaultLang={toolbar:{font:"Font",formats:"Formats",fontSize:"Size",bold:"Bold",underline:"Underline",italic:"Italic",strike:"Strike",subscript:"Subscript",superscript:"Superscript",removeFormat:"Remove Format",fontColor:"Font Color",hiliteColor:"Hilite Color",indent:"Indent",outdent:"Outdent",align:"Align",alignLeft:"Align left",alignRight:"Align right",alignCenter:"Align center",justifyFull:"Justify full",list:"list",orderList:"Ordered list",unorderList:"Unordered list",line:"Line",table:"Table",
link:"Link",image:"Image",video:"Video",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",resize100:"resize 100%",resize75:"resize 75%",resize50:"resize 50%",resize25:"resize 25%",
remove:"remove image",caption:"Insert image description",altText:"Alternative text"},videoBox:{title:"Insert Video",url:"Media embed URL, YouTube"},submitButton:"Submit",width:"Width",height:"Height",basic:"Basic",left:"Left",right:"Right",center:"Center"},editLink:{edit:"Edit",remove:"Remove"}};
link:"Link",image:"Image",video:"Video",fullScreen:"Full screen",showBlocks:"Show blocks",codeView:"Code view",undo:"Undo",redo:"Redo",preview:"Preview",print:"print",tag_p:"Paragraph",tag_div:"Normal (DIV)",tag_h:"Header"},dialogBox:{linkBox:{title:"Insert Link",url:"URL to link",text:"Text to display",newWindowCheck:"Open in new window"},imageBox:{title:"Insert image",file:"Select from files",url:"Image URL",caption:"Insert image description",altText:"Alternative text"},videoBox:{title:"Insert Video",
url:"Media embed URL, YouTube"},resize100:"resize 100%",resize75:"resize 75%",resize50:"resize 50%",resize25:"resize 25%",remove:"remove",submitButton:"Submit",revertButton:"Revert",proportion:"constrain proportions",width:"Width",height:"Height",basic:"Basic",left:"Left",right:"Right",center:"Center"},editLink:{edit:"Edit",remove:"Remove"}};
(function(){function z(a){var d="";a=document.createRange().createContextualFragment(a.trim()).childNodes;for(var e=0,b=a.length;e<b;e++){var f=a[e].outerHTML||a[e].textContent;d=/^(?:P|TABLE|H[1-6]|DIV)$/i.test(a[e].tagName)?d+f:d+("<P>"+f+"</p>")}0===d.length&&(d="<p>&#65279</p>");return d}function B(a){var d='<div class="sun-editor-id-toolbar-cover"></div>',e=null;var b=SUNEDITOR.lang;b={font:["btn_font",b.toolbar.font,"font","submenu","",'<span class="txt sun-editor-font-family">'+b.toolbar.font+

@@ -25,43 +25,44 @@ '</span><span class="ico_more"></span>'],formats:["btn_format",b.toolbar.formats,"formatBlock","submenu","",'<span class="txt">'+b.toolbar.formats+'</span><span class="ico_more"></span>'],fontSize:["btn_size",b.toolbar.fontSize,"fontSize","submenu","",'<span class="txt sun-editor-font-size">'+b.toolbar.fontSize+'</span><span class="ico_more"></span>'],bold:["sun-editor-id-bold",b.toolbar.bold+"(Ctrl+B)","bold","","",'<div class="ico_bold"></div>'],underline:["sun-editor-id-underline",b.toolbar.underline+

"function"===typeof d&&d():this._callBack_addModule(c,a,b,d):e.includeFile("text/javascript",g+"/"+a+".js",this._callBack_addModule.bind(this,c,a,b,d))},_callBack_addModule:function(c,a,b,d){this.context[c]||(this.context[c]={});SUNEDITOR.plugin[a].add(this,b);this.loadedPlugins[a]=!0;"function"===typeof d&&d()},submenuOn:function(c){this.submenu=c.nextElementSibling;this.submenu.style.display="block";d.addClass(c,"on");this.submenuActiveButton=c},submenuOff:function(){this.submenu&&(this.submenu.style.display=
"none",this.submenu=null,d.removeClass(this.submenuActiveButton,"on"),this.submenuActiveButton=null);this.controllersOff()},controllersOff:function(){var c=this.controllerArray.length;if(0<c){for(var a=0;a<c;a++)this.controllerArray[a].style.display="none";this.controllerArray=[]}},execCommand:function(c,b,d){a.element.wysiwygWindow.document.execCommand(c,b,d)},focus:function(){var c=d.getParentNode(this._variable.selectionNode,"figcaption");c?c.focus():a.element.wysiwygWindow.document.body.focus()},
_setSelectionNode:function(){this._variable.copySelection=e.copyObj(this.getSelection());var c=this.getRange();this._variable.selectionNode=c.startContainer!==c.endContainer?c.startContainer:this.getSelectionNode()},isEdgePoint:function(c,a){return 0===a||a===c.nodeValue.length},createRange:function(){return a.element.wysiwygWindow.document.createRange()},getSelection:function(){return a.element.wysiwygWindow.getSelection()},getSelectionNode:function(){return this.getSelection().extentNode||this.getSelection().anchorNode},
getRange:function(){var c=this.getSelection();if(0<c.rangeCount)var b=c.getRangeAt(0);else b=this.createRange(),(c=this._variable.copySelection)?(b.setStart(c.anchorNode,c.anchorOffset),b.setEnd(c.focusNode,c.focusOffset)):(c=a.element.wysiwygWindow.document.body.firstChild,b.setStart(c,0),b.setEnd(c,0));return b},setRange:function(c,a,b,d){var g=this.createRange();g.setStart(c,a);g.setEnd(b,d);c=this.getSelection();0<c.rangeCount&&c.removeAllRanges();c.addRange(g)},showLoading:function(){a.element.loading.style.display=
"block"},closeLoading:function(){a.element.loading.style.display="none"},getLineElement:function(c){c=c||this._variable.selectionNode;if(!c||/^HTML$/i.test(c.tagName))c=a.element.wysiwygWindow.document.body.firstChild;else for(;!/^BODY$/i.test(c.parentNode.tagName);)c=c.parentNode;return c},appendP:function(c){var a=document.createElement("P");a.innerHTML="&#65279";c=this.getLineElement(c);c.parentNode.insertBefore(a,c.nextElementSibling);return a},insertNode:function(c,a){if(a){var b=a.parentNode;
a=a.nextSibling}else{var d=this.getSelection();b=this.getRange();var g=b.startContainer,e=b.startOffset,f=b.endContainer,k=b.endOffset;b=g;3===g.nodeType&&(b=g.parentNode);if(g===f&&e===k)d.focusNode&&3===d.focusNode.nodeType?a=d.focusNode.splitText(k):(null!==b.lastChild&&/^BR$/i.test(b.lastChild.nodeName)&&b.removeChild(b.lastChild),a=null);else if(g===f)d=g,this.isEdgePoint(f,k)||(a=f.splitText(k)),this.isEdgePoint(g,e)||(d=g.splitText(e)),b.removeChild(d);else for(d.deleteFromDocument?d.deleteFromDocument():
this.removeNode(),a=f;1!==a.nodeType;)a=a.parentNode}try{b.insertBefore(c,a)}catch(m){b.appendChild(c)}},removeNode:function(){var c=this.getRange(),a=c.startContainer,b=c.startOffset,e=c.endContainer,f=c.endOffset;c=d.getListChildNodes(c.commonAncestorContainer);var r=d.getArrayIndex(c,a),l=d.getArrayIndex(c,e);var k=r+1;for(var m=a;0<=k;k--)c[k]===m.parentNode&&c[k].firstChild===m&&0===b&&(r=k,m=m.parentNode);k=l-1;for(m=e;k>r;k--)c[k]===m.parentNode&&1===c[k].nodeType&&(c.splice(k,1),m=m.parentNode,
--l);for(;r<=l;r++)k=c[r],0===k.length||3===k.nodeType&&void 0===k.data?d.removeItem(k):k===a?(k=1===a.nodeType?document.createTextNode(a.textContent):document.createTextNode(a.substringData(0,b)),0<k.length?a.data=k.data:d.removeItem(a)):k===e?(k=1===e.nodeType?document.createTextNode(e.textContent):document.createTextNode(e.substringData(f,e.length-f)),0<k.length?e.data=k.data:d.removeItem(e)):d.removeItem(k)},wrapRangeToTag:function(c,a){var b=this.getRange(),g=b.startContainer,e=b.startOffset,
f=b.endContainer,l=b.endOffset,k=b.commonAncestorContainer;b={};var m={},q;if(a){var h="(?:;|^|\\s)(?:"+a[0];for(q=1;q<a.length;q++)h+="|"+a[q];h+=")\\s*:[^;]*\\s*(?:;|$)";h=new RegExp(h,"gi")}if(g===f){q=c.cloneNode(!1);if(e===l)q.innerHTML="&nbsp;",g.parentNode.insertBefore(q,g.nextSibling);else{f=document.createTextNode(g.substringData(0,e));var w=document.createTextNode(g.substringData(l,g.length-l));q.innerText=g.substringData(e,l-e);g.parentNode.insertBefore(q,g.nextSibling);g.data=0<f.data.length?
f.data:g.substringData(0,e);0<w.data.length&&g.parentNode.insertBefore(w,q.nextSibling)}b.container=q;b.offset=0;m.container=q;m.offset=1}else if(w=function(a){if(3===a.nodeType)return!0;var b="";h&&0<a.style.cssText.length&&(b=a.style.cssText.replace(h,"").trim());return a.nodeName!==c.nodeName||0<b.length?(0<a.style.cssText.length&&(a.style.cssText=b),!0):!1},/BODY/i.test(k.nodeName)){m=d.getListChildren(k,function(a){return/^P$/i.test(a.nodeName)});var y=d.getParentNode(g,"P");k=d.getParentNode(f,
"P");b=0;for(q=m.length;b<q;b++)if(y===m[b])y=b;else if(k===m[b]){k=b;break}q=c.cloneNode(!1);b=this._wrapLineNodesStart(m[y],q,w,g,e);for(g=y+1;g<k;g++)q=c.cloneNode(!1),this._wrapLineNodes(m[g],q,w);q=c.cloneNode(!1);m=this._wrapLineNodesEnd(m[k],q,w,f,l)}else q=c.cloneNode(!1),l=this._wrapLineNodesPart(k,q,w,g,e,f,l),b.container=l.startContainer,b.offset=l.startOffset,m.container=l.endContainer,m.offset=l.endOffset;this.setRange(b.container,b.offset,m.container,m.offset)},_wrapLineNodesPart:function(a,
b,e,f,n,r,l){var c=[],g=f,p=n,h=r,u=l,y=!1,A=!1,v,t,x;(function D(f,k){for(var q=f.childNodes,l=0,r=q.length;l<r&&!A;l++){var m=q[l];if(y&&m!==h&&3===m.nodeType){for(v=[];t!==a&&null!==t;)e(t)&&1===t.nodeType&&v.push(t.cloneNode(!1)),t=t.parentNode;if(0<v.length){for(x=t=v.pop();0<v.length;)t=v.pop(),x.appendChild(t);b.appendChild(x);k=t}else k=b;k.appendChild(m.cloneNode(!1));c.push(m)}if(m===g){var n=document.createTextNode(g.substringData(0,p)),w=document.createTextNode(g.substringData(p,g.length-
p));0<n.length?g.data=n.data:c.push(g);t=m;for(v=[];t!==a&&null!==t;)e(t)&&1===t.nodeType&&v.push(t.cloneNode(!1)),t=t.parentNode;for(x=t=v.pop()||m;0<v.length;)t=v.pop(),x.appendChild(t);x!==m?(b.appendChild(x),k=t):k=b;g=w;p=0;k.appendChild(g);y=!0}else{if(m===h){q=document.createTextNode(h.substringData(u,h.length-u));l=document.createTextNode(h.substringData(0,u));r=t=m;for(v=[];t!==a&&null!==t;)e(t)&&1===t.nodeType&&v.push(t.cloneNode(!1)),r=t,t=t.parentNode;for(x=t=v.pop()||m;0<v.length;)t=
v.pop(),x.appendChild(t);x!==m?(b.appendChild(x),k=t):k=b;0<q.length?h.data=q.data:c.push(h);h=l;u=l.length;k.appendChild(h);for(a.insertBefore(b,r);0<c.length;){m=c.pop();for(m.data="";m.parentNode&&0===m.parentNode.innerText.length;)m=m.parentNode;d.removeItem(m)}A=!0;break}D(m)}}})(a);return{startContainer:g,startOffset:p,endContainer:h,endOffset:u}},_wrapLineNodes:function(a,b,d){(function l(a,c){for(var b=a.childNodes,g=0,e=b.length;g<e;g++){var p=b[g],f=c;if(d(p)){var r=p.cloneNode(!1);c.appendChild(r);
1===p.nodeType&&(f=r)}l(p,f)}})(a,b);a.innerHTML="";a.appendChild(b)},_wrapLineNodesStart:function(a,b,e,f,n){var c=document.createElement("P"),g=f,p=n,m=!1,q,h,u;(function t(d,f){for(var k=d.childNodes,l=0,r=k.length;l<r;l++){var n=k[l],v=f;if(m){if(1===n.nodeType){t(n,n);continue}h=n;for(q=[];null!==h.parentNode&&h!==a&&h!==b;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;if(0<q.length){for(u=h=q.pop();0<q.length;)h=q.pop(),u.appendChild(h);b.appendChild(u);f=h}else f=b}if(m||n!==
g){if(!m||e(n)){var w=n.cloneNode(!1);f.appendChild(w);1===n.nodeType&&(v=w)}t(n,v)}else{n=document.createTextNode(g.substringData(0,p));v=document.createTextNode(g.substringData(p,g.length-p));0<n.data.length&&f.appendChild(n);h=f;for(q=[];h!==c&&null!==h;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;for(u=h=q.pop()||f;0<q.length;)h=q.pop(),u.appendChild(h);u!==f?(b.appendChild(u),f=h):f=b;c.appendChild(b);g=v;p=0;m=!0;f.appendChild(g)}}})(a,c);a.parentNode.insertBefore(c,a);d.removeItem(a);
return{container:g,offset:p}},_wrapLineNodesEnd:function(a,b,e,f,n){var c=document.createElement("P"),g=f,p=n,m=!1,q,h,u;(function t(d,f){for(var k=d.childNodes,n=k.length-1;0<=n;n--){var l=k[n],r=f;if(m){if(1===l.nodeType){t(l,l);continue}h=l;for(q=[];null!==h.parentNode&&h!==a&&h!==b;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;if(0<q.length){for(u=h=q.pop();0<q.length;)h=q.pop(),u.insertBefore(h,u.firstChild);b.insertBefore(u,b.firstChild);f=h}else f=b}if(m||l!==g){if(!m||e(l)){var v=
l.cloneNode(!1);f.insertBefore(v,f.firstChild);1===l.nodeType&&(r=v)}t(l,r)}else{l=document.createTextNode(g.substringData(p,g.length-p));r=document.createTextNode(g.substringData(0,p));0<l.data.length&&f.insertBefore(l,f.firstChild);h=f;for(q=[];h!==c&&null!==h;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;for(u=h=q.pop()||f;0<q.length;)h=q.pop(),u.insertBefore(h,u.firstChild);u!==f?(b.insertBefore(u,b.firstChild),f=h):f=b;c.insertBefore(b,c.firstChild);g=r;p=r.data.length;m=!0;f.insertBefore(g,
f.firstChild)}}})(a,c);a.parentNode.insertBefore(c,a);d.removeItem(a);return{container:g,offset:p}},indent:function(a,b){var c=d.getParentNode(a,"P");if(c){var g=/\d+/.test(c.style.marginLeft)?1*c.style.marginLeft.match(/\d+/)[0]:0;g="indent"===b?g+25:g-25;c.style.marginLeft=(0>g?0:g)+"px"}},showBlocks:function(){SUNEDITOR.dom.toggleClass(a.element.wysiwygWindow.document.body,"sun-editor-show-block")},showCodeView:function(){if(this._variable.wysiwygActive)a.element.code.value=a.element.wysiwygWindow.document.body.innerHTML.trim().replace(/<\/p>(?=[^\n])/gi,
"</p>\n"),a.element.wysiwygElement.style.display="none",a.element.code.style.display="block",this._variable.wysiwygActive=!1;else{var b={"&amp;":"&","&nbsp;":"\u00a0","&lt;":"<","&gt;":">"},d=a.element.code.value.replace(/&[a-z]+;/g,function(a){return"string"===typeof b[a]?b[a]:a});a.element.wysiwygWindow.document.body.innerHTML=0<d.trim().length?d:"<p>&#65279</p>";a.element.wysiwygWindow.document.body.scrollTop=0;a.element.code.style.display="none";a.element.wysiwygElement.style.display="block";
this._variable.wysiwygActive=!0}},toggleFullScreen:function(b){this._variable.isFullScreen?(a.element.topArea.style.cssText=this._variable.originCssText,a.element.editorArea.style.height=this._variable.editorHeight+"px",d.removeClass(b.firstElementChild,"ico_full_screen_i"),d.addClass(b.firstElementChild,"ico_full_screen_e")):(a.element.topArea.style.position="fixed",a.element.topArea.style.top="0",a.element.topArea.style.left="0",a.element.topArea.style.width="100%",a.element.topArea.style.height=
"100%",this._variable.innerHeight_fullScreen=window.innerHeight-a.tool.bar.offsetHeight,a.element.editorArea.style.height=this._variable.innerHeight_fullScreen+"px",d.removeClass(b.firstElementChild,"ico_full_screen_e"),d.addClass(b.firstElementChild,"ico_full_screen_i"));this._variable.isFullScreen=!this._variable.isFullScreen},preview:function(){var b=window.open("","_blank");b.mimeType="text/html";b.document.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1"><title>'+
SUNEDITOR.lang.toolbar.preview+'</title><link rel="stylesheet" type="text/css" href="'+e.getBasePath+'css/suneditor-contents.css">';b.document.body.className="sun-editor-editable";b.document.body.innerHTML=a.element.wysiwygWindow.document.body.innerHTML}},f={_shortcutKeyCode:{66:["bold","B"],83:["strikethrough","STRIKE"],85:["underline","U"],73:["italic","I"],89:["redo"],90:["undo"],219:["outdent"],221:["indent"]},_directionKeyKeyCode:/^(?:8|13|32|46|33|34|35|36|37|38|39|40|98|100|102|104)$/,_findButtonEffectTag:function(){for(var c=
b._variable.selectionNode,g=!0,f=!0,e=!0,n="B|U|I|STRIKE|FONT|SIZE|SUB|SUP|",r=new RegExp(n,"i"),l;!/^(?:P|BODY|HTML|DIV)$/i.test(c.nodeName);){if(3!==c.nodeType){var k=[/^STRONG$/.test(c.nodeName)?"B":/^EM/.test(c.nodeName)?"I":c.nodeName];g&&1===c.nodeType&&(0<c.style.fontFamily.length||c.face&&0<c.face.length)&&(k.push("FONT"),g=(c.style.fontFamily||c.face||SUNEDITOR.lang.toolbar.font).replace(/["']/g,""),d.changeTxt(b.commandMap.FONT,g),g=!1,n=n.replace("FONT|",""),r=new RegExp(n,"i"));e&&/^A$/i.test(c.nodeName)&&
null===c.getAttribute("data-image-link")?(a.link&&b.controllerArray[0]===a.link.linkBtn||b.callModule("dialog","link",null,function(){SUNEDITOR.plugin.link.call_controller_linkButton.call(b,c)}),e=!1):e&&a.link&&b.controllerArray[0]===a.link.linkBtn&&b.controllersOff();f&&0<c.style.fontSize.length&&(d.changeTxt(b.commandMap.SIZE,c.style.fontSize.match(/\d+/)[0]),f=!1,n=n.replace("SIZE|",""),r=new RegExp(n,"i"));l=c.style.cssText;/:\s*bold(?:;|\s)/.test(l)&&k.push("B");/:\s*underline(?:;|\s)/.test(l)&&
k.push("U");/:\s*italic(?:;|\s)/.test(l)&&k.push("I");/:\s*line-through(?:;|\s)/.test(l)&&k.push("STRIKE");for(l=0;l<k.length;l++)r.test(k[l])&&(d.addClass(b.commandMap[k[l]],"on"),n=n.replace(k[l]+"|",""),r=new RegExp(n,"i"))}c=c.parentNode}e&&b.controllersOff();n=n.split("|");f=0;for(e=n.length-1;f<e;f++)/^FONT/i.test(n[f])?d.changeTxt(b.commandMap[n[f]],SUNEDITOR.lang.toolbar.font):/^SIZE$/i.test(n[f])?d.changeTxt(b.commandMap[n[f]],SUNEDITOR.lang.toolbar.fontSize):d.removeClass(b.commandMap[n[f]],
"on")},resize_window:function(){b._variable.isFullScreen&&(b._variable.innerHeight_fullScreen+=window.innerHeight-a.tool.bar.offsetHeight-b._variable.innerHeight_fullScreen,a.element.editorArea.style.height=b._variable.innerHeight_fullScreen+"px")},touchstart_toolbar:function(){b._variable.isTouchMove=!1},touchmove_toolbar:function(){b._variable.isTouchMove=!0},onClick_toolbar:function(c){if(b._variable.isTouchMove)return!0;for(var g=c.target,f=g.getAttribute("data-display"),e=g.getAttribute("data-command"),
n=g.className;!e&&!/editor_tool/.test(n)&&!/sun-editor-id-toolbar/.test(n);)g=g.parentNode,e=g.getAttribute("data-command"),f=g.getAttribute("data-display"),n=g.className;if(!e&&!f)return!0;c.preventDefault();c.stopPropagation();b.focus();if(f)c=b.submenu,b.submenuOff(),!/submenu/.test(f)||null!==g.nextElementSibling&&g.nextElementSibling===c?/dialog/.test(f)&&b.callModule("dialog",e,null,function(){SUNEDITOR.plugin.dialog.openDialog.call(b,e,g.getAttribute("data-option"),!1)}):b.callModule("submenu",
e,g,function(){b.submenuOn(g)});else{if(e)switch(e){case "codeView":b.showCodeView();d.toggleClass(g,"on");break;case "fullScreen":b.toggleFullScreen(g);d.toggleClass(g,"on");break;case "indent":case "outdent":b.indent(b._variable.selectionNode,e);break;case "redo":case "undo":case "removeFormat":b.execCommand(e,!1,null);break;case "preview":b.preview();break;case "print":a.element.wysiwygWindow.print();break;case "showBlocks":b.showBlocks();d.toggleClass(g,"on");break;default:b.execCommand(e,!1,
g.getAttribute("data-value")),d.toggleClass(g,"on"),/^subscript$/.test(e)?SUNEDITOR.dom.removeClass(a.tool.superscript,"on"):/^superscript$/.test(e)&&SUNEDITOR.dom.removeClass(a.tool.subscript,"on")}b.submenuOff()}},onMouseUp_wysiwyg:function(a){a.stopPropagation();b._setSelectionNode();var c=a.target;b.submenuOff();/^HTML$/i.test(c.nodeName)?(a.preventDefault(),b.focus()):/^IMG$/i.test(c.nodeName)?(a.preventDefault(),b.callModule("dialog","image",null,function(){SUNEDITOR.plugin.image.call_controller_imageResize.call(b,
c)})):f._findButtonEffectTag()},onKeyDown_wysiwyg:function(c){b._setSelectionNode();var g=c.keyCode,e=c.shiftKey,u=c.ctrlKey||c.metaKey,n=c.altKey;c.stopPropagation();if(u&&!/^(?:16|17|18)$/.test(g)){var r;if(r=!(e&&83!==g))(r=f._shortcutKeyCode[g])?(b.execCommand(r[0],!1,null),d.toggleClass(b.commandMap[r[1]],"on"),r=!0):r=!1;if(r){c.preventDefault();return}}switch(g){case 8:if(/^P$/i.test(b._variable.selectionNode.tagName)&&null===b._variable.selectionNode.previousSibling)return c.preventDefault(),
!1;break;case 9:if(c.preventDefault(),!u&&!n){for(c=b._variable.selectionNode||b.getSelection().anchorNode;!/^TD$/i.test(c.tagName)&&!/^BODY$/i.test(c.tagName);)c=c.parentNode;if(c&&/^TD$/i.test(c.tagName)){g=d.getParentNode(c,"table");g=d.getListChildren(g,d.isCell);c=e?d.prevIdx(g,c):d.nextIdx(g,c);c!==g.length||e||(c=0);-1===c&&e&&(c=g.length-1);c=g[c];if(!c)return!1;e=b.createRange();e.setStart(c,0);e.setEnd(c,0);c=b.getSelection();0<c.rangeCount&&c.removeAllRanges();c.addRange(e)}else e||(e=
a.element.wysiwygWindow.document.createTextNode(Array(b._variable.tabSize+1).join("\u00a0")),b.insertNode(e,null),c=b.getSelection(),g=b.createRange(),g.setStart(e,b._variable.tabSize),g.setEnd(e,b._variable.tabSize),0<c.rangeCount&&c.removeAllRanges(),c.addRange(g))}}},onKeyUp_wysiwyg:function(a){b._setSelectionNode();f._directionKeyKeyCode.test(a.keyCode)&&f._findButtonEffectTag()},onScroll_wysiwyg:function(){b.controllersOff()},onDrop_wysiwyg:function(a){var c=a.dataTransfer.files;if(0===c.length)return!0;
a.stopPropagation();a.preventDefault();b.focus();b.callModule("dialog","image",null,function(){b.context.image.imgInputFile.files=c;SUNEDITOR.plugin.image.onRender_imgInput.call(b);b.context.image.imgInputFile.files=null})},onMouseDown_resizeBar:function(c){function d(){a.element.resizeBackground.style.display="none";document.removeEventListener("mousemove",f.resize_editor);document.removeEventListener("mouseup",d)}c.stopPropagation();b._variable.resizeClientY=c.clientY;a.element.resizeBackground.style.display=
"block";document.addEventListener("mousemove",f.resize_editor);document.addEventListener("mouseup",d)},resize_editor:function(c){var d=c.clientY-b._variable.resizeClientY;a.element.editorArea.style.height=a.element.editorArea.offsetHeight+d+"px";b._variable.editorHeight=a.element.editorArea.offsetHeight+d;b._variable.resizeClientY=c.clientY}};a.tool.bar.addEventListener("touchstart",f.touchstart_toolbar);a.tool.bar.addEventListener("touchmove",f.touchmove_toolbar);a.tool.bar.addEventListener("touchend",
f.onClick_toolbar);a.tool.bar.addEventListener("click",f.onClick_toolbar);a.element.wysiwygWindow.addEventListener("mouseup",f.onMouseUp_wysiwyg);a.element.wysiwygWindow.addEventListener("keydown",f.onKeyDown_wysiwyg);a.element.wysiwygWindow.addEventListener("keyup",f.onKeyUp_wysiwyg);a.element.wysiwygWindow.addEventListener("scroll",f.onScroll_wysiwyg);a.element.wysiwygWindow.addEventListener("drop",f.onDrop_wysiwyg);a.element.resizebar.addEventListener("mousedown",f.onMouseDown_resizeBar);window.addEventListener("resize",
f.resize_window);return{save:function(){a.element.textElement.innerHTML=b._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML:a.element.code.value},getContent:function(){var c="";return 0===a.element.wysiwygWindow.document.body.innerText.trim().length?c:c=b._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML:a.element.code.value},setContent:function(c){c=z(c);b._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML=c:a.element.code.value=c},
appendContent:function(c){if(b._variable.wysiwygActive){var d=document.createElement("P");d.innerHTML=c;a.element.wysiwygWindow.document.body.appendChild(d)}else a.element.code.value+=c},disabled:function(){a.tool.cover.style.display="block";a.element.wysiwygWindow.document.body.setAttribute("contenteditable",!1)},enabled:function(){a.tool.cover.style.display="none";a.element.wysiwygWindow.document.body.setAttribute("contenteditable",!0)},show:function(){var c=a.element.topArea.style;c.cssText=b._variable.originCssText;
"none"===c.display&&(c.display="block")},hide:function(){a.element.topArea.style.display="none"},destroy:function(){a.element.topArea.parentNode.removeChild(a.element.topArea);a.element.textElement.style.display="";this.destroy=this.hide=this.show=this.enabled=this.disabled=this.appendContent=this.setContent=this.getContent=this.save=null}}};SUNEDITOR.lang=SUNEDITOR.lang||SUNEDITOR.defaultLang;SUNEDITOR.create=function(a,d){var e=document.getElementById(a);if(null===e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+
a+'")');var b=C(e,d);if(document.getElementById(b.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+b.constructed._top.id+'")');e.style.display="none";"object"===typeof e.nextElementSibling?e.parentNode.insertBefore(b.constructed._top,e.nextElementSibling):e.parentNode.appendChild(b.constructed._top);var f=b.constructed;b=b.options;e={element:{textElement:e,topArea:f._top,relative:f._relative,resizebar:f._resizeBar,editorArea:f._editorArea,
wysiwygWindow:f._editorArea.getElementsByClassName("sun-editor-id-wysiwyg")[0].contentWindow,wysiwygElement:f._editorArea.getElementsByClassName("sun-editor-id-wysiwyg")[0],code:f._editorArea.getElementsByClassName("sun-editor-id-code")[0],loading:f._loading,resizeBackground:f._resizeBack},tool:{bar:f._toolBar,cover:f._toolBar.getElementsByClassName("sun-editor-id-toolbar-cover")[0],bold:f._toolBar.getElementsByClassName("sun-editor-id-bold")[0],underline:f._toolBar.getElementsByClassName("sun-editor-id-underline")[0],
italic:f._toolBar.getElementsByClassName("sun-editor-id-italic")[0],strike:f._toolBar.getElementsByClassName("sun-editor-id-strike")[0],subscript:f._toolBar.getElementsByClassName("sun-editor-id-subscript")[0],superscript:f._toolBar.getElementsByClassName("sun-editor-id-superscript")[0],font:f._toolBar.getElementsByClassName("sun-editor-font-family")[0],fontSize:f._toolBar.getElementsByClassName("sun-editor-font-size")[0]},user:{videoX:b.videoX,videoY:b.videoY,imageFileInput:b.imageFileInput,imageUrlInput:b.imageUrlInput,
imageSize:b.imageSize,imageUploadUrl:b.imageUploadUrl,addFont:b.addFont,fontList:b.fontList,fontSizeList:b.fontSizeList,height:b.height.match(/\d+/)[0]}};return E(e,SUNEDITOR.dom,SUNEDITOR.util)};SUNEDITOR.destroy=function(a){var d=document.getElementById("suneditor_"+a);d.parentNode.removeChild(d);document.getElementById(a).style.display=""}})();
"none",this.submenu=null,d.removeClass(this.submenuActiveButton,"on"),this.submenuActiveButton=null);a.image&&a.image._onCaption&&SUNEDITOR.plugin.image.toggle_caption_contenteditable.call(b,!1);this.controllersOff()},controllersOff:function(){var c=this.controllerArray.length;if(0<c){for(var a=0;a<c;a++)this.controllerArray[a].style.display="none";this.controllerArray=[]}},execCommand:function(c,b,d){a.element.wysiwygWindow.document.execCommand(c,b,d)},focus:function(){var c=d.getParentNode(this._variable.selectionNode,
"figcaption");c?c.focus():a.element.wysiwygWindow.document.body.focus()},_setSelectionNode:function(){this._variable.copySelection=e.copyObj(this.getSelection());var c=this.getRange();this._variable.selectionNode=c.startContainer!==c.endContainer?c.startContainer:this.getSelectionNode()},isEdgePoint:function(c,a){return 0===a||a===c.nodeValue.length},createRange:function(){return a.element.wysiwygWindow.document.createRange()},getSelection:function(){return a.element.wysiwygWindow.getSelection()},
getSelectionNode:function(){return this.getSelection().extentNode||this.getSelection().anchorNode},getRange:function(){var c=this.getSelection();if(0<c.rangeCount)var b=c.getRangeAt(0);else b=this.createRange(),(c=this._variable.copySelection)?(b.setStart(c.anchorNode,c.anchorOffset),b.setEnd(c.focusNode,c.focusOffset)):(c=a.element.wysiwygWindow.document.body.firstChild,b.setStart(c,0),b.setEnd(c,0));return b},setRange:function(c,a,b,d){var g=this.createRange();g.setStart(c,a);g.setEnd(b,d);c=this.getSelection();
0<c.rangeCount&&c.removeAllRanges();c.addRange(g)},showLoading:function(){a.element.loading.style.display="block"},closeLoading:function(){a.element.loading.style.display="none"},getLineElement:function(c){c=c||this._variable.selectionNode;if(!c||/^HTML$/i.test(c.tagName))c=a.element.wysiwygWindow.document.body.firstChild;else for(;!/^BODY$/i.test(c.parentNode.tagName);)c=c.parentNode;return c},appendP:function(c){var a=document.createElement("P");a.innerHTML="&#65279";c=this.getLineElement(c);c.parentNode.insertBefore(a,
c.nextElementSibling);return a},insertNode:function(c,a){if(a){var b=a.parentNode;a=a.nextSibling}else{var d=this.getSelection();b=this.getRange();var g=b.startContainer,e=b.startOffset,f=b.endContainer,k=b.endOffset;b=g;3===g.nodeType&&(b=g.parentNode);if(g===f&&e===k)d.focusNode&&3===d.focusNode.nodeType?a=d.focusNode.splitText(k):(null!==b.lastChild&&/^BR$/i.test(b.lastChild.nodeName)&&b.removeChild(b.lastChild),a=null);else if(g===f)d=g,this.isEdgePoint(f,k)||(a=f.splitText(k)),this.isEdgePoint(g,
e)||(d=g.splitText(e)),b.removeChild(d);else for(d.deleteFromDocument?d.deleteFromDocument():this.removeNode(),a=f;1!==a.nodeType;)a=a.parentNode}try{b.insertBefore(c,a)}catch(m){b.appendChild(c)}},removeNode:function(){var c=this.getRange(),a=c.startContainer,b=c.startOffset,e=c.endContainer,f=c.endOffset;c=d.getListChildNodes(c.commonAncestorContainer);var r=d.getArrayIndex(c,a),l=d.getArrayIndex(c,e);var k=r+1;for(var m=a;0<=k;k--)c[k]===m.parentNode&&c[k].firstChild===m&&0===b&&(r=k,m=m.parentNode);
k=l-1;for(m=e;k>r;k--)c[k]===m.parentNode&&1===c[k].nodeType&&(c.splice(k,1),m=m.parentNode,--l);for(;r<=l;r++)k=c[r],0===k.length||3===k.nodeType&&void 0===k.data?d.removeItem(k):k===a?(k=1===a.nodeType?document.createTextNode(a.textContent):document.createTextNode(a.substringData(0,b)),0<k.length?a.data=k.data:d.removeItem(a)):k===e?(k=1===e.nodeType?document.createTextNode(e.textContent):document.createTextNode(e.substringData(f,e.length-f)),0<k.length?e.data=k.data:d.removeItem(e)):d.removeItem(k)},
wrapRangeToTag:function(c,a){var b=this.getRange(),g=b.startContainer,e=b.startOffset,f=b.endContainer,l=b.endOffset,k=b.commonAncestorContainer;b={};var m={},q;if(a){var h="(?:;|^|\\s)(?:"+a[0];for(q=1;q<a.length;q++)h+="|"+a[q];h+=")\\s*:[^;]*\\s*(?:;|$)";h=new RegExp(h,"gi")}if(g===f){q=c.cloneNode(!1);if(e===l)q.innerHTML="&nbsp;",g.parentNode.insertBefore(q,g.nextSibling);else{f=document.createTextNode(g.substringData(0,e));var w=document.createTextNode(g.substringData(l,g.length-l));q.innerText=
g.substringData(e,l-e);g.parentNode.insertBefore(q,g.nextSibling);g.data=0<f.data.length?f.data:g.substringData(0,e);0<w.data.length&&g.parentNode.insertBefore(w,q.nextSibling)}b.container=q;b.offset=0;m.container=q;m.offset=1}else if(w=function(a){if(3===a.nodeType)return!0;var b="";h&&0<a.style.cssText.length&&(b=a.style.cssText.replace(h,"").trim());return a.nodeName!==c.nodeName||0<b.length?(0<a.style.cssText.length&&(a.style.cssText=b),!0):!1},/BODY/i.test(k.nodeName)){m=d.getListChildren(k,
function(a){return/^P$/i.test(a.nodeName)});var y=d.getParentNode(g,"P");k=d.getParentNode(f,"P");b=0;for(q=m.length;b<q;b++)if(y===m[b])y=b;else if(k===m[b]){k=b;break}q=c.cloneNode(!1);b=this._wrapLineNodesStart(m[y],q,w,g,e);for(g=y+1;g<k;g++)q=c.cloneNode(!1),this._wrapLineNodes(m[g],q,w);q=c.cloneNode(!1);m=this._wrapLineNodesEnd(m[k],q,w,f,l)}else q=c.cloneNode(!1),l=this._wrapLineNodesPart(k,q,w,g,e,f,l),b.container=l.startContainer,b.offset=l.startOffset,m.container=l.endContainer,m.offset=
l.endOffset;this.setRange(b.container,b.offset,m.container,m.offset)},_wrapLineNodesPart:function(a,b,e,f,n,r,l){var c=[],g=f,p=n,h=r,u=l,y=!1,A=!1,v,t,x;(function D(f,k){for(var q=f.childNodes,l=0,r=q.length;l<r&&!A;l++){var m=q[l];if(y&&m!==h&&3===m.nodeType){for(v=[];t!==a&&null!==t;)e(t)&&1===t.nodeType&&v.push(t.cloneNode(!1)),t=t.parentNode;if(0<v.length){for(x=t=v.pop();0<v.length;)t=v.pop(),x.appendChild(t);b.appendChild(x);k=t}else k=b;k.appendChild(m.cloneNode(!1));c.push(m)}if(m===g){var n=
document.createTextNode(g.substringData(0,p)),w=document.createTextNode(g.substringData(p,g.length-p));0<n.length?g.data=n.data:c.push(g);t=m;for(v=[];t!==a&&null!==t;)e(t)&&1===t.nodeType&&v.push(t.cloneNode(!1)),t=t.parentNode;for(x=t=v.pop()||m;0<v.length;)t=v.pop(),x.appendChild(t);x!==m?(b.appendChild(x),k=t):k=b;g=w;p=0;k.appendChild(g);y=!0}else{if(m===h){q=document.createTextNode(h.substringData(u,h.length-u));l=document.createTextNode(h.substringData(0,u));r=t=m;for(v=[];t!==a&&null!==t;)e(t)&&
1===t.nodeType&&v.push(t.cloneNode(!1)),r=t,t=t.parentNode;for(x=t=v.pop()||m;0<v.length;)t=v.pop(),x.appendChild(t);x!==m?(b.appendChild(x),k=t):k=b;0<q.length?h.data=q.data:c.push(h);h=l;u=l.length;k.appendChild(h);for(a.insertBefore(b,r);0<c.length;){m=c.pop();for(m.data="";m.parentNode&&0===m.parentNode.innerText.length;)m=m.parentNode;d.removeItem(m)}A=!0;break}D(m)}}})(a);return{startContainer:g,startOffset:p,endContainer:h,endOffset:u}},_wrapLineNodes:function(a,b,d){(function l(a,c){for(var b=
a.childNodes,g=0,e=b.length;g<e;g++){var p=b[g],f=c;if(d(p)){var r=p.cloneNode(!1);c.appendChild(r);1===p.nodeType&&(f=r)}l(p,f)}})(a,b);a.innerHTML="";a.appendChild(b)},_wrapLineNodesStart:function(a,b,e,f,n){var c=document.createElement("P"),g=f,p=n,m=!1,q,h,u;(function t(d,f){for(var k=d.childNodes,l=0,r=k.length;l<r;l++){var n=k[l],v=f;if(m){if(1===n.nodeType){t(n,n);continue}h=n;for(q=[];null!==h.parentNode&&h!==a&&h!==b;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;if(0<q.length){for(u=
h=q.pop();0<q.length;)h=q.pop(),u.appendChild(h);b.appendChild(u);f=h}else f=b}if(m||n!==g){if(!m||e(n)){var w=n.cloneNode(!1);f.appendChild(w);1===n.nodeType&&(v=w)}t(n,v)}else{n=document.createTextNode(g.substringData(0,p));v=document.createTextNode(g.substringData(p,g.length-p));0<n.data.length&&f.appendChild(n);h=f;for(q=[];h!==c&&null!==h;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;for(u=h=q.pop()||f;0<q.length;)h=q.pop(),u.appendChild(h);u!==f?(b.appendChild(u),f=h):f=b;c.appendChild(b);
g=v;p=0;m=!0;f.appendChild(g)}}})(a,c);a.parentNode.insertBefore(c,a);d.removeItem(a);return{container:g,offset:p}},_wrapLineNodesEnd:function(a,b,e,f,n){var c=document.createElement("P"),g=f,p=n,m=!1,q,h,u;(function t(d,f){for(var k=d.childNodes,n=k.length-1;0<=n;n--){var l=k[n],r=f;if(m){if(1===l.nodeType){t(l,l);continue}h=l;for(q=[];null!==h.parentNode&&h!==a&&h!==b;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;if(0<q.length){for(u=h=q.pop();0<q.length;)h=q.pop(),u.insertBefore(h,
u.firstChild);b.insertBefore(u,b.firstChild);f=h}else f=b}if(m||l!==g){if(!m||e(l)){var v=l.cloneNode(!1);f.insertBefore(v,f.firstChild);1===l.nodeType&&(r=v)}t(l,r)}else{l=document.createTextNode(g.substringData(p,g.length-p));r=document.createTextNode(g.substringData(0,p));0<l.data.length&&f.insertBefore(l,f.firstChild);h=f;for(q=[];h!==c&&null!==h;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;for(u=h=q.pop()||f;0<q.length;)h=q.pop(),u.insertBefore(h,u.firstChild);u!==f?(b.insertBefore(u,
b.firstChild),f=h):f=b;c.insertBefore(b,c.firstChild);g=r;p=r.data.length;m=!0;f.insertBefore(g,f.firstChild)}}})(a,c);a.parentNode.insertBefore(c,a);d.removeItem(a);return{container:g,offset:p}},indent:function(a,b){var c=d.getParentNode(a,"P");if(c){var g=/\d+/.test(c.style.marginLeft)?1*c.style.marginLeft.match(/\d+/)[0]:0;g="indent"===b?g+25:g-25;c.style.marginLeft=(0>g?0:g)+"px"}},showBlocks:function(){SUNEDITOR.dom.toggleClass(a.element.wysiwygWindow.document.body,"sun-editor-show-block")},
showCodeView:function(){if(this._variable.wysiwygActive)a.element.code.value=a.element.wysiwygWindow.document.body.innerHTML.trim().replace(/<\/p>(?=[^\n])/gi,"</p>\n"),a.element.wysiwygElement.style.display="none",a.element.code.style.display="block",this._variable.wysiwygActive=!1;else{var b={"&amp;":"&","&nbsp;":"\u00a0","&lt;":"<","&gt;":">"},d=a.element.code.value.replace(/&[a-z]+;/g,function(a){return"string"===typeof b[a]?b[a]:a});a.element.wysiwygWindow.document.body.innerHTML=0<d.trim().length?
d:"<p>&#65279</p>";a.element.wysiwygWindow.document.body.scrollTop=0;a.element.code.style.display="none";a.element.wysiwygElement.style.display="block";this._variable.wysiwygActive=!0}},toggleFullScreen:function(b){this._variable.isFullScreen?(a.element.topArea.style.cssText=this._variable.originCssText,a.element.editorArea.style.height=this._variable.editorHeight+"px",d.removeClass(b.firstElementChild,"ico_full_screen_i"),d.addClass(b.firstElementChild,"ico_full_screen_e")):(a.element.topArea.style.position=
"fixed",a.element.topArea.style.top="0",a.element.topArea.style.left="0",a.element.topArea.style.width="100%",a.element.topArea.style.height="100%",this._variable.innerHeight_fullScreen=window.innerHeight-a.tool.bar.offsetHeight,a.element.editorArea.style.height=this._variable.innerHeight_fullScreen+"px",d.removeClass(b.firstElementChild,"ico_full_screen_e"),d.addClass(b.firstElementChild,"ico_full_screen_i"));this._variable.isFullScreen=!this._variable.isFullScreen},preview:function(){var b=window.open("",
"_blank");b.mimeType="text/html";b.document.head.innerHTML='<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1"><title>'+SUNEDITOR.lang.toolbar.preview+'</title><link rel="stylesheet" type="text/css" href="'+e.getBasePath+'css/suneditor-contents.css">';b.document.body.className="sun-editor-editable";b.document.body.innerHTML=a.element.wysiwygWindow.document.body.innerHTML}},f={_shortcutKeyCode:{66:["bold","B"],83:["strikethrough","STRIKE"],85:["underline","U"],
73:["italic","I"],89:["redo"],90:["undo"],219:["outdent"],221:["indent"]},_directionKeyKeyCode:/^(?:8|13|32|46|33|34|35|36|37|38|39|40|98|100|102|104)$/,_findButtonEffectTag:function(){for(var c=b._variable.selectionNode,g=!0,f=!0,e=!0,n="B|U|I|STRIKE|FONT|SIZE|SUB|SUP|",r=new RegExp(n,"i"),l;!/^(?:P|BODY|HTML|DIV)$/i.test(c.nodeName);){if(3!==c.nodeType){var k=[/^STRONG$/.test(c.nodeName)?"B":/^EM/.test(c.nodeName)?"I":c.nodeName];g&&1===c.nodeType&&(0<c.style.fontFamily.length||c.face&&0<c.face.length)&&
(k.push("FONT"),g=(c.style.fontFamily||c.face||SUNEDITOR.lang.toolbar.font).replace(/["']/g,""),d.changeTxt(b.commandMap.FONT,g),g=!1,n=n.replace("FONT|",""),r=new RegExp(n,"i"));e&&/^A$/i.test(c.nodeName)&&null===c.getAttribute("data-image-link")?(a.link&&b.controllerArray[0]===a.link.linkBtn||b.callModule("dialog","link",null,function(){SUNEDITOR.plugin.link.call_controller_linkButton.call(b,c)}),e=!1):e&&a.link&&b.controllerArray[0]===a.link.linkBtn&&b.controllersOff();f&&0<c.style.fontSize.length&&
(d.changeTxt(b.commandMap.SIZE,c.style.fontSize.match(/\d+/)[0]),f=!1,n=n.replace("SIZE|",""),r=new RegExp(n,"i"));l=c.style.cssText;/:\s*bold(?:;|\s)/.test(l)&&k.push("B");/:\s*underline(?:;|\s)/.test(l)&&k.push("U");/:\s*italic(?:;|\s)/.test(l)&&k.push("I");/:\s*line-through(?:;|\s)/.test(l)&&k.push("STRIKE");for(l=0;l<k.length;l++)r.test(k[l])&&(d.addClass(b.commandMap[k[l]],"on"),n=n.replace(k[l]+"|",""),r=new RegExp(n,"i"))}c=c.parentNode}e&&b.controllersOff();n=n.split("|");f=0;for(e=n.length-
1;f<e;f++)/^FONT/i.test(n[f])?d.changeTxt(b.commandMap[n[f]],SUNEDITOR.lang.toolbar.font):/^SIZE$/i.test(n[f])?d.changeTxt(b.commandMap[n[f]],SUNEDITOR.lang.toolbar.fontSize):d.removeClass(b.commandMap[n[f]],"on")},resize_window:function(){b._variable.isFullScreen&&(b._variable.innerHeight_fullScreen+=window.innerHeight-a.tool.bar.offsetHeight-b._variable.innerHeight_fullScreen,a.element.editorArea.style.height=b._variable.innerHeight_fullScreen+"px")},touchstart_toolbar:function(){b._variable.isTouchMove=
!1},touchmove_toolbar:function(){b._variable.isTouchMove=!0},onClick_toolbar:function(c){if(b._variable.isTouchMove)return!0;for(var g=c.target,f=g.getAttribute("data-display"),e=g.getAttribute("data-command"),n=g.className;!e&&!/editor_tool/.test(n)&&!/sun-editor-id-toolbar/.test(n);)g=g.parentNode,e=g.getAttribute("data-command"),f=g.getAttribute("data-display"),n=g.className;if(!e&&!f)return!0;c.preventDefault();c.stopPropagation();b.submenuOff();b.focus();if(f)c=b.submenu,b.submenuOff(),!/submenu/.test(f)||
null!==g.nextElementSibling&&g.nextElementSibling===c?/dialog/.test(f)&&b.callModule("dialog",e,null,function(){SUNEDITOR.plugin.dialog.openDialog.call(b,e,g.getAttribute("data-option"),!1)}):b.callModule("submenu",e,g,function(){b.submenuOn(g)});else if(e)switch(e){case "codeView":b.showCodeView();d.toggleClass(g,"on");break;case "fullScreen":b.toggleFullScreen(g);d.toggleClass(g,"on");break;case "indent":case "outdent":b.indent(b._variable.selectionNode,e);break;case "redo":case "undo":case "removeFormat":b.execCommand(e,
!1,null);break;case "preview":b.preview();break;case "print":a.element.wysiwygWindow.print();break;case "showBlocks":b.showBlocks();d.toggleClass(g,"on");break;default:b.execCommand(e,!1,g.getAttribute("data-value")),d.toggleClass(g,"on"),/^subscript$/.test(e)?SUNEDITOR.dom.removeClass(a.tool.superscript,"on"):/^superscript$/.test(e)&&SUNEDITOR.dom.removeClass(a.tool.subscript,"on")}},onMouseUp_wysiwyg:function(a){a.stopPropagation();var c=a.target;b.submenuOff();/^HTML$/i.test(c.nodeName)?(a.preventDefault(),
b.focus()):/^IMG$/i.test(c.nodeName)?(a.preventDefault(),b.callModule("dialog","image",null,function(){var a=SUNEDITOR.plugin.dialog.call_controller_resize.call(b,c,"image");SUNEDITOR.plugin.image.onModifyMode.call(b,c,a)})):(b._setSelectionNode(),f._findButtonEffectTag())},onKeyDown_wysiwyg:function(c){b._setSelectionNode();var g=c.keyCode,e=c.shiftKey,u=c.ctrlKey||c.metaKey,n=c.altKey;c.stopPropagation();if(u&&!/^(?:16|17|18)$/.test(g)){var r;if(r=!(e&&83!==g))(r=f._shortcutKeyCode[g])?(b.execCommand(r[0],
!1,null),d.toggleClass(b.commandMap[r[1]],"on"),r=!0):r=!1;if(r){c.preventDefault();return}}switch(g){case 8:if(/^P$/i.test(b._variable.selectionNode.tagName)&&null===b._variable.selectionNode.previousSibling)return c.preventDefault(),!1;break;case 9:if(c.preventDefault(),!u&&!n){for(c=b._variable.selectionNode||b.getSelection().anchorNode;!/^TD$/i.test(c.tagName)&&!/^BODY$/i.test(c.tagName);)c=c.parentNode;if(c&&/^TD$/i.test(c.tagName)){g=d.getParentNode(c,"table");g=d.getListChildren(g,d.isCell);
c=e?d.prevIdx(g,c):d.nextIdx(g,c);c!==g.length||e||(c=0);-1===c&&e&&(c=g.length-1);c=g[c];if(!c)return!1;e=b.createRange();e.setStart(c,0);e.setEnd(c,0);c=b.getSelection();0<c.rangeCount&&c.removeAllRanges();c.addRange(e)}else e||(e=a.element.wysiwygWindow.document.createTextNode(Array(b._variable.tabSize+1).join("\u00a0")),b.insertNode(e,null),c=b.getSelection(),g=b.createRange(),g.setStart(e,b._variable.tabSize),g.setEnd(e,b._variable.tabSize),0<c.rangeCount&&c.removeAllRanges(),c.addRange(g))}}},
onKeyUp_wysiwyg:function(a){b._setSelectionNode();f._directionKeyKeyCode.test(a.keyCode)&&f._findButtonEffectTag()},onScroll_wysiwyg:function(){b.controllersOff()},onDrop_wysiwyg:function(a){var c=a.dataTransfer.files;if(0===c.length)return!0;a.stopPropagation();a.preventDefault();b.focus();b.callModule("dialog","image",null,function(){b.context.image.imgInputFile.files=c;SUNEDITOR.plugin.image.onRender_imgInput.call(b);b.context.image.imgInputFile.files=null})},onMouseDown_resizeBar:function(c){function d(){a.element.resizeBackground.style.display=
"none";document.removeEventListener("mousemove",f.resize_editor);document.removeEventListener("mouseup",d)}c.stopPropagation();b._variable.resizeClientY=c.clientY;a.element.resizeBackground.style.display="block";document.addEventListener("mousemove",f.resize_editor);document.addEventListener("mouseup",d)},resize_editor:function(c){var d=c.clientY-b._variable.resizeClientY;a.element.editorArea.style.height=a.element.editorArea.offsetHeight+d+"px";b._variable.editorHeight=a.element.editorArea.offsetHeight+
d;b._variable.resizeClientY=c.clientY}};a.tool.bar.addEventListener("touchstart",f.touchstart_toolbar);a.tool.bar.addEventListener("touchmove",f.touchmove_toolbar);a.tool.bar.addEventListener("touchend",f.onClick_toolbar);a.tool.bar.addEventListener("click",f.onClick_toolbar);a.element.wysiwygWindow.addEventListener("mouseup",f.onMouseUp_wysiwyg);a.element.wysiwygWindow.addEventListener("keydown",f.onKeyDown_wysiwyg);a.element.wysiwygWindow.addEventListener("keyup",f.onKeyUp_wysiwyg);a.element.wysiwygWindow.addEventListener("scroll",
f.onScroll_wysiwyg);a.element.wysiwygWindow.addEventListener("drop",f.onDrop_wysiwyg);a.element.resizebar.addEventListener("mousedown",f.onMouseDown_resizeBar);window.addEventListener("resize",f.resize_window);return{save:function(){a.element.textElement.innerHTML=b._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML:a.element.code.value},getContent:function(){var c="";return 0===a.element.wysiwygWindow.document.body.innerText.trim().length?c:c=b._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML:
a.element.code.value},setContent:function(c){c=z(c);b._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML=c:a.element.code.value=c},appendContent:function(c){if(b._variable.wysiwygActive){var d=document.createElement("P");d.innerHTML=c;a.element.wysiwygWindow.document.body.appendChild(d)}else a.element.code.value+=c},disabled:function(){a.tool.cover.style.display="block";a.element.wysiwygWindow.document.body.setAttribute("contenteditable",!1)},enabled:function(){a.tool.cover.style.display=
"none";a.element.wysiwygWindow.document.body.setAttribute("contenteditable",!0)},show:function(){var c=a.element.topArea.style;c.cssText=b._variable.originCssText;"none"===c.display&&(c.display="block")},hide:function(){a.element.topArea.style.display="none"},destroy:function(){a.element.topArea.parentNode.removeChild(a.element.topArea);a.element.textElement.style.display="";this.destroy=this.hide=this.show=this.enabled=this.disabled=this.appendContent=this.setContent=this.getContent=this.save=null}}};
SUNEDITOR.lang=SUNEDITOR.lang||SUNEDITOR.defaultLang;SUNEDITOR.create=function(a,d){var e=document.getElementById(a);if(null===e)throw Error('[SUNEDITOR.create.fail] The element for that id was not found (ID:"'+a+'")');var b=C(e,d);if(document.getElementById(b.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+b.constructed._top.id+'")');e.style.display="none";"object"===typeof e.nextElementSibling?e.parentNode.insertBefore(b.constructed._top,
e.nextElementSibling):e.parentNode.appendChild(b.constructed._top);var f=b.constructed;b=b.options;e={element:{textElement:e,topArea:f._top,relative:f._relative,resizebar:f._resizeBar,editorArea:f._editorArea,wysiwygWindow:f._editorArea.getElementsByClassName("sun-editor-id-wysiwyg")[0].contentWindow,wysiwygElement:f._editorArea.getElementsByClassName("sun-editor-id-wysiwyg")[0],code:f._editorArea.getElementsByClassName("sun-editor-id-code")[0],loading:f._loading,resizeBackground:f._resizeBack},tool:{bar:f._toolBar,
cover:f._toolBar.getElementsByClassName("sun-editor-id-toolbar-cover")[0],bold:f._toolBar.getElementsByClassName("sun-editor-id-bold")[0],underline:f._toolBar.getElementsByClassName("sun-editor-id-underline")[0],italic:f._toolBar.getElementsByClassName("sun-editor-id-italic")[0],strike:f._toolBar.getElementsByClassName("sun-editor-id-strike")[0],subscript:f._toolBar.getElementsByClassName("sun-editor-id-subscript")[0],superscript:f._toolBar.getElementsByClassName("sun-editor-id-superscript")[0],font:f._toolBar.getElementsByClassName("sun-editor-font-family")[0],
fontSize:f._toolBar.getElementsByClassName("sun-editor-font-size")[0]},user:{videoX:b.videoX,videoY:b.videoY,imageFileInput:b.imageFileInput,imageUrlInput:b.imageUrlInput,imageSize:b.imageSize,imageUploadUrl:b.imageUploadUrl,addFont:b.addFont,fontList:b.fontList,fontSizeList:b.fontSizeList,height:b.height.match(/\d+/)[0]}};return E(e,SUNEDITOR.dom,SUNEDITOR.util)};SUNEDITOR.destroy=function(a){var d=document.getElementById("suneditor_"+a);d.parentNode.removeChild(d);document.getElementById(a).style.display=
""}})();

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc