suneditor
Advanced tools
Comparing version 1.6.2 to 1.7.0
{ | ||
"name": "suneditor", | ||
"version": "1.6.2", | ||
"version": "1.7.0", | ||
"description": "Pure JavaScript based WYSIWYG web editor", | ||
@@ -34,2 +34,2 @@ "main": "src/suneditor.js", | ||
] | ||
} | ||
} |
{ | ||
"name": "suneditor", | ||
"version": "1.6.2", | ||
"version": "1.7.0", | ||
"description": "Pure JavaScript based WYSIWYG web editor", | ||
@@ -36,2 +36,2 @@ "main": "src/suneditor.js", | ||
} | ||
} | ||
} |
@@ -10,15 +10,15 @@ /* | ||
add: function (_this) { | ||
var context = _this.context; | ||
const context = _this.context; | ||
/** dialog */ | ||
var dialog_div = document.createElement("DIV"); | ||
dialog_div.className = "sun-editor-id-dialogBox"; | ||
const dialog_div = document.createElement('DIV'); | ||
dialog_div.className = 'sun-editor-id-dialogBox'; | ||
var dialog_back = document.createElement("DIV"); | ||
dialog_back.className = "modal-dialog-background sun-editor-id-dialog-back"; | ||
dialog_back.style.display = "none"; | ||
const dialog_back = document.createElement('DIV'); | ||
dialog_back.className = 'modal-dialog-background sun-editor-id-dialog-back'; | ||
dialog_back.style.display = 'none'; | ||
var dialog_area = document.createElement("DIV"); | ||
dialog_area.className = "modal-dialog sun-editor-id-dialog-modal"; | ||
dialog_area.style.display = "none"; | ||
const dialog_area = document.createElement('DIV'); | ||
dialog_area.className = 'modal-dialog sun-editor-id-dialog-modal'; | ||
dialog_area.style.display = 'none'; | ||
@@ -40,3 +40,3 @@ dialog_div.appendChild(dialog_back); | ||
if (/modal-dialog/.test(e.target.className) || /close/.test(e.target.getAttribute("data-command"))) { | ||
if (/modal-dialog/.test(e.target.className) || /close/.test(e.target.getAttribute('data-command'))) { | ||
SUNEDITOR.plugin.dialog.closeDialog.call(this); | ||
@@ -52,5 +52,5 @@ } | ||
if (option === 'full') { | ||
this.context.dialog.modalArea.style.position = "fixed"; | ||
this.context.dialog.modalArea.style.position = 'fixed'; | ||
} else { | ||
this.context.dialog.modalArea.style.position = "absolute"; | ||
this.context.dialog.modalArea.style.position = 'absolute'; | ||
} | ||
@@ -60,8 +60,8 @@ | ||
this.modalForm = this.context[kind].modal; | ||
var focusElement = this.context[kind].focusElement; | ||
const focusElement = this.context[kind].focusElement; | ||
this.context.dialog.modalArea.style.display = "block"; | ||
this.context.dialog.back.style.display = "block"; | ||
this.context.dialog.modal.style.display = "block"; | ||
this.modalForm.style.display = "block"; | ||
this.context.dialog.modalArea.style.display = 'block'; | ||
this.context.dialog.back.style.display = 'block'; | ||
this.context.dialog.modal.style.display = 'block'; | ||
this.modalForm.style.display = 'block'; | ||
@@ -72,5 +72,5 @@ if (focusElement) focusElement.focus(); | ||
closeDialog: function () { | ||
this.modalForm.style.display = "none"; | ||
this.context.dialog.back.style.display = "none"; | ||
this.context.dialog.modalArea.style.display = "none"; | ||
this.modalForm.style.display = 'none'; | ||
this.context.dialog.back.style.display = 'none'; | ||
this.context.dialog.modalArea.style.display = 'none'; | ||
this.modalForm = null; | ||
@@ -77,0 +77,0 @@ this.context.dialog.updateModal = false; |
@@ -10,3 +10,3 @@ /* | ||
add: function (_this) { | ||
var context = _this.context; | ||
const context = _this.context; | ||
context.image = { | ||
@@ -30,3 +30,3 @@ _imageElementLink: null, | ||
/** image dialog */ | ||
var image_dialog = eval(this.setDialog(_this.context.user)); | ||
const image_dialog = eval(this.setDialog(_this.context.user)); | ||
context.image.modal = image_dialog; | ||
@@ -45,7 +45,7 @@ context.image.focusElement = image_dialog.getElementsByClassName('sun-editor-id-image-url')[0]; | ||
/** image resize controller, button */ | ||
var resize_img_div = eval(this.setController_ImageResizeController()); | ||
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]; | ||
var resize_img_button = eval(this.setController_ImageButton()); | ||
const resize_img_button = eval(this.setController_ImageButton()); | ||
context.image.imageResizeBtn = resize_img_button; | ||
@@ -55,3 +55,3 @@ | ||
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)); | ||
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')); | ||
@@ -71,8 +71,8 @@ resize_img_div.getElementsByClassName('sun-editor-img-controller')[1].addEventListener('mousedown', this.onMouseDown_image_ctrl.bind(_this, 'r')); | ||
setDialog: function (user) { | ||
var lang = SUNEDITOR.lang; | ||
var dialog = document.createElement('DIV'); | ||
const lang = SUNEDITOR.lang; | ||
const dialog = document.createElement('DIV'); | ||
dialog.className = 'modal-content sun-editor-id-dialog-image'; | ||
dialog.style.display = 'none'; | ||
var html = '' + | ||
let html = '' + | ||
'<div class="modal-header">' + | ||
@@ -146,3 +146,3 @@ ' <button type="button" data-command="close" class="close" aria-label="Close">' + | ||
openTab: function (e) { | ||
var targetElement = (e === 'init' ? document.getElementsByClassName('sun-editor-id-tab-link')[0] : e.target); | ||
const targetElement = (e === 'init' ? document.getElementsByClassName('sun-editor-id-tab-link')[0] : e.target); | ||
@@ -154,5 +154,5 @@ if (!/^BUTTON$/i.test(targetElement.tagName)) { | ||
// Declare all variables | ||
var i, tabcontent, tablinks; | ||
var tabName = targetElement.getAttribute('data-tab-link'); | ||
var contentClassName = 'sun-editor-id-tab-content'; | ||
const tabName = targetElement.getAttribute('data-tab-link'); | ||
const contentClassName = 'sun-editor-id-tab-content'; | ||
let i, tabcontent, tablinks; | ||
@@ -190,19 +190,18 @@ // Get all elements with class="tabcontent" and hide them | ||
if (files.length > 0) { | ||
var imageUploadUrl = this.context.user.imageUploadUrl; | ||
var filesLen = this.context.dialog.updateModal ? 1 : files.length; | ||
var i; | ||
const imageUploadUrl = this.context.user.imageUploadUrl; | ||
const filesLen = this.context.dialog.updateModal ? 1 : files.length; | ||
if (imageUploadUrl !== null && imageUploadUrl.length > 0) { | ||
var formData = new FormData(); | ||
const formData = new FormData(); | ||
for (i = 0; i < filesLen; i++) { | ||
formData.append("file-" + i, files[i]); | ||
for (let i = 0; i < filesLen; i++) { | ||
formData.append('file-' + i, files[i]); | ||
} | ||
SUNEDITOR.plugin.image.xmlHttp = SUNEDITOR.func.getXMLHttpRequest(); | ||
SUNEDITOR.plugin.image.xmlHttp = SUNEDITOR.util.getXMLHttpRequest(); | ||
SUNEDITOR.plugin.image.xmlHttp.onreadystatechange = SUNEDITOR.plugin.image.callBack_imgUpload.bind(this, this.context.image._linkValue, this.context.image.imgLinkNewWindowCheck.checked, this.context.image.imageX.value + 'px', this.context.image._align, this.context.dialog.updateModal); | ||
SUNEDITOR.plugin.image.xmlHttp.open("post", imageUploadUrl, true); | ||
SUNEDITOR.plugin.image.xmlHttp.open('post', imageUploadUrl, true); | ||
SUNEDITOR.plugin.image.xmlHttp.send(formData); | ||
} else { | ||
for (i = 0; i < filesLen; i++) { | ||
for (let i = 0; i < filesLen; i++) { | ||
SUNEDITOR.plugin.image.setup_reader.call(this, files[i], this.context.image._linkValue, this.context.image.imgLinkNewWindowCheck.checked, this.context.dialog.updateModal); | ||
@@ -223,3 +222,3 @@ } | ||
setup_reader: function (file, imgLinkValue, newWindowCheck, update) { | ||
var reader = new FileReader(); | ||
const reader = new FileReader(); | ||
@@ -234,14 +233,12 @@ reader.onload = function (update) { | ||
callBack_imgUpload: function (linkValue, linkNewWindow, width, align, update) { | ||
var xmlHttp = SUNEDITOR.plugin.image.xmlHttp; | ||
const xmlHttp = SUNEDITOR.plugin.image.xmlHttp; | ||
if (xmlHttp.readyState === 4) { | ||
if (xmlHttp.status === 200) { | ||
var result = eval(xmlHttp.responseText); | ||
var resultLen = update && result.length > 0 ? 1 : result.length; | ||
const result = eval(xmlHttp.responseText); | ||
for (var i = 0; i < resultLen; i++) { | ||
for (let i = 0, len = (update && result.length > 0 ? 1 : result.length); i < len; i++) { | ||
SUNEDITOR.plugin.image.create_image.call(this, result[i].SUNEDITOR_IMAGE_SRC, linkValue, linkNewWindow, width, align, update); | ||
} | ||
} else { | ||
var WindowObject = window.open('', "_blank"); | ||
WindowObject.document.writeln(xmlHttp.responseText); | ||
window.open('', '_blank').document.writeln(xmlHttp.responseText); | ||
} | ||
@@ -266,5 +263,5 @@ | ||
if (imgLinkValue.trim().length > 0) { | ||
var link = document.createElement("A"); | ||
link.href = /^https?:\/\//.test(imgLinkValue) ? imgLinkValue : "http://" + imgLinkValue; | ||
link.target = (newWindowCheck ? "_blank" : ""); | ||
const link = document.createElement('A'); | ||
link.href = /^https?:\/\//.test(imgLinkValue) ? imgLinkValue : 'http://' + imgLinkValue; | ||
link.target = (newWindowCheck ? '_blank' : ''); | ||
link.setAttribute('data-image-link', 'image'); | ||
@@ -327,5 +324,5 @@ link.addEventListener('click', function (e) { e.preventDefault(); }); | ||
var oImg = document.createElement("IMG"); | ||
var cover = document.createElement("FIGURE"); | ||
var container = document.createElement("DIV"); | ||
let oImg = document.createElement('IMG'); | ||
const cover = document.createElement('FIGURE'); | ||
const container = document.createElement('DIV'); | ||
@@ -343,3 +340,3 @@ oImg.src = src; | ||
if (this.context.image._captionChecked) { | ||
var caption = document.createElement("FIGCAPTION"); | ||
const caption = document.createElement('FIGCAPTION'); | ||
caption.innerHTML = '<p></p>'; | ||
@@ -366,7 +363,7 @@ caption.setAttribute('contenteditable', true); | ||
update_image: function () { | ||
var contextImage = this.context.image; | ||
var linkValue = contextImage._linkValue; | ||
var container = SUNEDITOR.dom.getParentNode(contextImage._imageElement, '.sun-editor-id-image-container') || contextImage._imageElement; | ||
var cover = SUNEDITOR.dom.getParentNode(contextImage._imageElement, '.sun-editor-image-cover'); | ||
var newEl; | ||
const contextImage = this.context.image; | ||
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'); | ||
let newEl; | ||
@@ -390,3 +387,3 @@ if (contextImage.imgInputFile.value.length === 0 && contextImage.focusElement.value.trim().length === 0) { | ||
if (contextImage._imageCaption === null) { | ||
var caption = document.createElement("FIGCAPTION"); | ||
const caption = document.createElement('FIGCAPTION'); | ||
caption.innerHTML = '<p></p>'; | ||
@@ -426,3 +423,3 @@ caption.setAttribute('contenteditable', true); | ||
else if (contextImage._imageElementLink !== null) { | ||
var imageElement = contextImage._imageElement; | ||
const imageElement = contextImage._imageElement; | ||
@@ -441,6 +438,6 @@ 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.imgInputFile.value = ''; | ||
this.context.image.focusElement.value = ''; | ||
this.context.image.altText.value = ''; | ||
this.context.image.imgLink.value = ''; | ||
this.context.image.imgLinkNewWindowCheck.checked = false; | ||
@@ -457,5 +454,5 @@ this.context.image.modal.querySelector('#suneditor_image_radio_none').checked = true; | ||
setController_ImageResizeController: function () { | ||
var resize_img_div = document.createElement("DIV"); | ||
resize_img_div.className = "modal-image-resize"; | ||
resize_img_div.style.display = "none"; | ||
const resize_img_div = document.createElement('DIV'); | ||
resize_img_div.className = 'modal-image-resize'; | ||
resize_img_div.style.display = 'none'; | ||
resize_img_div.innerHTML = '' + | ||
@@ -472,4 +469,4 @@ '<div class="image-resize-dot tl"></div>' + | ||
setController_ImageButton: function () { | ||
var lang = SUNEDITOR.lang; | ||
var resize_img_button = document.createElement("DIV"); | ||
const lang = SUNEDITOR.lang; | ||
const resize_img_button = document.createElement("DIV"); | ||
resize_img_button.className = "image-resize-btn"; | ||
@@ -497,9 +494,9 @@ resize_img_button.style.display = "none"; | ||
var resizeDiv = this.context.image.imageResizeDiv; | ||
var w = targetElement.offsetWidth; | ||
var h = targetElement.offsetHeight; | ||
const resizeDiv = this.context.image.imageResizeDiv; | ||
const w = targetElement.offsetWidth; | ||
const h = targetElement.offsetHeight; | ||
var parentElement = targetElement.offsetParent; | ||
var parentT = 0; | ||
var parentL = 0; | ||
let parentElement = targetElement.offsetParent; | ||
let parentT = 0; | ||
let parentL = 0; | ||
while (parentElement) { | ||
@@ -513,14 +510,14 @@ parentT += (parentElement.offsetTop + parentElement.clientTop); | ||
var t = (targetElement.offsetTop + this.context.image._imageResize_parent_t - this.context.element.wysiwygWindow.document.body.scrollTop); | ||
var l = (targetElement.offsetLeft + 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"; | ||
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"; | ||
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); | ||
SUNEDITOR.dom.changeTxt(this.context.image.imageResizeDisplay, w + ' x ' + h); | ||
@@ -535,4 +532,4 @@ this.context.image._imageElementLink = /^A$/i.test(targetElement.parentNode.nodeName) ? targetElement.parentNode : null; | ||
this.context.image.imageResizeDiv.style.display = "block"; | ||
this.context.image.imageResizeBtn.style.display = "block"; | ||
this.context.image.imageResizeDiv.style.display = 'block'; | ||
this.context.image.imageResizeBtn.style.display = 'block'; | ||
@@ -543,5 +540,5 @@ 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.element.resizeBackground.style.display = 'none'; | ||
this.context.image.imageResizeDiv.style.display = 'none'; | ||
this.context.image.imageResizeBtn.style.display = 'none'; | ||
this.context.image._imageElement = null; | ||
@@ -553,3 +550,3 @@ }, | ||
var command = e.target.getAttribute("data-command") || e.target.parentNode.getAttribute("data-command"); | ||
const command = e.target.getAttribute('data-command') || e.target.parentNode.getAttribute('data-command'); | ||
if (!command) return; | ||
@@ -559,7 +556,7 @@ | ||
var contextImage = this.context.image; | ||
const contextImage = this.context.image; | ||
if (/^\d+$/.test(command)) { | ||
contextImage._imageElement.style.height = ""; | ||
contextImage._imageElement.style.width = command + "%"; | ||
contextImage._imageElement.style.height = ''; | ||
contextImage._imageElement.style.width = command + '%'; | ||
} | ||
@@ -569,4 +566,4 @@ else if (/update/.test(command)) { | ||
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.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; | ||
@@ -581,3 +578,3 @@ contextImage._captionChecked = contextImage.caption.checked = !!contextImage._imageCaption; | ||
else if (/delete/.test(command)) { | ||
var imageContainer = SUNEDITOR.dom.getParentNode(contextImage._imageElement, '.sun-editor-id-image-container') || contextImage._imageElement; | ||
const imageContainer = SUNEDITOR.dom.getParentNode(contextImage._imageElement, '.sun-editor-id-image-container') || contextImage._imageElement; | ||
SUNEDITOR.dom.removeItem(imageContainer); | ||
@@ -591,3 +588,3 @@ } | ||
onMouseDown_image_ctrl: function (direction) { | ||
var e = window.event; | ||
const e = window.event; | ||
e.stopPropagation(); | ||
@@ -597,4 +594,4 @@ e.preventDefault(); | ||
this.context.image._imageClientX = e.clientX; | ||
this.context.element.resizeBackground.style.display = "block"; | ||
this.context.image.imageResizeBtn.style.display = "none"; | ||
this.context.element.resizeBackground.style.display = 'block'; | ||
this.context.image.imageResizeBtn.style.display = 'none'; | ||
@@ -607,4 +604,4 @@ function closureFunc() { | ||
var resize_image_bind = SUNEDITOR.plugin.image.resize_image.bind(this, direction); | ||
var closureFunc_bind = closureFunc.bind(this); | ||
const resize_image_bind = SUNEDITOR.plugin.image.resize_image.bind(this, direction); | ||
const closureFunc_bind = closureFunc.bind(this); | ||
@@ -616,12 +613,12 @@ document.addEventListener('mousemove', resize_image_bind); | ||
resize_image: function (direction) { | ||
var e = window.event; | ||
var w = this.context.image._imageElement_w + (direction === 'r' ? e.clientX - this.context.image._imageClientX : this.context.image._imageClientX - e.clientX); | ||
var h = ((this.context.image._imageElement_h / this.context.image._imageElement_w) * w); | ||
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"; | ||
this.context.image._imageElement.style.width = w + 'px'; | ||
this.context.image._imageElement.style.height = h + 'px'; | ||
var parentElement = this.context.image._imageElement.offsetParent; | ||
var parentT = 0; | ||
var parentL = 0; | ||
let parentElement = this.context.image._imageElement.offsetParent; | ||
let parentT = 0; | ||
let parentL = 0; | ||
while (parentElement) { | ||
@@ -633,12 +630,12 @@ parentT += (parentElement.offsetTop + parentElement.clientTop); | ||
var t = (this.context.image._imageElement.offsetTop + this.context.image._imageResize_parent_t - this.context.element.wysiwygWindow.document.body.scrollTop); | ||
var l = (this.context.image._imageElement.offsetLeft + parentL); | ||
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"; | ||
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)); | ||
SUNEDITOR.dom.changeTxt(this.context.image.imageResizeDisplay, Math.round(w) + ' x ' + Math.round(h)); | ||
} | ||
}; |
@@ -10,7 +10,7 @@ /* | ||
add: function (_this) { | ||
var context = _this.context; | ||
const context = _this.context; | ||
context.link = {}; | ||
/** link dialog */ | ||
var link_dialog = eval(this.setDialog()); | ||
const link_dialog = eval(this.setDialog()); | ||
context.link.modal = link_dialog; | ||
@@ -22,3 +22,3 @@ context.link.focusElement = link_dialog.getElementsByClassName('sun-editor-id-link-url')[0]; | ||
/** link button */ | ||
var link_button = eval(this.setController_LinkBtn()); | ||
const link_button = eval(this.setController_LinkBtn()); | ||
context.link.linkBtn = link_button; | ||
@@ -28,3 +28,3 @@ context.link._linkAnchor = null; | ||
/** add event listeners */ | ||
link_dialog.getElementsByClassName("btn-primary")[0].addEventListener('click', this.submit_dialog.bind(_this)); | ||
link_dialog.getElementsByClassName('btn-primary')[0].addEventListener('click', this.submit_dialog.bind(_this)); | ||
link_button.addEventListener('click', this.onClick_linkBtn.bind(_this)); | ||
@@ -39,4 +39,5 @@ | ||
setDialog: function () { | ||
var lang = SUNEDITOR.lang; | ||
var dialog = document.createElement('DIV'); | ||
const lang = SUNEDITOR.lang; | ||
const dialog = document.createElement('DIV'); | ||
dialog.className = 'modal-content sun-editor-id-dialog-link'; | ||
@@ -79,11 +80,11 @@ dialog.style.display = 'none'; | ||
var url = /^https?:\/\//.test(this.context.link.focusElement.value) ? this.context.link.focusElement.value : "http://" + this.context.link.focusElement.value; | ||
var anchor = this.context.link.linkAnchorText || this.context.dialog.document.getElementById("linkAnchorText"); | ||
var anchorText = anchor.value.length === 0 ? url : anchor.value; | ||
const url = /^https?:\/\//.test(this.context.link.focusElement.value) ? this.context.link.focusElement.value : "http://" + this.context.link.focusElement.value; | ||
const anchor = this.context.link.linkAnchorText || this.context.dialog.document.getElementById("linkAnchorText"); | ||
const anchorText = anchor.value.length === 0 ? url : anchor.value; | ||
if (!this.context.dialog.updateModal) { | ||
var oA = document.createElement("A"); | ||
const oA = document.createElement('A'); | ||
oA.href = url; | ||
oA.textContent = anchorText; | ||
oA.target = (this.context.link.linkNewWindowCheck.checked ? "_blank" : ""); | ||
oA.target = (this.context.link.linkNewWindowCheck.checked ? '_blank' : ''); | ||
@@ -95,8 +96,8 @@ this.insertNode(oA); | ||
this.context.link._linkAnchor.textContent = anchorText; | ||
this.context.link._linkAnchor.target = (this.context.link.linkNewWindowCheck.checked ? "_blank" : ""); | ||
this.context.link._linkAnchor.target = (this.context.link.linkNewWindowCheck.checked ? '_blank' : ''); | ||
this.setRange(this.context.link._linkAnchor.childNodes[0], 0, this.context.link._linkAnchor.childNodes[0], this.context.link._linkAnchor.textContent.length); | ||
} | ||
this.context.link.focusElement.value = ""; | ||
this.context.link.linkAnchorText.value = ""; | ||
this.context.link.focusElement.value = ''; | ||
this.context.link.linkAnchorText.value = ''; | ||
} | ||
@@ -116,6 +117,6 @@ | ||
init: function () { | ||
this.context.link.linkBtn.style.display = "none"; | ||
this.context.link.linkBtn.style.display = 'none'; | ||
this.context.link._linkAnchor = null; | ||
this.context.link.focusElement.value = ""; | ||
this.context.link.linkAnchorText.value = ""; | ||
this.context.link.focusElement.value = ''; | ||
this.context.link.linkAnchorText.value = ''; | ||
this.context.link.linkNewWindowCheck.checked = false; | ||
@@ -126,6 +127,7 @@ }, | ||
setController_LinkBtn: function () { | ||
var lang = SUNEDITOR.lang; | ||
var link_btn = document.createElement("DIV"); | ||
link_btn.className = "sun-editor-id-link-btn"; | ||
link_btn.style.display = "none"; | ||
const lang = SUNEDITOR.lang; | ||
const link_btn = document.createElement('DIV'); | ||
link_btn.className = 'sun-editor-id-link-btn'; | ||
link_btn.style.display = 'none'; | ||
link_btn.innerHTML = '' + | ||
@@ -145,3 +147,3 @@ '<div class="arrow"></div>' + | ||
this.editLink = this.context.link._linkAnchor = selectionATag; | ||
var linkBtn = this.context.link.linkBtn; | ||
const linkBtn = this.context.link.linkBtn; | ||
@@ -156,3 +158,2 @@ linkBtn.getElementsByTagName("A")[0].href = selectionATag.href; | ||
this.controllerArray = [linkBtn]; | ||
linkBtn = null; | ||
}, | ||
@@ -163,3 +164,3 @@ | ||
var command = e.target.getAttribute("data-command") || e.target.parentNode.getAttribute("data-command"); | ||
const command = e.target.getAttribute("data-command") || e.target.parentNode.getAttribute("data-command"); | ||
if (!command) return; | ||
@@ -166,0 +167,0 @@ |
@@ -10,7 +10,7 @@ /* | ||
add: function (_this) { | ||
var context = _this.context; | ||
const context = _this.context; | ||
context.video = {}; | ||
/** video dialog */ | ||
var video_dialog = eval(this.setDialog()); | ||
const video_dialog = eval(this.setDialog()); | ||
context.video.modal = video_dialog; | ||
@@ -26,3 +26,3 @@ context.video.focusElement = video_dialog.getElementsByClassName('sun-editor-id-video-url')[0]; | ||
/** add event listeners */ | ||
video_dialog.getElementsByClassName("btn-primary")[0].addEventListener('click', this.submit_dialog.bind(_this)); | ||
video_dialog.getElementsByClassName('btn-primary')[0].addEventListener('click', this.submit_dialog.bind(_this)); | ||
@@ -35,4 +35,5 @@ /** append html */ | ||
setDialog: function () { | ||
var lang = SUNEDITOR.lang; | ||
var dialog = document.createElement('DIV'); | ||
const lang = SUNEDITOR.lang; | ||
const dialog = document.createElement('DIV'); | ||
dialog.className = 'modal-content sun-editor-id-dialog-video'; | ||
@@ -75,6 +76,6 @@ dialog.style.display = 'none'; | ||
var url = this.context.video.focusElement.value.replace(/^https?:/, ''); | ||
var oIframe = document.createElement("IFRAME"); | ||
var x_v = this.context.video.videoX.value; | ||
var y_v = this.context.video.videoY.value; | ||
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; | ||
@@ -85,4 +86,3 @@ /** youtube */ | ||
if (!/^\/\/.+\/embed\//.test(url)) { | ||
var youtubeUrl = url.match(/^\/\/.+\//)[0]; | ||
url = url.replace(youtubeUrl, '//www.youtube.com/embed/'); | ||
url = url.replace(url.match(/^\/\/.+\//)[0], '//www.youtube.com/embed/'); | ||
} | ||
@@ -94,3 +94,3 @@ } | ||
oIframe.height = (/^\d+$/.test(y_v) ? y_v : this.context.user.videoY); | ||
oIframe.frameBorder = "0"; | ||
oIframe.frameBorder = '0'; | ||
oIframe.allowFullscreen = true; | ||
@@ -113,3 +113,3 @@ | ||
init: function () { | ||
this.context.video.focusElement.value = ""; | ||
this.context.video.focusElement.value = ''; | ||
this.context.video.videoX.value = this.context.user.videoX; | ||
@@ -116,0 +116,0 @@ this.context.video.videoY.value = this.context.user.videoY; |
@@ -11,3 +11,3 @@ /* | ||
/** set submenu */ | ||
var listDiv = eval(this.setSubmenu()); | ||
const listDiv = eval(this.setSubmenu()); | ||
@@ -22,7 +22,7 @@ /** add event listeners */ | ||
setSubmenu: function () { | ||
var lang = SUNEDITOR.lang; | ||
var listDiv = document.createElement('DIV'); | ||
const lang = SUNEDITOR.lang; | ||
const listDiv = document.createElement('DIV'); | ||
listDiv.className = 'layer_editor layer_align'; | ||
listDiv.style.display = 'none'; | ||
listDiv.innerHTML = '' + | ||
@@ -45,4 +45,5 @@ '<div class="inner_layer">' + | ||
var target = e.target; | ||
var command = null; | ||
let target = e.target; | ||
let command = null; | ||
while (!command && !/UL/i.test(target.tagName)) { | ||
@@ -49,0 +50,0 @@ command = target.getAttribute('data-command'); |
@@ -11,3 +11,3 @@ /* | ||
/** set submenu */ | ||
var listDiv = eval(this.setSubmenu(_this.context.user)); | ||
const listDiv = eval(this.setSubmenu(_this.context.user)); | ||
@@ -22,8 +22,8 @@ /** add event listeners */ | ||
setSubmenu: function (user) { | ||
var listDiv = document.createElement('DIV'); | ||
const listDiv = document.createElement('DIV'); | ||
listDiv.className = 'layer_editor'; | ||
listDiv.style.display = 'none'; | ||
var font, text, i, len; | ||
var fontList = !user.fontList ? | ||
let font, text, i, len; | ||
let fontList = !user.fontList ? | ||
[ | ||
@@ -39,3 +39,3 @@ 'Arial', | ||
var list = '<div class="inner_layer list_family">' + | ||
let list = '<div class="inner_layer list_family">' + | ||
' <ul class="list_editor sun-editor-list-font-family">'; | ||
@@ -74,3 +74,3 @@ for (i = 0, len = fontList.length; i < len; i++) { | ||
var target = e.target; | ||
const target = e.target; | ||
@@ -80,3 +80,3 @@ this.focus(); | ||
SUNEDITOR.dom.changeTxt(this.context.tool.font, target.getAttribute('data-txt')); | ||
var newNode = document.createElement('SPAN'); newNode.style.fontFamily = target.getAttribute('data-value'); | ||
const newNode = document.createElement('SPAN'); newNode.style.fontFamily = target.getAttribute('data-value'); | ||
this.wrapRangeToTag(newNode, ['font-family']); | ||
@@ -83,0 +83,0 @@ this.submenuOff(); |
@@ -11,3 +11,3 @@ /* | ||
/** set submenu */ | ||
var listDiv = eval(this.setSubmenu(_this.context.user)); | ||
const listDiv = eval(this.setSubmenu(_this.context.user)); | ||
@@ -22,12 +22,12 @@ /** add event listeners */ | ||
setSubmenu: function (user) { | ||
var listDiv = document.createElement('DIV'); | ||
const listDiv = document.createElement('DIV'); | ||
listDiv.className = 'layer_editor layer_size'; | ||
listDiv.style.display = 'none'; | ||
var sizeList = !user.fontSizeList ? [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72] : user.fontSizeList; | ||
const sizeList = !user.fontSizeList ? [8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72] : user.fontSizeList; | ||
var list = '<div class="inner_layer">' + | ||
let list = '<div class="inner_layer">' + | ||
' <ul class="list_editor font_size_list">'; | ||
for (var i = 0; i < sizeList.length; i++) { | ||
var size = sizeList[i]; | ||
for (let i = 0, len = sizeList.length; i < len; i++) { | ||
const size = sizeList[i]; | ||
list += '<li><button type="button" class="btn_edit" data-value="' + size + '" style="font-size:' + size + 'px;">' + size + '</button></li>'; | ||
@@ -54,3 +54,3 @@ } | ||
SUNEDITOR.dom.changeTxt(this.context.tool.fontSize, e.target.getAttribute('data-value')); | ||
var newNode = document.createElement('SPAN'); newNode.style.fontSize = e.target.getAttribute('data-value') + 'px'; | ||
const newNode = document.createElement('SPAN'); newNode.style.fontSize = e.target.getAttribute('data-value') + 'px'; | ||
this.wrapRangeToTag(newNode, ['font-size']); | ||
@@ -57,0 +57,0 @@ this.submenuOff(); |
@@ -11,3 +11,3 @@ /* | ||
/** set submenu */ | ||
var listDiv = eval(this.setSubmenu()); | ||
const listDiv = eval(this.setSubmenu()); | ||
@@ -22,15 +22,15 @@ /** add event listeners */ | ||
setSubmenu: function () { | ||
var listDiv = document.createElement('DIV'); | ||
const listDiv = document.createElement('DIV'); | ||
listDiv.className = 'layer_editor layer_color'; | ||
listDiv.style.display = 'none'; | ||
var colorList = ['#ff0000', '#ff5e00', '#ffe400', '#abf200', '#00d8ff', '#0055ff', '#6600ff', '#ff00dd', '#000000', '#ffd8d8', '#fae0d4', '#faf4c0', '#e4f7ba', '#d4f4fa', '#d9e5ff', '#e8d9ff', '#ffd9fa', | ||
const colorList = ['#ff0000', '#ff5e00', '#ffe400', '#abf200', '#00d8ff', '#0055ff', '#6600ff', '#ff00dd', '#000000', '#ffd8d8', '#fae0d4', '#faf4c0', '#e4f7ba', '#d4f4fa', '#d9e5ff', '#e8d9ff', '#ffd9fa', | ||
'#ffffff', '#ffa7a7', '#ffc19e', '#faed7d', '#cef279', '#b2ebf4', '#b2ccff', '#d1b2ff', '#ffb2f5', '#bdbdbd', '#f15f5f', '#f29661', '#e5d85c', '#bce55c', '#5cd1e5', '#6699ff', '#a366ff', '#f261df', '#8c8c8c', | ||
'#980000', '#993800', '#998a00', '#6b9900', '#008299', '#003399', '#3d0099', '#990085', '#353535', '#670000', '#662500', '#665c00', '#476600', '#005766', '#002266', '#290066', '#660058', '#222222']; | ||
var list = '<div class="inner_layer">' + | ||
let list = '<div class="inner_layer">' + | ||
' <div class="pallet_bgcolor">' + | ||
' <ul class="list_color list_bgcolor">'; | ||
for (var i = 0; i < colorList.length; i++) { | ||
var color = colorList[i]; | ||
for (let i = 0, len = colorList.length; i < len; i++) { | ||
const color = colorList[i]; | ||
list += '<li>' + | ||
@@ -62,3 +62,3 @@ ' <button type="button" class="' + (/ffffff/.test(color) ? ' color_white' : '') + '" data-value="' + color + '" style="background-color:' + color + ';">' + color + '' + | ||
var newNode = document.createElement('SPAN'); newNode.style.color = e.target.getAttribute('data-value'); | ||
const newNode = document.createElement('SPAN'); newNode.style.color = e.target.getAttribute('data-value'); | ||
this.wrapRangeToTag(newNode, ['color']); | ||
@@ -65,0 +65,0 @@ this.submenuOff(); |
@@ -11,3 +11,3 @@ /* | ||
/** set submenu */ | ||
var listDiv = eval(this.setSubmenu()); | ||
const listDiv = eval(this.setSubmenu()); | ||
@@ -22,4 +22,5 @@ /** add event listeners */ | ||
setSubmenu: function () { | ||
var lang = SUNEDITOR.lang; | ||
var listDiv = document.createElement('DIV'); | ||
const lang = SUNEDITOR.lang; | ||
const listDiv = document.createElement('DIV'); | ||
listDiv.className = 'layer_editor layer_size'; | ||
@@ -48,4 +49,5 @@ listDiv.style.display = 'none'; | ||
var target = e.target; | ||
var value = null; | ||
let target = e.target; | ||
let value = null; | ||
while (!value && !/UL/i.test(target.tagName)) { | ||
@@ -52,0 +54,0 @@ value = target.getAttribute('data-value'); |
@@ -11,3 +11,3 @@ /* | ||
/** set submenu */ | ||
var listDiv = eval(this.setSubmenu()); | ||
const listDiv = eval(this.setSubmenu()); | ||
@@ -22,13 +22,13 @@ /** add event listeners */ | ||
setSubmenu: function () { | ||
var listDiv = document.createElement('DIV'); | ||
const listDiv = document.createElement('DIV'); | ||
listDiv.className = 'layer_editor layer_color'; | ||
listDiv.style.display = 'none'; | ||
var colorList = ['#1e9af9', '#00b8c6', '#6cce02', '#ff9702', '#ff0000', '#ff00dd', '#6600ff', '#cce9ff', '#fcfd4c', '#ffffff', '#dfdede', '#8c8c8c', '#000000', '#222222']; | ||
const colorList = ['#1e9af9', '#00b8c6', '#6cce02', '#ff9702', '#ff0000', '#ff00dd', '#6600ff', '#cce9ff', '#fcfd4c', '#ffffff', '#dfdede', '#8c8c8c', '#000000', '#222222']; | ||
var list = '<div class="inner_layer">' + | ||
let list = '<div class="inner_layer">' + | ||
' <div class="pallet_bgcolor pallet_text">' + | ||
' <ul class="list_color list_bgcolor">'; | ||
for (var i = 0; i < colorList.length; i++) { | ||
var color = colorList[i]; | ||
for (let i = 0, len = colorList.length; i < len; i++) { | ||
const color = colorList[i]; | ||
list += '<li>' + | ||
@@ -60,3 +60,3 @@ ' <button type="button" class="' + (/ffffff/.test(color) ? ' color_white' : '') + '" data-value="' + color + '" style="background-color:' + color + ';">' + color + '' + | ||
var newNode = document.createElement('SPAN'); newNode.style.backgroundColor = e.target.getAttribute('data-value'); | ||
const newNode = document.createElement('SPAN'); newNode.style.backgroundColor = e.target.getAttribute('data-value'); | ||
this.wrapRangeToTag(newNode, ['background-color']); | ||
@@ -63,0 +63,0 @@ this.submenuOff(); |
@@ -11,3 +11,3 @@ /* | ||
/** set submenu */ | ||
var listDiv = eval(this.setSubmenu()); | ||
const listDiv = eval(this.setSubmenu()); | ||
@@ -22,6 +22,6 @@ /** add event listeners */ | ||
setSubmenu: function () { | ||
var listDiv = document.createElement('DIV'); | ||
const listDiv = document.createElement('DIV'); | ||
listDiv.className = 'layer_editor layer_line'; | ||
listDiv.style.display = 'none'; | ||
listDiv.innerHTML = '' + | ||
@@ -52,4 +52,5 @@ '<div class="inner_layer inner_layer_type2">' + | ||
appendHr: function (className) { | ||
var oHr = document.createElement("HR"); | ||
const oHr = document.createElement("HR"); | ||
oHr.className = className; | ||
const oP = this.appendP(oHr); | ||
@@ -59,3 +60,2 @@ this.focus(); | ||
this.insertNode(oHr, this.getLineElement(this.getSelectionNode())); | ||
var oP = this.appendP(oHr); | ||
this.setRange(oP, 0, oP, 0); | ||
@@ -68,4 +68,5 @@ }, | ||
var target = e.target; | ||
var value = null; | ||
let target = e.target; | ||
let value = null; | ||
while (!value && !/UL/i.test(target.tagName)) { | ||
@@ -72,0 +73,0 @@ value = target.getAttribute('data-value'); |
@@ -11,3 +11,3 @@ /* | ||
/** set submenu */ | ||
var listDiv = eval(this.setSubmenu()); | ||
const listDiv = eval(this.setSubmenu()); | ||
@@ -22,7 +22,7 @@ /** add event listeners */ | ||
setSubmenu: function () { | ||
var lang = SUNEDITOR.lang; | ||
var listDiv = document.createElement('DIV'); | ||
const lang = SUNEDITOR.lang; | ||
const listDiv = document.createElement('DIV'); | ||
listDiv.className = 'layer_editor layer_list'; | ||
listDiv.style.display = 'none'; | ||
listDiv.innerHTML = '' + | ||
@@ -43,5 +43,6 @@ '<div class="inner_layer">' + | ||
var target = e.target; | ||
var command = null; | ||
var value = null; | ||
let target = e.target; | ||
let command = null; | ||
let value = null; | ||
while (!value && !/UL/i.test(target.tagName)) { | ||
@@ -48,0 +49,0 @@ command = target.getAttribute('data-command'); |
@@ -10,7 +10,7 @@ /* | ||
add: function (_this, targetElement) { | ||
var context = _this.context; | ||
const context = _this.context; | ||
/** set submenu */ | ||
var listDiv = eval(this.setSubmenu()); | ||
var tablePicker = listDiv.getElementsByClassName('sun-editor-id-table-picker')[0]; | ||
const listDiv = eval(this.setSubmenu()); | ||
const tablePicker = listDiv.getElementsByClassName('sun-editor-id-table-picker')[0]; | ||
context.submenu.tableHighlight = listDiv.getElementsByClassName('sun-editor-id-table-highlighted')[0]; | ||
@@ -30,3 +30,3 @@ context.submenu.tableUnHighlight = listDiv.getElementsByClassName('sun-editor-id-table-unhighlighted')[0]; | ||
setSubmenu: function () { | ||
var listDiv = document.createElement('DIV'); | ||
const listDiv = document.createElement('DIV'); | ||
listDiv.className = 'table-content'; | ||
@@ -47,11 +47,11 @@ listDiv.style.display = 'none'; | ||
appendTable: function () { | ||
var oTable = document.createElement("TABLE"); | ||
const oTable = document.createElement('TABLE'); | ||
var x = this.context.submenu._tableXY[0]; | ||
var y = this.context.submenu._tableXY[1]; | ||
let x = this.context.submenu._tableXY[0]; | ||
let y = this.context.submenu._tableXY[1]; | ||
let tableHTML = '<tbody>'; | ||
var tableHTML = '<tbody>'; | ||
while (y > 0) { | ||
tableHTML += '<tr>'; | ||
var tdCnt = x; | ||
let tdCnt = x; | ||
while (tdCnt > 0) { | ||
@@ -77,15 +77,15 @@ tableHTML += '<td><p></p></td>'; | ||
var x = Math.ceil(e.offsetX / 18); | ||
var y = Math.ceil(e.offsetY / 18); | ||
let x = Math.ceil(e.offsetX / 18); | ||
let y = Math.ceil(e.offsetY / 18); | ||
x = x < 1 ? 1 : x; | ||
y = y < 1 ? 1 : y; | ||
this.context.submenu.tableHighlight.style.width = x + "em"; | ||
this.context.submenu.tableHighlight.style.height = y + "em"; | ||
this.context.submenu.tableHighlight.style.width = x + 'em'; | ||
this.context.submenu.tableHighlight.style.height = y + 'em'; | ||
var x_u = x < 5 ? 5 : (x > 9 ? 10 : x + 1); | ||
var y_u = y < 5 ? 5 : (y > 9 ? 10 : y + 1); | ||
this.context.submenu.tableUnHighlight.style.width = x_u + "em"; | ||
this.context.submenu.tableUnHighlight.style.height = y_u + "em"; | ||
let x_u = x < 5 ? 5 : (x > 9 ? 10 : x + 1); | ||
let y_u = y < 5 ? 5 : (y > 9 ? 10 : y + 1); | ||
this.context.submenu.tableUnHighlight.style.width = x_u + 'em'; | ||
this.context.submenu.tableUnHighlight.style.height = y_u + 'em'; | ||
SUNEDITOR.dom.changeTxt(this.context.submenu.tableDisplay, x + " x " + y); | ||
SUNEDITOR.dom.changeTxt(this.context.submenu.tableDisplay, x + ' x ' + y); | ||
this.context.submenu._tableXY = [x, y]; | ||
@@ -97,13 +97,13 @@ }, | ||
var highlight = this.context.submenu.tableHighlight.style; | ||
var unHighlight = this.context.submenu.tableUnHighlight.style; | ||
const highlight = this.context.submenu.tableHighlight.style; | ||
const unHighlight = this.context.submenu.tableUnHighlight.style; | ||
highlight.width = "1em"; | ||
highlight.height = "1em"; | ||
unHighlight.width = "5em"; | ||
unHighlight.height = "5em"; | ||
highlight.width = '1em'; | ||
highlight.height = '1em'; | ||
unHighlight.width = '5em'; | ||
unHighlight.height = '5em'; | ||
SUNEDITOR.dom.changeTxt(this.context.submenu.tableDisplay, "1 x 1"); | ||
SUNEDITOR.dom.changeTxt(this.context.submenu.tableDisplay, '1 x 1'); | ||
this.submenuOff(); | ||
} | ||
}; |
"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",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",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"}}; | ||
(function(){function A(a){var d="";a=document.createRange().createContextualFragment(a.trim()).childNodes;for(var e=0,c=a.length;e<c;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></p>");return d}function B(a){var d='<div class="sun-editor-id-toolbar-cover"></div>',e=null;var c=SUNEDITOR.lang;c={font:["btn_font",c.toolbar.font,"font","submenu","",'<span class="txt sun-editor-font-family">'+c.toolbar.font+ | ||
'</span><span class="ico_more"></span>'],formats:["btn_format",c.toolbar.formats,"formatBlock","submenu","",'<span class="txt">'+c.toolbar.formats+'</span><span class="ico_more"></span>'],fontSize:["btn_size",c.toolbar.fontSize,"fontSize","submenu","",'<span class="txt sun-editor-font-size">'+c.toolbar.fontSize+'</span><span class="ico_more"></span>'],bold:["sun-editor-id-bold",c.toolbar.bold+"(Ctrl+B)","bold","","",'<div class="ico_bold"></div>'],underline:["sun-editor-id-underline",c.toolbar.underline+ | ||
"(Ctrl+U)","underline","","",'<div class="ico_underline"></div>'],italic:["sun-editor-id-italic",c.toolbar.italic+"(Ctrl+I)","italic","","",'<div class="ico_italic"></div>'],strike:["sun-editor-id-strike",c.toolbar.strike+"(Ctrl+SHIFT+S)","strikethrough","","",'<div class="ico_strike"></div>'],removeFormat:["",c.toolbar.removeFormat+"","removeFormat","","",'<div class="ico_erase"></div>'],fontColor:["",c.toolbar.fontColor,"foreColor","submenu","",'<div class="ico_foreColor"></div>'],hiliteColor:["", | ||
c.toolbar.hiliteColor,"hiliteColor","submenu","",'<div class="ico_hiliteColor"></div>'],indent:["",c.toolbar.indent+"(Ctrl + [)","indent","","",'<div class="ico_indnet"></div>'],outdent:["",c.toolbar.outdent+"(Ctrl + ])","outdent","","",'<div class="ico_outdent"></div>'],align:["btn_align",c.toolbar.align,"align","submenu","",'<div class="ico_align"></div>'],list:["",c.toolbar.list,"list","submenu","",'<div class="ico_list_num"></div>'],line:["btn_line",c.toolbar.line,"horizontalRules","submenu", | ||
"",'<hr style="border-width: 1px 0 0; border-style: solid none none; border-color: black; border-image: initial; height: 1px;" /><hr style="border-width: 1px 0 0; border-style: dotted none none; border-color: black; border-image: initial; height: 1px;" /><hr style="border-width: 1px 0 0; border-style: dashed none none; border-color: black; border-image: initial; height: 1px;" />'],table:["",c.toolbar.table,"table","submenu","",'<div class="ico_table"></div>'],link:["",c.toolbar.link,"link","dialog", | ||
"",'<div class="ico_url"></div>'],image:["",c.toolbar.image,"image","dialog","",'<div class="ico_picture"></div>'],video:["",c.toolbar.video,"video","dialog","",'<div class="ico_video"></div>'],fullScreen:["",c.toolbar.fullScreen,"fullScreen","","",'<div class="ico_full_screen_e"></div>'],codeView:["",c.toolbar.codeView,"codeView","","",'<div class="ico_html"></div>'],undo:["",c.toolbar.undo+" (Ctrl+Z)","undo","","",'<div class="ico_undo"></div>'],redo:["",c.toolbar.redo+" (Ctrl+Y)","redo","","", | ||
'<div class="ico_redo"></div>'],preview:["",c.toolbar.preview,"preview","","",'<div class="ico_preview"></div>'],print:["",c.toolbar.print,"print","","",'<div class="ico_print"></div>']};for(var f=0;f<a.length;f++){for(var b=a[f],g=0;g<b.length;g++){var n=b[g];n="object"===typeof n?[n.className,n.title,n.dataCommand,n.dataDisplay,n.displayOption,n.innerHTML]:c[n];e+='<li> <button type="button" class="btn_editor '+n[0]+'" title="'+n[1]+'" data-command="'+n[2]+'" data-display="'+n[3]+'" data-option="'+ | ||
n[4]+'">'+n[5]+" </button></li>"}e=e?'<div class="tool_module"><ul class="editor_tool">'+e+"</ul></div>":"";d+=e;e=null}return d}function C(a,d){"object"!==typeof d&&(d={});d.addFont=d.addFont||null;d.videoX=d.videoX||560;d.videoY=d.videoY||315;d.imageFileInput=void 0===d.imageFileInput?!0:d.imageFileInput;d.imageUrlInput=void 0!==d.imageUrlInput&&d.imageFileInput?d.imageUrlInput:!0;d.imageSize=d.imageSize||350;d.imageUploadUrl=d.imageUploadUrl||null;d.fontList=d.fontList||null;d.fontSizeList=d.fontSizeList|| | ||
null;d.height=/^\d+/.test(d.height)?/^\d+$/.test(d.height)?d.height+"px":d.height:a.clientHeight+"px";d.buttonList=d.buttonList||[["undo","redo"],["font","fontSize","formats"],["bold","underline","italic","strike","removeFormat"],["fontColor","hiliteColor"],["indent","outdent"],["align","line","list","table"],["link","image","video"],["fullScreen","codeView"],["preview","print"]];d.width=/^\d+/.test(d.width)?/^\d+$/.test(d.width)?d.width+"px":d.width:/%|auto/.test(a.style.width)?a.style.width:a.clientWidth+ | ||
"px";d.display=d.display||("none"!==a.style.display&&a.style.display?a.style.display:"block");var e=document,c=e.createElement("DIV");c.className="sun-editor";c.id="suneditor_"+a.id;c.style.width=d.width;c.style.display=d.display;var f=e.createElement("DIV");f.className="sun-editor-container";var b=e.createElement("DIV");b.className="sun-editor-id-toolbar";b.innerHTML=B(d.buttonList);var g=e.createElement("DIV");g.className="sun-editor-id-editorArea";g.style.height=d.height;var n=e.createElement("IFRAME"); | ||
n.allowFullscreen=!0;n.frameBorder=0;n.className="input_editor sun-editor-id-wysiwyg";n.style.display="block";var v=e.createElement("TEXTAREA");v.className="input_editor html sun-editor-id-code";v.style.display="none";n.addEventListener("load",function(){this.setAttribute("scrolling","auto");this.contentWindow.document.head.innerHTML='<meta charset="utf-8" /><title>SunEditor</title><link rel="stylesheet" type="text/css" href="'+SUNEDITOR.func.getBasePath+'css/suneditor-contents.css">';this.contentWindow.document.body.className= | ||
"sun-editor-editable";this.contentWindow.document.body.setAttribute("contenteditable",!0);this.contentWindow.document.body.innerHTML=A(a.value)});var k=e.createElement("DIV");k.className="sun-editor-id-resizeBar";var m=e.createElement("DIV");m.className="sun-editor-id-loading";m.innerHTML='<div class="ico-loading"></div>';e=e.createElement("DIV");e.className="sun-editor-id-resize-background";g.appendChild(n);g.appendChild(v);f.appendChild(b);f.appendChild(g);f.appendChild(k);f.appendChild(e);f.appendChild(m); | ||
c.appendChild(f);return{constructed:{_top:c,_relative:f,_toolBar:b,_editorArea:g,_resizeBar:k,_loading:m,_resizeBack:e},options:d}}SUNEDITOR.func={getXMLHttpRequest:function(){if(window.ActiveXObject)try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(d){return null}}else return window.XMLHttpRequest?new XMLHttpRequest:null},copyObj:function(a){var d={},e;for(e in a)d[e]=a[e];return d},getBasePath:function(){var a=SUNEDITOR.SUNEDITOR_BASEPATH|| | ||
"";if(!a)for(var d=document.getElementsByTagName("script"),e=0;e<d.length;e++){var c=d[e].src.match(/(^|.*[\\\/])suneditor(\.min)?\.js(?:\?.*|;.*)?$/i);if(c){a=c[1];break}}-1===a.indexOf(":/")&&"//"!==a.slice(0,2)&&(a=0===a.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+a:location.href.match(/^[^\?]*\/(?:)/)[0]+a);if(!a)throw'[SUNEDITOR.func.getBasePath.fail] The SUNEDITOR installation path could not be automatically detected. Please set the global variable "SUNEDITOR.SUNEDITOR_BASEPATH" before creating editor instances.'; | ||
return a}(),includeFile:function(a,d,e){var c=document.createElement("script");c.type=a;c.src=d;c.onload=e;document.getElementsByTagName("head")[0].appendChild(c)}};SUNEDITOR.dom={getArrayIndex:function(a,d){for(var e=-1,c=a.length,f=0;f<c;f++)if(a[f]===d){e=f;break}return e},nextIdx:function(a,d){var e=this.getArrayIndex(a,d);return-1===e?-1:e+1},prevIdx:function(a,d){var e=this.getArrayIndex(a,d);return-1===e?-1:e-1},isCell:function(a){return a&&/^(?:TD|TH)$/i.test(a.nodeName)},getListChildren:function(a, | ||
d){var e=[];d=d||function(){return!0};(function b(f){a!==f&&d(f)&&e.push(f);for(var g=0,n=f.children.length;g<n;g++)b(f.children[g])})(a);return e},getListChildNodes:function(a,d){var e=[];d=d||function(){return!0};(function b(a){d(a)&&e.push(a);for(var g=0,n=a.childNodes.length;g<n;g++)b(a.childNodes[g])})(a);return e},getParentNode:function(a,d){if(/\./.test(d)){var e="className";d=d.split(".")[1]}else/#/.test(d)?(e="id",d="^"+d.split("#")[1]+"$"):/:/.test(d)?(e="name",d="^"+d.split(":")[1]+"$"): | ||
(e="tagName",d="^"+d+"$");for(var c=new RegExp(d,"i");a&&(3===a.nodeType||!c.test(a[e]));){if(/^BODY$/i.test(a.tagName))return null;a=a.parentNode}return a},changeTxt:function(a,d){a&&d&&(a.textContent=d)},addClass:function(a,d){a&&!(new RegExp("(\\s|^)"+d+"(\\s|$)")).test(a.className)&&(a.className+=" "+d)},removeClass:function(a,d){a&&(a.className=a.className.replace(new RegExp("(\\s|^)"+d+"(\\s|$)")," ").trim())},toggleClass:function(a,d){if(a){var e=new RegExp("(\\s|^)"+d+"(\\s|$)");e.test(a.className)? | ||
a.className=a.className.replace(e," ").trim():a.className+=" "+d}},removeItem:function(a){try{a.remove()}catch(d){a.parentNode.removeChild(a)}}};var E=function(a,d,e){var c={context:a,loadedPlugins:{},dialogForm:null,submenu:null,submenuActiveButton:null,controllerArray:[],commandMap:{FONT:a.tool.font,B:a.tool.bold,U:a.tool.underline,I:a.tool.italic,STRIKE:a.tool.strike,SIZE:a.tool.fontSize},_variable:{selectionNode:null,copySelection:null,wysiwygActive:!0,isFullScreen:!1,innerHeight_fullScreen:0, | ||
resizeClientY:0,tabSize:4,originCssText:a.element.topArea.style.cssText,editorHeight:a.user.height,isTouchMove:!1},callModule:function(b,a,d,c){var g=e.getBasePath+"plugins/"+b;if("dialog"===b){var n=this._callBack_addModule.bind(this,"dialog","dialog",d,this.callModule.bind(this,b,a,d,c));if(!SUNEDITOR.plugin.dialog){e.includeFile("text/javascript",g+"/dialog.js",n);return}if(!this.loadedPlugins.dialog){n();return}}SUNEDITOR.plugin[a]?this.loadedPlugins[a]?"function"===typeof c&&c():this._callBack_addModule(b, | ||
a,d,c):e.includeFile("text/javascript",g+"/"+a+".js",this._callBack_addModule.bind(this,b,a,d,c))},_callBack_addModule:function(b,a,c,d){this.context[b]||(this.context[b]={});SUNEDITOR.plugin[a].add(this,c);this.loadedPlugins[a]=!0;"function"===typeof d&&d()},submenuOn:function(b){this.submenu=b.nextElementSibling;this.submenu.style.display="block";d.addClass(b,"on");this.submenuActiveButton=b},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 b=this.controllerArray.length;if(0<b){for(var a=0;a<b;a++)this.controllerArray[a].style.display="none";this.controllerArray=[]}},execCommand:function(b,g,d){a.element.wysiwygWindow.document.execCommand(b,g,d)},focus:function(){var b=d.getParentNode(this._variable.selectionNode,"figcaption");b?b.focus():a.element.wysiwygWindow.document.body.focus()},_setSelectionNode:function(){this._variable.copySelection=e.copyObj(this.getSelection()); | ||
var b=this.getRange();this._variable.selectionNode=b.startContainer!==b.endContainer?b.startContainer:this.getSelectionNode()},isEdgePoint:function(b,a){return 0===a||a===b.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 b=this.getSelection();if(0<b.rangeCount)var d= | ||
b.getRangeAt(0);else d=this.createRange(),(b=this._variable.copySelection)?(d.setStart(b.anchorNode,b.anchorOffset),d.setEnd(b.focusNode,b.focusOffset)):(b=this._variable.selectionNode||a.element.wysiwygWindow.document.body.firstChild,d.setStart(b,0),d.setEnd(b,0));return d},setRange:function(b,a,d,c){var g=this.createRange();g.setStart(b,a);g.setEnd(d,c);b=this.getSelection();0<b.rangeCount&&b.removeAllRanges();b.addRange(g)},showLoading:function(){a.element.loading.style.display="block"},closeLoading:function(){a.element.loading.style.display= | ||
"none"},getLineElement:function(b){for(b=b||this._variable.selectionNode;!/^BODY$/i.test(b.parentNode.tagName);)b=b.parentNode;return b},appendP:function(b){b=this.getLineElement(b);var a=document.createElement("P");a.innerHTML="";b.parentNode.insertBefore(a,b.nextElementSibling);return a},insertNode:function(b,a){if(a){var d=a.parentNode;a=a.nextSibling}else{var c=this.getSelection();d=this.getRange();var g=d.startContainer,e=d.startOffset,f=d.endContainer,p=d.endOffset;d=g;3===g.nodeType&& | ||
(d=g.parentNode);if(g===f&&e===p)c.focusNode&&3===c.focusNode.nodeType?a=c.focusNode.splitText(p):(null!==d.lastChild&&/^BR$/i.test(d.lastChild.nodeName)&&d.removeChild(d.lastChild),a=null);else{var r=g;if(g===f)this.isEdgePoint(f,p)||(a=f.splitText(p)),this.isEdgePoint(g,e)||(r=g.splitText(e)),d.removeChild(r);else for(c.deleteFromDocument?c.deleteFromDocument():this.removeNode(),a=f;1!==a.nodeType;)a=a.parentNode}}try{d.insertBefore(b,a)}catch(w){d.appendChild(b)}},removeNode:function(){var b=this.getRange(), | ||
a=b.startContainer,c=b.startOffset,e=b.endContainer,f=b.endOffset;b=d.getListChildNodes(b.commonAncestorContainer);var m=d.getArrayIndex(b,a);var q=d.getArrayIndex(b,e),p,r=a;for(p=m+1;0<=p;p--)b[p]===r.parentNode&&b[p].firstChild===r&&0===c&&(m=p,r=r.parentNode);r=e;for(p=q-1;p>m;p--)b[p]===r.parentNode&&1===b[p].nodeType&&(b.splice(p,1),r=r.parentNode,--q);for(p=m;p<=q;p++)m=b[p],0===m.length||3===m.nodeType&&void 0===m.data?d.removeItem(m):m===a?(m=1===a.nodeType?document.createTextNode(a.textContent): | ||
document.createTextNode(a.substringData(0,c)),0<m.length?a.data=m.data:d.removeItem(a)):m===e?(m=1===e.nodeType?document.createTextNode(e.textContent):document.createTextNode(e.substringData(f,e.length-f)),0<m.length?e.data=m.data:d.removeItem(e)):d.removeItem(m)},wrapRangeToTag:function(b,a){var c=this.getRange(),g=c.startContainer,e=c.startOffset,f=c.endContainer,q=c.endOffset,p=c.commonAncestorContainer;c={};var r={};if(a){var w="(?:;|^|\\s)(?:"+a[0];for(t=1;t<a.length;t++)w+="|"+a[t];w+=")\\s*:[^;]*\\s*(?:;|$)"; | ||
w=new RegExp(w,"gi")}if(g===f){var h=b.cloneNode(!1);if(e===q)h.innerHTML=" ",g.parentNode.insertBefore(h,g.nextSibling);else{f=document.createTextNode(g.substringData(0,e));var u=document.createTextNode(g.substringData(q,g.length-q));h.innerText=g.substringData(e,q-e);g.parentNode.insertBefore(h,g.nextSibling);g.data=0<f.data.length?f.data:g.substringData(0,e);0<u.data.length&&g.parentNode.insertBefore(u,h.nextSibling)}c.container=h;c.offset=0;r.container=h;r.offset=1}else if(u=function(a){if(3=== | ||
a.nodeType)return!0;var c="";w&&0<a.style.cssText.length&&(c=a.style.cssText.replace(w,"").trim());return a.nodeName!==b.nodeName||0<c.length?(0<a.style.cssText.length&&(a.style.cssText=c),!0):!1},/BODY/i.test(p.nodeName)){r=d.getListChildren(p,function(a){return/^P$/i.test(a.nodeName)});p=d.getParentNode(g,"P");var y=d.getParentNode(f,"P"),t=0;for(c=r.length;t<c;t++)if(p===r[t])p=t;else if(y===r[t]){y=t;break}h=b.cloneNode(!1);c=this._wrapLineNodesStart(r[p],h,u,g,e);for(t=p+1;t<y;t++)h=b.cloneNode(!1), | ||
this._wrapLineNodes(r[t],h,u);h=b.cloneNode(!1);r=this._wrapLineNodesEnd(r[y],h,u,f,q)}else h=b.cloneNode(!1),g=this._wrapLineNodesPart(p,h,u,g,e,f,q),c.container=g.startContainer,c.offset=g.startOffset,r.container=g.endContainer,r.offset=g.endOffset;this.setRange(c.container,c.offset,r.container,r.offset)},_wrapLineNodesPart:function(a,c,e,f,k,m,q){var b=f,g=k,n=m,h=q,v=!1,y=!1,t,l,x,z=[];(function D(f,m){for(var p=f.childNodes,q=0,r=p.length;q<r&&!y;q++){var k=p[q];if(v&&k!==n&&3===k.nodeType){l= | ||
k;for(t=[];l!==a&&null!==l;)e(l)&&1===l.nodeType&&t.push(l.cloneNode(!1)),l=l.parentNode;if(0<t.length){for(x=l=t.pop();0<t.length;)l=t.pop(),x.appendChild(l);c.appendChild(x);m=l}else m=c;m.appendChild(k.cloneNode(!1));z.push(k)}if(k===b){var w=document.createTextNode(b.substringData(0,g)),u=document.createTextNode(b.substringData(g,b.length-g));0<w.length?b.data=w.data:z.push(b);l=k;for(t=[];l!==a&&null!==l;)e(l)&&1===l.nodeType&&t.push(l.cloneNode(!1)),l=l.parentNode;for(x=l=t.pop()||k;0<t.length;)l= | ||
t.pop(),x.appendChild(l);x!==k?(c.appendChild(x),m=l):m=c;b=u;g=0;m.appendChild(b);v=!0}else{if(k===n){p=document.createTextNode(n.substringData(h,n.length-h));q=document.createTextNode(n.substringData(0,h));r=l=k;for(t=[];l!==a&&null!==l;)e(l)&&1===l.nodeType&&t.push(l.cloneNode(!1)),r=l,l=l.parentNode;for(x=l=t.pop()||k;0<t.length;)l=t.pop(),x.appendChild(l);x!==k?(c.appendChild(x),m=l):m=c;0<p.length?n.data=p.data:z.push(n);n=q;h=q.length;m.appendChild(n);for(a.insertBefore(c,r);0<z.length;){k= | ||
z.pop();for(k.data="";k.parentNode&&0===k.parentNode.innerText.length;)k=k.parentNode;d.removeItem(k)}y=!0;break}D(k)}}})(a);return{startContainer:b,startOffset:g,endContainer:n,endOffset:h}},_wrapLineNodes:function(a,c,d){(function q(a,b){for(var c=a.childNodes,g=0,e=c.length;g<e;g++){var n=c[g],f=b;if(d(n)){var m=n.cloneNode(!1);b.appendChild(m);1===n.nodeType&&(f=m)}q(n,f)}})(a,c);a.innerHTML="";a.appendChild(c)},_wrapLineNodesStart:function(a,c,e,f,k){var b=f,g=k,n=document.createElement("P"), | ||
r=!1,v,h,u;(function x(d,f){for(var m=d.childNodes,k=0,p=m.length;k<p;k++){var l=m[k],q=f;if(r){if(1===l.nodeType){x(l,l);continue}h=l;for(v=[];null!==h.parentNode&&h!==a&&h!==c;)e(h)&&1===h.nodeType&&v.push(h.cloneNode(!1)),h=h.parentNode;if(0<v.length){for(u=h=v.pop();0<v.length;)h=v.pop(),u.appendChild(h);c.appendChild(u);f=h}else f=c}if(r||l!==b){if(!r||e(l)){var t=l.cloneNode(!1);f.appendChild(t);1===l.nodeType&&(q=t)}x(l,q)}else{l=document.createTextNode(b.substringData(0,g));q=document.createTextNode(b.substringData(g, | ||
b.length-g));0<l.data.length&&f.appendChild(l);h=f;for(v=[];h!==n&&null!==h;)e(h)&&1===h.nodeType&&v.push(h.cloneNode(!1)),h=h.parentNode;for(u=h=v.pop()||f;0<v.length;)h=v.pop(),u.appendChild(h);u!==f?(c.appendChild(u),f=h):f=c;n.appendChild(c);b=q;g=0;r=!0;f.appendChild(b)}}})(a,n);a.parentNode.insertBefore(n,a);d.removeItem(a);return{container:b,offset:g}},_wrapLineNodesEnd:function(a,c,e,f,k){var b=f,g=k,n=document.createElement("P"),v=!1,w,h,u;(function x(d,f){for(var k=d.childNodes,m=k.length- | ||
1;0<=m;m--){var l=k[m],p=f;if(v){if(1===l.nodeType){x(l,l);continue}h=l;for(w=[];null!==h.parentNode&&h!==a&&h!==c;)e(h)&&1===h.nodeType&&w.push(h.cloneNode(!1)),h=h.parentNode;if(0<w.length){for(u=h=w.pop();0<w.length;)h=w.pop(),u.insertBefore(h,u.firstChild);c.insertBefore(u,c.firstChild);f=h}else f=c}if(v||l!==b){if(!v||e(l)){var q=l.cloneNode(!1);f.insertBefore(q,f.firstChild);1===l.nodeType&&(p=q)}x(l,p)}else{l=document.createTextNode(b.substringData(g,b.length-g));p=document.createTextNode(b.substringData(0, | ||
g));0<l.data.length&&f.insertBefore(l,f.firstChild);h=f;for(w=[];h!==n&&null!==h;)e(h)&&1===h.nodeType&&w.push(h.cloneNode(!1)),h=h.parentNode;for(u=h=w.pop()||f;0<w.length;)h=w.pop(),u.insertBefore(h,u.firstChild);u!==f?(c.insertBefore(u,c.firstChild),f=h):f=c;n.insertBefore(c,n.firstChild);b=p;g=p.data.length;v=!0;f.insertBefore(b,f.firstChild)}}})(a,n);a.parentNode.insertBefore(n,a);d.removeItem(a);return{container:b,offset:g}},indent:function(a,c){var b=d.getParentNode(a,"P");if(b){var g=/\d+/.test(b.style.marginLeft)? | ||
1*b.style.marginLeft.match(/\d+/)[0]:0;g="indent"===c?g+25:g-25;b.style.marginLeft=(0>g?0:g)+"px"}},toggleFrame: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={"&":"&"," ":"\u00a0","<":"<",">":">"},c=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<c.trim().length?c:"<p></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" /><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 b=c._variable.selectionNode,g=!0,f=!0,e=!0,k="B|U|I|STRIKE|FONT|SIZE|",m=new RegExp(k,"i"),q;!/^(?:P|BODY|HTML|DIV)$/i.test(b.nodeName);){if(3!==b.nodeType){var p=[/^STRONG$/.test(b.nodeName)?"B":/^EM/.test(b.nodeName)?"I":b.nodeName];g&&1===b.nodeType&&(0<b.style.fontFamily.length|| | ||
b.face&&0<b.face.length)&&(p.push("FONT"),g=(b.style.fontFamily||b.face||SUNEDITOR.lang.toolbar.font).replace(/["']/g,""),d.changeTxt(c.commandMap.FONT,g),g=!1,k=k.replace("FONT|",""),m=new RegExp(k,"i"));if(e&&/^A$/i.test(b.nodeName)&&null===b.getAttribute("data-image-link")){if(!a.link||c.controllerArray[0]!==a.link.linkBtn){var r=b;c.callModule("dialog","link",null,function(){SUNEDITOR.plugin.link.call_controller_linkButton.call(c,r)})}e=!1}else e&&a.link&&c.controllerArray[0]===a.link.linkBtn&& | ||
c.controllersOff();f&&0<b.style.fontSize.length&&(d.changeTxt(c.commandMap.SIZE,b.style.fontSize.match(/\d+/)[0]),f=!1,k=k.replace("SIZE|",""),m=new RegExp(k,"i"));q=b.style.cssText;/:\s*bold(?:;|\s)/.test(q)&&p.push("B");/:\s*underline(?:;|\s)/.test(q)&&p.push("U");/:\s*italic(?:;|\s)/.test(q)&&p.push("I");/:\s*line-through(?:;|\s)/.test(q)&&p.push("STRIKE");for(q=0;q<p.length;q++)m.test(p[q])&&(d.addClass(c.commandMap[p[q]],"on"),k=k.replace(p[q]+"|",""),m=new RegExp(k,"i"))}b=b.parentNode}e&&c.controllersOff(); | ||
k=k.split("|");b=k.length-1;for(q=0;q<b;q++)/^FONT/i.test(k[q])?d.changeTxt(c.commandMap[k[q]],SUNEDITOR.lang.toolbar.font):/^SIZE$/i.test(k[q])?d.changeTxt(c.commandMap[k[q]],SUNEDITOR.lang.toolbar.fontSize):d.removeClass(c.commandMap[k[q]],"on")},resize_window:function(){c._variable.isFullScreen&&(c._variable.innerHeight_fullScreen+=window.innerHeight-a.tool.bar.offsetHeight-c._variable.innerHeight_fullScreen,a.element.editorArea.style.height=c._variable.innerHeight_fullScreen+"px")},touchstart_toolbar:function(){c._variable.isTouchMove= | ||
!1},touchmove_toolbar:function(){c._variable.isTouchMove=!0},onClick_toolbar:function(b){if(c._variable.isTouchMove)return!0;for(var g=b.target,f=g.getAttribute("data-display"),e=g.getAttribute("data-command"),k=g.className;!e&&!/editor_tool/.test(k)&&!/sun-editor-id-toolbar/.test(k);)g=g.parentNode,e=g.getAttribute("data-command"),f=g.getAttribute("data-display"),k=g.className;if(!e&&!f)return!0;b.preventDefault();b.stopPropagation();c.focus();if(f)b=c.submenu,c.submenuOff(),!/submenu/.test(f)|| | ||
null!==g.nextElementSibling&&g.nextElementSibling===b?/dialog/.test(f)&&c.callModule("dialog",e,null,function(){SUNEDITOR.plugin.dialog.openDialog.call(c,e,g.getAttribute("data-option"),!1)}):c.callModule("submenu",e,g,function(){c.submenuOn(g)});else{if(e)switch(f=g.getAttribute("data-value"),e){case "codeView":c.toggleFrame();d.toggleClass(g,"on");break;case "fullScreen":c.toggleFullScreen(g);d.toggleClass(g,"on");break;case "indent":case "outdent":c.indent(c._variable.selectionNode,e);break;case "redo":case "undo":case "removeFormat":c.execCommand(e, | ||
!1,null);break;case "preview":c.preview();break;case "print":a.element.wysiwygWindow.print();break;default:c.execCommand(e,!1,f),d.toggleClass(g,"on")}c.submenuOff()}},onMouseUp_wysiwyg:function(a){a.stopPropagation();c._setSelectionNode();var b=a.target;c.submenuOff();/^HTML$/i.test(b.nodeName)?(a.preventDefault(),c.focus()):/^IMG$/i.test(b.nodeName)?(a.preventDefault(),c.callModule("dialog","image",null,function(){SUNEDITOR.plugin.image.call_controller_imageResize.call(c,b)})):f._findButtonEffectTag()}, | ||
onKeyDown_wysiwyg:function(b){c._setSelectionNode();var g=b.keyCode,e=b.shiftKey,v=b.ctrlKey||b.metaKey,k=b.altKey;b.stopPropagation();if(v&&!/^(?:16|17|18)$/.test(g)){var m;if(m=!(e&&83!==g))(m=f._shortcutKeyCode[g])?(c.execCommand(m[0],!1,null),d.toggleClass(c.commandMap[m[1]],"on"),m=!0):m=!1;if(m){b.preventDefault();return}}switch(g){case 8:if(/^P$/i.test(c._variable.selectionNode.tagName)&&null===c._variable.selectionNode.previousSibling)return b.preventDefault(),!1;break;case 9:if(b.preventDefault(), | ||
!v&&!k){for(b=c._variable.selectionNode||c.getSelection().anchorNode;!/^TD$/i.test(b.tagName)&&!/^BODY$/i.test(b.tagName);)b=b.parentNode;if(b&&/^TD$/i.test(b.tagName)){g=d.getParentNode(b,"table");g=d.getListChildren(g,d.isCell);b=e?d.prevIdx(g,b):d.nextIdx(g,b);b!==g.length||e||(b=0);-1===b&&e&&(b=g.length-1);e=g[b];if(!e)return!1;b=c.createRange();b.setStart(e,0);b.setEnd(e,0);e=c.getSelection();0<e.rangeCount&&e.removeAllRanges();e.addRange(b)}else e||(b=a.element.wysiwygWindow.document.createTextNode(Array(c._variable.tabSize+ | ||
1).join("\u00a0")),c.insertNode(b,null),e=c.getSelection(),g=c.createRange(),g.setStart(b,c._variable.tabSize),g.setEnd(b,c._variable.tabSize),0<e.rangeCount&&e.removeAllRanges(),e.addRange(g))}}},onKeyUp_wysiwyg:function(a){c._setSelectionNode();f._directionKeyKeyCode.test(a.keyCode)&&f._findButtonEffectTag()},onScroll_wysiwyg:function(){c.controllersOff()},onDrop_wysiwyg:function(a){var b=a.dataTransfer.files;if(0===b.length)return!0;a.stopPropagation();a.preventDefault();c.focus();c.callModule("dialog", | ||
"image",null,function(){c.context.image.imgInputFile.files=b;SUNEDITOR.plugin.image.onRender_imgInput.call(c);c.context.image.imgInputFile.files=null})},onMouseDown_resizeBar:function(b){function d(){a.element.resizeBackground.style.display="none";document.removeEventListener("mousemove",f.resize_editor);document.removeEventListener("mouseup",d)}b.stopPropagation();c._variable.resizeClientY=b.clientY;a.element.resizeBackground.style.display="block";document.addEventListener("mousemove",f.resize_editor); | ||
document.addEventListener("mouseup",d)},resize_editor:function(b){var d=b.clientY-c._variable.resizeClientY;a.element.editorArea.style.height=a.element.editorArea.offsetHeight+d+"px";c._variable.editorHeight=a.element.editorArea.offsetHeight+d;c._variable.resizeClientY=b.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= | ||
c._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML:a.element.code.value},getContent:function(){var b="";return 0===a.element.wysiwygWindow.document.body.innerText.trim().length?b:b=c._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML:a.element.code.value},setContent:function(b){b=A(b);c._variable.wysiwygActive?a.element.wysiwygWindow.document.body.innerHTML=b:a.element.code.value=b},appendContent:function(b){if(c._variable.wysiwygActive){var d=document.createElement("P"); | ||
d.innerHTML=b;a.element.wysiwygWindow.document.body.appendChild(d)}else a.element.code.value+=b},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 b=a.element.topArea.style;b.cssText=c._variable.originCssText;"none"===b.display&&(b.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 c=C(e,d);if(document.getElementById(c.constructed._top.id))throw Error('[SUNEDITOR.create.fail] The ID of the suneditor you are trying to create already exists (ID:"'+ | ||
c.constructed._top.id+'")');e.style.display="none";"object"===typeof e.nextElementSibling?e.parentNode.insertBefore(c.constructed._top,e.nextElementSibling):e.parentNode.appendChild(c.constructed._top);var f=c.constructed;c=c.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],font:f._toolBar.getElementsByClassName("sun-editor-font-family")[0], | ||
fontSize:f._toolBar.getElementsByClassName("sun-editor-font-size")[0]},user:{videoX:c.videoX,videoY:c.videoY,imageFileInput:c.imageFileInput,imageUrlInput:c.imageUrlInput,imageSize:c.imageSize,imageUploadUrl:c.imageUploadUrl,addFont:c.addFont,fontList:c.fontList,fontSizeList:c.fontSizeList,height:c.height.match(/\d+/)[0]}};return E(e,SUNEDITOR.dom,SUNEDITOR.func)};SUNEDITOR.destroy=function(a){var d=document.getElementById("suneditor_"+a);d.parentNode.removeChild(d);document.getElementById(a).style.display= | ||
""}})(); | ||
fullScreen:"Full Screen",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"}}; | ||
(function(){function z(a){var d="";a=document.createRange().createContextualFragment(a.trim()).childNodes;for(var e=0,b=a.length;e<b;e++){var g=a[e].outerHTML||a[e].textContent;d=/^(?:P|TABLE|H[1-6]|DIV)$/i.test(a[e].tagName)?d+g:d+("<P>"+g+"</p>")}0===d.length&&(d="<p></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+ | ||
'</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+ | ||
"(Ctrl+U)","underline","","",'<div class="ico_underline"></div>'],italic:["sun-editor-id-italic",b.toolbar.italic+"(Ctrl+I)","italic","","",'<div class="ico_italic"></div>'],strike:["sun-editor-id-strike",b.toolbar.strike+"(Ctrl+SHIFT+S)","strikethrough","","",'<div class="ico_strike"></div>'],removeFormat:["",b.toolbar.removeFormat+"","removeFormat","","",'<div class="ico_erase"></div>'],fontColor:["",b.toolbar.fontColor,"foreColor","submenu","",'<div class="ico_foreColor"></div>'],hiliteColor:["", | ||
b.toolbar.hiliteColor,"hiliteColor","submenu","",'<div class="ico_hiliteColor"></div>'],indent:["",b.toolbar.indent+"(Ctrl + [)","indent","","",'<div class="ico_indnet"></div>'],outdent:["",b.toolbar.outdent+"(Ctrl + ])","outdent","","",'<div class="ico_outdent"></div>'],align:["btn_align",b.toolbar.align,"align","submenu","",'<div class="ico_align"></div>'],list:["",b.toolbar.list,"list","submenu","",'<div class="ico_list_num"></div>'],line:["btn_line",b.toolbar.line,"horizontalRules","submenu", | ||
"",'<hr style="border-width: 1px 0 0; border-style: solid none none; border-color: black; border-image: initial; height: 1px;" /><hr style="border-width: 1px 0 0; border-style: dotted none none; border-color: black; border-image: initial; height: 1px;" /><hr style="border-width: 1px 0 0; border-style: dashed none none; border-color: black; border-image: initial; height: 1px;" />'],table:["",b.toolbar.table,"table","submenu","",'<div class="ico_table"></div>'],link:["",b.toolbar.link,"link","dialog", | ||
"",'<div class="ico_url"></div>'],image:["",b.toolbar.image,"image","dialog","",'<div class="ico_picture"></div>'],video:["",b.toolbar.video,"video","dialog","",'<div class="ico_video"></div>'],fullScreen:["",b.toolbar.fullScreen,"fullScreen","","",'<div class="ico_full_screen_e"></div>'],codeView:["",b.toolbar.codeView,"codeView","","",'<div class="ico_html"></div>'],undo:["",b.toolbar.undo+" (Ctrl+Z)","undo","","",'<div class="ico_undo"></div>'],redo:["",b.toolbar.redo+" (Ctrl+Y)","redo","","", | ||
'<div class="ico_redo"></div>'],preview:["",b.toolbar.preview,"preview","","",'<div class="ico_preview"></div>'],print:["",b.toolbar.print,"print","","",'<div class="ico_print"></div>']};for(var g=0;g<a.length;g++){for(var c=a[g],f=0;f<c.length;f++){var p=c[f];p="object"===typeof p?[p.className,p.title,p.dataCommand,p.dataDisplay,p.displayOption,p.innerHTML]:b[p];e+='<li> <button type="button" class="btn_editor '+p[0]+'" title="'+p[1]+'" data-command="'+p[2]+'" data-display="'+p[3]+'" data-option="'+ | ||
p[4]+'">'+p[5]+" </button></li>"}e=e?'<div class="tool_module"><ul class="editor_tool">'+e+"</ul></div>":"";d+=e;e=null}return d}function C(a,d){"object"!==typeof d&&(d={});d.addFont=d.addFont||null;d.videoX=d.videoX||560;d.videoY=d.videoY||315;d.imageFileInput=void 0===d.imageFileInput?!0:d.imageFileInput;d.imageUrlInput=void 0!==d.imageUrlInput&&d.imageFileInput?d.imageUrlInput:!0;d.imageSize=d.imageSize||350;d.imageUploadUrl=d.imageUploadUrl||null;d.fontList=d.fontList||null;d.fontSizeList=d.fontSizeList|| | ||
null;d.height=/^\d+/.test(d.height)?/^\d+$/.test(d.height)?d.height+"px":d.height:a.clientHeight+"px";d.buttonList=d.buttonList||[["undo","redo"],["font","fontSize","formats"],["bold","underline","italic","strike","removeFormat"],["fontColor","hiliteColor"],["indent","outdent"],["align","line","list","table"],["link","image","video"],["fullScreen","codeView"],["preview","print"]];d.width=/^\d+/.test(d.width)?/^\d+$/.test(d.width)?d.width+"px":d.width:/%|auto/.test(a.style.width)?a.style.width:a.clientWidth+ | ||
"px";d.display=d.display||("none"!==a.style.display&&a.style.display?a.style.display:"block");var e=document,b=e.createElement("DIV");b.className="sun-editor";b.id="suneditor_"+a.id;b.style.width=d.width;b.style.display=d.display;var g=e.createElement("DIV");g.className="sun-editor-container";var c=e.createElement("DIV");c.className="sun-editor-id-toolbar";c.innerHTML=B(d.buttonList);var f=e.createElement("DIV");f.className="sun-editor-id-editorArea";f.style.height=d.height;var p=e.createElement("IFRAME"); | ||
p.allowFullscreen=!0;p.frameBorder=0;p.className="input_editor sun-editor-id-wysiwyg";p.style.display="block";var u=e.createElement("TEXTAREA");u.className="input_editor html sun-editor-id-code";u.style.display="none";p.addEventListener("load",function(){this.setAttribute("scrolling","auto");this.contentWindow.document.head.innerHTML='<meta charset="utf-8" /><title>SunEditor</title><link rel="stylesheet" type="text/css" href="'+SUNEDITOR.util.getBasePath+'css/suneditor-contents.css">';this.contentWindow.document.body.className= | ||
"sun-editor-editable";this.contentWindow.document.body.setAttribute("contenteditable",!0);this.contentWindow.document.body.innerHTML=z(a.value)});var n=e.createElement("DIV");n.className="sun-editor-id-resizeBar";var t=e.createElement("DIV");t.className="sun-editor-id-loading";t.innerHTML='<div class="ico-loading"></div>';e=e.createElement("DIV");e.className="sun-editor-id-resize-background";f.appendChild(p);f.appendChild(u);g.appendChild(c);g.appendChild(f);g.appendChild(n);g.appendChild(e);g.appendChild(t); | ||
b.appendChild(g);return{constructed:{_top:b,_relative:g,_toolBar:c,_editorArea:f,_resizeBar:n,_loading:t,_resizeBack:e},options:d}}SUNEDITOR.util={getXMLHttpRequest:function(){if(window.ActiveXObject)try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(a){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(d){return null}}else return window.XMLHttpRequest?new XMLHttpRequest:null},getBasePath:function(){var a=SUNEDITOR.SUNEDITOR_BASEPATH||"";if(!a)for(var d=document.getElementsByTagName("script"), | ||
e=0;e<d.length;e++){var b=d[e].src.match(/(^|.*[\\\/])suneditor(\.min)?\.js(?:\?.*|;.*)?$/i);if(b){a=b[1];break}}-1===a.indexOf(":/")&&"//"!==a.slice(0,2)&&(a=0===a.indexOf("/")?location.href.match(/^.*?:\/\/[^\/]*/)[0]+a:location.href.match(/^[^\?]*\/(?:)/)[0]+a);if(!a)throw'[SUNEDITOR.util.getBasePath.fail] The SUNEDITOR installation path could not be automatically detected. Please set the global variable "SUNEDITOR.SUNEDITOR_BASEPATH" before creating editor instances.';return a}(),includeFile:function(a, | ||
d,e){var b=document.createElement("script");b.type=a;b.src=d;b.onload=e;document.getElementsByTagName("head")[0].appendChild(b)}};SUNEDITOR.dom={getArrayIndex:function(a,d){for(var e=-1,b=0,g=a.length;b<g;b++)if(a[b]===d){e=b;break}return e},nextIdx:function(a,d){var e=this.getArrayIndex(a,d);return-1===e?-1:e+1},prevIdx:function(a,d){var e=this.getArrayIndex(a,d);return-1===e?-1:e-1},isCell:function(a){return a&&/^(?:TD|TH)$/i.test(a.nodeName)},getListChildren:function(a,d){var e=[];d=d||function(){return!0}; | ||
(function c(g){a!==g&&d(g)&&e.push(g);for(var f=0,p=g.children.length;f<p;f++)c(g.children[f])})(a);return e},getListChildNodes:function(a,d){var e=[];d=d||function(){return!0};(function c(a){d(a)&&e.push(a);for(var f=0,p=a.childNodes.length;f<p;f++)c(a.childNodes[f])})(a);return e},getParentNode:function(a,d){if(/\./.test(d)){var e="className";d=d.split(".")[1]}else/#/.test(d)?(e="id",d="^"+d.split("#")[1]+"$"):/:/.test(d)?(e="name",d="^"+d.split(":")[1]+"$"):(e="tagName",d="^"+d+"$");for(var b= | ||
new RegExp(d,"i");a&&(3===a.nodeType||!b.test(a[e]));){if(/^BODY$/i.test(a.tagName))return null;a=a.parentNode}return a},changeTxt:function(a,d){a&&d&&(a.textContent=d)},addClass:function(a,d){a&&!(new RegExp("(\\s|^)"+d+"(\\s|$)")).test(a.className)&&(a.className+=" "+d)},removeClass:function(a,d){a&&(a.className=a.className.replace(new RegExp("(\\s|^)"+d+"(\\s|$)")," ").trim())},toggleClass:function(a,d){if(a){var e=new RegExp("(\\s|^)"+d+"(\\s|$)");e.test(a.className)?a.className=a.className.replace(e, | ||
" ").trim():a.className+=" "+d}},removeItem:function(a){try{a.remove()}catch(d){a.parentNode.removeChild(a)}}};var E=function(a,d,e){var b={context:a,loadedPlugins:{},dialogForm:null,submenu:null,submenuActiveButton:null,controllerArray:[],commandMap:{FONT:a.tool.font,B:a.tool.bold,U:a.tool.underline,I:a.tool.italic,STRIKE:a.tool.strike,SIZE:a.tool.fontSize},_variable:{selectionNode:null,wysiwygActive:!0,isFullScreen:!1,innerHeight_fullScreen:0,resizeClientY:0,tabSize:4,originCssText:a.element.topArea.style.cssText, | ||
editorHeight:a.user.height,isTouchMove:!1},callModule:function(c,a,b,d){var f=e.getBasePath+"plugins/"+c;if("dialog"===c){var p=this._callBack_addModule.bind(this,"dialog","dialog",b,this.callModule.bind(this,c,a,b,d));if(!SUNEDITOR.plugin.dialog){e.includeFile("text/javascript",f+"/dialog.js",p);return}if(!this.loadedPlugins.dialog){p();return}}SUNEDITOR.plugin[a]?this.loadedPlugins[a]?"function"===typeof d&&d():this._callBack_addModule(c,a,b,d):e.includeFile("text/javascript",f+"/"+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,f,b){a.element.wysiwygWindow.document.execCommand(c,f,b)},focus:function(){var c=d.getParentNode(this._variable.selectionNode,"figcaption");c?c.focus():a.element.wysiwygWindow.document.body.focus()},_setSelectionNode:function(){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.selectionNode)?(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 f=this.createRange();f.setStart(c,a);f.setEnd(b,d);c=this.getSelection();0<c.rangeCount&&c.removeAllRanges();c.addRange(f)},showLoading:function(){a.element.loading.style.display="block"},closeLoading:function(){a.element.loading.style.display="none"},getLineElement:function(c){if(c=c||this._variable.selectionNode)for(;!/^BODY$/i.test(c.parentNode.tagName);)c= | ||
c.parentNode;else c=a.element.wysiwygWindow.document.body.firstChild;return c},appendP:function(c){var a=document.createElement("P");a.innerHTML="";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 f=b.startContainer,e=b.startOffset,g=b.endContainer,k=b.endOffset;b=f;3===f.nodeType&&(b=f.parentNode);if(f===g&&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(f===g)d=f,this.isEdgePoint(g,k)||(a=g.splitText(k)),this.isEdgePoint(f,e)||(d=f.splitText(e)),b.removeChild(d);else for(d.deleteFromDocument?d.deleteFromDocument():this.removeNode(),a=g;1!==a.nodeType;)a=a.parentNode}try{b.insertBefore(c,a)}catch(l){b.appendChild(c)}},removeNode:function(){var c=this.getRange(),a=c.startContainer,b=c.startOffset,e=c.endContainer,g=c.endOffset; | ||
c=d.getListChildNodes(c.commonAncestorContainer);var t=d.getArrayIndex(c,a),m=d.getArrayIndex(c,e);var k=t+1;for(var l=a;0<=k;k--)c[k]===l.parentNode&&c[k].firstChild===l&&0===b&&(t=k,l=l.parentNode);k=m-1;for(l=e;k>t;k--)c[k]===l.parentNode&&1===c[k].nodeType&&(c.splice(k,1),l=l.parentNode,--m);for(;t<=m;t++)k=c[t],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(g,e.length-g)),0<k.length?e.data=k.data:d.removeItem(e)):d.removeItem(k)},wrapRangeToTag:function(c,a){var b=this.getRange(),f=b.startContainer,e=b.startOffset,g=b.endContainer,m=b.endOffset,k=b.commonAncestorContainer;b={};var l={},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(f===g){q=c.cloneNode(!1); | ||
if(e===m)q.innerHTML=" ",f.parentNode.insertBefore(q,f.nextSibling);else{g=document.createTextNode(f.substringData(0,e));var w=document.createTextNode(f.substringData(m,f.length-m));q.innerText=f.substringData(e,m-e);f.parentNode.insertBefore(q,f.nextSibling);f.data=0<g.data.length?g.data:f.substringData(0,e);0<w.data.length&&f.parentNode.insertBefore(w,q.nextSibling)}b.container=q;b.offset=0;l.container=q;l.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)){l=d.getListChildren(k,function(a){return/^P$/i.test(a.nodeName)});var y=d.getParentNode(f,"P");k=d.getParentNode(g,"P");b=0;for(q=l.length;b<q;b++)if(y===l[b])y=b;else if(k===l[b]){k=b;break}q=c.cloneNode(!1);b=this._wrapLineNodesStart(l[y],q,w,f,e);for(f=y+1;f<k;f++)q=c.cloneNode(!1),this._wrapLineNodes(l[f],q,w);q=c.cloneNode(!1);l= | ||
this._wrapLineNodesEnd(l[k],q,w,g,m)}else q=c.cloneNode(!1),m=this._wrapLineNodesPart(k,q,w,f,e,g,m),b.container=m.startContainer,b.offset=m.startOffset,l.container=m.endContainer,l.offset=m.endOffset;this.setRange(b.container,b.offset,l.container,l.offset)},_wrapLineNodesPart:function(a,b,e,g,n,t,m){var c=[],f=g,p=n,h=t,u=m,y=!1,A=!1,v,r,x;(function D(g,k){for(var q=g.childNodes,m=0,t=q.length;m<t&&!A;m++){var l=q[m];if(y&&l!==h&&3===l.nodeType){r=l;for(v=[];r!==a&&null!==r;)e(r)&&1===r.nodeType&& | ||
v.push(r.cloneNode(!1)),r=r.parentNode;if(0<v.length){for(x=r=v.pop();0<v.length;)r=v.pop(),x.appendChild(r);b.appendChild(x);k=r}else k=b;k.appendChild(l.cloneNode(!1));c.push(l)}if(l===f){var n=document.createTextNode(f.substringData(0,p)),w=document.createTextNode(f.substringData(p,f.length-p));0<n.length?f.data=n.data:c.push(f);r=l;for(v=[];r!==a&&null!==r;)e(r)&&1===r.nodeType&&v.push(r.cloneNode(!1)),r=r.parentNode;for(x=r=v.pop()||l;0<v.length;)r=v.pop(),x.appendChild(r);x!==l?(b.appendChild(x), | ||
k=r):k=b;f=w;p=0;k.appendChild(f);y=!0}else{if(l===h){q=document.createTextNode(h.substringData(u,h.length-u));m=document.createTextNode(h.substringData(0,u));t=r=l;for(v=[];r!==a&&null!==r;)e(r)&&1===r.nodeType&&v.push(r.cloneNode(!1)),t=r,r=r.parentNode;for(x=r=v.pop()||l;0<v.length;)r=v.pop(),x.appendChild(r);x!==l?(b.appendChild(x),k=r):k=b;0<q.length?h.data=q.data:c.push(h);h=m;u=m.length;k.appendChild(h);for(a.insertBefore(b,t);0<c.length;){l=c.pop();for(l.data="";l.parentNode&&0===l.parentNode.innerText.length;)l= | ||
l.parentNode;d.removeItem(l)}A=!0;break}D(l)}}})(a);return{startContainer:f,startOffset:p,endContainer:h,endOffset:u}},_wrapLineNodes:function(a,b,d){(function m(a,c){for(var b=a.childNodes,f=0,e=b.length;f<e;f++){var p=b[f],g=c;if(d(p)){var t=p.cloneNode(!1);c.appendChild(t);1===p.nodeType&&(g=t)}m(p,g)}})(a,b);a.innerHTML="";a.appendChild(b)},_wrapLineNodesStart:function(a,b,e,g,n){var c=document.createElement("P"),f=g,p=n,l=!1,q,h,u;(function r(d,g){for(var k=d.childNodes,m=0,t=k.length;m<t;m++){var n= | ||
k[m],v=g;if(l){if(1===n.nodeType){r(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);g=h}else g=b}if(l||n!==f){if(!l||e(n)){var w=n.cloneNode(!1);g.appendChild(w);1===n.nodeType&&(v=w)}r(n,v)}else{n=document.createTextNode(f.substringData(0,p));v=document.createTextNode(f.substringData(p,f.length-p));0<n.data.length&&g.appendChild(n);h=g; | ||
for(q=[];h!==c&&null!==h;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;for(u=h=q.pop()||g;0<q.length;)h=q.pop(),u.appendChild(h);u!==g?(b.appendChild(u),g=h):g=b;c.appendChild(b);f=v;p=0;l=!0;g.appendChild(f)}}})(a,c);a.parentNode.insertBefore(c,a);d.removeItem(a);return{container:f,offset:p}},_wrapLineNodesEnd:function(a,b,e,g,n){var c=document.createElement("P"),f=g,p=n,l=!1,q,h,u;(function r(d,g){for(var k=d.childNodes,n=k.length-1;0<=n;n--){var m=k[n],t=g;if(l){if(1===m.nodeType){r(m, | ||
m);continue}h=m;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);g=h}else g=b}if(l||m!==f){if(!l||e(m)){var v=m.cloneNode(!1);g.insertBefore(v,g.firstChild);1===m.nodeType&&(t=v)}r(m,t)}else{m=document.createTextNode(f.substringData(p,f.length-p));t=document.createTextNode(f.substringData(0,p));0<m.data.length&&g.insertBefore(m, | ||
g.firstChild);h=g;for(q=[];h!==c&&null!==h;)e(h)&&1===h.nodeType&&q.push(h.cloneNode(!1)),h=h.parentNode;for(u=h=q.pop()||g;0<q.length;)h=q.pop(),u.insertBefore(h,u.firstChild);u!==g?(b.insertBefore(u,b.firstChild),g=h):g=b;c.insertBefore(b,c.firstChild);f=t;p=t.data.length;l=!0;g.insertBefore(f,g.firstChild)}}})(a,c);a.parentNode.insertBefore(c,a);d.removeItem(a);return{container:f,offset:p}},indent:function(a,b){var c=d.getParentNode(a,"P");if(c){var f=/\d+/.test(c.style.marginLeft)?1*c.style.marginLeft.match(/\d+/)[0]: | ||
0;f="indent"===b?f+25:f-25;c.style.marginLeft=(0>f?0:f)+"px"}},toggleFrame: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={"&":"&"," ":"\u00a0","<":"<",">":">"},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></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" /><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}},g={_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,f=!0,g=!0,e=!0,n="B|U|I|STRIKE|FONT|SIZE|",t=new RegExp(n,"i"),m;!/^(?: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];f&&1===c.nodeType&&(0<c.style.fontFamily.length||c.face&&0<c.face.length)&&(k.push("FONT"),f=(c.style.fontFamily|| | ||
c.face||SUNEDITOR.lang.toolbar.font).replace(/["']/g,""),d.changeTxt(b.commandMap.FONT,f),f=!1,n=n.replace("FONT|",""),t=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();g&&0<c.style.fontSize.length&&(d.changeTxt(b.commandMap.SIZE,c.style.fontSize.match(/\d+/)[0]), | ||
g=!1,n=n.replace("SIZE|",""),t=new RegExp(n,"i"));m=c.style.cssText;/:\s*bold(?:;|\s)/.test(m)&&k.push("B");/:\s*underline(?:;|\s)/.test(m)&&k.push("U");/:\s*italic(?:;|\s)/.test(m)&&k.push("I");/:\s*line-through(?:;|\s)/.test(m)&&k.push("STRIKE");for(m=0;m<k.length;m++)t.test(k[m])&&(d.addClass(b.commandMap[k[m]],"on"),n=n.replace(k[m]+"|",""),t=new RegExp(n,"i"))}c=c.parentNode}e&&b.controllersOff();n=n.split("|");g=0;for(e=n.length-1;g<e;g++)/^FONT/i.test(n[g])?d.changeTxt(b.commandMap[n[g]],SUNEDITOR.lang.toolbar.font): | ||
/^SIZE$/i.test(n[g])?d.changeTxt(b.commandMap[n[g]],SUNEDITOR.lang.toolbar.fontSize):d.removeClass(b.commandMap[n[g]],"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 f=c.target,g=f.getAttribute("data-display"),e=f.getAttribute("data-command"),n=f.className;!e&&!/editor_tool/.test(n)&&!/sun-editor-id-toolbar/.test(n);)f=f.parentNode,e=f.getAttribute("data-command"),g=f.getAttribute("data-display"),n=f.className;if(!e&&!g)return!0;c.preventDefault();c.stopPropagation();b.focus();if(g)c=b.submenu,b.submenuOff(),!/submenu/.test(g)||null!==f.nextElementSibling&&f.nextElementSibling===c?/dialog/.test(g)&&b.callModule("dialog",e,null,function(){SUNEDITOR.plugin.dialog.openDialog.call(b, | ||
e,f.getAttribute("data-option"),!1)}):b.callModule("submenu",e,f,function(){b.submenuOn(f)});else{if(e)switch(e){case "codeView":b.toggleFrame();d.toggleClass(f,"on");break;case "fullScreen":b.toggleFullScreen(f);d.toggleClass(f,"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;default:b.execCommand(e,!1,f.getAttribute("data-value")), | ||
d.toggleClass(f,"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)})):g._findButtonEffectTag()},onKeyDown_wysiwyg:function(c){b._setSelectionNode();var f=c.keyCode,e=c.shiftKey,u=c.ctrlKey||c.metaKey,n=c.altKey;c.stopPropagation(); | ||
if(u&&!/^(?:16|17|18)$/.test(f)){var t;if(t=!(e&&83!==f))(t=g._shortcutKeyCode[f])?(b.execCommand(t[0],!1,null),d.toggleClass(b.commandMap[t[1]],"on"),t=!0):t=!1;if(t){c.preventDefault();return}}switch(f){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)){f=d.getParentNode(c,"table");f=d.getListChildren(f,d.isCell);c=e?d.prevIdx(f,c):d.nextIdx(f,c);c!==f.length||e||(c=0);-1===c&&e&&(c=f.length-1);c=f[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(),f=b.createRange(),f.setStart(e, | ||
b._variable.tabSize),f.setEnd(e,b._variable.tabSize),0<c.rangeCount&&c.removeAllRanges(),c.addRange(f))}}},onKeyUp_wysiwyg:function(a){b._setSelectionNode();g._directionKeyKeyCode.test(a.keyCode)&&g._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",g.resize_editor);document.removeEventListener("mouseup",d)}c.stopPropagation();b._variable.resizeClientY=c.clientY;a.element.resizeBackground.style.display="block";document.addEventListener("mousemove",g.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",g.touchstart_toolbar);a.tool.bar.addEventListener("touchmove",g.touchmove_toolbar);a.tool.bar.addEventListener("touchend",g.onClick_toolbar);a.tool.bar.addEventListener("click",g.onClick_toolbar);a.element.wysiwygWindow.addEventListener("mouseup",g.onMouseUp_wysiwyg);a.element.wysiwygWindow.addEventListener("keydown", | ||
g.onKeyDown_wysiwyg);a.element.wysiwygWindow.addEventListener("keyup",g.onKeyUp_wysiwyg);a.element.wysiwygWindow.addEventListener("scroll",g.onScroll_wysiwyg);a.element.wysiwygWindow.addEventListener("drop",g.onDrop_wysiwyg);a.element.resizebar.addEventListener("mousedown",g.onMouseDown_resizeBar);window.addEventListener("resize",g.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 g=b.constructed;b=b.options;e={element:{textElement:e,topArea:g._top,relative:g._relative,resizebar:g._resizeBar,editorArea:g._editorArea,wysiwygWindow:g._editorArea.getElementsByClassName("sun-editor-id-wysiwyg")[0].contentWindow,wysiwygElement:g._editorArea.getElementsByClassName("sun-editor-id-wysiwyg")[0], | ||
code:g._editorArea.getElementsByClassName("sun-editor-id-code")[0],loading:g._loading,resizeBackground:g._resizeBack},tool:{bar:g._toolBar,cover:g._toolBar.getElementsByClassName("sun-editor-id-toolbar-cover")[0],bold:g._toolBar.getElementsByClassName("sun-editor-id-bold")[0],underline:g._toolBar.getElementsByClassName("sun-editor-id-underline")[0],italic:g._toolBar.getElementsByClassName("sun-editor-id-italic")[0],strike:g._toolBar.getElementsByClassName("sun-editor-id-strike")[0],font:g._toolBar.getElementsByClassName("sun-editor-font-family")[0], | ||
fontSize:g._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
2008832
34275