diff --git a/lib/assets/summernote-lite-unminified.js b/lib/assets/summernote-lite-unminified.js index 0a382964..a774f31d 100644 --- a/lib/assets/summernote-lite-unminified.js +++ b/lib/assets/summernote-lite-unminified.js @@ -3021,9 +3021,19 @@ let dataTransfer = o.originalEvent.dataTransfer; const matchedFileTypes = dataTransfer.types.filter(type => "Files" === type); if (matchedFileTypes && matchedFileTypes.length) { - var i = t.context.invoke("codeview.isActivated"), - r = t.$editor.width() > 0 && t.$editor.height() > 0; - i || e.length || !r || (t.$editor.addClass("dragover"), t.$dropzone.width(t.$editor.width()), t.$dropzone.height(t.$editor.height()), n.text(t.lang.image.dragImageHere)), e = e.add(o.target) + var i = t.context.invoke("codeview.isActivated"); + var r = t.$editor.width() > 0 && t.$editor.height() > 0; + if (!i && !e.length && r) { + t.$editor.addClass('dragover'); + if (!t.$dropzone.width()) { + t.$dropzone.width(t.$editor.width()); + } + if (!t.$dropzone.height()) { + t.$dropzone.height(t.$editor.height()); + } + n.text(t.lang.image.dragImageHere); + } + e = e.add(o.target); } }), (this.documentEventHandlers.onDragleave = function (n) { diff --git a/lib/assets/summernote-lite-v2.min.js b/lib/assets/summernote-lite-v2.min.js index e35d29f1..7dc93858 100644 --- a/lib/assets/summernote-lite-v2.min.js +++ b/lib/assets/summernote-lite-v2.min.js @@ -1,2 +1,2 @@ -/*! For license information please see summernote-lite.min.js.LICENSE.txt */ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("jquery"));else if("function"==typeof define&&define.amd)define(["jquery"],e);else{var n=e("object"==typeof exports?require("jquery"):t.jQuery);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(window,function(t){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e||4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,(function(e){return t[e]}).bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=51)}({0:function(e,n){e.exports=t},1:function(t,e,n){"use strict";var o=n(0),i=n.n(o);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){for(var n=0;n0||navigator.msMaxTouchPoints>0,p={isMac:navigator.appVersion.indexOf("Mac")>-1,isMSIE:u,isEdge:h,isFF:!h&&/firefox/i.test(c),isPhantom:/PhantomJS/i.test(c),isWebkit:!h&&/webkit/i.test(c),isChrome:!h&&/chrome/i.test(c),isSafari:!h&&/safari/i.test(c)&&!/chrome/i.test(c),browserVersion:l,jqueryVersion:parseFloat(i.a.fn.jquery),isSupportAmd:a,isSupportTouch:f,isFontInstalled:function(t){var e="Comic Sans MS"===t?"Courier New":"Comic Sans MS",n=document.createElement("canvas").getContext("2d");n.font="200px '"+e+"'";var o=n.measureText("mmmmmmmmmmwwwww").width;return n.font="200px "+s(t)+', "'+e+'"',o!==n.measureText("mmmmmmmmmmwwwww").width},isW3CRangeSupport:!!document.createRange,inputEventName:u?"DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted":"input",genericFontFamilies:r,validFontName:s},v=0,m={eq:function(t){return function(e){return t===e}},eq2:function(t,e){return t===e},peq2:function(t){return function(e,n){return e[t]===n[t]}},ok:function(){return!0},fail:function(){return!1},self:function(t){return t},not:function(t){return function(){return!t.apply(t,arguments)}},and:function(t,e){return function(n){return t(n)&&e(n)}},invoke:function(t,e){return function(){return t[e].apply(t,arguments)}},resetUniqueId:function(){v=0},uniqueId:function(t){var e=++v+"";return t?t+e:e},rect2bnd:function(t){var e=i()(document);return{top:t.top+e.scrollTop(),left:t.left+e.scrollLeft(),width:t.right-t.left,height:t.bottom-t.top}},invertObject:function(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[t[n]]=n);return e},namespaceToCamel:function(t,e){return(e=e||"")+t.split(".").map(function(t){return t.substring(0,1).toUpperCase()+t.substring(1)}).join("")},debounce:function(t,e,n){var o;return function(){var i=this,a=arguments,r=function(){o=null,n||t.apply(i,a)},s=n&&!o;clearTimeout(o),o=setTimeout(r,e),s&&t.apply(i,a)}},isValidUrl:function(t){return/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi.test(t)}};function g(t){return t[0]}function b(t){return t[t.length-1]}function k(t){return t.slice(1)}function y(t,e){if(t&&t.length&&e){if(t.indexOf)return -1!==t.indexOf(e);if(t.contains)return t.contains(e)}return!1}var C={head:g,last:b,initial:function(t){return t.slice(0,t.length-1)},tail:k,prev:function(t,e){if(t&&t.length&&e){var n=t.indexOf(e);return -1===n?null:t[n-1]}return null},next:function(t,e){if(t&&t.length&&e){var n=t.indexOf(e);return -1===n?null:t[n+1]}return null},find:function(t,e){for(var n=0,o=t.length;n";function M(t){return $(t)?t.nodeValue.length:t?t.childNodes.length:0}function O(t){var e=M(t);return 0===e||!$(t)&&1===e&&t.innerHTML===z||!(!C.all(t.childNodes,$)||""!==t.innerHTML)}function U(t){S(t)||M(t)||(t.innerHTML=z)}function W(t,e){for(;t;){if(e(t))return t;if(w(t))break;t=t.parentNode}return null}function j(t,e){e=e||m.fail;var n=[];return W(t,function(t){return w(t)||n.push(t),e(t)}),n}function K(t,e){e=e||m.fail;for(var n=[];t&&!e(t);)n.push(t),t=t.nextSibling;return n}function V(t,e){var n=e.nextSibling,o=e.parentNode;return n?o.insertBefore(t,n):o.appendChild(t),t}function q(t,e){return i.a.each(e,function(e,n){t.appendChild(n)}),t}function G(t){return 0===t.offset}function Y(t){return t.offset===M(t.node)}function Z(t){return G(t)||Y(t)}function X(t,e){for(;t&&t!==e;){if(0!==J(t))return!1;t=t.parentNode}return!0}function Q(t,e){if(!e)return!1;for(;t&&t!==e;){if(J(t)!==M(t.parentNode)-1)return!1;t=t.parentNode}return!0}function J(t){for(var e=0;t=t.previousSibling;)e+=1;return e}function tt(t){return!!(t&&t.childNodes&&t.childNodes.length)}function te(t,e){var n,o;if(0===t.offset){if(w(t.node))return null;n=t.node.parentNode,o=J(t.node)}else tt(t.node)?o=M(n=t.node.childNodes[t.offset-1]):(n=t.node,o=e?0:t.offset-1);return{node:n,offset:o}}function tn(t,e){var n,o;if(M(t.node)===t.offset){if(w(t.node))return null;var i=ti(t.node);i?(n=i,o=0):(n=t.node.parentNode,o=J(t.node)+1)}else tt(t.node)?(n=t.node.childNodes[t.offset],o=0):(n=t.node,o=e?M(t.node):t.offset+1);return{node:n,offset:o}}function to(t,e){var n,o;if(O(t.node))return{node:n=t.node.nextSibling,offset:o=0};if(M(t.node)===t.offset){if(w(t.node))return null;var i=ti(t.node);i?(n=i,o=0):(n=t.node.parentNode,o=J(t.node)+1),w(n)&&(n=t.node.nextSibling,o=0)}else if(tt(t.node)){if(o=0,O(n=t.node.childNodes[t.offset]))return null}else if(n=t.node,o=e?M(t.node):t.offset+1,O(n))return null;return{node:n,offset:o}}function ti(t){if(t.nextSibling&&t.parent===t.nextSibling.parent)return $(t.nextSibling)?t.nextSibling:ti(t.nextSibling)}function ta(t,e){return t.node===e.node&&t.offset===e.offset}function tr(t,e){var n=e&&e.isSkipPaddingBlankHTML,o=e&&e.isNotSplitEdgePoint,i=e&&e.isDiscardEmptySplits;if(i&&(n=!0),Z(t)&&($(t.node)||o)){if(G(t))return t.node;if(Y(t))return t.node.nextSibling}if($(t.node))return t.node.splitText(t.offset);var a=t.node.childNodes[t.offset],r=V(t.node.cloneNode(!1),t.node);return q(r,K(a)),n||(U(t.node),U(r)),i&&(O(t.node)&&tc(t.node),O(r))?(tc(r),t.node.nextSibling):r}function ts(t,e,n){var o=j(e.node,m.eq(t));return o.length?1===o.length?tr(e,n):o.reduce(function(t,o){return t===e.node&&(t=tr(e,n)),tr({node:o,offset:t?J(t):M(o)},n)}):null}function tl(t){return document.createElement(t)}function tc(t,e){if(t&&t.parentNode){if(t.removeNode)return t.removeNode(e);var n=t.parentNode;if(!e){for(var o=[],i=0,a=t.childNodes.length;i".concat(z,"

"),makePredByNodeName:x,isEditable:w,isControlSizing:function(t){return t&&i()(t).hasClass("note-control-sizing")},isText:$,isElement:function(t){return t&&1===t.nodeType},isVoid:S,isPara:N,isPurePara:function(t){return N(t)&&!_(t)},isHeading:function(t){return t&&/^H[1-7]/.test(t.nodeName.toUpperCase())},isInline:P,isBlock:m.not(P),isBodyInline:function(t){return P(t)&&!W(t,N)},isBody:B,isParaInline:function(t){return P(t)&&!!W(t,N)},isPre:T,isList:R,isTable:I,isData:E,isCell:A,isBlockquote:F,isBodyContainer:D,isAnchor:H,isDiv:x("DIV"),isLi:_,isBR:x("BR"),isSpan:x("SPAN"),isB:x("B"),isU:x("U"),isS:x("S"),isI:x("I"),isImg:x("IMG"),isTextarea:tu,deepestChildIsEmpty:function(t){do if(null===t.firstElementChild||""===t.firstElementChild.innerHTML)break;while(t=t.firstElementChild);return O(t)},isEmpty:O,isEmptyAnchor:m.and(H,O),isClosestSibling:function(t,e){return t.nextSibling===e||t.previousSibling===e},withClosestSiblings:function(t,e){e=e||m.ok;var n=[];return t.previousSibling&&e(t.previousSibling)&&n.push(t.previousSibling),n.push(t),t.nextSibling&&e(t.nextSibling)&&n.push(t.nextSibling),n},nodeLength:M,isLeftEdgePoint:G,isRightEdgePoint:Y,isEdgePoint:Z,isLeftEdgeOf:X,isRightEdgeOf:Q,isLeftEdgePointOf:function(t,e){return G(t)&&X(t.node,e)},isRightEdgePointOf:function(t,e){return Y(t)&&Q(t.node,e)},prevPoint:te,nextPoint:tn,nextPointWithEmptyNode:to,isSamePoint:ta,isVisiblePoint:function(t){if($(t.node)||!tt(t.node)||O(t.node))return!0;var e=t.node.childNodes[t.offset-1],n=t.node.childNodes[t.offset];return!(e&&!S(e)||n&&!S(n))},prevPointUntil:function(t,e){for(;t;){if(e(t))return t;t=te(t)}return null},nextPointUntil:function(t,e){for(;t;){if(e(t))return t;t=tn(t)}return null},isCharPoint:function(t){if(!$(t.node))return!1;var e=t.node.nodeValue.charAt(t.offset-1);return e&&" "!==e&&"\xa0"!==e},isSpacePoint:function(t){if(!$(t.node))return!1;var e=t.node.nodeValue.charAt(t.offset-1);return" "===e||"\xa0"===e},walkPoint:function(t,e,n,o){for(var i=t;i&&(n(i),!ta(i,e));)i=to(i,o&&t.node!==i.node&&e.node!==i.node)},ancestor:W,singleChildAncestor:function(t,e){for(t=t.parentNode;t&&1===M(t);){if(e(t))return t;if(w(t))break;t=t.parentNode}return null},listAncestor:j,lastAncestor:function(t,e){var n=j(t);return C.last(n.filter(e))},listNext:K,listPrev:function(t,e){e=e||m.fail;for(var n=[];t&&!e(t);)n.push(t),t=t.previousSibling;return n},listDescendant:function(t,e){var n=[];return e=e||m.ok,function o(i){t!==i&&e(i)&&n.push(i);for(var a=0,r=i.childNodes.length;a-1)return o;return null},wrap:function(t,e){var n=t.parentNode,o=i()("<"+e+">")[0];return n.insertBefore(o,t),o.appendChild(t),o},insertAfter:V,appendChildNodes:q,position:J,hasChildren:tt,makeOffsetPath:function(t,e){return j(e,m.eq(t)).map(J).reverse()},fromOffsetPath:function(t,e){for(var n=t,o=0,i=e.length;o\s]*)(.*?)(\s*\/?>)/g,function(t,e,n){n=n.toUpperCase();var o=/^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(n)&&!!e,i=/^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(n);return t+(o||i?"\n":"")})).trim()),n},value:td,posFromPlaceholder:function(t){var e=i()(t),n=e.offset(),o=e.outerHeight(!0);return{left:n.left,top:n.top+o}},attachEvents:function(t,e){Object.keys(e).forEach(function(n){t.on(n,e[n])})},detachEvents:function(t,e){Object.keys(e).forEach(function(n){t.off(n,e[n])})},isCustomStyleTag:function(t){return t&&!$(t)&&C.contains(t.classList,"note-styletag")}};function tf(t,e){for(var n=0;n1,i=o&&C.head(n),a=o?C.last(n):C.head(n),r=this.modules[i||"editor"];return!i&&this[a]?this[a].apply(this,e):r&&r[a]&&r.shouldInitialize()?r[a].apply(r,e):void 0}},],tf(t.prototype,e),n&&tf(t,n),o}();function tv(t,e){for(var n=0;n=0)break;o=r[n]}if(0!==n&&th.isText(r[n-1])){var s=document.body.createTextRange(),l=null;s.moveToElementText(o||i),s.collapse(!o),l=o?o.nextSibling:i.firstChild;var c=t.duplicate();c.setEndPoint("StartToStart",s);for(var u=c.text.replace(/[\r\n]/g,"").length;u>l.nodeValue.length&&l.nextSibling;)u-=l.nodeValue.length,l=l.nextSibling;l.nodeValue,e&&l.nextSibling&&th.isText(l.nextSibling)&&u===l.nodeValue.length&&(u-=l.nodeValue.length,l=l.nextSibling),i=l,n=u}return{cont:i,offset:n}}function tg(t){var e=document.body.createTextRange(),n=function t(e,n){var o,i;if(th.isText(e)){var a=th.listPrev(e,m.not(th.isText)),r=C.last(a).previousSibling;o=r||e.parentNode,n+=C.sum(C.tail(a),th.nodeLength),i=!r}else{if(o=e.childNodes[n]||e,th.isText(o))return t(o,0);n=0,i=!1}return{node:o,collapseToStart:i,offset:n}}(t.node,t.offset);return e.moveToElementText(n.node),e.collapse(n.collapseToStart),e.moveStart("character",n.offset),e}i.a.fn.extend({summernote:function(){var t=i.a.type(C.head(arguments)),e=i.a.extend({},i.a.summernote.options,"object"===t?C.head(arguments):{});e.langInfo=i.a.extend(!0,{},i.a.summernote.lang["en-US"],i.a.summernote.lang[e.lang]),e.icons=i.a.extend(!0,{},i.a.summernote.options.icons,e.icons),e.tooltip="auto"===e.tooltip?!p.isSupportTouch:e.tooltip,this.each(function(t,n){var o=i()(n);if(!o.data("summernote")){var a=new tp(o,e);o.data("summernote",a),o.data("summernote").triggerEvent("init",a.layoutInfo)}});var n=this.first();if(n.length){var o=n.data("summernote");if("string"===t)return o.invoke.apply(o,C.from(arguments));e.focus&&o.invoke("editor.focus")}return this}});var tb=function(){var t,e,n;function o(t,e,n,i){!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,o),this.sc=t,this.so=e,this.ec=n,this.eo=i,this.isOnEditable=this.makeIsOn(th.isEditable),this.isOnList=this.makeIsOn(th.isList),this.isOnAnchor=this.makeIsOn(th.isAnchor),this.isOnCell=this.makeIsOn(th.isCell),this.isOnData=this.makeIsOn(th.isData)}return t=o,e=[{key:"nativeRange",value:function(){if(p.isW3CRangeSupport){var t=document.createRange();return t.setStart(this.sc,this.so),t.setEnd(this.ec,this.eo),t}var e=tg({node:this.sc,offset:this.so});return e.setEndPoint("EndToEnd",tg({node:this.ec,offset:this.eo})),e}},{key:"getPoints",value:function(){return{sc:this.sc,so:this.so,ec:this.ec,eo:this.eo}}},{key:"getStartPoint",value:function(){return{node:this.sc,offset:this.so}}},{key:"getEndPoint",value:function(){return{node:this.ec,offset:this.eo}}},{key:"select",value:function(){var t=this.nativeRange();if(p.isW3CRangeSupport){var e=document.getSelection();e.rangeCount>0&&e.removeAllRanges(),e.addRange(t)}else t.select();return this}},{key:"scrollIntoView",value:function(t){var e=i()(t).height();return t.scrollTop+e0?e.so-1:0];if(t){var i=th.listPrev(t,th.isParaInline).reverse();if((i=i.concat(th.listNext(t.nextSibling,th.isParaInline))).length){var a=th.wrap(C.head(i),"p");th.appendChildNodes(a,C.tail(i))}}return this.normalize()}},{key:"insertNode",value:function(t){var e=this;(th.isText(t)||th.isInline(t))&&(e=this.wrapBodyInlineWithPara().deleteContents());var n=th.splitPoint(e.getStartPoint(),th.isInline(t));return n.rightNode?(n.rightNode.parentNode.insertBefore(t,n.rightNode),th.isEmpty(n.rightNode)&&th.isPara(t)&&n.rightNode.parentNode.removeChild(n.rightNode)):n.container.appendChild(t),t}},{key:"pasteHTML",value:function(t){t=i.a.trim(t);var e=i()("
").html(t)[0],n=C.from(e.childNodes),o=this,a=!1;return o.so>=0&&(n=n.reverse(),a=!0),n=n.map(function(t){return o.insertNode(t)}),a&&(n=n.reverse()),n}},{key:"toString",value:function(){var t=this.nativeRange();return p.isW3CRangeSupport?t.toString():t.text}},{key:"getWordRange",value:function(t){var e=this.getEndPoint();if(!th.isCharPoint(e))return this;var n=th.prevPointUntil(e,function(t){return!th.isCharPoint(t)});return t&&(e=th.nextPointUntil(e,function(t){return!th.isCharPoint(t)})),new o(n.node,n.offset,e.node,e.offset)}},{key:"getWordsRange",value:function(t){var e=this.getEndPoint(),n=function(t){return!th.isCharPoint(t)&&!th.isSpacePoint(t)};if(n(e))return this;var i=th.prevPointUntil(e,n);return t&&(e=th.nextPointUntil(e,n)),new o(i.node,i.offset,e.node,e.offset)}},{key:"getWordsMatchRange",value:function(t){var e=this.getEndPoint(),n=th.prevPointUntil(e,function(n){if(!th.isCharPoint(n)&&!th.isSpacePoint(n))return!0;var i=new o(n.node,n.offset,e.node,e.offset),a=t.exec(i.toString());return a&&0===a.index}),i=new o(n.node,n.offset,e.node,e.offset),a=i.toString(),r=t.exec(a);return r&&r[0].length===a.length?i:null}},{key:"bookmark",value:function(t){return{s:{path:th.makeOffsetPath(t,this.sc),offset:this.so},e:{path:th.makeOffsetPath(t,this.ec),offset:this.eo}}}},{key:"paraBookmark",value:function(t){return{s:{path:C.tail(th.makeOffsetPath(C.head(t),this.sc)),offset:this.so},e:{path:C.tail(th.makeOffsetPath(C.last(t),this.ec)),offset:this.eo}}}},{key:"getClientRects",value:function(){return this.nativeRange().getClientRects()}},],tv(t.prototype,e),n&&tv(t,n),o}(),tk={create:function(t,e,n,o){if(4===arguments.length)return new tb(t,e,n,o);if(2===arguments.length)return new tb(t,e,n=t,o=e);var i=this.createFromSelection();if(!i&&1===arguments.length){var a=arguments[0];return th.isEditable(a)&&(a=a.lastChild),this.createFromBodyElement(a,th.emptyPara===arguments[0].innerHTML)}return i},createFromBodyElement:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.createFromNode(t).collapse(e)},createFromSelection:function(){var t,e,n,o;if(p.isW3CRangeSupport){var i=document.getSelection();if(!i||0===i.rangeCount||th.isBody(i.anchorNode))return null;var a=i.getRangeAt(0);t=a.startContainer,e=a.startOffset,n=a.endContainer,o=a.endOffset}else{var r=document.selection.createRange(),s=r.duplicate();s.collapse(!1);var l=r;l.collapse(!0);var c=tm(l,!0),u=tm(s,!1);th.isText(c.node)&&th.isLeftEdgePoint(c)&&th.isTextNode(u.node)&&th.isRightEdgePoint(u)&&u.node.nextSibling===c.node&&(c=u),t=c.cont,e=c.offset,n=u.cont,o=u.offset}return new tb(t,e,n,o)},createFromNode:function(t){var e=t,n=0,o=t,i=th.nodeLength(o);return th.isVoid(e)&&(n=th.listPrev(e).length-1,e=e.parentNode),th.isBR(o)?(i=th.listPrev(o).length-1,o=o.parentNode):th.isVoid(o)&&(i=th.listPrev(o).length,o=o.parentNode),this.create(e,n,o,i)},createFromNodeBefore:function(t){return this.createFromNode(t).collapse(!0)},createFromNodeAfter:function(t){return this.createFromNode(t).collapse()},createFromBookmark:function(t,e){var n=th.fromOffsetPath(t,e.s.path),o=e.s.offset,i=th.fromOffsetPath(t,e.e.path),a=e.e.offset;return new tb(n,o,i,a)},createFromParaBookmark:function(t,e){var n=t.s.offset,o=t.e.offset,i=th.fromOffsetPath(C.head(e),t.s.path),a=th.fromOffsetPath(C.last(e),t.e.path);return new tb(i,n,a,o)}},ty={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,DELETE:46,LEFT:37,UP:38,RIGHT:39,DOWN:40,NUM0:48,NUM1:49,NUM2:50,NUM3:51,NUM4:52,NUM5:53,NUM6:54,NUM7:55,NUM8:56,B:66,E:69,I:73,J:74,K:75,L:76,R:82,S:83,U:85,V:86,Y:89,Z:90,SLASH:191,LEFTBRACKET:219,BACKSLASH:220,RIGHTBRACKET:221,HOME:36,END:35,PAGEUP:33,PAGEDOWN:34},tC={isEdit:function(t){return C.contains([ty.BACKSPACE,ty.TAB,ty.ENTER,ty.SPACE,ty.DELETE],t)},isMove:function(t){return C.contains([ty.LEFT,ty.UP,ty.RIGHT,ty.DOWN],t)},isNavigation:function(t){return C.contains([ty.HOME,ty.END,ty.PAGEUP,ty.PAGEDOWN],t)},nameFromCode:m.invertObject(ty),code:ty};function tw(t,e){for(var n=0;n0&&(this.stackOffset--,this.applySnapshot(this.stack[this.stackOffset]))}},{key:"redo",value:function(){this.stack.length-1>this.stackOffset&&(this.stackOffset++,this.applySnapshot(this.stack[this.stackOffset]))}},{key:"recordUndo",value:function(){this.stackOffset++,this.stack.length>this.stackOffset&&(this.stack=this.stack.slice(0,this.stackOffset)),this.stack.push(this.makeSnapshot()),this.stack.length>this.context.options.historyLimit&&(this.stack.shift(),this.stackOffset-=1)}},],tw(t.prototype,e),n&&tw(t,n),o}();function t$(t,e){for(var n=0;n-1;n["list-style"]=a?"unordered":"ordered"}else n["list-style"]="none";var r=th.ancestor(t.sc,th.isPara);if(r&&r.style["line-height"])n["line-height"]=r.style.lineHeight;else{var s=parseInt(n["line-height"],10)/parseInt(n["font-size"],10);n["line-height"]=s.toFixed(1)}return n.anchor=t.isOnAnchor()&&th.ancestor(t.sc,th.isAnchor),n.ancestors=th.listAncestor(t.sc,th.isEditable),n.range=t,n}},],t$(t.prototype,e),n&&t$(t,n),o}();function t9(t,e){for(var n=0;n25?e-25:""})})}),n.select()}},{key:"toggleList",value:function(t,e){var n=this,o=tk.create(e).wrapBodyInlineWithPara(),a=o.nodes(th.isPara,{includeAncestor:!0}),r=o.paraBookmark(a),s=C.clusterBy(a,m.peq2("parentNode"));if(C.find(a,th.isPurePara)){var l=[];i.a.each(s,function(e,o){l=l.concat(n.wrapList(o,t))}),a=l}else{var c=o.nodes(th.isList,{includeAncestor:!0}).filter(function(e){return!i.a.nodeName(e,t)});c.length?i.a.each(c,function(e,n){th.replace(n,t)}):a=this.releaseList(s,!0)}tk.createFromParaBookmark(r,a).select()}},{key:"wrapList",value:function(t,e){var n=C.head(t),o=C.last(t),i=th.isList(n.previousSibling)&&n.previousSibling,a=th.isList(o.nextSibling)&&o.nextSibling,r=i||th.insertAfter(th.create(e||"UL"),o);return t=t.map(function(t){return th.isPurePara(t)?th.replace(t,"LI"):t}),th.appendChildNodes(r,t),a&&(th.appendChildNodes(r,C.from(a.childNodes)),th.remove(a)),t}},{key:"releaseList",value:function(t,e){var n=this,o=[];return i.a.each(t,function(t,a){var r=C.head(a),s=C.last(a),l=e?th.lastAncestor(r,th.isList):r.parentNode,c=l.parentNode;if("LI"===l.parentNode.nodeName)a.map(function(t){var e=n.findNextSiblings(t);c.nextSibling?c.parentNode.insertBefore(t,c.nextSibling):c.parentNode.appendChild(t),e.length&&(n.wrapList(e,l.nodeName),t.appendChild(e[0].parentNode))}),0===l.children.length&&c.removeChild(l),0===c.childNodes.length&&c.parentNode.removeChild(c);else{var u=l.childNodes.length>1?th.splitTree(l,{node:s.parentNode,offset:th.position(s)+1},{isSkipPaddingBlankHTML:!0}):null,d=th.splitTree(l,{node:r.parentNode,offset:th.position(r)},{isSkipPaddingBlankHTML:!0});a=e?th.listDescendant(d,th.isLi):C.from(d.childNodes).filter(th.isLi),!e&&th.isList(l.parentNode)||(a=a.map(function(t){return th.replace(t,"P")})),i.a.each(C.from(a).reverse(),function(t,e){th.insertAfter(e,l)});var h=C.compact([l,d,u]);i.a.each(h,function(t,e){var n=[e].concat(th.listDescendant(e,th.isList));i.a.each(n.reverse(),function(t,e){th.nodeLength(e)||th.remove(e,!0)})})}o=o.concat(a)}),o}},{key:"appendToPrevious",value:function(t){return t.previousSibling?th.appendChildNodes(t.previousSibling,[t]):this.wrapList([t],"LI")}},{key:"findList",value:function(t){return t?C.find(t.children,function(t){return["OL","UL"].indexOf(t.nodeName)>-1}):null}},{key:"findNextSiblings",value:function(t){for(var e=[];t.nextSibling;)e.push(t.nextSibling),t=t.nextSibling;return e}},],t9(t.prototype,e),n&&t9(t,n),o}();function tT(t,e){for(var n=0;n1,i=e.rowSpan>1,r=t.rowIndex===a.rowPos&&e.cellIndex===a.colPos;l(t.rowIndex,n,t,e,i,o,!1);var s=e.attributes.rowSpan?parseInt(e.attributes.rowSpan.value,10):0;if(s>1)for(var c=1;c1)for(var p=1;p=n.cellIndex&&n.cellIndex<=e&&!o&&a.colPos++}function f(e){switch(n){case t.where.Column:if(e.isColSpan)return t.resultAction.SubtractSpanCount;break;case t.where.Row:if(!e.isVirtual&&e.isRowSpan)return t.resultAction.AddCell;if(e.isRowSpan)return t.resultAction.SubtractSpanCount}return t.resultAction.RemoveCell}function p(e){switch(n){case t.where.Column:if(e.isColSpan)return t.resultAction.SumSpanCount;if(e.isRowSpan&&e.isVirtual)return t.resultAction.Ignore;break;case t.where.Row:if(e.isRowSpan)return t.resultAction.SumSpanCount;if(e.isColSpan&&e.isVirtual)return t.resultAction.Ignore}return t.resultAction.AddCell}this.getActionList=function(){for(var e=n===t.where.Row?a.rowPos:-1,i=n===t.where.Column?a.colPos:-1,l=0,u=!0;u;){var d=e>=0?e:l,h=i>=0?i:l,v=r[d];if(!v)return u=!1,s;var m=v[h];if(!m)return u=!1,s;var g=t.resultAction.Ignore;switch(o){case t.requestAction.Add:g=p(m);break;case t.requestAction.Delete:g=f(m)}s.push(c(m,g,d,h)),l++}return s},e&&e.tagName&&("td"===e.tagName.toLowerCase()||"th"===e.tagName.toLowerCase())&&(a.colPos=e.cellIndex,e.parentElement&&e.parentElement.tagName&&"tr"===e.parentElement.tagName.toLowerCase()&&(a.rowPos=e.parentElement.rowIndex)),function(){for(var t=i.rows,e=0;e"),s=new tE(n,tE.where.Row,tE.requestAction.Add,i()(o).closest("table")[0]).getActionList(),l=0;l"+th.blank+"");break;case tE.resultAction.SumSpanCount:if("top"===e&&(c.baseCell.parent?c.baseCell.closest("tr").rowIndex:0)<=o[0].rowIndex){var d=i()("
").append(i()(""+th.blank+"").removeAttr("rowspan")).html();r.append(d);break}var h=parseInt(c.baseCell.rowSpan,10);h++,c.baseCell.setAttribute("rowSpan",h)}}if("top"===e)o.before(r);else{if(n.rowSpan>1){var f=o[0].rowIndex+(n.rowSpan-2);return void i()(i()(o).parent().find("tr")[f]).after(i()(r))}o.after(r)}}},{key:"addCol",value:function(t,e){var n=th.ancestor(t.commonAncestor(),th.isCell),o=i()(n).closest("tr");i()(o).siblings().push(o);for(var a=new tE(n,tE.where.Column,tE.requestAction.Add,i()(o).closest("table")[0]).getActionList(),r=0;r"+th.blank+""):i()(s.baseCell).before(""+th.blank+"");break;case tE.resultAction.SumSpanCount:if("right"===e){var c=parseInt(s.baseCell.colSpan,10);c++,s.baseCell.setAttribute("colSpan",c)}else i()(s.baseCell).before(""+th.blank+"")}}}},{key:"recoverAttributes",value:function(t){var e="";if(!t)return e;for(var n=t.attributes||[],o=0;o1,d=u?parseInt(l.rowSpan,10):0;switch(r[s].action){case tE.resultAction.Ignore:continue;case tE.resultAction.AddCell:var h=n.next("tr")[0];if(!h)continue;var f=n[0].cells[o];u&&(d>2?(d--,h.insertBefore(f,h.cells[o]),h.cells[o].setAttribute("rowSpan",d),h.cells[o].innerHTML=""):2===d&&(h.insertBefore(f,h.cells[o]),h.cells[o].removeAttribute("rowSpan"),h.cells[o].innerHTML=""));continue;case tE.resultAction.SubtractSpanCount:u&&(d>2?(d--,l.setAttribute("rowSpan",d),c.rowIndex!==a&&l.cellIndex===o&&(l.innerHTML="")):2===d&&(l.removeAttribute("rowSpan"),c.rowIndex!==a&&l.cellIndex===o&&(l.innerHTML="")));continue;case tE.resultAction.RemoveCell:continue}}n.remove()}},{key:"deleteCol",value:function(t){for(var e=th.ancestor(t.commonAncestor(),th.isCell),n=i()(e).closest("tr"),o=n.children("td, th").index(i()(e)),a=new tE(e,tE.where.Column,tE.requestAction.Delete,i()(n).closest("table")[0]).getActionList(),r=0;r1){var l=s.colSpan?parseInt(s.colSpan,10):0;l>2?(l--,s.setAttribute("colSpan",l),s.cellIndex===o&&(s.innerHTML="")):2===l&&(s.removeAttribute("colSpan"),s.cellIndex===o&&(s.innerHTML=""))}continue;case tE.resultAction.RemoveCell:th.remove(a[r].baseCell,!0);continue}}},{key:"createTable",value:function(t,e,n){for(var o,a=[],r=0;r"+th.blank+"");o=a.join("");for(var s,l=[],c=0;c"+o+"");s=l.join("");var u=i()(""+s+"
");return n&&n.tableClassName&&u.addClass(n.tableClassName),u[0]}},{key:"deleteTable",value:function(t){var e=th.ancestor(t.commonAncestor(),th.isCell);i()(e).closest("table").remove()}},],tI(t.prototype,e),n&&tI(t,n),o}();function tR(t,e){for(var n=0;n0&&e.isLimited(l))){var c=s.toString()!==o;"string"==typeof n&&(n=n.trim()),e.options.onCreateLink?n=e.options.onCreateLink(n):r&&(n=/^([A-Za-z][A-Za-z0-9+-.]*\:|#|\/)/.test(n)?n:e.options.defaultProtocol+n);var u=[];if(c){var d=(s=s.deleteContents()).insertNode(i()(""+o+"")[0]);u.push(d)}else u=e.style.styleNodes(s,{nodeName:"A",expandClosestSibling:!0,onlyPartialContains:!0});i.a.each(u,function(t,e){i()(e).attr("href",n),a?i()(e).attr("target","_blank"):i()(e).removeAttr("target")}),e.setLastRange(e.createRangeFromList(u).select())}}),this.color=this.wrapCommand(function(t){var e=t.foreColor,n=t.backColor;e&&document.execCommand("foreColor",!1,e),n&&document.execCommand("backColor",!1,n)}),this.foreColor=this.wrapCommand(function(t){document.execCommand("foreColor",!1,t)}),this.insertTable=this.wrapCommand(function(t){var n=t.split("x");e.getLastRange().deleteContents().insertNode(e.table.createTable(n[0],n[1],e.options))}),this.removeMedia=this.wrapCommand(function(){var t=i()(e.restoreTarget()).parent();t.closest("figure").length?t.closest("figure").remove():t=i()(e.restoreTarget()).detach(),e.context.triggerEvent("media.delete",t,e.$editable)}),this.floatMe=this.wrapCommand(function(t){var n=i()(e.restoreTarget());n.toggleClass("note-float-left","left"===t),n.toggleClass("note-float-right","right"===t),n.css("float","none"===t?"":t)}),this.resize=this.wrapCommand(function(t){var n=i()(e.restoreTarget());0===(t=parseFloat(t))?n.css("width",""):n.css({width:100*t+"%",height:""})})}return t=o,e=[{key:"initialize",value:function(){var t=this;this.$editable.on("keydown",function(e){if(e.keyCode===tC.code.ENTER&&t.context.triggerEvent("enter",e),t.context.triggerEvent("keydown",e),t.snapshot=t.history.makeSnapshot(),t.hasKeyShortCut=!1,e.isDefaultPrevented()||(t.options.shortcuts?t.hasKeyShortCut=t.handleKeyMap(e):t.preventDefaultEditableShortCuts(e)),t.isLimited(1,e)){var n=t.getLastRange();if(n.eo-n.so==0)return!1}t.setLastRange(),t.options.recordEveryKeystroke&&!1===t.hasKeyShortCut&&t.history.recordUndo()}).on("keyup",function(e){t.setLastRange(),t.context.triggerEvent("keyup",e)}).on("focus",function(e){t.setLastRange(),t.context.triggerEvent("focus",e)}).on("blur",function(e){t.context.triggerEvent("blur",e)}).on("mousedown",function(e){t.context.triggerEvent("mousedown",e)}).on("mouseup",function(e){t.setLastRange(),t.history.recordUndo(),t.context.triggerEvent("mouseup",e)}).on("scroll",function(e){t.context.triggerEvent("scroll",e)}).on("paste",function(e){t.setLastRange(),t.context.triggerEvent("paste",e)}).on("input",function(){t.isLimited(0)&&t.snapshot&&t.history.applySnapshot(t.snapshot)}),this.$editable.attr("spellcheck",this.options.spellCheck),this.$editable.attr("autocorrect",this.options.spellCheck),this.options.disableGrammar&&this.$editable.attr("data-gramm",!1),this.$editable.html(th.html(this.$note)||th.emptyPara),this.$editable.on(p.inputEventName,m.debounce(function(){t.context.triggerEvent("change",t.$editable.html(),t.$editable)},10)),this.$editable.on("focusin",function(e){t.context.triggerEvent("focusin",e)}).on("focusout",function(e){t.context.triggerEvent("focusout",e)}),this.options.airMode?this.options.overrideContextMenu&&this.$editor.on("contextmenu",function(e){return t.context.triggerEvent("contextmenu",e),!1}):(this.options.width&&this.$editor.outerWidth(this.options.width),this.options.height&&this.$editable.outerHeight(this.options.height),this.options.maxHeight&&this.$editable.css("max-height",this.options.maxHeight),this.options.minHeight&&this.$editable.css("min-height",this.options.minHeight)),this.history.recordUndo(),this.setLastRange()}},{key:"destroy",value:function(){this.$editable.off()}},{key:"handleKeyMap",value:function(t){var e=this.options.keyMap[p.isMac?"mac":"pc"],n=[];t.metaKey&&n.push("CMD"),t.ctrlKey&&!t.altKey&&n.push("CTRL"),t.shiftKey&&n.push("SHIFT");var o=tC.nameFromCode[t.keyCode];o&&n.push(o);var i=e[n.join("+")];if("TAB"!==o||this.options.tabDisable){if(i){if(!1!==this.context.invoke(i))return t.preventDefault(),!0}else tC.isEdit(t.keyCode)&&this.afterCommand()}else this.afterCommand();return!1}},{key:"preventDefaultEditableShortCuts",value:function(t){(t.ctrlKey||t.metaKey)&&C.contains([66,73,85],t.keyCode)&&t.preventDefault()}},{key:"isLimited",value:function(t,e){return t=t||0,(void 0===e||!(tC.isMove(e.keyCode)||tC.isNavigation(e.keyCode)||e.ctrlKey||e.metaKey||C.contains([tC.code.BACKSPACE,tC.code.DELETE],e.keyCode)))&&this.options.maxTextLength>0&&this.$editable.text().length+t>this.options.maxTextLength}},{key:"createRange",value:function(){return this.focus(),this.setLastRange(),this.getLastRange()}},{key:"createRangeFromList",value:function(t){var e=tk.createFromNodeBefore(C.head(t)).getStartPoint(),n=tk.createFromNodeAfter(C.last(t)).getEndPoint();return tk.create(e.node,e.offset,n.node,n.offset)}},{key:"setLastRange",value:function(t){t?this.lastRange=t:(this.lastRange=tk.create(this.editable),0===i()(this.lastRange.sc).closest(".note-editable").length&&(this.lastRange=tk.createFromBodyElement(this.editable)))}},{key:"getLastRange",value:function(){return this.lastRange||this.setLastRange(),this.lastRange}},{key:"saveRange",value:function(t){t&&this.getLastRange().collapse().select()}},{key:"restoreRange",value:function(){this.lastRange&&(this.lastRange.select(),this.focus())}},{key:"saveTarget",value:function(t){this.$editable.data("target",t)}},{key:"clearTarget",value:function(){this.$editable.removeData("target")}},{key:"restoreTarget",value:function(){return this.$editable.data("target")}},{key:"currentStyle",value:function(){var t=tk.create();return t&&(t=t.normalize()),t?this.style.current(t):this.style.fromNode(this.$editable)}},{key:"styleFromNode",value:function(t){return this.style.fromNode(t)}},{key:"undo",value:function(){this.context.triggerEvent("before.command",this.$editable.html()),this.history.undo(),this.context.triggerEvent("change",this.$editable.html(),this.$editable)}},{key:"commit",value:function(){this.context.triggerEvent("before.command",this.$editable.html()),this.history.commit(),this.context.triggerEvent("change",this.$editable.html(),this.$editable)}},{key:"redo",value:function(){this.context.triggerEvent("before.command",this.$editable.html()),this.history.redo(),this.context.triggerEvent("change",this.$editable.html(),this.$editable)}},{key:"beforeCommand",value:function(){this.context.triggerEvent("before.command",this.$editable.html()),document.execCommand("styleWithCSS",!1,this.options.styleWithCSS),this.focus()}},{key:"afterCommand",value:function(t){this.normalizeContent(),this.history.recordUndo(),t||this.context.triggerEvent("change",this.$editable.html(),this.$editable)}},{key:"tab",value:function(){var t=this.getLastRange();if(t.isCollapsed()&&t.isOnCell())this.table.tab(t);else{if(0===this.options.tabSize)return!1;this.isLimited(this.options.tabSize)||(this.beforeCommand(),this.typing.insertTab(t,this.options.tabSize),this.afterCommand())}}},{key:"untab",value:function(){var t=this.getLastRange();if(t.isCollapsed()&&t.isOnCell())this.table.tab(t,!0);else if(0===this.options.tabSize)return!1}},{key:"wrapCommand",value:function(t){return function(){this.beforeCommand(),t.apply(this,arguments),this.afterCommand()}}},{key:"insertImage",value:function(t,e){var n,o=this;return(n=t,i.a.Deferred(function(t){var e=i()("");e.one("load",function(){e.off("error abort"),t.resolve(e)}).one("error abort",function(){e.off("load").detach(),t.reject(e)}).css({display:"none"}).appendTo(document.body).attr("src",n)}).promise()).then(function(t){o.beforeCommand(),"function"==typeof e?e(t):("string"==typeof e&&t.attr("data-filename",e),t.css("width",Math.min(o.$editable.width(),t.width()))),t.show(),o.getLastRange().insertNode(t[0]),o.setLastRange(tk.createFromNodeAfter(t[0]).select()),o.afterCommand()}).fail(function(t){o.context.triggerEvent("image.upload.error",src,t)})}},{key:"insertImagesAsDataURL",value:function(t){var e=this;i.a.each(t,function(t,n){var o,a=n.name;e.options.maximumImageFileSize&&e.options.maximumImageFileSize":t),e&&e.length&&(e[0].tagName.toUpperCase()!==t.toUpperCase()&&(e=e.find(t)),e&&e.length)){var n=e[0].className||"";if(n){var o=this.createRange();i()([o.sc,o.ec]).closest(t).addClass(n)}}}},{key:"formatPara",value:function(){this.formatBlock("P")}},{key:"fontStyling",value:function(t,e){var n=this.getLastRange();if(""!==n){var o=this.style.styleNodes(n);if(this.$editor.find(".note-status-output").html(""),i()(o).css(t,e),n.isCollapsed()){var a=C.head(o);a&&!th.nodeLength(a)&&(a.innerHTML=th.ZERO_WIDTH_NBSP_CHAR,tk.createFromNode(a.firstChild).select(),this.setLastRange(),this.$editable.data("bogus",a))}else this.setLastRange(this.createRangeFromList(o).select())}else{var r=i.a.now();this.$editor.find(".note-status-output").html('
'+this.lang.output.noSelection+"
"),setTimeout(function(){i()("#note-status-output-"+r).remove()},5e3)}}},{key:"unlink",value:function(){var t=this.getLastRange();if(t.isOnAnchor()){var e=th.ancestor(t.sc,th.isAnchor);(t=tk.createFromNode(e)).select(),this.setLastRange(),this.beforeCommand(),document.execCommand("unlink"),this.afterCommand()}}},{key:"getLinkInfo",value:function(){var t=this.getLastRange().expand(th.isAnchor),e=i()(C.head(t.nodes(th.isAnchor))),n={range:t,text:t.toString(),url:e.length?e.attr("href"):""};return e.length&&(n.isNewWindow="_blank"===e.attr("target")),n}},{key:"addRow",value:function(t){var e=this.getLastRange(this.$editable);e.isCollapsed()&&e.isOnCell()&&(this.beforeCommand(),this.table.addRow(e,t),this.afterCommand())}},{key:"addCol",value:function(t){var e=this.getLastRange(this.$editable);e.isCollapsed()&&e.isOnCell()&&(this.beforeCommand(),this.table.addCol(e,t),this.afterCommand())}},{key:"deleteRow",value:function(){var t=this.getLastRange(this.$editable);t.isCollapsed()&&t.isOnCell()&&(this.beforeCommand(),this.table.deleteRow(t),this.afterCommand())}},{key:"deleteCol",value:function(){var t=this.getLastRange(this.$editable);t.isCollapsed()&&t.isOnCell()&&(this.beforeCommand(),this.table.deleteCol(t),this.afterCommand())}},{key:"deleteTable",value:function(){var t=this.getLastRange(this.$editable);t.isCollapsed()&&t.isOnCell()&&(this.beforeCommand(),this.table.deleteTable(t),this.afterCommand())}},{key:"resizeTo",value:function(t,e,n){var o;if(n){var i=t.y/t.x,a=e.data("ratio");o={width:a>i?t.x:t.y/a,height:a>i?t.x*a:t.y}}else o={width:t.x,height:t.y};e.css(o)}},{key:"hasFocus",value:function(){return this.$editable.is(":focus")}},{key:"focus",value:function(){this.hasFocus()||this.$editable.focus()}},{key:"isEmpty",value:function(){return th.isEmpty(this.$editable[0])||th.emptyPara===this.$editable.html()}},{key:"empty",value:function(){this.context.invoke("code",th.emptyPara)}},{key:"normalizeContent",value:function(){this.$editable[0].normalize()}},],tR(t.prototype,e),n&&tR(t,n),o}();function tA(t,e){for(var n=0;n1?n.items[1]:C.head(n.items);"file"===o.kind&&-1!==o.type.indexOf("image/")?(this.context.invoke("editor.insertImagesOrCallback",[o.getAsFile()]),t.preventDefault()):"string"===o.kind&&this.context.invoke("editor.isLimited",n.getData("Text").length)&&t.preventDefault()}else if(window.clipboardData){var i=window.clipboardData.getData("text");this.context.invoke("editor.isLimited",i.length)&&t.preventDefault()}setTimeout(function(){e.context.invoke("editor.afterCommand")},10)}},],tA(t.prototype,e),n&&tA(t,n),o}();function tD(t,e){for(var n=0;n
').prependTo(this.$editor)}return t=o,e=[{key:"initialize",value:function(){this.options.disableDragAndDrop?(this.documentEventHandlers.onDrop=function(t){t.preventDefault()},this.$eventListener=this.$dropzone,this.$eventListener.on("drop",this.documentEventHandlers.onDrop)):this.attachDragAndDropEvent()}},{key:"attachDragAndDropEvent",value:function(){var t=this,e=i()(),n=this.$dropzone.find(".note-dropzone-message");this.documentEventHandlers.onDragenter=function(o){let i=o.originalEvent.dataTransfer,a=i.types.filter(t=>"Files"===t);if(a&&a.length){var r=t.context.invoke("codeview.isActivated"),s=t.$editor.width()>0&&t.$editor.height()>0;r||e.length||!s||(t.$editor.addClass("dragover"),t.$dropzone.width(t.$editor.width()),t.$dropzone.height(t.$editor.height()),n.text(t.lang.image.dragImageHere)),e=e.add(o.target)}},this.documentEventHandlers.onDragleave=function(n){(e=e.not(n.target)).length&&"BODY"!==n.target.nodeName||(e=i()(),t.$editor.removeClass("dragover"))},this.documentEventHandlers.onDrop=function(){e=i()(),t.$editor.removeClass("dragover")},this.$eventListener.on("dragenter",this.documentEventHandlers.onDragenter).on("dragleave",this.documentEventHandlers.onDragleave).on("drop",this.documentEventHandlers.onDrop),this.$dropzone.on("dragenter",function(){t.$dropzone.addClass("hover"),n.text(t.lang.image.dropImage)}).on("dragleave",function(){t.$dropzone.removeClass("hover"),n.text(t.lang.image.dragImageHere)}),this.$dropzone.on("drop",function(e){var n=e.originalEvent.dataTransfer;e.preventDefault(),n&&n.files&&n.files.length?(t.$editable.focus(),t.context.invoke("editor.insertImagesOrCallback",n.files)):i.a.each(n.types,function(e,o){if(!(o.toLowerCase().indexOf("_moz_")>-1)){var a=n.getData(o);o.toLowerCase().indexOf("text")>-1?t.context.invoke("editor.pasteHTML",a):i()(a).each(function(e,n){t.context.invoke("editor.insertNode",n)})}})}).on("dragover",!1)}},{key:"destroy",value:function(){var t=this;Object.keys(this.documentEventHandlers).forEach(function(e){t.$eventListener.off(e.substr(2).toLowerCase(),t.documentEventHandlers[e])}),this.documentEventHandlers={}}},],tD(t.prototype,e),n&&tD(t,n),o}();function tB(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n.*?(?:<\/iframe>)?)/gi,function(t){if(/<.+src(?==?('|"|\s)?)[\s\S]+src(?=('|"|\s)?)[^>]*?>/i.test(t))return"";var n,o=function t(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(t,e){if(t){if("string"==typeof t)return tB(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if("Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return tB(t,e)}}(e))){var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(t){throw t},f:o}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a,r=!0,s=!1;return{s:function(){i=e[Symbol.iterator]()},n:function(){var t=i.next();return r=t.done,t},e:function(t){s=!0,a=t},f:function(){try{r||null==i.return||i.return()}finally{if(s)throw a}}}}(e);try{for(o.s();!(n=o.n()).done;){var i=n.value;if(RegExp('src="(https?:)?//'+i.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+'/(.+)"').test(t))return t}}catch(a){o.e(a)}finally{o.f()}return""})}return t}},{key:"activate",value:function(){var t=this,e=this.CodeMirrorConstructor;if(this.$codable.val(th.html(this.$editable,this.options.prettifyHtml)),this.$codable.height(this.$editable.height()),this.context.invoke("toolbar.updateCodeview",!0),this.context.invoke("airPopover.updateCodeview",!0),this.$editor.addClass("codeview"),this.$codable.focus(),e){var n=e.fromTextArea(this.$codable[0],this.options.codemirror);if(this.options.codemirror.tern){var o=new e.TernServer(this.options.codemirror.tern);n.ternServer=o,n.on("cursorActivity",function(t){o.updateArgHints(t)})}n.on("blur",function(e){t.context.triggerEvent("blur.codeview",n.getValue(),e)}),n.on("change",function(){t.context.triggerEvent("change.codeview",n.getValue(),n)}),n.setSize(null,this.$editable.outerHeight()),this.$codable.data("cmEditor",n)}else this.$codable.on("blur",function(e){t.context.triggerEvent("blur.codeview",t.$codable.val(),e)}),this.$codable.on("input",function(){t.context.triggerEvent("change.codeview",t.$codable.val(),t.$codable)})}},{key:"deactivate",value:function(){if(this.CodeMirrorConstructor){var t=this.$codable.data("cmEditor");this.$codable.val(t.getValue()),t.toTextArea()}var e=this.purify(th.value(this.$codable,this.options.prettifyHtml)||th.emptyPara),n=this.$editable.html()!==e;this.$editable.html(e),this.$editable.height(this.options.height?this.$codable.height():"auto"),this.$editor.removeClass("codeview"),n&&this.context.triggerEvent("change",this.$editable.html(),this.$editable),this.$editable.focus(),this.context.invoke("toolbar.updateCodeview",!1),this.context.invoke("airPopover.updateCodeview",!1)}},{key:"destroy",value:function(){this.isActivated()&&this.deactivate()}},],tz(t.prototype,e),n&&tz(t,n),o}();function tO(t,e){for(var n=0;n0?Math.max(o,t.options.minheight):o,o=t.options.maxHeight>0?Math.min(o,t.options.maxHeight):o,t.$editable.height(o)};t.$document.on("mousemove",o).one("mouseup",function(){t.$document.off("mousemove",o)})})}},{key:"destroy",value:function(){this.$statusbar.off(),this.$statusbar.addClass("locked")}},],tO(t.prototype,e),n&&tO(t,n),o}();function t0(t,e){for(var n=0;n','
','
','
','
','
','
',this.options.disableResizeImage?"":'
',"
","",].join("")).prependTo(this.$editingArea),this.$handle.on("mousedown",function(e){if(th.isControlSizing(e.target)){e.preventDefault(),e.stopPropagation();var n=t.$handle.find(".note-control-selection").data("target"),o=n.offset(),i=t.$document.scrollTop(),a=function(e){t.context.invoke("editor.resizeTo",{x:e.clientX-o.left,y:e.clientY-(o.top-i)},n,!e.shiftKey),t.update(n[0],e)};t.$document.on("mousemove",a).one("mouseup",function(e){e.preventDefault(),t.$document.off("mousemove",a),t.context.invoke("editor.afterCommand")}),n.data("ratio")||n.data("ratio",n.height()/n.width())}}),this.$handle.on("wheel",function(e){e.preventDefault(),t.update()})}},{key:"destroy",value:function(){this.$handle.remove()}},{key:"update",value:function(t,e){if(this.context.isDisabled())return!1;var n=th.isImg(t),o=this.$handle.find(".note-control-selection");if(this.context.invoke("imagePopover.update",t,e),n){var a=i()(t),r=a.position(),s={left:r.left+parseInt(a.css("marginLeft"),10),top:r.top+parseInt(a.css("marginTop"),10)},l={w:a.outerWidth(!1),h:a.outerHeight(!1)};o.css({display:"block",left:s.left,top:s.top,width:l.w,height:l.h}).data("target",a);var c=new Image;c.src=a.attr("src");var u=l.w+"x"+l.h+" ("+this.lang.image.original+": "+c.width+"x"+c.height+")";o.find(".note-control-selection-info").text(u),this.context.invoke("editor.saveTarget",t)}else this.hide();return n}},{key:"hide",value:function(){this.context.invoke("editor.clearTarget"),this.$handle.children().hide()}},],tj(t.prototype,e),n&&tj(t,n),o}();function t4(t,e){for(var n=0;n").html(o).attr("href",n)[0];this.context.options.linkTargetBlank&&i()(a).attr("target","_blank"),this.lastWordRange.insertNode(a),this.lastWordRange=null,this.context.invoke("editor.focus")}}}},{key:"handleKeydown",value:function(t){if(C.contains([tC.code.ENTER,tC.code.SPACE],t.keyCode)){var e=this.context.invoke("editor.createRange").getWordRange();this.lastWordRange=e}}},{key:"handleKeyup",value:function(t){C.contains([tC.code.ENTER,tC.code.SPACE],t.keyCode)&&this.replace()}},],t4(t.prototype,e),n&&t4(t,n),o}();function tV(t,e){for(var n=0;n'),this.$placeholder.on("click",function(){t.context.invoke("focus")}).html(this.options.placeholder).prependTo(this.$editingArea),this.update()}},{key:"destroy",value:function(){this.$placeholder.remove()}},{key:"update",value:function(){var t=!this.context.invoke("codeview.isActivated")&&this.context.invoke("editor.isEmpty");this.$placeholder.toggle(t)}},],t5(t.prototype,e),n&&t5(t,n),o}();function tG(t,e){for(var n=0;n','
'+this.lang.color.background+"
","
",'","
",'
',"
",'",'',"
",'
',"",].join(""):"")+(o?['
','
'+this.lang.color.foreground+"
","
",'","
",'
',"
",'",'',"
",'
',"
",].join(""):""),callback:function(t){t.find(".note-holder").each(function(t,e){var n=i()(e);n.append(a.ui.palette({colors:a.options.colors,colorsName:a.options.colorsName,eventName:n.data("event"),container:a.options.container,tooltip:a.options.tooltip}).render())});var e=[["#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF","#FFFFFF"]];t.find(".note-holder-custom").each(function(t,n){var o=i()(n);o.append(a.ui.palette({colors:e,colorsName:e,eventName:o.data("event"),container:a.options.container,tooltip:a.options.tooltip}).render())}),t.find("input[type=color]").each(function(e,n){i()(n).change(function(){var e=t.find("#"+i()(this).data("event")).find(".note-color-btn").first(),n=this.value.toUpperCase();e.css("background-color",n).attr("aria-label",n).attr("data-value",n).attr("data-original-title",n),e.click()})})},click:function(e){e.stopPropagation();var n=i()("."+t).find(".note-dropdown-menu"),o=i()(e.target),r=o.data("event"),s=o.attr("data-value");if("openPalette"===r){var l=n.find("#"+s),c=i()(n.find("#"+l.data("event")).find(".note-color-row")[0]),u=c.find(".note-color-btn").last().detach(),d=l.val();u.css("background-color",d).attr("aria-label",d).attr("data-value",d).attr("data-original-title",d),c.prepend(u),l.click()}else{if(C.contains(["backColor","foreColor"],r)){var h=o.closest(".note-color").find(".note-recent-color"),f=o.closest(".note-color").find(".note-current-color-button");h.css("backColor"===r?"background-color":"color",s),f.attr("data-"+r,s)}a.context.invoke("editor."+r,s)}}}),]}).render()}},{key:"addToolbarButtons",value:function(){var t=this;this.context.memo("button.style",function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents(t.ui.icon(t.options.icons.magic),t.options),tooltip:t.lang.style.style,data:{toggle:"dropdown"}}),t.ui.dropdown({className:"dropdown-style",items:t.options.styleTags,title:t.lang.style.style,template:function(e){"string"==typeof e&&(e={tag:e,title:Object.prototype.hasOwnProperty.call(t.lang.style,e)?t.lang.style[e]:e});var n=e.tag,o=e.title;return"<"+n+(e.style?' style="'+e.style+'" ':"")+(e.className?' class="'+e.className+'"':"")+">"+o+""},click:t.context.createInvokeHandler("editor.formatBlock")}),]).render()});for(var e=0,n=this.options.styleTags.length;e'+o.toUpperCase()+"",tooltip:t.lang.style[o],click:t.context.createInvokeHandler("editor.formatBlock")}).render()})})(e);this.context.memo("button.bold",function(){return t.button({className:"note-btn-bold",contents:t.ui.icon(t.options.icons.bold),tooltip:t.lang.font.bold+t.representShortcut("bold"),click:t.context.createInvokeHandlerAndUpdateState("editor.bold")}).render()}),this.context.memo("button.italic",function(){return t.button({className:"note-btn-italic",contents:t.ui.icon(t.options.icons.italic),tooltip:t.lang.font.italic+t.representShortcut("italic"),click:t.context.createInvokeHandlerAndUpdateState("editor.italic")}).render()}),this.context.memo("button.underline",function(){return t.button({className:"note-btn-underline",contents:t.ui.icon(t.options.icons.underline),tooltip:t.lang.font.underline+t.representShortcut("underline"),click:t.context.createInvokeHandlerAndUpdateState("editor.underline")}).render()}),this.context.memo("button.clear",function(){return t.button({contents:t.ui.icon(t.options.icons.eraser),tooltip:t.lang.font.clear+t.representShortcut("removeFormat"),click:t.context.createInvokeHandler("editor.removeFormat")}).render()}),this.context.memo("button.strikethrough",function(){return t.button({className:"note-btn-strikethrough",contents:t.ui.icon(t.options.icons.strikethrough),tooltip:t.lang.font.strikethrough+t.representShortcut("strikethrough"),click:t.context.createInvokeHandlerAndUpdateState("editor.strikethrough")}).render()}),this.context.memo("button.superscript",function(){return t.button({className:"note-btn-superscript",contents:t.ui.icon(t.options.icons.superscript),tooltip:t.lang.font.superscript,click:t.context.createInvokeHandlerAndUpdateState("editor.superscript")}).render()}),this.context.memo("button.subscript",function(){return t.button({className:"note-btn-subscript",contents:t.ui.icon(t.options.icons.subscript),tooltip:t.lang.font.subscript,click:t.context.createInvokeHandlerAndUpdateState("editor.subscript")}).render()}),this.context.memo("button.fontname",function(){var e=t.context.invoke("editor.currentStyle");return t.options.addDefaultFonts&&i.a.each(e["font-family"].split(","),function(e,n){n=n.trim().replace(/['"]+/g,""),t.isFontDeservedToAdd(n)&&-1===t.options.fontNames.indexOf(n)&&t.options.fontNames.push(n)}),t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents('',t.options),tooltip:t.lang.font.name,data:{toggle:"dropdown"}}),t.ui.dropdownCheck({className:"dropdown-fontname",checkClassName:t.options.icons.menuCheck,items:t.options.fontNames.filter(t.isFontInstalled.bind(t)),title:t.lang.font.name,template:function(t){return''+t+""},click:t.context.createInvokeHandlerAndUpdateState("editor.fontName")}),]).render()}),this.context.memo("button.fontsize",function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents('',t.options),tooltip:t.lang.font.size,data:{toggle:"dropdown"}}),t.ui.dropdownCheck({className:"dropdown-fontsize",checkClassName:t.options.icons.menuCheck,items:t.options.fontSizes,title:t.lang.font.size,click:t.context.createInvokeHandlerAndUpdateState("editor.fontSize")}),]).render()}),this.context.memo("button.fontsizeunit",function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents('',t.options),tooltip:t.lang.font.sizeunit,data:{toggle:"dropdown"}}),t.ui.dropdownCheck({className:"dropdown-fontsizeunit",checkClassName:t.options.icons.menuCheck,items:t.options.fontSizeUnits,title:t.lang.font.sizeunit,click:t.context.createInvokeHandlerAndUpdateState("editor.fontSizeUnit")}),]).render()}),this.context.memo("button.color",function(){return t.colorPalette("note-color-all",t.lang.color.recent,!0,!0)}),this.context.memo("button.forecolor",function(){return t.colorPalette("note-color-fore",t.lang.color.foreground,!1,!0)}),this.context.memo("button.backcolor",function(){return t.colorPalette("note-color-back",t.lang.color.background,!0,!1)}),this.context.memo("button.ul",function(){return t.button({contents:t.ui.icon(t.options.icons.unorderedlist),tooltip:t.lang.lists.unordered+t.representShortcut("insertUnorderedList"),click:t.context.createInvokeHandler("editor.insertUnorderedList")}).render()}),this.context.memo("button.ol",function(){return t.button({contents:t.ui.icon(t.options.icons.orderedlist),tooltip:t.lang.lists.ordered+t.representShortcut("insertOrderedList"),click:t.context.createInvokeHandler("editor.insertOrderedList")}).render()});var o=this.button({contents:this.ui.icon(this.options.icons.alignLeft),tooltip:this.lang.paragraph.left+this.representShortcut("justifyLeft"),click:this.context.createInvokeHandler("editor.justifyLeft")}),a=this.button({contents:this.ui.icon(this.options.icons.alignCenter),tooltip:this.lang.paragraph.center+this.representShortcut("justifyCenter"),click:this.context.createInvokeHandler("editor.justifyCenter")}),r=this.button({contents:this.ui.icon(this.options.icons.alignRight),tooltip:this.lang.paragraph.right+this.representShortcut("justifyRight"),click:this.context.createInvokeHandler("editor.justifyRight")}),s=this.button({contents:this.ui.icon(this.options.icons.alignJustify),tooltip:this.lang.paragraph.justify+this.representShortcut("justifyFull"),click:this.context.createInvokeHandler("editor.justifyFull")}),l=this.button({contents:this.ui.icon(this.options.icons.outdent),tooltip:this.lang.paragraph.outdent+this.representShortcut("outdent"),click:this.context.createInvokeHandler("editor.outdent")}),c=this.button({contents:this.ui.icon(this.options.icons.indent),tooltip:this.lang.paragraph.indent+this.representShortcut("indent"),click:this.context.createInvokeHandler("editor.indent")});this.context.memo("button.justifyLeft",m.invoke(o,"render")),this.context.memo("button.justifyCenter",m.invoke(a,"render")),this.context.memo("button.justifyRight",m.invoke(r,"render")),this.context.memo("button.justifyFull",m.invoke(s,"render")),this.context.memo("button.outdent",m.invoke(l,"render")),this.context.memo("button.indent",m.invoke(c,"render")),this.context.memo("button.paragraph",function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents(t.ui.icon(t.options.icons.alignLeft),t.options),tooltip:t.lang.paragraph.paragraph,data:{toggle:"dropdown"}}),t.ui.dropdown([t.ui.buttonGroup({className:"note-align",children:[o,a,r,s]}),t.ui.buttonGroup({className:"note-list",children:[l,c]})]),]).render()}),this.context.memo("button.height",function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents(t.ui.icon(t.options.icons.textHeight),t.options),tooltip:t.lang.font.height,data:{toggle:"dropdown"}}),t.ui.dropdownCheck({items:t.options.lineHeights,checkClassName:t.options.icons.menuCheck,className:"dropdown-line-height",title:t.lang.font.height,click:t.context.createInvokeHandler("editor.lineHeight")}),]).render()}),this.context.memo("button.table",function(){return t.ui.buttonGroup([t.button({className:"dropdown-toggle",contents:t.ui.dropdownButtonContents(t.ui.icon(t.options.icons.table),t.options),tooltip:t.lang.table.table,data:{toggle:"dropdown"}}),t.ui.dropdown({title:t.lang.table.table,className:"note-table",items:'
1 x 1
'}),],{callback:function(e){e.find(".note-dimension-picker-mousecatcher").css({width:t.options.insertTableMaxSize.col+"em",height:t.options.insertTableMaxSize.row+"em"}).mousedown(t.context.createInvokeHandler("editor.insertTable")).on("mousemove",t.tableMoveHandler.bind(t))}}).render()}),this.context.memo("button.link",function(){return t.button({contents:t.ui.icon(t.options.icons.link),tooltip:t.lang.link.link+t.representShortcut("linkDialog.show"),click:t.context.createInvokeHandler("linkDialog.show")}).render()}),this.context.memo("button.picture",function(){return t.button({contents:t.ui.icon(t.options.icons.picture),tooltip:t.lang.image.image,click:t.context.createInvokeHandler("imageDialog.show")}).render()}),this.context.memo("button.video",function(){return t.button({contents:t.ui.icon(t.options.icons.video),tooltip:t.lang.video.video,click:t.context.createInvokeHandler("videoDialog.show")}).render()}),this.context.memo("button.hr",function(){return t.button({contents:t.ui.icon(t.options.icons.minus),tooltip:t.lang.hr.insert+t.representShortcut("insertHorizontalRule"),click:t.context.createInvokeHandler("editor.insertHorizontalRule")}).render()}),this.context.memo("button.fullscreen",function(){return t.button({className:"btn-fullscreen note-codeview-keep",contents:t.ui.icon(t.options.icons.arrowsAlt),tooltip:t.lang.options.fullscreen,click:t.context.createInvokeHandler("fullscreen.toggle")}).render()}),this.context.memo("button.codeview",function(){return t.button({className:"btn-codeview note-codeview-keep",contents:t.ui.icon(t.options.icons.code),tooltip:t.lang.options.codeview,click:t.context.createInvokeHandler("codeview.toggle")}).render()}),this.context.memo("button.redo",function(){return t.button({contents:t.ui.icon(t.options.icons.redo),tooltip:t.lang.history.redo+t.representShortcut("redo"),click:t.context.createInvokeHandler("editor.redo")}).render()}),this.context.memo("button.undo",function(){return t.button({contents:t.ui.icon(t.options.icons.undo),tooltip:t.lang.history.undo+t.representShortcut("undo"),click:t.context.createInvokeHandler("editor.undo")}).render()}),this.context.memo("button.help",function(){return t.button({contents:t.ui.icon(t.options.icons.question),tooltip:t.lang.options.help,click:t.context.createInvokeHandler("helpDialog.show")}).render()})}},{key:"addImagePopoverButtons",value:function(){var t=this;this.context.memo("button.resizeFull",function(){return t.button({contents:'100%',tooltip:t.lang.image.resizeFull,click:t.context.createInvokeHandler("editor.resize","1")}).render()}),this.context.memo("button.resizeHalf",function(){return t.button({contents:'50%',tooltip:t.lang.image.resizeHalf,click:t.context.createInvokeHandler("editor.resize","0.5")}).render()}),this.context.memo("button.resizeQuarter",function(){return t.button({contents:'25%',tooltip:t.lang.image.resizeQuarter,click:t.context.createInvokeHandler("editor.resize","0.25")}).render()}),this.context.memo("button.resizeNone",function(){return t.button({contents:t.ui.icon(t.options.icons.rollback),tooltip:t.lang.image.resizeNone,click:t.context.createInvokeHandler("editor.resize","0")}).render()}),this.context.memo("button.floatLeft",function(){return t.button({contents:t.ui.icon(t.options.icons.floatLeft),tooltip:t.lang.image.floatLeft,click:t.context.createInvokeHandler("editor.floatMe","left")}).render()}),this.context.memo("button.floatRight",function(){return t.button({contents:t.ui.icon(t.options.icons.floatRight),tooltip:t.lang.image.floatRight,click:t.context.createInvokeHandler("editor.floatMe","right")}).render()}),this.context.memo("button.floatNone",function(){return t.button({contents:t.ui.icon(t.options.icons.rollback),tooltip:t.lang.image.floatNone,click:t.context.createInvokeHandler("editor.floatMe","none")}).render()}),this.context.memo("button.removeMedia",function(){return t.button({contents:t.ui.icon(t.options.icons.trash),tooltip:t.lang.image.remove,click:t.context.createInvokeHandler("editor.removeMedia")}).render()})}},{key:"addLinkPopoverButtons",value:function(){var t=this;this.context.memo("button.linkDialogShow",function(){return t.button({contents:t.ui.icon(t.options.icons.link),tooltip:t.lang.link.edit,click:t.context.createInvokeHandler("linkDialog.show")}).render()}),this.context.memo("button.unlink",function(){return t.button({contents:t.ui.icon(t.options.icons.unlink),tooltip:t.lang.link.unlink,click:t.context.createInvokeHandler("editor.unlink")}).render()})}},{key:"addTablePopoverButtons",value:function(){var t=this;this.context.memo("button.addRowUp",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.rowAbove),tooltip:t.lang.table.addRowAbove,click:t.context.createInvokeHandler("editor.addRow","top")}).render()}),this.context.memo("button.addRowDown",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.rowBelow),tooltip:t.lang.table.addRowBelow,click:t.context.createInvokeHandler("editor.addRow","bottom")}).render()}),this.context.memo("button.addColLeft",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.colBefore),tooltip:t.lang.table.addColLeft,click:t.context.createInvokeHandler("editor.addCol","left")}).render()}),this.context.memo("button.addColRight",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.colAfter),tooltip:t.lang.table.addColRight,click:t.context.createInvokeHandler("editor.addCol","right")}).render()}),this.context.memo("button.deleteRow",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.rowRemove),tooltip:t.lang.table.delRow,click:t.context.createInvokeHandler("editor.deleteRow")}).render()}),this.context.memo("button.deleteCol",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.colRemove),tooltip:t.lang.table.delCol,click:t.context.createInvokeHandler("editor.deleteCol")}).render()}),this.context.memo("button.deleteTable",function(){return t.button({className:"btn-md",contents:t.ui.icon(t.options.icons.trash),tooltip:t.lang.table.delTable,click:t.context.createInvokeHandler("editor.deleteTable")}).render()})}},{key:"build",value:function(t,e){for(var n=0,o=e.length;n3&&c3&&ul&&rc)&&(this.isFollowing=!1,this.$toolbar.css({position:"relative",top:0,width:"100%",zIndex:"auto"}),this.$editable.css({marginTop:""}))}},{key:"changeContainer",value:function(t){t?this.$toolbar.prependTo(this.$editor):this.options.toolbarContainer&&this.$toolbar.appendTo(this.options.toolbarContainer),this.options.followingToolbar&&this.followScroll()}},{key:"updateFullscreen",value:function(t){this.ui.toggleBtnActive(this.$toolbar.find(".btn-fullscreen"),t),this.changeContainer(t)}},{key:"updateCodeview",value:function(t){this.ui.toggleBtnActive(this.$toolbar.find(".btn-codeview"),t),t?this.deactivate():this.activate()}},{key:"activate",value:function(t){var e=this.$toolbar.find("button");t||(e=e.not(".note-codeview-keep")),this.ui.toggleBtn(e,!0)}},{key:"deactivate",value:function(t){var e=this.$toolbar.find("button");t||(e=e.not(".note-codeview-keep")),this.ui.toggleBtn(e,!1)}},],tY(t.prototype,e),n&&tY(t,n),o}();function tX(t,e){for(var n=0;n','"),''),"",'
','"),''),"
",this.options.disableLinkTarget?"":i()("
").append(this.ui.checkbox({className:"sn-checkbox-open-in-new-window",text:this.lang.link.openInNewWindow,checked:!0}).render()).html(),i()("
").append(this.ui.checkbox({className:"sn-checkbox-use-protocol",text:this.lang.link.useProtocol,checked:!0}).render()).html(),].join(""),n='');this.$dialog=this.ui.dialog({className:"link-dialog",title:this.lang.link.insert,fade:this.options.dialogsFade,body:e,footer:n}).render().appendTo(t)}},{key:"destroy",value:function(){this.ui.hideDialog(this.$dialog),this.$dialog.remove()}},{key:"bindEnterKey",value:function(t,e){t.on("keypress",function(t){t.keyCode===tC.code.ENTER&&(t.preventDefault(),e.trigger("click"))})}},{key:"toggleLinkBtn",value:function(t,e,n){this.ui.toggleBtn(t,e.val()&&n.val())}},{key:"showLinkDialog",value:function(t){var e=this;return i.a.Deferred(function(n){var o=e.$dialog.find(".note-link-text"),i=e.$dialog.find(".note-link-url"),a=e.$dialog.find(".note-link-btn"),r=e.$dialog.find(".sn-checkbox-open-in-new-window input[type=checkbox]"),s=e.$dialog.find(".sn-checkbox-use-protocol input[type=checkbox]");e.ui.onDialogShown(e.$dialog,function(){e.context.triggerEvent("dialog.shown"),!t.url&&m.isValidUrl(t.text)&&(t.url=t.text),o.on("input paste propertychange",function(){t.text=o.val(),e.toggleLinkBtn(a,o,i)}).val(t.text),i.on("input paste propertychange",function(){t.text||o.val(i.val()),e.toggleLinkBtn(a,o,i)}).val(t.url),p.isSupportTouch||i.trigger("focus"),e.toggleLinkBtn(a,o,i),e.bindEnterKey(i,a),e.bindEnterKey(o,a);var l=void 0!==t.isNewWindow?t.isNewWindow:e.context.options.linkTargetBlank;r.prop("checked",l);var c=!t.url&&e.context.options.useProtocol;s.prop("checked",c),a.one("click",function(a){a.preventDefault(),n.resolve({range:t.range,url:i.val(),text:o.val(),isNewWindow:r.is(":checked"),checkProtocol:s.is(":checked")}),e.ui.hideDialog(e.$dialog)})}),e.ui.onDialogHidden(e.$dialog,function(){o.off(),i.off(),a.off(),"pending"===n.state()&&n.reject()}),e.ui.showDialog(e.$dialog)}).promise()}},{key:"show",value:function(){var t=this,e=this.context.invoke("editor.getLinkInfo");this.context.invoke("editor.saveRange"),this.showLinkDialog(e).then(function(e){t.context.invoke("editor.restoreRange"),t.context.invoke("editor.createLink",e)}).fail(function(){t.context.invoke("editor.restoreRange")})}},],tX(t.prototype,e),n&&tX(t,n),o}();function tJ(t,e){for(var n=0;n ')}}).render().appendTo(this.options.container);var t=this.$popover.find(".popover-content,.note-popover-content");this.context.invoke("buttons.build",t,this.options.popover.link),this.$popover.on("mousedown",function(t){t.preventDefault()})}},{key:"destroy",value:function(){this.$popover.remove()}},{key:"update",value:function(){if(this.context.invoke("editor.hasFocus")){var t=this.context.invoke("editor.getLastRange");if(t.isCollapsed()&&t.isOnAnchor()){var e=th.ancestor(t.sc,th.isAnchor),n=i()(e).attr("href");this.$popover.find("a").attr("href",n).text(n);var o=th.posFromPlaceholder(e),a=i()(this.options.container).offset();o.top-=a.top,o.left-=a.left,this.$popover.css({display:"block",left:o.left,top:o.top})}else this.hide()}else this.hide()}},{key:"hide",value:function(){this.$popover.hide()}},],tJ(t.prototype,e),n&&tJ(t,n),o}();function ee(t,e){for(var n=0;n")}var o=this.options.dialogsInBody?this.$body:this.options.container,i=['
','",'',t,"
",'
','",'',"
",].join(""),a='');this.$dialog=this.ui.dialog({title:this.lang.image.insert,fade:this.options.dialogsFade,body:i,footer:a}).render().appendTo(o)}},{key:"destroy",value:function(){this.ui.hideDialog(this.$dialog),this.$dialog.remove()}},{key:"bindEnterKey",value:function(t,e){t.on("keypress",function(t){t.keyCode===tC.code.ENTER&&(t.preventDefault(),e.trigger("click"))})}},{key:"show",value:function(){var t=this;this.context.invoke("editor.saveRange"),this.showImageDialog().then(function(e){t.ui.hideDialog(t.$dialog),t.context.invoke("editor.restoreRange"),"string"==typeof e?t.options.callbacks.onImageLinkInsert?t.context.triggerEvent("image.link.insert",e):t.context.invoke("editor.insertImage",e):t.context.invoke("editor.insertImagesOrCallback",e)}).fail(function(){t.context.invoke("editor.restoreRange")})}},{key:"showImageDialog",value:function(){var t=this;return i.a.Deferred(function(e){var n=t.$dialog.find(".note-image-input"),o=t.$dialog.find(".note-image-url"),i=t.$dialog.find(".note-image-btn");t.ui.onDialogShown(t.$dialog,function(){t.context.triggerEvent("dialog.shown"),n.replaceWith(n.clone().on("change",function(t){e.resolve(t.target.files||t.target.value)}).val("")),o.on("input paste propertychange",function(){t.ui.toggleBtn(i,o.val())}).val(""),p.isSupportTouch||o.trigger("focus"),i.click(function(t){t.preventDefault(),e.resolve(o.val())}),t.bindEnterKey(o,i)}),t.ui.onDialogHidden(t.$dialog,function(){n.off(),o.off(),i.off(),"pending"===e.state()&&e.reject()}),t.ui.showDialog(t.$dialog)})}},],ee(t.prototype,e),n&&ee(t,n),o}();function eo(t,e){for(var n=0;n','"),''),"
",].join(""),n='');this.$dialog=this.ui.dialog({title:this.lang.video.insert,fade:this.options.dialogsFade,body:e,footer:n}).render().appendTo(t)}},{key:"destroy",value:function(){this.ui.hideDialog(this.$dialog),this.$dialog.remove()}},{key:"bindEnterKey",value:function(t,e){t.on("keypress",function(t){t.keyCode===tC.code.ENTER&&(t.preventDefault(),e.trigger("click"))})}},{key:"createVideoNode",value:function(t){var e,n=t.match(/\/\/(?:(?:www|m)\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?$/),o=t.match(/(?:www\.|\/\/)instagram\.com\/p\/(.[a-zA-Z0-9_-]*)/),a=t.match(/\/\/vine\.co\/v\/([a-zA-Z0-9]+)/),r=t.match(/\/\/(player\.)?vimeo\.com\/([a-z]*\/)*(\d+)[?]?.*/),s=t.match(/.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/),l=t.match(/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/),c=t.match(/\/\/v\.qq\.com.*?vid=(.+)/),u=t.match(/\/\/v\.qq\.com\/x?\/?(page|cover).*?\/([^\/]+)\.html\??.*/),d=t.match(/^.+.(mp4|m4v)$/),h=t.match(/^.+.(ogg|ogv)$/),f=t.match(/^.+.(webm)$/),p=t.match(/(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/);if(n&&11===n[1].length){var v=n[1],m=0;if(void 0!==n[2]){var g=n[2].match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/);if(g)for(var b=[3600,60,1],k=0,y=b.length;k").attr("frameborder",0).attr("src","https://www.youtube.com/embed/"+v+(m>0?"?start="+m:"")).attr("width","640").attr("height","360")}else if(o&&o[0].length)e=i()("