1 |
- {"version":3,"file":"summernote-lite.js","sources":["../src/js/base/renderer.js","../src/js/lite/ui/TooltipUI.js","../src/js/lite/ui/DropdownUI.js","../src/js/lite/ui/ModalUI.js","../src/js/lite/ui.js","../src/js/base/summernote-en-US.js","../src/js/base/core/env.js","../src/js/base/core/func.js","../src/js/base/core/lists.js","../src/js/base/core/dom.js","../src/js/base/Context.js","../src/js/summernote.js","../src/js/base/core/range.js","../src/js/base/core/key.js","../src/js/base/core/async.js","../src/js/base/editing/History.js","../src/js/base/editing/Style.js","../src/js/base/editing/Bullet.js","../src/js/base/editing/Typing.js","../src/js/base/editing/Table.js","../src/js/base/module/Editor.js","../src/js/base/module/Clipboard.js","../src/js/base/module/Dropzone.js","../src/js/base/module/Codeview.js","../src/js/base/module/Statusbar.js","../src/js/base/module/Fullscreen.js","../src/js/base/module/Handle.js","../src/js/base/module/AutoLink.js","../src/js/base/module/AutoSync.js","../src/js/base/module/AutoReplace.js","../src/js/base/module/Placeholder.js","../src/js/base/module/Buttons.js","../src/js/base/module/Toolbar.js","../src/js/base/module/LinkDialog.js","../src/js/base/module/LinkPopover.js","../src/js/base/module/ImageDialog.js","../src/js/base/module/ImagePopover.js","../src/js/base/module/TablePopover.js","../src/js/base/module/VideoDialog.js","../src/js/base/module/HelpDialog.js","../src/js/base/module/AirPopover.js","../src/js/base/module/HintPopover.js","../src/js/base/settings.js","../src/js/lite/settings.js"],"sourcesContent":["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","class TooltipUI {\n constructor($node, options) {\n this.$node = $node;\n this.options = $.extend({}, {\n title: '',\n target: options.container,\n trigger: 'hover focus',\n placement: 'bottom',\n }, options);\n\n // create tooltip node\n this.$tooltip = $([\n '<div class=\"note-tooltip in\">',\n ' <div class=\"note-tooltip-arrow\"/>',\n ' <div class=\"note-tooltip-content\"/>',\n '</div>',\n ].join(''));\n\n // define event\n if (this.options.trigger !== 'manual') {\n const showCallback = this.show.bind(this);\n const hideCallback = this.hide.bind(this);\n const toggleCallback = this.toggle.bind(this);\n\n this.options.trigger.split(' ').forEach(function(eventName) {\n if (eventName === 'hover') {\n $node.off('mouseenter mouseleave');\n $node.on('mouseenter', showCallback).on('mouseleave', hideCallback);\n } else if (eventName === 'click') {\n $node.on('click', toggleCallback);\n } else if (eventName === 'focus') {\n $node.on('focus', showCallback).on('blur', hideCallback);\n }\n });\n }\n }\n\n show() {\n const $node = this.$node;\n const offset = $node.offset();\n\n const $tooltip = this.$tooltip;\n const title = this.options.title || $node.attr('title') || $node.data('title');\n const placement = this.options.placement || $node.data('placement');\n\n $tooltip.addClass(placement);\n $tooltip.addClass('in');\n $tooltip.find('.note-tooltip-content').text(title);\n $tooltip.appendTo(this.options.target);\n\n const nodeWidth = $node.outerWidth();\n const nodeHeight = $node.outerHeight();\n const tooltipWidth = $tooltip.outerWidth();\n const tooltipHeight = $tooltip.outerHeight();\n\n if (placement === 'bottom') {\n $tooltip.css({\n top: offset.top + nodeHeight,\n left: offset.left + (nodeWidth / 2 - tooltipWidth / 2),\n });\n } else if (placement === 'top') {\n $tooltip.css({\n top: offset.top - tooltipHeight,\n left: offset.left + (nodeWidth / 2 - tooltipWidth / 2),\n });\n } else if (placement === 'left') {\n $tooltip.css({\n top: offset.top + (nodeHeight / 2 - tooltipHeight / 2),\n left: offset.left - tooltipWidth,\n });\n } else if (placement === 'right') {\n $tooltip.css({\n top: offset.top + (nodeHeight / 2 - tooltipHeight / 2),\n left: offset.left + nodeWidth,\n });\n }\n }\n\n hide() {\n this.$tooltip.removeClass('in');\n this.$tooltip.remove();\n }\n\n toggle() {\n if (this.$tooltip.hasClass('in')) {\n this.hide();\n } else {\n this.show();\n }\n }\n}\n\nexport default TooltipUI;\n","class DropdownUI {\n constructor($node, options) {\n this.$button = $node;\n this.options = $.extend({}, {\n target: options.container,\n }, options);\n this.setEvent();\n }\n\n setEvent() {\n this.$button.on('click', (e) => {\n this.toggle();\n e.stopImmediatePropagation();\n });\n }\n\n clear() {\n var $parent = $('.note-btn-group.open');\n $parent.find('.note-btn.active').removeClass('active');\n $parent.removeClass('open');\n }\n\n show() {\n this.$button.addClass('active');\n this.$button.parent().addClass('open');\n\n var $dropdown = this.$button.next();\n var offset = $dropdown.offset();\n var width = $dropdown.outerWidth();\n var windowWidth = $(window).width();\n var targetMarginRight = parseFloat($(this.options.target).css('margin-right'));\n\n if (offset.left + width > windowWidth - targetMarginRight) {\n $dropdown.css('margin-left', windowWidth - targetMarginRight - (offset.left + width));\n } else {\n $dropdown.css('margin-left', '');\n }\n }\n\n hide() {\n this.$button.removeClass('active');\n this.$button.parent().removeClass('open');\n }\n\n toggle() {\n var isOpened = this.$button.parent().hasClass('open');\n\n this.clear();\n\n if (isOpened) {\n this.hide();\n } else {\n this.show();\n }\n }\n}\n\n$(document).on('click', function(e) {\n if (!$(e.target).closest('.note-btn-group').length) {\n $('.note-btn-group.open').removeClass('open');\n }\n});\n\n$(document).on('click.note-dropdown-menu', function(e) {\n $(e.target).closest('.note-dropdown-menu').parent().removeClass('open');\n});\n\nexport default DropdownUI;\n","class ModalUI {\n constructor($node, options) {\n this.options = $.extend({}, {\n target: options.container || 'body',\n }, options);\n\n this.$modal = $node;\n this.$backdrop = $('<div class=\"note-modal-backdrop\" />');\n }\n\n show() {\n if (this.options.target === 'body') {\n this.$backdrop.css('position', 'fixed');\n this.$modal.css('position', 'fixed');\n } else {\n this.$backdrop.css('position', 'absolute');\n this.$modal.css('position', 'absolute');\n }\n\n this.$backdrop.appendTo(this.options.target).show();\n this.$modal.appendTo(this.options.target).addClass('open').show();\n\n this.$modal.trigger('note.modal.show');\n this.$modal.off('click', '.close').on('click', '.close', this.hide.bind(this));\n }\n\n hide() {\n this.$modal.removeClass('open').hide();\n this.$backdrop.hide();\n this.$modal.trigger('note.modal.hide');\n }\n}\n\nexport default ModalUI;\n","import renderer from '../base/renderer';\nimport TooltipUI from './ui/TooltipUI';\nimport DropdownUI from './ui/DropdownUI';\nimport ModalUI from './ui/ModalUI';\n\nconst editor = renderer.create('<div class=\"note-editor note-frame\"/>');\nconst toolbar = renderer.create('<div class=\"note-toolbar\" role=\"toolbar\"/>');\nconst editingArea = renderer.create('<div class=\"note-editing-area\"/>');\nconst codable = renderer.create('<textarea class=\"note-codable\" role=\"textbox\" aria-multiline=\"true\"/>');\nconst editable = renderer.create('<div class=\"note-editable\" contentEditable=\"true\" role=\"textbox\" aria-multiline=\"true\"/>');\nconst statusbar = renderer.create([\n '<output class=\"note-status-output\" role=\"status\" aria-live=\"polite\"/>',\n '<div class=\"note-statusbar\" role=\"resize\">',\n ' <div class=\"note-resizebar\" role=\"seperator\" aria-orientation=\"horizontal\" aria-label=\"resize\">',\n ' <div class=\"note-icon-bar\"/>',\n ' <div class=\"note-icon-bar\"/>',\n ' <div class=\"note-icon-bar\"/>',\n ' </div>',\n '</div>',\n].join(''));\n\nconst airEditor = renderer.create('<div class=\"note-editor\"/>');\nconst airEditable = renderer.create([\n '<div class=\"note-editable\" contentEditable=\"true\" role=\"textbox\" aria-multiline=\"true\"/>',\n '<output class=\"note-status-output\" role=\"status\" aria-live=\"polite\"/>',\n].join(''));\n\nconst buttonGroup = renderer.create('<div class=\"note-btn-group\">');\nconst button = renderer.create('<button type=\"button\" class=\"note-btn\" role=\"button\" tabindex=\"-1\">', function($node, options) {\n // set button type\n if (options && options.tooltip) {\n $node.attr({\n 'aria-label': options.tooltip,\n });\n $node.data('_lite_tooltip', new TooltipUI($node, {\n title: options.tooltip,\n container: options.container,\n })).on('click', (e) => {\n $(e.currentTarget).data('_lite_tooltip').hide();\n });\n }\n if (options.contents) {\n $node.html(options.contents);\n }\n\n if (options && options.data && options.data.toggle === 'dropdown') {\n $node.data('_lite_dropdown', new DropdownUI($node, {\n container: options.container,\n }));\n }\n});\n\nconst dropdown = renderer.create('<div class=\"note-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 $temp = $('<a class=\"note-dropdown-item\" href=\"#\" data-value=\"' + value + '\" role=\"listitem\" aria-label=\"' + value + '\"></a>');\n\n $temp.html(content).data('item', item);\n\n return $temp;\n }) : options.items;\n\n $node.html(markup).attr({ 'aria-label': options.title });\n\n $node.on('click', '> .note-dropdown-item', function(e) {\n const $a = $(this);\n\n const item = $a.data('item');\n const value = $a.data('value');\n\n if (item.click) {\n item.click($a);\n } else if (options.itemClick) {\n options.itemClick(e, item, value);\n }\n });\n});\n\nconst dropdownCheck = renderer.create('<div class=\"note-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\n const $temp = $('<a class=\"note-dropdown-item\" href=\"#\" data-value=\"' + value + '\" role=\"listitem\" aria-label=\"' + item + '\"></a>');\n $temp.html([icon(options.checkClassName), ' ', content]).data('item', item);\n return $temp;\n }) : options.items;\n\n $node.html(markup).attr({ 'aria-label': options.title });\n\n $node.on('click', '> .note-dropdown-item', function(e) {\n const $a = $(this);\n\n const item = $a.data('item');\n const value = $a.data('value');\n\n if (item.click) {\n item.click($a);\n } else if (options.itemClick) {\n options.itemClick(e, item, value);\n }\n });\n});\n\nconst dropdownButtonContents = function(contents, options) {\n return contents + ' ' + icon(options.icons.caret, 'span');\n};\n\nconst dropdownButton = function(opt, callback) {\n return buttonGroup([\n button({\n className: 'dropdown-toggle',\n contents: opt.title + ' ' + icon('note-icon-caret'),\n tooltip: opt.tooltip,\n data: {\n toggle: 'dropdown',\n },\n }),\n dropdown({\n className: opt.className,\n items: opt.items,\n template: opt.template,\n itemClick: opt.itemClick,\n }),\n ], { callback: callback }).render();\n};\n\nconst dropdownCheckButton = function(opt, callback) {\n return buttonGroup([\n button({\n className: 'dropdown-toggle',\n contents: opt.title + ' ' + icon('note-icon-caret'),\n tooltip: opt.tooltip,\n data: {\n toggle: 'dropdown',\n },\n }),\n dropdownCheck({\n className: opt.className,\n checkClassName: opt.checkClassName,\n items: opt.items,\n template: opt.template,\n itemClick: opt.itemClick,\n }),\n ], { callback: callback }).render();\n};\n\nconst paragraphDropdownButton = function(opt) {\n return buttonGroup([\n button({\n className: 'dropdown-toggle',\n contents: opt.title + ' ' + icon('note-icon-caret'),\n tooltip: opt.tooltip,\n data: {\n toggle: 'dropdown',\n },\n }),\n dropdown([\n buttonGroup({\n className: 'note-align',\n children: opt.items[0],\n }),\n buttonGroup({\n className: 'note-list',\n children: opt.items[1],\n }),\n ]),\n ]).render();\n};\n\nconst tableMoveHandler = function(event, col, row) {\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 < col) {\n $unhighlighted.css({ width: dim.c + 1 + 'em' });\n }\n\n if (dim.r > 3 && dim.r < row) {\n $unhighlighted.css({ height: dim.r + 1 + 'em' });\n }\n\n $dimensionDisplay.html(dim.c + ' x ' + dim.r);\n};\n\nconst tableDropdownButton = function(opt) {\n return buttonGroup([\n button({\n className: 'dropdown-toggle',\n contents: opt.title + ' ' + icon('note-icon-caret'),\n tooltip: opt.tooltip,\n data: {\n toggle: 'dropdown',\n },\n }),\n dropdown({\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\"/>',\n ' <div class=\"note-dimension-picker-highlighted\"/>',\n ' <div class=\"note-dimension-picker-unhighlighted\"/>',\n '</div>',\n '<div class=\"note-dimension-display\">1 x 1</div>',\n ].join(''),\n }),\n ], {\n callback: function($node) {\n const $catcher = $node.find('.note-dimension-picker-mousecatcher');\n $catcher.css({\n width: opt.col + 'em',\n height: opt.row + 'em',\n })\n .mousedown(opt.itemClick)\n .mousemove(function(e) {\n tableMoveHandler(e, opt.col, opt.row);\n });\n },\n }).render();\n};\n\nconst palette = renderer.create('<div class=\"note-color-palette\"/>', 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-btn 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 $node.find('.note-color-btn').each(function() {\n $(this).data('_lite_tooltip', new TooltipUI($(this), {\n container: options.container,\n }));\n });\n});\n\nconst colorDropdownButton = function(opt, type) {\n return buttonGroup({\n className: 'note-color',\n children: [\n button({\n className: 'note-current-color-button',\n contents: opt.title,\n tooltip: opt.lang.color.recent,\n click: opt.currentClick,\n callback: function($button) {\n const $recentColor = $button.find('.note-recent-color');\n\n if (type !== 'foreColor') {\n $recentColor.css('background-color', '#FFFF00');\n $button.attr('data-backColor', '#FFFF00');\n }\n },\n }),\n button({\n className: 'dropdown-toggle',\n contents: icon('note-icon-caret'),\n tooltip: opt.lang.color.more,\n data: {\n toggle: 'dropdown',\n },\n }),\n dropdown({\n items: [\n '<div>',\n '<div class=\"note-btn-group btn-background-color\">',\n ' <div class=\"note-palette-title\">' + opt.lang.color.background + '</div>',\n ' <div>',\n '<button type=\"button\" class=\"note-color-reset note-btn note-btn-block\" ' +\n ' data-event=\"backColor\" data-value=\"inherit\">',\n opt.lang.color.transparent,\n ' </button>',\n ' </div>',\n ' <div class=\"note-holder\" data-event=\"backColor\"/>',\n ' <div class=\"btn-sm\">',\n ' <input type=\"color\" id=\"html5bcp\" class=\"note-btn btn-default\" value=\"#21104A\" style=\"width:100%;\" data-value=\"cp\">',\n ' <button type=\"button\" class=\"note-color-reset btn\" data-event=\"backColor\" data-value=\"cpbackColor\">',\n opt.lang.color.cpSelect,\n ' </button>',\n ' </div>',\n '</div>',\n '<div class=\"note-btn-group btn-foreground-color\">',\n ' <div class=\"note-palette-title\">' + opt.lang.color.foreground + '</div>',\n ' <div>',\n '<button type=\"button\" class=\"note-color-reset note-btn note-btn-block\" ' +\n ' data-event=\"removeFormat\" data-value=\"foreColor\">',\n opt.lang.color.resetToDefault,\n ' </button>',\n ' </div>',\n ' <div class=\"note-holder\" data-event=\"foreColor\"/>',\n ' <div class=\"btn-sm\">',\n ' <input type=\"color\" id=\"html5fcp\" class=\"note-btn btn-default\" value=\"#21104A\" style=\"width:100%;\" data-value=\"cp\">',\n ' <button type=\"button\" class=\"note-color-reset btn\" data-event=\"foreColor\" data-value=\"cpforeColor\">',\n opt.lang.color.cpSelect,\n ' </button>',\n ' </div>',\n '</div>',\n '</div>',\n ].join(''),\n callback: function($dropdown) {\n $dropdown.find('.note-holder').each(function() {\n const $holder = $(this);\n $holder.append(palette({\n colors: opt.colors,\n eventName: $holder.data('event'),\n }).render());\n });\n\n if (type === 'fore') {\n $dropdown.find('.btn-background-color').hide();\n $dropdown.css({ 'min-width': '210px' });\n } else if (type === 'back') {\n $dropdown.find('.btn-foreground-color').hide();\n $dropdown.css({ 'min-width': '210px' });\n }\n },\n click: function(event) {\n const $button = $(event.target);\n const eventName = $button.data('event');\n let value = $button.data('value');\n const foreinput = document.getElementById('html5fcp').value;\n const backinput = document.getElementById('html5bcp').value;\n if (value === 'cp') {\n event.stopPropagation();\n } else if (value === 'cpbackColor') {\n value = backinput;\n } else if (value === 'cpforeColor') {\n value = foreinput;\n }\n\n if (eventName && value) {\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 if (type === 'fore') {\n opt.itemClick('foreColor', value);\n } else if (type === 'back') {\n opt.itemClick('backColor', value);\n } else {\n opt.itemClick(eventName, value);\n }\n }\n },\n }),\n ],\n }).render();\n};\n\nconst dialog = renderer.create('<div class=\"note-modal\" aria-hidden=\"false\" tabindex=\"-1\" role=\"dialog\"/>', 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=\"note-modal-content\">',\n (options.title\n ? ' <div class=\"note-modal-header\">' +\n ' <button type=\"button\" class=\"close\" aria-label=\"Close\" aria-hidden=\"true\"><i class=\"note-icon-close\"></i></button>' +\n ' <h4 class=\"note-modal-title\">' + options.title + '</h4>' +\n ' </div>' : ''\n ),\n ' <div class=\"note-modal-body\">' + options.body + '</div>',\n (options.footer\n ? ' <div class=\"note-modal-footer\">' + options.footer + '</div>' : ''\n ),\n ' </div>',\n ].join(''));\n\n $node.data('modal', new ModalUI($node, options));\n});\n\nconst videoDialog = function(opt) {\n const body = '<div class=\"note-form-group\">' +\n '<label class=\"note-form-label\">' +\n opt.lang.video.url + ' <small class=\"text-muted\">' +\n opt.lang.video.providers + '</small>' +\n '</label>' +\n '<input class=\"note-video-url note-input\" type=\"text\" />' +\n '</div>';\n const footer = [\n '<button type=\"button\" href=\"#\" class=\"note-btn note-btn-primary note-video-btn disabled\" disabled>',\n opt.lang.video.insert,\n '</button>',\n ].join('');\n\n return dialog({\n title: opt.lang.video.insert,\n fade: opt.fade,\n body: body,\n footer: footer,\n }).render();\n};\n\nconst imageDialog = function(opt) {\n const body = '<div class=\"note-form-group note-group-select-from-files\">' +\n '<label class=\"note-form-label\">' + opt.lang.image.selectFromFiles + '</label>' +\n '<input class=\"note-note-image-input note-input\" type=\"file\" name=\"files\" accept=\"image/*\" multiple=\"multiple\" />' +\n opt.imageLimitation +\n '</div>' +\n '<div class=\"note-form-group\" style=\"overflow:auto;\">' +\n '<label class=\"note-form-label\">' + opt.lang.image.url + '</label>' +\n '<input class=\"note-image-url note-input\" type=\"text\" />' +\n '</div>';\n const footer = [\n '<button href=\"#\" type=\"button\" class=\"note-btn note-btn-primary note-btn-large note-image-btn disabled\" disabled>',\n opt.lang.image.insert,\n '</button>',\n ].join('');\n\n return dialog({\n title: opt.lang.image.insert,\n fade: opt.fade,\n body: body,\n footer: footer,\n }).render();\n};\n\nconst linkDialog = function(opt) {\n const body = '<div class=\"note-form-group\">' +\n '<label class=\"note-form-label\">' + opt.lang.link.textToDisplay + '</label>' +\n '<input class=\"note-link-text note-input\" type=\"text\" />' +\n '</div>' +\n '<div class=\"note-form-group\">' +\n '<label class=\"note-form-label\">' + opt.lang.link.url + '</label>' +\n '<input class=\"note-link-url note-input\" type=\"text\" value=\"http://\" />' +\n '</div>' +\n (!opt.disableLinkTarget\n ? '<div class=\"checkbox\">' +\n '<label>' + '<input type=\"checkbox\" checked> ' + opt.lang.link.openInNewWindow + '</label>' +\n '</div>' : ''\n );\n const footer = [\n '<button href=\"#\" type=\"button\" class=\"note-btn note-btn-primary note-link-btn disabled\" disabled>',\n opt.lang.link.insert,\n '</button>',\n ].join('');\n\n return dialog({\n className: 'link-dialog',\n title: opt.lang.link.insert,\n fade: opt.fade,\n body: body,\n footer: footer,\n }).render();\n};\n\nconst popover = renderer.create([\n '<div class=\"note-popover bottom\">',\n ' <div class=\"note-popover-arrow\"/>',\n ' <div class=\"popover-content note-children-container\"/>',\n '</div>',\n].join(''), function($node, options) {\n const direction = typeof options.direction !== 'undefined' ? options.direction : 'bottom';\n\n $node.addClass(direction).hide();\n\n if (options.hideArrow) {\n $node.find('.note-popover-arrow').hide();\n }\n});\n\nconst checkbox = renderer.create('<div class=\"checkbox\"></div>', function($node, options) {\n $node.html([\n '<label' + (options.id ? ' for=\"' + options.id + '\"' : '') + '>',\n ' <input role=\"checkbox\" type=\"checkbox\"' + (options.id ? ' id=\"' + options.id + '\"' : ''),\n (options.checked ? ' checked' : ''),\n ' aria-checked=\"' + (options.checked ? 'true' : 'false') + '\"/>',\n (options.text ? options.text : ''),\n '</label>',\n ].join(''));\n});\n\nconst icon = function(iconClassName, tagName) {\n tagName = tagName || 'i';\n return '<' + tagName + ' class=\"' + iconClassName + '\"/>';\n};\n\nconst ui = {\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 button: button,\n dropdown: dropdown,\n dropdownCheck: dropdownCheck,\n dropdownButton: dropdownButton,\n dropdownButtonContents: dropdownButtonContents,\n dropdownCheckButton: dropdownCheckButton,\n paragraphDropdownButton: paragraphDropdownButton,\n tableDropdownButton: tableDropdownButton,\n colorDropdownButton: colorDropdownButton,\n palette: palette,\n dialog: dialog,\n videoDialog: videoDialog,\n imageDialog: imageDialog,\n linkDialog: linkDialog,\n popover: popover,\n checkbox: checkbox,\n icon: icon,\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 check: function($dom, value) {\n $dom.find('.checked').removeClass('checked');\n $dom.find('[data-value=\"' + value + '\"]').addClass('checked');\n },\n\n onDialogShown: function($dialog, handler) {\n $dialog.one('note.modal.show', handler);\n },\n\n onDialogHidden: function($dialog, handler) {\n $dialog.one('note.modal.hide', handler);\n },\n\n showDialog: function($dialog) {\n $dialog.data('modal').show();\n },\n\n hideDialog: function($dialog) {\n $dialog.data('modal').hide();\n },\n\n /**\n * get popover content area\n *\n * @param $popover\n * @returns {*}\n */\n getPopoverContent: function($popover) {\n return $popover.find('.note-popover-content');\n },\n\n /**\n * get dialog's body area\n *\n * @param $dialog\n * @returns {*}\n */\n getDialogBody: function($dialog) {\n return $dialog.find('.note-modal-body');\n },\n\n createLayout: function($note, options) {\n const $editor = (options.airMode ? ui.airEditor([\n ui.editingArea([\n ui.airEditable(),\n ]),\n ]) : ui.editor([\n ui.toolbar(),\n ui.editingArea([\n ui.codable(),\n ui.editable(),\n ]),\n ui.statusbar(),\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.off('summernote'); // remove summernote custom event\n $note.show();\n },\n};\n\nexport default ui;\n","import $ from 'jquery';\n\n$.summernote = $.summernote || {\n lang: {},\n};\n\n$.extend($.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 },\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, Vimeo, Vine, Instagram, DailyMotion or Youku)',\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: 'Foreground 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 'insertParagraph': 'Insert Paragraph',\n 'undo': 'Undoes the last command',\n 'redo': 'Redoes 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 },\n});\n","import $ from 'jquery';\nconst isSupportAmd = typeof define === 'function' && define.amd; // eslint-disable-line\n\n/**\n * returns whether font is installed or not.\n *\n * @param {String} fontName\n * @return {Boolean}\n */\nfunction isFontInstalled(fontName) {\n const testFontName = fontName === 'Comic Sans MS' ? 'Courier New' : 'Comic Sans MS';\n const testText = 'mmmmmmmmmmwwwww';\n const testSize = '200px';\n\n var canvas = document.createElement('canvas');\n var context = canvas.getContext('2d');\n\n context.font = testSize + \" '\" + testFontName + \"'\";\n const originalWidth = context.measureText(testText).width;\n\n context.font = testSize + \" '\" + fontName + \"', '\" + testFontName + \"'\";\n const width = context.measureText(testText).width;\n\n return originalWidth !== width;\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\nlet hasCodeMirror = !!window.CodeMirror;\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 || isEdge) ? '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),\n browserVersion,\n jqueryVersion: parseFloat($.fn.jquery),\n isSupportAmd,\n isSupportTouch,\n hasCodeMirror,\n isFontInstalled,\n isW3CRangeSupport: !!document.createRange,\n inputEventName,\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 * 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 (obj.hasOwnProperty(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 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 return array.indexOf(item) !== -1;\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 \n * - [workaround] IE11 and other browser works with bogus br\n */\nconst blankHTML = env.isMSIE && env.browserVersion < 11 ? ' ' : '<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 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 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 node = point.node.parentNode;\n offset = position(point.node) + 1;\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 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))) {\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 * @method walkPoint\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 = nextPoint(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 const clone = insertAfter(point.node.cloneNode(false), point.node);\n appendChildNodes(clone, listNext(childNode));\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 const 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\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 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 isSamePoint,\n isVisiblePoint,\n prevPointUntil,\n nextPointUntil,\n isCharPoint,\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.ui = $.summernote.ui;\n this.$note = $note;\n\n this.memos = {};\n this.modules = {};\n this.layoutInfo = {};\n this.options = options;\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, this.options);\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 // 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
|