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AAX;AACAuC,MAAAA,UAAU,CAACe,MAAX,CAAkBta,MAAlB;AACAoZ,MAAAA,KAAK,CAACye,IAAN;AACD;AAtJI,GAAP;AAwJD,CAzJD;;AA2JAh6B,uFAAA,GAAeA,iFAAA,CAASA,uFAAT,EAAuB;AACpC4b,EAAAA,WAAW,EAAED,EADuB;AAEpC,eAAW;AAFyB,CAAvB,CAAf;AAKA3b,yGAAA,GAAiC,CAC/B,GAD+B,EAE/B;AAAEimC,EAAAA,KAAK,EAAE,YAAT;AAAuBxH,EAAAA,GAAG,EAAE,YAA5B;AAA0C/D,EAAAA,SAAS,EAAE,YAArD;AAAmE3hB,EAAAA,KAAK,EAAE;AAA1E,CAF+B,EAG/B,KAH+B,EAGxB,IAHwB,EAGlB,IAHkB,EAGZ,IAHY,EAGN,IAHM,EAGA,IAHA,EAGM,IAHN,CAAjC","sources":["webpack:///webpack/universalModuleDefinition","webpack:///./src/lang/summernote-en-US.js","webpack:///external umd {\"root\":\"jQuery\",\"commonjs\":\"jquery\",\"commonjs2\":\"jquery\",\"amd\":\"jquery\"}","webpack:///webpack/bootstrap","webpack:///webpack/runtime/compat get default export","webpack:///webpack/runtime/define property getters","webpack:///webpack/runtime/hasOwnProperty shorthand","webpack:///webpack/runtime/make namespace object","webpack:///./src/js/core/env.js","webpack:///./src/js/core/func.js","webpack:///./src/js/core/lists.js","webpack:///./src/js/core/dom.js","webpack:///./src/js/Context.js","webpack:///./src/js/summernote.js","webpack:///./src/js/core/range.js","webpack:///./src/js/core/key.js","webpack:///./src/js/core/async.js","webpack:///./src/js/editing/History.js","webpack:///./src/js/editing/Style.js","webpack:///./src/js/editing/Bullet.js","webpack:///./src/js/editing/Typing.js","webpack:///./src/js/editing/Table.js","webpack:///./src/js/module/Editor.js","webpack:///./src/js/module/Clipboard.js","webpack:///./src/js/module/Dropzone.js","webpack:///./src/js/module/Codeview.js","webpack:///./src/js/module/Statusbar.js","webpack:///./src/js/module/Fullscreen.js","webpack:///./src/js/module/Handle.js","webpack:///./src/js/module/AutoLink.js","webpack:///./src/js/module/AutoSync.js","webpack:///./src/js/module/AutoReplace.js","webpack:///./src/js/module/Placeholder.js","webpack:///./src/js/module/Buttons.js","webpack:///./src/js/module/Toolbar.js","webpack:///./src/js/module/LinkDialog.js","webpack:///./src/js/module/LinkPopover.js","webpack:///./src/js/module/ImageDialog.js","webpack:///./src/js/module/ImagePopover.js","webpack:///./src/js/module/TablePopover.js","webpack:///./src/js/module/VideoDialog.js","webpack:///./src/js/module/HelpDialog.js","webpack:///./src/js/module/AirPopover.js","webpack:///./src/js/module/HintPopover.js","webpack:///./src/js/settings.js","webpack:///./src/js/renderer.js","webpack:///./src/styles/bs5/summernote-bs5.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"jquery\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"jquery\"], factory);\n\telse {\n\t\tvar a = typeof exports === 'object' ? factory(require(\"jquery\")) : factory(root[\"jQuery\"]);\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(self, function(__WEBPACK_EXTERNAL_MODULE__5549__) {\nreturn ","import $ from 'jquery';\n\n$.summernote = $.summernote || {\n lang: {},\n};\n\n$.extend(true, $.summernote.lang, {\n 'en-US': {\n font: {\n bold: 'Bold',\n italic: 'Italic',\n underline: 'Underline',\n clear: 'Remove Font Style',\n height: 'Line Height',\n name: 'Font Family',\n strikethrough: 'Strikethrough',\n subscript: 'Subscript',\n superscript: 'Superscript',\n size: 'Font Size',\n sizeunit: 'Font Size Unit',\n },\n image: {\n image: 'Picture',\n insert: 'Insert Image',\n resizeFull: 'Resize full',\n resizeHalf: 'Resize half',\n resizeQuarter: 'Resize quarter',\n resizeNone: 'Original size',\n floatLeft: 'Float Left',\n floatRight: 'Float Right',\n floatNone: 'Remove float',\n shapeRounded: 'Shape: Rounded',\n shapeCircle: 'Shape: Circle',\n shapeThumbnail: 'Shape: Thumbnail',\n shapeNone: 'Shape: None',\n dragImageHere: 'Drag image or text here',\n dropImage: 'Drop image or Text',\n selectFromFiles: 'Select from files',\n maximumFileSize: 'Maximum file size',\n maximumFileSizeError: 'Maximum file size exceeded.',\n url: 'Image URL',\n remove: 'Remove Image',\n original: 'Original',\n },\n video: {\n video: 'Video',\n videoLink: 'Video Link',\n insert: 'Insert Video',\n url: 'Video URL',\n providers: '(YouTube, Google Drive, Vimeo, Vine, Instagram, DailyMotion, Youku, Peertube)',\n },\n link: {\n link: 'Link',\n insert: 'Insert Link',\n unlink: 'Unlink',\n edit: 'Edit',\n textToDisplay: 'Text to display',\n url: 'To what URL should this link go?',\n openInNewWindow: 'Open in new window',\n },\n table: {\n table: 'Table',\n addRowAbove: 'Add row above',\n addRowBelow: 'Add row below',\n addColLeft: 'Add column left',\n addColRight: 'Add column right',\n delRow: 'Delete row',\n delCol: 'Delete column',\n delTable: 'Delete table',\n },\n hr: {\n insert: 'Insert Horizontal Rule',\n },\n style: {\n style: 'Style',\n p: 'Normal',\n blockquote: 'Quote',\n pre: 'Code',\n h1: 'Header 1',\n h2: 'Header 2',\n h3: 'Header 3',\n h4: 'Header 4',\n h5: 'Header 5',\n h6: 'Header 6',\n },\n lists: {\n unordered: 'Unordered list',\n ordered: 'Ordered list',\n },\n options: {\n help: 'Help',\n fullscreen: 'Full Screen',\n codeview: 'Code View',\n },\n paragraph: {\n paragraph: 'Paragraph',\n outdent: 'Outdent',\n indent: 'Indent',\n left: 'Align left',\n center: 'Align center',\n right: 'Align right',\n justify: 'Justify full',\n },\n color: {\n recent: 'Recent Color',\n more: 'More Color',\n background: 'Background Color',\n foreground: 'Text Color',\n transparent: 'Transparent',\n setTransparent: 'Set transparent',\n reset: 'Reset',\n resetToDefault: 'Reset to default',\n cpSelect: 'Select',\n },\n shortcut: {\n shortcuts: 'Keyboard shortcuts',\n close: 'Close',\n textFormatting: 'Text formatting',\n action: 'Action',\n paragraphFormatting: 'Paragraph formatting',\n documentStyle: 'Document Style',\n extraKeys: 'Extra keys',\n },\n help: {\n 'escape': 'Escape',\n 'insertParagraph': 'Insert Paragraph',\n 'undo': 'Undo the last command',\n 'redo': 'Redo the last command',\n 'tab': 'Tab',\n 'untab': 'Untab',\n 'bold': 'Set a bold style',\n 'italic': 'Set a italic style',\n 'underline': 'Set a underline style',\n 'strikethrough': 'Set a strikethrough style',\n 'removeFormat': 'Clean a style',\n 'justifyLeft': 'Set left align',\n 'justifyCenter': 'Set center align',\n 'justifyRight': 'Set right align',\n 'justifyFull': 'Set full align',\n 'insertUnorderedList': 'Toggle unordered list',\n 'insertOrderedList': 'Toggle ordered list',\n 'outdent': 'Outdent on current paragraph',\n 'indent': 'Indent on current paragraph',\n 'formatPara': 'Change current block\\'s format as a paragraph(P tag)',\n 'formatH1': 'Change current block\\'s format as H1',\n 'formatH2': 'Change current block\\'s format as H2',\n 'formatH3': 'Change current block\\'s format as H3',\n 'formatH4': 'Change current block\\'s format as H4',\n 'formatH5': 'Change current block\\'s format as H5',\n 'formatH6': 'Change current block\\'s format as H6',\n 'insertHorizontalRule': 'Insert horizontal rule',\n 'linkDialog.show': 'Show Link Dialog',\n },\n history: {\n undo: 'Undo',\n redo: 'Redo',\n },\n specialChar: {\n specialChar: 'SPECIAL CHARACTERS',\n select: 'Select Special characters',\n },\n output: {\n noSelection: 'No Selection Made!',\n },\n },\n});\n","module.exports = __WEBPACK_EXTERNAL_MODULE__5549__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import $ from 'jquery';\n\n/**\n * returns whether font is installed or not.\n *\n * @param {String} fontName\n * @return {Boolean}\n */\nconst genericFontFamilies = ['sans-serif', 'serif', 'monospace', 'cursive', 'fantasy'];\n\nfunction validFontName(fontName) {\n return ($.inArray(fontName.toLowerCase(), genericFontFamilies) === -1) ? `'${fontName}'` : fontName;\n}\n\nfunction isFontInstalled(fontName) {\n const testFontName = fontName === 'Comic Sans MS' ? 'Courier New' : 'Comic Sans MS';\n const testText = \"mw\";\n const fontSize = \"20px\";\n const canvasWidth = 40;\n const canvasHeight = 20;\n var canvas = document.createElement(\"canvas\");\n var context = canvas.getContext(\"2d\");\n canvas.width = canvasWidth;\n canvas.height = canvasHeight;\n // Center display\n context.textAlign = \"center\";\n context.fillStyle = \"black\";\n context.textBaseline = \"middle\";\n function getPxInfo(font) {\n let s = '';\n context.clearRect(0, 0, canvasWidth, canvasHeight);\n context.font = fontSize + ' ' + validFontName(font) + ', \"' + testFontName + '\"';\n context.fillText(testText, canvasWidth / 2, canvasHeight / 2);\n // Get pixel information\n var pxInfo = context.getImageData(0, 0, canvasWidth, canvasHeight).data;\n if (CanvasPixelArray.prototype.join) {\n s = pxInfo.join();\n } else {\n for (let i = 0; i < pxInfo.length; i++) s += pxInfo[i].toString();\n }\n return s;\n }\n let testInfo = getPxInfo(testFontName);\n let fontInfo = getPxInfo(fontName);\n return testInfo !== fontInfo;\n}\n\nconst userAgent = navigator.userAgent;\nconst isMSIE = /MSIE|Trident/i.test(userAgent);\nlet browserVersion;\nif (isMSIE) {\n let matches = /MSIE (\\d+[.]\\d+)/.exec(userAgent);\n if (matches) {\n browserVersion = parseFloat(matches[1]);\n }\n matches = /Trident\\/.*rv:([0-9]{1,}[.0-9]{0,})/.exec(userAgent);\n if (matches) {\n browserVersion = parseFloat(matches[1]);\n }\n}\n\nconst isEdge = /Edge\\/\\d+/.test(userAgent);\n\nconst isSupportTouch =\n (('ontouchstart' in window) ||\n (navigator.MaxTouchPoints > 0) ||\n (navigator.msMaxTouchPoints > 0));\n\n// [workaround] IE doesn't have input events for contentEditable\n// - see: https://goo.gl/4bfIvA\nconst inputEventName = (isMSIE) ? 'DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted' : 'input';\n\n/**\n * @class core.env\n *\n * Object which check platform and agent\n *\n * @singleton\n * @alternateClassName env\n */\nexport default {\n isMac: navigator.appVersion.indexOf('Mac') > -1,\n isMSIE,\n isEdge,\n isFF: !isEdge && /firefox/i.test(userAgent),\n isPhantom: /PhantomJS/i.test(userAgent),\n isWebkit: !isEdge && /webkit/i.test(userAgent),\n isChrome: !isEdge && /chrome/i.test(userAgent),\n isSafari: !isEdge && /safari/i.test(userAgent) && (!/chrome/i.test(userAgent)),\n browserVersion,\n isSupportTouch,\n isFontInstalled,\n isW3CRangeSupport: !!document.createRange,\n inputEventName,\n genericFontFamilies,\n validFontName,\n};\n","import $ from 'jquery';\n\n/**\n * @class core.func\n *\n * func utils (for high-order func's arg)\n *\n * @singleton\n * @alternateClassName func\n */\nfunction eq(itemA) {\n return function(itemB) {\n return itemA === itemB;\n };\n}\n\nfunction eq2(itemA, itemB) {\n return itemA === itemB;\n}\n\nfunction peq2(propName) {\n return function(itemA, itemB) {\n return itemA[propName] === itemB[propName];\n };\n}\n\nfunction ok() {\n return true;\n}\n\nfunction fail() {\n return false;\n}\n\nfunction not(f) {\n return function() {\n return !f.apply(f, arguments);\n };\n}\n\nfunction and(fA, fB) {\n return function(item) {\n return fA(item) && fB(item);\n };\n}\n\nfunction self(a) {\n return a;\n}\n\nfunction invoke(obj, method) {\n return function() {\n return obj[method].apply(obj, arguments);\n };\n}\n\nlet idCounter = 0;\n\n/**\n * reset globally-unique id\n *\n */\nfunction resetUniqueId() {\n idCounter = 0;\n}\n\n/**\n * generate a globally-unique id\n *\n * @param {String} [prefix]\n */\nfunction uniqueId(prefix) {\n const id = ++idCounter + '';\n return prefix ? prefix + id : id;\n}\n\n/**\n * returns bnd (bounds) from rect\n *\n * - IE Compatibility Issue: http://goo.gl/sRLOAo\n * - Scroll Issue: http://goo.gl/sNjUc\n *\n * @param {Rect} rect\n * @return {Object} bounds\n * @return {Number} bounds.top\n * @return {Number} bounds.left\n * @return {Number} bounds.width\n * @return {Number} bounds.height\n */\nfunction rect2bnd(rect) {\n const $document = $(document);\n return {\n top: rect.top + $document.scrollTop(),\n left: rect.left + $document.scrollLeft(),\n width: rect.right - rect.left,\n height: rect.bottom - rect.top,\n };\n}\n\n/**\n * returns a copy of the object where the keys have become the values and the values the keys.\n * @param {Object} obj\n * @return {Object}\n */\nfunction invertObject(obj) {\n const inverted = {};\n for (const key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) {\n inverted[obj[key]] = key;\n }\n }\n return inverted;\n}\n\n/**\n * @param {String} namespace\n * @param {String} [prefix]\n * @return {String}\n */\nfunction namespaceToCamel(namespace, prefix) {\n prefix = prefix || '';\n return prefix + namespace.split('.').map(function(name) {\n return name.substring(0, 1).toUpperCase() + name.substring(1);\n }).join('');\n}\n\n/**\n * Returns a function, that, as long as it continues to be invoked, will not\n * be triggered. The function will be called after it stops being called for\n * N milliseconds. If `immediate` is passed, trigger the function on the\n * leading edge, instead of the trailing.\n * @param {Function} func\n * @param {Number} wait\n * @param {Boolean} immediate\n * @return {Function}\n */\nfunction debounce(func, wait, immediate) {\n let timeout;\n return function() {\n const context = this;\n const args = arguments;\n const later = () => {\n timeout = null;\n if (!immediate) {\n func.apply(context, args);\n }\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) {\n func.apply(context, args);\n }\n };\n}\n\n/**\n *\n * @param {String} url\n * @return {Boolean}\n */\nfunction isValidUrl(url) {\n const expression = /[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)/gi;\n return expression.test(url);\n}\n\nexport default {\n eq,\n eq2,\n peq2,\n ok,\n fail,\n self,\n not,\n and,\n invoke,\n resetUniqueId,\n uniqueId,\n rect2bnd,\n invertObject,\n namespaceToCamel,\n debounce,\n isValidUrl,\n};\n","import func from './func';\n\n/**\n * returns the first item of an array.\n *\n * @param {Array} array\n */\nfunction head(array) {\n return array[0];\n}\n\n/**\n * returns the last item of an array.\n *\n * @param {Array} array\n */\nfunction last(array) {\n return array[array.length - 1];\n}\n\n/**\n * returns everything but the last entry of the array.\n *\n * @param {Array} array\n */\nfunction initial(array) {\n return array.slice(0, array.length - 1);\n}\n\n/**\n * returns the rest of the items in an array.\n *\n * @param {Array} array\n */\nfunction tail(array) {\n return array.slice(1);\n}\n\n/**\n * returns item of array\n */\nfunction find(array, pred) {\n for (let idx = 0, len = array.length; idx < len; idx++) {\n const item = array[idx];\n if (pred(item)) {\n return item;\n }\n }\n}\n\n/**\n * returns true if all of the values in the array pass the predicate truth test.\n */\nfunction all(array, pred) {\n for (let idx = 0, len = array.length; idx < len; idx++) {\n if (!pred(array[idx])) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * returns true if the value is present in the list.\n */\nfunction contains(array, item) {\n if (array && array.length && item) {\n if (array.indexOf) {\n return array.indexOf(item) !== -1;\n } else if (array.contains) {\n // `DOMTokenList` doesn't implement `.indexOf`, but it implements `.contains`\n return array.contains(item);\n }\n }\n return false;\n}\n\n/**\n * get sum from a list\n *\n * @param {Array} array - array\n * @param {Function} fn - iterator\n */\nfunction sum(array, fn) {\n fn = fn || func.self;\n return array.reduce(function(memo, v) {\n return memo + fn(v);\n }, 0);\n}\n\n/**\n * returns a copy of the collection with array type.\n * @param {Collection} collection - collection eg) node.childNodes, ...\n */\nfunction from(collection) {\n const result = [];\n const length = collection.length;\n let idx = -1;\n while (++idx < length) {\n result[idx] = collection[idx];\n }\n return result;\n}\n\n/**\n * returns whether list is empty or not\n */\nfunction isEmpty(array) {\n return !array || !array.length;\n}\n\n/**\n * cluster elements by predicate function.\n *\n * @param {Array} array - array\n * @param {Function} fn - predicate function for cluster rule\n * @param {Array[]}\n */\nfunction clusterBy(array, fn) {\n if (!array.length) { return []; }\n const aTail = tail(array);\n return aTail.reduce(function(memo, v) {\n const aLast = last(memo);\n if (fn(last(aLast), v)) {\n aLast[aLast.length] = v;\n } else {\n memo[memo.length] = [v];\n }\n return memo;\n }, [[head(array)]]);\n}\n\n/**\n * returns a copy of the array with all false values removed\n *\n * @param {Array} array - array\n * @param {Function} fn - predicate function for cluster rule\n */\nfunction compact(array) {\n const aResult = [];\n for (let idx = 0, len = array.length; idx < len; idx++) {\n if (array[idx]) { aResult.push(array[idx]); }\n }\n return aResult;\n}\n\n/**\n * produces a duplicate-free version of the array\n *\n * @param {Array} array\n */\nfunction unique(array) {\n const results = [];\n\n for (let idx = 0, len = array.length; idx < len; idx++) {\n if (!contains(results, array[idx])) {\n results.push(array[idx]);\n }\n }\n\n return results;\n}\n\n/**\n * returns next item.\n * @param {Array} array\n */\nfunction next(array, item) {\n if (array && array.length && item) {\n const idx = array.indexOf(item);\n return idx === -1 ? null : array[idx + 1];\n }\n return null;\n}\n\n/**\n * returns prev item.\n * @param {Array} array\n */\nfunction prev(array, item) {\n if (array && array.length && item) {\n const idx = array.indexOf(item);\n return idx === -1 ? null : array[idx - 1];\n }\n return null;\n}\n\n/**\n * @class core.list\n *\n * list utils\n *\n * @singleton\n * @alternateClassName list\n */\nexport default {\n head,\n last,\n initial,\n tail,\n prev,\n next,\n find,\n contains,\n all,\n sum,\n from,\n isEmpty,\n clusterBy,\n compact,\n unique,\n};\n","import $ from 'jquery';\nimport func from './func';\nimport lists from './lists';\nimport env from './env';\n\nconst NBSP_CHAR = String.fromCharCode(160);\nconst ZERO_WIDTH_NBSP_CHAR = '\\ufeff';\n\n/**\n * @method isEditable\n *\n * returns whether node is `note-editable` or not.\n *\n * @param {Node} node\n * @return {Boolean}\n */\nfunction isEditable(node) {\n return node && $(node).hasClass('note-editable');\n}\n\n/**\n * @method isControlSizing\n *\n * returns whether node is `note-control-sizing` or not.\n *\n * @param {Node} node\n * @return {Boolean}\n */\nfunction isControlSizing(node) {\n return node && $(node).hasClass('note-control-sizing');\n}\n\n/**\n * @method makePredByNodeName\n *\n * returns predicate which judge whether nodeName is same\n *\n * @param {String} nodeName\n * @return {Function}\n */\nfunction makePredByNodeName(nodeName) {\n nodeName = nodeName.toUpperCase();\n return function(node) {\n return node && node.nodeName.toUpperCase() === nodeName;\n };\n}\n\n/**\n * @method isText\n *\n *\n *\n * @param {Node} node\n * @return {Boolean} true if node's type is text(3)\n */\nfunction isText(node) {\n return node && node.nodeType === 3;\n}\n\n/**\n * @method isElement\n *\n *\n *\n * @param {Node} node\n * @return {Boolean} true if node's type is element(1)\n */\nfunction isElement(node) {\n return node && node.nodeType === 1;\n}\n\n/**\n * ex) br, col, embed, hr, img, input, ...\n * @see http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements\n */\nfunction isVoid(node) {\n return node && /^BR|^IMG|^HR|^IFRAME|^BUTTON|^INPUT|^AUDIO|^VIDEO|^EMBED/.test(node.nodeName.toUpperCase());\n}\n\nfunction isPara(node) {\n if (isEditable(node)) {\n return false;\n }\n\n // Chrome(v31.0), FF(v25.0.1) use DIV for paragraph\n return node && /^DIV|^P|^LI|^H[1-7]/.test(node.nodeName.toUpperCase());\n}\n\nfunction isHeading(node) {\n return node && /^H[1-7]/.test(node.nodeName.toUpperCase());\n}\n\nconst isPre = makePredByNodeName('PRE');\n\nconst isLi = makePredByNodeName('LI');\n\nfunction isPurePara(node) {\n return isPara(node) && !isLi(node);\n}\n\nconst isTable = makePredByNodeName('TABLE');\n\nconst isData = makePredByNodeName('DATA');\n\nfunction isInline(node) {\n return !isBodyContainer(node) &&\n !isList(node) &&\n !isHr(node) &&\n !isPara(node) &&\n !isTable(node) &&\n !isBlockquote(node) &&\n !isData(node);\n}\n\nfunction isList(node) {\n return node && /^UL|^OL/.test(node.nodeName.toUpperCase());\n}\n\nconst isHr = makePredByNodeName('HR');\n\nfunction isCell(node) {\n return node && /^TD|^TH/.test(node.nodeName.toUpperCase());\n}\n\nconst isBlockquote = makePredByNodeName('BLOCKQUOTE');\n\nfunction isBodyContainer(node) {\n return isCell(node) || isBlockquote(node) || isEditable(node);\n}\n\nconst isAnchor = makePredByNodeName('A');\n\nfunction isParaInline(node) {\n return isInline(node) && !!ancestor(node, isPara);\n}\n\nfunction isBodyInline(node) {\n return isInline(node) && !ancestor(node, isPara);\n}\n\nconst isBody = makePredByNodeName('BODY');\n\n/**\n * returns whether nodeB is closest sibling of nodeA\n *\n * @param {Node} nodeA\n * @param {Node} nodeB\n * @return {Boolean}\n */\nfunction isClosestSibling(nodeA, nodeB) {\n return nodeA.nextSibling === nodeB ||\n nodeA.previousSibling === nodeB;\n}\n\n/**\n * returns array of closest siblings with node\n *\n * @param {Node} node\n * @param {function} [pred] - predicate function\n * @return {Node[]}\n */\nfunction withClosestSiblings(node, pred) {\n pred = pred || func.ok;\n\n const siblings = [];\n if (node.previousSibling && pred(node.previousSibling)) {\n siblings.push(node.previousSibling);\n }\n siblings.push(node);\n if (node.nextSibling && pred(node.nextSibling)) {\n siblings.push(node.nextSibling);\n }\n return siblings;\n}\n\n/**\n * blank HTML for cursor position\n * - [workaround] old IE only works with &nbsp;\n * - [workaround] IE11 and other browser works with bogus br\n */\nconst blankHTML = env.isMSIE && env.browserVersion < 11 ? '&nbsp;' : '<br>';\n\n/**\n * @method nodeLength\n *\n * returns #text's text size or element's childNodes size\n *\n * @param {Node} node\n */\nfunction nodeLength(node) {\n if (isText(node)) {\n return node.nodeValue.length;\n }\n\n if (node) {\n return node.childNodes.length;\n }\n\n return 0;\n}\n\n/**\n * returns whether deepest child node is empty or not.\n *\n * @param {Node} node\n * @return {Boolean}\n */\nfunction deepestChildIsEmpty(node) {\n do {\n if (node.firstElementChild === null || node.firstElementChild.innerHTML === '') break;\n } while ((node = node.firstElementChild));\n\n return isEmpty(node);\n}\n\n/**\n * returns whether node is empty or not.\n *\n * @param {Node} node\n * @return {Boolean}\n */\nfunction isEmpty(node) {\n const len = nodeLength(node);\n\n if (len === 0) {\n return true;\n } else if (!isText(node) && len === 1 && node.innerHTML === blankHTML) {\n // ex) <p><br></p>, <span><br></span>\n return true;\n } else if (lists.all(node.childNodes, isText) && node.innerHTML === '') {\n // ex) <p></p>, <span></span>\n return true;\n }\n\n return false;\n}\n\n/**\n * padding blankHTML if node is empty (for cursor position)\n */\nfunction paddingBlankHTML(node) {\n if (!isVoid(node) && !nodeLength(node)) {\n node.innerHTML = blankHTML;\n }\n}\n\n/**\n * find nearest ancestor predicate hit\n *\n * @param {Node} node\n * @param {Function} pred - predicate function\n */\nfunction ancestor(node, pred) {\n while (node) {\n if (pred(node)) { return node; }\n if (isEditable(node)) { break; }\n\n node = node.parentNode;\n }\n return null;\n}\n\n/**\n * find nearest ancestor only single child blood line and predicate hit\n *\n * @param {Node} node\n * @param {Function} pred - predicate function\n */\nfunction singleChildAncestor(node, pred) {\n node = node.parentNode;\n\n while (node) {\n if (nodeLength(node) !== 1) { break; }\n if (pred(node)) { return node; }\n if (isEditable(node)) { break; }\n\n node = node.parentNode;\n }\n return null;\n}\n\n/**\n * returns new array of ancestor nodes (until predicate hit).\n *\n * @param {Node} node\n * @param {Function} [optional] pred - predicate function\n */\nfunction listAncestor(node, pred) {\n pred = pred || func.fail;\n\n const ancestors = [];\n ancestor(node, function(el) {\n if (!isEditable(el)) {\n ancestors.push(el);\n }\n\n return pred(el);\n });\n return ancestors;\n}\n\n/**\n * find farthest ancestor predicate hit\n */\nfunction lastAncestor(node, pred) {\n const ancestors = listAncestor(node);\n return lists.last(ancestors.filter(pred));\n}\n\n/**\n * returns common ancestor node between two nodes.\n *\n * @param {Node} nodeA\n * @param {Node} nodeB\n */\nfunction commonAncestor(nodeA, nodeB) {\n const ancestors = listAncestor(nodeA);\n for (let n = nodeB; n; n = n.parentNode) {\n if (ancestors.indexOf(n) > -1) return n;\n }\n return null; // difference document area\n}\n\n/**\n * listing all previous siblings (until predicate hit).\n *\n * @param {Node} node\n * @param {Function} [optional] pred - predicate function\n */\nfunction listPrev(node, pred) {\n pred = pred || func.fail;\n\n const nodes = [];\n while (node) {\n if (pred(node)) { break; }\n nodes.push(node);\n node = node.previousSibling;\n }\n return nodes;\n}\n\n/**\n * listing next siblings (until predicate hit).\n *\n * @param {Node} node\n * @param {Function} [pred] - predicate function\n */\nfunction listNext(node, pred) {\n pred = pred || func.fail;\n\n const nodes = [];\n while (node) {\n if (pred(node)) { break; }\n nodes.push(node);\n node = node.nextSibling;\n }\n return nodes;\n}\n\n/**\n * listing descendant nodes\n *\n * @param {Node} node\n * @param {Function} [pred] - predicate function\n */\nfunction listDescendant(node, pred) {\n const descendants = [];\n pred = pred || func.ok;\n\n // start DFS(depth first search) with node\n (function fnWalk(current) {\n if (node !== current && pred(current)) {\n descendants.push(current);\n }\n for (let idx = 0, len = current.childNodes.length; idx < len; idx++) {\n fnWalk(current.childNodes[idx]);\n }\n })(node);\n\n return descendants;\n}\n\n/**\n * wrap node with new tag.\n *\n * @param {Node} node\n * @param {Node} tagName of wrapper\n * @return {Node} - wrapper\n */\nfunction wrap(node, wrapperName) {\n const parent = node.parentNode;\n const wrapper = $('<' + wrapperName + '>')[0];\n\n parent.insertBefore(wrapper, node);\n wrapper.appendChild(node);\n\n return wrapper;\n}\n\n/**\n * insert node after preceding\n *\n * @param {Node} node\n * @param {Node} preceding - predicate function\n */\nfunction insertAfter(node, preceding) {\n const next = preceding.nextSibling;\n let parent = preceding.parentNode;\n if (next) {\n parent.insertBefore(node, next);\n } else {\n parent.appendChild(node);\n }\n return node;\n}\n\n/**\n * append elements.\n *\n * @param {Node} node\n * @param {Collection} aChild\n */\nfunction appendChildNodes(node, aChild) {\n $.each(aChild, function(idx, child) {\n // special case: appending a pure UL/OL to a LI element creates inaccessible LI element\n // e.g. press enter in last LI which has UL/OL-subelements\n // Therefore, if current node is LI element with no child nodes (text-node) and appending a list, add a br before\n if (isLi(node) && node.firstChild === null && isList(child)) {\n node.appendChild(create(\"br\"));\n }\n\n node.appendChild(child);\n });\n return node;\n}\n\n/**\n * returns whether boundaryPoint is left edge or not.\n *\n * @param {BoundaryPoint} point\n * @return {Boolean}\n */\nfunction isLeftEdgePoint(point) {\n return point.offset === 0;\n}\n\n/**\n * returns whether boundaryPoint is right edge or not.\n *\n * @param {BoundaryPoint} point\n * @return {Boolean}\n */\nfunction isRightEdgePoint(point) {\n return point.offset === nodeLength(point.node);\n}\n\n/**\n * returns whether boundaryPoint is edge or not.\n *\n * @param {BoundaryPoint} point\n * @return {Boolean}\n */\nfunction isEdgePoint(point) {\n return isLeftEdgePoint(point) || isRightEdgePoint(point);\n}\n\n/**\n * returns whether node is left edge of ancestor or not.\n *\n * @param {Node} node\n * @param {Node} ancestor\n * @return {Boolean}\n */\nfunction isLeftEdgeOf(node, ancestor) {\n while (node && node !== ancestor) {\n if (position(node) !== 0) {\n return false;\n }\n node = node.parentNode;\n }\n\n return true;\n}\n\n/**\n * returns whether node is right edge of ancestor or not.\n *\n * @param {Node} node\n * @param {Node} ancestor\n * @return {Boolean}\n */\nfunction isRightEdgeOf(node, ancestor) {\n if (!ancestor) {\n return false;\n }\n while (node && node !== ancestor) {\n if (position(node) !== nodeLength(node.parentNode) - 1) {\n return false;\n }\n node = node.parentNode;\n }\n\n return true;\n}\n\n/**\n * returns whether point is left edge of ancestor or not.\n * @param {BoundaryPoint} point\n * @param {Node} ancestor\n * @return {Boolean}\n */\nfunction isLeftEdgePointOf(point, ancestor) {\n return isLeftEdgePoint(point) && isLeftEdgeOf(point.node, ancestor);\n}\n\n/**\n * returns whether point is right edge of ancestor or not.\n * @param {BoundaryPoint} point\n * @param {Node} ancestor\n * @return {Boolean}\n */\nfunction isRightEdgePointOf(point, ancestor) {\n return isRightEdgePoint(point) && isRightEdgeOf(point.node, ancestor);\n}\n\n/**\n * returns offset from parent.\n *\n * @param {Node} node\n */\nfunction position(node) {\n let offset = 0;\n while ((node = node.previousSibling)) {\n offset += 1;\n }\n return offset;\n}\n\nfunction hasChildren(node) {\n return !!(node && node.childNodes && node.childNodes.length);\n}\n\n/**\n * returns previous boundaryPoint\n *\n * @param {BoundaryPoint} point\n * @param {Boolean} isSkipInnerOffset\n * @return {BoundaryPoint}\n */\nfunction prevPoint(point, isSkipInnerOffset) {\n let node;\n let offset;\n\n if (point.offset === 0) {\n if (isEditable(point.node)) {\n return null;\n }\n\n node = point.node.parentNode;\n offset = position(point.node);\n } else if (hasChildren(point.node)) {\n node = point.node.childNodes[point.offset - 1];\n offset = nodeLength(node);\n } else {\n node = point.node;\n offset = isSkipInnerOffset ? 0 : point.offset - 1;\n }\n\n return {\n node: node,\n offset: offset,\n };\n}\n\n/**\n * returns next boundaryPoint\n *\n * @param {BoundaryPoint} point\n * @param {Boolean} isSkipInnerOffset\n * @return {BoundaryPoint}\n */\nfunction nextPoint(point, isSkipInnerOffset) {\n let node, offset;\n\n if (nodeLength(point.node) === point.offset) {\n if (isEditable(point.node)) {\n return null;\n }\n\n let nextTextNode = getNextTextNode(point.node);\n if (nextTextNode) {\n node = nextTextNode;\n offset = 0;\n } else {\n node = point.node.parentNode;\n offset = position(point.node) + 1;\n }\n } else if (hasChildren(point.node)) {\n node = point.node.childNodes[point.offset];\n offset = 0;\n } else {\n node = point.node;\n offset = isSkipInnerOffset ? nodeLength(point.node) : point.offset + 1;\n }\n\n return {\n node: node,\n offset: offset,\n };\n}\n\n/**\n * Find next boundaryPoint for preorder / depth first traversal of the DOM\n * returns next boundaryPoint with empty node\n *\n * @param {BoundaryPoint} point\n * @param {Boolean} isSkipInnerOffset\n * @return {BoundaryPoint}\n */\nfunction nextPointWithEmptyNode(point, isSkipInnerOffset) {\n let node, offset = 0;\n\n if (nodeLength(point.node) === point.offset) {\n if (isEditable(point.node)) {\n return null;\n }\n\n node = point.node.parentNode;\n offset = position(point.node) + 1;\n\n // if parent node is editable, return current node's sibling node.\n if (isEditable(node)) {\n node = point.node.nextSibling;\n offset = 0;\n }\n } else if (hasChildren(point.node)) {\n node = point.node.childNodes[point.offset];\n offset = 0;\n } else {\n node = point.node;\n offset = isSkipInnerOffset ? nodeLength(point.node) : point.offset + 1;\n }\n\n return {\n node: node,\n offset: offset,\n };\n}\n\n/*\n* returns the next Text node index or 0 if not found.\n*/\nfunction getNextTextNode(actual) {\n if(!actual.nextSibling) return undefined;\n if(actual.parent !== actual.nextSibling.parent) return undefined;\n\n if(isText(actual.nextSibling) ) return actual.nextSibling;\n else return getNextTextNode(actual.nextSibling);\n}\n\n/**\n * returns whether pointA and pointB is same or not.\n *\n * @param {BoundaryPoint} pointA\n * @param {BoundaryPoint} pointB\n * @return {Boolean}\n */\nfunction isSamePoint(pointA, pointB) {\n return pointA.node === pointB.node && pointA.offset === pointB.offset;\n}\n\n/**\n * returns whether point is visible (can set cursor) or not.\n *\n * @param {BoundaryPoint} point\n * @return {Boolean}\n */\nfunction isVisiblePoint(point) {\n if (isText(point.node) || !hasChildren(point.node) || isEmpty(point.node)) {\n return true;\n }\n\n const leftNode = point.node.childNodes[point.offset - 1];\n const rightNode = point.node.childNodes[point.offset];\n if ((!leftNode || isVoid(leftNode)) && (!rightNode || isVoid(rightNode)) || isTable(rightNode)) {\n return true;\n }\n\n return false;\n}\n\n/**\n * @method prevPointUtil\n *\n * @param {BoundaryPoint} point\n * @param {Function} pred\n * @return {BoundaryPoint}\n */\nfunction prevPointUntil(point, pred) {\n while (point) {\n if (pred(point)) {\n return point;\n }\n\n point = prevPoint(point);\n }\n\n return null;\n}\n\n/**\n * @method nextPointUntil\n *\n * @param {BoundaryPoint} point\n * @param {Function} pred\n * @return {BoundaryPoint}\n */\nfunction nextPointUntil(point, pred) {\n while (point) {\n if (pred(point)) {\n return point;\n }\n\n point = nextPoint(point);\n }\n\n return null;\n}\n\n/**\n * returns whether point has character or not.\n *\n * @param {Point} point\n * @return {Boolean}\n */\nfunction isCharPoint(point) {\n if (!isText(point.node)) {\n return false;\n }\n\n const ch = point.node.nodeValue.charAt(point.offset - 1);\n return ch && (ch !== ' ' && ch !== NBSP_CHAR);\n}\n\n/**\n * returns whether point has space or not.\n *\n * @param {Point} point\n * @return {Boolean}\n */\nfunction isSpacePoint(point) {\n if (!isText(point.node)) {\n return false;\n }\n\n const ch = point.node.nodeValue.charAt(point.offset - 1);\n return ch === ' ' || ch === NBSP_CHAR;\n}\n\n/**\n * @method walkPoint - preorder / depth first traversal of the DOM\n *\n * @param {BoundaryPoint} startPoint\n * @param {BoundaryPoint} endPoint\n * @param {Function} handler\n * @param {Boolean} isSkipInnerOffset\n */\nfunction walkPoint(startPoint, endPoint, handler, isSkipInnerOffset) {\n let point = startPoint;\n\n while (point) {\n handler(point);\n\n if (isSamePoint(point, endPoint)) {\n break;\n }\n\n const isSkipOffset = isSkipInnerOffset &&\n startPoint.node !== point.node &&\n endPoint.node !== point.node;\n point = nextPointWithEmptyNode(point, isSkipOffset);\n }\n}\n\n/**\n * @method makeOffsetPath\n *\n * return offsetPath(array of offset) from ancestor\n *\n * @param {Node} ancestor - ancestor node\n * @param {Node} node\n */\nfunction makeOffsetPath(ancestor, node) {\n const ancestors = listAncestor(node, func.eq(ancestor));\n return ancestors.map(position).reverse();\n}\n\n/**\n * @method fromOffsetPath\n *\n * return element from offsetPath(array of offset)\n *\n * @param {Node} ancestor - ancestor node\n * @param {array} offsets - offsetPath\n */\nfunction fromOffsetPath(ancestor, offsets) {\n let current = ancestor;\n for (let i = 0, len = offsets.length; i < len; i++) {\n if (current.childNodes.length <= offsets[i]) {\n current = current.childNodes[current.childNodes.length - 1];\n } else {\n current = current.childNodes[offsets[i]];\n }\n }\n return current;\n}\n\n/**\n * @method splitNode\n *\n * split element or #text\n *\n * @param {BoundaryPoint} point\n * @param {Object} [options]\n * @param {Boolean} [options.isSkipPaddingBlankHTML] - default: false\n * @param {Boolean} [options.isNotSplitEdgePoint] - default: false\n * @param {Boolean} [options.isDiscardEmptySplits] - default: false\n * @return {Node} right node of boundaryPoint\n */\nfunction splitNode(point, options) {\n let isSkipPaddingBlankHTML = options && options.isSkipPaddingBlankHTML;\n const isNotSplitEdgePoint = options && options.isNotSplitEdgePoint;\n const isDiscardEmptySplits = options && options.isDiscardEmptySplits;\n\n if (isDiscardEmptySplits) {\n isSkipPaddingBlankHTML = true;\n }\n\n // edge case\n if (isEdgePoint(point) && (isText(point.node) || isNotSplitEdgePoint)) {\n if (isLeftEdgePoint(point)) {\n return point.node;\n } else if (isRightEdgePoint(point)) {\n return point.node.nextSibling;\n }\n }\n\n // split #text\n if (isText(point.node)) {\n return point.node.splitText(point.offset);\n } else {\n const childNode = point.node.childNodes[point.offset];\n let childNodes = listNext(childNode);\n\n const clone = insertAfter(point.node.cloneNode(false), point.node);\n appendChildNodes(clone, childNodes);\n\n if (!isSkipPaddingBlankHTML) {\n paddingBlankHTML(point.node);\n paddingBlankHTML(clone);\n }\n\n if (isDiscardEmptySplits) {\n if (isEmpty(point.node)) {\n remove(point.node);\n }\n if (isEmpty(clone)) {\n remove(clone);\n return point.node.nextSibling;\n }\n }\n\n return clone;\n }\n}\n\n/**\n * @method splitTree\n *\n * split tree by point\n *\n * @param {Node} root - split root\n * @param {BoundaryPoint} point\n * @param {Object} [options]\n * @param {Boolean} [options.isSkipPaddingBlankHTML] - default: false\n * @param {Boolean} [options.isNotSplitEdgePoint] - default: false\n * @return {Node} right node of boundaryPoint\n */\nfunction splitTree(root, point, options) {\n // ex) [#text, <span>, <p>]\n let ancestors = listAncestor(point.node, func.eq(root));\n\n if (!ancestors.length) {\n return null;\n } else if (ancestors.length === 1) {\n return splitNode(point, options);\n }\n // Filter elements with sibling elements\n if (ancestors.length > 2) {\n let domList = ancestors.slice(0, ancestors.length - 1);\n let ifHasNextSibling = domList.find(item => item.nextSibling);\n if (ifHasNextSibling && point.offset != 0 && isRightEdgePoint(point)) {\n let nestSibling = ifHasNextSibling.nextSibling;\n let textNode;\n if (nestSibling.nodeType == 1) {\n textNode = nestSibling.childNodes[0];\n ancestors = listAncestor(textNode, func.eq(root));\n point = {\n node: textNode,\n offset: 0,\n };\n }\n else if (nestSibling.nodeType == 3 && !nestSibling.data.match(/[\\n\\r]/g)) {\n textNode = nestSibling;\n ancestors = listAncestor(textNode, func.eq(root));\n point = {\n node: textNode,\n offset: 0,\n };\n }\n }\n }\n return ancestors.reduce(function(node, parent) {\n if (node === point.node) {\n node = splitNode(point, options);\n }\n\n return splitNode({\n node: parent,\n offset: node ? position(node) : nodeLength(parent),\n }, options);\n });\n}\n\n/**\n * split point\n *\n * @param {Point} point\n * @param {Boolean} isInline\n * @return {Object}\n */\nfunction splitPoint(point, isInline) {\n // find splitRoot, container\n // - inline: splitRoot is a child of paragraph\n // - block: splitRoot is a child of bodyContainer\n const pred = isInline ? isPara : isBodyContainer;\n const ancestors = listAncestor(point.node, pred);\n const topAncestor = lists.last(ancestors) || point.node;\n\n let splitRoot, container;\n if (pred(topAncestor)) {\n splitRoot = ancestors[ancestors.length - 2];\n container = topAncestor;\n } else {\n splitRoot = topAncestor;\n container = splitRoot.parentNode;\n }\n\n // if splitRoot is exists, split with splitTree\n let pivot = splitRoot && splitTree(splitRoot, point, {\n isSkipPaddingBlankHTML: isInline,\n isNotSplitEdgePoint: isInline,\n });\n\n // if container is point.node, find pivot with point.offset\n if (!pivot && container === point.node) {\n pivot = point.node.childNodes[point.offset];\n }\n\n return {\n rightNode: pivot,\n container: container,\n };\n}\n\nfunction create(nodeName) {\n return document.createElement(nodeName);\n}\n\nfunction createText(text) {\n return document.createTextNode(text);\n}\n\n/**\n * @method remove\n *\n * remove node, (isRemoveChild: remove child or not)\n *\n * @param {Node} node\n * @param {Boolean} isRemoveChild\n */\nfunction remove(node, isRemoveChild) {\n if (!node || !node.parentNode) { return; }\n if (node.removeNode) { return node.removeNode(isRemoveChild); }\n\n const parent = node.parentNode;\n if (!isRemoveChild) {\n const nodes = [];\n for (let i = 0, len = node.childNodes.length; i < len; i++) {\n nodes.push(node.childNodes[i]);\n }\n\n for (let i = 0, len = nodes.length; i < len; i++) {\n parent.insertBefore(nodes[i], node);\n }\n }\n\n parent.removeChild(node);\n}\n\n/**\n * @method removeWhile\n *\n * @param {Node} node\n * @param {Function} pred\n */\nfunction removeWhile(node, pred) {\n while (node) {\n if (isEditable(node) || !pred(node)) {\n break;\n }\n\n const parent = node.parentNode;\n remove(node);\n node = parent;\n }\n}\n\n/**\n * @method replace\n *\n * replace node with provided nodeName\n *\n * @param {Node} node\n * @param {String} nodeName\n * @return {Node} - new node\n */\nfunction replace(node, nodeName) {\n if (node.nodeName.toUpperCase() === nodeName.toUpperCase()) {\n return node;\n }\n\n const newNode = create(nodeName);\n\n if (node.style.cssText) {\n newNode.style.cssText = node.style.cssText;\n }\n\n appendChildNodes(newNode, lists.from(node.childNodes));\n insertAfter(newNode, node);\n remove(node);\n\n return newNode;\n}\n\nconst isTextarea = makePredByNodeName('TEXTAREA');\n\n/**\n * @param {jQuery} $node\n * @param {Boolean} [stripLinebreaks] - default: false\n */\nfunction value($node, stripLinebreaks) {\n const val = isTextarea($node[0]) ? $node.val() : $node.html();\n if (stripLinebreaks) {\n return val.replace(/[\\n\\r]/g, '');\n }\n return val;\n}\n\n/**\n * @method html\n *\n * get the HTML contents of node\n *\n * @param {jQuery} $node\n * @param {Boolean} [isNewlineOnBlock]\n */\nfunction html($node, isNewlineOnBlock) {\n let markup = value($node);\n\n if (isNewlineOnBlock) {\n const regexTag = /<(\\/?)(\\b(?!!)[^>\\s]*)(.*?)(\\s*\\/?>)/g;\n markup = markup.replace(regexTag, function(match, endSlash, name) {\n name = name.toUpperCase();\n const isEndOfInlineContainer = /^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(name) &&\n !!endSlash;\n const isBlockNode = /^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(name);\n\n return match + ((isEndOfInlineContainer || isBlockNode) ? '\\n' : '');\n });\n markup = markup.trim();\n }\n\n return markup;\n}\n\nfunction posFromPlaceholder(placeholder) {\n const $placeholder = $(placeholder);\n const pos = $placeholder.offset();\n const height = $placeholder.outerHeight(true); // include margin\n\n return {\n left: pos.left,\n top: pos.top + height,\n };\n}\n\nfunction attachEvents($node, events) {\n Object.keys(events).forEach(function(key) {\n $node.on(key, events[key]);\n });\n}\n\nfunction detachEvents($node, events) {\n Object.keys(events).forEach(function(key) {\n $node.off(key, events[key]);\n });\n}\n\n/**\n * @method isCustomStyleTag\n *\n * assert if a node contains a \"note-styletag\" class,\n * which implies that's a custom-made style tag node\n *\n * @param {Node} an HTML DOM node\n */\nfunction isCustomStyleTag(node) {\n return node && !isText(node) && lists.contains(node.classList, 'note-styletag');\n}\n\nexport default {\n /** @property {String} NBSP_CHAR */\n NBSP_CHAR,\n /** @property {String} ZERO_WIDTH_NBSP_CHAR */\n ZERO_WIDTH_NBSP_CHAR,\n /** @property {String} blank */\n blank: blankHTML,\n /** @property {String} emptyPara */\n emptyPara: `<p>${blankHTML}</p>`,\n makePredByNodeName,\n isEditable,\n isControlSizing,\n isText,\n isElement,\n isVoid,\n isPara,\n isPurePara,\n isHeading,\n isInline,\n isBlock: func.not(isInline),\n isBodyInline,\n isBody,\n isParaInline,\n isPre,\n isList,\n isTable,\n isData,\n isCell,\n isBlockquote,\n isBodyContainer,\n isAnchor,\n isDiv: makePredByNodeName('DIV'),\n isLi,\n isBR: makePredByNodeName('BR'),\n isSpan: makePredByNodeName('SPAN'),\n isB: makePredByNodeName('B'),\n isU: makePredByNodeName('U'),\n isS: makePredByNodeName('S'),\n isI: makePredByNodeName('I'),\n isImg: makePredByNodeName('IMG'),\n isTextarea,\n deepestChildIsEmpty,\n isEmpty,\n isEmptyAnchor: func.and(isAnchor, isEmpty),\n isClosestSibling,\n withClosestSiblings,\n nodeLength,\n isLeftEdgePoint,\n isRightEdgePoint,\n isEdgePoint,\n isLeftEdgeOf,\n isRightEdgeOf,\n isLeftEdgePointOf,\n isRightEdgePointOf,\n prevPoint,\n nextPoint,\n nextPointWithEmptyNode,\n isSamePoint,\n isVisiblePoint,\n prevPointUntil,\n nextPointUntil,\n isCharPoint,\n isSpacePoint,\n walkPoint,\n ancestor,\n singleChildAncestor,\n listAncestor,\n lastAncestor,\n listNext,\n listPrev,\n listDescendant,\n commonAncestor,\n wrap,\n insertAfter,\n appendChildNodes,\n position,\n hasChildren,\n makeOffsetPath,\n fromOffsetPath,\n splitTree,\n splitPoint,\n create,\n createText,\n remove,\n removeWhile,\n replace,\n html,\n value,\n posFromPlaceholder,\n attachEvents,\n detachEvents,\n isCustomStyleTag,\n};\n","import $ from 'jquery';\nimport func from './core/func';\nimport lists from './core/lists';\nimport dom from './core/dom';\n\nexport default class Context {\n /**\n * @param {jQuery} $note\n * @param {Object} options\n */\n constructor($note, options) {\n this.$note = $note;\n\n this.memos = {};\n this.modules = {};\n this.layoutInfo = {};\n this.options = $.extend(true, {}, options);\n\n // init ui with options\n $.summernote.ui = $.summernote.ui_template(this.options);\n this.ui = $.summernote.ui;\n\n this.initialize();\n }\n\n /**\n * create layout and initialize modules and other resources\n */\n initialize() {\n this.layoutInfo = this.ui.createLayout(this.$note);\n this._initialize();\n this.$note.hide();\n return this;\n }\n\n /**\n * destroy modules and other resources and remove layout\n */\n destroy() {\n this._destroy();\n this.$note.removeData('summernote');\n this.ui.removeLayout(this.$note, this.layoutInfo);\n }\n\n /**\n * destory modules and other resources and initialize it again\n */\n reset() {\n const disabled = this.isDisabled();\n this.code(dom.emptyPara);\n this._destroy();\n this._initialize();\n\n if (disabled) {\n this.disable();\n }\n }\n\n _initialize() {\n // set own id\n this.options.id = func.uniqueId($.now());\n // set default container for tooltips, popovers, and dialogs\n this.options.container = this.options.container || this.layoutInfo.editor;\n\n // add optional buttons\n const buttons = $.extend({}, this.options.buttons);\n Object.keys(buttons).forEach((key) => {\n this.memo('button.' + key, buttons[key]);\n });\n\n const modules = $.extend({}, this.options.modules, $.summernote.plugins || {});\n\n // add and initialize modules\n Object.keys(modules).forEach((key) => {\n this.module(key, modules[key], true);\n });\n\n Object.keys(this.modules).forEach((key) => {\n this.initializeModule(key);\n });\n }\n\n _destroy() {\n // destroy modules with reversed order\n Object.keys(this.modules).reverse().forEach((key) => {\n this.removeModule(key);\n });\n\n Object.keys(this.memos).forEach((key) => {\n this.removeMemo(key);\n });\n // trigger custom onDestroy callback\n this.triggerEvent('destroy', this);\n }\n\n code(html) {\n const isActivated = this.invoke('codeview.isActivated');\n\n if (html === undefined) {\n this.invoke('codeview.sync');\n return isActivated ? this.layoutInfo.codable.val() : this.layoutInfo.editable.html();\n } else {\n if (isActivated) {\n this.invoke('codeview.sync', html);\n } else {\n this.layoutInfo.editable.html(html);\n }\n this.$note.val(html);\n this.triggerEvent('change', html, this.layoutInfo.editable);\n }\n }\n\n isDisabled() {\n return this.layoutInfo.editable.attr('contenteditable') === 'false';\n }\n\n enable() {\n this.layoutInfo.editable.attr('contenteditable', true);\n this.invoke('toolbar.activate', true);\n this.triggerEvent('disable', false);\n this.options.editing = true;\n }\n\n disable() {\n // close codeview if codeview is opend\n if (this.invoke('codeview.isActivated')) {\n this.invoke('codeview.deactivate');\n }\n this.layoutInfo.editable.attr('contenteditable', false);\n this.options.editing = false;\n this.invoke('toolbar.deactivate', true);\n\n this.triggerEvent('disable', true);\n }\n\n triggerEvent() {\n const namespace = lists.head(arguments);\n const args = lists.tail(lists.from(arguments));\n\n const callback = this.options.callbacks[func.namespaceToCamel(namespace, 'on')];\n if (callback) {\n callback.apply(this.$note[0], args);\n }\n this.$note.trigger('summernote.' + namespace, args);\n }\n\n initializeModule(key) {\n const module = this.modules[key];\n module.shouldInitialize = module.shouldInitialize || func.ok;\n if (!module.shouldInitialize()) {\n return;\n }\n\n // initialize module\n if (module.initialize) {\n module.initialize();\n }\n\n // attach events\n if (module.events) {\n dom.attachEvents(this.$note, module.events);\n }\n }\n\n module(key, ModuleClass, withoutIntialize) {\n if (arguments.length === 1) {\n return this.modules[key];\n }\n\n this.modules[key] = new ModuleClass(this);\n\n if (!withoutIntialize) {\n this.initializeModule(key);\n }\n }\n\n removeModule(key) {\n const module = this.modules[key];\n if (module.shouldInitialize()) {\n if (module.events) {\n dom.detachEvents(this.$note, module.events);\n }\n\n if (module.destroy) {\n module.destroy();\n }\n }\n\n delete this.modules[key];\n }\n\n memo(key, obj) {\n if (arguments.length === 1) {\n return this.memos[key];\n }\n this.memos[key] = obj;\n }\n\n removeMemo(key) {\n if (this.memos[key] && this.memos[key].destroy) {\n this.memos[key].destroy();\n }\n\n delete this.memos[key];\n }\n\n /**\n * Some buttons need to change their visual style immediately once they get pressed\n */\n createInvokeHandlerAndUpdateState(namespace, value) {\n return (event) => {\n this.createInvokeHandler(namespace, value)(event);\n this.invoke('buttons.updateCurrentStyle');\n };\n }\n\n createInvokeHandler(namespace, value) {\n return (event) => {\n event.preventDefault();\n const $target = $(event.target);\n this.invoke(namespace, value || $target.closest('[data-value]').data('value'), $target);\n };\n }\n\n invoke() {\n const namespace = lists.head(arguments);\n const args = lists.tail(lists.from(arguments));\n\n const splits = namespace.split('.');\n const hasSeparator = splits.length > 1;\n const moduleName = hasSeparator && lists.head(splits);\n const methodName = hasSeparator ? lists.last(splits) : lists.head(splits);\n\n const module = this.modules[moduleName || 'editor'];\n if (!moduleName && this[methodName]) {\n return this[methodName].apply(this, args);\n } else if (module && module[methodName] && module.shouldInitialize()) {\n return module[methodName].apply(module, args);\n }\n }\n}\n","import $ from 'jquery';\nimport env from './core/env';\nimport lists from './core/lists';\nimport Context from './Context';\n\n$.fn.extend({\n /**\n * Summernote API\n *\n * @param {Object|String}\n * @return {this}\n */\n summernote: function() {\n const type = typeof(lists.head(arguments));\n const isExternalAPICalled = type === 'string';\n const hasInitOptions = type === 'object';\n\n const options = $.extend({}, $.summernote.options, hasInitOptions ? lists.head(arguments) : {});\n\n // Update options\n options.langInfo = $.extend(true, {}, $.summernote.lang['en-US'], $.summernote.lang[options.lang]);\n options.icons = $.extend(true, {}, $.summernote.options.icons, options.icons);\n options.tooltip = options.tooltip === 'auto' ? !env.isSupportTouch : options.tooltip;\n\n this.each((idx, note) => {\n const $note = $(note);\n if (!$note.data('summernote')) {\n const context = new Context($note, options);\n $note.data('summernote', context);\n $note.data('summernote').triggerEvent('init', context.layoutInfo);\n }\n });\n\n const $note = this.first();\n if ($note.length) {\n const context = $note.data('summernote');\n if (isExternalAPICalled) {\n return context.invoke.apply(context, lists.from(arguments));\n } else if (options.focus) {\n context.invoke('editor.focus');\n }\n }\n\n return this;\n },\n});\n","import $ from 'jquery';\nimport env from './env';\nimport func from './func';\nimport lists from './lists';\nimport dom from './dom';\n\n/**\n * return boundaryPoint from TextRange, inspired by Andy Na's HuskyRange.js\n *\n * @param {TextRange} textRange\n * @param {Boolean} isStart\n * @return {BoundaryPoint}\n *\n * @see http://msdn.microsoft.com/en-us/library/ie/ms535872(v=vs.85).aspx\n */\nfunction textRangeToPoint(textRange, isStart) {\n let container = textRange.parentElement();\n let offset;\n\n const tester = document.body.createTextRange();\n let prevContainer;\n const childNodes = lists.from(container.childNodes);\n for (offset = 0; offset < childNodes.length; offset++) {\n if (dom.isText(childNodes[offset])) {\n continue;\n }\n tester.moveToElementText(childNodes[offset]);\n if (tester.compareEndPoints('StartToStart', textRange) >= 0) {\n break;\n }\n prevContainer = childNodes[offset];\n }\n\n if (offset !== 0 && dom.isText(childNodes[offset - 1])) {\n const textRangeStart = document.body.createTextRange();\n let curTextNode = null;\n textRangeStart.moveToElementText(prevContainer || container);\n textRangeStart.collapse(!prevContainer);\n curTextNode = prevContainer ? prevContainer.nextSibling : container.firstChild;\n\n const pointTester = textRange.duplicate();\n pointTester.setEndPoint('StartToStart', textRangeStart);\n let textCount = pointTester.text.replace(/[\\r\\n]/g, '').length;\n\n while (textCount > curTextNode.nodeValue.length && curTextNode.nextSibling) {\n textCount -= curTextNode.nodeValue.length;\n curTextNode = curTextNode.nextSibling;\n }\n\n // [workaround] enforce IE to re-reference curTextNode, hack\n const dummy = curTextNode.nodeValue; // eslint-disable-line\n\n if (isStart && curTextNode.nextSibling && dom.isText(curTextNode.nextSibling) &&\n textCount === curTextNode.nodeValue.length) {\n textCount -= curTextNode.nodeValue.length;\n curTextNode = curTextNode.nextSibling;\n }\n\n container = curTextNode;\n offset = textCount;\n }\n\n return {\n cont: container,\n offset: offset,\n };\n}\n\n/**\n * return TextRange from boundary point (inspired by google closure-library)\n * @param {BoundaryPoint} point\n * @return {TextRange}\n */\nfunction pointToTextRange(point) {\n const textRangeInfo = function(container, offset) {\n let node, isCollapseToStart;\n\n if (dom.isText(container)) {\n const prevTextNodes = dom.listPrev(container, func.not(dom.isText));\n const prevContainer = lists.last(prevTextNodes).previousSibling;\n node = prevContainer || container.parentNode;\n offset += lists.sum(lists.tail(prevTextNodes), dom.nodeLength);\n isCollapseToStart = !prevContainer;\n } else {\n node = container.childNodes[offset] || container;\n if (dom.isText(node)) {\n return textRangeInfo(node, 0);\n }\n\n offset = 0;\n isCollapseToStart = false;\n }\n\n return {\n node: node,\n collapseToStart: isCollapseToStart,\n offset: offset,\n };\n };\n\n const textRange = document.body.createTextRange();\n const info = textRangeInfo(point.node, point.offset);\n\n textRange.moveToElementText(info.node);\n textRange.collapse(info.collapseToStart);\n textRange.moveStart('character', info.offset);\n return textRange;\n}\n\n/**\n * Wrapped Range\n *\n * @constructor\n * @param {Node} sc - start container\n * @param {Number} so - start offset\n * @param {Node} ec - end container\n * @param {Number} eo - end offset\n */\nclass WrappedRange {\n constructor(sc, so, ec, eo) {\n this.sc = sc;\n this.so = so;\n this.ec = ec;\n this.eo = eo;\n\n // isOnEditable: judge whether range is on editable or not\n this.isOnEditable = this.makeIsOn(dom.isEditable);\n // isOnList: judge whether range is on list node or not\n this.isOnList = this.makeIsOn(dom.isList);\n // isOnAnchor: judge whether range is on anchor node or not\n this.isOnAnchor = this.makeIsOn(dom.isAnchor);\n // isOnCell: judge whether range is on cell node or not\n this.isOnCell = this.makeIsOn(dom.isCell);\n // isOnData: judge whether range is on data node or not\n this.isOnData = this.makeIsOn(dom.isData);\n }\n\n // nativeRange: get nativeRange from sc, so, ec, eo\n nativeRange() {\n if (env.isW3CRangeSupport) {\n const w3cRange = document.createRange();\n w3cRange.setStart(this.sc, this.so);\n w3cRange.setEnd(this.ec, this.eo);\n\n return w3cRange;\n } else {\n const textRange = pointToTextRange({\n node: this.sc,\n offset: this.so,\n });\n\n textRange.setEndPoint('EndToEnd', pointToTextRange({\n node: this.ec,\n offset: this.eo,\n }));\n\n return textRange;\n }\n }\n\n getPoints() {\n return {\n sc: this.sc,\n so: this.so,\n ec: this.ec,\n eo: this.eo,\n };\n }\n\n getStartPoint() {\n return {\n node: this.sc,\n offset: this.so,\n };\n }\n\n getEndPoint() {\n return {\n node: this.ec,\n offset: this.eo,\n };\n }\n\n /**\n * select update visible range\n */\n select() {\n const nativeRng = this.nativeRange();\n if (env.isW3CRangeSupport) {\n const selection = document.getSelection();\n if (selection.rangeCount > 0) {\n selection.removeAllRanges();\n }\n selection.addRange(nativeRng);\n } else {\n nativeRng.select();\n }\n\n return this;\n }\n\n /**\n * Moves the scrollbar to start container(sc) of current range\n *\n * @return {WrappedRange}\n */\n scrollIntoView(container) {\n const height = $(container).height();\n if (container.scrollTop + height < this.sc.offsetTop) {\n container.scrollTop += Math.abs(container.scrollTop + height - this.sc.offsetTop);\n }\n\n return this;\n }\n\n /**\n * @return {WrappedRange}\n */\n normalize() {\n /**\n * @param {BoundaryPoint} point\n * @param {Boolean} isLeftToRight - true: prefer to choose right node\n * - false: prefer to choose left node\n * @return {BoundaryPoint}\n */\n const getVisiblePoint = function(point, isLeftToRight) {\n if (!point) {\n return point;\n }\n\n // Just use the given point [XXX:Adhoc]\n // - case 01. if the point is on the middle of the node\n // - case 02. if the point is on the right edge and prefer to choose left node\n // - case 03. if the point is on the left edge and prefer to choose right node\n // - case 04. if the point is on the right edge and prefer to choose right node but the node is void\n // - case 05. if the point is on the left edge and prefer to choose left node but the node is void\n // - case 06. if the point is on the block node and there is no children\n if (dom.isVisiblePoint(point)) {\n if (!dom.isEdgePoint(point) ||\n (dom.isRightEdgePoint(point) && !isLeftToRight) ||\n (dom.isLeftEdgePoint(point) && isLeftToRight) ||\n (dom.isRightEdgePoint(point) && isLeftToRight && dom.isVoid(point.node.nextSibling)) ||\n (dom.isLeftEdgePoint(point) && !isLeftToRight && dom.isVoid(point.node.previousSibling)) ||\n (dom.isBlock(point.node) && dom.isEmpty(point.node))) {\n return point;\n }\n }\n\n // point on block's edge\n const block = dom.ancestor(point.node, dom.isBlock);\n let hasRightNode = false;\n\n if (!hasRightNode) {\n const prevPoint = dom.prevPoint(point) || { node: null };\n hasRightNode = (dom.isLeftEdgePointOf(point, block) || dom.isVoid(prevPoint.node)) && !isLeftToRight;\n }\n\n let hasLeftNode = false;\n if (!hasLeftNode) {\n const nextPoint = dom.nextPoint(point) || { node: null };\n hasLeftNode = (dom.isRightEdgePointOf(point, block) || dom.isVoid(nextPoint.node)) && isLeftToRight;\n }\n\n if (hasRightNode || hasLeftNode) {\n // returns point already on visible point\n if (dom.isVisiblePoint(point)) {\n return point;\n }\n // reverse direction\n isLeftToRight = !isLeftToRight;\n }\n\n const nextPoint = isLeftToRight ? dom.nextPointUntil(dom.nextPoint(point), dom.isVisiblePoint)\n : dom.prevPointUntil(dom.prevPoint(point), dom.isVisiblePoint);\n return nextPoint || point;\n };\n\n const endPoint = getVisiblePoint(this.getEndPoint(), false);\n const startPoint = this.isCollapsed() ? endPoint : getVisiblePoint(this.getStartPoint(), true);\n\n return new WrappedRange(\n startPoint.node,\n startPoint.offset,\n endPoint.node,\n endPoint.offset\n );\n }\n\n /**\n * returns matched nodes on range\n *\n * @param {Function} [pred] - predicate function\n * @param {Object} [options]\n * @param {Boolean} [options.includeAncestor]\n * @param {Boolean} [options.fullyContains]\n * @return {Node[]}\n */\n nodes(pred, options) {\n pred = pred || func.ok;\n\n const includeAncestor = options && options.includeAncestor;\n const fullyContains = options && options.fullyContains;\n\n // TODO compare points and sort\n const startPoint = this.getStartPoint();\n const endPoint = this.getEndPoint();\n\n const nodes = [];\n const leftEdgeNodes = [];\n\n dom.walkPoint(startPoint, endPoint, function(point) {\n if (dom.isEditable(point.node)) {\n return;\n }\n\n let node;\n if (fullyContains) {\n if (dom.isLeftEdgePoint(point)) {\n leftEdgeNodes.push(point.node);\n }\n if (dom.isRightEdgePoint(point) && lists.contains(leftEdgeNodes, point.node)) {\n node = point.node;\n }\n } else if (includeAncestor) {\n node = dom.ancestor(point.node, pred);\n } else {\n node = point.node;\n }\n\n if (node && pred(node)) {\n nodes.push(node);\n }\n }, true);\n\n return lists.unique(nodes);\n }\n\n /**\n * returns commonAncestor of range\n * @return {Element} - commonAncestor\n */\n commonAncestor() {\n return dom.commonAncestor(this.sc, this.ec);\n }\n\n /**\n * returns expanded range by pred\n *\n * @param {Function} pred - predicate function\n * @return {WrappedRange}\n */\n expand(pred) {\n const startAncestor = dom.ancestor(this.sc, pred);\n const endAncestor = dom.ancestor(this.ec, pred);\n\n if (!startAncestor && !endAncestor) {\n return new WrappedRange(this.sc, this.so, this.ec, this.eo);\n }\n\n const boundaryPoints = this.getPoints();\n\n if (startAncestor) {\n boundaryPoints.sc = startAncestor;\n boundaryPoints.so = 0;\n }\n\n if (endAncestor) {\n boundaryPoints.ec = endAncestor;\n boundaryPoints.eo = dom.nodeLength(endAncestor);\n }\n\n return new WrappedRange(\n boundaryPoints.sc,\n boundaryPoints.so,\n boundaryPoints.ec,\n boundaryPoints.eo\n );\n }\n\n /**\n * @param {Boolean} isCollapseToStart\n * @return {WrappedRange}\n */\n collapse(isCollapseToStart) {\n if (isCollapseToStart) {\n return new WrappedRange(this.sc, this.so, this.sc, this.so);\n } else {\n return new WrappedRange(this.ec, this.eo, this.ec, this.eo);\n }\n }\n\n /**\n * splitText on range\n */\n splitText() {\n const isSameContainer = this.sc === this.ec;\n const boundaryPoints = this.getPoints();\n\n if (dom.isText(this.ec) && !dom.isEdgePoint(this.getEndPoint())) {\n this.ec.splitText(this.eo);\n }\n\n if (dom.isText(this.sc) && !dom.isEdgePoint(this.getStartPoint())) {\n boundaryPoints.sc = this.sc.splitText(this.so);\n boundaryPoints.so = 0;\n\n if (isSameContainer) {\n boundaryPoints.ec = boundaryPoints.sc;\n boundaryPoints.eo = this.eo - this.so;\n }\n }\n\n return new WrappedRange(\n boundaryPoints.sc,\n boundaryPoints.so,\n boundaryPoints.ec,\n boundaryPoints.eo\n );\n }\n\n /**\n * delete contents on range\n * @return {WrappedRange}\n */\n deleteContents() {\n if (this.isCollapsed()) {\n return this;\n }\n\n const rng = this.splitText();\n const nodes = rng.nodes(null, {\n fullyContains: true,\n });\n\n // find new cursor point\n const point = dom.prevPointUntil(rng.getStartPoint(), function(point) {\n return !lists.contains(nodes, point.node);\n });\n\n const emptyParents = [];\n $.each(nodes, function(idx, node) {\n // find empty parents\n const parent = node.parentNode;\n if (point.node !== parent && dom.nodeLength(parent) === 1) {\n emptyParents.push(parent);\n }\n dom.remove(node, false);\n });\n\n // remove empty parents\n $.each(emptyParents, function(idx, node) {\n dom.remove(node, false);\n });\n\n return new WrappedRange(\n point.node,\n point.offset,\n point.node,\n point.offset\n ).normalize();\n }\n\n /**\n * makeIsOn: return isOn(pred) function\n */\n makeIsOn(pred) {\n return function() {\n const ancestor = dom.ancestor(this.sc, pred);\n return !!ancestor && (ancestor === dom.ancestor(this.ec, pred));\n };\n }\n\n /**\n * @param {Function} pred\n * @return {Boolean}\n */\n isLeftEdgeOf(pred) {\n if (!dom.isLeftEdgePoint(this.getStartPoint())) {\n return false;\n }\n\n const node = dom.ancestor(this.sc, pred);\n return node && dom.isLeftEdgeOf(this.sc, node);\n }\n\n /**\n * returns whether range was collapsed or not\n */\n isCollapsed() {\n return this.sc === this.ec && this.so === this.eo;\n }\n\n /**\n * wrap inline nodes which children of body with paragraph\n *\n * @return {WrappedRange}\n */\n wrapBodyInlineWithPara() {\n if (dom.isBodyContainer(this.sc) && dom.isEmpty(this.sc)) {\n this.sc.innerHTML = dom.emptyPara;\n return new WrappedRange(this.sc.firstChild, 0, this.sc.firstChild, 0);\n }\n\n /**\n * [workaround] firefox often create range on not visible point. so normalize here.\n * - firefox: |<p>text</p>|\n * - chrome: <p>|text|</p>\n */\n const rng = this.normalize();\n if (dom.isParaInline(this.sc) || dom.isPara(this.sc)) {\n return rng;\n }\n\n // find inline top ancestor\n let topAncestor;\n if (dom.isInline(rng.sc)) {\n const ancestors = dom.listAncestor(rng.sc, func.not(dom.isInline));\n topAncestor = lists.last(ancestors);\n if (!dom.isInline(topAncestor)) {\n topAncestor = ancestors[ancestors.length - 2] || rng.sc.childNodes[rng.so];\n }\n } else {\n topAncestor = rng.sc.childNodes[rng.so > 0 ? rng.so - 1 : 0];\n }\n\n if (topAncestor) {\n // siblings not in paragraph\n let inlineSiblings = dom.listPrev(topAncestor, dom.isParaInline).reverse();\n inlineSiblings = inlineSiblings.concat(dom.listNext(topAncestor.nextSibling, dom.isParaInline));\n\n // wrap with paragraph\n if (inlineSiblings.length) {\n const para = dom.wrap(lists.head(inlineSiblings), 'p');\n dom.appendChildNodes(para, lists.tail(inlineSiblings));\n }\n }\n\n return this.normalize();\n }\n\n /**\n * insert node at current cursor\n *\n * @param {Node} node\n * @param {Boolean} doNotInsertPara - default is false, removes added <p> that's added if true\n * @return {Node}\n */\n insertNode(node, doNotInsertPara = false) {\n let rng = this;\n\n if (dom.isText(node) || dom.isInline(node)) {\n rng = this.wrapBodyInlineWithPara().deleteContents();\n }\n\n const info = dom.splitPoint(rng.getStartPoint(), dom.isInline(node));\n if (info.rightNode) {\n info.rightNode.parentNode.insertBefore(node, info.rightNode);\n if (dom.isEmpty(info.rightNode) && (doNotInsertPara || dom.isPara(node))) {\n info.rightNode.parentNode.removeChild(info.rightNode);\n }\n } else {\n info.container.appendChild(node);\n }\n\n return node;\n }\n\n /**\n * insert html at current cursor\n */\n pasteHTML(markup) {\n markup = ((markup || '') + '').trim(markup);\n\n const contentsContainer = $('<div></div>').html(markup)[0];\n let childNodes = lists.from(contentsContainer.childNodes);\n\n // const rng = this.wrapBodyInlineWithPara().deleteContents();\n const rng = this;\n let reversed = false;\n\n if (rng.so >= 0) {\n childNodes = childNodes.reverse();\n reversed = true;\n }\n\n childNodes = childNodes.map(function(childNode) {\n return rng.insertNode(childNode, !dom.isInline(childNode));\n });\n\n if (reversed) {\n childNodes = childNodes.reverse();\n }\n return childNodes;\n }\n\n /**\n * returns text in range\n *\n * @return {String}\n */\n toString() {\n const nativeRng = this.nativeRange();\n return env.isW3CRangeSupport ? nativeRng.toString() : nativeRng.text;\n }\n\n /**\n * returns range for word before cursor\n *\n * @param {Boolean} [findAfter] - find after cursor, default: false\n * @return {WrappedRange}\n */\n getWordRange(findAfter) {\n let endPoint = this.getEndPoint();\n\n if (!dom.isCharPoint(endPoint)) {\n return this;\n }\n\n const startPoint = dom.prevPointUntil(endPoint, function(point) {\n return !dom.isCharPoint(point);\n });\n\n if (findAfter) {\n endPoint = dom.nextPointUntil(endPoint, function(point) {\n return !dom.isCharPoint(point);\n });\n }\n\n return new WrappedRange(\n startPoint.node,\n startPoint.offset,\n endPoint.node,\n endPoint.offset\n );\n }\n\n /**\n * returns range for words before cursor\n *\n * @param {Boolean} [findAfter] - find after cursor, default: false\n * @return {WrappedRange}\n */\n getWordsRange(findAfter) {\n var endPoint = this.getEndPoint();\n\n var isNotTextPoint = function(point) {\n return !dom.isCharPoint(point) && !dom.isSpacePoint(point);\n };\n\n if (isNotTextPoint(endPoint)) {\n return this;\n }\n\n var startPoint = dom.prevPointUntil(endPoint, isNotTextPoint);\n\n if (findAfter) {\n endPoint = dom.nextPointUntil(endPoint, isNotTextPoint);\n }\n\n return new WrappedRange(\n startPoint.node,\n startPoint.offset,\n endPoint.node,\n endPoint.offset\n );\n }\n\n /**\n * returns range for words before cursor that match with a Regex\n *\n * example:\n * range: 'hi @Peter Pan'\n * regex: '/@[a-z ]+/i'\n * return range: '@Peter Pan'\n *\n * @param {RegExp} [regex]\n * @return {WrappedRange|null}\n */\n getWordsMatchRange(regex) {\n var endPoint = this.getEndPoint();\n\n var startPoint = dom.prevPointUntil(endPoint, function(point) {\n if (!dom.isCharPoint(point) && !dom.isSpacePoint(point)) {\n return true;\n }\n var rng = new WrappedRange(\n point.node,\n point.offset,\n endPoint.node,\n endPoint.offset\n );\n var result = regex.exec(rng.toString());\n return result && result.index === 0;\n });\n\n var rng = new WrappedRange(\n startPoint.node,\n startPoint.offset,\n endPoint.node,\n endPoint.offset\n );\n\n var text = rng.toString();\n var result = regex.exec(text);\n\n if (result && result[0].length === text.length) {\n return rng;\n } else {\n return null;\n }\n }\n\n /**\n * create offsetPath bookmark\n *\n * @param {Node} editable\n */\n bookmark(editable) {\n return {\n s: {\n path: dom.makeOffsetPath(editable, this.sc),\n offset: this.so,\n },\n e: {\n path: dom.makeOffsetPath(editable, this.ec),\n offset: this.eo,\n },\n };\n }\n\n /**\n * create offsetPath bookmark base on paragraph\n *\n * @param {Node[]} paras\n */\n paraBookmark(paras) {\n return {\n s: {\n path: lists.tail(dom.makeOffsetPath(lists.head(paras), this.sc)),\n offset: this.so,\n },\n e: {\n path: lists.tail(dom.makeOffsetPath(lists.last(paras), this.ec)),\n offset: this.eo,\n },\n };\n }\n\n /**\n * getClientRects\n * @return {Rect[]}\n */\n getClientRects() {\n const nativeRng = this.nativeRange();\n return nativeRng.getClientRects();\n }\n}\n\n/**\n * Data structure\n * * BoundaryPoint: a point of dom tree\n * * BoundaryPoints: two boundaryPoints corresponding to the start and the end of the Range\n *\n * See to http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Position\n */\nexport default {\n /**\n * create Range Object From arguments or Browser Selection\n *\n * @param {Node} sc - start container\n * @param {Number} so - start offset\n * @param {Node} ec - end container\n * @param {Number} eo - end offset\n * @return {WrappedRange}\n */\n create: function(sc, so, ec, eo) {\n if (arguments.length === 4) {\n return new WrappedRange(sc, so, ec, eo);\n } else if (arguments.length === 2) { // collapsed\n ec = sc;\n eo = so;\n return new WrappedRange(sc, so, ec, eo);\n } else {\n let wrappedRange = this.createFromSelection();\n\n if (!wrappedRange && arguments.length === 1) {\n let bodyElement = arguments[0];\n if (dom.isEditable(bodyElement)) {\n bodyElement = bodyElement.lastChild;\n }\n return this.createFromBodyElement(bodyElement, dom.emptyPara === arguments[0].innerHTML);\n }\n return wrappedRange;\n }\n },\n\n createFromBodyElement: function(bodyElement, isCollapseToStart = false) {\n var wrappedRange = this.createFromNode(bodyElement);\n return wrappedRange.collapse(isCollapseToStart);\n },\n\n createFromSelection: function() {\n let sc, so, ec, eo;\n if (env.isW3CRangeSupport) {\n const selection = document.getSelection();\n if (!selection || selection.rangeCount === 0) {\n return null;\n } else if (dom.isBody(selection.anchorNode)) {\n // Firefox: returns entire body as range on initialization.\n // We won't never need it.\n return null;\n }\n\n const nativeRng = selection.getRangeAt(0);\n sc = nativeRng.startContainer;\n so = nativeRng.startOffset;\n ec = nativeRng.endContainer;\n eo = nativeRng.endOffset;\n } else { // IE8: TextRange\n const textRange = document.selection.createRange();\n const textRangeEnd = textRange.duplicate();\n textRangeEnd.collapse(false);\n const textRangeStart = textRange;\n textRangeStart.collapse(true);\n\n let startPoint = textRangeToPoint(textRangeStart, true);\n let endPoint = textRangeToPoint(textRangeEnd, false);\n\n // same visible point case: range was collapsed.\n if (dom.isText(startPoint.node) && dom.isLeftEdgePoint(startPoint) &&\n dom.isTextNode(endPoint.node) && dom.isRightEdgePoint(endPoint) &&\n endPoint.node.nextSibling === startPoint.node) {\n startPoint = endPoint;\n }\n\n sc = startPoint.cont;\n so = startPoint.offset;\n ec = endPoint.cont;\n eo = endPoint.offset;\n }\n\n return new WrappedRange(sc, so, ec, eo);\n },\n\n /**\n * @method\n *\n * create WrappedRange from node\n *\n * @param {Node} node\n * @return {WrappedRange}\n */\n createFromNode: function(node) {\n let sc = node;\n let so = 0;\n let ec = node;\n let eo = dom.nodeLength(ec);\n\n // browsers can't target a picture or void node\n if (dom.isVoid(sc)) {\n so = dom.listPrev(sc).length - 1;\n sc = sc.parentNode;\n }\n if (dom.isBR(ec)) {\n eo = dom.listPrev(ec).length - 1;\n ec = ec.parentNode;\n } else if (dom.isVoid(ec)) {\n eo = dom.listPrev(ec).length;\n ec = ec.parentNode;\n }\n\n return this.create(sc, so, ec, eo);\n },\n\n /**\n * create WrappedRange from node after position\n *\n * @param {Node} node\n * @return {WrappedRange}\n */\n createFromNodeBefore: function(node) {\n return this.createFromNode(node).collapse(true);\n },\n\n /**\n * create WrappedRange from node after position\n *\n * @param {Node} node\n * @return {WrappedRange}\n */\n createFromNodeAfter: function(node) {\n return this.createFromNode(node).collapse();\n },\n\n /**\n * @method\n *\n * create WrappedRange from bookmark\n *\n * @param {Node} editable\n * @param {Object} bookmark\n * @return {WrappedRange}\n */\n createFromBookmark: function(editable, bookmark) {\n const sc = dom.fromOffsetPath(editable, bookmark.s.path);\n const so = bookmark.s.offset;\n const ec = dom.fromOffsetPath(editable, bookmark.e.path);\n const eo = bookmark.e.offset;\n return new WrappedRange(sc, so, ec, eo);\n },\n\n /**\n * @method\n *\n * create WrappedRange from paraBookmark\n *\n * @param {Object} bookmark\n * @param {Node[]} paras\n * @return {WrappedRange}\n */\n createFromParaBookmark: function(bookmark, paras) {\n const so = bookmark.s.offset;\n const eo = bookmark.e.offset;\n const sc = dom.fromOffsetPath(lists.head(paras), bookmark.s.path);\n const ec = dom.fromOffsetPath(lists.last(paras), bookmark.e.path);\n\n return new WrappedRange(sc, so, ec, eo);\n },\n};\n","import lists from './lists';\nimport func from './func';\n\nconst KEY_MAP = {\n 'BACKSPACE': 8,\n 'TAB': 9,\n 'ENTER': 13,\n 'ESCAPE': 27,\n 'SPACE': 32,\n 'DELETE': 46,\n\n // Arrow\n 'LEFT': 37,\n 'UP': 38,\n 'RIGHT': 39,\n 'DOWN': 40,\n\n // Number: 0-9\n 'NUM0': 48,\n 'NUM1': 49,\n 'NUM2': 50,\n 'NUM3': 51,\n 'NUM4': 52,\n 'NUM5': 53,\n 'NUM6': 54,\n 'NUM7': 55,\n 'NUM8': 56,\n\n // Alphabet: a-z\n 'B': 66,\n 'E': 69,\n 'I': 73,\n 'J': 74,\n 'K': 75,\n 'L': 76,\n 'R': 82,\n 'S': 83,\n 'U': 85,\n 'V': 86,\n 'Y': 89,\n 'Z': 90,\n\n 'SLASH': 191,\n 'LEFTBRACKET': 219,\n 'BACKSLASH': 220,\n 'RIGHTBRACKET': 221,\n\n // Navigation\n 'HOME': 36,\n 'END': 35,\n 'PAGEUP': 33,\n 'PAGEDOWN': 34,\n};\n\n/**\n * @class core.key\n *\n * Object for keycodes.\n *\n * @singleton\n * @alternateClassName key\n */\nexport default {\n /**\n * @method isEdit\n *\n * @param {Number} keyCode\n * @return {Boolean}\n */\n isEdit: (keyCode) => {\n return lists.contains([\n KEY_MAP.BACKSPACE,\n KEY_MAP.TAB,\n KEY_MAP.ENTER,\n KEY_MAP.SPACE,\n KEY_MAP.DELETE,\n ], keyCode);\n },\n /**\n * @method isRemove\n *\n * @param {Number} keyCode\n * @return {Boolean}\n */\n isRemove: (keyCode) => { // LB\n return lists.contains([\n KEY_MAP.BACKSPACE,\n KEY_MAP.DELETE,\n ], keyCode);\n },\n /**\n * @method isMove\n *\n * @param {Number} keyCode\n * @return {Boolean}\n */\n isMove: (keyCode) => {\n return lists.contains([\n KEY_MAP.LEFT,\n KEY_MAP.UP,\n KEY_MAP.RIGHT,\n KEY_MAP.DOWN,\n ], keyCode);\n },\n /**\n * @method isNavigation\n *\n * @param {Number} keyCode\n * @return {Boolean}\n */\n isNavigation: (keyCode) => {\n return lists.contains([\n KEY_MAP.HOME,\n KEY_MAP.END,\n KEY_MAP.PAGEUP,\n KEY_MAP.PAGEDOWN,\n ], keyCode);\n },\n /**\n * @property {Object} nameFromCode\n * @property {String} nameFromCode.8 \"BACKSPACE\"\n */\n nameFromCode: func.invertObject(KEY_MAP),\n code: KEY_MAP,\n};\n","import $ from 'jquery';\n\n/**\n * @method readFileAsDataURL\n *\n * read contents of file as representing URL\n *\n * @param {File} file\n * @return {Promise} - then: dataUrl\n */\nexport function readFileAsDataURL(file) {\n return $.Deferred((deferred) => {\n $.extend(new FileReader(), {\n onload: (event) => {\n const dataURL = event.target.result;\n deferred.resolve(dataURL);\n },\n onerror: (err) => {\n deferred.reject(err);\n },\n }).readAsDataURL(file);\n }).promise();\n}\n\n/**\n * @method createImage\n *\n * create `<image>` from url string\n *\n * @param {String} url\n * @return {Promise} - then: $image\n */\nexport function createImage(url) {\n return $.Deferred((deferred) => {\n const $img = $('<img>');\n\n $img.one('load', () => {\n $img.off('error abort');\n deferred.resolve($img);\n }).one('error abort', () => {\n $img.off('load').detach();\n deferred.reject($img);\n }).css({\n display: 'none',\n }).appendTo(document.body).attr('src', url);\n }).promise();\n}\n","import range from '../core/range';\n\nexport default class History {\n constructor(context) {\n this.stack = [];\n this.stackOffset = -1;\n this.context = context;\n this.$editable = context.layoutInfo.editable;\n this.editable = this.$editable[0];\n }\n\n makeSnapshot() {\n const rng = range.create(this.editable);\n const emptyBookmark = { s: { path: [], offset: 0 }, e: { path: [], offset: 0 } };\n\n return {\n contents: this.$editable.html(),\n bookmark: ((rng && rng.isOnEditable()) ? rng.bookmark(this.editable) : emptyBookmark),\n };\n }\n\n applySnapshot(snapshot) {\n if (snapshot.contents !== null) {\n this.$editable.html(snapshot.contents);\n }\n if (snapshot.bookmark !== null) {\n range.createFromBookmark(this.editable, snapshot.bookmark).select();\n }\n }\n\n /**\n * @method rewind\n * Rewinds the history stack back to the first snapshot taken.\n * Leaves the stack intact, so that \"Redo\" can still be used.\n */\n rewind() {\n // Create snap shot if not yet recorded\n if (this.$editable.html() !== this.stack[this.stackOffset].contents) {\n this.recordUndo();\n }\n\n // Return to the first available snapshot.\n this.stackOffset = 0;\n\n // Apply that snapshot.\n this.applySnapshot(this.stack[this.stackOffset]);\n }\n\n /**\n * @method commit\n * Resets history stack, but keeps current editor's content.\n */\n commit() {\n // Clear the stack.\n this.stack = [];\n\n // Restore stackOffset to its original value.\n this.stackOffset = -1;\n\n // Record our first snapshot (of nothing).\n this.recordUndo();\n }\n\n /**\n * @method reset\n * Resets the history stack completely; reverting to an empty editor.\n */\n reset() {\n // Clear the stack.\n this.stack = [];\n\n // Restore stackOffset to its original value.\n this.stackOffset = -1;\n\n // Clear the editable area.\n this.$editable.html('');\n\n // Record our first snapshot (of nothing).\n this.recordUndo();\n }\n\n /**\n * undo\n */\n undo() {\n // Create snap shot if not yet recorded\n if (this.$editable.html() !== this.stack[this.stackOffset].contents) {\n this.recordUndo();\n }\n\n if (this.stackOffset > 0) {\n this.stackOffset--;\n this.applySnapshot(this.stack[this.stackOffset]);\n }\n }\n\n /**\n * redo\n */\n redo() {\n if (this.stack.length - 1 > this.stackOffset) {\n this.stackOffset++;\n this.applySnapshot(this.stack[this.stackOffset]);\n }\n }\n\n /**\n * recorded undo\n */\n recordUndo() {\n this.stackOffset++;\n\n // Wash out stack after stackOffset\n if (this.stack.length > this.stackOffset) {\n this.stack = this.stack.slice(0, this.stackOffset);\n }\n\n // Create new snapshot and push it to the end\n this.stack.push(this.makeSnapshot());\n\n // If the stack size reachs to the limit, then slice it\n if (this.stack.length > this.context.options.historyLimit) {\n this.stack.shift();\n this.stackOffset -= 1;\n }\n }\n}\n","import $ from 'jquery';\nimport func from '../core/func';\nimport lists from '../core/lists';\nimport dom from '../core/dom';\n\nexport default class Style {\n /**\n * @method jQueryCSS\n *\n * [workaround] for old jQuery\n * passing an array of style properties to .css()\n * will result in an object of property-value pairs.\n * (compability with version < 1.9)\n *\n * @private\n * @param {jQuery} $obj\n * @param {Array} propertyNames - An array of one or more CSS properties.\n * @return {Object}\n */\n jQueryCSS($obj, propertyNames) {\n const result = {};\n $.each(propertyNames, (idx, propertyName) => {\n result[propertyName] = $obj.css(propertyName);\n });\n return result;\n }\n\n /**\n * returns style object from node\n *\n * @param {jQuery} $node\n * @return {Object}\n */\n fromNode($node) {\n const properties = ['font-family', 'font-size', 'text-align', 'list-style-type', 'line-height'];\n const styleInfo = this.jQueryCSS($node, properties) || {};\n\n const fontSize = $node[0].style.fontSize || styleInfo['font-size'];\n\n styleInfo['font-size'] = parseInt(fontSize, 10);\n styleInfo['font-size-unit'] = fontSize.match(/[a-z%]+$/);\n\n return styleInfo;\n }\n\n /**\n * paragraph level style\n *\n * @param {WrappedRange} rng\n * @param {Object} styleInfo\n */\n stylePara(rng, styleInfo) {\n $.each(rng.nodes(dom.isPara, {\n includeAncestor: true,\n }), (idx, para) => {\n $(para).css(styleInfo);\n });\n }\n\n /**\n * insert and returns styleNodes on range.\n *\n * @param {WrappedRange} rng\n * @param {Object} [options] - options for styleNodes\n * @param {String} [options.nodeName] - default: `SPAN`\n * @param {Boolean} [options.expandClosestSibling] - default: `false`\n * @param {Boolean} [options.onlyPartialContains] - default: `false`\n * @return {Node[]}\n */\n styleNodes(rng, options) {\n rng = rng.splitText();\n\n const nodeName = (options && options.nodeName) || 'SPAN';\n const expandClosestSibling = !!(options && options.expandClosestSibling);\n const onlyPartialContains = !!(options && options.onlyPartialContains);\n\n if (rng.isCollapsed()) {\n return [rng.insertNode(dom.create(nodeName))];\n }\n\n let pred = dom.makePredByNodeName(nodeName);\n const nodes = rng.nodes(dom.isText, {\n fullyContains: true,\n }).map((text) => {\n return dom.singleChildAncestor(text, pred) || dom.wrap(text, nodeName);\n });\n\n if (expandClosestSibling) {\n if (onlyPartialContains) {\n const nodesInRange = rng.nodes();\n // compose with partial contains predication\n pred = func.and(pred, (node) => {\n return lists.contains(nodesInRange, node);\n });\n }\n\n return nodes.map((node) => {\n const siblings = dom.withClosestSiblings(node, pred);\n const head = lists.head(siblings);\n const tails = lists.tail(siblings);\n $.each(tails, (idx, elem) => {\n dom.appendChildNodes(head, elem.childNodes);\n dom.remove(elem);\n });\n return lists.head(siblings);\n });\n } else {\n return nodes;\n }\n }\n\n /**\n * get current style on cursor\n *\n * @param {WrappedRange} rng\n * @return {Object} - object contains style properties.\n */\n current(rng) {\n const $cont = $(!dom.isElement(rng.sc) ? rng.sc.parentNode : rng.sc);\n let styleInfo = this.fromNode($cont);\n\n // document.queryCommandState for toggle state\n // [workaround] prevent Firefox nsresult: \"0x80004005 (NS_ERROR_FAILURE)\"\n try {\n styleInfo = $.extend(styleInfo, {\n 'font-bold': document.queryCommandState('bold') ? 'bold' : 'normal',\n 'font-italic': document.queryCommandState('italic') ? 'italic' : 'normal',\n 'font-underline': document.queryCommandState('underline') ? 'underline' : 'normal',\n 'font-subscript': document.queryCommandState('subscript') ? 'subscript' : 'normal',\n 'font-superscript': document.queryCommandState('superscript') ? 'superscript' : 'normal',\n 'font-strikethrough': document.queryCommandState('strikethrough') ? 'strikethrough' : 'normal',\n 'font-family': document.queryCommandValue('fontname') || styleInfo['font-family'],\n });\n } catch (e) {\n // eslint-disable-next-line\n }\n\n // list-style-type to list-style(unordered, ordered)\n if (!rng.isOnList()) {\n styleInfo['list-style'] = 'none';\n } else {\n const orderedTypes = ['circle', 'disc', 'disc-leading-zero', 'square'];\n const isUnordered = orderedTypes.indexOf(styleInfo['list-style-type']) > -1;\n styleInfo['list-style'] = isUnordered ? 'unordered' : 'ordered';\n }\n\n const para = dom.ancestor(rng.sc, dom.isPara);\n if (para && para.style['line-height']) {\n styleInfo['line-height'] = para.style.lineHeight;\n } else {\n const lineHeight = parseInt(styleInfo['line-height'], 10) / parseInt(styleInfo['font-size'], 10);\n styleInfo['line-height'] = lineHeight.toFixed(1);\n }\n\n styleInfo.anchor = rng.isOnAnchor() && dom.ancestor(rng.sc, dom.isAnchor);\n styleInfo.ancestors = dom.listAncestor(rng.sc, dom.isEditable);\n styleInfo.range = rng;\n\n return styleInfo;\n }\n}\n","import $ from 'jquery';\nimport lists from '../core/lists';\nimport func from '../core/func';\nimport dom from '../core/dom';\nimport range from '../core/range';\n\nexport default class Bullet {\n /**\n * toggle ordered list\n */\n insertOrderedList(editable) {\n this.toggleList('OL', editable);\n }\n\n /**\n * toggle unordered list\n */\n insertUnorderedList(editable) {\n this.toggleList('UL', editable);\n }\n\n /**\n * indent\n */\n indent(editable) {\n const rng = range.create(editable).wrapBodyInlineWithPara();\n \n const paras = rng.nodes(dom.isPara, { includeAncestor: true });\n const clustereds = lists.clusterBy(paras, func.peq2('parentNode'));\n\n $.each(clustereds, (idx, paras) => {\n const head = lists.head(paras);\n if (dom.isLi(head)) {\n const previousList = this.findList(head.previousElementSibling);\n if (previousList) {\n paras\n .map(para => previousList.appendChild(para));\n } else {\n this.wrapList(paras, head.parentNode.nodeName);\n \n // move ul element to parent li element\n paras\n .map((para) => para.parentNode)\n // distinct\n .filter(function(elem, index, self) {\treturn index === self.indexOf(elem); })\n .map((para) => this.appendToPrevious(para));\n }\n } else {\n $.each(paras, (idx, para) => {\n $(para).css('marginLeft', (idx, val) => {\n return (parseInt(val, 10) || 0) + 25;\n });\n });\n }\n });\n\n rng.select();\n }\n\n /**\n * outdent\n */\n outdent(editable) {\n const rng = range.create(editable).wrapBodyInlineWithPara();\n\n const paras = rng.nodes(dom.isPara, { includeAncestor: true });\n const clustereds = lists.clusterBy(paras, func.peq2('parentNode'));\n\n $.each(clustereds, (idx, paras) => {\n const head = lists.head(paras);\n if (dom.isLi(head)) {\n this.releaseList([paras]);\n } else {\n $.each(paras, (idx, para) => {\n $(para).css('marginLeft', (idx, val) => {\n val = (parseInt(val, 10) || 0);\n return val > 25 ? val - 25 : '';\n });\n });\n }\n });\n\n rng.select();\n }\n\n /**\n * toggle list\n *\n * @param {String} listName - OL or UL\n */\n toggleList(listName, editable) {\n const rng = range.create(editable).wrapBodyInlineWithPara();\n\n let paras = rng.nodes(dom.isPara, { includeAncestor: true });\n const bookmark = rng.paraBookmark(paras);\n const clustereds = lists.clusterBy(paras, func.peq2('parentNode'));\n\n // paragraph to list\n if (lists.find(paras, dom.isPurePara)) {\n let wrappedParas = [];\n $.each(clustereds, (idx, paras) => {\n wrappedParas = wrappedParas.concat(this.wrapList(paras, listName));\n });\n paras = wrappedParas;\n // list to paragraph or change list style\n } else {\n const diffLists = rng.nodes(dom.isList, {\n includeAncestor: true,\n }).filter((listNode) => {\n return (listNode.nodeName !== listName);\n });\n\n if (diffLists.length) {\n $.each(diffLists, (idx, listNode) => {\n dom.replace(listNode, listName);\n });\n } else {\n paras = this.releaseList(clustereds, true);\n }\n }\n\n range.createFromParaBookmark(bookmark, paras).select();\n }\n\n /**\n * @param {Node[]} paras\n * @param {String} listName\n * @return {Node[]}\n */\n wrapList(paras, listName) {\n const head = lists.head(paras);\n const last = lists.last(paras);\n\n const prevList = dom.isList(head.previousElementSibling) && head.previousElementSibling;\n const nextList = dom.isList(last.nextElementSibling) && last.nextElementSibling;\n\n const listNode = prevList || dom.insertAfter(dom.create(listName || 'UL'), last);\n\n // P to LI\n paras = paras.map((para) => {\n return dom.isPurePara(para) ? dom.replace(para, 'LI') : para;\n });\n\n // append to list(<ul>, <ol>)\n dom.appendChildNodes(listNode, paras);\n\n if (nextList) {\n dom.appendChildNodes(listNode, lists.from(nextList.childNodes));\n dom.remove(nextList);\n }\n\n return paras;\n }\n\n /**\n * @method releaseList\n *\n * @param {Array[]} clustereds\n * @param {Boolean} isEscapseToBody\n * @return {Node[]}\n */\n releaseList(clustereds, isEscapseToBody) {\n let releasedParas = [];\n\n $.each(clustereds, (idx, paras) => {\n const head = lists.head(paras);\n const last = lists.last(paras);\n\n const headList = isEscapseToBody ? dom.lastAncestor(head, dom.isList) : head.parentNode;\n const parentItem = headList.parentNode;\n\n if (headList.parentNode.nodeName === 'LI') {\n paras.map(para => {\n const newList = this.findNextElementSiblings(para);\n\n if (parentItem.nextElementSibling) {\n parentItem.parentNode.insertBefore(\n para,\n parentItem.nextElementSibling\n );\n } else {\n parentItem.parentNode.appendChild(para);\n }\n\n if (newList.length) {\n this.wrapList(newList, headList.nodeName);\n para.appendChild(newList[0].parentNode);\n }\n });\n\n if (headList.children.length === 0) {\n parentItem.removeChild(headList);\n }\n\n // remove left-over ul or ul with only whitespace node\n if (parentItem.childNodes.length === 0 || parentItem.childNodes.length === 1 && parentItem.childNodes[0].textContent.trim() === '') {\n parentItem.parentNode.removeChild(parentItem);\n }\n } else {\n const lastList = headList.childNodes.length > 1 ? dom.splitTree(headList, {\n node: last.parentNode,\n offset: dom.position(last) + 1,\n }, {\n isSkipPaddingBlankHTML: true,\n }) : null;\n\n const middleList = dom.splitTree(headList, {\n node: head.parentNode,\n offset: dom.position(head),\n }, {\n isSkipPaddingBlankHTML: true,\n });\n\n paras = isEscapseToBody ? dom.listDescendant(middleList, dom.isLi)\n : lists.from(middleList.childNodes).filter(dom.isLi);\n\n // LI to P\n if (isEscapseToBody || !dom.isList(headList.parentNode)) {\n paras = paras.map((para) => {\n return dom.replace(para, 'P');\n });\n }\n\n $.each(lists.from(paras).reverse(), (idx, para) => {\n dom.insertAfter(para, headList);\n });\n\n // remove empty lists\n const rootLists = lists.compact([headList, middleList, lastList]);\n $.each(rootLists, (idx, rootList) => {\n const listNodes = [rootList].concat(dom.listDescendant(rootList, dom.isList));\n $.each(listNodes.reverse(), (idx, listNode) => {\n if (!dom.nodeLength(listNode)) {\n dom.remove(listNode, true);\n }\n });\n });\n }\n\n releasedParas = releasedParas.concat(paras);\n });\n\n return releasedParas;\n }\n\n /**\n * @method appendToPrevious\n *\n * Appends list to previous list item, if\n * none exist it wraps the list in a new list item.\n *\n * @param {HTMLNode} ListItem\n * @return {HTMLNode}\n */\n appendToPrevious(node) {\n return node.previousElementSibling\n ? dom.appendChildNodes(node.previousElementSibling, [node])\n : this.wrapList([node], 'LI');\n }\n\n /**\n * @method findList\n *\n * Finds an existing list in list item\n *\n * @param {HTMLNode} ListItem\n * @return {Array[]}\n */\n findList(node) {\n return node\n ? node.children && lists.find(node.children, child => ['OL', 'UL'].indexOf(child.nodeName) > -1)\n : null;\n }\n\n /**\n * @method findNextElementSiblings\n *\n * Finds all list item siblings that follow it\n *\n * @param {HTMLNode} ListItem\n * @return {HTMLNode}\n */\n findNextElementSiblings(node) {\n const siblings = [];\n while (node.nextElementSibling) {\n siblings.push(node.nextElementSibling);\n node = node.nextElementSibling;\n }\n return siblings;\n }\n}\n","import $ from 'jquery';\nimport dom from '../core/dom';\nimport range from '../core/range';\nimport Bullet from '../editing/Bullet';\n\n/**\n * @class editing.Typing\n *\n * Typing\n *\n */\nexport default class Typing {\n constructor(context) {\n // a Bullet instance to toggle lists off\n this.bullet = new Bullet();\n this.options = context.options;\n }\n\n /**\n * insert tab\n *\n * @param {WrappedRange} rng\n * @param {Number} tabsize\n */\n insertTab(rng, tabsize) {\n const tab = dom.createText(new Array(tabsize + 1).join(dom.NBSP_CHAR));\n rng = rng.deleteContents();\n rng.insertNode(tab, true);\n\n rng = range.create(tab, tabsize);\n rng.select();\n }\n\n /**\n * insert paragraph\n *\n * @param {jQuery} $editable\n * @param {WrappedRange} rng Can be used in unit tests to \"mock\" the range\n *\n * blockquoteBreakingLevel\n * 0 - No break, the new paragraph remains inside the quote\n * 1 - Break the first blockquote in the ancestors list\n * 2 - Break all blockquotes, so that the new paragraph is not quoted (this is the default)\n */\n insertParagraph(editable, rng) {\n rng = rng || range.create(editable);\n\n // deleteContents on range.\n rng = rng.deleteContents();\n\n // Wrap range if it needs to be wrapped by paragraph\n rng = rng.wrapBodyInlineWithPara();\n\n // finding paragraph\n const splitRoot = dom.ancestor(rng.sc, dom.isPara);\n\n let nextPara;\n // on paragraph: split paragraph\n if (splitRoot) {\n // if it is an empty line with li\n if (dom.isLi(splitRoot) && (dom.isEmpty(splitRoot) || dom.deepestChildIsEmpty(splitRoot))) {\n // toggle UL/OL and escape\n this.bullet.toggleList(splitRoot.parentNode.nodeName);\n return;\n } else {\n let blockquote = null;\n if (this.options.blockquoteBreakingLevel === 1) {\n blockquote = dom.ancestor(splitRoot, dom.isBlockquote);\n } else if (this.options.blockquoteBreakingLevel === 2) {\n blockquote = dom.lastAncestor(splitRoot, dom.isBlockquote);\n }\n\n if (blockquote) {\n // We're inside a blockquote and options ask us to break it\n nextPara = $(dom.emptyPara)[0];\n // If the split is right before a <br>, remove it so that there's no \"empty line\"\n // after the split in the new blockquote created\n if (dom.isRightEdgePoint(rng.getStartPoint()) && dom.isBR(rng.sc.nextSibling)) {\n $(rng.sc.nextSibling).remove();\n }\n const split = dom.splitTree(blockquote, rng.getStartPoint(), { isDiscardEmptySplits: true });\n if (split) {\n split.parentNode.insertBefore(nextPara, split);\n } else {\n dom.insertAfter(nextPara, blockquote); // There's no split if we were at the end of the blockquote\n }\n } else {\n nextPara = dom.splitTree(splitRoot, rng.getStartPoint());\n\n // not a blockquote, just insert the paragraph\n let emptyAnchors = dom.listDescendant(splitRoot, dom.isEmptyAnchor);\n emptyAnchors = emptyAnchors.concat(dom.listDescendant(nextPara, dom.isEmptyAnchor));\n\n $.each(emptyAnchors, (idx, anchor) => {\n dom.remove(anchor);\n });\n\n // replace empty heading, pre or custom-made styleTag with P tag\n if ((dom.isHeading(nextPara) || dom.isPre(nextPara) || dom.isCustomStyleTag(nextPara)) && dom.isEmpty(nextPara)) {\n nextPara = dom.replace(nextPara, 'p');\n }\n }\n }\n // no paragraph: insert empty paragraph\n } else {\n const next = rng.sc.childNodes[rng.so];\n nextPara = $(dom.emptyPara)[0];\n if (next) {\n rng.sc.insertBefore(nextPara, next);\n } else {\n rng.sc.appendChild(nextPara);\n }\n }\n\n range.create(nextPara, 0).normalize().select().scrollIntoView(editable);\n }\n}\n","import $ from 'jquery';\nimport dom from '../core/dom';\nimport range from '../core/range';\nimport lists from '../core/lists';\n\n/**\n * @class Create a virtual table to create what actions to do in change.\n * @param {object} startPoint Cell selected to apply change.\n * @param {enum} where Where change will be applied Row or Col. Use enum: TableResultAction.where\n * @param {enum} action Action to be applied. Use enum: TableResultAction.requestAction\n * @param {object} domTable Dom element of table to make changes.\n */\nconst TableResultAction = function(startPoint, where, action, domTable) {\n const _startPoint = { 'colPos': 0, 'rowPos': 0 };\n const _virtualTable = [];\n const _actionCellList = [];\n\n /// ///////////////////////////////////////////\n // Private functions\n /// ///////////////////////////////////////////\n\n /**\n * Set the startPoint of action.\n */\n function setStartPoint() {\n if (!startPoint || !startPoint.tagName || (startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th')) {\n // Impossible to identify start Cell point\n return;\n }\n _startPoint.colPos = startPoint.cellIndex;\n if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {\n // Impossible to identify start Row point\n return;\n }\n _startPoint.rowPos = startPoint.parentElement.rowIndex;\n }\n\n /**\n * Define virtual table position info object.\n *\n * @param {int} rowIndex Index position in line of virtual table.\n * @param {int} cellIndex Index position in column of virtual table.\n * @param {object} baseRow Row affected by this position.\n * @param {object} baseCell Cell affected by this position.\n * @param {bool} isSpan Inform if it is an span cell/row.\n */\n function setVirtualTablePosition(rowIndex, cellIndex, baseRow, baseCell, isRowSpan, isColSpan, isVirtualCell) {\n const objPosition = {\n 'baseRow': baseRow,\n 'baseCell': baseCell,\n 'isRowSpan': isRowSpan,\n 'isColSpan': isColSpan,\n 'isVirtual': isVirtualCell,\n };\n if (!_virtualTable[rowIndex]) {\n _virtualTable[rowIndex] = [];\n }\n _virtualTable[rowIndex][cellIndex] = objPosition;\n }\n\n /**\n * Create action cell object.\n *\n * @param {object} virtualTableCellObj Object of specific position on virtual table.\n * @param {enum} resultAction Action to be applied in that item.\n */\n function getActionCell(virtualTableCellObj, resultAction, virtualRowPosition, virtualColPosition) {\n return {\n 'baseCell': virtualTableCellObj.baseCell,\n 'action': resultAction,\n 'virtualTable': {\n 'rowIndex': virtualRowPosition,\n 'cellIndex': virtualColPosition,\n },\n };\n }\n\n /**\n * Recover free index of row to append Cell.\n *\n * @param {int} rowIndex Index of row to find free space.\n * @param {int} cellIndex Index of cell to find free space in table.\n */\n function recoverCellIndex(rowIndex, cellIndex) {\n if (!_virtualTable[rowIndex]) {\n return cellIndex;\n }\n if (!_virtualTable[rowIndex][cellIndex]) {\n return cellIndex;\n }\n\n let newCellIndex = cellIndex;\n while (_virtualTable[rowIndex][newCellIndex]) {\n newCellIndex++;\n if (!_virtualTable[rowIndex][newCellIndex]) {\n return newCellIndex;\n }\n }\n }\n\n /**\n * Recover info about row and cell and add information to virtual table.\n *\n * @param {object} row Row to recover information.\n * @param {object} cell Cell to recover information.\n */\n function addCellInfoToVirtual(row, cell) {\n const cellIndex = recoverCellIndex(row.rowIndex, cell.cellIndex);\n const cellHasColspan = (cell.colSpan > 1);\n const cellHasRowspan = (cell.rowSpan > 1);\n const isThisSelectedCell = (row.rowIndex === _startPoint.rowPos && cell.cellIndex === _startPoint.colPos);\n setVirtualTablePosition(row.rowIndex, cellIndex, row, cell, cellHasRowspan, cellHasColspan, false);\n\n // Add span rows to virtual Table.\n const rowspanNumber = cell.attributes.rowSpan ? parseInt(cell.attributes.rowSpan.value, 10) : 0;\n if (rowspanNumber > 1) {\n for (let rp = 1; rp < rowspanNumber; rp++) {\n const rowspanIndex = row.rowIndex + rp;\n adjustStartPoint(rowspanIndex, cellIndex, cell, isThisSelectedCell);\n setVirtualTablePosition(rowspanIndex, cellIndex, row, cell, true, cellHasColspan, true);\n }\n }\n\n // Add span cols to virtual table.\n const colspanNumber = cell.attributes.colSpan ? parseInt(cell.attributes.colSpan.value, 10) : 0;\n if (colspanNumber > 1) {\n for (let cp = 1; cp < colspanNumber; cp++) {\n const cellspanIndex = recoverCellIndex(row.rowIndex, (cellIndex + cp));\n adjustStartPoint(row.rowIndex, cellspanIndex, cell, isThisSelectedCell);\n setVirtualTablePosition(row.rowIndex, cellspanIndex, row, cell, cellHasRowspan, true, true);\n }\n }\n }\n\n /**\n * Process validation and adjust of start point if needed\n *\n * @param {int} rowIndex\n * @param {int} cellIndex\n * @param {object} cell\n * @param {bool} isSelectedCell\n */\n function adjustStartPoint(rowIndex, cellIndex, cell, isSelectedCell) {\n if (rowIndex === _startPoint.rowPos && _startPoint.colPos >= cell.cellIndex && cell.cellIndex <= cellIndex && !isSelectedCell) {\n _startPoint.colPos++;\n }\n }\n\n /**\n * Create virtual table of cells with all cells, including span cells.\n */\n function createVirtualTable() {\n const rows = domTable.rows;\n for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {\n const cells = rows[rowIndex].cells;\n for (let cellIndex = 0; cellIndex < cells.length; cellIndex++) {\n addCellInfoToVirtual(rows[rowIndex], cells[cellIndex]);\n }\n }\n }\n\n /**\n * Get action to be applied on the cell.\n *\n * @param {object} cell virtual table cell to apply action\n */\n function getDeleteResultActionToCell(cell) {\n switch (where) {\n case TableResultAction.where.Column:\n if (cell.isColSpan) {\n return TableResultAction.resultAction.SubtractSpanCount;\n }\n break;\n case TableResultAction.where.Row:\n if (!cell.isVirtual && cell.isRowSpan) {\n return TableResultAction.resultAction.AddCell;\n } else if (cell.isRowSpan) {\n return TableResultAction.resultAction.SubtractSpanCount;\n }\n break;\n }\n return TableResultAction.resultAction.RemoveCell;\n }\n\n /**\n * Get action to be applied on the cell.\n *\n * @param {object} cell virtual table cell to apply action\n */\n function getAddResultActionToCell(cell) {\n switch (where) {\n case TableResultAction.where.Column:\n if (cell.isColSpan) {\n return TableResultAction.resultAction.SumSpanCount;\n } else if (cell.isRowSpan && cell.isVirtual) {\n return TableResultAction.resultAction.Ignore;\n }\n break;\n case TableResultAction.where.Row:\n if (cell.isRowSpan) {\n return TableResultAction.resultAction.SumSpanCount;\n } else if (cell.isColSpan && cell.isVirtual) {\n return TableResultAction.resultAction.Ignore;\n }\n break;\n }\n return TableResultAction.resultAction.AddCell;\n }\n\n function init() {\n setStartPoint();\n createVirtualTable();\n }\n\n /// ///////////////////////////////////////////\n // Public functions\n /// ///////////////////////////////////////////\n\n /**\n * Recover array os what to do in table.\n */\n this.getActionList = function() {\n const fixedRow = (where === TableResultAction.where.Row) ? _startPoint.rowPos : -1;\n const fixedCol = (where === TableResultAction.where.Column) ? _startPoint.colPos : -1;\n\n let actualPosition = 0;\n let canContinue = true;\n while (canContinue) {\n const rowPosition = (fixedRow >= 0) ? fixedRow : actualPosition;\n const colPosition = (fixedCol >= 0) ? fixedCol : actualPosition;\n const row = _virtualTable[rowPosition];\n if (!row) {\n canContinue = false;\n return _actionCellList;\n }\n const cell = row[colPosition];\n if (!cell) {\n canContinue = false;\n return _actionCellList;\n }\n\n // Define action to be applied in this cell\n let resultAction = TableResultAction.resultAction.Ignore;\n switch (action) {\n case TableResultAction.requestAction.Add:\n resultAction = getAddResultActionToCell(cell);\n break;\n case TableResultAction.requestAction.Delete:\n resultAction = getDeleteResultActionToCell(cell);\n break;\n }\n _actionCellList.push(getActionCell(cell, resultAction, rowPosition, colPosition));\n actualPosition++;\n }\n\n return _actionCellList;\n };\n\n init();\n};\n/**\n*\n* Where action occours enum.\n*/\nTableResultAction.where = { 'Row': 0, 'Column': 1 };\n/**\n*\n* Requested action to apply enum.\n*/\nTableResultAction.requestAction = { 'Add': 0, 'Delete': 1 };\n/**\n*\n* Result action to be executed enum.\n*/\nTableResultAction.resultAction = { 'Ignore': 0, 'SubtractSpanCount': 1, 'RemoveCell': 2, 'AddCell': 3, 'SumSpanCount': 4 };\n\n/**\n *\n * @class editing.Table\n *\n * Table\n *\n */\nexport default class Table {\n /**\n * handle tab key\n *\n * @param {WrappedRange} rng\n * @param {Boolean} isShift\n */\n tab(rng, isShift) {\n const cell = dom.ancestor(rng.commonAncestor(), dom.isCell);\n const table = dom.ancestor(cell, dom.isTable);\n const cells = dom.listDescendant(table, dom.isCell);\n\n const nextCell = lists[isShift ? 'prev' : 'next'](cells, cell);\n if (nextCell) {\n range.create(nextCell, 0).select();\n }\n }\n\n /**\n * Add a new row\n *\n * @param {WrappedRange} rng\n * @param {String} position (top/bottom)\n * @return {Node}\n */\n addRow(rng, position) {\n const cell = dom.ancestor(rng.commonAncestor(), dom.isCell);\n\n const currentTr = $(cell).closest('tr');\n const trAttributes = this.recoverAttributes(currentTr);\n const html = $('<tr' + trAttributes + '></tr>');\n\n const vTable = new TableResultAction(cell, TableResultAction.where.Row,\n TableResultAction.requestAction.Add, $(currentTr).closest('table')[0]);\n const actions = vTable.getActionList();\n\n for (let idCell = 0; idCell < actions.length; idCell++) {\n const currentCell = actions[idCell];\n const tdAttributes = this.recoverAttributes(currentCell.baseCell);\n switch (currentCell.action) {\n case TableResultAction.resultAction.AddCell:\n html.append('<td' + tdAttributes + '>' + dom.blank + '</td>');\n break;\n case TableResultAction.resultAction.SumSpanCount:\n {\n if (position === 'top') {\n const baseCellTr = currentCell.baseCell.parent;\n const isTopFromRowSpan = (!baseCellTr ? 0 : currentCell.baseCell.closest('tr').rowIndex) <= currentTr[0].rowIndex;\n if (isTopFromRowSpan) {\n const newTd = $('<div></div>').append($('<td' + tdAttributes + '>' + dom.blank + '</td>').removeAttr('rowspan')).html();\n html.append(newTd);\n break;\n }\n }\n let rowspanNumber = parseInt(currentCell.baseCell.rowSpan, 10);\n rowspanNumber++;\n currentCell.baseCell.setAttribute('rowSpan', rowspanNumber);\n }\n break;\n }\n }\n\n if (position === 'top') {\n currentTr.before(html);\n } else {\n const cellHasRowspan = (cell.rowSpan > 1);\n if (cellHasRowspan) {\n const lastTrIndex = currentTr[0].rowIndex + (cell.rowSpan - 2);\n $($(currentTr).parent().find('tr')[lastTrIndex]).after($(html));\n return;\n }\n currentTr.after(html);\n }\n }\n\n /**\n * Add a new col\n *\n * @param {WrappedRange} rng\n * @param {String} position (left/right)\n * @return {Node}\n */\n addCol(rng, position) {\n const cell = dom.ancestor(rng.commonAncestor(), dom.isCell);\n const row = $(cell).closest('tr');\n const rowsGroup = $(row).siblings();\n rowsGroup.push(row);\n\n const vTable = new TableResultAction(cell, TableResultAction.where.Column,\n TableResultAction.requestAction.Add, $(row).closest('table')[0]);\n const actions = vTable.getActionList();\n\n for (let actionIndex = 0; actionIndex < actions.length; actionIndex++) {\n const currentCell = actions[actionIndex];\n const tdAttributes = this.recoverAttributes(currentCell.baseCell);\n switch (currentCell.action) {\n case TableResultAction.resultAction.AddCell:\n if (position === 'right') {\n $(currentCell.baseCell).after('<td' + tdAttributes + '>' + dom.blank + '</td>');\n } else {\n $(currentCell.baseCell).before('<td' + tdAttributes + '>' + dom.blank + '</td>');\n }\n break;\n case TableResultAction.resultAction.SumSpanCount:\n if (position === 'right') {\n let colspanNumber = parseInt(currentCell.baseCell.colSpan, 10);\n colspanNumber++;\n currentCell.baseCell.setAttribute('colSpan', colspanNumber);\n } else {\n $(currentCell.baseCell).before('<td' + tdAttributes + '>' + dom.blank + '</td>');\n }\n break;\n }\n }\n }\n\n /*\n * Copy attributes from element.\n *\n * @param {object} Element to recover attributes.\n * @return {string} Copied string elements.\n */\n recoverAttributes(el) {\n let resultStr = '';\n\n if (!el) {\n return resultStr;\n }\n\n const attrList = el.attributes || [];\n\n for (let i = 0; i < attrList.length; i++) {\n if (attrList[i].name.toLowerCase() === 'id') {\n continue;\n }\n\n if (attrList[i].specified) {\n resultStr += ' ' + attrList[i].name + '=\\'' + attrList[i].value + '\\'';\n }\n }\n\n return resultStr;\n }\n\n /**\n * Delete current row\n *\n * @param {WrappedRange} rng\n * @return {Node}\n */\n deleteRow(rng) {\n const cell = dom.ancestor(rng.commonAncestor(), dom.isCell);\n const row = $(cell).closest('tr');\n const cellPos = row.children('td, th').index($(cell));\n const rowPos = row[0].rowIndex;\n\n const vTable = new TableResultAction(cell, TableResultAction.where.Row,\n TableResultAction.requestAction.Delete, $(row).closest('table')[0]);\n const actions = vTable.getActionList();\n\n for (let actionIndex = 0; actionIndex < actions.length; actionIndex++) {\n if (!actions[actionIndex]) {\n continue;\n }\n\n const baseCell = actions[actionIndex].baseCell;\n const virtualPosition = actions[actionIndex].virtualTable;\n const hasRowspan = (baseCell.rowSpan && baseCell.rowSpan > 1);\n let rowspanNumber = (hasRowspan) ? parseInt(baseCell.rowSpan, 10) : 0;\n switch (actions[actionIndex].action) {\n case TableResultAction.resultAction.Ignore:\n continue;\n case TableResultAction.resultAction.AddCell:\n {\n const nextRow = row.next('tr')[0];\n if (!nextRow) { continue; }\n const cloneRow = row[0].cells[cellPos];\n if (hasRowspan) {\n if (rowspanNumber > 2) {\n rowspanNumber--;\n nextRow.insertBefore(cloneRow, nextRow.cells[cellPos]);\n nextRow.cells[cellPos].setAttribute('rowSpan', rowspanNumber);\n nextRow.cells[cellPos].innerHTML = '';\n } else if (rowspanNumber === 2) {\n nextRow.insertBefore(cloneRow, nextRow.cells[cellPos]);\n nextRow.cells[cellPos].removeAttribute('rowSpan');\n nextRow.cells[cellPos].innerHTML = '';\n }\n }\n }\n continue;\n case TableResultAction.resultAction.SubtractSpanCount:\n if (hasRowspan) {\n if (rowspanNumber > 2) {\n rowspanNumber--;\n baseCell.setAttribute('rowSpan', rowspanNumber);\n if (virtualPosition.rowIndex !== rowPos && baseCell.cellIndex === cellPos) { baseCell.innerHTML = ''; }\n } else if (rowspanNumber === 2) {\n baseCell.removeAttribute('rowSpan');\n if (virtualPosition.rowIndex !== rowPos && baseCell.cellIndex === cellPos) { baseCell.innerHTML = ''; }\n }\n }\n continue;\n case TableResultAction.resultAction.RemoveCell:\n // Do not need remove cell because row will be deleted.\n continue;\n }\n }\n row.remove();\n }\n\n /**\n * Delete current col\n *\n * @param {WrappedRange} rng\n * @return {Node}\n */\n deleteCol(rng) {\n const cell = dom.ancestor(rng.commonAncestor(), dom.isCell);\n const row = $(cell).closest('tr');\n const cellPos = row.children('td, th').index($(cell));\n\n const vTable = new TableResultAction(cell, TableResultAction.where.Column,\n TableResultAction.requestAction.Delete, $(row).closest('table')[0]);\n const actions = vTable.getActionList();\n\n for (let actionIndex = 0; actionIndex < actions.length; actionIndex++) {\n if (!actions[actionIndex]) {\n continue;\n }\n switch (actions[actionIndex].action) {\n case TableResultAction.resultAction.Ignore:\n continue;\n case TableResultAction.resultAction.SubtractSpanCount:\n {\n const baseCell = actions[actionIndex].baseCell;\n const hasColspan = (baseCell.colSpan && baseCell.colSpan > 1);\n if (hasColspan) {\n let colspanNumber = (baseCell.colSpan) ? parseInt(baseCell.colSpan, 10) : 0;\n if (colspanNumber > 2) {\n colspanNumber--;\n baseCell.setAttribute('colSpan', colspanNumber);\n if (baseCell.cellIndex === cellPos) { baseCell.innerHTML = ''; }\n } else if (colspanNumber === 2) {\n baseCell.removeAttribute('colSpan');\n if (baseCell.cellIndex === cellPos) { baseCell.innerHTML = ''; }\n }\n }\n }\n continue;\n case TableResultAction.resultAction.RemoveCell:\n dom.remove(actions[actionIndex].baseCell, true);\n continue;\n }\n }\n }\n\n /**\n * create empty table element\n *\n * @param {Number} rowCount\n * @param {Number} colCount\n * @return {Node}\n */\n createTable(colCount, rowCount, options) {\n const tds = [];\n let tdHTML;\n for (let idxCol = 0; idxCol < colCount; idxCol++) {\n tds.push('<td>' + dom.blank + '</td>');\n }\n tdHTML = tds.join('');\n\n const trs = [];\n let trHTML;\n for (let idxRow = 0; idxRow < rowCount; idxRow++) {\n trs.push('<tr>' + tdHTML + '</tr>');\n }\n trHTML = trs.join('');\n const $table = $('<table>' + trHTML + '</table>');\n if (options && options.tableClassName) {\n $table.addClass(options.tableClassName);\n }\n\n return $table[0];\n }\n\n /**\n * Delete current table\n *\n * @param {WrappedRange} rng\n * @return {Node}\n */\n deleteTable(rng) {\n const cell = dom.ancestor(rng.commonAncestor(), dom.isCell);\n $(cell).closest('table').remove();\n }\n}\n","import $ from 'jquery';\nimport env from '../core/env';\nimport key from '../core/key';\nimport func from '../core/func';\nimport lists from '../core/lists';\nimport dom from '../core/dom';\nimport range from '../core/range';\nimport { readFileAsDataURL, createImage } from '../core/async';\nimport History from '../editing/History';\nimport Style from '../editing/Style';\nimport Typing from '../editing/Typing';\nimport Table from '../editing/Table';\nimport Bullet from '../editing/Bullet';\n\nconst KEY_BOGUS = 'bogus';\nconst MAILTO_PATTERN = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/;\nconst TEL_PATTERN = /^(\\+?\\d{1,3}[\\s-]?)?(\\d{1,4})[\\s-]?(\\d{1,4})[\\s-]?(\\d{1,4})$/;\nconst URL_SCHEME_PATTERN = /^([A-Za-z][A-Za-z0-9+-.]*\\:|#|\\/)/;\n\n/**\n * @class Editor\n */\nexport default class Editor {\n constructor(context) {\n this.context = context;\n\n this.$note = context.layoutInfo.note;\n this.$editor = context.layoutInfo.editor;\n this.$editable = context.layoutInfo.editable;\n this.options = context.options;\n this.lang = this.options.langInfo;\n\n this.editable = this.$editable[0];\n this.lastRange = null;\n this.snapshot = null;\n\n this.style = new Style();\n this.table = new Table();\n this.typing = new Typing(context);\n this.bullet = new Bullet();\n this.history = new History(context);\n\n this.context.memo('help.escape', this.lang.help.escape);\n this.context.memo('help.undo', this.lang.help.undo);\n this.context.memo('help.redo', this.lang.help.redo);\n this.context.memo('help.tab', this.lang.help.tab);\n this.context.memo('help.untab', this.lang.help.untab);\n this.context.memo('help.insertParagraph', this.lang.help.insertParagraph);\n this.context.memo('help.insertOrderedList', this.lang.help.insertOrderedList);\n this.context.memo('help.insertUnorderedList', this.lang.help.insertUnorderedList);\n this.context.memo('help.indent', this.lang.help.indent);\n this.context.memo('help.outdent', this.lang.help.outdent);\n this.context.memo('help.formatPara', this.lang.help.formatPara);\n this.context.memo('help.insertHorizontalRule', this.lang.help.insertHorizontalRule);\n this.context.memo('help.fontName', this.lang.help.fontName);\n\n // native commands(with execCommand), generate function for execCommand\n const commands = [\n 'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript',\n 'justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull',\n 'formatBlock', 'removeFormat', 'backColor',\n ];\n\n for (let idx = 0, len = commands.length; idx < len; idx++) {\n this[commands[idx]] = ((sCmd) => {\n return (value) => {\n this.beforeCommand();\n document.execCommand(sCmd, false, value);\n this.afterCommand(true);\n };\n })(commands[idx]);\n this.context.memo('help.' + commands[idx], this.lang.help[commands[idx]]);\n }\n\n this.fontName = this.wrapCommand((value) => {\n return this.fontStyling('font-family', env.validFontName(value));\n });\n\n this.fontSize = this.wrapCommand((value) => {\n const unit = this.currentStyle()['font-size-unit'];\n return this.fontStyling('font-size', value + unit);\n });\n\n this.fontSizeUnit = this.wrapCommand((value) => {\n const size = this.currentStyle()['font-size'];\n return this.fontStyling('font-size', size + value);\n });\n\n for (let idx = 1; idx <= 6; idx++) {\n this['formatH' + idx] = ((idx) => {\n return () => {\n this.formatBlock('H' + idx);\n };\n })(idx);\n this.context.memo('help.formatH' + idx, this.lang.help['formatH' + idx]);\n }\n\n this.insertParagraph = this.wrapCommand(() => {\n this.typing.insertParagraph(this.editable);\n });\n\n this.insertOrderedList = this.wrapCommand(() => {\n this.bullet.insertOrderedList(this.editable);\n });\n\n this.insertUnorderedList = this.wrapCommand(() => {\n this.bullet.insertUnorderedList(this.editable);\n });\n\n this.indent = this.wrapCommand(() => {\n this.bullet.indent(this.editable);\n });\n\n this.outdent = this.wrapCommand(() => {\n this.bullet.outdent(this.editable);\n });\n\n /**\n * insertNode\n * insert node\n * @param {Node} node\n */\n this.insertNode = this.wrapCommand((node) => {\n if (this.isLimited($(node).text().length)) {\n return;\n }\n const rng = this.getLastRange();\n rng.insertNode(node);\n this.setLastRange(range.createFromNodeAfter(node).select());\n });\n\n /**\n * insert text\n * @param {String} text\n */\n this.insertText = this.wrapCommand((text) => {\n if (this.isLimited(text.length)) {\n return;\n }\n const rng = this.getLastRange();\n const textNode = rng.insertNode(dom.createText(text));\n this.setLastRange(range.create(textNode, dom.nodeLength(textNode)).select());\n });\n\n /**\n * paste HTML\n * @param {String} markup\n */\n this.pasteHTML = this.wrapCommand((markup) => {\n if (this.isLimited(markup.length)) {\n return;\n }\n markup = this.context.invoke('codeview.purify', markup);\n const contents = this.getLastRange().pasteHTML(markup);\n this.setLastRange(range.createFromNodeAfter(lists.last(contents)).select());\n });\n\n /**\n * formatBlock\n *\n * @param {String} tagName\n */\n this.formatBlock = this.wrapCommand((tagName, $target) => {\n const onApplyCustomStyle = this.options.callbacks.onApplyCustomStyle;\n if (onApplyCustomStyle) {\n onApplyCustomStyle.call(this, $target, this.context, this.onFormatBlock);\n } else {\n this.onFormatBlock(tagName, $target);\n }\n });\n\n /**\n * insert horizontal rule\n */\n this.insertHorizontalRule = this.wrapCommand(() => {\n const hrNode = this.getLastRange().insertNode(dom.create('HR'));\n if (hrNode.nextSibling) {\n this.setLastRange(range.create(hrNode.nextSibling, 0).normalize().select());\n }\n });\n\n /**\n * lineHeight\n * @param {String} value\n */\n this.lineHeight = this.wrapCommand((value) => {\n this.style.stylePara(this.getLastRange(), {\n lineHeight: value,\n });\n });\n\n /**\n * create link (command)\n *\n * @param {Object} linkInfo\n */\n this.createLink = this.wrapCommand((linkInfo) => {\n let rel = [];\n let linkUrl = linkInfo.url;\n const linkText = linkInfo.text;\n const isNewWindow = linkInfo.isNewWindow;\n const addNoReferrer = this.options.linkAddNoReferrer;\n const addNoOpener = this.options.linkAddNoOpener;\n let rng = linkInfo.range || this.getLastRange();\n const additionalTextLength = linkText.length - rng.toString().length;\n if (additionalTextLength > 0 && this.isLimited(additionalTextLength)) {\n return;\n }\n const isTextChanged = rng.toString() !== linkText;\n\n // handle spaced urls from input\n if (typeof linkUrl === 'string') {\n linkUrl = linkUrl.trim();\n }\n\n if (this.options.onCreateLink) {\n linkUrl = this.options.onCreateLink(linkUrl);\n } else {\n linkUrl = this.checkLinkUrl(linkUrl);\n }\n\n let anchors = [];\n if (isTextChanged) {\n rng = rng.deleteContents();\n const anchor = rng.insertNode($('<A></A>').text(linkText)[0]);\n anchors.push(anchor);\n } else {\n anchors = this.style.styleNodes(rng, {\n nodeName: 'A',\n expandClosestSibling: true,\n onlyPartialContains: true,\n });\n }\n\n $.each(anchors, (idx, anchor) => {\n $(anchor).attr('href', linkUrl);\n if (isNewWindow) {\n $(anchor).attr('target', '_blank');\n if (addNoReferrer) {\n rel.push('noreferrer');\n }\n if (addNoOpener) {\n rel.push('noopener');\n }\n if (rel.length) {\n $(anchor).attr('rel', rel.join(' '));\n }\n } else {\n $(anchor).removeAttr('target');\n }\n });\n\n this.setLastRange(\n this.createRangeFromList(anchors).select()\n );\n });\n\n /**\n * setting color\n *\n * @param {Object} sObjColor color code\n * @param {String} sObjColor.foreColor foreground color\n * @param {String} sObjColor.backColor background color\n */\n this.color = this.wrapCommand((colorInfo) => {\n const foreColor = colorInfo.foreColor;\n const backColor = colorInfo.backColor;\n\n if (foreColor) { document.execCommand('foreColor', false, foreColor); }\n if (backColor) { document.execCommand('backColor', false, backColor); }\n });\n\n /**\n * Set foreground color\n *\n * @param {String} colorCode foreground color code\n */\n this.foreColor = this.wrapCommand((colorInfo) => {\n document.execCommand('foreColor', false, colorInfo);\n });\n\n /**\n * insert Table\n *\n * @param {String} dimension of table (ex : \"5x5\")\n */\n this.insertTable = this.wrapCommand((dim) => {\n const dimension = dim.split('x');\n\n const rng = this.getLastRange().deleteContents();\n rng.insertNode(this.table.createTable(dimension[0], dimension[1], this.options));\n });\n\n /**\n * remove media object and Figure Elements if media object is img with Figure.\n */\n this.removeMedia = this.wrapCommand(() => {\n let $target = $(this.restoreTarget()).parent();\n if ($target.closest('figure').length) {\n $target.closest('figure').remove();\n } else {\n $target = $(this.restoreTarget()).detach();\n }\n \n this.setLastRange(range.createFromSelection($target).select());\n this.context.triggerEvent('media.delete', $target, this.$editable);\n });\n\n /**\n * float me\n *\n * @param {String} value\n */\n this.floatMe = this.wrapCommand((value) => {\n const $target = $(this.restoreTarget());\n $target.toggleClass('note-float-left', value === 'left');\n $target.toggleClass('note-float-right', value === 'right');\n $target.css('float', (value === 'none' ? '' : value));\n });\n\n /**\n * resize overlay element\n * @param {String} value\n */\n this.resize = this.wrapCommand((value) => {\n const $target = $(this.restoreTarget());\n value = parseFloat(value);\n if (value === 0) {\n $target.css('width', '');\n } else {\n $target.css({\n width: value * 100 + '%',\n height: '',\n });\n }\n });\n }\n\n initialize() {\n // bind custom events\n this.$editable.on('keydown', (event) => {\n if (event.keyCode === key.code.ENTER) {\n this.context.triggerEvent('enter', event);\n }\n this.context.triggerEvent('keydown', event);\n\n // keep a snapshot to limit text on input event\n this.snapshot = this.history.makeSnapshot();\n this.hasKeyShortCut = false;\n if (!event.isDefaultPrevented()) {\n if (this.options.shortcuts) {\n this.hasKeyShortCut = this.handleKeyMap(event);\n } else {\n this.preventDefaultEditableShortCuts(event);\n }\n }\n if (this.isLimited(1, event)) {\n const lastRange = this.getLastRange();\n if (lastRange.eo - lastRange.so === 0) {\n return false;\n }\n }\n this.setLastRange();\n\n // record undo in the key event except keyMap.\n if (this.options.recordEveryKeystroke) {\n if (this.hasKeyShortCut === false) {\n this.history.recordUndo();\n }\n }\n }).on('keyup', (event) => {\n this.setLastRange();\n this.context.triggerEvent('keyup', event);\n }).on('focus', (event) => {\n this.setLastRange();\n this.context.triggerEvent('focus', event);\n }).on('blur', (event) => {\n this.context.triggerEvent('blur', event);\n }).on('mousedown', (event) => {\n this.context.triggerEvent('mousedown', event);\n }).on('mouseup', (event) => {\n this.setLastRange();\n this.history.recordUndo();\n this.context.triggerEvent('mouseup', event);\n }).on('scroll', (event) => {\n this.context.triggerEvent('scroll', event);\n }).on('paste', (event) => {\n this.setLastRange();\n this.context.triggerEvent('paste', event);\n }).on('copy', (event) => {\n this.context.triggerEvent('copy', event);\n }).on('input', () => {\n // To limit composition characters (e.g. Korean)\n if (this.isLimited(0) && this.snapshot) {\n this.history.applySnapshot(this.snapshot);\n }\n });\n\n this.$editable.attr('spellcheck', this.options.spellCheck);\n\n this.$editable.attr('autocorrect', this.options.spellCheck);\n\n if (this.options.disableGrammar) {\n this.$editable.attr('data-gramm', false);\n }\n\n // init content before set event\n this.$editable.html(dom.html(this.$note) || dom.emptyPara);\n\n this.$editable.on(env.inputEventName, func.debounce(() => {\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }, 10));\n\n this.$editable.on('focusin', (event) => {\n this.context.triggerEvent('focusin', event);\n }).on('focusout', (event) => {\n this.context.triggerEvent('focusout', event);\n });\n\n if (this.options.airMode) {\n if (this.options.overrideContextMenu) {\n this.$editor.on('contextmenu', (event) => {\n this.context.triggerEvent('contextmenu', event);\n return false;\n });\n }\n } else {\n if (this.options.width) {\n this.$editor.outerWidth(this.options.width);\n }\n if (this.options.height) {\n this.$editable.outerHeight(this.options.height);\n }\n if (this.options.maxHeight) {\n this.$editable.css('max-height', this.options.maxHeight);\n }\n if (this.options.minHeight) {\n this.$editable.css('min-height', this.options.minHeight);\n }\n }\n\n this.history.recordUndo();\n this.setLastRange();\n }\n\n destroy() {\n this.$editable.off();\n }\n\n handleKeyMap(event) {\n const keyMap = this.options.keyMap[env.isMac ? 'mac' : 'pc'];\n const keys = [];\n\n if (event.metaKey) { keys.push('CMD'); }\n if (event.ctrlKey && !event.altKey) { keys.push('CTRL'); }\n if (event.shiftKey) { keys.push('SHIFT'); }\n\n const keyName = key.nameFromCode[event.keyCode];\n if (keyName) {\n keys.push(keyName);\n }\n\n const eventName = keyMap[keys.join('+')];\n\n if (keyName === 'TAB' && !this.options.tabDisable) {\n this.afterCommand();\n } else if (eventName) {\n if (this.context.invoke(eventName) !== false) {\n event.preventDefault();\n return true;\n }\n } else if (key.isEdit(event.keyCode)) {\n if (key.isRemove(event.keyCode)) {\n this.context.invoke('removed');\n }\n this.afterCommand();\n }\n return false;\n }\n\n preventDefaultEditableShortCuts(event) {\n // B(Bold, 66) / I(Italic, 73) / U(Underline, 85)\n if ((event.ctrlKey || event.metaKey) &&\n lists.contains([66, 73, 85], event.keyCode)) {\n event.preventDefault();\n }\n }\n\n isLimited(pad, event) {\n pad = pad || 0;\n\n if (typeof event !== 'undefined') {\n if (key.isMove(event.keyCode) ||\n key.isNavigation(event.keyCode) ||\n (event.ctrlKey || event.metaKey) ||\n lists.contains([key.code.BACKSPACE, key.code.DELETE], event.keyCode)) {\n return false;\n }\n }\n\n if (this.options.maxTextLength > 0) {\n if ((this.$editable.text().length + pad) > this.options.maxTextLength) {\n return true;\n }\n }\n return false;\n }\n\n checkLinkUrl(linkUrl) {\n if (MAILTO_PATTERN.test(linkUrl)) {\n return 'mailto://' + linkUrl;\n } else if (TEL_PATTERN.test(linkUrl)) {\n return 'tel://' + linkUrl;\n } else if (!URL_SCHEME_PATTERN.test(linkUrl)) {\n return 'http://' + linkUrl;\n }\n return linkUrl;\n }\n\n /**\n * create range\n * @return {WrappedRange}\n */\n createRange() {\n this.focus();\n this.setLastRange();\n return this.getLastRange();\n }\n\n /**\n * create a new range from the list of elements\n *\n * @param {list} dom element list\n * @return {WrappedRange}\n */\n createRangeFromList(lst) {\n const startRange = range.createFromNodeBefore(lists.head(lst));\n const startPoint = startRange.getStartPoint();\n const endRange = range.createFromNodeAfter(lists.last(lst));\n const endPoint = endRange.getEndPoint();\n\n return range.create(\n startPoint.node,\n startPoint.offset,\n endPoint.node,\n endPoint.offset\n );\n }\n\n /**\n * set the last range\n *\n * if given rng is exist, set rng as the last range\n * or create a new range at the end of the document\n *\n * @param {WrappedRange} rng\n */\n setLastRange(rng) {\n if (rng) {\n this.lastRange = rng;\n } else {\n this.lastRange = range.create(this.editable);\n\n if ($(this.lastRange.sc).closest('.note-editable').length === 0) {\n this.lastRange = range.createFromBodyElement(this.editable);\n }\n }\n }\n\n /**\n * get the last range\n *\n * if there is a saved last range, return it\n * or create a new range and return it\n *\n * @return {WrappedRange}\n */\n getLastRange() {\n if (!this.lastRange) {\n this.setLastRange();\n }\n return this.lastRange;\n }\n\n /**\n * saveRange\n *\n * save current range\n *\n * @param {Boolean} [thenCollapse=false]\n */\n saveRange(thenCollapse) {\n if (thenCollapse) {\n this.getLastRange().collapse().select();\n }\n }\n\n /**\n * restoreRange\n *\n * restore lately range\n */\n restoreRange() {\n if (this.lastRange) {\n this.lastRange.select();\n this.focus();\n }\n }\n\n saveTarget(node) {\n this.$editable.data('target', node);\n }\n\n clearTarget() {\n this.$editable.removeData('target');\n }\n\n restoreTarget() {\n return this.$editable.data('target');\n }\n\n /**\n * currentStyle\n *\n * current style\n * @return {Object|Boolean} unfocus\n */\n currentStyle() {\n let rng = range.create();\n if (rng) {\n rng = rng.normalize();\n }\n return rng ? this.style.current(rng) : this.style.fromNode(this.$editable);\n }\n\n /**\n * style from node\n *\n * @param {jQuery} $node\n * @return {Object}\n */\n styleFromNode($node) {\n return this.style.fromNode($node);\n }\n\n /**\n * undo\n */\n undo() {\n this.context.triggerEvent('before.command', this.$editable.html());\n this.history.undo();\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }\n\n /*\n * commit\n */\n commit() {\n this.context.triggerEvent('before.command', this.$editable.html());\n this.history.commit();\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }\n\n /**\n * redo\n */\n redo() {\n this.context.triggerEvent('before.command', this.$editable.html());\n this.history.redo();\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }\n\n /**\n * before command\n */\n beforeCommand() {\n this.context.triggerEvent('before.command', this.$editable.html());\n\n // Set styleWithCSS before run a command\n try {\n document.execCommand('styleWithCSS', false, this.options.styleWithCSS);\n } catch(e) {\n // eslint-disable-next-line\n }\n\n // keep focus on editable before command execution\n this.focus();\n }\n\n /**\n * after command\n * @param {Boolean} isPreventTrigger\n */\n afterCommand(isPreventTrigger) {\n this.normalizeContent();\n this.history.recordUndo();\n if (!isPreventTrigger) {\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }\n }\n\n /**\n * handle tab key\n */\n tab() {\n const rng = this.getLastRange();\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.table.tab(rng);\n } else {\n if (this.options.tabSize === 0) {\n return false;\n }\n\n if (!this.isLimited(this.options.tabSize)) {\n this.beforeCommand();\n this.typing.insertTab(rng, this.options.tabSize);\n this.afterCommand();\n }\n }\n }\n\n /**\n * handle shift+tab key\n */\n untab() {\n const rng = this.getLastRange();\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.table.tab(rng, true);\n } else {\n if (this.options.tabSize === 0) {\n return false;\n }\n }\n }\n\n /**\n * run given function between beforeCommand and afterCommand\n */\n wrapCommand(fn) {\n return function() {\n this.beforeCommand();\n fn.apply(this, arguments);\n this.afterCommand();\n };\n }\n /**\n * removed (function added by 1der1)\n */\n removed(rng, node, tagName) { // LB\n rng = range.create();\n if (rng.isCollapsed() && rng.isOnCell()) {\n node = rng.ec;\n if( (tagName = node.tagName) &&\n\t\t\t\t(node.childElementCount === 1) &&\n\t\t\t\t(node.childNodes[0].tagName === \"BR\") ){\n\n if(tagName === \"P\") {\n node.remove();\n } else if(['TH', 'TD'].indexOf(tagName) >=0) {\n node.firstChild.remove();\n }\n }\n }\n }\n /**\n * insert image\n *\n * @param {String} src\n * @param {String|Function} param\n * @return {Promise}\n */\n insertImage(src, param) {\n return createImage(src, param).then(($image) => {\n this.beforeCommand();\n\n if (typeof param === 'function') {\n param($image);\n } else {\n if (typeof param === 'string') {\n $image.attr('data-filename', param);\n }\n $image.css('width', Math.min(this.$editable.width(), $image.width()));\n }\n\n $image.show();\n this.getLastRange().insertNode($image[0]);\n this.setLastRange(range.createFromNodeAfter($image[0]).select());\n this.afterCommand();\n }).fail((e) => {\n this.context.triggerEvent('image.upload.error', e);\n });\n }\n\n /**\n * insertImages\n * @param {File[]} files\n */\n insertImagesAsDataURL(files) {\n $.each(files, (idx, file) => {\n const filename = file.name;\n if (this.options.maximumImageFileSize && this.options.maximumImageFileSize < file.size) {\n this.context.triggerEvent('image.upload.error', this.lang.image.maximumFileSizeError);\n } else {\n readFileAsDataURL(file).then((dataURL) => {\n return this.insertImage(dataURL, filename);\n }).fail(() => {\n this.context.triggerEvent('image.upload.error');\n });\n }\n });\n }\n\n /**\n * insertImagesOrCallback\n * @param {File[]} files\n */\n insertImagesOrCallback(files) {\n const callbacks = this.options.callbacks;\n // If onImageUpload set,\n if (callbacks.onImageUpload) {\n this.context.triggerEvent('image.upload', files);\n // else insert Image as dataURL\n } else {\n this.insertImagesAsDataURL(files);\n }\n }\n\n /**\n * return selected plain text\n * @return {String} text\n */\n getSelectedText() {\n let rng = this.getLastRange();\n\n // if range on anchor, expand range with anchor\n if (rng.isOnAnchor()) {\n rng = range.createFromNode(dom.ancestor(rng.sc, dom.isAnchor));\n }\n\n return rng.toString();\n }\n\n onFormatBlock(tagName, $target) {\n // [workaround] for MSIE, IE need `<`\n document.execCommand('FormatBlock', false, env.isMSIE ? '<' + tagName + '>' : tagName);\n\n // support custom class\n if ($target && $target.length) {\n // find the exact element has given tagName\n if ($target[0].tagName.toUpperCase() !== tagName.toUpperCase()) {\n $target = $target.find(tagName);\n }\n\n if ($target && $target.length) {\n const currentRange = this.createRange();\n const $parent = $([currentRange.sc, currentRange.ec]).closest(tagName);\n // remove class added for current block\n $parent.removeClass();\n const className = $target[0].className || '';\n if (className) {\n $parent.addClass(className);\n }\n }\n }\n }\n\n formatPara() {\n this.formatBlock('P');\n }\n\n fontStyling(target, value) {\n const rng = this.getLastRange();\n\n if (rng !== '') {\n const spans = this.style.styleNodes(rng);\n this.$editor.find('.note-status-output').html('');\n $(spans).css(target, value);\n\n // [workaround] added styled bogus span for style\n // - also bogus character needed for cursor position\n if (rng.isCollapsed()) {\n const firstSpan = lists.head(spans);\n if (firstSpan && !dom.nodeLength(firstSpan)) {\n firstSpan.innerHTML = dom.ZERO_WIDTH_NBSP_CHAR;\n range.createFromNode(firstSpan.firstChild).select();\n this.setLastRange();\n this.$editable.data(KEY_BOGUS, firstSpan);\n }\n } else {\n rng.select();\n }\n } else {\n const noteStatusOutput = $.now();\n this.$editor.find('.note-status-output').html('<div id=\"note-status-output-' + noteStatusOutput + '\" class=\"alert alert-info\">' + this.lang.output.noSelection + '</div>');\n setTimeout(function() { $('#note-status-output-' + noteStatusOutput).remove(); }, 5000);\n }\n }\n\n /**\n * unlink\n *\n * @type command\n */\n unlink() {\n let rng = this.getLastRange();\n if (rng.isOnAnchor()) {\n const anchor = dom.ancestor(rng.sc, dom.isAnchor);\n rng = range.createFromNode(anchor);\n rng.select();\n this.setLastRange();\n\n this.beforeCommand();\n document.execCommand('unlink');\n this.afterCommand();\n }\n }\n\n /**\n * returns link info\n *\n * @return {Object}\n * @return {WrappedRange} return.range\n * @return {String} return.text\n * @return {Boolean} [return.isNewWindow=true]\n * @return {String} [return.url=\"\"]\n */\n getLinkInfo() {\n if (!this.hasFocus()) {\n this.focus();\n }\n\n const rng = this.getLastRange().expand(dom.isAnchor);\n // Get the first anchor on range(for edit).\n const $anchor = $(lists.head(rng.nodes(dom.isAnchor)));\n const linkInfo = {\n range: rng,\n text: rng.toString(),\n url: $anchor.length ? $anchor.attr('href') : '',\n };\n\n // When anchor exists,\n if ($anchor.length) {\n // Set isNewWindow by checking its target.\n linkInfo.isNewWindow = $anchor.attr('target') === '_blank';\n }\n\n return linkInfo;\n }\n\n addRow(position) {\n const rng = this.getLastRange(this.$editable);\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.beforeCommand();\n this.table.addRow(rng, position);\n this.afterCommand();\n }\n }\n\n addCol(position) {\n const rng = this.getLastRange(this.$editable);\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.beforeCommand();\n this.table.addCol(rng, position);\n this.afterCommand();\n }\n }\n\n deleteRow() {\n const rng = this.getLastRange(this.$editable);\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.beforeCommand();\n this.table.deleteRow(rng);\n this.afterCommand();\n }\n }\n\n deleteCol() {\n const rng = this.getLastRange(this.$editable);\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.beforeCommand();\n this.table.deleteCol(rng);\n this.afterCommand();\n }\n }\n\n deleteTable() {\n const rng = this.getLastRange(this.$editable);\n if (rng.isCollapsed() && rng.isOnCell()) {\n this.beforeCommand();\n this.table.deleteTable(rng);\n this.afterCommand();\n }\n }\n\n /**\n * @param {Position} pos\n * @param {jQuery} $target - target element\n * @param {Boolean} [bKeepRatio] - keep ratio\n */\n resizeTo(pos, $target, bKeepRatio) {\n let imageSize;\n if (bKeepRatio) {\n const newRatio = pos.y / pos.x;\n const ratio = $target.data('ratio');\n imageSize = {\n width: ratio > newRatio ? pos.x : pos.y / ratio,\n height: ratio > newRatio ? pos.x * ratio : pos.y,\n };\n } else {\n imageSize = {\n width: pos.x,\n height: pos.y,\n };\n }\n\n $target.css(imageSize);\n }\n\n /**\n * returns whether editable area has focus or not.\n */\n hasFocus() {\n return this.$editable.is(':focus');\n }\n\n /**\n * set focus\n */\n focus() {\n // [workaround] Screen will move when page is scolled in IE.\n // - do focus when not focused\n if (!this.hasFocus()) {\n this.$editable.trigger('focus');\n }\n }\n\n /**\n * returns whether contents is empty or not.\n * @return {Boolean}\n */\n isEmpty() {\n return dom.isEmpty(this.$editable[0]) || dom.emptyPara === this.$editable.html();\n }\n\n /**\n * Removes all contents and restores the editable instance to an _emptyPara_.\n */\n empty() {\n this.context.invoke('code', dom.emptyPara);\n }\n\n /**\n * normalize content\n */\n normalizeContent() {\n this.$editable[0].normalize();\n }\n}\n","export default class Clipboard {\n constructor(context) {\n this.context = context;\n this.options = context.options;\n this.$editable = context.layoutInfo.editable;\n }\n\n initialize() {\n this.$editable.on('paste', this.pasteByEvent.bind(this));\n }\n\n /**\n * paste by clipboard event\n *\n * @param {Event} event\n */\n pasteByEvent(event) {\n\n if (this.context.isDisabled()) {\n return;\n }\n const clipboardData = event.originalEvent.clipboardData;\n\n if (clipboardData && clipboardData.items && clipboardData.items.length) {\n const clipboardFiles = clipboardData.files;\n const clipboardText = clipboardData.getData('Text');\n\n // paste img file\n if (clipboardFiles.length > 0 && this.options.allowClipboardImagePasting) {\n this.context.invoke('editor.insertImagesOrCallback', clipboardFiles);\n event.preventDefault();\n }\n\n // paste text with maxTextLength check\n if (clipboardText.length > 0 && this.context.invoke('editor.isLimited', clipboardText.length)) {\n event.preventDefault();\n }\n } else if (window.clipboardData) {\n // for IE\n let text = window.clipboardData.getData('text');\n if (this.context.invoke('editor.isLimited', text.length)) {\n event.preventDefault();\n }\n }\n\n // Call editor.afterCommand after proceeding default event handler\n setTimeout(() => {\n this.context.invoke('editor.afterCommand');\n }, 10);\n }\n}\n","import $ from 'jquery';\n\nexport default class Dropzone {\n constructor(context) {\n this.context = context;\n this.$eventListener = $(document);\n this.$editor = context.layoutInfo.editor;\n this.$editable = context.layoutInfo.editable;\n this.options = context.options;\n this.lang = this.options.langInfo;\n this.documentEventHandlers = {};\n\n this.$dropzone = $([\n '<div class=\"note-dropzone\">',\n '<div class=\"note-dropzone-message\"></div>',\n '</div>',\n ].join('')).prependTo(this.$editor);\n }\n\n /**\n * attach Drag and Drop Events\n */\n initialize() {\n if (this.options.disableDragAndDrop) {\n // prevent default drop event\n this.documentEventHandlers.onDrop = (e) => {\n e.preventDefault();\n };\n // do not consider outside of dropzone\n this.$eventListener = this.$dropzone;\n this.$eventListener.on('drop', this.documentEventHandlers.onDrop);\n } else {\n this.attachDragAndDropEvent();\n }\n }\n\n /**\n * attach Drag and Drop Events\n */\n attachDragAndDropEvent() {\n let collection = $();\n const $dropzoneMessage = this.$dropzone.find('.note-dropzone-message');\n\n this.documentEventHandlers.onDragenter = (e) => {\n const isCodeview = this.context.invoke('codeview.isActivated');\n const hasEditorSize = this.$editor.width() > 0 && this.$editor.height() > 0;\n if (!isCodeview && !collection.length && hasEditorSize) {\n this.$editor.addClass('dragover');\n this.$dropzone.width(this.$editor.width());\n this.$dropzone.height(this.$editor.height());\n $dropzoneMessage.text(this.lang.image.dragImageHere);\n }\n collection = collection.add(e.target);\n };\n\n this.documentEventHandlers.onDragleave = (e) => {\n collection = collection.not(e.target);\n\n // If nodeName is BODY, then just make it over (fix for IE)\n if (!collection.length || e.target.nodeName === 'BODY') {\n collection = $();\n this.$editor.removeClass('dragover');\n }\n };\n\n this.documentEventHandlers.onDrop = () => {\n collection = $();\n this.$editor.removeClass('dragover');\n };\n\n // show dropzone on dragenter when dragging a object to document\n // -but only if the editor is visible, i.e. has a positive width and height\n this.$eventListener.on('dragenter', this.documentEventHandlers.onDragenter)\n .on('dragleave', this.documentEventHandlers.onDragleave)\n .on('drop', this.documentEventHandlers.onDrop);\n\n // change dropzone's message on hover.\n this.$dropzone.on('dragenter', () => {\n this.$dropzone.addClass('hover');\n $dropzoneMessage.text(this.lang.image.dropImage);\n }).on('dragleave', () => {\n this.$dropzone.removeClass('hover');\n $dropzoneMessage.text(this.lang.image.dragImageHere);\n });\n\n // attach dropImage\n this.$dropzone.on('drop', (event) => {\n const dataTransfer = event.originalEvent.dataTransfer;\n\n // stop the browser from opening the dropped content\n event.preventDefault();\n\n if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {\n this.$editable.trigger('focus');\n this.context.invoke('editor.insertImagesOrCallback', dataTransfer.files);\n } else {\n $.each(dataTransfer.types, (idx, type) => {\n // skip moz-specific types\n if (type.toLowerCase().indexOf('_moz_') > -1) {\n return;\n }\n const content = dataTransfer.getData(type);\n\n if (type.toLowerCase().indexOf('text') > -1) {\n this.context.invoke('editor.pasteHTML', content);\n } else {\n $(content).each((idx, item) => {\n this.context.invoke('editor.insertNode', item);\n });\n }\n });\n }\n }).on('dragover', false); // prevent default dragover event\n }\n\n destroy() {\n Object.keys(this.documentEventHandlers).forEach((key) => {\n this.$eventListener.off(key.slice(2).toLowerCase(), this.documentEventHandlers[key]);\n });\n this.documentEventHandlers = {};\n }\n}\n","import dom from '../core/dom';\nimport key from '../core/key';\n\n/**\n * @class Codeview\n */\nexport default class CodeView {\n constructor(context) {\n this.context = context;\n this.$editor = context.layoutInfo.editor;\n this.$editable = context.layoutInfo.editable;\n this.$codable = context.layoutInfo.codable;\n this.options = context.options;\n this.CodeMirrorConstructor = window.CodeMirror;\n\n if (this.options.codemirror.CodeMirrorConstructor) {\n this.CodeMirrorConstructor = this.options.codemirror.CodeMirrorConstructor;\n }\n }\n\n sync(html) {\n const isCodeview = this.isActivated();\n const CodeMirror = this.CodeMirrorConstructor;\n\n if (isCodeview) {\n if (html) {\n if (CodeMirror) {\n this.$codable.data('cmEditor').getDoc().setValue(html);\n } else {\n this.$codable.val(html);\n }\n } else {\n if (CodeMirror) {\n this.$codable.data('cmEditor').save();\n }\n }\n }\n }\n\n initialize() {\n this.$codable.on('keyup', (event) => {\n if (event.keyCode === key.code.ESCAPE) {\n this.deactivate();\n }\n });\n }\n\n /**\n * @return {Boolean}\n */\n isActivated() {\n return this.$editor.hasClass('codeview');\n }\n\n /**\n * toggle codeview\n */\n toggle() {\n if (this.isActivated()) {\n this.deactivate();\n } else {\n this.activate();\n }\n this.context.triggerEvent('codeview.toggled');\n }\n\n /**\n * purify input value\n * @param value\n * @returns {*}\n */\n purify(value) {\n if (this.options.codeviewFilter) {\n // filter code view regex\n value = value.replace(this.options.codeviewFilterRegex, '');\n // allow specific iframe tag\n if (this.options.codeviewIframeFilter) {\n const whitelist = this.options.codeviewIframeWhitelistSrc.concat(this.options.codeviewIframeWhitelistSrcBase);\n value = value.replace(/(<iframe.*?>.*?(?:<\\/iframe>)?)/gi, function(tag) {\n // remove if src attribute is duplicated\n if (/<.+src(?==?('|\"|\\s)?)[\\s\\S]+src(?=('|\"|\\s)?)[^>]*?>/i.test(tag)) {\n return '';\n }\n for (const src of whitelist) {\n // pass if src is trusted\n if ((new RegExp('src=\"(https?:)?\\/\\/' + src.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&') + '\\/(.+)\"')).test(tag)) {\n return tag;\n }\n }\n return '';\n });\n }\n }\n return value;\n }\n\n /**\n * activate code view\n */\n activate() {\n const CodeMirror = this.CodeMirrorConstructor;\n this.$codable.val(dom.html(this.$editable, this.options.prettifyHtml));\n this.$codable.height(this.$editable.height());\n\n this.context.invoke('toolbar.updateCodeview', true);\n this.context.invoke('airPopover.updateCodeview', true);\n\n this.$editor.addClass('codeview');\n this.$codable.trigger('focus');\n\n // activate CodeMirror as codable\n if (CodeMirror) {\n const cmEditor = CodeMirror.fromTextArea(this.$codable[0], this.options.codemirror);\n\n // CodeMirror TernServer\n if (this.options.codemirror.tern) {\n const server = new CodeMirror.TernServer(this.options.codemirror.tern);\n cmEditor.ternServer = server;\n cmEditor.on('cursorActivity', (cm) => {\n server.updateArgHints(cm);\n });\n }\n\n cmEditor.on('blur', (event) => {\n this.context.triggerEvent('blur.codeview', cmEditor.getValue(), event);\n });\n cmEditor.on('change', () => {\n this.context.triggerEvent('change.codeview', cmEditor.getValue(), cmEditor);\n });\n\n // CodeMirror hasn't Padding.\n cmEditor.setSize(null, this.$editable.outerHeight());\n this.$codable.data('cmEditor', cmEditor);\n } else {\n this.$codable.on('blur', (event) => {\n this.context.triggerEvent('blur.codeview', this.$codable.val(), event);\n });\n this.$codable.on('input', () => {\n this.context.triggerEvent('change.codeview', this.$codable.val(), this.$codable);\n });\n }\n }\n\n /**\n * deactivate code view\n */\n deactivate() {\n const CodeMirror = this.CodeMirrorConstructor;\n // deactivate CodeMirror as codable\n if (CodeMirror) {\n const cmEditor = this.$codable.data('cmEditor');\n this.$codable.val(cmEditor.getValue());\n cmEditor.toTextArea();\n }\n\n const value = this.purify(dom.value(this.$codable, this.options.prettifyHtml) || dom.emptyPara);\n const isChange = this.$editable.html() !== value;\n\n this.$editable.html(value);\n this.$editable.height(this.options.height ? this.$codable.height() : 'auto');\n this.$editor.removeClass('codeview');\n\n if (isChange) {\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }\n\n this.$editable.trigger('focus');\n\n this.context.invoke('toolbar.updateCodeview', false);\n this.context.invoke('airPopover.updateCodeview', false);\n }\n\n destroy() {\n if (this.isActivated()) {\n this.deactivate();\n }\n }\n}\n","import $ from 'jquery';\nconst EDITABLE_PADDING = 24;\n\nexport default class Statusbar {\n constructor(context) {\n this.$document = $(document);\n this.$statusbar = context.layoutInfo.statusbar;\n this.$editable = context.layoutInfo.editable;\n this.$codable = context.layoutInfo.codable;\n this.options = context.options;\n }\n\n initialize() {\n if (this.options.airMode || this.options.disableResizeEditor) {\n this.destroy();\n return;\n }\n\n this.$statusbar.on('mousedown touchstart', (event) => {\n event.preventDefault();\n event.stopPropagation();\n\n const editableTop = this.$editable.offset().top - this.$document.scrollTop();\n const editableCodeTop = this.$codable.offset().top - this.$document.scrollTop();\n\n const onStatusbarMove = (event) => {\n let originalEvent = (event.type == 'mousemove') ? event : event.originalEvent.touches[0];\n let height = originalEvent.clientY - (editableTop + EDITABLE_PADDING);\n let heightCode = originalEvent.clientY - (editableCodeTop + EDITABLE_PADDING);\n\n height = (this.options.minheight > 0) ? Math.max(height, this.options.minheight) : height;\n height = (this.options.maxHeight > 0) ? Math.min(height, this.options.maxHeight) : height;\n heightCode = (this.options.minheight > 0) ? Math.max(heightCode, this.options.minheight) : heightCode;\n heightCode = (this.options.maxHeight > 0) ? Math.min(heightCode, this.options.maxHeight) : heightCode;\n\n\n this.$editable.height(height);\n this.$codable.height(heightCode);\n };\n\n this.$document.on('mousemove touchmove', onStatusbarMove).one('mouseup touchend', () => {\n this.$document.off('mousemove touchmove', onStatusbarMove);\n });\n });\n }\n\n destroy() {\n this.$statusbar.off();\n this.$statusbar.addClass('locked');\n }\n}\n","import $ from 'jquery';\n\nexport default class Fullscreen {\n constructor(context) {\n this.context = context;\n\n this.$editor = context.layoutInfo.editor;\n this.$toolbar = context.layoutInfo.toolbar;\n this.$editable = context.layoutInfo.editable;\n this.$codable = context.layoutInfo.codable;\n\n this.$window = $(window);\n this.$scrollbar = $('html, body');\n this.scrollbarClassName = 'note-fullscreen-body';\n\n this.onResize = () => {\n this.resizeTo({\n h: this.$window.height() - this.$toolbar.outerHeight(),\n });\n };\n }\n\n resizeTo(size) {\n this.$editable.css('height', size.h);\n this.$codable.css('height', size.h);\n if (this.$codable.data('cmeditor')) {\n this.$codable.data('cmeditor').setsize(null, size.h);\n }\n }\n\n /**\n * toggle fullscreen\n */\n toggle() {\n this.$editor.toggleClass('fullscreen');\n const isFullscreen = this.isFullscreen();\n this.$scrollbar.toggleClass(this.scrollbarClassName, isFullscreen);\n if (isFullscreen) {\n this.$editable.data('orgHeight', this.$editable.css('height'));\n this.$editable.data('orgMaxHeight', this.$editable.css('maxHeight'));\n this.$editable.css('maxHeight', '');\n this.$window.on('resize', this.onResize).trigger('resize');\n } else {\n this.$window.off('resize', this.onResize);\n this.resizeTo({ h: this.$editable.data('orgHeight') });\n this.$editable.css('maxHeight', this.$editable.css('orgMaxHeight'));\n }\n\n this.context.invoke('toolbar.updateFullscreen', isFullscreen);\n }\n\n isFullscreen() {\n return this.$editor.hasClass('fullscreen');\n }\n\n destroy() {\n this.$scrollbar.removeClass(this.scrollbarClassName);\n }\n}\n","import $ from 'jquery';\nimport dom from '../core/dom';\n\nexport default class Handle {\n constructor(context) {\n this.context = context;\n this.$document = $(document);\n this.$editingArea = context.layoutInfo.editingArea;\n this.options = context.options;\n this.lang = this.options.langInfo;\n\n this.events = {\n 'summernote.mousedown': (we, e) => {\n if (this.update(e.target, e)) {\n e.preventDefault();\n }\n },\n 'summernote.keyup summernote.scroll summernote.change summernote.dialog.shown': () => {\n this.update();\n },\n 'summernote.disable summernote.blur': () => {\n this.hide();\n },\n 'summernote.codeview.toggled': () => {\n this.update();\n },\n };\n }\n\n initialize() {\n this.$handle = $([\n '<div class=\"note-handle\">',\n '<div class=\"note-control-selection\">',\n '<div class=\"note-control-selection-bg\"></div>',\n '<div class=\"note-control-holder note-control-nw\"></div>',\n '<div class=\"note-control-holder note-control-ne\"></div>',\n '<div class=\"note-control-holder note-control-sw\"></div>',\n '<div class=\"',\n (this.options.disableResizeImage ? 'note-control-holder' : 'note-control-sizing'),\n ' note-control-se\"></div>',\n (this.options.disableResizeImage ? '' : '<div class=\"note-control-selection-info\"></div>'),\n '</div>',\n '</div>',\n ].join('')).prependTo(this.$editingArea);\n\n this.$handle.on('mousedown', (event) => {\n if (dom.isControlSizing(event.target)) {\n event.preventDefault();\n event.stopPropagation();\n\n const $target = this.$handle.find('.note-control-selection').data('target');\n const posStart = $target.offset();\n const scrollTop = this.$document.scrollTop();\n\n const onMouseMove = (event) => {\n this.context.invoke('editor.resizeTo', {\n x: event.clientX - posStart.left,\n y: event.clientY - (posStart.top - scrollTop),\n }, $target, !event.shiftKey);\n\n this.update($target[0], event);\n };\n\n this.$document\n .on('mousemove', onMouseMove)\n .one('mouseup', (e) => {\n e.preventDefault();\n this.$document.off('mousemove', onMouseMove);\n this.context.invoke('editor.afterCommand');\n });\n\n if (!$target.data('ratio')) { // original ratio.\n $target.data('ratio', $target.height() / $target.width());\n }\n }\n });\n\n // Listen for scrolling on the handle overlay.\n this.$handle.on('wheel', (event) => {\n event.preventDefault();\n this.update();\n });\n }\n\n destroy() {\n this.$handle.remove();\n }\n\n update(target, event) {\n if (this.context.isDisabled()) {\n return false;\n }\n\n const isImage = dom.isImg(target);\n const $selection = this.$handle.find('.note-control-selection');\n\n this.context.invoke('imagePopover.update', target, event);\n\n if (isImage) {\n const $image = $(target);\n\n const areaRect = this.$editingArea[0].getBoundingClientRect();\n const imageRect = target.getBoundingClientRect();\n\n $selection.css({\n display: 'block',\n left: imageRect.left - areaRect.left,\n top: imageRect.top - areaRect.top,\n width: imageRect.width,\n height: imageRect.height,\n }).data('target', $image); // save current image element.\n\n const origImageObj = new Image();\n origImageObj.src = $image.attr('src');\n\n const sizingText = imageRect.width + 'x' + imageRect.height + ' (' + this.lang.image.original + ': ' + origImageObj.width + 'x' + origImageObj.height + ')';\n $selection.find('.note-control-selection-info').text(sizingText);\n this.context.invoke('editor.saveTarget', target);\n } else {\n this.hide();\n }\n\n return isImage;\n }\n\n /**\n * hide\n *\n * @param {jQuery} $handle\n */\n hide() {\n this.context.invoke('editor.clearTarget');\n this.$handle.children().hide();\n }\n}\n","import $ from 'jquery';\nimport lists from '../core/lists';\nimport key from '../core/key';\n\nconst defaultScheme = 'http://';\nconst linkPattern = /^([A-Za-z][A-Za-z0-9+-.]*\\:[\\/]{2}|tel:|mailto:[A-Z0-9._%+-]+@|xmpp:[A-Z0-9._%+-]+@)?(www\\.)?(.+)$/i;\n\nexport default class AutoLink {\n constructor(context) {\n this.context = context;\n this.options = context.options;\n this.$editable = context.layoutInfo.editable;\n this.events = {\n 'summernote.keyup': (we, event) => {\n if (!event.isDefaultPrevented()) {\n this.handleKeyup(event);\n }\n },\n 'summernote.keydown': (we, event) => {\n this.handleKeydown(event);\n },\n };\n }\n\n initialize() {\n this.lastWordRange = null;\n }\n\n destroy() {\n this.lastWordRange = null;\n }\n\n replace() {\n if (!this.lastWordRange) {\n return;\n }\n\n const keyword = this.lastWordRange.toString();\n const match = keyword.match(linkPattern);\n\n if (match && (match[1] || match[2])) {\n const link = match[1] ? keyword : defaultScheme + keyword;\n const urlText = this.options.showDomainOnlyForAutolink ?\n keyword.replace(/^(?:https?:\\/\\/)?(?:tel?:?)?(?:mailto?:?)?(?:xmpp?:?)?(?:www\\.)?/i, '').split('/')[0]\n : keyword;\n const node = $('<a></a>').html(urlText).attr('href', link)[0];\n if (this.context.options.linkTargetBlank) {\n $(node).attr('target', '_blank');\n }\n\n this.lastWordRange.insertNode(node);\n this.lastWordRange = null;\n this.context.invoke('editor.focus');\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }\n }\n\n handleKeydown(event) {\n if (lists.contains([key.code.ENTER, key.code.SPACE], event.keyCode)) {\n const wordRange = this.context.invoke('editor.createRange').getWordRange();\n this.lastWordRange = wordRange;\n }\n }\n\n handleKeyup(event) {\n if (key.code.SPACE === event.keyCode || (key.code.ENTER === event.keyCode && !event.shiftKey)) {\n this.replace();\n }\n }\n}\n","import dom from '../core/dom';\n\n/**\n * textarea auto sync.\n */\nexport default class AutoSync {\n constructor(context) {\n this.$note = context.layoutInfo.note;\n this.events = {\n 'summernote.change': () => {\n this.$note.val(context.invoke('code'));\n },\n };\n }\n\n shouldInitialize() {\n return dom.isTextarea(this.$note[0]);\n }\n}\n","import lists from '../core/lists';\nimport dom from '../core/dom';\nimport key from '../core/key';\n\nexport default class AutoReplace {\n constructor(context) {\n this.context = context;\n this.options = context.options.replace || {};\n\n this.keys = [key.code.ENTER, key.code.SPACE, key.code.PERIOD, key.code.COMMA, key.code.SEMICOLON, key.code.SLASH];\n this.previousKeydownCode = null;\n\n this.events = {\n 'summernote.keyup': (we, event) => {\n if (!event.isDefaultPrevented()) {\n this.handleKeyup(event);\n }\n },\n 'summernote.keydown': (we, event) => {\n this.handleKeydown(event);\n },\n };\n }\n\n shouldInitialize() {\n return !!this.options.match;\n }\n\n initialize() {\n this.lastWord = null;\n }\n\n destroy() {\n this.lastWord = null;\n }\n\n replace() {\n if (!this.lastWord) {\n return;\n }\n\n const self = this;\n const keyword = this.lastWord.toString();\n this.options.match(keyword, function(match) {\n if (match) {\n let node = '';\n\n if (typeof match === 'string') {\n node = dom.createText(match);\n } else if (match instanceof jQuery) {\n node = match[0];\n } else if (match instanceof Node) {\n node = match;\n }\n\n if (!node) return;\n self.lastWord.insertNode(node);\n self.lastWord = null;\n self.context.invoke('editor.focus');\n }\n });\n }\n\n handleKeydown(event) {\n // this forces it to remember the last whole word, even if multiple termination keys are pressed\n // before the previous key is let go.\n if (this.previousKeydownCode && lists.contains(this.keys, this.previousKeydownCode)) {\n this.previousKeydownCode = event.keyCode;\n return;\n }\n\n if (lists.contains(this.keys, event.keyCode)) {\n const wordRange = this.context.invoke('editor.createRange').getWordRange();\n this.lastWord = wordRange;\n }\n this.previousKeydownCode = event.keyCode;\n }\n\n handleKeyup(event) {\n if (lists.contains(this.keys, event.keyCode)) {\n this.replace();\n }\n }\n}\n","import $ from 'jquery';\nexport default class Placeholder {\n constructor(context) {\n this.context = context;\n\n this.$editingArea = context.layoutInfo.editingArea;\n this.options = context.options;\n\n if (this.options.inheritPlaceholder === true) {\n // get placeholder value from the original element\n this.options.placeholder = this.context.$note.attr('placeholder') || this.options.placeholder;\n }\n\n this.events = {\n 'summernote.init summernote.change': () => {\n this.update();\n },\n 'summernote.codeview.toggled': () => {\n this.update();\n },\n };\n }\n\n shouldInitialize() {\n return !!this.options.placeholder;\n }\n\n initialize() {\n this.$placeholder = $('<div class=\"note-placeholder\"></div>');\n this.$placeholder.on('click', () => {\n this.context.invoke('focus');\n }).html(this.options.placeholder).prependTo(this.$editingArea);\n\n this.update();\n }\n\n destroy() {\n this.$placeholder.remove();\n }\n\n update() {\n const isShow = !this.context.invoke('codeview.isActivated') && this.context.invoke('editor.isEmpty');\n this.$placeholder.toggle(isShow);\n }\n}\n","import $ from 'jquery';\nimport func from '../core/func';\nimport lists from '../core/lists';\nimport env from '../core/env';\n\nexport default class Buttons {\n constructor(context) {\n this.ui = $.summernote.ui;\n this.context = context;\n this.$toolbar = context.layoutInfo.toolbar;\n this.options = context.options;\n this.lang = this.options.langInfo;\n this.invertedKeyMap = func.invertObject(\n this.options.keyMap[env.isMac ? 'mac' : 'pc']\n );\n }\n\n representShortcut(editorMethod) {\n let shortcut = this.invertedKeyMap[editorMethod];\n if (!this.options.shortcuts || !shortcut) {\n return '';\n }\n\n if (env.isMac) {\n shortcut = shortcut.replace('CMD', '⌘').replace('SHIFT', '⇧');\n }\n\n shortcut = shortcut.replace('BACKSLASH', '\\\\')\n .replace('SLASH', '/')\n .replace('LEFTBRACKET', '[')\n .replace('RIGHTBRACKET', ']');\n\n return ' (' + shortcut + ')';\n }\n\n button(o) {\n if (!this.options.tooltip && o.tooltip) {\n delete o.tooltip;\n }\n o.container = this.options.container;\n return this.ui.button(o);\n }\n\n initialize() {\n this.addToolbarButtons();\n this.addImagePopoverButtons();\n this.addLinkPopoverButtons();\n this.addTablePopoverButtons();\n this.fontInstalledMap = {};\n }\n\n destroy() {\n delete this.fontInstalledMap;\n }\n\n isFontInstalled(name) {\n if (!Object.prototype.hasOwnProperty.call(this.fontInstalledMap, name)) {\n this.fontInstalledMap[name] = env.isFontInstalled(name) ||\n lists.contains(this.options.fontNamesIgnoreCheck, name);\n }\n return this.fontInstalledMap[name];\n }\n\n isFontDeservedToAdd(name) {\n name = name.toLowerCase();\n return (name !== '' && this.isFontInstalled(name) && env.genericFontFamilies.indexOf(name) === -1);\n }\n\n colorPalette(className, tooltip, backColor, foreColor) {\n return this.ui.buttonGroup({\n className: 'note-color ' + className,\n children: [\n this.button({\n className: 'note-current-color-button',\n contents: this.ui.icon(this.options.icons.font + ' note-recent-color'),\n tooltip: tooltip,\n click: (event) => {\n const $button = $(event.currentTarget);\n if (backColor && foreColor) {\n this.context.invoke('editor.color', {\n backColor: $button.attr('data-backColor'),\n foreColor: $button.attr('data-foreColor'),\n });\n } else if (backColor) {\n this.context.invoke('editor.color', {\n backColor: $button.attr('data-backColor'),\n });\n } else if (foreColor) {\n this.context.invoke('editor.color', {\n foreColor: $button.attr('data-foreColor'),\n });\n }\n },\n callback: ($button) => {\n const $recentColor = $button.find('.note-recent-color');\n if (backColor) {\n $recentColor.css('background-color', this.options.colorButton.backColor);\n $button.attr('data-backColor', this.options.colorButton.backColor);\n }\n if (foreColor) {\n $recentColor.css('color', this.options.colorButton.foreColor);\n $button.attr('data-foreColor', this.options.colorButton.foreColor);\n } else {\n $recentColor.css('color', 'transparent');\n }\n },\n }),\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents('', this.options),\n tooltip: this.lang.color.more,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdown({\n items: (backColor ? [\n '<div class=\"note-palette\">',\n '<div class=\"note-palette-title\">' + this.lang.color.background + '</div>',\n '<div>',\n '<button type=\"button\" class=\"note-color-reset btn btn-light btn-default\" data-event=\"backColor\" data-value=\"transparent\">',\n this.lang.color.transparent,\n '</button>',\n '</div>',\n '<div class=\"note-holder\" data-event=\"backColor\"><!-- back colors --></div>',\n '<div>',\n '<button type=\"button\" class=\"note-color-select btn btn-light btn-default\" data-event=\"openPalette\" data-value=\"backColorPicker-'+this.options.id+'\">',\n this.lang.color.cpSelect,\n '</button>',\n '<input type=\"color\" id=\"backColorPicker-'+this.options.id+'\" class=\"note-btn note-color-select-btn\" value=\"' + this.options.colorButton.backColor + '\" data-event=\"backColorPalette-'+this.options.id+'\">',\n '</div>',\n '<div class=\"note-holder-custom\" id=\"backColorPalette-'+this.options.id+'\" data-event=\"backColor\"></div>',\n '</div>',\n ].join('') : '') +\n (foreColor ? [\n '<div class=\"note-palette\">',\n '<div class=\"note-palette-title\">' + this.lang.color.foreground + '</div>',\n '<div>',\n '<button type=\"button\" class=\"note-color-reset btn btn-light btn-default\" data-event=\"removeFormat\" data-value=\"foreColor\">',\n this.lang.color.resetToDefault,\n '</button>',\n '</div>',\n '<div class=\"note-holder\" data-event=\"foreColor\"><!-- fore colors --></div>',\n '<div>',\n '<button type=\"button\" class=\"note-color-select btn btn-light btn-default\" data-event=\"openPalette\" data-value=\"foreColorPicker-'+this.options.id+'\">',\n this.lang.color.cpSelect,\n '</button>',\n '<input type=\"color\" id=\"foreColorPicker-'+this.options.id+'\" class=\"note-btn note-color-select-btn\" value=\"' + this.options.colorButton.foreColor + '\" data-event=\"foreColorPalette-'+this.options.id+'\">',\n '</div>', // Fix missing Div, Commented to find easily if it's wrong\n '<div class=\"note-holder-custom\" id=\"foreColorPalette-'+this.options.id+'\" data-event=\"foreColor\"></div>',\n '</div>',\n ].join('') : ''),\n callback: ($dropdown) => {\n $dropdown.find('.note-holder').each((idx, item) => {\n const $holder = $(item);\n $holder.append(this.ui.palette({\n colors: this.options.colors,\n colorsName: this.options.colorsName,\n eventName: $holder.data('event'),\n container: this.options.container,\n tooltip: this.options.tooltip,\n }).render());\n });\n /* TODO: do we have to record recent custom colors within cookies? */\n var customColors = [\n ['#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF'],\n ];\n $dropdown.find('.note-holder-custom').each((idx, item) => {\n const $holder = $(item);\n $holder.append(this.ui.palette({\n colors: customColors,\n colorsName: customColors,\n eventName: $holder.data('event'),\n container: this.options.container,\n tooltip: this.options.tooltip,\n }).render());\n });\n $dropdown.find('input[type=color]').each((idx, item) => {\n $(item).on(\"change\", function() {\n const $chip = $dropdown.find('#' + $(this).data('event')).find('.note-color-btn').first();\n const color = this.value.toUpperCase();\n $chip.css('background-color', color)\n .attr('aria-label', color)\n .attr('data-value', color)\n .attr('data-original-title', color);\n $chip.trigger('click');\n });\n });\n },\n click: (event) => {\n event.stopPropagation();\n\n const $parent = $('.' + className).find('.note-dropdown-menu');\n const $button = $(event.target);\n const eventName = $button.data('event');\n const value = $button.attr('data-value');\n\n if (eventName === 'openPalette') {\n const $picker = $parent.find('#' + value);\n const $palette = $($parent.find('#' + $picker.data('event')).find('.note-color-row')[0]);\n\n // Shift palette chips\n const $chip = $palette.find('.note-color-btn').last().detach();\n\n // Set chip attributes\n const color = $picker.val();\n $chip.css('background-color', color)\n .attr('aria-label', color)\n .attr('data-value', color)\n .attr('data-original-title', color);\n $palette.prepend($chip);\n $picker.trigger('click');\n } else {\n if (lists.contains(['backColor', 'foreColor'], eventName)) {\n const key = eventName === 'backColor' ? 'background-color' : 'color';\n const $color = $button.closest('.note-color').find('.note-recent-color');\n const $currentButton = $button.closest('.note-color').find('.note-current-color-button');\n\n $color.css(key, value);\n $currentButton.attr('data-' + eventName, value);\n }\n this.context.invoke('editor.' + eventName, value);\n }\n },\n }),\n ],\n }).render();\n }\n\n addToolbarButtons() {\n this.context.memo('button.style', () => {\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents(\n this.ui.icon(this.options.icons.magic), this.options\n ),\n tooltip: this.lang.style.style,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdown({\n className: 'dropdown-style',\n items: this.options.styleTags,\n title: this.lang.style.style,\n template: (item) => {\n // TBD: need to be simplified\n if (typeof item === 'string') {\n item = {\n tag: item,\n title: (Object.prototype.hasOwnProperty.call(this.lang.style, item) ? this.lang.style[item] : item),\n };\n }\n\n const tag = item.tag;\n const title = item.title;\n const style = item.style ? ' style=\"' + item.style + '\" ' : '';\n const className = item.className ? ' class=\"' + item.className + '\"' : '';\n\n return '<' + tag + style + className + '>' + title + '</' + tag + '>';\n },\n click: this.context.createInvokeHandler('editor.formatBlock'),\n }),\n ]).render();\n });\n\n for (let styleIdx = 0, styleLen = this.options.styleTags.length; styleIdx < styleLen; styleIdx++) {\n const item = this.options.styleTags[styleIdx];\n\n this.context.memo('button.style.' + item, () => {\n return this.button({\n className: 'note-btn-style-' + item,\n contents: '<div data-value=\"' + item + '\">' + item.toUpperCase() + '</div>',\n tooltip: this.lang.style[item],\n click: this.context.createInvokeHandler('editor.formatBlock'),\n }).render();\n });\n }\n\n this.context.memo('button.bold', () => {\n return this.button({\n className: 'note-btn-bold',\n contents: this.ui.icon(this.options.icons.bold),\n tooltip: this.lang.font.bold + this.representShortcut('bold'),\n click: this.context.createInvokeHandlerAndUpdateState('editor.bold'),\n }).render();\n });\n\n this.context.memo('button.italic', () => {\n return this.button({\n className: 'note-btn-italic',\n contents: this.ui.icon(this.options.icons.italic),\n tooltip: this.lang.font.italic + this.representShortcut('italic'),\n click: this.context.createInvokeHandlerAndUpdateState('editor.italic'),\n }).render();\n });\n\n this.context.memo('button.underline', () => {\n return this.button({\n className: 'note-btn-underline',\n contents: this.ui.icon(this.options.icons.underline),\n tooltip: this.lang.font.underline + this.representShortcut('underline'),\n click: this.context.createInvokeHandlerAndUpdateState('editor.underline'),\n }).render();\n });\n\n this.context.memo('button.clear', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.eraser),\n tooltip: this.lang.font.clear + this.representShortcut('removeFormat'),\n click: this.context.createInvokeHandler('editor.removeFormat'),\n }).render();\n });\n\n this.context.memo('button.strikethrough', () => {\n return this.button({\n className: 'note-btn-strikethrough',\n contents: this.ui.icon(this.options.icons.strikethrough),\n tooltip: this.lang.font.strikethrough + this.representShortcut('strikethrough'),\n click: this.context.createInvokeHandlerAndUpdateState('editor.strikethrough'),\n }).render();\n });\n\n this.context.memo('button.superscript', () => {\n return this.button({\n className: 'note-btn-superscript',\n contents: this.ui.icon(this.options.icons.superscript),\n tooltip: this.lang.font.superscript,\n click: this.context.createInvokeHandlerAndUpdateState('editor.superscript'),\n }).render();\n });\n\n this.context.memo('button.subscript', () => {\n return this.button({\n className: 'note-btn-subscript',\n contents: this.ui.icon(this.options.icons.subscript),\n tooltip: this.lang.font.subscript,\n click: this.context.createInvokeHandlerAndUpdateState('editor.subscript'),\n }).render();\n });\n\n this.context.memo('button.fontname', () => {\n const styleInfo = this.context.invoke('editor.currentStyle');\n\n if (this.options.addDefaultFonts) {\n // Add 'default' fonts into the fontnames array if not exist\n $.each(styleInfo['font-family'].split(','), (idx, fontname) => {\n fontname = fontname.trim().replace(/['\"]+/g, '');\n if (this.isFontDeservedToAdd(fontname)) {\n if (this.options.fontNames.indexOf(fontname) === -1) {\n this.options.fontNames.push(fontname);\n }\n }\n });\n }\n\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents(\n '<span class=\"note-current-fontname\"></span>', this.options\n ),\n tooltip: this.lang.font.name,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdownCheck({\n className: 'dropdown-fontname',\n checkClassName: this.options.icons.menuCheck,\n items: this.options.fontNames.filter(this.isFontInstalled.bind(this)),\n title: this.lang.font.name,\n template: (item) => {\n return '<span style=\"font-family: ' + env.validFontName(item) + '\">' + item + '</span>';\n },\n click: this.context.createInvokeHandlerAndUpdateState('editor.fontName'),\n }),\n ]).render();\n });\n\n this.context.memo('button.fontsize', () => {\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents('<span class=\"note-current-fontsize\"></span>', this.options),\n tooltip: this.lang.font.size,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdownCheck({\n className: 'dropdown-fontsize',\n checkClassName: this.options.icons.menuCheck,\n items: this.options.fontSizes,\n title: this.lang.font.size,\n click: this.context.createInvokeHandlerAndUpdateState('editor.fontSize'),\n }),\n ]).render();\n });\n\n this.context.memo('button.fontsizeunit', () => {\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents('<span class=\"note-current-fontsizeunit\"></span>', this.options),\n tooltip: this.lang.font.sizeunit,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdownCheck({\n className: 'dropdown-fontsizeunit',\n checkClassName: this.options.icons.menuCheck,\n items: this.options.fontSizeUnits,\n title: this.lang.font.sizeunit,\n click: this.context.createInvokeHandlerAndUpdateState('editor.fontSizeUnit'),\n }),\n ]).render();\n });\n\n this.context.memo('button.color', () => {\n return this.colorPalette('note-color-all', this.lang.color.recent, true, true);\n });\n\n this.context.memo('button.forecolor', () => {\n return this.colorPalette('note-color-fore', this.lang.color.foreground, false, true);\n });\n\n this.context.memo('button.backcolor', () => {\n return this.colorPalette('note-color-back', this.lang.color.background, true, false);\n });\n\n this.context.memo('button.ul', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.unorderedlist),\n tooltip: this.lang.lists.unordered + this.representShortcut('insertUnorderedList'),\n click: this.context.createInvokeHandler('editor.insertUnorderedList'),\n }).render();\n });\n\n this.context.memo('button.ol', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.orderedlist),\n tooltip: this.lang.lists.ordered + this.representShortcut('insertOrderedList'),\n click: this.context.createInvokeHandler('editor.insertOrderedList'),\n }).render();\n });\n\n const justifyLeft = this.button({\n contents: this.ui.icon(this.options.icons.alignLeft),\n tooltip: this.lang.paragraph.left + this.representShortcut('justifyLeft'),\n click: this.context.createInvokeHandler('editor.justifyLeft'),\n });\n\n const justifyCenter = this.button({\n contents: this.ui.icon(this.options.icons.alignCenter),\n tooltip: this.lang.paragraph.center + this.representShortcut('justifyCenter'),\n click: this.context.createInvokeHandler('editor.justifyCenter'),\n });\n\n const justifyRight = this.button({\n contents: this.ui.icon(this.options.icons.alignRight),\n tooltip: this.lang.paragraph.right + this.representShortcut('justifyRight'),\n click: this.context.createInvokeHandler('editor.justifyRight'),\n });\n\n const justifyFull = this.button({\n contents: this.ui.icon(this.options.icons.alignJustify),\n tooltip: this.lang.paragraph.justify + this.representShortcut('justifyFull'),\n click: this.context.createInvokeHandler('editor.justifyFull'),\n });\n\n const outdent = this.button({\n contents: this.ui.icon(this.options.icons.outdent),\n tooltip: this.lang.paragraph.outdent + this.representShortcut('outdent'),\n click: this.context.createInvokeHandler('editor.outdent'),\n });\n\n const indent = this.button({\n contents: this.ui.icon(this.options.icons.indent),\n tooltip: this.lang.paragraph.indent + this.representShortcut('indent'),\n click: this.context.createInvokeHandler('editor.indent'),\n });\n\n this.context.memo('button.justifyLeft', func.invoke(justifyLeft, 'render'));\n this.context.memo('button.justifyCenter', func.invoke(justifyCenter, 'render'));\n this.context.memo('button.justifyRight', func.invoke(justifyRight, 'render'));\n this.context.memo('button.justifyFull', func.invoke(justifyFull, 'render'));\n this.context.memo('button.outdent', func.invoke(outdent, 'render'));\n this.context.memo('button.indent', func.invoke(indent, 'render'));\n\n this.context.memo('button.paragraph', () => {\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents(this.ui.icon(this.options.icons.alignLeft), this.options),\n tooltip: this.lang.paragraph.paragraph,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdown([\n this.ui.buttonGroup({\n className: 'note-align',\n children: [justifyLeft, justifyCenter, justifyRight, justifyFull],\n }),\n this.ui.buttonGroup({\n className: 'note-list',\n children: [outdent, indent],\n }),\n ]),\n ]).render();\n });\n\n this.context.memo('button.height', () => {\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents(this.ui.icon(this.options.icons.textHeight), this.options),\n tooltip: this.lang.font.height,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdownCheck({\n items: this.options.lineHeights,\n checkClassName: this.options.icons.menuCheck,\n className: 'dropdown-line-height',\n title: this.lang.font.height,\n click: this.context.createInvokeHandler('editor.lineHeight'),\n }),\n ]).render();\n });\n\n this.context.memo('button.table', () => {\n return this.ui.buttonGroup([\n this.button({\n className: 'dropdown-toggle',\n contents: this.ui.dropdownButtonContents(this.ui.icon(this.options.icons.table), this.options),\n tooltip: this.lang.table.table,\n data: {\n toggle: 'dropdown',\n },\n }),\n this.ui.dropdown({\n title: this.lang.table.table,\n className: 'note-table',\n items: [\n '<div class=\"note-dimension-picker\">',\n '<div class=\"note-dimension-picker-mousecatcher\" data-event=\"insertTable\" data-value=\"1x1\"></div>',\n '<div class=\"note-dimension-picker-highlighted\"></div>',\n '<div class=\"note-dimension-picker-unhighlighted\"></div>',\n '</div>',\n '<div class=\"note-dimension-display\">1 x 1</div>',\n ].join(''),\n }),\n ], {\n callback: ($node) => {\n const $catcher = $node.find('.note-dimension-picker-mousecatcher');\n $catcher.css({\n width: this.options.insertTableMaxSize.col + 'em',\n height: this.options.insertTableMaxSize.row + 'em',\n }).on('mousedown', this.context.createInvokeHandler('editor.insertTable'))\n .on('mousemove', this.tableMoveHandler.bind(this));\n },\n }).render();\n });\n\n this.context.memo('button.link', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.link),\n tooltip: this.lang.link.link + this.representShortcut('linkDialog.show'),\n click: this.context.createInvokeHandler('linkDialog.show'),\n }).render();\n });\n\n this.context.memo('button.picture', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.picture),\n tooltip: this.lang.image.image,\n click: this.context.createInvokeHandler('imageDialog.show'),\n }).render();\n });\n\n this.context.memo('button.video', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.video),\n tooltip: this.lang.video.video,\n click: this.context.createInvokeHandler('videoDialog.show'),\n }).render();\n });\n\n this.context.memo('button.hr', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.minus),\n tooltip: this.lang.hr.insert + this.representShortcut('insertHorizontalRule'),\n click: this.context.createInvokeHandler('editor.insertHorizontalRule'),\n }).render();\n });\n\n this.context.memo('button.fullscreen', () => {\n return this.button({\n className: 'btn-fullscreen note-codeview-keep',\n contents: this.ui.icon(this.options.icons.arrowsAlt),\n tooltip: this.lang.options.fullscreen,\n click: this.context.createInvokeHandler('fullscreen.toggle'),\n }).render();\n });\n\n this.context.memo('button.codeview', () => {\n return this.button({\n className: 'btn-codeview note-codeview-keep',\n contents: this.ui.icon(this.options.icons.code),\n tooltip: this.lang.options.codeview,\n click: this.context.createInvokeHandler('codeview.toggle'),\n }).render();\n });\n\n this.context.memo('button.redo', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.redo),\n tooltip: this.lang.history.redo + this.representShortcut('redo'),\n click: this.context.createInvokeHandler('editor.redo'),\n }).render();\n });\n\n this.context.memo('button.undo', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.undo),\n tooltip: this.lang.history.undo + this.representShortcut('undo'),\n click: this.context.createInvokeHandler('editor.undo'),\n }).render();\n });\n\n this.context.memo('button.help', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.question),\n tooltip: this.lang.options.help,\n click: this.context.createInvokeHandler('helpDialog.show'),\n }).render();\n });\n }\n\n /**\n * image: [\n * ['imageResize', ['resizeFull', 'resizeHalf', 'resizeQuarter', 'resizeNone']],\n * ['float', ['floatLeft', 'floatRight', 'floatNone']],\n * ['remove', ['removeMedia']],\n * ],\n */\n addImagePopoverButtons() {\n // Image Size Buttons\n this.context.memo('button.resizeFull', () => {\n return this.button({\n contents: '<span class=\"note-fontsize-10\">100%</span>',\n tooltip: this.lang.image.resizeFull,\n click: this.context.createInvokeHandler('editor.resize', '1'),\n }).render();\n });\n this.context.memo('button.resizeHalf', () => {\n return this.button({\n contents: '<span class=\"note-fontsize-10\">50%</span>',\n tooltip: this.lang.image.resizeHalf,\n click: this.context.createInvokeHandler('editor.resize', '0.5'),\n }).render();\n });\n this.context.memo('button.resizeQuarter', () => {\n return this.button({\n contents: '<span class=\"note-fontsize-10\">25%</span>',\n tooltip: this.lang.image.resizeQuarter,\n click: this.context.createInvokeHandler('editor.resize', '0.25'),\n }).render();\n });\n this.context.memo('button.resizeNone', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.rollback),\n tooltip: this.lang.image.resizeNone,\n click: this.context.createInvokeHandler('editor.resize', '0'),\n }).render();\n });\n\n // Float Buttons\n this.context.memo('button.floatLeft', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.floatLeft),\n tooltip: this.lang.image.floatLeft,\n click: this.context.createInvokeHandler('editor.floatMe', 'left'),\n }).render();\n });\n\n this.context.memo('button.floatRight', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.floatRight),\n tooltip: this.lang.image.floatRight,\n click: this.context.createInvokeHandler('editor.floatMe', 'right'),\n }).render();\n });\n\n this.context.memo('button.floatNone', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.rollback),\n tooltip: this.lang.image.floatNone,\n click: this.context.createInvokeHandler('editor.floatMe', 'none'),\n }).render();\n });\n\n // Remove Buttons\n this.context.memo('button.removeMedia', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.trash),\n tooltip: this.lang.image.remove,\n click: this.context.createInvokeHandler('editor.removeMedia'),\n }).render();\n });\n }\n\n addLinkPopoverButtons() {\n this.context.memo('button.linkDialogShow', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.link),\n tooltip: this.lang.link.edit,\n click: this.context.createInvokeHandler('linkDialog.show'),\n }).render();\n });\n\n this.context.memo('button.unlink', () => {\n return this.button({\n contents: this.ui.icon(this.options.icons.unlink),\n tooltip: this.lang.link.unlink,\n click: this.context.createInvokeHandler('editor.unlink'),\n }).render();\n });\n }\n\n /**\n * table : [\n * ['add', ['addRowDown', 'addRowUp', 'addColLeft', 'addColRight']],\n * ['delete', ['deleteRow', 'deleteCol', 'deleteTable']]\n * ],\n */\n addTablePopoverButtons() {\n this.context.memo('button.addRowUp', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.rowAbove),\n tooltip: this.lang.table.addRowAbove,\n click: this.context.createInvokeHandler('editor.addRow', 'top'),\n }).render();\n });\n this.context.memo('button.addRowDown', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.rowBelow),\n tooltip: this.lang.table.addRowBelow,\n click: this.context.createInvokeHandler('editor.addRow', 'bottom'),\n }).render();\n });\n this.context.memo('button.addColLeft', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.colBefore),\n tooltip: this.lang.table.addColLeft,\n click: this.context.createInvokeHandler('editor.addCol', 'left'),\n }).render();\n });\n this.context.memo('button.addColRight', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.colAfter),\n tooltip: this.lang.table.addColRight,\n click: this.context.createInvokeHandler('editor.addCol', 'right'),\n }).render();\n });\n this.context.memo('button.deleteRow', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.rowRemove),\n tooltip: this.lang.table.delRow,\n click: this.context.createInvokeHandler('editor.deleteRow'),\n }).render();\n });\n this.context.memo('button.deleteCol', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.colRemove),\n tooltip: this.lang.table.delCol,\n click: this.context.createInvokeHandler('editor.deleteCol'),\n }).render();\n });\n this.context.memo('button.deleteTable', () => {\n return this.button({\n className: 'btn-md',\n contents: this.ui.icon(this.options.icons.trash),\n tooltip: this.lang.table.delTable,\n click: this.context.createInvokeHandler('editor.deleteTable'),\n }).render();\n });\n }\n\n build($container, groups) {\n for (let groupIdx = 0, groupLen = groups.length; groupIdx < groupLen; groupIdx++) {\n const group = groups[groupIdx];\n const groupName = Array.isArray(group) ? group[0] : group;\n const buttons = Array.isArray(group) ? ((group.length === 1) ? [group[0]] : group[1]) : [group];\n\n const $group = this.ui.buttonGroup({\n className: 'note-' + groupName,\n }).render();\n\n for (let idx = 0, len = buttons.length; idx < len; idx++) {\n const btn = this.context.memo('button.' + buttons[idx]);\n if (btn) {\n $group.append(typeof btn === 'function' ? btn(this.context) : btn);\n }\n }\n $group.appendTo($container);\n }\n }\n\n /**\n * @param {jQuery} [$container]\n */\n updateCurrentStyle($container) {\n const $cont = $container || this.$toolbar;\n\n const styleInfo = this.context.invoke('editor.currentStyle');\n this.updateBtnStates($cont, {\n '.note-btn-bold': () => {\n return styleInfo['font-bold'] === 'bold';\n },\n '.note-btn-italic': () => {\n return styleInfo['font-italic'] === 'italic';\n },\n '.note-btn-underline': () => {\n return styleInfo['font-underline'] === 'underline';\n },\n '.note-btn-subscript': () => {\n return styleInfo['font-subscript'] === 'subscript';\n },\n '.note-btn-superscript': () => {\n return styleInfo['font-superscript'] === 'superscript';\n },\n '.note-btn-strikethrough': () => {\n return styleInfo['font-strikethrough'] === 'strikethrough';\n },\n });\n\n if (styleInfo['font-family']) {\n const fontNames = styleInfo['font-family'].split(',').map((name) => {\n return name.replace(/[\\'\\\"]/g, '')\n .replace(/\\s+$/, '')\n .replace(/^\\s+/, '');\n });\n const fontName = lists.find(fontNames, this.isFontInstalled.bind(this));\n\n $cont.find('.dropdown-fontname a').each((idx, item) => {\n const $item = $(item);\n // always compare string to avoid creating another func.\n const isChecked = ($item.data('value') + '') === (fontName + '');\n $item.toggleClass('checked', isChecked);\n });\n $cont.find('.note-current-fontname').text(fontName).css('font-family', fontName);\n }\n\n if (styleInfo['font-size']) {\n const fontSize = styleInfo['font-size'];\n $cont.find('.dropdown-fontsize a').each((idx, item) => {\n const $item = $(item);\n // always compare with string to avoid creating another func.\n const isChecked = ($item.data('value') + '') === (fontSize + '');\n $item.toggleClass('checked', isChecked);\n });\n $cont.find('.note-current-fontsize').text(fontSize);\n\n const fontSizeUnit = styleInfo['font-size-unit'];\n $cont.find('.dropdown-fontsizeunit a').each((idx, item) => {\n const $item = $(item);\n const isChecked = ($item.data('value') + '') === (fontSizeUnit + '');\n $item.toggleClass('checked', isChecked);\n });\n $cont.find('.note-current-fontsizeunit').text(fontSizeUnit);\n }\n\n if (styleInfo['line-height']) {\n const lineHeight = styleInfo['line-height'];\n $cont.find('.dropdown-line-height a').each((idx, item) => {\n const $item = $(item);\n // always compare with string to avoid creating another func.\n const isChecked = ($(item).data('value') + '') === (lineHeight + '');\n $item.toggleClass('checked', isChecked);\n });\n $cont.find('.note-current-line-height').text(lineHeight);\n }\n }\n\n updateBtnStates($container, infos) {\n $.each(infos, (selector, pred) => {\n this.ui.toggleBtnActive($container.find(selector), pred());\n });\n }\n\n tableMoveHandler(event) {\n const PX_PER_EM = 18;\n const $picker = $(event.target.parentNode); // target is mousecatcher\n const $dimensionDisplay = $picker.next();\n const $catcher = $picker.find('.note-dimension-picker-mousecatcher');\n const $highlighted = $picker.find('.note-dimension-picker-highlighted');\n const $unhighlighted = $picker.find('.note-dimension-picker-unhighlighted');\n\n let posOffset;\n // HTML5 with jQuery - e.offsetX is undefined in Firefox\n if (event.offsetX === undefined) {\n const posCatcher = $(event.target).offset();\n posOffset = {\n x: event.pageX - posCatcher.left,\n y: event.pageY - posCatcher.top,\n };\n } else {\n posOffset = {\n x: event.offsetX,\n y: event.offsetY,\n };\n }\n\n const dim = {\n c: Math.ceil(posOffset.x / PX_PER_EM) || 1,\n r: Math.ceil(posOffset.y / PX_PER_EM) || 1,\n };\n\n $highlighted.css({ width: dim.c + 'em', height: dim.r + 'em' });\n $catcher.data('value', dim.c + 'x' + dim.r);\n\n if (dim.c > 3 && dim.c < this.options.insertTableMaxSize.col) {\n $unhighlighted.css({ width: dim.c + 1 + 'em' });\n }\n\n if (dim.r > 3 && dim.r < this.options.insertTableMaxSize.row) {\n $unhighlighted.css({ height: dim.r + 1 + 'em' });\n }\n\n $dimensionDisplay.html(dim.c + ' x ' + dim.r);\n }\n}\n","import $ from 'jquery';\nexport default class Toolbar {\n constructor(context) {\n this.context = context;\n\n this.$window = $(window);\n this.$document = $(document);\n\n this.ui = $.summernote.ui;\n this.$note = context.layoutInfo.note;\n this.$editor = context.layoutInfo.editor;\n this.$toolbar = context.layoutInfo.toolbar;\n this.$editable = context.layoutInfo.editable;\n this.$statusbar = context.layoutInfo.statusbar;\n this.options = context.options;\n\n this.isFollowing = false;\n this.followScroll = this.followScroll.bind(this);\n }\n\n shouldInitialize() {\n return !this.options.airMode;\n }\n\n initialize() {\n this.options.toolbar = this.options.toolbar || [];\n\n if (!this.options.toolbar.length) {\n this.$toolbar.hide();\n } else {\n this.context.invoke('buttons.build', this.$toolbar, this.options.toolbar);\n }\n\n if (this.options.toolbarContainer) {\n this.$toolbar.appendTo(this.options.toolbarContainer);\n }\n\n this.changeContainer(false);\n\n this.$note.on('summernote.keyup summernote.mouseup summernote.change', () => {\n this.context.invoke('buttons.updateCurrentStyle');\n });\n\n this.context.invoke('buttons.updateCurrentStyle');\n if (this.options.followingToolbar) {\n this.$window.on('scroll resize', this.followScroll);\n }\n }\n\n destroy() {\n this.$toolbar.children().remove();\n\n if (this.options.followingToolbar) {\n this.$window.off('scroll resize', this.followScroll);\n }\n }\n\n followScroll() {\n if (this.$editor.hasClass('fullscreen')) {\n return false;\n }\n\n const editorHeight = this.$editor.outerHeight();\n const editorWidth = this.$editor.width();\n const toolbarHeight = this.$toolbar.height();\n const statusbarHeight = this.$statusbar.height();\n\n // check if the web app is currently using another static bar\n let otherBarHeight = 0;\n if (this.options.otherStaticBar) {\n otherBarHeight = $(this.options.otherStaticBar).outerHeight();\n }\n\n const currentOffset = this.$document.scrollTop();\n const editorOffsetTop = this.$editor.offset().top;\n const editorOffsetBottom = editorOffsetTop + editorHeight;\n const activateOffset = editorOffsetTop - otherBarHeight;\n const deactivateOffsetBottom = editorOffsetBottom - otherBarHeight - toolbarHeight - statusbarHeight;\n\n if (!this.isFollowing &&\n (currentOffset > activateOffset) && (currentOffset < deactivateOffsetBottom - toolbarHeight)) {\n this.isFollowing = true;\n this.$editable.css({\n marginTop: this.$toolbar.outerHeight(),\n });\n this.$toolbar.css({\n position: 'fixed',\n top: otherBarHeight,\n width: editorWidth,\n zIndex: 1000,\n });\n } else if (this.isFollowing &&\n ((currentOffset < activateOffset) || (currentOffset > deactivateOffsetBottom))) {\n this.isFollowing = false;\n this.$toolbar.css({\n position: 'relative',\n top: 0,\n width: '100%',\n zIndex: 'auto',\n });\n this.$editable.css({\n marginTop: '',\n });\n }\n }\n\n changeContainer(isFullscreen) {\n if (isFullscreen) {\n this.$toolbar.prependTo(this.$editor);\n } else {\n if (this.options.toolbarContainer) {\n this.$toolbar.appendTo(this.options.toolbarContainer);\n }\n }\n if (this.options.followingToolbar) {\n this.followScroll();\n }\n }\n\n updateFullscreen(isFullscreen) {\n this.ui.toggleBtnActive(this.$toolbar.find('.btn-fullscreen'), isFullscreen);\n\n this.changeContainer(isFullscreen);\n }\n\n updateCodeview(isCodeview) {\n this.ui.toggleBtnActive(this.$toolbar.find('.btn-codeview'), isCodeview);\n if (isCodeview) {\n this.deactivate();\n } else {\n this.activate();\n }\n }\n\n activate(isIncludeCodeview) {\n let $btn = this.$toolbar.find('button');\n if (!isIncludeCodeview) {\n $btn = $btn.not('.note-codeview-keep');\n }\n this.ui.toggleBtn($btn, true);\n }\n\n deactivate(isIncludeCodeview) {\n let $btn = this.$toolbar.find('button');\n if (!isIncludeCodeview) {\n $btn = $btn.not('.note-codeview-keep');\n }\n this.ui.toggleBtn($btn, false);\n }\n}\n","import $ from 'jquery';\nimport env from '../core/env';\nimport key from '../core/key';\nimport func from '../core/func';\n\nconst MAILTO_PATTERN = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/;\nconst TEL_PATTERN = /^(\\+?\\d{1,3}[\\s-]?)?(\\d{1,4})[\\s-]?(\\d{1,4})[\\s-]?(\\d{1,4})$/;\nconst URL_SCHEME_PATTERN = /^([A-Za-z][A-Za-z0-9+-.]*\\:|#|\\/)/;\n\nexport default class LinkDialog {\n constructor(context) {\n this.context = context;\n\n this.ui = $.summernote.ui;\n this.$body = $(document.body);\n this.$editor = context.layoutInfo.editor;\n this.options = context.options;\n this.lang = this.options.langInfo;\n\n context.memo('help.linkDialog.show', this.options.langInfo.help['linkDialog.show']);\n }\n\n initialize() {\n const $container = this.options.dialogsInBody ? this.$body : this.options.container;\n const body = [\n '<div class=\"form-group note-form-group\">',\n `<label for=\"note-dialog-link-txt-${this.options.id}\" class=\"note-form-label\">${this.lang.link.textToDisplay}</label>`,\n `<input id=\"note-dialog-link-txt-${this.options.id}\" class=\"note-link-text form-control note-form-control note-input\" type=\"text\"/>`,\n '</div>',\n '<div class=\"form-group note-form-group\">',\n `<label for=\"note-dialog-link-url-${this.options.id}\" class=\"note-form-label\">${this.lang.link.url}</label>`,\n `<input id=\"note-dialog-link-url-${this.options.id}\" class=\"note-link-url form-control note-form-control note-input\" type=\"text\" value=\"http://\"/>`,\n '</div>',\n !this.options.disableLinkTarget\n ? $('<div></div>').append(this.ui.checkbox({\n className: 'sn-checkbox-open-in-new-window',\n text: this.lang.link.openInNewWindow,\n checked: true,\n }).render()).html()\n : '',\n ].join('');\n\n const buttonClass = 'btn btn-primary note-btn note-btn-primary note-link-btn';\n const footer = `<input type=\"button\" href=\"#\" class=\"${buttonClass}\" value=\"${this.lang.link.insert}\" disabled>`;\n\n this.$dialog = this.ui.dialog({\n className: 'link-dialog',\n title: this.lang.link.insert,\n fade: this.options.dialogsFade,\n body: body,\n footer: footer,\n }).render().appendTo($container);\n }\n\n destroy() {\n this.ui.hideDialog(this.$dialog);\n this.$dialog.remove();\n }\n\n bindEnterKey($input, $btn) {\n $input.on('keypress', (event) => {\n if (event.keyCode === key.code.ENTER) {\n event.preventDefault();\n $btn.trigger('click');\n }\n });\n }\n\n checkLinkUrl(linkUrl) {\n if (MAILTO_PATTERN.test(linkUrl)) {\n return 'mailto://' + linkUrl;\n } else if (TEL_PATTERN.test(linkUrl)) {\n return 'tel://' + linkUrl;\n } else if (!URL_SCHEME_PATTERN.test(linkUrl)) {\n return 'http://' + linkUrl;\n }\n return linkUrl;\n }\n\n onCheckLinkUrl($input) {\n $input.on('blur', (event) => {\n event.target.value =\n event.target.value == '' ? '' : this.checkLinkUrl(event.target.value);\n });\n }\n\n /**\n * toggle update button\n */\n toggleLinkBtn($linkBtn, $linkText, $linkUrl) {\n this.ui.toggleBtn($linkBtn, $linkText.val() && $linkUrl.val());\n }\n\n /**\n * Show link dialog and set event handlers on dialog controls.\n *\n * @param {Object} linkInfo\n * @return {Promise}\n */\n showLinkDialog(linkInfo) {\n return $.Deferred((deferred) => {\n const $linkText = this.$dialog.find('.note-link-text');\n const $linkUrl = this.$dialog.find('.note-link-url');\n const $linkBtn = this.$dialog.find('.note-link-btn');\n const $openInNewWindow = this.$dialog\n .find('.sn-checkbox-open-in-new-window input[type=checkbox]');\n\n this.ui.onDialogShown(this.$dialog, () => {\n this.context.triggerEvent('dialog.shown');\n\n // If no url was given and given text is valid URL then copy that into URL Field\n if (!linkInfo.url && func.isValidUrl(linkInfo.text)) {\n linkInfo.url = this.checkLinkUrl(linkInfo.text);\n }\n\n $linkText.on('input paste propertychange', () => {\n // If linktext was modified by input events,\n // cloning text from linkUrl will be stopped.\n let text = $linkText.val();\n let div = document.createElement('div');\n div.innerText = text;\n text = div.innerHTML;\n linkInfo.text = text;\n this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);\n }).val(linkInfo.text);\n\n $linkUrl.on('input paste propertychange', () => {\n // Display same text on `Text to display` as default\n // when linktext has no text\n if (!linkInfo.text) {\n $linkText.val($linkUrl.val());\n }\n this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);\n }).val(linkInfo.url);\n\n if (!env.isSupportTouch) {\n $linkUrl.trigger('focus');\n }\n\n this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);\n this.bindEnterKey($linkUrl, $linkBtn);\n this.bindEnterKey($linkText, $linkBtn);\n this.onCheckLinkUrl($linkUrl);\n\n const isNewWindowChecked = linkInfo.isNewWindow !== undefined\n ? linkInfo.isNewWindow : this.context.options.linkTargetBlank;\n\n $openInNewWindow.prop('checked', isNewWindowChecked);\n\n $linkBtn.one('click', (event) => {\n event.preventDefault();\n\n deferred.resolve({\n range: linkInfo.range,\n url: $linkUrl.val(),\n text: $linkText.val(),\n isNewWindow: $openInNewWindow.is(':checked'),\n });\n this.ui.hideDialog(this.$dialog);\n });\n });\n\n this.ui.onDialogHidden(this.$dialog, () => {\n // detach events\n $linkText.off();\n $linkUrl.off();\n $linkBtn.off();\n\n if (deferred.state() === 'pending') {\n deferred.reject();\n }\n });\n\n this.ui.showDialog(this.$dialog);\n }).promise();\n }\n\n /**\n * @param {Object} layoutInfo\n */\n show() {\n const linkInfo = this.context.invoke('editor.getLinkInfo');\n\n this.context.invoke('editor.saveRange');\n this.showLinkDialog(linkInfo).then((linkInfo) => {\n this.context.invoke('editor.restoreRange');\n this.context.invoke('editor.createLink', linkInfo);\n }).fail(() => {\n this.context.invoke('editor.restoreRange');\n });\n }\n}\n","import $ from 'jquery';\nimport lists from '../core/lists';\nimport dom from '../core/dom';\n\nexport default class LinkPopover {\n constructor(context) {\n this.context = context;\n\n this.ui = $.summernote.ui;\n this.options = context.options;\n this.events = {\n 'summernote.keyup summernote.mouseup summernote.change summernote.scroll': () => {\n this.update();\n },\n 'summernote.disable summernote.dialog.shown': () => {\n this.hide();\n },\n 'summernote.blur': (we, event) => {\n if (event.originalEvent && event.originalEvent.relatedTarget) {\n if (!this.$popover[0].contains(event.originalEvent.relatedTarget)) {\n this.hide();\n }\n } else {\n this.hide();\n }\n },\n };\n }\n\n shouldInitialize() {\n return !lists.isEmpty(this.options.popover.link);\n }\n\n initialize() {\n this.$popover = this.ui.popover({\n className: 'note-link-popover',\n callback: ($node) => {\n const $content = $node.find('.popover-content,.note-popover-content');\n $content.prepend('<span><a target=\"_blank\"></a>&nbsp;</span>');\n },\n }).render().appendTo(this.options.container);\n const $content = this.$popover.find('.popover-content,.note-popover-content');\n\n this.context.invoke('buttons.build', $content, this.options.popover.link);\n\n this.$popover.on('mousedown', (event) => { event.preventDefault(); });\n }\n\n destroy() {\n this.$popover.remove();\n }\n\n update() {\n // Prevent focusing on editable when invoke('code') is executed\n if (!this.context.invoke('editor.hasFocus')) {\n this.hide();\n return;\n }\n\n const rng = this.context.invoke('editor.getLastRange');\n if (rng.isCollapsed() && rng.isOnAnchor()) {\n const anchor = dom.ancestor(rng.sc, dom.isAnchor);\n const href = $(anchor).attr('href');\n this.$popover.find('a').attr('href', href).text(href);\n\n const pos = dom.posFromPlaceholder(anchor);\n const containerOffset = $(this.options.container).offset();\n pos.top -= containerOffset.top;\n pos.left -= containerOffset.left;\n\n this.$popover.css({\n display: 'block',\n left: pos.left,\n top: pos.top,\n });\n } else {\n this.hide();\n }\n }\n\n hide() {\n this.$popover.hide();\n }\n}\n","import $ from 'jquery';\nimport env from '../core/env';\nimport key from '../core/key';\n\nexport default class ImageDialog {\n constructor(context) {\n this.context = context;\n this.ui = $.summernote.ui;\n this.$body = $(document.body);\n this.$editor = context.layoutInfo.editor;\n this.options = context.options;\n this.lang = this.options.langInfo;\n }\n\n initialize() {\n let imageLimitation = '';\n if (this.options.maximumImageFileSize) {\n const unit = Math.floor(Math.log(this.options.maximumImageFileSize) / Math.log(1024));\n const readableSize = (this.options.maximumImageFileSize / Math.pow(1024, unit)).toFixed(2) * 1 +\n ' ' + ' KMGTP'[unit] + 'B';\n imageLimitation = `<small>${this.lang.image.maximumFileSize + ' : ' + readableSize}</small>`;\n }\n\n const $container = this.options.dialogsInBody ? this.$body : this.options.container;\n const body = [\n '<div class=\"form-group note-form-group note-group-select-from-files\">',\n '<label for=\"note-dialog-image-file-' + this.options.id + '\" class=\"note-form-label\">' + this.lang.image.selectFromFiles + '</label>',\n '<input id=\"note-dialog-image-file-' + this.options.id + '\" class=\"note-image-input form-control-file note-form-control note-input\" ',\n ' type=\"file\" name=\"files\" accept=\"'+this.options.acceptImageFileTypes+'\" multiple=\"multiple\"/>',\n imageLimitation,\n '</div>',\n '<div class=\"form-group note-group-image-url\">',\n '<label for=\"note-dialog-image-url-' + this.options.id + '\" class=\"note-form-label\">' + this.lang.image.url + '</label>',\n '<input id=\"note-dialog-image-url-' + this.options.id + '\" class=\"note-image-url form-control note-form-control note-input\" type=\"text\"/>',\n '</div>',\n ].join('');\n const buttonClass = 'btn btn-primary note-btn note-btn-primary note-image-btn';\n const footer = `<input type=\"button\" href=\"#\" class=\"${buttonClass}\" value=\"${this.lang.image.insert}\" disabled>`;\n\n this.$dialog = this.ui.dialog({\n title: this.lang.image.insert,\n fade: this.options.dialogsFade,\n body: body,\n footer: footer,\n }).render().appendTo($container);\n }\n\n destroy() {\n this.ui.hideDialog(this.$dialog);\n this.$dialog.remove();\n }\n\n bindEnterKey($input, $btn) {\n $input.on('keypress', (event) => {\n if (event.keyCode === key.code.ENTER) {\n event.preventDefault();\n $btn.trigger('click');\n }\n });\n }\n\n show() {\n this.context.invoke('editor.saveRange');\n this.showImageDialog().then((data) => {\n // [workaround] hide dialog before restore range for IE range focus\n this.ui.hideDialog(this.$dialog);\n this.context.invoke('editor.restoreRange');\n\n if (typeof data === 'string') { // image url\n // If onImageLinkInsert set,\n if (this.options.callbacks.onImageLinkInsert) {\n this.context.triggerEvent('image.link.insert', data);\n } else {\n this.context.invoke('editor.insertImage', data);\n }\n } else { // array of files\n this.context.invoke('editor.insertImagesOrCallback', data);\n }\n }).fail(() => {\n this.context.invoke('editor.restoreRange');\n });\n }\n\n /**\n * show image dialog\n *\n * @param {jQuery} $dialog\n * @return {Promise}\n */\n showImageDialog() {\n return $.Deferred((deferred) => {\n const $imageInput = this.$dialog.find('.note-image-input');\n const $imageUrl = this.$dialog.find('.note-image-url');\n const $imageBtn = this.$dialog.find('.note-image-btn');\n\n this.ui.onDialogShown(this.$dialog, () => {\n this.context.triggerEvent('dialog.shown');\n\n // Cloning imageInput to clear element.\n $imageInput.replaceWith($imageInput.clone().on('change', (event) => {\n deferred.resolve(event.target.files || event.target.value);\n }).val(''));\n\n $imageUrl.on('input paste propertychange', () => {\n this.ui.toggleBtn($imageBtn, $imageUrl.val());\n }).val('');\n\n if (!env.isSupportTouch) {\n $imageUrl.trigger('focus');\n }\n\n $imageBtn.on('click', (event) => {\n event.preventDefault();\n deferred.resolve($imageUrl.val());\n });\n\n this.bindEnterKey($imageUrl, $imageBtn);\n });\n\n this.ui.onDialogHidden(this.$dialog, () => {\n $imageInput.off();\n $imageUrl.off();\n $imageBtn.off();\n\n if (deferred.state() === 'pending') {\n deferred.reject();\n }\n });\n\n this.ui.showDialog(this.$dialog);\n });\n }\n}\n","import $ from 'jquery';\nimport lists from '../core/lists';\nimport dom from '../core/dom';\n\n/**\n * Image popover module\n * mouse events that show/hide popover will be handled by Handle.js.\n * Handle.js will receive the events and invoke 'imagePopover.update'.\n */\nexport default class ImagePopover {\n constructor(context) {\n this.context = context;\n this.ui = $.summernote.ui;\n\n this.editable = context.layoutInfo.editable[0];\n this.options = context.options;\n\n this.events = {\n 'summernote.disable summernote.dialog.shown': () => {\n this.hide();\n },\n 'summernote.blur': (we, event) => {\n if (event.originalEvent && event.originalEvent.relatedTarget) {\n if (!this.$popover[0].contains(event.originalEvent.relatedTarget)) {\n this.hide();\n }\n } else {\n this.hide();\n }\n },\n };\n }\n\n shouldInitialize() {\n return !lists.isEmpty(this.options.popover.image);\n }\n\n initialize() {\n this.$popover = this.ui.popover({\n className: 'note-image-popover',\n }).render().appendTo(this.options.container);\n const $content = this.$popover.find('.popover-content,.note-popover-content');\n this.context.invoke('buttons.build', $content, this.options.popover.image);\n\n this.$popover.on('mousedown', (event) => { event.preventDefault(); });\n }\n\n destroy() {\n this.$popover.remove();\n }\n\n update(target, event) {\n if (dom.isImg(target)) {\n const position = $(target).offset();\n const containerOffset = $(this.options.container).offset();\n let pos = {};\n if (this.options.popatmouse) {\n pos.left = event.pageX - 20;\n pos.top = event.pageY;\n } else {\n pos = position;\n }\n pos.top -= containerOffset.top;\n pos.left -= containerOffset.left;\n\n this.$popover.css({\n display: 'block',\n left: pos.left,\n top: pos.top,\n });\n } else {\n this.hide();\n }\n }\n\n hide() {\n this.$popover.hide();\n }\n}\n","import $ from 'jquery';\nimport env from '../core/env';\nimport lists from '../core/lists';\nimport dom from '../core/dom';\n\nexport default class TablePopover {\n constructor(context) {\n this.context = context;\n\n this.ui = $.summernote.ui;\n this.options = context.options;\n this.events = {\n 'summernote.mousedown': (we, event) => {\n this.update(event.target);\n },\n 'summernote.keyup summernote.scroll summernote.change': () => {\n this.update();\n },\n 'summernote.disable summernote.dialog.shown': () => {\n this.hide();\n },\n 'summernote.blur': (we, event) => {\n if (event.originalEvent && event.originalEvent.relatedTarget) {\n if (!this.$popover[0].contains(event.originalEvent.relatedTarget)) {\n this.hide();\n }\n } else {\n this.hide();\n }\n },\n };\n }\n\n shouldInitialize() {\n return !lists.isEmpty(this.options.popover.table);\n }\n\n initialize() {\n this.$popover = this.ui.popover({\n className: 'note-table-popover',\n }).render().appendTo(this.options.container);\n const $content = this.$popover.find('.popover-content,.note-popover-content');\n\n this.context.invoke('buttons.build', $content, this.options.popover.table);\n\n // [workaround] Disable Firefox's default table editor\n if (env.isFF) {\n document.execCommand('enableInlineTableEditing', false, false);\n }\n\n this.$popover.on('mousedown', (event) => { event.preventDefault(); });\n }\n\n destroy() {\n this.$popover.remove();\n }\n\n update(target) {\n if (this.context.isDisabled()) {\n return false;\n }\n\n const isCell = dom.isCell(target) || dom.isCell(target?.parentElement);\n\n if (isCell) {\n const pos = dom.posFromPlaceholder(target);\n const containerOffset = $(this.options.container).offset();\n pos.top -= containerOffset.top;\n pos.left -= containerOffset.left;\n\n this.$popover.css({\n display: 'block',\n left: pos.left,\n top: pos.top,\n });\n } else {\n this.hide();\n }\n\n return isCell;\n }\n\n hide() {\n this.$popover.hide();\n }\n}\n","import $ from 'jquery';\nimport env from '../core/env';\nimport key from '../core/key';\n\nexport default class VideoDialog {\n constructor(context) {\n this.context = context;\n\n this.ui = $.summernote.ui;\n this.$body = $(document.body);\n this.$editor = context.layoutInfo.editor;\n this.options = context.options;\n this.lang = this.options.langInfo;\n }\n\n initialize() {\n const $container = this.options.dialogsInBody ? this.$body : this.options.container;\n const body = [\n '<div class=\"form-group note-form-group row-fluid\">',\n `<label for=\"note-dialog-video-url-${this.options.id}\" class=\"note-form-label\">${this.lang.video.url} <small class=\"text-muted\">${this.lang.video.providers}</small></label>`,\n `<input id=\"note-dialog-video-url-${this.options.id}\" class=\"note-video-url form-control note-form-control note-input\" type=\"text\"/>`,\n '</div>',\n ].join('');\n const buttonClass = 'btn btn-primary note-btn note-btn-primary note-video-btn';\n const footer = `<input type=\"button\" href=\"#\" class=\"${buttonClass}\" value=\"${this.lang.video.insert}\" disabled>`;\n\n this.$dialog = this.ui.dialog({\n title: this.lang.video.insert,\n fade: this.options.dialogsFade,\n body: body,\n footer: footer,\n }).render().appendTo($container);\n }\n\n destroy() {\n this.ui.hideDialog(this.$dialog);\n this.$dialog.remove();\n }\n\n bindEnterKey($input, $btn) {\n $input.on('keypress', (event) => {\n if (event.keyCode === key.code.ENTER) {\n event.preventDefault();\n $btn.trigger('click');\n }\n });\n }\n\n createVideoNode(url) {\n // video url patterns(youtube, instagram, vimeo, dailymotion, youku, peertube, mp4, ogg, webm)\n const ytRegExp = /(?:youtu\\.be\\/|youtube\\.com\\/(?:[^\\/\\n\\s]+\\/\\S+\\/|(?:v|e(?:mbed)?)\\/|\\S*?[?&]v=|shorts\\/|live\\/))([^&\\n?]+)(?:.*[?&]t=([^&\\n]+))?.*/;\n const ytRegExpForStart = /^(?:(\\d+)h)?(?:(\\d+)m)?(?:(\\d+)s)?$/;\n const ytMatch = url.match(ytRegExp);\n\n const gdRegExp = /(?:\\.|\\/\\/)drive\\.google\\.com\\/file\\/d\\/(.[a-zA-Z0-9_-]*)\\/view/;\n const gdMatch = url.match(gdRegExp);\n\n const igRegExp = /(?:www\\.|\\/\\/)instagram\\.com\\/reel\\/(.[a-zA-Z0-9_-]*)/;\n const igMatch = url.match(igRegExp);\n\n const vRegExp = /\\/\\/vine\\.co\\/v\\/([a-zA-Z0-9]+)/;\n const vMatch = url.match(vRegExp);\n\n const vimRegExp = /\\/\\/(player\\.)?vimeo\\.com\\/([a-z]*\\/)*(\\d+)[?]?.*/;\n const vimMatch = url.match(vimRegExp);\n\n const dmRegExp = /.+dailymotion.com\\/(video|hub)\\/([^_]+)[^#]*(#video=([^_&]+))?/;\n const dmMatch = url.match(dmRegExp);\n\n const youkuRegExp = /\\/\\/v\\.youku\\.com\\/v_show\\/id_(\\w+)=*\\.html/;\n const youkuMatch = url.match(youkuRegExp);\n\n const peerTubeRegExp =/\\/\\/(.*)\\/videos\\/watch\\/([^?]*)(?:\\?(?:start=(\\w*))?(?:&stop=(\\w*))?(?:&loop=([10]))?(?:&autoplay=([10]))?(?:&muted=([10]))?)?/;\n const peerTubeMatch = url.match(peerTubeRegExp);\n\n const qqRegExp = /\\/\\/v\\.qq\\.com.*?vid=(.+)/;\n const qqMatch = url.match(qqRegExp);\n\n const qqRegExp2 = /\\/\\/v\\.qq\\.com\\/x?\\/?(page|cover).*?\\/([^\\/]+)\\.html\\??.*/;\n const qqMatch2 = url.match(qqRegExp2);\n\n const mp4RegExp = /^.+.(mp4|m4v)$/;\n const mp4Match = url.match(mp4RegExp);\n\n const oggRegExp = /^.+.(ogg|ogv)$/;\n const oggMatch = url.match(oggRegExp);\n\n const webmRegExp = /^.+.(webm)$/;\n const webmMatch = url.match(webmRegExp);\n\n const fbRegExp = /(?:www\\.|\\/\\/)facebook\\.com\\/([^\\/]+)\\/videos\\/([0-9]+)/;\n const fbMatch = url.match(fbRegExp);\n\n let $video;\n if (ytMatch && ytMatch[1].length === 11) {\n const youtubeId = ytMatch[1];\n var start = 0;\n if (typeof ytMatch[2] !== 'undefined') {\n const ytMatchForStart = ytMatch[2].match(ytRegExpForStart);\n if (ytMatchForStart) {\n for (var n = [3600, 60, 1], i = 0, r = n.length; i < r; i++) {\n start += (typeof ytMatchForStart[i + 1] !== 'undefined' ? n[i] * parseInt(ytMatchForStart[i + 1], 10) : 0);\n }\n }else{\n start = parseInt(ytMatch[2], 10);\n }\n }\n $video = $('<iframe>')\n .attr('frameborder', 0)\n .attr('src', '//www.youtube.com/embed/' + youtubeId + (start > 0 ? '?start=' + start : ''))\n .attr('width', '640').attr('height', '360');\n } else if (gdMatch && gdMatch[0].length) {\n $video = $('<iframe>')\n .attr('frameborder', 0)\n .attr('src', 'https://drive.google.com/file/d/' + gdMatch[1] + '/preview')\n .attr('width', '640').attr('height', '480');\n } else if (igMatch && igMatch[0].length) {\n $video = $('<iframe>')\n .attr('frameborder', 0)\n .attr('src', 'https://instagram.com/p/' + igMatch[1] + '/embed/')\n .attr('width', '612').attr('height', '710')\n .attr('scrolling', 'no')\n .attr('allowtransparency', 'true');\n } else if (vMatch && vMatch[0].length) {\n $video = $('<iframe>')\n .attr('frameborder', 0)\n .attr('src', vMatch[0] + '/embed/simple')\n .attr('width', '600').attr('height', '600')\n .attr('class', 'vine-embed');\n } else if (vimMatch && vimMatch[3].length) {\n $video = $('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>')\n .attr('frameborder', 0)\n .attr('src', '//player.vimeo.com/video/' + vimMatch[3])\n .attr('width', '640').attr('height', '360');\n } else if (dmMatch && dmMatch[2].length) {\n $video = $('<iframe>')\n .attr('frameborder', 0)\n .attr('src', '//www.dailymotion.com/embed/video/' + dmMatch[2])\n .attr('width', '640').attr('height', '360');\n } else if (youkuMatch && youkuMatch[1].length) {\n $video = $('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>')\n .attr('frameborder', 0)\n .attr('height', '498')\n .attr('width', '510')\n .attr('src', '//player.youku.com/embed/' + youkuMatch[1]);\n } else if (peerTubeMatch && peerTubeMatch[0].length){\n var begin = 0;\n if (peerTubeMatch[2] !== 'undefined') begin = peerTubeMatch[2];\n var end =0;\n if (peerTubeMatch[3] !== 'undefined') end = peerTubeMatch[3];\n var loop = 0;\n if (peerTubeMatch[4] !== 'undefined') loop = peerTubeMatch[4];\n var autoplay = 0;\n if (peerTubeMatch[5] !== 'undefined') autoplay = peerTubeMatch[5];\n var muted = 0;\n if (peerTubeMatch[6] !== 'undefined') muted = peerTubeMatch[6];\n $video = $('<iframe allowfullscreen sandbox=\"allow-same-origin allow-scripts allow-popups\">')\n .attr('frameborder', 0)\n .attr('src', '//'+ peerTubeMatch[1] +'/videos/embed/' + peerTubeMatch[2]+\"?loop=\"+loop\n +\"&autoplay=\"+autoplay+\"&muted=\"+muted +(begin > 0 ? '&start=' + begin : '')+(end > 0 ? '&end=' + start : ''))\n .attr('width', '560')\n .attr('height', '315');\n }else if ((qqMatch && qqMatch[1].length) || (qqMatch2 && qqMatch2[2].length)) {\n const vid = ((qqMatch && qqMatch[1].length) ? qqMatch[1] : qqMatch2[2]);\n $video = $('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>')\n .attr('frameborder', 0)\n .attr('height', '310')\n .attr('width', '500')\n .attr('src', 'https://v.qq.com/txp/iframe/player.html?vid=' + vid + '&amp;auto=0');\n } else if (mp4Match || oggMatch || webmMatch) {\n $video = $('<video controls>')\n .attr('src', url)\n .attr('width', '640').attr('height', '360');\n } else if (fbMatch && fbMatch[0].length) {\n $video = $('<iframe>')\n .attr('frameborder', 0)\n .attr('src', 'https://www.facebook.com/plugins/video.php?href=' + encodeURIComponent(fbMatch[0]) + '&show_text=0&width=560')\n .attr('width', '560').attr('height', '301')\n .attr('scrolling', 'no')\n .attr('allowtransparency', 'true');\n } else {\n // this is not a known video link. Now what, Cat? Now what?\n return false;\n }\n\n $video.addClass('note-video-clip');\n\n return $video[0];\n }\n\n show() {\n const text = this.context.invoke('editor.getSelectedText');\n this.context.invoke('editor.saveRange');\n this.showVideoDialog(text).then((url) => {\n // [workaround] hide dialog before restore range for IE range focus\n this.ui.hideDialog(this.$dialog);\n this.context.invoke('editor.restoreRange');\n\n // build node\n const $node = this.createVideoNode(url);\n\n if ($node) {\n // insert video node\n this.context.invoke('editor.insertNode', $node);\n }\n }).fail(() => {\n this.context.invoke('editor.restoreRange');\n });\n }\n\n /**\n * show video dialog\n *\n * @param {jQuery} $dialog\n * @return {Promise}\n */\n showVideoDialog(/* text */) {\n return $.Deferred((deferred) => {\n const $videoUrl = this.$dialog.find('.note-video-url');\n const $videoBtn = this.$dialog.find('.note-video-btn');\n\n this.ui.onDialogShown(this.$dialog, () => {\n this.context.triggerEvent('dialog.shown');\n\n $videoUrl.on('input paste propertychange', () => {\n this.ui.toggleBtn($videoBtn, $videoUrl.val());\n });\n\n if (!env.isSupportTouch) {\n $videoUrl.trigger('focus');\n }\n\n $videoBtn.on('click', (event) => {\n event.preventDefault();\n deferred.resolve($videoUrl.val());\n });\n\n this.bindEnterKey($videoUrl, $videoBtn);\n });\n\n this.ui.onDialogHidden(this.$dialog, () => {\n $videoUrl.off();\n $videoBtn.off();\n\n if (deferred.state() === 'pending') {\n deferred.reject();\n }\n });\n\n this.ui.showDialog(this.$dialog);\n });\n }\n}\n","import $ from 'jquery';\nimport env from '../core/env';\n\nexport default class HelpDialog {\n constructor(context) {\n this.context = context;\n\n this.ui = $.summernote.ui;\n this.$body = $(document.body);\n this.$editor = context.layoutInfo.editor;\n this.options = context.options;\n this.lang = this.options.langInfo;\n }\n\n initialize() {\n const $container = this.options.dialogsInBody ? this.$body : this.options.container;\n const body = [\n '<p class=\"text-center\">',\n '<a href=\"http://summernote.org/\" target=\"_blank\" rel=\"noopener noreferrer\">Summernote @@VERSION@@</a> · ',\n '<a href=\"https://github.com/summernote/summernote\" target=\"_blank\" rel=\"noopener noreferrer\">Project</a> · ',\n '<a href=\"https://github.com/summernote/summernote/issues\" target=\"_blank\" rel=\"noopener noreferrer\">Issues</a>',\n '</p>',\n ].join('');\n\n this.$dialog = this.ui.dialog({\n title: this.lang.options.help,\n fade: this.options.dialogsFade,\n body: this.createShortcutList(),\n footer: body,\n callback: ($node) => {\n $node.find('.modal-body,.note-modal-body').css({\n 'max-height': 300,\n 'overflow': 'scroll',\n });\n },\n }).render().appendTo($container);\n }\n\n destroy() {\n this.ui.hideDialog(this.$dialog);\n this.$dialog.remove();\n }\n\n createShortcutList() {\n const keyMap = this.options.keyMap[env.isMac ? 'mac' : 'pc'];\n return Object.keys(keyMap).map((key) => {\n const command = keyMap[key];\n const $row = $('<div><div class=\"help-list-item\"></div></div>');\n $row.append($('<label><kbd>' + key + '</kdb></label>').css({\n 'width': 180,\n 'margin-right': 10,\n })).append($('<span></span>').html(this.context.memo('help.' + command) || command));\n return $row.html();\n }).join('');\n }\n\n /**\n * show help dialog\n *\n * @return {Promise}\n */\n showHelpDialog() {\n return $.Deferred((deferred) => {\n this.ui.onDialogShown(this.$dialog, () => {\n this.context.triggerEvent('dialog.shown');\n deferred.resolve();\n });\n this.ui.showDialog(this.$dialog);\n }).promise();\n }\n\n show() {\n this.context.invoke('editor.saveRange');\n this.showHelpDialog().then(() => {\n this.context.invoke('editor.restoreRange');\n });\n }\n}\n","import $ from 'jquery';\nimport lists from '../core/lists';\nimport func from '../core/func';\n\nconst AIRMODE_POPOVER_X_OFFSET = -5;\nconst AIRMODE_POPOVER_Y_OFFSET = 5;\n\nexport default class AirPopover {\n constructor(context) {\n this.context = context;\n this.ui = $.summernote.ui;\n this.options = context.options;\n\n this.hidable = true;\n this.onContextmenu = false;\n this.pageX = null;\n this.pageY = null;\n\n this.events = {\n 'summernote.contextmenu': (event) => {\n if (this.options.editing) {\n event.preventDefault();\n event.stopPropagation();\n this.onContextmenu = true;\n this.update(true);\n }\n },\n 'summernote.mousedown': (we, event) => {\n this.pageX = event.pageX;\n this.pageY = event.pageY;\n },\n 'summernote.keyup summernote.mouseup summernote.scroll': (we, event) => {\n if (this.options.editing && !this.onContextmenu) {\n if (event.type == 'keyup') {\n let range = this.context.invoke('editor.getLastRange');\n let wordRange = range.getWordRange();\n const bnd = func.rect2bnd(lists.last(wordRange.getClientRects()));\n this.pageX = bnd.left;\n this.pageY = bnd.top;\n } else {\n this.pageX = event.pageX;\n this.pageY = event.pageY;\n }\n this.update();\n }\n this.onContextmenu = false;\n },\n 'summernote.disable summernote.change summernote.dialog.shown summernote.blur': () => {\n this.hide();\n },\n 'summernote.focusout': () => {\n if (!this.$popover.is(':active,:focus')) {\n this.hide();\n }\n },\n };\n }\n\n shouldInitialize() {\n return this.options.airMode && !lists.isEmpty(this.options.popover.air);\n }\n\n initialize() {\n this.$popover = this.ui.popover({\n className: 'note-air-popover',\n }).render().appendTo(this.options.container);\n const $content = this.$popover.find('.popover-content');\n\n this.context.invoke('buttons.build', $content, this.options.popover.air);\n\n // disable hiding this popover preemptively by 'summernote.blur' event.\n this.$popover.on('mousedown', () => { this.hidable = false; });\n // (re-)enable hiding after 'summernote.blur' has been handled (aka. ignored).\n this.$popover.on('mouseup', () => { this.hidable = true; });\n }\n\n destroy() {\n this.$popover.remove();\n }\n\n update(forcelyOpen) {\n const styleInfo = this.context.invoke('editor.currentStyle');\n if (styleInfo.range && (!styleInfo.range.isCollapsed() || forcelyOpen)) {\n let rect = {\n left: this.pageX,\n top: this.pageY,\n };\n\n const containerOffset = $(this.options.container).offset();\n rect.top -= containerOffset.top;\n rect.left -= containerOffset.left;\n\n this.$popover.css({\n display: 'block',\n left: Math.max(rect.left, 0) + AIRMODE_POPOVER_X_OFFSET,\n top: rect.top + AIRMODE_POPOVER_Y_OFFSET,\n });\n this.context.invoke('buttons.updateCurrentStyle', this.$popover);\n } else {\n this.hide();\n }\n }\n\n updateCodeview(isCodeview) {\n this.ui.toggleBtnActive(this.$popover.find('.btn-codeview'), isCodeview);\n if (isCodeview) {\n this.hide();\n }\n }\n\n hide() {\n if (this.hidable) {\n this.$popover.hide();\n }\n }\n}\n","import $ from 'jquery';\nimport func from '../core/func';\nimport lists from '../core/lists';\nimport dom from '../core/dom';\nimport range from '../core/range';\nimport key from '../core/key';\n\nconst POPOVER_DIST = 5;\n\nexport default class HintPopover {\n constructor(context) {\n this.context = context;\n\n this.ui = $.summernote.ui;\n this.$editable = context.layoutInfo.editable;\n this.options = context.options;\n this.hint = this.options.hint || [];\n this.direction = this.options.hintDirection || 'bottom';\n this.hints = Array.isArray(this.hint) ? this.hint : [this.hint];\n\n this.events = {\n 'summernote.keyup': (we, event) => {\n if (!event.isDefaultPrevented()) {\n this.handleKeyup(event);\n }\n },\n 'summernote.keydown': (we, event) => {\n this.handleKeydown(event);\n },\n 'summernote.disable summernote.dialog.shown summernote.blur': () => {\n this.hide();\n },\n };\n }\n\n shouldInitialize() {\n return this.hints.length > 0;\n }\n\n initialize() {\n this.lastWordRange = null;\n this.matchingWord = null;\n this.$popover = this.ui.popover({\n className: 'note-hint-popover',\n hideArrow: true,\n direction: '',\n }).render().appendTo(this.options.container);\n\n this.$popover.hide();\n this.$content = this.$popover.find('.popover-content,.note-popover-content');\n this.$content.on('click', '.note-hint-item', (event) => {\n this.$content.find('.active').removeClass('active');\n $(event.currentTarget).addClass('active');\n this.replace();\n });\n\n this.$popover.on('mousedown', (event) => { event.preventDefault(); });\n }\n\n destroy() {\n this.$popover.remove();\n }\n\n selectItem($item) {\n this.$content.find('.active').removeClass('active');\n $item.addClass('active');\n\n this.$content[0].scrollTop = $item[0].offsetTop - (this.$content.innerHeight() / 2);\n }\n\n moveDown() {\n const $current = this.$content.find('.note-hint-item.active');\n const $next = $current.next();\n\n if ($next.length) {\n this.selectItem($next);\n } else {\n let $nextGroup = $current.parent().next();\n\n if (!$nextGroup.length) {\n $nextGroup = this.$content.find('.note-hint-group').first();\n }\n\n this.selectItem($nextGroup.find('.note-hint-item').first());\n }\n }\n\n moveUp() {\n const $current = this.$content.find('.note-hint-item.active');\n const $prev = $current.prev();\n\n if ($prev.length) {\n this.selectItem($prev);\n } else {\n let $prevGroup = $current.parent().prev();\n\n if (!$prevGroup.length) {\n $prevGroup = this.$content.find('.note-hint-group').last();\n }\n\n this.selectItem($prevGroup.find('.note-hint-item').last());\n }\n }\n\n replace() {\n const $item = this.$content.find('.note-hint-item.active');\n\n if ($item.length) {\n var node = this.nodeFromItem($item);\n // If matchingWord length = 0 -> capture OK / open hint / but as mention capture \"\" (\\w*)\n if (this.matchingWord !== null && this.matchingWord.length === 0) {\n this.lastWordRange.so = this.lastWordRange.eo;\n // Else si > 0 and normal case -> adjust range \"before\" for correct position of insertion\n } else if (this.matchingWord !== null && this.matchingWord.length > 0 && !this.lastWordRange.isCollapsed()) {\n let rangeCompute = this.lastWordRange.eo - this.lastWordRange.so - this.matchingWord.length;\n if (rangeCompute > 0) {\n this.lastWordRange.so += rangeCompute;\n }\n }\n this.lastWordRange.insertNode(node);\n\n if (this.options.hintSelect === 'next') {\n var blank = document.createTextNode('');\n $(node).after(blank);\n range.createFromNodeBefore(blank).select();\n } else {\n range.createFromNodeAfter(node).select();\n }\n\n this.lastWordRange = null;\n this.hide();\n this.context.invoke('editor.focus');\n this.context.triggerEvent('change', this.$editable.html(), this.$editable);\n }\n }\n\n nodeFromItem($item) {\n const hint = this.hints[$item.data('index')];\n const item = $item.data('item');\n let node = hint.content ? hint.content(item) : item;\n if (typeof node === 'string') {\n node = dom.createText(node);\n }\n return node;\n }\n\n createItemTemplates(hintIdx, items) {\n const hint = this.hints[hintIdx];\n return items.map((item , idx) => {\n const $item = $('<div class=\"note-hint-item\"></div>');\n $item.append(hint.template ? hint.template(item) : item + '');\n $item.data({\n 'index': hintIdx,\n 'item': item,\n });\n\n if (hintIdx === 0 && idx === 0) {\n $item.addClass('active');\n }\n\n return $item;\n });\n }\n\n handleKeydown(event) {\n if (!this.$popover.is(':visible')) {\n return;\n }\n\n if (event.keyCode === key.code.ENTER) {\n event.preventDefault();\n this.replace();\n } else if (event.keyCode === key.code.UP) {\n event.preventDefault();\n this.moveUp();\n } else if (event.keyCode === key.code.DOWN) {\n event.preventDefault();\n this.moveDown();\n }\n }\n\n searchKeyword(index, keyword, callback) {\n const hint = this.hints[index];\n if (hint && hint.match.test(keyword) && hint.search) {\n const matches = hint.match.exec(keyword);\n this.matchingWord = matches[0];\n hint.search(matches[1], callback);\n } else {\n callback();\n }\n }\n\n createGroup(idx, keyword) {\n const $group = $('<div class=\"note-hint-group note-hint-group-' + idx + '\"></div>');\n this.searchKeyword(idx, keyword, (items) => {\n items = items || [];\n if (items.length) {\n $group.html(this.createItemTemplates(idx, items));\n this.show();\n }\n });\n\n return $group;\n }\n\n handleKeyup(event) {\n if (!lists.contains([key.code.ENTER, key.code.UP, key.code.DOWN], event.keyCode)) {\n let range = this.context.invoke('editor.getLastRange');\n let wordRange, keyword;\n if (this.options.hintMode === 'words') {\n wordRange = range.getWordsRange(range);\n keyword = wordRange.toString();\n\n this.hints.forEach((hint) => {\n if (hint.match.test(keyword)) {\n wordRange = range.getWordsMatchRange(hint.match);\n return false;\n }\n });\n\n if (!wordRange) {\n this.hide();\n return;\n }\n\n keyword = wordRange.toString();\n } else {\n wordRange = range.getWordRange();\n keyword = wordRange.toString();\n }\n\n if (this.hints.length && keyword) {\n this.$content.empty();\n\n const bnd = func.rect2bnd(lists.last(wordRange.getClientRects()));\n const containerOffset = $(this.options.container).offset();\n if (bnd) {\n bnd.top -= containerOffset.top;\n bnd.left -= containerOffset.left;\n\n this.$popover.hide();\n this.lastWordRange = wordRange;\n this.hints.forEach((hint, idx) => {\n if (hint.match.test(keyword)) {\n this.createGroup(idx, keyword).appendTo(this.$content);\n }\n });\n // select first .note-hint-item\n this.$content.find('.note-hint-item').first().addClass('active');\n\n // set position for popover after group is created\n if (this.direction === 'top') {\n this.$popover.css({\n left: bnd.left,\n top: bnd.top - this.$popover.outerHeight() - POPOVER_DIST,\n });\n } else {\n this.$popover.css({\n left: bnd.left,\n top: bnd.top + bnd.height + POPOVER_DIST,\n });\n }\n }\n } else {\n this.hide();\n }\n }\n }\n\n show() {\n this.$popover.show();\n }\n\n hide() {\n this.$popover.hide();\n }\n}\n","import $ from 'jquery';\nimport '../lang/summernote-en-US';\nimport './summernote';\nimport dom from './core/dom';\nimport range from './core/range';\nimport lists from './core/lists';\nimport Editor from './module/Editor';\nimport Clipboard from './module/Clipboard';\nimport Dropzone from './module/Dropzone';\nimport Codeview from './module/Codeview';\nimport Statusbar from './module/Statusbar';\nimport Fullscreen from './module/Fullscreen';\nimport Handle from './module/Handle';\nimport AutoLink from './module/AutoLink';\nimport AutoSync from './module/AutoSync';\nimport AutoReplace from './module/AutoReplace';\nimport Placeholder from './module/Placeholder';\nimport Buttons from './module/Buttons';\nimport Toolbar from './module/Toolbar';\nimport LinkDialog from './module/LinkDialog';\nimport LinkPopover from './module/LinkPopover';\nimport ImageDialog from './module/ImageDialog';\nimport ImagePopover from './module/ImagePopover';\nimport TablePopover from './module/TablePopover';\nimport VideoDialog from './module/VideoDialog';\nimport HelpDialog from './module/HelpDialog';\nimport AirPopover from './module/AirPopover';\nimport HintPopover from './module/HintPopover';\n\n$.summernote = $.extend($.summernote, {\n version: '@@VERSION@@',\n plugins: {},\n\n dom: dom,\n range: range,\n lists: lists,\n\n options: {\n langInfo: $.summernote.lang['en-US'],\n editing: true,\n modules: {\n 'editor': Editor,\n 'clipboard': Clipboard,\n 'dropzone': Dropzone,\n 'codeview': Codeview,\n 'statusbar': Statusbar,\n 'fullscreen': Fullscreen,\n 'handle': Handle,\n // FIXME: HintPopover must be front of autolink\n // - Script error about range when Enter key is pressed on hint popover\n 'hintPopover': HintPopover,\n 'autoLink': AutoLink,\n 'autoSync': AutoSync,\n 'autoReplace': AutoReplace,\n 'placeholder': Placeholder,\n 'buttons': Buttons,\n 'toolbar': Toolbar,\n 'linkDialog': LinkDialog,\n 'linkPopover': LinkPopover,\n 'imageDialog': ImageDialog,\n 'imagePopover': ImagePopover,\n 'tablePopover': TablePopover,\n 'videoDialog': VideoDialog,\n 'helpDialog': HelpDialog,\n 'airPopover': AirPopover,\n },\n\n buttons: {},\n\n lang: 'en-US',\n\n followingToolbar: false,\n toolbarPosition: 'top',\n otherStaticBar: '',\n\n // toolbar\n codeviewKeepButton: false,\n toolbar: [\n ['style', ['style']],\n ['font', ['bold', 'underline', 'clear']],\n ['fontname', ['fontname']],\n ['color', ['color']],\n ['para', ['ul', 'ol', 'paragraph']],\n ['table', ['table']],\n ['insert', ['link', 'picture', 'video']],\n ['view', ['fullscreen', 'codeview', 'help']],\n ],\n\n // popover\n popatmouse: true,\n popover: {\n image: [\n ['resize', ['resizeFull', 'resizeHalf', 'resizeQuarter', 'resizeNone']],\n ['float', ['floatLeft', 'floatRight', 'floatNone']],\n ['remove', ['removeMedia']],\n ],\n link: [\n ['link', ['linkDialogShow', 'unlink']],\n ],\n table: [\n ['add', ['addRowDown', 'addRowUp', 'addColLeft', 'addColRight']],\n ['delete', ['deleteRow', 'deleteCol', 'deleteTable']],\n ],\n air: [\n ['color', ['color']],\n ['font', ['bold', 'underline', 'clear']],\n ['para', ['ul', 'paragraph']],\n ['table', ['table']],\n ['insert', ['link', 'picture']],\n ['view', ['fullscreen', 'codeview']],\n ],\n },\n\n // link options\n linkAddNoReferrer: false,\n addLinkNoOpener: false,\n\n // air mode: inline editor\n airMode: false,\n overrideContextMenu: false, // TBD\n\n width: null,\n height: null,\n linkTargetBlank: true,\n\n focus: false,\n tabDisable: false,\n tabSize: 4,\n styleWithCSS: false,\n shortcuts: true,\n textareaAutoSync: true,\n tooltip: 'auto',\n container: null,\n maxTextLength: 0,\n blockquoteBreakingLevel: 2,\n spellCheck: true,\n disableGrammar: false,\n placeholder: null,\n inheritPlaceholder: false,\n // TODO: need to be documented\n recordEveryKeystroke: false,\n historyLimit: 200,\n\n // TODO: need to be documented\n showDomainOnlyForAutolink: false,\n\n // TODO: need to be documented\n hintMode: 'word',\n hintSelect: 'after',\n hintDirection: 'bottom',\n\n styleTags: ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],\n\n fontNames: [\n 'Arial', 'Arial Black', 'Comic Sans MS', 'Courier New',\n 'Helvetica Neue', 'Helvetica', 'Impact', 'Lucida Grande',\n 'Tahoma', 'Times New Roman', 'Verdana',\n ],\n fontNamesIgnoreCheck: [],\n addDefaultFonts: true,\n\n fontSizes: ['8', '9', '10', '11', '12', '14', '18', '24', '36'],\n\n fontSizeUnits: ['px', 'pt'],\n\n // pallete colors(n x n)\n colors: [\n ['#000000', '#424242', '#636363', '#9C9C94', '#CEC6CE', '#EFEFEF', '#F7F7F7', '#FFFFFF'],\n ['#FF0000', '#FF9C00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', '#9C00FF', '#FF00FF'],\n ['#F7C6CE', '#FFE7CE', '#FFEFC6', '#D6EFD6', '#CEDEE7', '#CEE7F7', '#D6D6E7', '#E7D6DE'],\n ['#E79C9C', '#FFC69C', '#FFE79C', '#B5D6A5', '#A5C6CE', '#9CC6EF', '#B5A5D6', '#D6A5BD'],\n ['#E76363', '#F7AD6B', '#FFD663', '#94BD7B', '#73A5AD', '#6BADDE', '#8C7BC6', '#C67BA5'],\n ['#CE0000', '#E79439', '#EFC631', '#6BA54A', '#4A7B8C', '#3984C6', '#634AA5', '#A54A7B'],\n ['#9C0000', '#B56308', '#BD9400', '#397B21', '#104A5A', '#085294', '#311873', '#731842'],\n ['#630000', '#7B3900', '#846300', '#295218', '#083139', '#003163', '#21104A', '#4A1031'],\n ],\n\n // http://chir.ag/projects/name-that-color/\n colorsName: [\n ['Black', 'Tundora', 'Dove Gray', 'Star Dust', 'Pale Slate', 'Gallery', 'Alabaster', 'White'],\n ['Red', 'Orange Peel', 'Yellow', 'Green', 'Cyan', 'Blue', 'Electric Violet', 'Magenta'],\n ['Azalea', 'Karry', 'Egg White', 'Zanah', 'Botticelli', 'Tropical Blue', 'Mischka', 'Twilight'],\n ['Tonys Pink', 'Peach Orange', 'Cream Brulee', 'Sprout', 'Casper', 'Perano', 'Cold Purple', 'Careys Pink'],\n ['Mandy', 'Rajah', 'Dandelion', 'Olivine', 'Gulf Stream', 'Viking', 'Blue Marguerite', 'Puce'],\n ['Guardsman Red', 'Fire Bush', 'Golden Dream', 'Chelsea Cucumber', 'Smalt Blue', 'Boston Blue', 'Butterfly Bush', 'Cadillac'],\n ['Sangria', 'Mai Tai', 'Buddha Gold', 'Forest Green', 'Eden', 'Venice Blue', 'Meteorite', 'Claret'],\n ['Rosewood', 'Cinnamon', 'Olive', 'Parsley', 'Tiber', 'Midnight Blue', 'Valentino', 'Loulou'],\n ],\n\n colorButton: {\n foreColor: '#000000',\n backColor: '#FFFF00',\n },\n\n lineHeights: ['1.0', '1.2', '1.4', '1.5', '1.6', '1.8', '2.0', '3.0'],\n\n tableClassName: 'table table-bordered',\n\n insertTableMaxSize: {\n col: 10,\n row: 10,\n },\n\n // By default, dialogs are attached in container.\n dialogsInBody: false,\n dialogsFade: false,\n\n maximumImageFileSize: null,\n acceptImageFileTypes: \"image/*\",\n\n allowClipboardImagePasting: true,\n\n callbacks: {\n onBeforeCommand: null,\n onBlur: null,\n onBlurCodeview: null,\n onChange: null,\n onChangeCodeview: null,\n onDialogShown: null,\n onEnter: null,\n onFocus: null,\n onImageLinkInsert: null,\n onImageUpload: null,\n onImageUploadError: null,\n onInit: null,\n onKeydown: null,\n onKeyup: null,\n onMousedown: null,\n onMouseup: null,\n onPaste: null,\n onScroll: null,\n },\n\n codemirror: {\n mode: 'text/html',\n htmlMode: true,\n lineNumbers: true,\n },\n\n codeviewFilter: true,\n codeviewFilterRegex: /<\\/*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|ilayer|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|t(?:itle|extarea)|xml)[^>]*?>/gi,\n codeviewIframeFilter: true,\n codeviewIframeWhitelistSrc: [],\n codeviewIframeWhitelistSrcBase: [\n 'www.youtube.com',\n 'www.youtube-nocookie.com',\n 'www.facebook.com',\n 'vine.co',\n 'instagram.com',\n 'player.vimeo.com',\n 'www.dailymotion.com',\n 'player.youku.com',\n 'jumpingbean.tv',\n 'v.qq.com',\n ],\n\n keyMap: {\n pc: {\n 'ESC': 'escape',\n 'ENTER': 'insertParagraph',\n 'CTRL+Z': 'undo',\n 'CTRL+Y': 'redo',\n 'TAB': 'tab',\n 'SHIFT+TAB': 'untab',\n 'CTRL+B': 'bold',\n 'CTRL+I': 'italic',\n 'CTRL+U': 'underline',\n 'CTRL+SHIFT+S': 'strikethrough',\n 'CTRL+BACKSLASH': 'removeFormat',\n 'CTRL+SHIFT+L': 'justifyLeft',\n 'CTRL+SHIFT+E': 'justifyCenter',\n 'CTRL+SHIFT+R': 'justifyRight',\n 'CTRL+SHIFT+J': 'justifyFull',\n 'CTRL+SHIFT+NUM7': 'insertUnorderedList',\n 'CTRL+SHIFT+NUM8': 'insertOrderedList',\n 'CTRL+LEFTBRACKET': 'outdent',\n 'CTRL+RIGHTBRACKET': 'indent',\n 'CTRL+NUM0': 'formatPara',\n 'CTRL+NUM1': 'formatH1',\n 'CTRL+NUM2': 'formatH2',\n 'CTRL+NUM3': 'formatH3',\n 'CTRL+NUM4': 'formatH4',\n 'CTRL+NUM5': 'formatH5',\n 'CTRL+NUM6': 'formatH6',\n 'CTRL+ENTER': 'insertHorizontalRule',\n 'CTRL+K': 'linkDialog.show',\n },\n\n mac: {\n 'ESC': 'escape',\n 'ENTER': 'insertParagraph',\n 'CMD+Z': 'undo',\n 'CMD+SHIFT+Z': 'redo',\n 'TAB': 'tab',\n 'SHIFT+TAB': 'untab',\n 'CMD+B': 'bold',\n 'CMD+I': 'italic',\n 'CMD+U': 'underline',\n 'CMD+SHIFT+S': 'strikethrough',\n 'CMD+BACKSLASH': 'removeFormat',\n 'CMD+SHIFT+L': 'justifyLeft',\n 'CMD+SHIFT+E': 'justifyCenter',\n 'CMD+SHIFT+R': 'justifyRight',\n 'CMD+SHIFT+J': 'justifyFull',\n 'CMD+SHIFT+NUM7': 'insertUnorderedList',\n 'CMD+SHIFT+NUM8': 'insertOrderedList',\n 'CMD+LEFTBRACKET': 'outdent',\n 'CMD+RIGHTBRACKET': 'indent',\n 'CMD+NUM0': 'formatPara',\n 'CMD+NUM1': 'formatH1',\n 'CMD+NUM2': 'formatH2',\n 'CMD+NUM3': 'formatH3',\n 'CMD+NUM4': 'formatH4',\n 'CMD+NUM5': 'formatH5',\n 'CMD+NUM6': 'formatH6',\n 'CMD+ENTER': 'insertHorizontalRule',\n 'CMD+K': 'linkDialog.show',\n },\n },\n icons: {\n 'align': 'note-icon-align',\n 'alignCenter': 'note-icon-align-center',\n 'alignJustify': 'note-icon-align-justify',\n 'alignLeft': 'note-icon-align-left',\n 'alignRight': 'note-icon-align-right',\n 'rowBelow': 'note-icon-row-below',\n 'colBefore': 'note-icon-col-before',\n 'colAfter': 'note-icon-col-after',\n 'rowAbove': 'note-icon-row-above',\n 'rowRemove': 'note-icon-row-remove',\n 'colRemove': 'note-icon-col-remove',\n 'indent': 'note-icon-align-indent',\n 'outdent': 'note-icon-align-outdent',\n 'arrowsAlt': 'note-icon-arrows-alt',\n 'bold': 'note-icon-bold',\n 'caret': 'note-icon-caret',\n 'circle': 'note-icon-circle',\n 'close': 'note-icon-close',\n 'code': 'note-icon-code',\n 'eraser': 'note-icon-eraser',\n 'floatLeft': 'note-icon-float-left',\n 'floatRight': 'note-icon-float-right',\n 'font': 'note-icon-font',\n 'frame': 'note-icon-frame',\n 'italic': 'note-icon-italic',\n 'link': 'note-icon-link',\n 'unlink': 'note-icon-chain-broken',\n 'magic': 'note-icon-magic',\n 'menuCheck': 'note-icon-menu-check',\n 'minus': 'note-icon-minus',\n 'orderedlist': 'note-icon-orderedlist',\n 'pencil': 'note-icon-pencil',\n 'picture': 'note-icon-picture',\n 'question': 'note-icon-question',\n 'redo': 'note-icon-redo',\n 'rollback': 'note-icon-rollback',\n 'square': 'note-icon-square',\n 'strikethrough': 'note-icon-strikethrough',\n 'subscript': 'note-icon-subscript',\n 'superscript': 'note-icon-superscript',\n 'table': 'note-icon-table',\n 'textHeight': 'note-icon-text-height',\n 'trash': 'note-icon-trash',\n 'underline': 'note-icon-underline',\n 'undo': 'note-icon-undo',\n 'unorderedlist': 'note-icon-unorderedlist',\n 'video': 'note-icon-video',\n },\n },\n});\n","import $ from 'jquery';\n\nclass Renderer {\n constructor(markup, children, options, callback) {\n this.markup = markup;\n this.children = children;\n this.options = options;\n this.callback = callback;\n }\n\n render($parent) {\n const $node = $(this.markup);\n\n if (this.options && this.options.contents) {\n $node.html(this.options.contents);\n }\n\n if (this.options && this.options.className) {\n $node.addClass(this.options.className);\n }\n\n if (this.options && this.options.data) {\n $.each(this.options.data, (k, v) => {\n $node.attr('data-' + k, v);\n });\n }\n\n if (this.options && this.options.click) {\n $node.on('click', this.options.click);\n }\n\n if (this.children) {\n const $container = $node.find('.note-children-container');\n this.children.forEach((child) => {\n child.render($container.length ? $container : $node);\n });\n }\n\n if (this.callback) {\n this.callback($node, this.options);\n }\n\n if (this.options && this.options.callback) {\n this.options.callback($node);\n }\n\n if ($parent) {\n $parent.append($node);\n }\n\n return $node;\n }\n}\n\nexport default {\n create: (markup, callback) => {\n return function() {\n const options = typeof arguments[1] === 'object' ? arguments[1] : arguments[0];\n let children = Array.isArray(arguments[0]) ? arguments[0] : [];\n if (options && options.children) {\n children = options.children;\n }\n return new Renderer(markup, children, options, callback);\n };\n },\n};\n","import $ from 'jquery';\nimport '/js/settings';\nimport renderer from '/js/renderer';\nimport './summernote-bs5.scss';\n\nconst editor = renderer.create('<div class=\"note-editor note-frame card\"></div>');\nconst toolbar = renderer.create('<div class=\"note-toolbar card-header\" role=\"toolbar\"></div>');\nconst editingArea = renderer.create('<div class=\"note-editing-area\"></div>');\nconst codable = renderer.create('<textarea class=\"note-codable\" aria-multiline=\"true\"></textarea>');\nconst editable = renderer.create('<div class=\"note-editable card-block\" contentEditable=\"true\" role=\"textbox\" aria-multiline=\"true\"/>');\nconst statusbar = renderer.create([\n '<output class=\"note-status-output\" role=\"status\" aria-live=\"polite\"></output>',\n '<div class=\"note-statusbar\" role=\"status\">',\n '<div class=\"note-resizebar\" aria-label=\"Resize\">',\n '<div class=\"note-icon-bar\"></div>',\n '<div class=\"note-icon-bar\"></div>',\n '<div class=\"note-icon-bar\"></div>',\n '</div>',\n '</div>',\n].join(''));\n\nconst airEditor = renderer.create('<div class=\"note-editor note-airframe\"></div>');\nconst airEditable = renderer.create([\n '<div class=\"note-editable\" contentEditable=\"true\" role=\"textbox\" aria-multiline=\"true\"></div>',\n '<output class=\"note-status-output\" role=\"status\" aria-live=\"polite\"></output>',\n].join(''));\n\nconst buttonGroup = renderer.create('<div class=\"note-btn-group btn-group\">');\n\nconst dropdown = renderer.create('<div class=\"note-dropdown-menu dropdown-menu\" role=\"list\">', function($node, options) {\n const markup = Array.isArray(options.items) ? options.items.map(function(item) {\n const value = (typeof item === 'string') ? item : (item.value || '');\n const content = options.template ? options.template(item) : item;\n const option = (typeof item === 'object') ? item.option : undefined;\n\n const dataValue = 'data-value=\"' + value + '\"';\n const dataOption = (option !== undefined) ? ' data-option=\"' + option + '\"' : '';\n return '<a class=\"dropdown-item\" href=\"#\" ' + (dataValue + dataOption) + ' role=\"listitem\" aria-label=\"' + value + '\">' + content + '</a>';\n }).join('') : options.items;\n\n $node.html(markup).attr({ 'aria-label': options.title });\n\n if (options && options.codeviewKeepButton) {\n $node.addClass('note-codeview-keep');\n }\n});\n\nconst dropdownButtonContents = function(contents) {\n return contents;\n};\n\nconst dropdownCheck = renderer.create('<div class=\"note-dropdown-menu dropdown-menu note-check\" role=\"list\">', function($node, options) {\n const markup = Array.isArray(options.items) ? options.items.map(function(item) {\n const value = (typeof item === 'string') ? item : (item.value || '');\n const content = options.template ? options.template(item) : item;\n return '<a class=\"dropdown-item\" href=\"#\" data-value=\"' + value + '\" role=\"listitem\" aria-label=\"' + item + '\">' + icon(options.checkClassName) + ' ' + content + '</a>';\n }).join('') : options.items;\n $node.html(markup).attr({ 'aria-label': options.title });\n\n if (options && options.codeviewKeepButton) {\n $node.addClass('note-codeview-keep');\n }\n});\n\nconst dialog = renderer.create('<div class=\"modal note-modal\" aria-hidden=\"false\" tabindex=\"-1\" role=\"dialog\"></div>', function($node, options) {\n if (options.fade) {\n $node.addClass('fade');\n }\n $node.attr({\n 'aria-label': options.title,\n });\n $node.html([\n '<div class=\"modal-dialog\">',\n '<div class=\"modal-content\">',\n (options.title ? '<div class=\"modal-header\">' +\n '<h4 class=\"modal-title\">' + options.title + '</h4>' +\n '<button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\" aria-hidden=\"true\"></button>' +\n '</div>' : ''),\n '<div class=\"modal-body\">' + options.body + '</div>',\n (options.footer ? '<div class=\"modal-footer\">' + options.footer + '</div>' : ''),\n '</div>',\n '</div>',\n ].join(''));\n});\n\nconst popover = renderer.create([\n '<div class=\"note-popover popover bs-popover-auto show\">',\n '<div class=\"popover-arrow\"></div>',\n '<div class=\"popover-body note-popover-content note-children-container\"></div>',\n '</div>',\n].join(''), function($node, options) {\n const direction = typeof options.direction !== 'undefined' ? options.direction : 'bottom';\n\n $node.attr('data-popper-placement', direction);\n\n if (options.hideArrow) {\n $node.find('.popover-arrow').hide();\n }\n});\n\nconst checkbox = renderer.create('<div class=\"form-check\"></div>', function($node, options) {\n $node.html([\n '<label class=\"form-check-label\"' + (options.id ? ' for=\"note-' + options.id + '\"' : '') + '>',\n '<input type=\"checkbox\" class=\"form-check-input\"' + (options.id ? ' id=\"note-' + options.id + '\"' : ''),\n (options.checked ? ' checked' : ''),\n ' aria-label=\"' + (options.text ? options.text : '') + '\"',\n ' aria-checked=\"' + (options.checked ? 'true' : 'false') + '\"/>',\n ' ' + (options.text ? options.text : '') +\n '</label>',\n ].join(''));\n});\n\nconst icon = function(iconClassName, tagName) {\n if (iconClassName.match(/^</)) {\n return iconClassName;\n }\n tagName = tagName || 'i';\n return '<' + tagName + ' class=\"' + iconClassName + '\"></' + tagName+'>';\n};\n\nconst ui = function(editorOptions) {\n return {\n editor: editor,\n toolbar: toolbar,\n editingArea: editingArea,\n codable: codable,\n editable: editable,\n statusbar: statusbar,\n airEditor: airEditor,\n airEditable: airEditable,\n buttonGroup: buttonGroup,\n dropdown: dropdown,\n dropdownButtonContents: dropdownButtonContents,\n dropdownCheck: dropdownCheck,\n dialog: dialog,\n popover: popover,\n icon: icon,\n checkbox: checkbox,\n options: editorOptions,\n\n palette: function($node, options) {\n return renderer.create('<div class=\"note-color-palette\"></div>', function($node, options) {\n const contents = [];\n for (let row = 0, rowSize = options.colors.length; row < rowSize; row++) {\n const eventName = options.eventName;\n const colors = options.colors[row];\n const colorsName = options.colorsName[row];\n const buttons = [];\n for (let col = 0, colSize = colors.length; col < colSize; col++) {\n const color = colors[col];\n const colorName = colorsName[col];\n buttons.push([\n '<button type=\"button\" class=\"note-color-btn\"',\n 'style=\"background-color:', color, '\" ',\n 'data-event=\"', eventName, '\" ',\n 'data-value=\"', color, '\" ',\n 'title=\"', colorName, '\" ',\n 'aria-label=\"', colorName, '\" ',\n 'data-toggle=\"button\" tabindex=\"-1\"></button>',\n ].join(''));\n }\n contents.push('<div class=\"note-color-row\">' + buttons.join('') + '</div>');\n }\n $node.html(contents.join(''));\n\n if (options.tooltip) {\n $node.find('.note-color-btn').tooltip({\n container: options.container || editorOptions.container,\n trigger: 'hover',\n placement: 'bottom',\n });\n }\n })($node, options);\n },\n\n button: function($node, options) {\n return renderer.create('<button type=\"button\" class=\"note-btn btn btn-outline-secondary btn-sm\" tabindex=\"-1\">', function($node, options) {\n if (options && options.data && options.data.toggle === 'dropdown') {\n $node.removeAttr('data-toggle');\n $node.attr('data-bs-toggle', 'dropdown');\n if (options && options.tooltip) {\n $node.attr({\n title: options.tooltip,\n 'aria-label': options.tooltip,\n });\n }\n } else if (options && options.tooltip) {\n $node.attr({\n title: options.tooltip,\n 'aria-label': options.tooltip,\n }).tooltip({\n container: options.container || editorOptions.container,\n trigger: 'hover',\n placement: 'bottom',\n }).on('click', (e) => {\n $(e.currentTarget).tooltip('hide');\n });\n }\n if (options && options.codeviewButton) {\n $node.addClass('note-codeview-keep');\n }\n })($node, options);\n },\n\n toggleBtn: function($btn, isEnable) {\n $btn.toggleClass('disabled', !isEnable);\n $btn.attr('disabled', !isEnable);\n },\n\n toggleBtnActive: function($btn, isActive) {\n $btn.toggleClass('active', isActive);\n },\n\n onDialogShown: function($dialog, handler) {\n $dialog.one('shown.bs.modal', handler);\n },\n\n onDialogHidden: function($dialog, handler) {\n $dialog.one('hidden.bs.modal', handler);\n },\n\n showDialog: function($dialog) {\n $dialog.modal('show');\n },\n\n hideDialog: function($dialog) {\n $dialog.modal('hide');\n },\n\n createLayout: function($note) {\n const $editor = (editorOptions.airMode ? airEditor([\n editingArea([\n codable(),\n airEditable(),\n ]),\n ]) : (editorOptions.toolbarPosition === 'bottom'\n ? editor([\n editingArea([\n codable(),\n editable(),\n ]),\n toolbar(),\n statusbar(),\n ])\n : editor([\n toolbar(),\n editingArea([\n codable(),\n editable(),\n ]),\n statusbar(),\n ])\n )).render();\n\n $editor.insertAfter($note);\n\n return {\n note: $note,\n editor: $editor,\n toolbar: $editor.find('.note-toolbar'),\n editingArea: $editor.find('.note-editing-area'),\n editable: $editor.find('.note-editable'),\n codable: $editor.find('.note-codable'),\n statusbar: $editor.find('.note-statusbar'),\n };\n },\n\n removeLayout: function($note, layoutInfo) {\n $note.html(layoutInfo.editable.html());\n layoutInfo.editor.remove();\n $note.show();\n },\n };\n};\n\n$.summernote = $.extend($.summernote, {\n ui_template: ui,\n interface: 'bs5',\n});\n\n$.summernote.options.styleTags = [\n 'p',\n { title: 'Blockquote', tag: 'blockquote', className: 'blockquote', value: 'blockquote' },\n 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',\n];\n"],"names":["$","summernote","lang","extend","font","bold","italic","underline","clear","height","name","strikethrough","subscript","superscript","size","sizeunit","image","insert","resizeFull","resizeHalf","resizeQuarter","resizeNone","floatLeft","floatRight","floatNone","shapeRounded","shapeCircle","shapeThumbnail","shapeNone","dragImageHere","dropImage","selectFromFiles","maximumFileSize","maximumFileSizeError","url","remove","original","video","videoLink","providers","link","unlink","edit","textToDisplay","openInNewWindow","table","addRowAbove","addRowBelow","addColLeft","addColRight","delRow","delCol","delTable","hr","style","p","blockquote","pre","h1","h2","h3","h4","h5","h6","lists","unordered","ordered","options","help","fullscreen","codeview","paragraph","outdent","indent","left","center","right","justify","color","recent","more","background","foreground","transparent","setTransparent","reset","resetToDefault","cpSelect","shortcut","shortcuts","close","textFormatting","action","paragraphFormatting","documentStyle","extraKeys","history","undo","redo","specialChar","select","output","noSelection","genericFontFamilies","validFontName","fontName","inArray","toLowerCase","isFontInstalled","testFontName","testText","fontSize","canvasWidth","canvasHeight","canvas","document","createElement","context","getContext","width","textAlign","fillStyle","textBaseline","getPxInfo","s","clearRect","fillText","pxInfo","getImageData","data","CanvasPixelArray","prototype","join","i","length","toString","testInfo","fontInfo","userAgent","navigator","isMSIE","test","browserVersion","matches","exec","parseFloat","isEdge","isSupportTouch","window","MaxTouchPoints","msMaxTouchPoints","inputEventName","isMac","appVersion","indexOf","isFF","isPhantom","isWebkit","isChrome","isSafari","isW3CRangeSupport","createRange","eq","itemA","itemB","eq2","peq2","propName","ok","fail","not","f","apply","arguments","and","fA","fB","item","self","a","invoke","obj","method","idCounter","resetUniqueId","uniqueId","prefix","id","rect2bnd","rect","$document","top","scrollTop","scrollLeft","bottom","invertObject","inverted","key","Object","hasOwnProperty","call","namespaceToCamel","namespace","split","map","substring","toUpperCase","debounce","func","wait","immediate","timeout","args","later","callNow","clearTimeout","setTimeout","isValidUrl","expression","head","array","last","initial","slice","tail","find","pred","idx","len","all","contains","sum","fn","reduce","memo","v","from","collection","result","isEmpty","clusterBy","aTail","aLast","compact","aResult","push","unique","results","next","prev","env","NBSP_CHAR","String","fromCharCode","ZERO_WIDTH_NBSP_CHAR","isEditable","node","hasClass","isControlSizing","makePredByNodeName","nodeName","isText","nodeType","isElement","isVoid","isPara","isHeading","isPre","isLi","isPurePara","isTable","isData","isInline","isBodyContainer","isList","isHr","isBlockquote","isCell","isAnchor","isParaInline","ancestor","isBodyInline","isBody","isClosestSibling","nodeA","nodeB","nextSibling","previousSibling","withClosestSiblings","siblings","blankHTML","nodeLength","nodeValue","childNodes","deepestChildIsEmpty","firstElementChild","innerHTML","paddingBlankHTML","parentNode","singleChildAncestor","listAncestor","ancestors","el","lastAncestor","filter","commonAncestor","n","listPrev","nodes","listNext","listDescendant","descendants","fnWalk","current","wrap","wrapperName","parent","wrapper","insertBefore","appendChild","insertAfter","preceding","appendChildNodes","aChild","each","child","firstChild","create","isLeftEdgePoint","point","offset","isRightEdgePoint","isEdgePoint","isLeftEdgeOf","position","isRightEdgeOf","isLeftEdgePointOf","isRightEdgePointOf","hasChildren","prevPoint","isSkipInnerOffset","nextPoint","nextTextNode","getNextTextNode","nextPointWithEmptyNode","actual","undefined","isSamePoint","pointA","pointB","isVisiblePoint","leftNode","rightNode","prevPointUntil","nextPointUntil","isCharPoint","ch","charAt","isSpacePoint","walkPoint","startPoint","endPoint","handler","isSkipOffset","makeOffsetPath","reverse","fromOffsetPath","offsets","splitNode","isSkipPaddingBlankHTML","isNotSplitEdgePoint","isDiscardEmptySplits","splitText","childNode","clone","cloneNode","splitTree","root","domList","ifHasNextSibling","nestSibling","textNode","match","splitPoint","topAncestor","splitRoot","container","pivot","createText","text","createTextNode","isRemoveChild","removeNode","removeChild","removeWhile","replace","newNode","cssText","isTextarea","value","$node","stripLinebreaks","val","html","isNewlineOnBlock","markup","regexTag","endSlash","isEndOfInlineContainer","isBlockNode","trim","posFromPlaceholder","placeholder","$placeholder","pos","outerHeight","attachEvents","events","keys","forEach","on","detachEvents","off","isCustomStyleTag","classList","blank","emptyPara","isBlock","isDiv","isBR","isSpan","isB","isU","isS","isI","isImg","isEmptyAnchor","dom","Context","$note","memos","modules","layoutInfo","ui","ui_template","initialize","createLayout","_initialize","hide","_destroy","removeData","removeLayout","disabled","isDisabled","code","disable","now","editor","buttons","plugins","module","initializeModule","removeModule","removeMemo","triggerEvent","isActivated","codable","editable","attr","editing","callback","callbacks","trigger","shouldInitialize","ModuleClass","withoutIntialize","destroy","event","createInvokeHandler","preventDefault","$target","target","closest","splits","hasSeparator","moduleName","methodName","type","isExternalAPICalled","hasInitOptions","langInfo","icons","tooltip","note","first","focus","textRangeToPoint","textRange","isStart","parentElement","tester","body","createTextRange","prevContainer","moveToElementText","compareEndPoints","textRangeStart","curTextNode","collapse","pointTester","duplicate","setEndPoint","textCount","dummy","cont","pointToTextRange","textRangeInfo","isCollapseToStart","prevTextNodes","collapseToStart","info","moveStart","WrappedRange","sc","so","ec","eo","isOnEditable","makeIsOn","isOnList","isOnAnchor","isOnCell","isOnData","w3cRange","setStart","setEnd","nativeRng","nativeRange","selection","getSelection","rangeCount","removeAllRanges","addRange","offsetTop","Math","abs","getVisiblePoint","isLeftToRight","block","hasRightNode","hasLeftNode","getEndPoint","isCollapsed","getStartPoint","includeAncestor","fullyContains","leftEdgeNodes","startAncestor","endAncestor","boundaryPoints","getPoints","isSameContainer","rng","emptyParents","normalize","inlineSiblings","concat","para","doNotInsertPara","wrapBodyInlineWithPara","deleteContents","contentsContainer","reversed","insertNode","findAfter","isNotTextPoint","regex","index","path","e","paras","getClientRects","wrappedRange","createFromSelection","bodyElement","lastChild","createFromBodyElement","createFromNode","anchorNode","getRangeAt","startContainer","startOffset","endContainer","endOffset","textRangeEnd","isTextNode","createFromNodeBefore","createFromNodeAfter","createFromBookmark","bookmark","createFromParaBookmark","KEY_MAP","isEdit","keyCode","BACKSPACE","TAB","ENTER","SPACE","DELETE","isRemove","isMove","LEFT","UP","RIGHT","DOWN","isNavigation","HOME","END","PAGEUP","PAGEDOWN","nameFromCode","readFileAsDataURL","file","Deferred","deferred","FileReader","onload","dataURL","resolve","onerror","err","reject","readAsDataURL","promise","createImage","$img","one","detach","css","display","appendTo","range","History","stack","stackOffset","$editable","emptyBookmark","contents","snapshot","recordUndo","applySnapshot","makeSnapshot","historyLimit","shift","Style","$obj","propertyNames","propertyName","properties","styleInfo","jQueryCSS","parseInt","expandClosestSibling","onlyPartialContains","nodesInRange","tails","elem","$cont","fromNode","queryCommandState","queryCommandValue","orderedTypes","isUnordered","lineHeight","toFixed","anchor","Bullet","toggleList","clustereds","previousList","findList","previousElementSibling","wrapList","appendToPrevious","releaseList","listName","paraBookmark","wrappedParas","diffLists","listNode","prevList","nextList","nextElementSibling","isEscapseToBody","releasedParas","headList","parentItem","newList","findNextElementSiblings","children","textContent","lastList","middleList","rootLists","rootList","listNodes","Typing","bullet","tabsize","tab","Array","nextPara","blockquoteBreakingLevel","emptyAnchors","scrollIntoView","TableResultAction","where","domTable","_startPoint","_virtualTable","_actionCellList","setStartPoint","tagName","colPos","cellIndex","rowPos","rowIndex","setVirtualTablePosition","baseRow","baseCell","isRowSpan","isColSpan","isVirtualCell","objPosition","getActionCell","virtualTableCellObj","resultAction","virtualRowPosition","virtualColPosition","recoverCellIndex","newCellIndex","addCellInfoToVirtual","row","cell","cellHasColspan","colSpan","cellHasRowspan","rowSpan","isThisSelectedCell","rowspanNumber","attributes","rp","rowspanIndex","adjustStartPoint","colspanNumber","cp","cellspanIndex","isSelectedCell","createVirtualTable","rows","cells","getDeleteResultActionToCell","Column","SubtractSpanCount","Row","isVirtual","AddCell","RemoveCell","getAddResultActionToCell","SumSpanCount","Ignore","init","getActionList","fixedRow","fixedCol","actualPosition","canContinue","rowPosition","colPosition","requestAction","Add","Delete","Table","isShift","nextCell","currentTr","trAttributes","recoverAttributes","vTable","actions","idCell","currentCell","tdAttributes","append","baseCellTr","isTopFromRowSpan","newTd","removeAttr","setAttribute","before","lastTrIndex","after","rowsGroup","actionIndex","resultStr","attrList","specified","cellPos","virtualPosition","virtualTable","hasRowspan","nextRow","cloneRow","removeAttribute","hasColspan","colCount","rowCount","tds","tdHTML","idxCol","trs","trHTML","idxRow","$table","tableClassName","addClass","KEY_BOGUS","MAILTO_PATTERN","TEL_PATTERN","URL_SCHEME_PATTERN","Editor","$editor","lastRange","typing","escape","untab","insertParagraph","insertOrderedList","insertUnorderedList","formatPara","insertHorizontalRule","commands","sCmd","beforeCommand","execCommand","afterCommand","wrapCommand","fontStyling","unit","currentStyle","fontSizeUnit","formatBlock","isLimited","getLastRange","setLastRange","insertText","pasteHTML","onApplyCustomStyle","onFormatBlock","hrNode","stylePara","createLink","linkInfo","rel","linkUrl","linkText","isNewWindow","addNoReferrer","linkAddNoReferrer","addNoOpener","linkAddNoOpener","additionalTextLength","isTextChanged","onCreateLink","checkLinkUrl","anchors","styleNodes","createRangeFromList","colorInfo","foreColor","backColor","insertTable","dim","dimension","createTable","removeMedia","restoreTarget","floatMe","toggleClass","resize","hasKeyShortCut","isDefaultPrevented","handleKeyMap","preventDefaultEditableShortCuts","recordEveryKeystroke","spellCheck","disableGrammar","airMode","overrideContextMenu","outerWidth","maxHeight","minHeight","keyMap","metaKey","ctrlKey","altKey","shiftKey","keyName","eventName","tabDisable","pad","maxTextLength","lst","startRange","endRange","thenCollapse","commit","styleWithCSS","isPreventTrigger","normalizeContent","tabSize","insertTab","childElementCount","src","param","then","$image","min","show","files","filename","maximumImageFileSize","insertImage","onImageUpload","insertImagesAsDataURL","currentRange","$parent","removeClass","className","spans","firstSpan","noteStatusOutput","hasFocus","expand","$anchor","addRow","addCol","deleteRow","deleteCol","deleteTable","bKeepRatio","imageSize","newRatio","y","x","ratio","is","Clipboard","pasteByEvent","bind","clipboardData","originalEvent","items","clipboardFiles","clipboardText","getData","allowClipboardImagePasting","Dropzone","$eventListener","documentEventHandlers","$dropzone","prependTo","disableDragAndDrop","onDrop","attachDragAndDropEvent","$dropzoneMessage","onDragenter","isCodeview","hasEditorSize","add","onDragleave","dataTransfer","types","content","CodeView","$codable","CodeMirrorConstructor","CodeMirror","codemirror","getDoc","setValue","save","ESCAPE","deactivate","activate","codeviewFilter","codeviewFilterRegex","codeviewIframeFilter","whitelist","codeviewIframeWhitelistSrc","codeviewIframeWhitelistSrcBase","tag","RegExp","prettifyHtml","cmEditor","fromTextArea","tern","server","TernServer","ternServer","cm","updateArgHints","getValue","setSize","toTextArea","purify","isChange","EDITABLE_PADDING","Statusbar","$statusbar","statusbar","disableResizeEditor","stopPropagation","editableTop","editableCodeTop","onStatusbarMove","touches","clientY","heightCode","minheight","max","Fullscreen","$toolbar","toolbar","$window","$scrollbar","scrollbarClassName","onResize","resizeTo","h","setsize","isFullscreen","Handle","$editingArea","editingArea","we","update","$handle","disableResizeImage","posStart","onMouseMove","clientX","isImage","$selection","areaRect","getBoundingClientRect","imageRect","origImageObj","Image","sizingText","defaultScheme","linkPattern","AutoLink","handleKeyup","handleKeydown","lastWordRange","keyword","urlText","showDomainOnlyForAutolink","linkTargetBlank","wordRange","getWordRange","AutoSync","AutoReplace","PERIOD","COMMA","SEMICOLON","SLASH","previousKeydownCode","lastWord","jQuery","Node","Placeholder","inheritPlaceholder","isShow","toggle","Buttons","invertedKeyMap","editorMethod","o","button","addToolbarButtons","addImagePopoverButtons","addLinkPopoverButtons","addTablePopoverButtons","fontInstalledMap","fontNamesIgnoreCheck","buttonGroup","icon","click","$button","currentTarget","$recentColor","colorButton","dropdownButtonContents","dropdown","$dropdown","$holder","palette","colors","colorsName","render","customColors","$chip","$picker","$palette","prepend","$color","$currentButton","magic","styleTags","title","template","styleIdx","styleLen","representShortcut","createInvokeHandlerAndUpdateState","eraser","addDefaultFonts","fontname","isFontDeservedToAdd","fontNames","dropdownCheck","checkClassName","menuCheck","fontSizes","fontSizeUnits","colorPalette","unorderedlist","orderedlist","justifyLeft","alignLeft","justifyCenter","alignCenter","justifyRight","alignRight","justifyFull","alignJustify","textHeight","lineHeights","$catcher","insertTableMaxSize","col","tableMoveHandler","picture","minus","arrowsAlt","question","rollback","trash","rowAbove","rowBelow","colBefore","colAfter","rowRemove","colRemove","$container","groups","groupIdx","groupLen","group","groupName","isArray","$group","btn","updateBtnStates","$item","isChecked","infos","selector","toggleBtnActive","PX_PER_EM","$dimensionDisplay","$highlighted","$unhighlighted","posOffset","offsetX","posCatcher","pageX","pageY","offsetY","c","ceil","r","Toolbar","isFollowing","followScroll","toolbarContainer","changeContainer","followingToolbar","editorHeight","editorWidth","toolbarHeight","statusbarHeight","otherBarHeight","otherStaticBar","currentOffset","editorOffsetTop","editorOffsetBottom","activateOffset","deactivateOffsetBottom","marginTop","zIndex","isIncludeCodeview","$btn","toggleBtn","LinkDialog","$body","dialogsInBody","disableLinkTarget","checkbox","checked","buttonClass","footer","$dialog","dialog","fade","dialogsFade","hideDialog","$input","$linkBtn","$linkText","$linkUrl","$openInNewWindow","onDialogShown","div","innerText","toggleLinkBtn","bindEnterKey","onCheckLinkUrl","isNewWindowChecked","prop","onDialogHidden","state","showDialog","showLinkDialog","LinkPopover","relatedTarget","$popover","popover","$content","href","containerOffset","ImageDialog","imageLimitation","floor","log","readableSize","pow","acceptImageFileTypes","showImageDialog","onImageLinkInsert","$imageInput","$imageUrl","$imageBtn","replaceWith","ImagePopover","popatmouse","TablePopover","VideoDialog","ytRegExp","ytRegExpForStart","ytMatch","gdRegExp","gdMatch","igRegExp","igMatch","vRegExp","vMatch","vimRegExp","vimMatch","dmRegExp","dmMatch","youkuRegExp","youkuMatch","peerTubeRegExp","peerTubeMatch","qqRegExp","qqMatch","qqRegExp2","qqMatch2","mp4RegExp","mp4Match","oggRegExp","oggMatch","webmRegExp","webmMatch","fbRegExp","fbMatch","$video","youtubeId","start","ytMatchForStart","begin","end","loop","autoplay","muted","vid","encodeURIComponent","showVideoDialog","createVideoNode","$videoUrl","$videoBtn","HelpDialog","createShortcutList","command","$row","showHelpDialog","AIRMODE_POPOVER_X_OFFSET","AIRMODE_POPOVER_Y_OFFSET","AirPopover","hidable","onContextmenu","bnd","air","forcelyOpen","POPOVER_DIST","HintPopover","hint","direction","hintDirection","hints","matchingWord","hideArrow","innerHeight","$current","$next","selectItem","$nextGroup","$prev","$prevGroup","nodeFromItem","rangeCompute","hintSelect","hintIdx","moveUp","moveDown","search","searchKeyword","createItemTemplates","hintMode","getWordsRange","getWordsMatchRange","empty","createGroup","Codeview","version","toolbarPosition","codeviewKeepButton","addLinkNoOpener","textareaAutoSync","onBeforeCommand","onBlur","onBlurCodeview","onChange","onChangeCodeview","onEnter","onFocus","onImageUploadError","onInit","onKeydown","onKeyup","onMousedown","onMouseup","onPaste","onScroll","mode","htmlMode","lineNumbers","pc","mac","Renderer","k","renderer","airEditor","airEditable","option","dataValue","dataOption","iconClassName","editorOptions","rowSize","colSize","colorName","placement","codeviewButton","isEnable","isActive","modal"],"sourceRoot":""}