PageSourceSearch

https://uftb.ac.bd/assets/dashboard/js/summernote/dist/summernote.js

js uftb.ac.bd collected 2026-10-09 17:00:52 UTC 491,410 bytes, 10,960 lines download raw bytes

vendor: 6,243 bytes, lines 1-121
1/*!
2 *
3 * Super simple WYSIWYG editor v0.8.20
4 * https://summernote.org
5 *
6 *
7 * Copyright 2013- Alan Hong and contributors
8 * Summernote may be freely distributed under the MIT license.
9 *
10 * Date: 2021-10-14T21:15Z
11 *
12 */
13(function webpackUniversalModuleDefinition(root, factory) {
14    if (typeof exports === 'object' && typeof module === 'object')
15        module.exports = factory(require("jQuery"));
16    else if (typeof define === 'function' && define.amd)
17        define(["jQuery"], factory);
18    else {
19        var a = typeof exports === 'object' ? factory(require("jQuery")) : factory(root["jQuery"]);
20        for (var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
21    }
22})(self, function (__WEBPACK_EXTERNAL_MODULE__1145__) {
23    return /******/ (() => { // webpackBootstrap
24        /******/
25        "use strict";
26        /******/
27        var __webpack_modules__ = ({
28
29            /***/ 9770:
30            /***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
31
32                /* harmony import */
33                var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1145);
34                /* harmony import */
35                var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
36
37                (jquery__WEBPACK_IMPORTED_MODULE_0___default().summernote) = (jquery__WEBPACK_IMPORTED_MODULE_0___default().summernote) || {
38                    lang: {}
39                };
40                if (public_lang == "ar") {
41                    jquery__WEBPACK_IMPORTED_MODULE_0___default().extend((jquery__WEBPACK_IMPORTED_MODULE_0___default().summernote.lang), {
42                        'en-US': {
43                            font: {
44                                bold: 'عريض',
45                                italic: 'مائل',
46                                underline: 'تحته خط',
47                                clear: 'مسح التنسيق',
48                                height: 'إرتفاع السطر',
49                                name: 'الخط',
50                                strikethrough: 'فى وسطه خط',
51                                subscript: 'مخطوطة',
52                                superscript: 'حرف فوقي',
53                                size: 'الحجم'
54                            },
55                            image: {
56
57                                image: 'صورة',
58                                insert: 'إضافة صورة',
59                                resizeFull: 'الحجم بالكامل',
60                                resizeHalf: 'تصغير للنصف',
61                                resizeQuarter: 'تصغير للربع',
62                                floatLeft: 'تطيير لليسار',
63                                floatRight: 'تطيير لليمين',
64                                floatNone: 'ثابته',
65                                shapeRounded: 'الشكل: تقريب',
66                                shapeCircle: 'الشكل: دائرة',
67                                shapeThumbnail: 'الشكل: صورة مصغرة',
68                                shapeNone: 'الشكل: لا شيء',
69                                dragImageHere: 'إدرج الصورة هنا',
70                                dropImage: 'إسقاط صورة أو نص',
71                                selectFromFiles: 'حدد ملف',
72                                maximumFileSize: 'الحد الأقصى لحجم الملف',
73                                maximumFileSizeError: 'تم تجاوز الحد الأقصى لحجم الملف',
74                                url: 'رابط الصورة',
75                                remove: 'حذف الصورة',
76                            },
77                            video: {
78                                video: 'فيديو',
79                                videoLink: 'رابط الفيديو',
80                                insert: 'إدراج الفيديو',
81                                url: 'رابط الفيديو',
82                                providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion ou Youku)'
83                            },
84                            link: {
85                                link: 'رابط رابط',
86                                insert: 'إدراج',
87                                unlink: 'حذف الرابط',
88                                edit: 'تعديل',
89                                textToDisplay: 'النص',
90                                url: 'مسار الرابط',
91                                openInNewWindow: 'فتح في نافذة جديدة'
92                            },
93                            table: {
94                                table: 'جدول'
95                            },
96                            hr: {
97                                insert: 'إدراج خط أفقي'
98                            },
99                            style: {
100                                style: 'تنسيق',
101                                p: 'عادي',
102                                blockquote: 'إقتباس',
103                                pre: 'شفيرة',
104                                h1: 'عنوان رئيسي 1',
105                                h2: 'عنوان رئيسي 2',
106                                h3: 'عنوان رئيسي 3',
107                                h4: 'عنوان رئيسي 4',
108                                h5: 'عنوان رئيسي 5',
109                                h6: 'عنوان رئيسي 6'
110                            },
111                            lists: {
112                                unordered: 'قائمة مُنقطة',
113                                ordered: 'قائمة مُرقمة'
114                            },
115                            options: {
116                                help: 'مساعدة',
117                                fullscreen: 'حجم الشاشة بالكامل',
118                                codeview: 'شفيرة المصدر'
119                            },
120                            paragraph: {
121                                paragraph: 'فقرة',
122                                outdent: 'محاذاة للخارج',
123                                indent: 'محاذاة للداخل',
124                                left: 'محاذاة لليسار',
125                                center: 'توسيط',
126                                right: 'محاذاة لليمين',
127                                justify: 'ملئ السطر'
128                            },
129                            color: {
130                                recent: 'تم إستخدامه',
131                                more: 'المزيد',
132                                background: 'لون الخلفية',
133                                foreground: 'لون النص',
134                                transparent: 'شفاف',
135                                setTransparent: 'بدون خلفية',
136                                reset: 'إعادة الضبط',
137                                resetToDefault: 'إعادة الضبط'
138                            },
139                            shortcut: {
140                                shortcuts: 'إختصارات',
141                                close: 'غلق',
142                                textFormatting: 'تنسيق النص',
143                                action: 'Action',
144                                paragraphFormatting: 'تنسيق الفقرة',
145                                documentStyle: 'تنسيق المستند',
146                                extraKeys: 'Extra keys'
147                            },
148                            help: {
149                                'insertParagraph': 'Insert Paragraph',
150                                'undo': 'Undoes the last command',
151                                'redo': 'Redoes the last command',
152                                'tab': 'Tab',
153                                'untab': 'Untab',
154                                'bold': 'Set a bold style',
155                                'italic': 'Set a italic style',
156                                'underline': 'Set a underline style',
157                                'strikethrough': 'Set a strikethrough style',
158                                'removeFormat': 'Clean a style',
159                                'justifyLeft': 'Set left align',
160                                'justifyCenter': 'Set center align',
161                                'justifyRight': 'Set right align',
162                                'justifyFull': 'Set full align',
163                                'insertUnorderedList': 'Toggle unordered list',
164                                'insertOrderedList': 'Toggle ordered list',
165                                'outdent': 'Outdent on current paragraph',
166                                'indent': 'Indent on current paragraph',
167                                'formatPara': 'Change current block\'s format as a paragraph(P tag)',
168                                'formatH1': 'Change current block\'s format as H1',
169                                'formatH2': 'Change current block\'s format as H2',
170                                'formatH3': 'Change current block\'s format as H3',
171                                'formatH4': 'Change current block\'s format as H4',
172                                'formatH5': 'Change current block\'s format as H5',
173                                'formatH6': 'Change current block\'s format as H6',
174                                'insertHorizontalRule': 'Insert horizontal rule',
175                                'linkDialog.show': 'Show Link Dialog'
176                            },
177                            history: {
178                                undo: 'تراجع',
179                                redo: 'إعادة'
180                            },
181                            specialChar: {
182                                specialChar: 'SPECIAL CHARACTERS',
183                                select: 'Select Special characters'
184                            }
185                        }
186                    });
187                } else {
188                    jquery__WEBPACK_IMPORTED_MODULE_0___default().extend((jquery__WEBPACK_IMPORTED_MODULE_0___default().summernote.lang), {
189                        'en-US': {
190                            font: {
191                                bold: 'Bold',
192                                italic: 'Italic',
193                                underline: 'Underline',
194                                clear: 'Remove Font Style',
195                                height: 'Line Height',
196                                name: 'Font Family',
197                                strikethrough: 'Strikethrough',
198                                subscript: 'Subscript',
199                                superscript: 'Superscript',
200                                size: 'Font Size',
201                                sizeunit: 'Font Size Unit'
202                            },
203                            image: {
204                                image: 'Picture',
205                                insert: 'Insert Image',
206                                resizeFull: 'Resize full',
207                                resizeHalf: 'Resize half',
208                                resizeQuarter: 'Resize quarter',
209                                resizeNone: 'Original size',
210                                floatLeft: 'Float Left',
211                                floatRight: 'Float Right',
212                                floatNone: 'Remove float',
213                                shapeRounded: 'Shape: Rounded',
214                                shapeCircle: 'Shape: Circle',
215                                shapeThumbnail: 'Shape: Thumbnail',
216                                shapeNone: 'Shape: None',
217                                dragImageHere: 'Drag image or text here',
218                                dropImage: 'Drop image or Text',
219                                selectFromFiles: 'Select from files',
220                                maximumFileSize: 'Maximum file size',
221                                maximumFileSizeError: 'Maximum file size exceeded.',
222                                url: 'Image URL',
223                                remove: 'Remove Image',
224                                original: 'Original'
225                            },
226                            video: {
227                                video: 'Video',
228                                videoLink: 'Video Link',
229                                insert: 'Insert Video',
230                                url: 'Video URL',
231                                providers: '(YouTube, Google Drive, Vimeo, Vine, Instagram, DailyMotion, Youku, Peertube)'
232                            },
233                            link: {
234                                link: 'Link',
235                                insert: 'Insert Link',
236                                unlink: 'Unlink',
237                                edit: 'Edit',
238                                textToDisplay: 'Text to display',
239                                url: 'To what URL should this link go?',
240                                openInNewWindow: 'Open in new window',
241                                useProtocol: 'Use default protocol'
242                            },
243                            table: {
244                                table: 'Table',
245                                addRowAbove: 'Add row above',
246                                addRowBelow: 'Add row below',
247                                addColLeft: 'Add column left',
248                                addColRight: 'Add column right',
249                                delRow: 'Delete row',
250                                delCol: 'Delete column',
251                                delTable: 'Delete table'
252                            },
253                            hr: {
254                                insert: 'Insert Horizontal Rule'
255                            },
256                            style: {
257                                style: 'Style',
258                                p: 'Normal',
259                                blockquote: 'Quote',
260                                pre: 'Code',
261                                h1: 'Header 1',
262                                h2: 'Header 2',
263                                h3: 'Header 3',
264                                h4: 'Header 4',
265                                h5: 'Header 5',
266                                h6: 'Header 6'
267                            },
268                            lists: {
269                                unordered: 'Unordered list',
270                                ordered: 'Ordered list'
271                            },
272                            options: {
273                                help: 'Help',
274                                fullscreen: 'Full Screen',
275                                codeview: 'Code View'
276                            },
277                            paragraph: {
278                                paragraph: 'Paragraph',
279                                outdent: 'Outdent',
280                                indent: 'Indent',
281                                left: 'Align left',
282                                center: 'Align center',
283                                right: 'Align right',
284                                justify: 'Justify full'
285                            },
286                            color: {
287                                recent: 'Recent Color',
288                                more: 'More Color',
289                                background: 'Background Color',
290                                foreground: 'Text Color',
291                                transparent: 'Transparent',
292                                setTransparent: 'Set transparent',
293                                reset: 'Reset',
294                                resetToDefault: 'Reset to default',
295                                cpSelect: 'Select'
296                            },
297                            shortcut: {
298                                shortcuts: 'Keyboard shortcuts',
299                                close: 'Close',
300                                textFormatting: 'Text formatting',
301                                action: 'Action',
302                                paragraphFormatting: 'Paragraph formatting',
303                                documentStyle: 'Document Style',
304                                extraKeys: 'Extra keys'
305                            },
306                            help: {
307                                'escape': 'Escape',
308                                'insertParagraph': 'Insert Paragraph',
309                                'undo': 'Undo the last command',
310                                'redo': 'Redo the last command',
311                                'tab': 'Tab',
312                                'untab': 'Untab',
313                                'bold': 'Set a bold style',
314                                'italic': 'Set a italic style',
315                                'underline': 'Set a underline style',
316                                'strikethrough': 'Set a strikethrough style',
317                                'removeFormat': 'Clean a style',
318                                'justifyLeft': 'Set left align',
319                                'justifyCenter': 'Set center align',
320                                'justifyRight': 'Set right align',
321                                'justifyFull': 'Set full align',
322                                'insertUnorderedList': 'Toggle unordered list',
323                                'insertOrderedList': 'Toggle ordered list',
324                                'outdent': 'Outdent on current paragraph',
325                                'indent': 'Indent on current paragraph',
326                                'formatPara': 'Change current block\'s format as a paragraph(P tag)',
327                                'formatH1': 'Change current block\'s format as H1',
328                                'formatH2': 'Change current block\'s format as H2',
329                                'formatH3': 'Change current block\'s format as H3',
330                                'formatH4': 'Change current block\'s format as H4',
331                                'formatH5': 'Change current block\'s format as H5',
332                                'formatH6': 'Change current block\'s format as H6',
333                                'insertHorizontalRule': 'Insert horizontal rule',
334                                'linkDialog.show': 'Show Link Dialog'
335                            },
336                            history: {
337                                undo: 'Undo',
338                                redo: 'Redo'
339                            },
340                            specialChar: {
341                                specialChar: 'SPECIAL CHARACTERS',
342                                select: 'Select Special characters'
343                            },
344                            output: {
345                                noSelection: 'No Selection Made!'
346                            }
347                        }
348                    });
349                }
350                /***/
351            }),
352
353            /***/ 1145:
354            /***/ ((module) => {
355
356                module.exports = __WEBPACK_EXTERNAL_MODULE__1145__;
357
358                /***/
359            })
360
361            /******/
362        });
363        /************************************************************************/
364        /******/ 	// The module cache
365        /******/
366        var __webpack_module_cache__ = {};
367        /******/
368        /******/ 	// The require function
369        /******/
370        function __webpack_require__(moduleId) {
371            /******/ 		// Check if module is in cache
372            /******/
373            var cachedModule = __webpack_module_cache__[moduleId];
374            /******/
375            if (cachedModule !== undefined) {
376                /******/
377                return cachedModule.exports;
378                /******/
379            }
380            /******/ 		// Create a new module (and put it into the cache)
381            /******/
382            var module = __webpack_module_cache__[moduleId] = {
383                /******/ 			// no module.id needed
384                /******/ 			// no module.loaded needed
385                /******/            exports: {}
386                /******/
387            };
388            /******/
389            /******/ 		// Execute the module function
390            /******/
391            __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
392            /******/
393            /******/ 		// Return the exports of the module
394            /******/
395            return module.exports;
396            /******/
397        }
398
399        /******/
400        /************************************************************************/
401        /******/ 	/* webpack/runtime/compat get default export */
402        /******/
403        (() => {
404            /******/ 		// getDefaultExport function for compatibility with non-harmony modules
405            /******/
406            __webpack_require__.n = (module) => {
407                /******/
vendor: 6,983 bytes, lines 408-590
408                var getter = module && module.__esModule ?
409                    /******/                () => (module['default']) :
410                    /******/                () => (module);
411                /******/
412                __webpack_require__.d(getter, {a: getter});
413                /******/
414                return getter;
415                /******/
416            };
417            /******/
418        })();
419        /******/
420        /******/ 	/* webpack/runtime/define property getters */
421        /******/
422        (() => {
423            /******/ 		// define getter functions for harmony exports
424            /******/
425            __webpack_require__.d = (exports, definition) => {
426                /******/
427                for (var key in definition) {
428                    /******/
429                    if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
430                        /******/
431                        Object.defineProperty(exports, key, {enumerable: true, get: definition[key]});
432                        /******/
433                    }
434                    /******/
435                }
436                /******/
437            };
438            /******/
439        })();
440        /******/
441        /******/ 	/* webpack/runtime/hasOwnProperty shorthand */
442        /******/
443        (() => {
444            /******/
445            __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
446            /******/
447        })();
448        /******/
449        /******/ 	/* webpack/runtime/make namespace object */
450        /******/
451        (() => {
452            /******/ 		// define __esModule on exports
453            /******/
454            __webpack_require__.r = (exports) => {
455                /******/
456                if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
457                    /******/
458                    Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'});
459                    /******/
460                }
461                /******/
462                Object.defineProperty(exports, '__esModule', {value: true});
463                /******/
464            };
465            /******/
466        })();
467        /******/
468        /************************************************************************/
469        var __webpack_exports__ = {};
470// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
471        (() => {
472// ESM COMPAT FLAG
473            __webpack_require__.r(__webpack_exports__);
474
475// EXTERNAL MODULE: external "jQuery"
476            var external_jQuery_ = __webpack_require__(1145);
477            var external_jQuery_default = /*#__PURE__*/__webpack_require__.n(external_jQuery_);
478// EXTERNAL MODULE: ./src/lang/summernote-en-US.js
479            var summernote_en_US = __webpack_require__(9770);
480            ;// CONCATENATED MODULE: ./src/js/core/env.js
481
482            /**
483             * returns whether font is installed or not.
484             *
485             * @param {String} fontName
486             * @return {Boolean}
487             */
488
489            var genericFontFamilies = ['sans-serif', 'serif', 'monospace', 'cursive', 'fantasy'];
490
491            function validFontName(fontName) {
492                return external_jQuery_default().inArray(fontName.toLowerCase(), genericFontFamilies) === -1 ? "'".concat(fontName, "'") : fontName;
493            }
494
495            function isFontInstalled(fontName) {
496                var testFontName = fontName === 'Comic Sans MS' ? 'Courier New' : 'Comic Sans MS';
497                var testText = 'mmmmmmmmmmwwwww';
498                var testSize = '200px';
499                var canvas = document.createElement('canvas');
500                var context = canvas.getContext('2d');
501                context.font = testSize + " '" + testFontName + "'";
502                var originalWidth = context.measureText(testText).width;
503                context.font = testSize + ' ' + validFontName(fontName) + ', "' + testFontName + '"';
504                var width = context.measureText(testText).width;
505                return originalWidth !== width;
506            }
507
508            var userAgent = navigator.userAgent;
509            var isMSIE = /MSIE|Trident/i.test(userAgent);
510            var browserVersion;
511
512            if (isMSIE) {
513                var matches = /MSIE (\d+[.]\d+)/.exec(userAgent);
514
515                if (matches) {
516                    browserVersion = parseFloat(matches[1]);
517                }
518
519                matches = /Trident\/.*rv:([0-9]{1,}[.0-9]{0,})/.exec(userAgent);
520
521                if (matches) {
522                    browserVersion = parseFloat(matches[1]);
523                }
524            }
525
526            var isEdge = /Edge\/\d+/.test(userAgent);
527            var isSupportTouch = 'ontouchstart' in window || navigator.MaxTouchPoints > 0 || navigator.msMaxTouchPoints > 0; // [workaround] IE doesn't have input events for contentEditable
528// - see: https://goo.gl/4bfIvA
529
530            var inputEventName = isMSIE ? 'DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted' : 'input';
531            /**
532             * @class core.env
533             *
534             * Object which check platform and agent
535             *
536             * @singleton
537             * @alternateClassName env
538             */
539
540            /* harmony default export */
541            const env = ({
542                isMac: navigator.appVersion.indexOf('Mac') > -1,
543                isMSIE: isMSIE,
544                isEdge: isEdge,
545                isFF: !isEdge && /firefox/i.test(userAgent),
546                isPhantom: /PhantomJS/i.test(userAgent),
547                isWebkit: !isEdge && /webkit/i.test(userAgent),
548                isChrome: !isEdge && /chrome/i.test(userAgent),
549                isSafari: !isEdge && /safari/i.test(userAgent) && !/chrome/i.test(userAgent),
550                browserVersion: browserVersion,
551                isSupportTouch: isSupportTouch,
552                isFontInstalled: isFontInstalled,
553                isW3CRangeSupport: !!document.createRange,
554                inputEventName: inputEventName,
555                genericFontFamilies: genericFontFamilies,
556                validFontName: validFontName
557            });
558            ;// CONCATENATED MODULE: ./src/js/core/func.js
559
560            /**
561             * @class core.func
562             *
563             * func utils (for high-order func's arg)
564             *
565             * @singleton
566             * @alternateClassName func
567             */
568
569            function eq(itemA) {
570                return function (itemB) {
571                    return itemA === itemB;
572                };
573            }
574
575            function eq2(itemA, itemB) {
576                return itemA === itemB;
577            }
578
579            function peq2(propName) {
580                return function (itemA, itemB) {
581                    return itemA[propName] === itemB[propName];
582                };
583            }
584
585            function ok() {
586                return true;
587            }
588
589            function fail() {
590                return false;
vendor: 31,169 bytes, lines 591-1704
591            }
592
593            function not(f) {
594                return function () {
595                    return !f.apply(f, arguments);
596                };
597            }
598
599            function and(fA, fB) {
600                return function (item) {
601                    return fA(item) && fB(item);
602                };
603            }
604
605            function func_self(a) {
606                return a;
607            }
608
609            function invoke(obj, method) {
610                return function () {
611                    return obj[method].apply(obj, arguments);
612                };
613            }
614
615            var idCounter = 0;
616
617            /**
618             * reset globally-unique id
619             *
620             */
621
622            function resetUniqueId() {
623                idCounter = 0;
624            }
625
626            /**
627             * generate a globally-unique id
628             *
629             * @param {String} [prefix]
630             */
631
632
633            function uniqueId(prefix) {
634                var id = ++idCounter + '';
635                return prefix ? prefix + id : id;
636            }
637
638            /**
639             * returns bnd (bounds) from rect
640             *
641             * - IE Compatibility Issue: http://goo.gl/sRLOAo
642             * - Scroll Issue: http://goo.gl/sNjUc
643             *
644             * @param {Rect} rect
645             * @return {Object} bounds
646             * @return {Number} bounds.top
647             * @return {Number} bounds.left
648             * @return {Number} bounds.width
649             * @return {Number} bounds.height
650             */
651
652
653            function rect2bnd(rect) {
654                var $document = external_jQuery_default()(document);
655                return {
656                    top: rect.top + $document.scrollTop(),
657                    left: rect.left + $document.scrollLeft(),
658                    width: rect.right - rect.left,
659                    height: rect.bottom - rect.top
660                };
661            }
662
663            /**
664             * returns a copy of the object where the keys have become the values and the values the keys.
665             * @param {Object} obj
666             * @return {Object}
667             */
668
669
670            function invertObject(obj) {
671                var inverted = {};
672
673                for (var key in obj) {
674                    if (Object.prototype.hasOwnProperty.call(obj, key)) {
675                        inverted[obj[key]] = key;
676                    }
677                }
678
679                return inverted;
680            }
681
682            /**
683             * @param {String} namespace
684             * @param {String} [prefix]
685             * @return {String}
686             */
687
688
689            function namespaceToCamel(namespace, prefix) {
690                prefix = prefix || '';
691                return prefix + namespace.split('.').map(function (name) {
692                    return name.substring(0, 1).toUpperCase() + name.substring(1);
693                }).join('');
694            }
695
696            /**
697             * Returns a function, that, as long as it continues to be invoked, will not
698             * be triggered. The function will be called after it stops being called for
699             * N milliseconds. If `immediate` is passed, trigger the function on the
700             * leading edge, instead of the trailing.
701             * @param {Function} func
702             * @param {Number} wait
703             * @param {Boolean} immediate
704             * @return {Function}
705             */
706
707
708            function debounce(func, wait, immediate) {
709                var timeout;
710                return function () {
711                    var context = this;
712                    var args = arguments;
713
714                    var later = function later() {
715                        timeout = null;
716
717                        if (!immediate) {
718                            func.apply(context, args);
719                        }
720                    };
721
722                    var callNow = immediate && !timeout;
723                    clearTimeout(timeout);
724                    timeout = setTimeout(later, wait);
725
726                    if (callNow) {
727                        func.apply(context, args);
728                    }
729                };
730            }
731
732            /**
733             *
734             * @param {String} url
735             * @return {Boolean}
736             */
737
738
739            function isValidUrl(url) {
740                var expression = /[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi;
741                return expression.test(url);
742            }
743
744            /* harmony default export */
745            const func = ({
746                eq: eq,
747                eq2: eq2,
748                peq2: peq2,
749                ok: ok,
750                fail: fail,
751                self: func_self,
752                not: not,
753                and: and,
754                invoke: invoke,
755                resetUniqueId: resetUniqueId,
756                uniqueId: uniqueId,
757                rect2bnd: rect2bnd,
758                invertObject: invertObject,
759                namespaceToCamel: namespaceToCamel,
760                debounce: debounce,
761                isValidUrl: isValidUrl
762            });
763            ;// CONCATENATED MODULE: ./src/js/core/lists.js
764
765            /**
766             * returns the first item of an array.
767             *
768             * @param {Array} array
769             */
770
771            function head(array) {
772                return array[0];
773            }
774
775            /**
776             * returns the last item of an array.
777             *
778             * @param {Array} array
779             */
780
781
782            function last(array) {
783                return array[array.length - 1];
784            }
785
786            /**
787             * returns everything but the last entry of the array.
788             *
789             * @param {Array} array
790             */
791
792
793            function initial(array) {
794                return array.slice(0, array.length - 1);
795            }
796
797            /**
798             * returns the rest of the items in an array.
799             *
800             * @param {Array} array
801             */
802
803
804            function tail(array) {
805                return array.slice(1);
806            }
807
808            /**
809             * returns item of array
810             */
811
812
813            function find(array, pred) {
814                for (var idx = 0, len = array.length; idx < len; idx++) {
815                    var item = array[idx];
816
817                    if (pred(item)) {
818                        return item;
819                    }
820                }
821            }
822
823            /**
824             * returns true if all of the values in the array pass the predicate truth test.
825             */
826
827
828            function lists_all(array, pred) {
829                for (var idx = 0, len = array.length; idx < len; idx++) {
830                    if (!pred(array[idx])) {
831                        return false;
832                    }
833                }
834
835                return true;
836            }
837
838            /**
839             * returns true if the value is present in the list.
840             */
841
842
843            function contains(array, item) {
844                if (array && array.length && item) {
845                    if (array.indexOf) {
846                        return array.indexOf(item) !== -1;
847                    } else if (array.contains) {
848                        // `DOMTokenList` doesn't implement `.indexOf`, but it implements `.contains`
849                        return array.contains(item);
850                    }
851                }
852
853                return false;
854            }
855
856            /**
857             * get sum from a list
858             *
859             * @param {Array} array - array
860             * @param {Function} fn - iterator
861             */
862
863
864            function sum(array, fn) {
865                fn = fn || func.self;
866                return array.reduce(function (memo, v) {
867                    return memo + fn(v);
868                }, 0);
869            }
870
871            /**
872             * returns a copy of the collection with array type.
873             * @param {Collection} collection - collection eg) node.childNodes, ...
874             */
875
876
877            function from(collection) {
878                var result = [];
879                var length = collection.length;
880                var idx = -1;
881
882                while (++idx < length) {
883                    result[idx] = collection[idx];
884                }
885
886                return result;
887            }
888
889            /**
890             * returns whether list is empty or not
891             */
892
893
894            function isEmpty(array) {
895                return !array || !array.length;
896            }
897
898            /**
899             * cluster elements by predicate function.
900             *
901             * @param {Array} array - array
902             * @param {Function} fn - predicate function for cluster rule
903             * @param {Array[]}
904             */
905
906
907            function clusterBy(array, fn) {
908                if (!array.length) {
909                    return [];
910                }
911
912                var aTail = tail(array);
913                return aTail.reduce(function (memo, v) {
914                    var aLast = last(memo);
915
916                    if (fn(last(aLast), v)) {
917                        aLast[aLast.length] = v;
918                    } else {
919                        memo[memo.length] = [v];
920                    }
921
922                    return memo;
923                }, [[head(array)]]);
924            }
925
926            /**
927             * returns a copy of the array with all false values removed
928             *
929             * @param {Array} array - array
930             * @param {Function} fn - predicate function for cluster rule
931             */
932
933
934            function compact(array) {
935                var aResult = [];
936
937                for (var idx = 0, len = array.length; idx < len; idx++) {
938                    if (array[idx]) {
939                        aResult.push(array[idx]);
940                    }
941                }
942
943                return aResult;
944            }
945
946            /**
947             * produces a duplicate-free version of the array
948             *
949             * @param {Array} array
950             */
951
952
953            function unique(array) {
954                var results = [];
955
956                for (var idx = 0, len = array.length; idx < len; idx++) {
957                    if (!contains(results, array[idx])) {
958                        results.push(array[idx]);
959                    }
960                }
961
962                return results;
963            }
964
965            /**
966             * returns next item.
967             * @param {Array} array
968             */
969
970
971            function next(array, item) {
972                if (array && array.length && item) {
973                    var idx = array.indexOf(item);
974                    return idx === -1 ? null : array[idx + 1];
975                }
976
977                return null;
978            }
979
980            /**
981             * returns prev item.
982             * @param {Array} array
983             */
984
985
986            function prev(array, item) {
987                if (array && array.length && item) {
988                    var idx = array.indexOf(item);
989                    return idx === -1 ? null : array[idx - 1];
990                }
991
992                return null;
993            }
994
995            /**
996             * @class core.list
997             *
998             * list utils
999             *
1000             * @singleton
1001             * @alternateClassName list
1002             */
1003
1004
1005            /* harmony default export */
1006            const lists = ({
1007                head: head,
1008                last: last,
1009                initial: initial,
1010                tail: tail,
1011                prev: prev,
1012                next: next,
1013                find: find,
1014                contains: contains,
1015                all: lists_all,
1016                sum: sum,
1017                from: from,
1018                isEmpty: isEmpty,
1019                clusterBy: clusterBy,
1020                compact: compact,
1021                unique: unique
1022            });
1023            ;// CONCATENATED MODULE: ./src/js/core/dom.js
1024
1025
1026            var NBSP_CHAR = String.fromCharCode(160);
1027            var ZERO_WIDTH_NBSP_CHAR = "\uFEFF";
1028
1029            /**
1030             * @method isEditable
1031             *
1032             * returns whether node is `note-editable` or not.
1033             *
1034             * @param {Node} node
1035             * @return {Boolean}
1036             */
1037
1038            function isEditable(node) {
1039                return node && external_jQuery_default()(node).hasClass('note-editable');
1040            }
1041
1042            /**
1043             * @method isControlSizing
1044             *
1045             * returns whether node is `note-control-sizing` or not.
1046             *
1047             * @param {Node} node
1048             * @return {Boolean}
1049             */
1050
1051
1052            function isControlSizing(node) {
1053                return node && external_jQuery_default()(node).hasClass('note-control-sizing');
1054            }
1055
1056            /**
1057             * @method makePredByNodeName
1058             *
1059             * returns predicate which judge whether nodeName is same
1060             *
1061             * @param {String} nodeName
1062             * @return {Function}
1063             */
1064
1065
1066            function makePredByNodeName(nodeName) {
1067                nodeName = nodeName.toUpperCase();
1068                return function (node) {
1069                    return node && node.nodeName.toUpperCase() === nodeName;
1070                };
1071            }
1072
1073            /**
1074             * @method isText
1075             *
1076             *
1077             *
1078             * @param {Node} node
1079             * @return {Boolean} true if node's type is text(3)
1080             */
1081
1082
1083            function isText(node) {
1084                return node && node.nodeType === 3;
1085            }
1086
1087            /**
1088             * @method isElement
1089             *
1090             *
1091             *
1092             * @param {Node} node
1093             * @return {Boolean} true if node's type is element(1)
1094             */
1095
1096
1097            function isElement(node) {
1098                return node && node.nodeType === 1;
1099            }
1100
1101            /**
1102             * ex) br, col, embed, hr, img, input, ...
1103             * @see http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements
1104             */
1105
1106
1107            function isVoid(node) {
1108                return node && /^BR|^IMG|^HR|^IFRAME|^BUTTON|^INPUT|^AUDIO|^VIDEO|^EMBED/.test(node.nodeName.toUpperCase());
1109            }
1110
1111            function isPara(node) {
1112                if (isEditable(node)) {
1113                    return false;
1114                } // Chrome(v31.0), FF(v25.0.1) use DIV for paragraph
1115
1116
1117                return node && /^DIV|^P|^LI|^H[1-7]/.test(node.nodeName.toUpperCase());
1118            }
1119
1120            function isHeading(node) {
1121                return node && /^H[1-7]/.test(node.nodeName.toUpperCase());
1122            }
1123
1124            var isPre = makePredByNodeName('PRE');
1125            var isLi = makePredByNodeName('LI');
1126
1127            function isPurePara(node) {
1128                return isPara(node) && !isLi(node);
1129            }
1130
1131            var isTable = makePredByNodeName('TABLE');
1132            var isData = makePredByNodeName('DATA');
1133
1134            function isInline(node) {
1135                return !isBodyContainer(node) && !isList(node) && !isHr(node) && !isPara(node) && !isTable(node) && !isBlockquote(node) && !isData(node);
1136            }
1137
1138            function isList(node) {
1139                return node && /^UL|^OL/.test(node.nodeName.toUpperCase());
1140            }
1141
1142            var isHr = makePredByNodeName('HR');
1143
1144            function isCell(node) {
1145                return node && /^TD|^TH/.test(node.nodeName.toUpperCase());
1146            }
1147
1148            var isBlockquote = makePredByNodeName('BLOCKQUOTE');
1149
1150            function isBodyContainer(node) {
1151                return isCell(node) || isBlockquote(node) || isEditable(node);
1152            }
1153
1154            var isAnchor = makePredByNodeName('A');
1155
1156            function isParaInline(node) {
1157                return isInline(node) && !!ancestor(node, isPara);
1158            }
1159
1160            function isBodyInline(node) {
1161                return isInline(node) && !ancestor(node, isPara);
1162            }
1163
1164            var isBody = makePredByNodeName('BODY');
1165
1166            /**
1167             * returns whether nodeB is closest sibling of nodeA
1168             *
1169             * @param {Node} nodeA
1170             * @param {Node} nodeB
1171             * @return {Boolean}
1172             */
1173
1174            function isClosestSibling(nodeA, nodeB) {
1175                return nodeA.nextSibling === nodeB || nodeA.previousSibling === nodeB;
1176            }
1177
1178            /**
1179             * returns array of closest siblings with node
1180             *
1181             * @param {Node} node
1182             * @param {function} [pred] - predicate function
1183             * @return {Node[]}
1184             */
1185
1186
1187            function withClosestSiblings(node, pred) {
1188                pred = pred || func.ok;
1189                var siblings = [];
1190
1191                if (node.previousSibling && pred(node.previousSibling)) {
1192                    siblings.push(node.previousSibling);
1193                }
1194
1195                siblings.push(node);
1196
1197                if (node.nextSibling && pred(node.nextSibling)) {
1198                    siblings.push(node.nextSibling);
1199                }
1200
1201                return siblings;
1202            }
1203
1204            /**
1205             * blank HTML for cursor position
1206             * - [workaround] old IE only works with &nbsp;
1207             * - [workaround] IE11 and other browser works with bogus br
1208             */
1209
1210
1211            var blankHTML = env.isMSIE && env.browserVersion < 11 ? '&nbsp;' : '<br>';
1212
1213            /**
1214             * @method nodeLength
1215             *
1216             * returns #text's text size or element's childNodes size
1217             *
1218             * @param {Node} node
1219             */
1220
1221            function nodeLength(node) {
1222                if (isText(node)) {
1223                    return node.nodeValue.length;
1224                }
1225
1226                if (node) {
1227                    return node.childNodes.length;
1228                }
1229
1230                return 0;
1231            }
1232
1233            /**
1234             * returns whether deepest child node is empty or not.
1235             *
1236             * @param {Node} node
1237             * @return {Boolean}
1238             */
1239
1240
1241            function deepestChildIsEmpty(node) {
1242                do {
1243                    if (node.firstElementChild === null || node.firstElementChild.innerHTML === '') break;
1244                } while (node = node.firstElementChild);
1245
1246                return dom_isEmpty(node);
1247            }
1248
1249            /**
1250             * returns whether node is empty or not.
1251             *
1252             * @param {Node} node
1253             * @return {Boolean}
1254             */
1255
1256
1257            function dom_isEmpty(node) {
1258                var len = nodeLength(node);
1259
1260                if (len === 0) {
1261                    return true;
1262                } else if (!isText(node) && len === 1 && node.innerHTML === blankHTML) {
1263                    // ex) <p><br></p>, <span><br></span>
1264                    return true;
1265                } else if (lists.all(node.childNodes, isText) && node.innerHTML === '') {
1266                    // ex) <p></p>, <span></span>
1267                    return true;
1268                }
1269
1270                return false;
1271            }
1272
1273            /**
1274             * padding blankHTML if node is empty (for cursor position)
1275             */
1276
1277
1278            function paddingBlankHTML(node) {
1279                if (!isVoid(node) && !nodeLength(node)) {
1280                    node.innerHTML = blankHTML;
1281                }
1282            }
1283
1284            /**
1285             * find nearest ancestor predicate hit
1286             *
1287             * @param {Node} node
1288             * @param {Function} pred - predicate function
1289             */
1290
1291
1292            function ancestor(node, pred) {
1293                while (node) {
1294                    if (pred(node)) {
1295                        return node;
1296                    }
1297
1298                    if (isEditable(node)) {
1299                        break;
1300                    }
1301
1302                    node = node.parentNode;
1303                }
1304
1305                return null;
1306            }
1307
1308            /**
1309             * find nearest ancestor only single child blood line and predicate hit
1310             *
1311             * @param {Node} node
1312             * @param {Function} pred - predicate function
1313             */
1314
1315
1316            function singleChildAncestor(node, pred) {
1317                node = node.parentNode;
1318
1319                while (node) {
1320                    if (nodeLength(node) !== 1) {
1321                        break;
1322                    }
1323
1324                    if (pred(node)) {
1325                        return node;
1326                    }
1327
1328                    if (isEditable(node)) {
1329                        break;
1330                    }
1331
1332                    node = node.parentNode;
1333                }
1334
1335                return null;
1336            }
1337
1338            /**
1339             * returns new array of ancestor nodes (until predicate hit).
1340             *
1341             * @param {Node} node
1342             * @param {Function} [optional] pred - predicate function
1343             */
1344
1345
1346            function listAncestor(node, pred) {
1347                pred = pred || func.fail;
1348                var ancestors = [];
1349                ancestor(node, function (el) {
1350                    if (!isEditable(el)) {
1351                        ancestors.push(el);
1352                    }
1353
1354                    return pred(el);
1355                });
1356                return ancestors;
1357            }
1358
1359            /**
1360             * find farthest ancestor predicate hit
1361             */
1362
1363
1364            function lastAncestor(node, pred) {
1365                var ancestors = listAncestor(node);
1366                return lists.last(ancestors.filter(pred));
1367            }
1368
1369            /**
1370             * returns common ancestor node between two nodes.
1371             *
1372             * @param {Node} nodeA
1373             * @param {Node} nodeB
1374             */
1375
1376
1377            function commonAncestor(nodeA, nodeB) {
1378                var ancestors = listAncestor(nodeA);
1379
1380                for (var n = nodeB; n; n = n.parentNode) {
1381                    if (ancestors.indexOf(n) > -1) return n;
1382                }
1383
1384                return null; // difference document area
1385            }
1386
1387            /**
1388             * listing all previous siblings (until predicate hit).
1389             *
1390             * @param {Node} node
1391             * @param {Function} [optional] pred - predicate function
1392             */
1393
1394
1395            function listPrev(node, pred) {
1396                pred = pred || func.fail;
1397                var nodes = [];
1398
1399                while (node) {
1400                    if (pred(node)) {
1401                        break;
1402                    }
1403
1404                    nodes.push(node);
1405                    node = node.previousSibling;
1406                }
1407
1408                return nodes;
1409            }
1410
1411            /**
1412             * listing next siblings (until predicate hit).
1413             *
1414             * @param {Node} node
1415             * @param {Function} [pred] - predicate function
1416             */
1417
1418
1419            function listNext(node, pred) {
1420                pred = pred || func.fail;
1421                var nodes = [];
1422
1423                while (node) {
1424                    if (pred(node)) {
1425                        break;
1426                    }
1427
1428                    nodes.push(node);
1429                    node = node.nextSibling;
1430                }
1431
1432                return nodes;
1433            }
1434
1435            /**
1436             * listing descendant nodes
1437             *
1438             * @param {Node} node
1439             * @param {Function} [pred] - predicate function
1440             */
1441
1442
1443            function listDescendant(node, pred) {
1444                var descendants = [];
1445                pred = pred || func.ok; // start DFS(depth first search) with node
1446
1447                (function fnWalk(current) {
1448                    if (node !== current && pred(current)) {
1449                        descendants.push(current);
1450                    }
1451
1452                    for (var idx = 0, len = current.childNodes.length; idx < len; idx++) {
1453                        fnWalk(current.childNodes[idx]);
1454                    }
1455                })(node);
1456
1457                return descendants;
1458            }
1459
1460            /**
1461             * wrap node with new tag.
1462             *
1463             * @param {Node} node
1464             * @param {Node} tagName of wrapper
1465             * @return {Node} - wrapper
1466             */
1467
1468
1469            function wrap(node, wrapperName) {
1470                var parent = node.parentNode;
1471                var wrapper = external_jQuery_default()('<' + wrapperName + '>')[0];
1472                parent.insertBefore(wrapper, node);
1473                wrapper.appendChild(node);
1474                return wrapper;
1475            }
1476
1477            /**
1478             * insert node after preceding
1479             *
1480             * @param {Node} node
1481             * @param {Node} preceding - predicate function
1482             */
1483
1484
1485            function insertAfter(node, preceding) {
1486                var next = preceding.nextSibling;
1487                var parent = preceding.parentNode;
1488
1489                if (next) {
1490                    parent.insertBefore(node, next);
1491                } else {
1492                    parent.appendChild(node);
1493                }
1494
1495                return node;
1496            }
1497
1498            /**
1499             * append elements.
1500             *
1501             * @param {Node} node
1502             * @param {Collection} aChild
1503             */
1504
1505
1506            function appendChildNodes(node, aChild) {
1507                external_jQuery_default().each(aChild, function (idx, child) {
1508                    node.appendChild(child);
1509                });
1510                return node;
1511            }
1512
1513            /**
1514             * returns whether boundaryPoint is left edge or not.
1515             *
1516             * @param {BoundaryPoint} point
1517             * @return {Boolean}
1518             */
1519
1520
1521            function isLeftEdgePoint(point) {
1522                return point.offset === 0;
1523            }
1524
1525            /**
1526             * returns whether boundaryPoint is right edge or not.
1527             *
1528             * @param {BoundaryPoint} point
1529             * @return {Boolean}
1530             */
1531
1532
1533            function isRightEdgePoint(point) {
1534                return point.offset === nodeLength(point.node);
1535            }
1536
1537            /**
1538             * returns whether boundaryPoint is edge or not.
1539             *
1540             * @param {BoundaryPoint} point
1541             * @return {Boolean}
1542             */
1543
1544
1545            function isEdgePoint(point) {
1546                return isLeftEdgePoint(point) || isRightEdgePoint(point);
1547            }
1548
1549            /**
1550             * returns whether node is left edge of ancestor or not.
1551             *
1552             * @param {Node} node
1553             * @param {Node} ancestor
1554             * @return {Boolean}
1555             */
1556
1557
1558            function isLeftEdgeOf(node, ancestor) {
1559                while (node && node !== ancestor) {
1560                    if (position(node) !== 0) {
1561                        return false;
1562                    }
1563
1564                    node = node.parentNode;
1565                }
1566
1567                return true;
1568            }
1569
1570            /**
1571             * returns whether node is right edge of ancestor or not.
1572             *
1573             * @param {Node} node
1574             * @param {Node} ancestor
1575             * @return {Boolean}
1576             */
1577
1578
1579            function isRightEdgeOf(node, ancestor) {
1580                if (!ancestor) {
1581                    return false;
1582                }
1583
1584                while (node && node !== ancestor) {
1585                    if (position(node) !== nodeLength(node.parentNode) - 1) {
1586                        return false;
1587                    }
1588
1589                    node = node.parentNode;
1590                }
1591
1592                return true;
1593            }
1594
1595            /**
1596             * returns whether point is left edge of ancestor or not.
1597             * @param {BoundaryPoint} point
1598             * @param {Node} ancestor
1599             * @return {Boolean}
1600             */
1601
1602
1603            function isLeftEdgePointOf(point, ancestor) {
1604                return isLeftEdgePoint(point) && isLeftEdgeOf(point.node, ancestor);
1605            }
1606
1607            /**
1608             * returns whether point is right edge of ancestor or not.
1609             * @param {BoundaryPoint} point
1610             * @param {Node} ancestor
1611             * @return {Boolean}
1612             */
1613
1614
1615            function isRightEdgePointOf(point, ancestor) {
1616                return isRightEdgePoint(point) && isRightEdgeOf(point.node, ancestor);
1617            }
1618
1619            /**
1620             * returns offset from parent.
1621             *
1622             * @param {Node} node
1623             */
1624
1625
1626            function position(node) {
1627                var offset = 0;
1628
1629                while (node = node.previousSibling) {
1630                    offset += 1;
1631                }
1632
1633                return offset;
1634            }
1635
1636            function hasChildren(node) {
1637                return !!(node && node.childNodes && node.childNodes.length);
1638            }
1639
1640            /**
1641             * returns previous boundaryPoint
1642             *
1643             * @param {BoundaryPoint} point
1644             * @param {Boolean} isSkipInnerOffset
1645             * @return {BoundaryPoint}
1646             */
1647
1648
1649            function prevPoint(point, isSkipInnerOffset) {
1650                var node;
1651                var offset;
1652
1653                if (point.offset === 0) {
1654                    if (isEditable(point.node)) {
1655                        return null;
1656                    }
1657
1658                    node = point.node.parentNode;
1659                    offset = position(point.node);
1660                } else if (hasChildren(point.node)) {
1661                    node = point.node.childNodes[point.offset - 1];
1662                    offset = nodeLength(node);
1663                } else {
1664                    node = point.node;
1665                    offset = isSkipInnerOffset ? 0 : point.offset - 1;
1666                }
1667
1668                return {
1669                    node: node,
1670                    offset: offset
1671                };
1672            }
1673
1674            /**
1675             * returns next boundaryPoint
1676             *
1677             * @param {BoundaryPoint} point
1678             * @param {Boolean} isSkipInnerOffset
1679             * @return {BoundaryPoint}
1680             */
1681
1682
1683            function nextPoint(point, isSkipInnerOffset) {
1684                var node, offset;
1685
1686                if (nodeLength(point.node) === point.offset) {
1687                    if (isEditable(point.node)) {
1688                        return null;
1689                    }
1690
1691                    var nextTextNode = getNextTextNode(point.node);
1692
1693                    if (nextTextNode) {
1694                        node = nextTextNode;
1695                        offset = 0;
1696                    } else {
1697                        node = point.node.parentNode;
1698                        offset = position(point.node) + 1;
1699                    }
1700                } else if (hasChildren(point.node)) {
1701                    node = point.node.childNodes[point.offset];
1702                    offset = 0;
1703                } else {
1704                    node = point.node;
vendor: 6,641 bytes, lines 1705-1924
1705                    offset = isSkipInnerOffset ? nodeLength(point.node) : point.offset + 1;
1706                }
1707
1708                return {
1709                    node: node,
1710                    offset: offset
1711                };
1712            }
1713
1714            /**
1715             * returns next boundaryPoint with empty node
1716             *
1717             * @param {BoundaryPoint} point
1718             * @param {Boolean} isSkipInnerOffset
1719             * @return {BoundaryPoint}
1720             */
1721
1722
1723            function nextPointWithEmptyNode(point, isSkipInnerOffset) {
1724                var node,
1725                    offset = 0; // if node is empty string node, return current node's sibling.
1726
1727                if (dom_isEmpty(point.node)) {
1728                    if (point.node === null) {
1729                        return null;
1730                    }
1731
1732                    node = point.node.nextSibling;
1733                    offset = 0;
1734                    return {
1735                        node: node,
1736                        offset: offset
1737                    };
1738                }
1739
1740                if (nodeLength(point.node) === point.offset) {
1741                    if (isEditable(point.node)) {
1742                        return null;
1743                    }
1744
1745                    node = point.node.parentNode;
1746                    offset = position(point.node) + 1; // if next node is editable ,  return current node's sibling node.
1747
1748                    if (isEditable(node)) {
1749                        node = point.node.nextSibling;
1750                        offset = 0;
1751                    }
1752                } else if (hasChildren(point.node)) {
1753                    node = point.node.childNodes[point.offset];
1754                    offset = 0;
1755
1756                    if (dom_isEmpty(node)) {
1757                        if (!dom_isEmpty(point.node.nextSibling)) {
1758                            return {
1759                                node: point.node.nextSibling,
1760                                offset: offset
1761                            };
1762                        }
1763
1764                        return null;
1765                    }
1766                } else {
1767                    node = point.node;
1768                    offset = isSkipInnerOffset ? nodeLength(point.node) : point.offset + 1;
1769
1770                    if (dom_isEmpty(node)) {
1771                        return null;
1772                    }
1773                }
1774
1775                return {
1776                    node: node,
1777                    offset: offset
1778                };
1779            }
1780
1781            /*
1782* returns the next Text node index or 0 if not found.
1783*/
1784
1785
1786            function getNextTextNode(actual) {
1787                if (!actual.nextSibling) return undefined;
1788                if (actual.parent !== actual.nextSibling.parent) return undefined;
1789                if (isText(actual.nextSibling)) return actual.nextSibling; else return getNextTextNode(actual.nextSibling);
1790            }
1791
1792            /**
1793             * returns whether pointA and pointB is same or not.
1794             *
1795             * @param {BoundaryPoint} pointA
1796             * @param {BoundaryPoint} pointB
1797             * @return {Boolean}
1798             */
1799
1800
1801            function isSamePoint(pointA, pointB) {
1802                return pointA.node === pointB.node && pointA.offset === pointB.offset;
1803            }
1804
1805            /**
1806             * returns whether point is visible (can set cursor) or not.
1807             *
1808             * @param {BoundaryPoint} point
1809             * @return {Boolean}
1810             */
1811
1812
1813            function isVisiblePoint(point) {
1814                if (isText(point.node) || !hasChildren(point.node) || dom_isEmpty(point.node)) {
1815                    return true;
1816                }
1817
1818                var leftNode = point.node.childNodes[point.offset - 1];
1819                var rightNode = point.node.childNodes[point.offset];
1820
1821                if ((!leftNode || isVoid(leftNode)) && (!rightNode || isVoid(rightNode)) || isTable(rightNode)) {
1822                    return true;
1823                }
1824
1825                return false;
1826            }
1827
1828            /**
1829             * @method prevPointUtil
1830             *
1831             * @param {BoundaryPoint} point
1832             * @param {Function} pred
1833             * @return {BoundaryPoint}
1834             */
1835
1836
1837            function prevPointUntil(point, pred) {
1838                while (point) {
1839                    if (pred(point)) {
1840                        return point;
1841                    }
1842
1843                    point = prevPoint(point);
1844                }
1845
1846                return null;
1847            }
1848
1849            /**
1850             * @method nextPointUntil
1851             *
1852             * @param {BoundaryPoint} point
1853             * @param {Function} pred
1854             * @return {BoundaryPoint}
1855             */
1856
1857
1858            function nextPointUntil(point, pred) {
1859                while (point) {
1860                    if (pred(point)) {
1861                        return point;
1862                    }
1863
1864                    point = nextPoint(point);
1865                }
1866
1867                return null;
1868            }
1869
1870            /**
1871             * returns whether point has character or not.
1872             *
1873             * @param {Point} point
1874             * @return {Boolean}
1875             */
1876
1877
1878            function isCharPoint(point) {
1879                if (!isText(point.node)) {
1880                    return false;
1881                }
1882
1883                var ch = point.node.nodeValue.charAt(point.offset - 1);
1884                return ch && ch !== ' ' && ch !== NBSP_CHAR;
1885            }
1886
1887            /**
1888             * returns whether point has space or not.
1889             *
1890             * @param {Point} point
1891             * @return {Boolean}
1892             */
1893
1894
1895            function isSpacePoint(point) {
1896                if (!isText(point.node)) {
1897                    return false;
1898                }
1899
1900                var ch = point.node.nodeValue.charAt(point.offset - 1);
1901                return ch === ' ' || ch === NBSP_CHAR;
1902            }
1903
1904            /**
1905             * @method walkPoint
1906             *
1907             * @param {BoundaryPoint} startPoint
1908             * @param {BoundaryPoint} endPoint
1909             * @param {Function} handler
1910             * @param {Boolean} isSkipInnerOffset
1911             */
1912
1913
1914            function walkPoint(startPoint, endPoint, handler, isSkipInnerOffset) {
1915                var point = startPoint;
1916
1917                while (point) {
1918                    handler(point);
1919
1920                    if (isSamePoint(point, endPoint)) {
1921                        break;
1922                    }
1923
1924                    var isSkipOffset = isSkipInnerOffset && startPoint.node !== point.node && endPoint.node !== point.node;
vendor: 2,464 bytes, lines 1925-1994
1925                    point = nextPointWithEmptyNode(point, isSkipOffset);
1926                }
1927            }
1928
1929            /**
1930             * @method makeOffsetPath
1931             *
1932             * return offsetPath(array of offset) from ancestor
1933             *
1934             * @param {Node} ancestor - ancestor node
1935             * @param {Node} node
1936             */
1937
1938
1939            function makeOffsetPath(ancestor, node) {
1940                var ancestors = listAncestor(node, func.eq(ancestor));
1941                return ancestors.map(position).reverse();
1942            }
1943
1944            /**
1945             * @method fromOffsetPath
1946             *
1947             * return element from offsetPath(array of offset)
1948             *
1949             * @param {Node} ancestor - ancestor node
1950             * @param {array} offsets - offsetPath
1951             */
1952
1953
1954            function fromOffsetPath(ancestor, offsets) {
1955                var current = ancestor;
1956
1957                for (var i = 0, len = offsets.length; i < len; i++) {
1958                    if (current.childNodes.length <= offsets[i]) {
1959                        current = current.childNodes[current.childNodes.length - 1];
1960                    } else {
1961                        current = current.childNodes[offsets[i]];
1962                    }
1963                }
1964
1965                return current;
1966            }
1967
1968            /**
1969             * @method splitNode
1970             *
1971             * split element or #text
1972             *
1973             * @param {BoundaryPoint} point
1974             * @param {Object} [options]
1975             * @param {Boolean} [options.isSkipPaddingBlankHTML] - default: false
1976             * @param {Boolean} [options.isNotSplitEdgePoint] - default: false
1977             * @param {Boolean} [options.isDiscardEmptySplits] - default: false
1978             * @return {Node} right node of boundaryPoint
1979             */
1980
1981
1982            function splitNode(point, options) {
1983                var isSkipPaddingBlankHTML = options && options.isSkipPaddingBlankHTML;
1984                var isNotSplitEdgePoint = options && options.isNotSplitEdgePoint;
1985                var isDiscardEmptySplits = options && options.isDiscardEmptySplits;
1986
1987                if (isDiscardEmptySplits) {
1988                    isSkipPaddingBlankHTML = true;
1989                } // edge case
1990
1991
1992                if (isEdgePoint(point) && (isText(point.node) || isNotSplitEdgePoint)) {
1993                    if (isLeftEdgePoint(point)) {
1994                        return point.node;
vendor: 5,887 bytes, lines 1995-2176
1995                    } else if (isRightEdgePoint(point)) {
1996                        return point.node.nextSibling;
1997                    }
1998                } // split #text
1999
2000
2001                if (isText(point.node)) {
2002                    return point.node.splitText(point.offset);
2003                } else {
2004                    var childNode = point.node.childNodes[point.offset];
2005                    var clone = insertAfter(point.node.cloneNode(false), point.node);
2006                    appendChildNodes(clone, listNext(childNode));
2007
2008                    if (!isSkipPaddingBlankHTML) {
2009                        paddingBlankHTML(point.node);
2010                        paddingBlankHTML(clone);
2011                    }
2012
2013                    if (isDiscardEmptySplits) {
2014                        if (dom_isEmpty(point.node)) {
2015                            remove(point.node);
2016                        }
2017
2018                        if (dom_isEmpty(clone)) {
2019                            remove(clone);
2020                            return point.node.nextSibling;
2021                        }
2022                    }
2023
2024                    return clone;
2025                }
2026            }
2027
2028            /**
2029             * @method splitTree
2030             *
2031             * split tree by point
2032             *
2033             * @param {Node} root - split root
2034             * @param {BoundaryPoint} point
2035             * @param {Object} [options]
2036             * @param {Boolean} [options.isSkipPaddingBlankHTML] - default: false
2037             * @param {Boolean} [options.isNotSplitEdgePoint] - default: false
2038             * @return {Node} right node of boundaryPoint
2039             */
2040
2041
2042            function splitTree(root, point, options) {
2043                // ex) [#text, <span>, <p>]
2044                var ancestors = listAncestor(point.node, func.eq(root));
2045
2046                if (!ancestors.length) {
2047                    return null;
2048                } else if (ancestors.length === 1) {
2049                    return splitNode(point, options);
2050                }
2051
2052                return ancestors.reduce(function (node, parent) {
2053                    if (node === point.node) {
2054                        node = splitNode(point, options);
2055                    }
2056
2057                    return splitNode({
2058                        node: parent,
2059                        offset: node ? position(node) : nodeLength(parent)
2060                    }, options);
2061                });
2062            }
2063
2064            /**
2065             * split point
2066             *
2067             * @param {Point} point
2068             * @param {Boolean} isInline
2069             * @return {Object}
2070             */
2071
2072
2073            function splitPoint(point, isInline) {
2074                // find splitRoot, container
2075                //  - inline: splitRoot is a child of paragraph
2076                //  - block: splitRoot is a child of bodyContainer
2077                var pred = isInline ? isPara : isBodyContainer;
2078                var ancestors = listAncestor(point.node, pred);
2079                var topAncestor = lists.last(ancestors) || point.node;
2080                var splitRoot, container;
2081
2082                if (pred(topAncestor)) {
2083                    splitRoot = ancestors[ancestors.length - 2];
2084                    container = topAncestor;
2085                } else {
2086                    splitRoot = topAncestor;
2087                    container = splitRoot.parentNode;
2088                } // if splitRoot is exists, split with splitTree
2089
2090
2091                var pivot = splitRoot && splitTree(splitRoot, point, {
2092                    isSkipPaddingBlankHTML: isInline,
2093                    isNotSplitEdgePoint: isInline
2094                }); // if container is point.node, find pivot with point.offset
2095
2096                if (!pivot && container === point.node) {
2097                    pivot = point.node.childNodes[point.offset];
2098                }
2099
2100                return {
2101                    rightNode: pivot,
2102                    container: container
2103                };
2104            }
2105
2106            function create(nodeName) {
2107                return document.createElement(nodeName);
2108            }
2109
2110            function createText(text) {
2111                return document.createTextNode(text);
2112            }
2113
2114            /**
2115             * @method remove
2116             *
2117             * remove node, (isRemoveChild: remove child or not)
2118             *
2119             * @param {Node} node
2120             * @param {Boolean} isRemoveChild
2121             */
2122
2123
2124            function remove(node, isRemoveChild) {
2125                if (!node || !node.parentNode) {
2126                    return;
2127                }
2128
2129                if (node.removeNode) {
2130                    return node.removeNode(isRemoveChild);
2131                }
2132
2133                var parent = node.parentNode;
2134
2135                if (!isRemoveChild) {
2136                    var nodes = [];
2137
2138                    for (var i = 0, len = node.childNodes.length; i < len; i++) {
2139                        nodes.push(node.childNodes[i]);
2140                    }
2141
2142                    for (var _i = 0, _len = nodes.length; _i < _len; _i++) {
2143                        parent.insertBefore(nodes[_i], node);
2144                    }
2145                }
2146
2147                parent.removeChild(node);
2148            }
2149
2150            /**
2151             * @method removeWhile
2152             *
2153             * @param {Node} node
2154             * @param {Function} pred
2155             */
2156
2157
2158            function removeWhile(node, pred) {
2159                while (node) {
2160                    if (isEditable(node) || !pred(node)) {
2161                        break;
2162                    }
2163
2164                    var parent = node.parentNode;
2165                    remove(node);
2166                    node = parent;
2167                }
2168            }
2169
2170            /**
2171             * @method replace
2172             *
2173             * replace node with provided nodeName
2174             *
2175             * @param {Node} node
2176             * @param {String}
vendor: 5,118 bytes, lines 2176-2323
2176 nodeName
2177             * @return {Node} - new node
2178             */
2179
2180
2181            function replace(node, nodeName) {
2182                if (node.nodeName.toUpperCase() === nodeName.toUpperCase()) {
2183                    return node;
2184                }
2185
2186                var newNode = create(nodeName);
2187
2188                if (node.style.cssText) {
2189                    newNode.style.cssText = node.style.cssText;
2190                }
2191
2192                appendChildNodes(newNode, lists.from(node.childNodes));
2193                insertAfter(newNode, node);
2194                remove(node);
2195                return newNode;
2196            }
2197
2198            var isTextarea = makePredByNodeName('TEXTAREA');
2199
2200            /**
2201             * @param {jQuery} $node
2202             * @param {Boolean} [stripLinebreaks] - default: false
2203             */
2204
2205            function value($node, stripLinebreaks) {
2206                var val = isTextarea($node[0]) ? $node.val() : $node.html();
2207
2208                if (stripLinebreaks) {
2209                    return val.replace(/[\n\r]/g, '');
2210                }
2211
2212                return val;
2213            }
2214
2215            /**
2216             * @method html
2217             *
2218             * get the HTML contents of node
2219             *
2220             * @param {jQuery} $node
2221             * @param {Boolean} [isNewlineOnBlock]
2222             */
2223
2224
2225            function html($node, isNewlineOnBlock) {
2226                var markup = value($node);
2227
2228                if (isNewlineOnBlock) {
2229                    var regexTag = /<(\/?)(\b(?!!)[^>\s]*)(.*?)(\s*\/?>)/g;
2230                    markup = markup.replace(regexTag, function (match, endSlash, name) {
2231                        name = name.toUpperCase();
2232                        var isEndOfInlineContainer = /^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(name) && !!endSlash;
2233                        var isBlockNode = /^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(name);
2234                        return match + (isEndOfInlineContainer || isBlockNode ? '\n' : '');
2235                    });
2236                    markup = markup.trim();
2237                }
2238
2239                return markup;
2240            }
2241
2242            function posFromPlaceholder(placeholder) {
2243                var $placeholder = external_jQuery_default()(placeholder);
2244                var pos = $placeholder.offset();
2245                var height = $placeholder.outerHeight(true); // include margin
2246
2247                return {
2248                    left: pos.left,
2249                    top: pos.top + height
2250                };
2251            }
2252
2253            function attachEvents($node, events) {
2254                Object.keys(events).forEach(function (key) {
2255                    $node.on(key, events[key]);
2256                });
2257            }
2258
2259            function detachEvents($node, events) {
2260                Object.keys(events).forEach(function (key) {
2261                    $node.off(key, events[key]);
2262                });
2263            }
2264
2265            /**
2266             * @method isCustomStyleTag
2267             *
2268             * assert if a node contains a "note-styletag" class,
2269             * which implies that's a custom-made style tag node
2270             *
2271             * @param {Node} an HTML DOM node
2272             */
2273
2274
2275            function isCustomStyleTag(node) {
2276                return node && !isText(node) && lists.contains(node.classList, 'note-styletag');
2277            }
2278
2279            /* harmony default export */
2280            const dom = ({
2281                /** @property {String} NBSP_CHAR */
2282                NBSP_CHAR: NBSP_CHAR,
2283
2284                /** @property {String} ZERO_WIDTH_NBSP_CHAR */
2285                ZERO_WIDTH_NBSP_CHAR: ZERO_WIDTH_NBSP_CHAR,
2286
2287                /** @property {String} blank */
2288                blank: blankHTML,
2289
2290                /** @property {String} emptyPara */
2291                emptyPara: "<div>".concat(blankHTML, "</div>"),
2292                makePredByNodeName: makePredByNodeName,
2293                isEditable: isEditable,
2294                isControlSizing: isControlSizing,
2295                isText: isText,
2296                isElement: isElement,
2297                isVoid: isVoid,
2298                isPara: isPara,
2299                isPurePara: isPurePara,
2300                isHeading: isHeading,
2301                isInline: isInline,
2302                isBlock: func.not(isInline),
2303                isBodyInline: isBodyInline,
2304                isBody: isBody,
2305                isParaInline: isParaInline,
2306                isPre: isPre,
2307                isList: isList,
2308                isTable: isTable,
2309                isData: isData,
2310                isCell: isCell,
2311                isBlockquote: isBlockquote,
2312                isBodyContainer: isBodyContainer,
2313                isAnchor: isAnchor,
2314                isDiv: makePredByNodeName('DIV'),
2315                isLi: isLi,
2316                isBR: makePredByNodeName('BR'),
2317                isSpan: makePredByNodeName('SPAN'),
2318                isB: makePredByNodeName('B'),
2319                isU: makePredByNodeName('U'),
2320                isS: makePredByNodeName('S'),
2321                isI: makePredByNodeName('I'),
2322                isImg: makePredByNodeName('IMG'),
2323                isTextarea: isTextarea,
vendor: 4,761 bytes, lines 2324-2438
2324                deepestChildIsEmpty: deepestChildIsEmpty,
2325                isEmpty: dom_isEmpty,
2326                isEmptyAnchor: func.and(isAnchor, dom_isEmpty),
2327                isClosestSibling: isClosestSibling,
2328                withClosestSiblings: withClosestSiblings,
2329                nodeLength: nodeLength,
2330                isLeftEdgePoint: isLeftEdgePoint,
2331                isRightEdgePoint: isRightEdgePoint,
2332                isEdgePoint: isEdgePoint,
2333                isLeftEdgeOf: isLeftEdgeOf,
2334                isRightEdgeOf: isRightEdgeOf,
2335                isLeftEdgePointOf: isLeftEdgePointOf,
2336                isRightEdgePointOf: isRightEdgePointOf,
2337                prevPoint: prevPoint,
2338                nextPoint: nextPoint,
2339                nextPointWithEmptyNode: nextPointWithEmptyNode,
2340                isSamePoint: isSamePoint,
2341                isVisiblePoint: isVisiblePoint,
2342                prevPointUntil: prevPointUntil,
2343                nextPointUntil: nextPointUntil,
2344                isCharPoint: isCharPoint,
2345                isSpacePoint: isSpacePoint,
2346                walkPoint: walkPoint,
2347                ancestor: ancestor,
2348                singleChildAncestor: singleChildAncestor,
2349                listAncestor: listAncestor,
2350                lastAncestor: lastAncestor,
2351                listNext: listNext,
2352                listPrev: listPrev,
2353                listDescendant: listDescendant,
2354                commonAncestor: commonAncestor,
2355                wrap: wrap,
2356                insertAfter: insertAfter,
2357                appendChildNodes: appendChildNodes,
2358                position: position,
2359                hasChildren: hasChildren,
2360                makeOffsetPath: makeOffsetPath,
2361                fromOffsetPath: fromOffsetPath,
2362                splitTree: splitTree,
2363                splitPoint: splitPoint,
2364                create: create,
2365                createText: createText,
2366                remove: remove,
2367                removeWhile: removeWhile,
2368                replace: replace,
2369                html: html,
2370                value: value,
2371                posFromPlaceholder: posFromPlaceholder,
2372                attachEvents: attachEvents,
2373                detachEvents: detachEvents,
2374                isCustomStyleTag: isCustomStyleTag
2375            });
2376            ;// CONCATENATED MODULE: ./src/js/Context.js
2377            function _classCallCheck(instance, Constructor) {
2378                if (!(instance instanceof Constructor)) {
2379                    throw new TypeError("Cannot call a class as a function");
2380                }
2381            }
2382
2383            function _defineProperties(target, props) {
2384                for (var i = 0; i < props.length; i++) {
2385                    var descriptor = props[i];
2386                    descriptor.enumerable = descriptor.enumerable || false;
2387                    descriptor.configurable = true;
2388                    if ("value" in descriptor) descriptor.writable = true;
2389                    Object.defineProperty(target, descriptor.key, descriptor);
2390                }
2391            }
2392
2393            function _createClass(Constructor, protoProps, staticProps) {
2394                if (protoProps) _defineProperties(Constructor.prototype, protoProps);
2395                if (staticProps) _defineProperties(Constructor, staticProps);
2396                return Constructor;
2397            }
2398
2399
2400            var Context = /*#__PURE__*/function () {
2401                /**
2402                 * @param {jQuery} $note
2403                 * @param {Object} options
2404                 */
2405                function Context($note, options) {
2406                    _classCallCheck(this, Context);
2407
2408                    this.$note = $note;
2409                    this.memos = {};
2410                    this.modules = {};
2411                    this.layoutInfo = {};
2412                    this.options = external_jQuery_default().extend(true, {}, options); // init ui with options
2413
2414                    (external_jQuery_default()).summernote.ui = external_jQuery_default().summernote.ui_template(this.options);
2415                    this.ui = (external_jQuery_default()).summernote.ui;
2416                    this.initialize();
2417                }
2418
2419                /**
2420                 * create layout and initialize modules and other resources
2421                 */
2422
2423
2424                _createClass(Context, [{
2425                    key: "initialize",
2426                    value: function initialize() {
2427                        this.layoutInfo = this.ui.createLayout(this.$note);
2428
2429                        this._initialize();
2430
2431                        this.$note.hide();
2432                        return this;
2433                    }
2434                    /**
2435                     * destroy modules and other resources and remove layout
2436                     */
2437
2438                }, {
vendor: 9,999 bytes, lines 2439-2669
2439                    key: "destroy",
2440                    value: function destroy() {
2441                        this._destroy();
2442
2443                        this.$note.removeData('summernote');
2444                        this.ui.removeLayout(this.$note, this.layoutInfo);
2445                    }
2446                    /**
2447                     * destory modules and other resources and initialize it again
2448                     */
2449
2450                }, {
2451                    key: "reset",
2452                    value: function reset() {
2453                        var disabled = this.isDisabled();
2454                        this.code(dom.emptyPara);
2455
2456                        this._destroy();
2457
2458                        this._initialize();
2459
2460                        if (disabled) {
2461                            this.disable();
2462                        }
2463                    }
2464                }, {
2465                    key: "_initialize",
2466                    value: function _initialize() {
2467                        var _this = this;
2468
2469                        // set own id
2470                        this.options.id = func.uniqueId(external_jQuery_default().now()); // set default container for tooltips, popovers, and dialogs
2471
2472                        this.options.container = this.options.container || this.layoutInfo.editor; // add optional buttons
2473
2474                        var buttons = external_jQuery_default().extend({}, this.options.buttons);
2475                        Object.keys(buttons).forEach(function (key) {
2476                            _this.memo('button.' + key, buttons[key]);
2477                        });
2478                        var modules = external_jQuery_default().extend({}, this.options.modules, (external_jQuery_default()).summernote.plugins || {}); // add and initialize modules
2479
2480                        Object.keys(modules).forEach(function (key) {
2481                            _this.module(key, modules[key], true);
2482                        });
2483                        Object.keys(this.modules).forEach(function (key) {
2484                            _this.initializeModule(key);
2485                        });
2486                    }
2487                }, {
2488                    key: "_destroy",
2489                    value: function _destroy() {
2490                        var _this2 = this;
2491
2492                        // destroy modules with reversed order
2493                        Object.keys(this.modules).reverse().forEach(function (key) {
2494                            _this2.removeModule(key);
2495                        });
2496                        Object.keys(this.memos).forEach(function (key) {
2497                            _this2.removeMemo(key);
2498                        }); // trigger custom onDestroy callback
2499
2500                        this.triggerEvent('destroy', this);
2501                    }
2502                }, {
2503                    key: "code",
2504                    value: function code(html) {
2505                        var isActivated = this.invoke('codeview.isActivated');
2506
2507                        if (html === undefined) {
2508                            this.invoke('codeview.sync');
2509                            return isActivated ? this.layoutInfo.codable.val() : this.layoutInfo.editable.html();
2510                        } else {
2511                            if (isActivated) {
2512                                this.invoke('codeview.sync', html);
2513                            } else {
2514                                this.layoutInfo.editable.html(html);
2515                            }
2516
2517                            this.$note.val(html);
2518                            this.triggerEvent('change', html, this.layoutInfo.editable);
2519                        }
2520                    }
2521                }, {
2522                    key: "isDisabled",
2523                    value: function isDisabled() {
2524                        return this.layoutInfo.editable.attr('contenteditable') === 'false';
2525                    }
2526                }, {
2527                    key: "enable",
2528                    value: function enable() {
2529                        this.layoutInfo.editable.attr('contenteditable', true);
2530                        this.invoke('toolbar.activate', true);
2531                        this.triggerEvent('disable', false);
2532                        this.options.editing = true;
2533                    }
2534                }, {
2535                    key: "disable",
2536                    value: function disable() {
2537                        // close codeview if codeview is opend
2538                        if (this.invoke('codeview.isActivated')) {
2539                            this.invoke('codeview.deactivate');
2540                        }
2541
2542                        this.layoutInfo.editable.attr('contenteditable', false);
2543                        this.options.editing = false;
2544                        this.invoke('toolbar.deactivate', true);
2545                        this.triggerEvent('disable', true);
2546                    }
2547                }, {
2548                    key: "triggerEvent",
2549                    value: function triggerEvent() {
2550                        var namespace = lists.head(arguments);
2551                        var args = lists.tail(lists.from(arguments));
2552                        var callback = this.options.callbacks[func.namespaceToCamel(namespace, 'on')];
2553
2554                        if (callback) {
2555                            callback.apply(this.$note[0], args);
2556                        }
2557
2558                        this.$note.trigger('summernote.' + namespace, args);
2559                    }
2560                }, {
2561                    key: "initializeModule",
2562                    value: function initializeModule(key) {
2563                        var module = this.modules[key];
2564                        module.shouldInitialize = module.shouldInitialize || func.ok;
2565
2566                        if (!module.shouldInitialize()) {
2567                            return;
2568                        } // initialize module
2569
2570
2571                        if (module.initialize) {
2572                            module.initialize();
2573                        } // attach events
2574
2575
2576                        if (module.events) {
2577                            dom.attachEvents(this.$note, module.events);
2578                        }
2579                    }
2580                }, {
2581                    key: "module",
2582                    value: function module(key, ModuleClass, withoutIntialize) {
2583                        if (arguments.length === 1) {
2584                            return this.modules[key];
2585                        }
2586
2587                        this.modules[key] = new ModuleClass(this);
2588
2589                        if (!withoutIntialize) {
2590                            this.initializeModule(key);
2591                        }
2592                    }
2593                }, {
2594                    key: "removeModule",
2595                    value: function removeModule(key) {
2596                        var module = this.modules[key];
2597
2598                        if (module.shouldInitialize()) {
2599                            if (module.events) {
2600                                dom.detachEvents(this.$note, module.events);
2601                            }
2602
2603                            if (module.destroy) {
2604                                module.destroy();
2605                            }
2606                        }
2607
2608                        delete this.modules[key];
2609                    }
2610                }, {
2611                    key: "memo",
2612                    value: function memo(key, obj) {
2613                        if (arguments.length === 1) {
2614                            return this.memos[key];
2615                        }
2616
2617                        this.memos[key] = obj;
2618                    }
2619                }, {
2620                    key: "removeMemo",
2621                    value: function removeMemo(key) {
2622                        if (this.memos[key] && this.memos[key].destroy) {
2623                            this.memos[key].destroy();
2624                        }
2625
2626                        delete this.memos[key];
2627                    }
2628                    /**
2629                     * Some buttons need to change their visual style immediately once they get pressed
2630                     */
2631
2632                }, {
2633                    key: "createInvokeHandlerAndUpdateState",
2634                    value: function createInvokeHandlerAndUpdateState(namespace, value) {
2635                        var _this3 = this;
2636
2637                        return function (event) {
2638                            _this3.createInvokeHandler(namespace, value)(event);
2639
2640                            _this3.invoke('buttons.updateCurrentStyle');
2641                        };
2642                    }
2643                }, {
2644                    key: "createInvokeHandler",
2645                    value: function createInvokeHandler(namespace, value) {
2646                        var _this4 = this;
2647
2648                        return function (event) {
2649                            event.preventDefault();
2650                            var $target = external_jQuery_default()(event.target);
2651
2652                            _this4.invoke(namespace, value || $target.closest('[data-value]').data('value'), $target);
2653                        };
2654                    }
2655                }, {
2656                    key: "invoke",
2657                    value: function invoke() {
2658                        var namespace = lists.head(arguments);
2659                        var args = lists.tail(lists.from(arguments));
2660                        var splits = namespace.split('.');
2661                        var hasSeparator = splits.length > 1;
2662                        var moduleName = hasSeparator && lists.head(splits);
2663                        var methodName = hasSeparator ? lists.last(splits) : lists.head(splits);
2664                        var module = this.modules[moduleName || 'editor'];
2665
2666                        if (!moduleName && this[methodName]) {
2667                            return this[methodName].apply(this, args);
2668                        } else if (module && module[methodName] && module.shouldInitialize()) {
2669                            return module[methodName].apply(module, args
vendor: 4,223 bytes, lines 2669-2766
2669);
2670                        }
2671                    }
2672                }]);
2673
2674                return Context;
2675            }();
2676
2677
2678            ;// CONCATENATED MODULE: ./src/js/summernote.js
2679
2680
2681            external_jQuery_default().fn.extend({
2682                /**
2683                 * Summernote API
2684                 *
2685                 * @param {Object|String}
2686                 * @return {this}
2687                 */
2688                summernote: function summernote() {
2689                    var type = external_jQuery_default().type(lists.head(arguments));
2690                    var isExternalAPICalled = type === 'string';
2691                    var hasInitOptions = type === 'object';
2692                    var options = external_jQuery_default().extend({}, (external_jQuery_default()).summernote.options, hasInitOptions ? lists.head(arguments) : {}); // Update options
2693
2694                    options.langInfo = external_jQuery_default().extend(true, {}, (external_jQuery_default()).summernote.lang["en-US"], (external_jQuery_default()).summernote.lang[options.lang]);
2695                    options.icons = external_jQuery_default().extend(true, {}, (external_jQuery_default()).summernote.options.icons, options.icons);
2696                    options.tooltip = options.tooltip === 'auto' ? !env.isSupportTouch : options.tooltip;
2697                    this.each(function (idx, note) {
2698                        var $note = external_jQuery_default()(note);
2699
2700                        if (!$note.data('summernote')) {
2701                            var context = new Context($note, options);
2702                            $note.data('summernote', context);
2703                            $note.data('summernote').triggerEvent('init', context.layoutInfo);
2704                        }
2705                    });
2706                    var $note = this.first();
2707
2708                    if ($note.length) {
2709                        var context = $note.data('summernote');
2710
2711                        if (isExternalAPICalled) {
2712                            return context.invoke.apply(context, lists.from(arguments));
2713                        } else if (options.focus) {
2714                            context.invoke('editor.focus');
2715                        }
2716                    }
2717
2718                    return this;
2719                }
2720            });
2721            ;// CONCATENATED MODULE: ./src/js/core/range.js
2722            function range_classCallCheck(instance, Constructor) {
2723                if (!(instance instanceof Constructor)) {
2724                    throw new TypeError("Cannot call a class as a function");
2725                }
2726            }
2727
2728            function range_defineProperties(target, props) {
2729                for (var i = 0; i < props.length; i++) {
2730                    var descriptor = props[i];
2731                    descriptor.enumerable = descriptor.enumerable || false;
2732                    descriptor.configurable = true;
2733                    if ("value" in descriptor) descriptor.writable = true;
2734                    Object.defineProperty(target, descriptor.key, descriptor);
2735                }
2736            }
2737
2738            function range_createClass(Constructor, protoProps, staticProps) {
2739                if (protoProps) range_defineProperties(Constructor.prototype, protoProps);
2740                if (staticProps) range_defineProperties(Constructor, staticProps);
2741                return Constructor;
2742            }
2743
2744
2745            /**
2746             * return boundaryPoint from TextRange, inspired by Andy Na's HuskyRange.js
2747             *
2748             * @param {TextRange} textRange
2749             * @param {Boolean} isStart
2750             * @return {BoundaryPoint}
2751             *
2752             * @see http://msdn.microsoft.com/en-us/library/ie/ms535872(v=vs.85).aspx
2753             */
2754
2755            function textRangeToPoint(textRange, isStart) {
2756                var container = textRange.parentElement();
2757                var offset;
2758                var tester = document.body.createTextRange();
2759                var prevContainer;
2760                var childNodes = lists.from(container.childNodes);
2761
2762                for (offset = 0; offset < childNodes.length; offset++) {
2763                    if (dom.isText(childNodes[offset])) {
2764                        continue;
2765                    }
2766
vendor: 3,013 bytes, lines 2767-2834
2767                    tester.moveToElementText(childNodes[offset]);
2768
2769                    if (tester.compareEndPoints('StartToStart', textRange) >= 0) {
2770                        break;
2771                    }
2772
2773                    prevContainer = childNodes[offset];
2774                }
2775
2776                if (offset !== 0 && dom.isText(childNodes[offset - 1])) {
2777                    var textRangeStart = document.body.createTextRange();
2778                    var curTextNode = null;
2779                    textRangeStart.moveToElementText(prevContainer || container);
2780                    textRangeStart.collapse(!prevContainer);
2781                    curTextNode = prevContainer ? prevContainer.nextSibling : container.firstChild;
2782                    var pointTester = textRange.duplicate();
2783                    pointTester.setEndPoint('StartToStart', textRangeStart);
2784                    var textCount = pointTester.text.replace(/[\r\n]/g, '').length;
2785
2786                    while (textCount > curTextNode.nodeValue.length && curTextNode.nextSibling) {
2787                        textCount -= curTextNode.nodeValue.length;
2788                        curTextNode = curTextNode.nextSibling;
2789                    } // [workaround] enforce IE to re-reference curTextNode, hack
2790
2791
2792                    var dummy = curTextNode.nodeValue; // eslint-disable-line
2793
2794                    if (isStart && curTextNode.nextSibling && dom.isText(curTextNode.nextSibling) && textCount === curTextNode.nodeValue.length) {
2795                        textCount -= curTextNode.nodeValue.length;
2796                        curTextNode = curTextNode.nextSibling;
2797                    }
2798
2799                    container = curTextNode;
2800                    offset = textCount;
2801                }
2802
2803                return {
2804                    cont: container,
2805                    offset: offset
2806                };
2807            }
2808
2809            /**
2810             * return TextRange from boundary point (inspired by google closure-library)
2811             * @param {BoundaryPoint} point
2812             * @return {TextRange}
2813             */
2814
2815
2816            function pointToTextRange(point) {
2817                var textRangeInfo = function textRangeInfo(container, offset) {
2818                    var node, isCollapseToStart;
2819
2820                    if (dom.isText(container)) {
2821                        var prevTextNodes = dom.listPrev(container, func.not(dom.isText));
2822                        var prevContainer = lists.last(prevTextNodes).previousSibling;
2823                        node = prevContainer || container.parentNode;
2824                        offset += lists.sum(lists.tail(prevTextNodes), dom.nodeLength);
2825                        isCollapseToStart = !prevContainer;
2826                    } else {
2827                        node = container.childNodes[offset] || container;
2828
2829                        if (dom.isText(node)) {
2830                            return textRangeInfo(node, 0);
2831                        }
2832
2833                        offset = 0;
2834                        isCollapseToStart = false;
vendor: 7,428 bytes, lines 2835-3003
2835                    }
2836
2837                    return {
2838                        node: node,
2839                        collapseToStart: isCollapseToStart,
2840                        offset: offset
2841                    };
2842                };
2843
2844                var textRange = document.body.createTextRange();
2845                var info = textRangeInfo(point.node, point.offset);
2846                textRange.moveToElementText(info.node);
2847                textRange.collapse(info.collapseToStart);
2848                textRange.moveStart('character', info.offset);
2849                return textRange;
2850            }
2851
2852            /**
2853             * Wrapped Range
2854             *
2855             * @constructor
2856             * @param {Node} sc - start container
2857             * @param {Number} so - start offset
2858             * @param {Node} ec - end container
2859             * @param {Number} eo - end offset
2860             */
2861
2862
2863            var WrappedRange = /*#__PURE__*/function () {
2864                function WrappedRange(sc, so, ec, eo) {
2865                    range_classCallCheck(this, WrappedRange);
2866
2867                    this.sc = sc;
2868                    this.so = so;
2869                    this.ec = ec;
2870                    this.eo = eo; // isOnEditable: judge whether range is on editable or not
2871
2872                    this.isOnEditable = this.makeIsOn(dom.isEditable); // isOnList: judge whether range is on list node or not
2873
2874                    this.isOnList = this.makeIsOn(dom.isList); // isOnAnchor: judge whether range is on anchor node or not
2875
2876                    this.isOnAnchor = this.makeIsOn(dom.isAnchor); // isOnCell: judge whether range is on cell node or not
2877
2878                    this.isOnCell = this.makeIsOn(dom.isCell); // isOnData: judge whether range is on data node or not
2879
2880                    this.isOnData = this.makeIsOn(dom.isData);
2881                } // nativeRange: get nativeRange from sc, so, ec, eo
2882
2883
2884                range_createClass(WrappedRange, [{
2885                    key: "nativeRange",
2886                    value: function nativeRange() {
2887                        if (env.isW3CRangeSupport) {
2888                            var w3cRange = document.createRange();
2889                            w3cRange.setStart(this.sc, this.so);
2890                            w3cRange.setEnd(this.ec, this.eo);
2891                            return w3cRange;
2892                        } else {
2893                            var textRange = pointToTextRange({
2894                                node: this.sc,
2895                                offset: this.so
2896                            });
2897                            textRange.setEndPoint('EndToEnd', pointToTextRange({
2898                                node: this.ec,
2899                                offset: this.eo
2900                            }));
2901                            return textRange;
2902                        }
2903                    }
2904                }, {
2905                    key: "getPoints",
2906                    value: function getPoints() {
2907                        return {
2908                            sc: this.sc,
2909                            so: this.so,
2910                            ec: this.ec,
2911                            eo: this.eo
2912                        };
2913                    }
2914                }, {
2915                    key: "getStartPoint",
2916                    value: function getStartPoint() {
2917                        return {
2918                            node: this.sc,
2919                            offset: this.so
2920                        };
2921                    }
2922                }, {
2923                    key: "getEndPoint",
2924                    value: function getEndPoint() {
2925                        return {
2926                            node: this.ec,
2927                            offset: this.eo
2928                        };
2929                    }
2930                    /**
2931                     * select update visible range
2932                     */
2933
2934                }, {
2935                    key: "select",
2936                    value: function select() {
2937                        var nativeRng = this.nativeRange();
2938
2939                        if (env.isW3CRangeSupport) {
2940                            var selection = document.getSelection();
2941
2942                            if (selection.rangeCount > 0) {
2943                                selection.removeAllRanges();
2944                            }
2945
2946                            selection.addRange(nativeRng);
2947                        } else {
2948                            nativeRng.select();
2949                        }
2950
2951                        return this;
2952                    }
2953                    /**
2954                     * Moves the scrollbar to start container(sc) of current range
2955                     *
2956                     * @return {WrappedRange}
2957                     */
2958
2959                }, {
2960                    key: "scrollIntoView",
2961                    value: function scrollIntoView(container) {
2962                        var height = external_jQuery_default()(container).height();
2963
2964                        if (container.scrollTop + height < this.sc.offsetTop) {
2965                            container.scrollTop += Math.abs(container.scrollTop + height - this.sc.offsetTop);
2966                        }
2967
2968                        return this;
2969                    }
2970                    /**
2971                     * @return {WrappedRange}
2972                     */
2973
2974                }, {
2975                    key: "normalize",
2976                    value: function normalize() {
2977                        /**
2978                         * @param {BoundaryPoint} point
2979                         * @param {Boolean} isLeftToRight - true: prefer to choose right node
2980                         *                                - false: prefer to choose left node
2981                         * @return {BoundaryPoint}
2982                         */
2983                        var getVisiblePoint = function getVisiblePoint(point, isLeftToRight) {
2984                            if (!point) {
2985                                return point;
2986                            } // Just use the given point [XXX:Adhoc]
2987                            //  - case 01. if the point is on the middle of the node
2988                            //  - case 02. if the point is on the right edge and prefer to choose left node
2989                            //  - case 03. if the point is on the left edge and prefer to choose right node
2990                            //  - case 04. if the point is on the right edge and prefer to choose right node but the node is void
2991                            //  - case 05. if the point is on the left edge and prefer to choose left node but the node is void
2992                            //  - case 06. if the point is on the block node and there is no children
2993
2994
2995                            if (dom.isVisiblePoint(point)) {
2996                                if (!dom.isEdgePoint(point) || dom.isRightEdgePoint(point) && !isLeftToRight || dom.isLeftEdgePoint(point) && isLeftToRight || dom.isRightEdgePoint(point) && isLeftToRight && dom.isVoid(point.node.nextSibling) || dom.isLeftEdgePoint(point) && !isLeftToRight && dom.isVoid(point.node.previousSibling) || dom.isBlock(point.node) && dom.isEmpty(point.node)) {
2997                                    return point;
2998                                }
2999                            } // point on block's edge
3000
3001
3002                            var block = dom.ancestor(point.node, dom.isBlock);
3003                            var hasRightNode = false;
vendor: 9,551 bytes, lines 3004-3223
3004
3005                            if (!hasRightNode) {
3006                                var prevPoint = dom.prevPoint(point) || {
3007                                    node: null
3008                                };
3009                                hasRightNode = (dom.isLeftEdgePointOf(point, block) || dom.isVoid(prevPoint.node)) && !isLeftToRight;
3010                            }
3011
3012                            var hasLeftNode = false;
3013
3014                            if (!hasLeftNode) {
3015                                var _nextPoint = dom.nextPoint(point) || {
3016                                    node: null
3017                                };
3018
3019                                hasLeftNode = (dom.isRightEdgePointOf(point, block) || dom.isVoid(_nextPoint.node)) && isLeftToRight;
3020                            }
3021
3022                            if (hasRightNode || hasLeftNode) {
3023                                // returns point already on visible point
3024                                if (dom.isVisiblePoint(point)) {
3025                                    return point;
3026                                } // reverse direction
3027
3028
3029                                isLeftToRight = !isLeftToRight;
3030                            }
3031
3032                            var nextPoint = isLeftToRight ? dom.nextPointUntil(dom.nextPoint(point), dom.isVisiblePoint) : dom.prevPointUntil(dom.prevPoint(point), dom.isVisiblePoint);
3033                            return nextPoint || point;
3034                        };
3035
3036                        var endPoint = getVisiblePoint(this.getEndPoint(), false);
3037                        var startPoint = this.isCollapsed() ? endPoint : getVisiblePoint(this.getStartPoint(), true);
3038                        return new WrappedRange(startPoint.node, startPoint.offset, endPoint.node, endPoint.offset);
3039                    }
3040                    /**
3041                     * returns matched nodes on range
3042                     *
3043                     * @param {Function} [pred] - predicate function
3044                     * @param {Object} [options]
3045                     * @param {Boolean} [options.includeAncestor]
3046                     * @param {Boolean} [options.fullyContains]
3047                     * @return {Node[]}
3048                     */
3049
3050                }, {
3051                    key: "nodes",
3052                    value: function nodes(pred, options) {
3053                        pred = pred || func.ok;
3054                        var includeAncestor = options && options.includeAncestor;
3055                        var fullyContains = options && options.fullyContains; // TODO compare points and sort
3056
3057                        var startPoint = this.getStartPoint();
3058                        var endPoint = this.getEndPoint();
3059                        var nodes = [];
3060                        var leftEdgeNodes = [];
3061                        dom.walkPoint(startPoint, endPoint, function (point) {
3062                            if (dom.isEditable(point.node)) {
3063                                return;
3064                            }
3065
3066                            var node;
3067
3068                            if (fullyContains) {
3069                                if (dom.isLeftEdgePoint(point)) {
3070                                    leftEdgeNodes.push(point.node);
3071                                }
3072
3073                                if (dom.isRightEdgePoint(point) && lists.contains(leftEdgeNodes, point.node)) {
3074                                    node = point.node;
3075                                }
3076                            } else if (includeAncestor) {
3077                                node = dom.ancestor(point.node, pred);
3078                            } else {
3079                                node = point.node;
3080                            }
3081
3082                            if (node && pred(node)) {
3083                                nodes.push(node);
3084                            }
3085                        }, true);
3086                        return lists.unique(nodes);
3087                    }
3088                    /**
3089                     * returns commonAncestor of range
3090                     * @return {Element} - commonAncestor
3091                     */
3092
3093                }, {
3094                    key: "commonAncestor",
3095                    value: function commonAncestor() {
3096                        return dom.commonAncestor(this.sc, this.ec);
3097                    }
3098                    /**
3099                     * returns expanded range by pred
3100                     *
3101                     * @param {Function} pred - predicate function
3102                     * @return {WrappedRange}
3103                     */
3104
3105                }, {
3106                    key: "expand",
3107                    value: function expand(pred) {
3108                        var startAncestor = dom.ancestor(this.sc, pred);
3109                        var endAncestor = dom.ancestor(this.ec, pred);
3110
3111                        if (!startAncestor && !endAncestor) {
3112                            return new WrappedRange(this.sc, this.so, this.ec, this.eo);
3113                        }
3114
3115                        var boundaryPoints = this.getPoints();
3116
3117                        if (startAncestor) {
3118                            boundaryPoints.sc = startAncestor;
3119                            boundaryPoints.so = 0;
3120                        }
3121
3122                        if (endAncestor) {
3123                            boundaryPoints.ec = endAncestor;
3124                            boundaryPoints.eo = dom.nodeLength(endAncestor);
3125                        }
3126
3127                        return new WrappedRange(boundaryPoints.sc, boundaryPoints.so, boundaryPoints.ec, boundaryPoints.eo);
3128                    }
3129                    /**
3130                     * @param {Boolean} isCollapseToStart
3131                     * @return {WrappedRange}
3132                     */
3133
3134                }, {
3135                    key: "collapse",
3136                    value: function collapse(isCollapseToStart) {
3137                        if (isCollapseToStart) {
3138                            return new WrappedRange(this.sc, this.so, this.sc, this.so);
3139                        } else {
3140                            return new WrappedRange(this.ec, this.eo, this.ec, this.eo);
3141                        }
3142                    }
3143                    /**
3144                     * splitText on range
3145                     */
3146
3147                }, {
3148                    key: "splitText",
3149                    value: function splitText() {
3150                        var isSameContainer = this.sc === this.ec;
3151                        var boundaryPoints = this.getPoints();
3152
3153                        if (dom.isText(this.ec) && !dom.isEdgePoint(this.getEndPoint())) {
3154                            this.ec.splitText(this.eo);
3155                        }
3156
3157                        if (dom.isText(this.sc) && !dom.isEdgePoint(this.getStartPoint())) {
3158                            boundaryPoints.sc = this.sc.splitText(this.so);
3159                            boundaryPoints.so = 0;
3160
3161                            if (isSameContainer) {
3162                                boundaryPoints.ec = boundaryPoints.sc;
3163                                boundaryPoints.eo = this.eo - this.so;
3164                            }
3165                        }
3166
3167                        return new WrappedRange(boundaryPoints.sc, boundaryPoints.so, boundaryPoints.ec, boundaryPoints.eo);
3168                    }
3169                    /**
3170                     * delete contents on range
3171                     * @return {WrappedRange}
3172                     */
3173
3174                }, {
3175                    key: "deleteContents",
3176                    value: function deleteContents() {
3177                        if (this.isCollapsed()) {
3178                            return this;
3179                        }
3180
3181                        var rng = this.splitText();
3182                        var nodes = rng.nodes(null, {
3183                            fullyContains: true
3184                        }); // find new cursor point
3185
3186                        var point = dom.prevPointUntil(rng.getStartPoint(), function (point) {
3187                            return !lists.contains(nodes, point.node);
3188                        });
3189                        var emptyParents = [];
3190                        external_jQuery_default().each(nodes, function (idx, node) {
3191                            // find empty parents
3192                            var parent = node.parentNode;
3193
3194                            if (point.node !== parent && dom.nodeLength(parent) === 1) {
3195                                emptyParents.push(parent);
3196                            }
3197
3198                            dom.remove(node, false);
3199                        }); // remove empty parents
3200
3201                        external_jQuery_default().each(emptyParents, function (idx, node) {
3202                            dom.remove(node, false);
3203                        });
3204                        return new WrappedRange(point.node, point.offset, point.node, point.offset).normalize();
3205                    }
3206                    /**
3207                     * makeIsOn: return isOn(pred) function
3208                     */
3209
3210                }, {
3211                    key: "makeIsOn",
3212                    value: function makeIsOn(pred) {
3213                        return function () {
3214                            var ancestor = dom.ancestor(this.sc, pred);
3215                            return !!ancestor && ancestor === dom.ancestor(this.ec, pred);
3216                        };
3217                    }
3218                    /**
3219                     * @param {Function} pred
3220                     * @return {Boolean}
3221                     */
3222
3223                }, {
vendor: 13,873 bytes, lines 3224-3557
3224                    key: "isLeftEdgeOf",
3225                    value: function isLeftEdgeOf(pred) {
3226                        if (!dom.isLeftEdgePoint(this.getStartPoint())) {
3227                            return false;
3228                        }
3229
3230                        var node = dom.ancestor(this.sc, pred);
3231                        return node && dom.isLeftEdgeOf(this.sc, node);
3232                    }
3233                    /**
3234                     * returns whether range was collapsed or not
3235                     */
3236
3237                }, {
3238                    key: "isCollapsed",
3239                    value: function isCollapsed() {
3240                        return this.sc === this.ec && this.so === this.eo;
3241                    }
3242                    /**
3243                     * wrap inline nodes which children of body with paragraph
3244                     *
3245                     * @return {WrappedRange}
3246                     */
3247
3248                }, {
3249                    key: "wrapBodyInlineWithPara",
3250                    value: function wrapBodyInlineWithPara() {
3251                        if (dom.isBodyContainer(this.sc) && dom.isEmpty(this.sc)) {
3252                            this.sc.innerHTML = dom.emptyPara;
3253                            return new WrappedRange(this.sc.firstChild, 0, this.sc.firstChild, 0);
3254                        }
3255                        /**
3256                         * [workaround] firefox often create range on not visible point. so normalize here.
3257                         *  - firefox: |<p>text</p>|
3258                         *  - chrome: <p>|text|</p>
3259                         */
3260
3261
3262                        var rng = this.normalize();
3263
3264                        if (dom.isParaInline(this.sc) || dom.isPara(this.sc)) {
3265                            return rng;
3266                        } // find inline top ancestor
3267
3268
3269                        var topAncestor;
3270
3271                        if (dom.isInline(rng.sc)) {
3272                            var ancestors = dom.listAncestor(rng.sc, func.not(dom.isInline));
3273                            topAncestor = lists.last(ancestors);
3274
3275                            if (!dom.isInline(topAncestor)) {
3276                                topAncestor = ancestors[ancestors.length - 2] || rng.sc.childNodes[rng.so];
3277                            }
3278                        } else {
3279                            topAncestor = rng.sc.childNodes[rng.so > 0 ? rng.so - 1 : 0];
3280                        }
3281
3282                        if (topAncestor) {
3283                            // siblings not in paragraph
3284                            var inlineSiblings = dom.listPrev(topAncestor, dom.isParaInline).reverse();
3285                            inlineSiblings = inlineSiblings.concat(dom.listNext(topAncestor.nextSibling, dom.isParaInline)); // wrap with paragraph
3286
3287                            if (inlineSiblings.length) {
3288                                var para = dom.wrap(lists.head(inlineSiblings), 'p');
3289                                dom.appendChildNodes(para, lists.tail(inlineSiblings));
3290                            }
3291                        }
3292
3293                        return this.normalize();
3294                    }
3295                    /**
3296                     * insert node at current cursor
3297                     *
3298                     * @param {Node} node
3299                     * @return {Node}
3300                     */
3301
3302                }, {
3303                    key: "insertNode",
3304                    value: function insertNode(node) {
3305                        var rng = this;
3306
3307                        if (dom.isText(node) || dom.isInline(node)) {
3308                            rng = this.wrapBodyInlineWithPara().deleteContents();
3309                        }
3310
3311                        var info = dom.splitPoint(rng.getStartPoint(), dom.isInline(node));
3312
3313                        if (info.rightNode) {
3314                            info.rightNode.parentNode.insertBefore(node, info.rightNode);
3315
3316                            if (dom.isEmpty(info.rightNode) && dom.isPara(node)) {
3317                                info.rightNode.parentNode.removeChild(info.rightNode);
3318                            }
3319                        } else {
3320                            info.container.appendChild(node);
3321                        }
3322
3323                        return node;
3324                    }
3325                    /**
3326                     * insert html at current cursor
3327                     */
3328
3329                }, {
3330                    key: "pasteHTML",
3331                    value: function pasteHTML(markup) {
3332                        markup = external_jQuery_default().trim(markup);
3333                        var contentsContainer = external_jQuery_default()('<div></div>').html(markup)[0];
3334                        var childNodes = lists.from(contentsContainer.childNodes); // const rng = this.wrapBodyInlineWithPara().deleteContents();
3335
3336                        var rng = this;
3337                        var reversed = false;
3338
3339                        if (rng.so >= 0) {
3340                            childNodes = childNodes.reverse();
3341                            reversed = true;
3342                        }
3343
3344                        childNodes = childNodes.map(function (childNode) {
3345                            return rng.insertNode(childNode);
3346                        });
3347
3348                        if (reversed) {
3349                            childNodes = childNodes.reverse();
3350                        }
3351
3352                        return childNodes;
3353                    }
3354                    /**
3355                     * returns text in range
3356                     *
3357                     * @return {String}
3358                     */
3359
3360                }, {
3361                    key: "toString",
3362                    value: function toString() {
3363                        var nativeRng = this.nativeRange();
3364                        return env.isW3CRangeSupport ? nativeRng.toString() : nativeRng.text;
3365                    }
3366                    /**
3367                     * returns range for word before cursor
3368                     *
3369                     * @param {Boolean} [findAfter] - find after cursor, default: false
3370                     * @return {WrappedRange}
3371                     */
3372
3373                }, {
3374                    key: "getWordRange",
3375                    value: function getWordRange(findAfter) {
3376                        var endPoint = this.getEndPoint();
3377
3378                        if (!dom.isCharPoint(endPoint)) {
3379                            return this;
3380                        }
3381
3382                        var startPoint = dom.prevPointUntil(endPoint, function (point) {
3383                            return !dom.isCharPoint(point);
3384                        });
3385
3386                        if (findAfter) {
3387                            endPoint = dom.nextPointUntil(endPoint, function (point) {
3388                                return !dom.isCharPoint(point);
3389                            });
3390                        }
3391
3392                        return new WrappedRange(startPoint.node, startPoint.offset, endPoint.node, endPoint.offset);
3393                    }
3394                    /**
3395                     * returns range for words before cursor
3396                     *
3397                     * @param {Boolean} [findAfter] - find after cursor, default: false
3398                     * @return {WrappedRange}
3399                     */
3400
3401                }, {
3402                    key: "getWordsRange",
3403                    value: function getWordsRange(findAfter) {
3404                        var endPoint = this.getEndPoint();
3405
3406                        var isNotTextPoint = function isNotTextPoint(point) {
3407                            return !dom.isCharPoint(point) && !dom.isSpacePoint(point);
3408                        };
3409
3410                        if (isNotTextPoint(endPoint)) {
3411                            return this;
3412                        }
3413
3414                        var startPoint = dom.prevPointUntil(endPoint, isNotTextPoint);
3415
3416                        if (findAfter) {
3417                            endPoint = dom.nextPointUntil(endPoint, isNotTextPoint);
3418                        }
3419
3420                        return new WrappedRange(startPoint.node, startPoint.offset, endPoint.node, endPoint.offset);
3421                    }
3422                    /**
3423                     * returns range for words before cursor that match with a Regex
3424                     *
3425                     * example:
3426                     *  range: 'hi @Peter Pan'
3427                     *  regex: '/@[a-z ]+/i'
3428                     *  return range: '@Peter Pan'
3429                     *
3430                     * @param {RegExp} [regex]
3431                     * @return {WrappedRange|null}
3432                     */
3433
3434                }, {
3435                    key: "getWordsMatchRange",
3436                    value: function getWordsMatchRange(regex) {
3437                        var endPoint = this.getEndPoint();
3438                        var startPoint = dom.prevPointUntil(endPoint, function (point) {
3439                            if (!dom.isCharPoint(point) && !dom.isSpacePoint(point)) {
3440                                return true;
3441                            }
3442
3443                            var rng = new WrappedRange(point.node, point.offset, endPoint.node, endPoint.offset);
3444                            var result = regex.exec(rng.toString());
3445                            return result && result.index === 0;
3446                        });
3447                        var rng = new WrappedRange(startPoint.node, startPoint.offset, endPoint.node, endPoint.offset);
3448                        var text = rng.toString();
3449                        var result = regex.exec(text);
3450
3451                        if (result && result[0].length === text.length) {
3452                            return rng;
3453                        } else {
3454                            return null;
3455                        }
3456                    }
3457                    /**
3458                     * create offsetPath bookmark
3459                     *
3460                     * @param {Node} editable
3461                     */
3462
3463                }, {
3464                    key: "bookmark",
3465                    value: function bookmark(editable) {
3466                        return {
3467                            s: {
3468                                path: dom.makeOffsetPath(editable, this.sc),
3469                                offset: this.so
3470                            },
3471                            e: {
3472                                path: dom.makeOffsetPath(editable, this.ec),
3473                                offset: this.eo
3474                            }
3475                        };
3476                    }
3477                    /**
3478                     * create offsetPath bookmark base on paragraph
3479                     *
3480                     * @param {Node[]} paras
3481                     */
3482
3483                }, {
3484                    key: "paraBookmark",
3485                    value: function paraBookmark(paras) {
3486                        return {
3487                            s: {
3488                                path: lists.tail(dom.makeOffsetPath(lists.head(paras), this.sc)),
3489                                offset: this.so
3490                            },
3491                            e: {
3492                                path: lists.tail(dom.makeOffsetPath(lists.last(paras), this.ec)),
3493                                offset: this.eo
3494                            }
3495                        };
3496                    }
3497                    /**
3498                     * getClientRects
3499                     * @return {Rect[]}
3500                     */
3501
3502                }, {
3503                    key: "getClientRects",
3504                    value: function getClientRects() {
3505                        var nativeRng = this.nativeRange();
3506                        return nativeRng.getClientRects();
3507                    }
3508                }]);
3509
3510                return WrappedRange;
3511            }();
3512            /**
3513             * Data structure
3514             *  * BoundaryPoint: a point of dom tree
3515             *  * BoundaryPoints: two boundaryPoints corresponding to the start and the end of the Range
3516             *
3517             * See to http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Position
3518             */
3519
3520
3521            /* harmony default export */
3522            const range = ({
3523                /**
3524                 * create Range Object From arguments or Browser Selection
3525                 *
3526                 * @param {Node} sc - start container
3527                 * @param {Number} so - start offset
3528                 * @param {Node} ec - end container
3529                 * @param {Number} eo - end offset
3530                 * @return {WrappedRange}
3531                 */
3532                create: function create(sc, so, ec, eo) {
3533                    if (arguments.length === 4) {
3534                        return new WrappedRange(sc, so, ec, eo);
3535                    } else if (arguments.length === 2) {
3536                        // collapsed
3537                        ec = sc;
3538                        eo = so;
3539                        return new WrappedRange(sc, so, ec, eo);
3540                    } else {
3541                        var wrappedRange = this.createFromSelection();
3542
3543                        if (!wrappedRange && arguments.length === 1) {
3544                            var bodyElement = arguments[0];
3545
3546                            if (dom.isEditable(bodyElement)) {
3547                                bodyElement = bodyElement.lastChild;
3548                            }
3549
3550                            return this.createFromBodyElement(bodyElement, dom.emptyPara === arguments[0].innerHTML);
3551                        }
3552
3553                        return wrappedRange;
3554                    }
3555                },
3556                createFromBodyElement: function createFromBodyElement(bodyElement) {
3557                    var isCollapseToStart = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
vendor: 5,874 bytes, lines 3558-3702
3558                    var wrappedRange = this.createFromNode(bodyElement);
3559                    return wrappedRange.collapse(isCollapseToStart);
3560                },
3561                createFromSelection: function createFromSelection() {
3562                    var sc, so, ec, eo;
3563
3564                    if (env.isW3CRangeSupport) {
3565                        var selection = document.getSelection();
3566
3567                        if (!selection || selection.rangeCount === 0) {
3568                            return null;
3569                        } else if (dom.isBody(selection.anchorNode)) {
3570                            // Firefox: returns entire body as range on initialization.
3571                            // We won't never need it.
3572                            return null;
3573                        }
3574
3575                        var nativeRng = selection.getRangeAt(0);
3576                        sc = nativeRng.startContainer;
3577                        so = nativeRng.startOffset;
3578                        ec = nativeRng.endContainer;
3579                        eo = nativeRng.endOffset;
3580                    } else {
3581                        // IE8: TextRange
3582                        var textRange = document.selection.createRange();
3583                        var textRangeEnd = textRange.duplicate();
3584                        textRangeEnd.collapse(false);
3585                        var textRangeStart = textRange;
3586                        textRangeStart.collapse(true);
3587                        var startPoint = textRangeToPoint(textRangeStart, true);
3588                        var endPoint = textRangeToPoint(textRangeEnd, false); // same visible point case: range was collapsed.
3589
3590                        if (dom.isText(startPoint.node) && dom.isLeftEdgePoint(startPoint) && dom.isTextNode(endPoint.node) && dom.isRightEdgePoint(endPoint) && endPoint.node.nextSibling === startPoint.node) {
3591                            startPoint = endPoint;
3592                        }
3593
3594                        sc = startPoint.cont;
3595                        so = startPoint.offset;
3596                        ec = endPoint.cont;
3597                        eo = endPoint.offset;
3598                    }
3599
3600                    return new WrappedRange(sc, so, ec, eo);
3601                },
3602
3603                /**
3604                 * @method
3605                 *
3606                 * create WrappedRange from node
3607                 *
3608                 * @param {Node} node
3609                 * @return {WrappedRange}
3610                 */
3611                createFromNode: function createFromNode(node) {
3612                    var sc = node;
3613                    var so = 0;
3614                    var ec = node;
3615                    var eo = dom.nodeLength(ec); // browsers can't target a picture or void node
3616
3617                    if (dom.isVoid(sc)) {
3618                        so = dom.listPrev(sc).length - 1;
3619                        sc = sc.parentNode;
3620                    }
3621
3622                    if (dom.isBR(ec)) {
3623                        eo = dom.listPrev(ec).length - 1;
3624                        ec = ec.parentNode;
3625                    } else if (dom.isVoid(ec)) {
3626                        eo = dom.listPrev(ec).length;
3627                        ec = ec.parentNode;
3628                    }
3629
3630                    return this.create(sc, so, ec, eo);
3631                },
3632
3633                /**
3634                 * create WrappedRange from node after position
3635                 *
3636                 * @param {Node} node
3637                 * @return {WrappedRange}
3638                 */
3639                createFromNodeBefore: function createFromNodeBefore(node) {
3640                    return this.createFromNode(node).collapse(true);
3641                },
3642
3643                /**
3644                 * create WrappedRange from node after position
3645                 *
3646                 * @param {Node} node
3647                 * @return {WrappedRange}
3648                 */
3649                createFromNodeAfter: function createFromNodeAfter(node) {
3650                    return this.createFromNode(node).collapse();
3651                },
3652
3653                /**
3654                 * @method
3655                 *
3656                 * create WrappedRange from bookmark
3657                 *
3658                 * @param {Node} editable
3659                 * @param {Object} bookmark
3660                 * @return {WrappedRange}
3661                 */
3662                createFromBookmark: function createFromBookmark(editable, bookmark) {
3663                    var sc = dom.fromOffsetPath(editable, bookmark.s.path);
3664                    var so = bookmark.s.offset;
3665                    var ec = dom.fromOffsetPath(editable, bookmark.e.path);
3666                    var eo = bookmark.e.offset;
3667                    return new WrappedRange(sc, so, ec, eo);
3668                },
3669
3670                /**
3671                 * @method
3672                 *
3673                 * create WrappedRange from paraBookmark
3674                 *
3675                 * @param {Object} bookmark
3676                 * @param {Node[]} paras
3677                 * @return {WrappedRange}
3678                 */
3679                createFromParaBookmark: function createFromParaBookmark(bookmark, paras) {
3680                    var so = bookmark.s.offset;
3681                    var eo = bookmark.e.offset;
3682                    var sc = dom.fromOffsetPath(lists.head(paras), bookmark.s.path);
3683                    var ec = dom.fromOffsetPath(lists.last(paras), bookmark.e.path);
3684                    return new WrappedRange(sc, so, ec, eo);
3685                }
3686            });
3687            ;// CONCATENATED MODULE: ./src/js/core/key.js
3688
3689
3690            var KEY_MAP = {
3691                'BACKSPACE': 8,
3692                'TAB': 9,
3693                'ENTER': 13,
3694                'ESCAPE': 27,
3695                'SPACE': 32,
3696                'DELETE': 46,
3697                // Arrow
3698                'LEFT': 37,
3699                'UP': 38,
3700                'RIGHT': 39,
3701                'DOWN': 40,
3702                // Number: 0-9
3703                'NUM0': 48,
3704                'NUM1': 49,
3705                'NUM2': 50,
3706                'NUM3': 51,
3707                'NUM4': 52,
3708                'NUM5': 53,
3709                'NUM6': 54,
3710                'NUM7': 55,
3711                'NUM8': 56,
3712                // Alphabet: a-z
3713                'B': 66,
3714                'E': 69,
3715                'I': 73,
3716                'J': 74,
3717                'K': 75,
3718                'L': 76,
3719                'R': 82,
3720                'S': 83,
3721                'U': 85,
3722                'V': 86,
3723                'Y': 89,
3724                'Z': 90,
3725                'SLASH': 191,
3726                'LEFTBRACKET': 219,
3727                'BACKSLASH': 220,
3728                'RIGHTBRACKET': 221,
3729                // Navigation
3730                'HOME': 36,
3731                'END': 35,
3732                'PAGEUP': 33,
3733                'PAGEDOWN': 34
3734            };
3735            /**
3736             * @class core.key
3737             *
3738             * Object for keycodes.
3739             *
3740             * @singleton
3741             * @alternateClassName key
3742             */
3743
3744            /* harmony default export */
3745            const key = ({
3746                /**
3747                 * @method isEdit
3748                 *
3749                 * @param {Number} keyCode
3750                 * @return {Boolean}
3751                 */
3752                isEdit: function isEdit(keyCode) {
3753                    return lists.contains([KEY_MAP.BACKSPACE, KEY_MAP.TAB, KEY_MAP.ENTER, KEY_MAP.SPACE, KEY_MAP.DELET
vendor: 13,217 bytes, lines 3753-4081
3753E], keyCode);
3754                },
3755
3756                /**
3757                 * @method isMove
3758                 *
3759                 * @param {Number} keyCode
3760                 * @return {Boolean}
3761                 */
3762                isMove: function isMove(keyCode) {
3763                    return lists.contains([KEY_MAP.LEFT, KEY_MAP.UP, KEY_MAP.RIGHT, KEY_MAP.DOWN], keyCode);
3764                },
3765
3766                /**
3767                 * @method isNavigation
3768                 *
3769                 * @param {Number} keyCode
3770                 * @return {Boolean}
3771                 */
3772                isNavigation: function isNavigation(keyCode) {
3773                    return lists.contains([KEY_MAP.HOME, KEY_MAP.END, KEY_MAP.PAGEUP, KEY_MAP.PAGEDOWN], keyCode);
3774                },
3775
3776                /**
3777                 * @property {Object} nameFromCode
3778                 * @property {String} nameFromCode.8 "BACKSPACE"
3779                 */
3780                nameFromCode: func.invertObject(KEY_MAP),
3781                code: KEY_MAP
3782            });
3783            ;// CONCATENATED MODULE: ./src/js/core/async.js
3784
3785            /**
3786             * @method readFileAsDataURL
3787             *
3788             * read contents of file as representing URL
3789             *
3790             * @param {File} file
3791             * @return {Promise} - then: dataUrl
3792             */
3793
3794            function readFileAsDataURL(file) {
3795                return external_jQuery_default().Deferred(function (deferred) {
3796                    external_jQuery_default().extend(new FileReader(), {
3797                        onload: function onload(e) {
3798                            var dataURL = e.target.result;
3799                            deferred.resolve(dataURL);
3800                        },
3801                        onerror: function onerror(err) {
3802                            deferred.reject(err);
3803                        }
3804                    }).readAsDataURL(file);
3805                }).promise();
3806            }
3807
3808            /**
3809             * @method createImage
3810             *
3811             * create `<image>` from url string
3812             *
3813             * @param {String} url
3814             * @return {Promise} - then: $image
3815             */
3816
3817            function createImage(url) {
3818                return external_jQuery_default().Deferred(function (deferred) {
3819                    var $img = external_jQuery_default()('<img>');
3820                    $img.one('load', function () {
3821                        $img.off('error abort');
3822                        deferred.resolve($img);
3823                    }).one('error abort', function () {
3824                        $img.off('load').detach();
3825                        deferred.reject($img);
3826                    }).css({
3827                        display: 'none'
3828                    }).appendTo(document.body).attr('src', url);
3829                }).promise();
3830            }
3831            ;// CONCATENATED MODULE: ./src/js/editing/History.js
3832            function History_classCallCheck(instance, Constructor) {
3833                if (!(instance instanceof Constructor)) {
3834                    throw new TypeError("Cannot call a class as a function");
3835                }
3836            }
3837
3838            function History_defineProperties(target, props) {
3839                for (var i = 0; i < props.length; i++) {
3840                    var descriptor = props[i];
3841                    descriptor.enumerable = descriptor.enumerable || false;
3842                    descriptor.configurable = true;
3843                    if ("value" in descriptor) descriptor.writable = true;
3844                    Object.defineProperty(target, descriptor.key, descriptor);
3845                }
3846            }
3847
3848            function History_createClass(Constructor, protoProps, staticProps) {
3849                if (protoProps) History_defineProperties(Constructor.prototype, protoProps);
3850                if (staticProps) History_defineProperties(Constructor, staticProps);
3851                return Constructor;
3852            }
3853
3854
3855            var History = /*#__PURE__*/function () {
3856                function History(context) {
3857                    History_classCallCheck(this, History);
3858
3859                    this.stack = [];
3860                    this.stackOffset = -1;
3861                    this.context = context;
3862                    this.$editable = context.layoutInfo.editable;
3863                    this.editable = this.$editable[0];
3864                }
3865
3866                History_createClass(History, [{
3867                    key: "makeSnapshot",
3868                    value: function makeSnapshot() {
3869                        var rng = range.create(this.editable);
3870                        var emptyBookmark = {
3871                            s: {
3872                                path: [],
3873                                offset: 0
3874                            },
3875                            e: {
3876                                path: [],
3877                                offset: 0
3878                            }
3879                        };
3880                        return {
3881                            contents: this.$editable.html(),
3882                            bookmark: rng && rng.isOnEditable() ? rng.bookmark(this.editable) : emptyBookmark
3883                        };
3884                    }
3885                }, {
3886                    key: "applySnapshot",
3887                    value: function applySnapshot(snapshot) {
3888                        if (snapshot.contents !== null) {
3889                            this.$editable.html(snapshot.contents);
3890                        }
3891
3892                        if (snapshot.bookmark !== null) {
3893                            range.createFromBookmark(this.editable, snapshot.bookmark).select();
3894                        }
3895                    }
3896                    /**
3897                     * @method rewind
3898                     * Rewinds the history stack back to the first snapshot taken.
3899                     * Leaves the stack intact, so that "Redo" can still be used.
3900                     */
3901
3902                }, {
3903                    key: "rewind",
3904                    value: function rewind() {
3905                        // Create snap shot if not yet recorded
3906                        if (this.$editable.html() !== this.stack[this.stackOffset].contents) {
3907                            this.recordUndo();
3908                        } // Return to the first available snapshot.
3909
3910
3911                        this.stackOffset = 0; // Apply that snapshot.
3912
3913                        this.applySnapshot(this.stack[this.stackOffset]);
3914                    }
3915                    /**
3916                     *  @method commit
3917                     *  Resets history stack, but keeps current editor's content.
3918                     */
3919
3920                }, {
3921                    key: "commit",
3922                    value: function commit() {
3923                        // Clear the stack.
3924                        this.stack = []; // Restore stackOffset to its original value.
3925
3926                        this.stackOffset = -1; // Record our first snapshot (of nothing).
3927
3928                        this.recordUndo();
3929                    }
3930                    /**
3931                     * @method reset
3932                     * Resets the history stack completely; reverting to an empty editor.
3933                     */
3934
3935                }, {
3936                    key: "reset",
3937                    value: function reset() {
3938                        // Clear the stack.
3939                        this.stack = []; // Restore stackOffset to its original value.
3940
3941                        this.stackOffset = -1; // Clear the editable area.
3942
3943                        this.$editable.html(''); // Record our first snapshot (of nothing).
3944
3945                        this.recordUndo();
3946                    }
3947                    /**
3948                     * undo
3949                     */
3950
3951                }, {
3952                    key: "undo",
3953                    value: function undo() {
3954                        // Create snap shot if not yet recorded
3955                        if (this.$editable.html() !== this.stack[this.stackOffset].contents) {
3956                            this.recordUndo();
3957                        }
3958
3959                        if (this.stackOffset > 0) {
3960                            this.stackOffset--;
3961                            this.applySnapshot(this.stack[this.stackOffset]);
3962                        }
3963                    }
3964                    /**
3965                     * redo
3966                     */
3967
3968                }, {
3969                    key: "redo",
3970                    value: function redo() {
3971                        if (this.stack.length - 1 > this.stackOffset) {
3972                            this.stackOffset++;
3973                            this.applySnapshot(this.stack[this.stackOffset]);
3974                        }
3975                    }
3976                    /**
3977                     * recorded undo
3978                     */
3979
3980                }, {
3981                    key: "recordUndo",
3982                    value: function recordUndo() {
3983                        this.stackOffset++; // Wash out stack after stackOffset
3984
3985                        if (this.stack.length > this.stackOffset) {
3986                            this.stack = this.stack.slice(0, this.stackOffset);
3987                        } // Create new snapshot and push it to the end
3988
3989
3990                        this.stack.push(this.makeSnapshot()); // If the stack size reachs to the limit, then slice it
3991
3992                        if (this.stack.length > this.context.options.historyLimit) {
3993                            this.stack.shift();
3994                            this.stackOffset -= 1;
3995                        }
3996                    }
3997                }]);
3998
3999                return History;
4000            }();
4001
4002
4003            ;// CONCATENATED MODULE: ./src/js/editing/Style.js
4004            function Style_classCallCheck(instance, Constructor) {
4005                if (!(instance instanceof Constructor)) {
4006                    throw new TypeError("Cannot call a class as a function");
4007                }
4008            }
4009
4010            function Style_defineProperties(target, props) {
4011                for (var i = 0; i < props.length; i++) {
4012                    var descriptor = props[i];
4013                    descriptor.enumerable = descriptor.enumerable || false;
4014                    descriptor.configurable = true;
4015                    if ("value" in descriptor) descriptor.writable = true;
4016                    Object.defineProperty(target, descriptor.key, descriptor);
4017                }
4018            }
4019
4020            function Style_createClass(Constructor, protoProps, staticProps) {
4021                if (protoProps) Style_defineProperties(Constructor.prototype, protoProps);
4022                if (staticProps) Style_defineProperties(Constructor, staticProps);
4023                return Constructor;
4024            }
4025
4026
4027            var Style = /*#__PURE__*/function () {
4028                function Style() {
4029                    Style_classCallCheck(this, Style);
4030                }
4031
4032                Style_createClass(Style, [{
4033                    key: "jQueryCSS",
4034                    value:
4035                        /**
4036                         * @method jQueryCSS
4037                         *
4038                         * [workaround] for old jQuery
4039                         * passing an array of style properties to .css()
4040                         * will result in an object of property-value pairs.
4041                         * (compability with version < 1.9)
4042                         *
4043                         * @private
4044                         * @param  {jQuery} $obj
4045                         * @param  {Array} propertyNames - An array of one or more CSS properties.
4046                         * @return {Object}
4047                         */
4048                        function jQueryCSS($obj, propertyNames) {
4049                            var result = {};
4050                            external_jQuery_default().each(propertyNames, function (idx, propertyName) {
4051                                result[propertyName] = $obj.css(propertyName);
4052                            });
4053                            return result;
4054                        }
4055                    /**
4056                     * returns style object from node
4057                     *
4058                     * @param {jQuery} $node
4059                     * @return {Object}
4060                     */
4061
4062                }, {
4063                    key: "fromNode",
4064                    value: function fromNode($node) {
4065                        var properties = ['font-family', 'font-size', 'text-align', 'list-style-type', 'line-height'];
4066                        var styleInfo = this.jQueryCSS($node, properties) || {};
4067                        var fontSize = $node[0].style.fontSize || styleInfo['font-size'];
4068                        styleInfo['font-size'] = parseInt(fontSize, 10);
4069                        styleInfo['font-size-unit'] = fontSize.match(/[a-z%]+$/);
4070                        return styleInfo;
4071                    }
4072                    /**
4073                     * paragraph level style
4074                     *
4075                     * @param {WrappedRange} rng
4076                     * @param {Object} styleInfo
4077                     */
4078
4079                }, {
4080                    key: "stylePara",
4081                    value: function stylePara(rng, styleInfo) {
vendor: 5,713 bytes, lines 4082-4185
4082                        external_jQuery_default().each(rng.nodes(dom.isPara, {
4083                            includeAncestor: true
4084                        }), function (idx, para) {
4085                            external_jQuery_default()(para).css(styleInfo);
4086                        });
4087                    }
4088                    /**
4089                     * insert and returns styleNodes on range.
4090                     *
4091                     * @param {WrappedRange} rng
4092                     * @param {Object} [options] - options for styleNodes
4093                     * @param {String} [options.nodeName] - default: `SPAN`
4094                     * @param {Boolean} [options.expandClosestSibling] - default: `false`
4095                     * @param {Boolean} [options.onlyPartialContains] - default: `false`
4096                     * @return {Node[]}
4097                     */
4098
4099                }, {
4100                    key: "styleNodes",
4101                    value: function styleNodes(rng, options) {
4102                        rng = rng.splitText();
4103                        var nodeName = options && options.nodeName || 'SPAN';
4104                        var expandClosestSibling = !!(options && options.expandClosestSibling);
4105                        var onlyPartialContains = !!(options && options.onlyPartialContains);
4106
4107                        if (rng.isCollapsed()) {
4108                            return [rng.insertNode(dom.create(nodeName))];
4109                        }
4110
4111                        var pred = dom.makePredByNodeName(nodeName);
4112                        var nodes = rng.nodes(dom.isText, {
4113                            fullyContains: true
4114                        }).map(function (text) {
4115                            return dom.singleChildAncestor(text, pred) || dom.wrap(text, nodeName);
4116                        });
4117
4118                        if (expandClosestSibling) {
4119                            if (onlyPartialContains) {
4120                                var nodesInRange = rng.nodes(); // compose with partial contains predication
4121
4122                                pred = func.and(pred, function (node) {
4123                                    return lists.contains(nodesInRange, node);
4124                                });
4125                            }
4126
4127                            return nodes.map(function (node) {
4128                                var siblings = dom.withClosestSiblings(node, pred);
4129                                var head = lists.head(siblings);
4130                                var tails = lists.tail(siblings);
4131                                external_jQuery_default().each(tails, function (idx, elem) {
4132                                    dom.appendChildNodes(head, elem.childNodes);
4133                                    dom.remove(elem);
4134                                });
4135                                return lists.head(siblings);
4136                            });
4137                        } else {
4138                            return nodes;
4139                        }
4140                    }
4141                    /**
4142                     * get current style on cursor
4143                     *
4144                     * @param {WrappedRange} rng
4145                     * @return {Object} - object contains style properties.
4146                     */
4147
4148                }, {
4149                    key: "current",
4150                    value: function current(rng) {
4151                        var $cont = external_jQuery_default()(!dom.isElement(rng.sc) ? rng.sc.parentNode : rng.sc);
4152                        var styleInfo = this.fromNode($cont); // document.queryCommandState for toggle state
4153                        // [workaround] prevent Firefox nsresult: "0x80004005 (NS_ERROR_FAILURE)"
4154
4155                        try {
4156                            styleInfo = external_jQuery_default().extend(styleInfo, {
4157                                'font-bold': document.queryCommandState('bold') ? 'bold' : 'normal',
4158                                'font-italic': document.queryCommandState('italic') ? 'italic' : 'normal',
4159                                'font-underline': document.queryCommandState('underline') ? 'underline' : 'normal',
4160                                'font-subscript': document.queryCommandState('subscript') ? 'subscript' : 'normal',
4161                                'font-superscript': document.queryCommandState('superscript') ? 'superscript' : 'normal',
4162                                'font-strikethrough': document.queryCommandState('strikethrough') ? 'strikethrough' : 'normal',
4163                                'font-family': document.queryCommandValue('fontname') || styleInfo['font-family']
4164                            });
4165                        } catch (e) {// eslint-disable-next-line
4166                        } // list-style-type to list-style(unordered, ordered)
4167
4168
4169                        if (!rng.isOnList()) {
4170                            styleInfo['list-style'] = 'none';
4171                        } else {
4172                            var orderedTypes = ['circle', 'disc', 'disc-leading-zero', 'square'];
4173                            var isUnordered = orderedTypes.indexOf(styleInfo['list-style-type']) > -1;
4174                            styleInfo['list-style'] = isUnordered ? 'unordered' : 'ordered';
4175                        }
4176
4177                        var para = dom.ancestor(rng.sc, dom.isPara);
4178
4179                        if (para && para.style['line-height']) {
4180                            styleInfo['line-height'] = para.style.lineHeight;
4181                        } else {
4182                            var lineHeight = parseInt(styleInfo['line-height'], 10) / parseInt(styleInfo['font-size'], 10);
4183                            styleInfo['line-height'] = lineHeight.toFixed(1);
4184                        }
4185
vendor: 17,579 bytes, lines 4186-4581
4186                        styleInfo.anchor = rng.isOnAnchor() && dom.ancestor(rng.sc, dom.isAnchor);
4187                        styleInfo.ancestors = dom.listAncestor(rng.sc, dom.isEditable);
4188                        styleInfo.range = rng;
4189                        return styleInfo;
4190                    }
4191                }]);
4192
4193                return Style;
4194            }();
4195
4196
4197            ;// CONCATENATED MODULE: ./src/js/editing/Bullet.js
4198            function Bullet_classCallCheck(instance, Constructor) {
4199                if (!(instance instanceof Constructor)) {
4200                    throw new TypeError("Cannot call a class as a function");
4201                }
4202            }
4203
4204            function Bullet_defineProperties(target, props) {
4205                for (var i = 0; i < props.length; i++) {
4206                    var descriptor = props[i];
4207                    descriptor.enumerable = descriptor.enumerable || false;
4208                    descriptor.configurable = true;
4209                    if ("value" in descriptor) descriptor.writable = true;
4210                    Object.defineProperty(target, descriptor.key, descriptor);
4211                }
4212            }
4213
4214            function Bullet_createClass(Constructor, protoProps, staticProps) {
4215                if (protoProps) Bullet_defineProperties(Constructor.prototype, protoProps);
4216                if (staticProps) Bullet_defineProperties(Constructor, staticProps);
4217                return Constructor;
4218            }
4219
4220
4221            var Bullet = /*#__PURE__*/function () {
4222                function Bullet() {
4223                    Bullet_classCallCheck(this, Bullet);
4224                }
4225
4226                Bullet_createClass(Bullet, [{
4227                    key: "insertOrderedList",
4228                    value:
4229                        /**
4230                         * toggle ordered list
4231                         */
4232                        function insertOrderedList(editable) {
4233                            this.toggleList('OL', editable);
4234                        }
4235                    /**
4236                     * toggle unordered list
4237                     */
4238
4239                }, {
4240                    key: "insertUnorderedList",
4241                    value: function insertUnorderedList(editable) {
4242                        this.toggleList('UL', editable);
4243                    }
4244                    /**
4245                     * indent
4246                     */
4247
4248                }, {
4249                    key: "indent",
4250                    value: function indent(editable) {
4251                        var _this = this;
4252
4253                        var rng = range.create(editable).wrapBodyInlineWithPara();
4254                        var paras = rng.nodes(dom.isPara, {
4255                            includeAncestor: true
4256                        });
4257                        var clustereds = lists.clusterBy(paras, func.peq2('parentNode'));
4258                        external_jQuery_default().each(clustereds, function (idx, paras) {
4259                            var head = lists.head(paras);
4260
4261                            if (dom.isLi(head)) {
4262                                var previousList = _this.findList(head.previousSibling);
4263
4264                                if (previousList) {
4265                                    paras.map(function (para) {
4266                                        return previousList.appendChild(para);
4267                                    });
4268                                } else {
4269                                    _this.wrapList(paras, head.parentNode.nodeName);
4270
4271                                    paras.map(function (para) {
4272                                        return para.parentNode;
4273                                    }).map(function (para) {
4274                                        return _this.appendToPrevious(para);
4275                                    });
4276                                }
4277                            } else {
4278                                external_jQuery_default().each(paras, function (idx, para) {
4279                                    external_jQuery_default()(para).css('marginLeft', function (idx, val) {
4280                                        return (parseInt(val, 10) || 0) + 25;
4281                                    });
4282                                });
4283                            }
4284                        });
4285                        rng.select();
4286                    }
4287                    /**
4288                     * outdent
4289                     */
4290
4291                }, {
4292                    key: "outdent",
4293                    value: function outdent(editable) {
4294                        var _this2 = this;
4295
4296                        var rng = range.create(editable).wrapBodyInlineWithPara();
4297                        var paras = rng.nodes(dom.isPara, {
4298                            includeAncestor: true
4299                        });
4300                        var clustereds = lists.clusterBy(paras, func.peq2('parentNode'));
4301                        external_jQuery_default().each(clustereds, function (idx, paras) {
4302                            var head = lists.head(paras);
4303
4304                            if (dom.isLi(head)) {
4305                                _this2.releaseList([paras]);
4306                            } else {
4307                                external_jQuery_default().each(paras, function (idx, para) {
4308                                    external_jQuery_default()(para).css('marginLeft', function (idx, val) {
4309                                        val = parseInt(val, 10) || 0;
4310                                        return val > 25 ? val - 25 : '';
4311                                    });
4312                                });
4313                            }
4314                        });
4315                        rng.select();
4316                    }
4317                    /**
4318                     * toggle list
4319                     *
4320                     * @param {String} listName - OL or UL
4321                     */
4322
4323                }, {
4324                    key: "toggleList",
4325                    value: function toggleList(listName, editable) {
4326                        var _this3 = this;
4327
4328                        var rng = range.create(editable).wrapBodyInlineWithPara();
4329                        var paras = rng.nodes(dom.isPara, {
4330                            includeAncestor: true
4331                        });
4332                        var bookmark = rng.paraBookmark(paras);
4333                        var clustereds = lists.clusterBy(paras, func.peq2('parentNode')); // paragraph to list
4334
4335                        if (lists.find(paras, dom.isPurePara)) {
4336                            var wrappedParas = [];
4337                            external_jQuery_default().each(clustereds, function (idx, paras) {
4338                                wrappedParas = wrappedParas.concat(_this3.wrapList(paras, listName));
4339                            });
4340                            paras = wrappedParas; // list to paragraph or change list style
4341                        } else {
4342                            var diffLists = rng.nodes(dom.isList, {
4343                                includeAncestor: true
4344                            }).filter(function (listNode) {
4345                                return !external_jQuery_default().nodeName(listNode, listName);
4346                            });
4347
4348                            if (diffLists.length) {
4349                                external_jQuery_default().each(diffLists, function (idx, listNode) {
4350                                    dom.replace(listNode, listName);
4351                                });
4352                            } else {
4353                                paras = this.releaseList(clustereds, true);
4354                            }
4355                        }
4356
4357                        range.createFromParaBookmark(bookmark, paras).select();
4358                    }
4359                    /**
4360                     * @param {Node[]} paras
4361                     * @param {String} listName
4362                     * @return {Node[]}
4363                     */
4364
4365                }, {
4366                    key: "wrapList",
4367                    value: function wrapList(paras, listName) {
4368                        var head = lists.head(paras);
4369                        var last = lists.last(paras);
4370                        var prevList = dom.isList(head.previousSibling) && head.previousSibling;
4371                        var nextList = dom.isList(last.nextSibling) && last.nextSibling;
4372                        var listNode = prevList || dom.insertAfter(dom.create(listName || 'UL'), last); // P to LI
4373
4374                        paras = paras.map(function (para) {
4375                            return dom.isPurePara(para) ? dom.replace(para, 'LI') : para;
4376                        }); // append to list(<ul>, <ol>)
4377
4378                        dom.appendChildNodes(listNode, paras);
4379
4380                        if (nextList) {
4381                            dom.appendChildNodes(listNode, lists.from(nextList.childNodes));
4382                            dom.remove(nextList);
4383                        }
4384
4385                        return paras;
4386                    }
4387                    /**
4388                     * @method releaseList
4389                     *
4390                     * @param {Array[]} clustereds
4391                     * @param {Boolean} isEscapseToBody
4392                     * @return {Node[]}
4393                     */
4394
4395                }, {
4396                    key: "releaseList",
4397                    value: function releaseList(clustereds, isEscapseToBody) {
4398                        var _this4 = this;
4399
4400                        var releasedParas = [];
4401                        external_jQuery_default().each(clustereds, function (idx, paras) {
4402                            var head = lists.head(paras);
4403                            var last = lists.last(paras);
4404                            var headList = isEscapseToBody ? dom.lastAncestor(head, dom.isList) : head.parentNode;
4405                            var parentItem = headList.parentNode;
4406
4407                            if (headList.parentNode.nodeName === 'LI') {
4408                                paras.map(function (para) {
4409                                    var newList = _this4.findNextSiblings(para);
4410
4411                                    if (parentItem.nextSibling) {
4412                                        parentItem.parentNode.insertBefore(para, parentItem.nextSibling);
4413                                    } else {
4414                                        parentItem.parentNode.appendChild(para);
4415                                    }
4416
4417                                    if (newList.length) {
4418                                        _this4.wrapList(newList, headList.nodeName);
4419
4420                                        para.appendChild(newList[0].parentNode);
4421                                    }
4422                                });
4423
4424                                if (headList.children.length === 0) {
4425                                    parentItem.removeChild(headList);
4426                                }
4427
4428                                if (parentItem.childNodes.length === 0) {
4429                                    parentItem.parentNode.removeChild(parentItem);
4430                                }
4431                            } else {
4432                                var lastList = headList.childNodes.length > 1 ? dom.splitTree(headList, {
4433                                    node: last.parentNode,
4434                                    offset: dom.position(last) + 1
4435                                }, {
4436                                    isSkipPaddingBlankHTML: true
4437                                }) : null;
4438                                var middleList = dom.splitTree(headList, {
4439                                    node: head.parentNode,
4440                                    offset: dom.position(head)
4441                                }, {
4442                                    isSkipPaddingBlankHTML: true
4443                                });
4444                                paras = isEscapseToBody ? dom.listDescendant(middleList, dom.isLi) : lists.from(middleList.childNodes).filter(dom.isLi); // LI to P
4445
4446                                if (isEscapseToBody || !dom.isList(headList.parentNode)) {
4447                                    paras = paras.map(function (para) {
4448                                        return dom.replace(para, 'P');
4449                                    });
4450                                }
4451
4452                                external_jQuery_default().each(lists.from(paras).reverse(), function (idx, para) {
4453                                    dom.insertAfter(para, headList);
4454                                }); // remove empty lists
4455
4456                                var rootLists = lists.compact([headList, middleList, lastList]);
4457                                external_jQuery_default().each(rootLists, function (idx, rootList) {
4458                                    var listNodes = [rootList].concat(dom.listDescendant(rootList, dom.isList));
4459                                    external_jQuery_default().each(listNodes.reverse(), function (idx, listNode) {
4460                                        if (!dom.nodeLength(listNode)) {
4461                                            dom.remove(listNode, true);
4462                                        }
4463                                    });
4464                                });
4465                            }
4466
4467                            releasedParas = releasedParas.concat(paras);
4468                        });
4469                        return releasedParas;
4470                    }
4471                    /**
4472                     * @method appendToPrevious
4473                     *
4474                     * Appends list to previous list item, if
4475                     * none exist it wraps the list in a new list item.
4476                     *
4477                     * @param {HTMLNode} ListItem
4478                     * @return {HTMLNode}
4479                     */
4480
4481                }, {
4482                    key: "appendToPrevious",
4483                    value: function appendToPrevious(node) {
4484                        return node.previousSibling ? dom.appendChildNodes(node.previousSibling, [node]) : this.wrapList([node], 'LI');
4485                    }
4486                    /**
4487                     * @method findList
4488                     *
4489                     * Finds an existing list in list item
4490                     *
4491                     * @param {HTMLNode} ListItem
4492                     * @return {Array[]}
4493                     */
4494
4495                }, {
4496                    key: "findList",
4497                    value: function findList(node) {
4498                        return node ? lists.find(node.children, function (child) {
4499                            return ['OL', 'UL'].indexOf(child.nodeName) > -1;
4500                        }) : null;
4501                    }
4502                    /**
4503                     * @method findNextSiblings
4504                     *
4505                     * Finds all list item siblings that follow it
4506                     *
4507                     * @param {HTMLNode} ListItem
4508                     * @return {HTMLNode}
4509                     */
4510
4511                }, {
4512                    key: "findNextSiblings",
4513                    value: function findNextSiblings(node) {
4514                        var siblings = [];
4515
4516                        while (node.nextSibling) {
4517                            siblings.push(node.nextSibling);
4518                            node = node.nextSibling;
4519                        }
4520
4521                        return siblings;
4522                    }
4523                }]);
4524
4525                return Bullet;
4526            }();
4527
4528
4529            ;// CONCATENATED MODULE: ./src/js/editing/Typing.js
4530            function Typing_classCallCheck(instance, Constructor) {
4531                if (!(instance instanceof Constructor)) {
4532                    throw new TypeError("Cannot call a class as a function");
4533                }
4534            }
4535
4536            function Typing_defineProperties(target, props) {
4537                for (var i = 0; i < props.length; i++) {
4538                    var descriptor = props[i];
4539                    descriptor.enumerable = descriptor.enumerable || false;
4540                    descriptor.configurable = true;
4541                    if ("value" in descriptor) descriptor.writable = true;
4542                    Object.defineProperty(target, descriptor.key, descriptor);
4543                }
4544            }
4545
4546            function Typing_createClass(Constructor, protoProps, staticProps) {
4547                if (protoProps) Typing_defineProperties(Constructor.prototype, protoProps);
4548                if (staticProps) Typing_defineProperties(Constructor, staticProps);
4549                return Constructor;
4550            }
4551
4552
4553            /**
4554             * @class editing.Typing
4555             *
4556             * Typing
4557             *
4558             */
4559
4560            var Typing = /*#__PURE__*/function () {
4561                function Typing(context) {
4562                    Typing_classCallCheck(this, Typing);
4563
4564                    // a Bullet instance to toggle lists off
4565                    this.bullet = new Bullet();
4566                    this.options = context.options;
4567                }
4568
4569                /**
4570                 * insert tab
4571                 *
4572                 * @param {WrappedRange} rng
4573                 * @param {Number} tabsize
4574                 */
4575
4576
4577                Typing_createClass(Typing, [{
4578                    key: "insertTab",
4579                    value: function insertTab(rng, tabsize) {
4580                        var tab = dom.createText(new Array(tabsize + 1).join(dom.NBSP_CHAR));
4581                        rng = rng.deleteContents();
vendor: 4,458 bytes, lines 4582-4656
4582                        rng.insertNode(tab, true);
4583                        rng = range.create(tab, tabsize);
4584                        rng.select();
4585                    }
4586                    /**
4587                     * insert paragraph
4588                     *
4589                     * @param {jQuery} $editable
4590                     * @param {WrappedRange} rng Can be used in unit tests to "mock" the range
4591                     *
4592                     * blockquoteBreakingLevel
4593                     *   0 - No break, the new paragraph remains inside the quote
4594                     *   1 - Break the first blockquote in the ancestors list
4595                     *   2 - Break all blockquotes, so that the new paragraph is not quoted (this is the default)
4596                     */
4597
4598                }, {
4599                    key: "insertParagraph",
4600                    value: function insertParagraph(editable, rng) {
4601                        rng = rng || range.create(editable); // deleteContents on range.
4602
4603                        rng = rng.deleteContents(); // Wrap range if it needs to be wrapped by paragraph
4604
4605                        rng = rng.wrapBodyInlineWithPara(); // finding paragraph
4606
4607                        var splitRoot = dom.ancestor(rng.sc, dom.isPara);
4608                        var nextPara; // on paragraph: split paragraph
4609
4610                        if (splitRoot) {
4611                            // if it is an empty line with li
4612                            if (dom.isLi(splitRoot) && (dom.isEmpty(splitRoot) || dom.deepestChildIsEmpty(splitRoot))) {
4613                                // toggle UL/OL and escape
4614                                this.bullet.toggleList(splitRoot.parentNode.nodeName);
4615                                return;
4616                            } else {
4617                                var blockquote = null;
4618
4619                                if (this.options.blockquoteBreakingLevel === 1) {
4620                                    blockquote = dom.ancestor(splitRoot, dom.isBlockquote);
4621                                } else if (this.options.blockquoteBreakingLevel === 2) {
4622                                    blockquote = dom.lastAncestor(splitRoot, dom.isBlockquote);
4623                                }
4624
4625                                if (blockquote) {
4626                                    // We're inside a blockquote and options ask us to break it
4627                                    nextPara = external_jQuery_default()(dom.emptyPara)[0]; // If the split is right before a <br>, remove it so that there's no "empty line"
4628                                    // after the split in the new blockquote created
4629
4630                                    if (dom.isRightEdgePoint(rng.getStartPoint()) && dom.isBR(rng.sc.nextSibling)) {
4631                                        external_jQuery_default()(rng.sc.nextSibling).remove();
4632                                    }
4633
4634                                    var split = dom.splitTree(blockquote, rng.getStartPoint(), {
4635                                        isDiscardEmptySplits: true
4636                                    });
4637
4638                                    if (split) {
4639                                        split.parentNode.insertBefore(nextPara, split);
4640                                    } else {
4641                                        dom.insertAfter(nextPara, blockquote); // There's no split if we were at the end of the blockquote
4642                                    }
4643                                } else {
4644                                    nextPara = dom.splitTree(splitRoot, rng.getStartPoint()); // not a blockquote, just insert the paragraph
4645
4646                                    var emptyAnchors = dom.listDescendant(splitRoot, dom.isEmptyAnchor);
4647                                    emptyAnchors = emptyAnchors.concat(dom.listDescendant(nextPara, dom.isEmptyAnchor));
4648                                    external_jQuery_default().each(emptyAnchors, function (idx, anchor) {
4649                                        dom.remove(anchor);
4650                                    }); // replace empty heading, pre or custom-made styleTag with P tag
4651
4652                                    if ((dom.isHeading(nextPara) || dom.isPre(nextPara) || dom.isCustomStyleTag(nextPara)) && dom.isEmpty(nextPara)) {
4653                                        nextPara = dom.replace(nextPara, 'p');
4654                                    }
4655                                }
4656                            }
vendor: 6,641 bytes, lines 4656-4817
4656 // no paragraph: insert empty paragraph
4657
4658                        } else {
4659                            var next = rng.sc.childNodes[rng.so];
4660                            nextPara = external_jQuery_default()(dom.emptyPara)[0];
4661
4662                            if (next) {
4663                                rng.sc.insertBefore(nextPara, next);
4664                            } else {
4665                                rng.sc.appendChild(nextPara);
4666                            }
4667                        }
4668
4669                        range.create(nextPara, 0).normalize().select().scrollIntoView(editable);
4670                    }
4671                }]);
4672
4673                return Typing;
4674            }();
4675
4676
4677            ;// CONCATENATED MODULE: ./src/js/editing/Table.js
4678            function Table_classCallCheck(instance, Constructor) {
4679                if (!(instance instanceof Constructor)) {
4680                    throw new TypeError("Cannot call a class as a function");
4681                }
4682            }
4683
4684            function Table_defineProperties(target, props) {
4685                for (var i = 0; i < props.length; i++) {
4686                    var descriptor = props[i];
4687                    descriptor.enumerable = descriptor.enumerable || false;
4688                    descriptor.configurable = true;
4689                    if ("value" in descriptor) descriptor.writable = true;
4690                    Object.defineProperty(target, descriptor.key, descriptor);
4691                }
4692            }
4693
4694            function Table_createClass(Constructor, protoProps, staticProps) {
4695                if (protoProps) Table_defineProperties(Constructor.prototype, protoProps);
4696                if (staticProps) Table_defineProperties(Constructor, staticProps);
4697                return Constructor;
4698            }
4699
4700
4701            /**
4702             * @class Create a virtual table to create what actions to do in change.
4703             * @param {object} startPoint Cell selected to apply change.
4704             * @param {enum} where  Where change will be applied Row or Col. Use enum: TableResultAction.where
4705             * @param {enum} action Action to be applied. Use enum: TableResultAction.requestAction
4706             * @param {object} domTable Dom element of table to make changes.
4707             */
4708
4709            var TableResultAction = function TableResultAction(startPoint, where, action, domTable) {
4710                var _startPoint = {
4711                    'colPos': 0,
4712                    'rowPos': 0
4713                };
4714                var _virtualTable = [];
4715                var _actionCellList = []; /// ///////////////////////////////////////////
4716                // Private functions
4717                /// ///////////////////////////////////////////
4718
4719                /**
4720                 * Set the startPoint of action.
4721                 */
4722
4723                function setStartPoint() {
4724                    if (!startPoint || !startPoint.tagName || startPoint.tagName.toLowerCase() !== 'td' && startPoint.tagName.toLowerCase() !== 'th') {
4725                        // Impossible to identify start Cell point
4726                        return;
4727                    }
4728
4729                    _startPoint.colPos = startPoint.cellIndex;
4730
4731                    if (!startPoint.parentElement || !startPoint.parentElement.tagName || startPoint.parentElement.tagName.toLowerCase() !== 'tr') {
4732                        // Impossible to identify start Row point
4733                        return;
4734                    }
4735
4736                    _startPoint.rowPos = startPoint.parentElement.rowIndex;
4737                }
4738
4739                /**
4740                 * Define virtual table position info object.
4741                 *
4742                 * @param {int} rowIndex Index position in line of virtual table.
4743                 * @param {int} cellIndex Index position in column of virtual table.
4744                 * @param {object} baseRow Row affected by this position.
4745                 * @param {object} baseCell Cell affected by this position.
4746                 * @param {bool} isSpan Inform if it is an span cell/row.
4747                 */
4748
4749
4750                function setVirtualTablePosition(rowIndex, cellIndex, baseRow, baseCell, isRowSpan, isColSpan, isVirtualCell) {
4751                    var objPosition = {
4752                        'baseRow': baseRow,
4753                        'baseCell': baseCell,
4754                        'isRowSpan': isRowSpan,
4755                        'isColSpan': isColSpan,
4756                        'isVirtual': isVirtualCell
4757                    };
4758
4759                    if (!_virtualTable[rowIndex]) {
4760                        _virtualTable[rowIndex] = [];
4761                    }
4762
4763                    _virtualTable[rowIndex][cellIndex] = objPosition;
4764                }
4765
4766                /**
4767                 * Create action cell object.
4768                 *
4769                 * @param {object} virtualTableCellObj Object of specific position on virtual table.
4770                 * @param {enum} resultAction Action to be applied in that item.
4771                 */
4772
4773
4774                function getActionCell(virtualTableCellObj, resultAction, virtualRowPosition, virtualColPosition) {
4775                    return {
4776                        'baseCell': virtualTableCellObj.baseCell,
4777                        'action': resultAction,
4778                        'virtualTable': {
4779                            'rowIndex': virtualRowPosition,
4780                            'cellIndex': virtualColPosition
4781                        }
4782                    };
4783                }
4784
4785                /**
4786                 * Recover free index of row to append Cell.
4787                 *
4788                 * @param {int} rowIndex Index of row to find free space.
4789                 * @param {int} cellIndex Index of cell to find free space in table.
4790                 */
4791
4792
4793                function recoverCellIndex(rowIndex, cellIndex) {
4794                    if (!_virtualTable[rowIndex]) {
4795                        return cellIndex;
4796                    }
4797
4798                    if (!_virtualTable[rowIndex][cellIndex]) {
4799                        return cellIndex;
4800                    }
4801
4802                    var newCellIndex = cellIndex;
4803
4804                    while (_virtualTable[rowIndex][newCellIndex]) {
4805                        newCellIndex++;
4806
4807                        if (!_virtualTable[rowIndex][newCellIndex]) {
4808                            return newCellIndex;
4809                        }
4810                    }
4811                }
4812
4813                /**
4814                 * Recover info about row and cell and add information to virtual table.
4815                 *
4816                 * @param {object} row Row to recover information.
4817                 * @param {object}
vendor: 5,351 bytes, lines 4817-4942
4817 cell Cell to recover information.
4818                 */
4819
4820
4821                function addCellInfoToVirtual(row, cell) {
4822                    var cellIndex = recoverCellIndex(row.rowIndex, cell.cellIndex);
4823                    var cellHasColspan = cell.colSpan > 1;
4824                    var cellHasRowspan = cell.rowSpan > 1;
4825                    var isThisSelectedCell = row.rowIndex === _startPoint.rowPos && cell.cellIndex === _startPoint.colPos;
4826                    setVirtualTablePosition(row.rowIndex, cellIndex, row, cell, cellHasRowspan, cellHasColspan, false); // Add span rows to virtual Table.
4827
4828                    var rowspanNumber = cell.attributes.rowSpan ? parseInt(cell.attributes.rowSpan.value, 10) : 0;
4829
4830                    if (rowspanNumber > 1) {
4831                        for (var rp = 1; rp < rowspanNumber; rp++) {
4832                            var rowspanIndex = row.rowIndex + rp;
4833                            adjustStartPoint(rowspanIndex, cellIndex, cell, isThisSelectedCell);
4834                            setVirtualTablePosition(rowspanIndex, cellIndex, row, cell, true, cellHasColspan, true);
4835                        }
4836                    } // Add span cols to virtual table.
4837
4838
4839                    var colspanNumber = cell.attributes.colSpan ? parseInt(cell.attributes.colSpan.value, 10) : 0;
4840
4841                    if (colspanNumber > 1) {
4842                        for (var cp = 1; cp < colspanNumber; cp++) {
4843                            var cellspanIndex = recoverCellIndex(row.rowIndex, cellIndex + cp);
4844                            adjustStartPoint(row.rowIndex, cellspanIndex, cell, isThisSelectedCell);
4845                            setVirtualTablePosition(row.rowIndex, cellspanIndex, row, cell, cellHasRowspan, true, true);
4846                        }
4847                    }
4848                }
4849
4850                /**
4851                 * Process validation and adjust of start point if needed
4852                 *
4853                 * @param {int} rowIndex
4854                 * @param {int} cellIndex
4855                 * @param {object} cell
4856                 * @param {bool} isSelectedCell
4857                 */
4858
4859
4860                function adjustStartPoint(rowIndex, cellIndex, cell, isSelectedCell) {
4861                    if (rowIndex === _startPoint.rowPos && _startPoint.colPos >= cell.cellIndex && cell.cellIndex <= cellIndex && !isSelectedCell) {
4862                        _startPoint.colPos++;
4863                    }
4864                }
4865
4866                /**
4867                 * Create virtual table of cells with all cells, including span cells.
4868                 */
4869
4870
4871                function createVirtualTable() {
4872                    var rows = domTable.rows;
4873
4874                    for (var rowIndex = 0; rowIndex < rows.length; rowIndex++) {
4875                        var cells = rows[rowIndex].cells;
4876
4877                        for (var cellIndex = 0; cellIndex < cells.length; cellIndex++) {
4878                            addCellInfoToVirtual(rows[rowIndex], cells[cellIndex]);
4879                        }
4880                    }
4881                }
4882
4883                /**
4884                 * Get action to be applied on the cell.
4885                 *
4886                 * @param {object} cell virtual table cell to apply action
4887                 */
4888
4889
4890                function getDeleteResultActionToCell(cell) {
4891                    switch (where) {
4892                        case TableResultAction.where.Column:
4893                            if (cell.isColSpan) {
4894                                return TableResultAction.resultAction.SubtractSpanCount;
4895                            }
4896
4897                            break;
4898
4899                        case TableResultAction.where.Row:
4900                            if (!cell.isVirtual && cell.isRowSpan) {
4901                                return TableResultAction.resultAction.AddCell;
4902                            } else if (cell.isRowSpan) {
4903                                return TableResultAction.resultAction.SubtractSpanCount;
4904                            }
4905
4906                            break;
4907                    }
4908
4909                    return TableResultAction.resultAction.RemoveCell;
4910                }
4911
4912                /**
4913                 * Get action to be applied on the cell.
4914                 *
4915                 * @param {object} cell virtual table cell to apply action
4916                 */
4917
4918
4919                function getAddResultActionToCell(cell) {
4920                    switch (where) {
4921                        case TableResultAction.where.Column:
4922                            if (cell.isColSpan) {
4923                                return TableResultAction.resultAction.SumSpanCount;
4924                            } else if (cell.isRowSpan && cell.isVirtual) {
4925                                return TableResultAction.resultAction.Ignore;
4926                            }
4927
4928                            break;
4929
4930                        case TableResultAction.where.Row:
4931                            if (cell.isRowSpan) {
4932                                return TableResultAction.resultAction.SumSpanCount;
4933                            } else if (cell.isColSpan && cell.isVirtual) {
4934                                return TableResultAction.resultAction.Ignore;
4935                            }
4936
4937                            break;
4938                    }
4939
4940                    return TableResultAction.resultAction.AddCell;
4941                }
4942
vendor: 10,311 bytes, lines 4943-5177
4943                function init() {
4944                    setStartPoint();
4945                    createVirtualTable();
4946                } /// ///////////////////////////////////////////
4947                // Public functions
4948                /// ///////////////////////////////////////////
4949
4950                /**
4951                 * Recover array os what to do in table.
4952                 */
4953
4954
4955                this.getActionList = function () {
4956                    var fixedRow = where === TableResultAction.where.Row ? _startPoint.rowPos : -1;
4957                    var fixedCol = where === TableResultAction.where.Column ? _startPoint.colPos : -1;
4958                    var actualPosition = 0;
4959                    var canContinue = true;
4960
4961                    while (canContinue) {
4962                        var rowPosition = fixedRow >= 0 ? fixedRow : actualPosition;
4963                        var colPosition = fixedCol >= 0 ? fixedCol : actualPosition;
4964                        var row = _virtualTable[rowPosition];
4965
4966                        if (!row) {
4967                            canContinue = false;
4968                            return _actionCellList;
4969                        }
4970
4971                        var cell = row[colPosition];
4972
4973                        if (!cell) {
4974                            canContinue = false;
4975                            return _actionCellList;
4976                        } // Define action to be applied in this cell
4977
4978
4979                        var resultAction = TableResultAction.resultAction.Ignore;
4980
4981                        switch (action) {
4982                            case TableResultAction.requestAction.Add:
4983                                resultAction = getAddResultActionToCell(cell);
4984                                break;
4985
4986                            case TableResultAction.requestAction.Delete:
4987                                resultAction = getDeleteResultActionToCell(cell);
4988                                break;
4989                        }
4990
4991                        _actionCellList.push(getActionCell(cell, resultAction, rowPosition, colPosition));
4992
4993                        actualPosition++;
4994                    }
4995
4996                    return _actionCellList;
4997                };
4998
4999                init();
5000            };
5001            /**
5002             *
5003             * Where action occours enum.
5004             */
5005
5006
5007            TableResultAction.where = {
5008                'Row': 0,
5009                'Column': 1
5010            };
5011            /**
5012             *
5013             * Requested action to apply enum.
5014             */
5015
5016            TableResultAction.requestAction = {
5017                'Add': 0,
5018                'Delete': 1
5019            };
5020            /**
5021             *
5022             * Result action to be executed enum.
5023             */
5024
5025            TableResultAction.resultAction = {
5026                'Ignore': 0,
5027                'SubtractSpanCount': 1,
5028                'RemoveCell': 2,
5029                'AddCell': 3,
5030                'SumSpanCount': 4
5031            };
5032            /**
5033             *
5034             * @class editing.Table
5035             *
5036             * Table
5037             *
5038             */
5039
5040            var Table = /*#__PURE__*/function () {
5041                function Table() {
5042                    Table_classCallCheck(this, Table);
5043                }
5044
5045                Table_createClass(Table, [{
5046                    key: "tab",
5047                    value:
5048                        /**
5049                         * handle tab key
5050                         *
5051                         * @param {WrappedRange} rng
5052                         * @param {Boolean} isShift
5053                         */
5054                        function tab(rng, isShift) {
5055                            var cell = dom.ancestor(rng.commonAncestor(), dom.isCell);
5056                            var table = dom.ancestor(cell, dom.isTable);
5057                            var cells = dom.listDescendant(table, dom.isCell);
5058                            var nextCell = lists[isShift ? 'prev' : 'next'](cells, cell);
5059
5060                            if (nextCell) {
5061                                range.create(nextCell, 0).select();
5062                            }
5063                        }
5064                    /**
5065                     * Add a new row
5066                     *
5067                     * @param {WrappedRange} rng
5068                     * @param {String} position (top/bottom)
5069                     * @return {Node}
5070                     */
5071
5072                }, {
5073                    key: "addRow",
5074                    value: function addRow(rng, position) {
5075                        var cell = dom.ancestor(rng.commonAncestor(), dom.isCell);
5076                        var currentTr = external_jQuery_default()(cell).closest('tr');
5077                        var trAttributes = this.recoverAttributes(currentTr);
5078                        var html = external_jQuery_default()('<tr' + trAttributes + '></tr>');
5079                        var vTable = new TableResultAction(cell, TableResultAction.where.Row, TableResultAction.requestAction.Add, external_jQuery_default()(currentTr).closest('table')[0]);
5080                        var actions = vTable.getActionList();
5081
5082                        for (var idCell = 0; idCell < actions.length; idCell++) {
5083                            var currentCell = actions[idCell];
5084                            var tdAttributes = this.recoverAttributes(currentCell.baseCell);
5085
5086                            switch (currentCell.action) {
5087                                case TableResultAction.resultAction.AddCell:
5088                                    html.append('<td' + tdAttributes + '>' + dom.blank + '</td>');
5089                                    break;
5090
5091                                case TableResultAction.resultAction.SumSpanCount: {
5092                                    if (position === 'top') {
5093                                        var baseCellTr = currentCell.baseCell.parent;
5094                                        var isTopFromRowSpan = (!baseCellTr ? 0 : currentCell.baseCell.closest('tr').rowIndex) <= currentTr[0].rowIndex;
5095
5096                                        if (isTopFromRowSpan) {
5097                                            var newTd = external_jQuery_default()('<div></div>').append(external_jQuery_default()('<td' + tdAttributes + '>' + dom.blank + '</td>').removeAttr('rowspan')).html();
5098                                            html.append(newTd);
5099                                            break;
5100                                        }
5101                                    }
5102
5103                                    var rowspanNumber = parseInt(currentCell.baseCell.rowSpan, 10);
5104                                    rowspanNumber++;
5105                                    currentCell.baseCell.setAttribute('rowSpan', rowspanNumber);
5106                                }
5107                                    break;
5108                            }
5109                        }
5110
5111                        if (position === 'top') {
5112                            currentTr.before(html);
5113                        } else {
5114                            var cellHasRowspan = cell.rowSpan > 1;
5115
5116                            if (cellHasRowspan) {
5117                                var lastTrIndex = currentTr[0].rowIndex + (cell.rowSpan - 2);
5118                                external_jQuery_default()(external_jQuery_default()(currentTr).parent().find('tr')[lastTrIndex]).after(external_jQuery_default()(html));
5119                                return;
5120                            }
5121
5122                            currentTr.after(html);
5123                        }
5124                    }
5125                    /**
5126                     * Add a new col
5127                     *
5128                     * @param {WrappedRange} rng
5129                     * @param {String} position (left/right)
5130                     * @return {Node}
5131                     */
5132
5133                }, {
5134                    key: "addCol",
5135                    value: function addCol(rng, position) {
5136                        var cell = dom.ancestor(rng.commonAncestor(), dom.isCell);
5137                        var row = external_jQuery_default()(cell).closest('tr');
5138                        var rowsGroup = external_jQuery_default()(row).siblings();
5139                        rowsGroup.push(row);
5140                        var vTable = new TableResultAction(cell, TableResultAction.where.Column, TableResultAction.requestAction.Add, external_jQuery_default()(row).closest('table')[0]);
5141                        var actions = vTable.getActionList();
5142
5143                        for (var actionIndex = 0; actionIndex < actions.length; actionIndex++) {
5144                            var currentCell = actions[actionIndex];
5145                            var tdAttributes = this.recoverAttributes(currentCell.baseCell);
5146
5147                            switch (currentCell.action) {
5148                                case TableResultAction.resultAction.AddCell:
5149                                    if (position === 'right') {
5150                                        external_jQuery_default()(currentCell.baseCell).after('<td' + tdAttributes + '>' + dom.blank + '</td>');
5151                                    } else {
5152                                        external_jQuery_default()(currentCell.baseCell).before('<td' + tdAttributes + '>' + dom.blank + '</td>');
5153                                    }
5154
5155                                    break;
5156
5157                                case TableResultAction.resultAction.SumSpanCount:
5158                                    if (position === 'right') {
5159                                        var colspanNumber = parseInt(currentCell.baseCell.colSpan, 10);
5160                                        colspanNumber++;
5161                                        currentCell.baseCell.setAttribute('colSpan', colspanNumber);
5162                                    } else {
5163                                        external_jQuery_default()(currentCell.baseCell).before('<td' + tdAttributes + '>' + dom.blank + '</td>');
5164                                    }
5165
5166                                    break;
5167                            }
5168                        }
5169                    }
5170                    /*
5171    * Copy attributes from element.
5172    *
5173    * @param {object} Element to recover attributes.
5174    * @return {string} Copied string elements.
5175    */
5176
5177                }, {
vendor: 5,014 bytes, lines 5178-5275
5178                    key: "recoverAttributes",
5179                    value: function recoverAttributes(el) {
5180                        var resultStr = '';
5181
5182                        if (!el) {
5183                            return resultStr;
5184                        }
5185
5186                        var attrList = el.attributes || [];
5187
5188                        for (var i = 0; i < attrList.length; i++) {
5189                            if (attrList[i].name.toLowerCase() === 'id') {
5190                                continue;
5191                            }
5192
5193                            if (attrList[i].specified) {
5194                                resultStr += ' ' + attrList[i].name + '=\'' + attrList[i].value + '\'';
5195                            }
5196                        }
5197
5198                        return resultStr;
5199                    }
5200                    /**
5201                     * Delete current row
5202                     *
5203                     * @param {WrappedRange} rng
5204                     * @return {Node}
5205                     */
5206
5207                }, {
5208                    key: "deleteRow",
5209                    value: function deleteRow(rng) {
5210                        var cell = dom.ancestor(rng.commonAncestor(), dom.isCell);
5211                        var row = external_jQuery_default()(cell).closest('tr');
5212                        var cellPos = row.children('td, th').index(external_jQuery_default()(cell));
5213                        var rowPos = row[0].rowIndex;
5214                        var vTable = new TableResultAction(cell, TableResultAction.where.Row, TableResultAction.requestAction.Delete, external_jQuery_default()(row).closest('table')[0]);
5215                        var actions = vTable.getActionList();
5216
5217                        for (var actionIndex = 0; actionIndex < actions.length; actionIndex++) {
5218                            if (!actions[actionIndex]) {
5219                                continue;
5220                            }
5221
5222                            var baseCell = actions[actionIndex].baseCell;
5223                            var virtualPosition = actions[actionIndex].virtualTable;
5224                            var hasRowspan = baseCell.rowSpan && baseCell.rowSpan > 1;
5225                            var rowspanNumber = hasRowspan ? parseInt(baseCell.rowSpan, 10) : 0;
5226
5227                            switch (actions[actionIndex].action) {
5228                                case TableResultAction.resultAction.Ignore:
5229                                    continue;
5230
5231                                case TableResultAction.resultAction.AddCell: {
5232                                    var nextRow = row.next('tr')[0];
5233
5234                                    if (!nextRow) {
5235                                        continue;
5236                                    }
5237
5238                                    var cloneRow = row[0].cells[cellPos];
5239
5240                                    if (hasRowspan) {
5241                                        if (rowspanNumber > 2) {
5242                                            rowspanNumber--;
5243                                            nextRow.insertBefore(cloneRow, nextRow.cells[cellPos]);
5244                                            nextRow.cells[cellPos].setAttribute('rowSpan', rowspanNumber);
5245                                            nextRow.cells[cellPos].innerHTML = '';
5246                                        } else if (rowspanNumber === 2) {
5247                                            nextRow.insertBefore(cloneRow, nextRow.cells[cellPos]);
5248                                            nextRow.cells[cellPos].removeAttribute('rowSpan');
5249                                            nextRow.cells[cellPos].innerHTML = '';
5250                                        }
5251                                    }
5252                                }
5253                                    continue;
5254
5255                                case TableResultAction.resultAction.SubtractSpanCount:
5256                                    if (hasRowspan) {
5257                                        if (rowspanNumber > 2) {
5258                                            rowspanNumber--;
5259                                            baseCell.setAttribute('rowSpan', rowspanNumber);
5260
5261                                            if (virtualPosition.rowIndex !== rowPos && baseCell.cellIndex === cellPos) {
5262                                                baseCell.innerHTML = '';
5263                                            }
5264                                        } else if (rowspanNumber === 2) {
5265                                            baseCell.removeAttribute('rowSpan');
5266
5267                                            if (virtualPosition.rowIndex !== rowPos && baseCell.cellIndex === cellPos) {
5268                                                baseCell.innerHTML = '';
5269                                            }
5270                                        }
5271                                    }
5272
5273                                    continue;
5274
5275                                case TableResultAction.resultAction.RemoveCell:
vendor: 11,080 bytes, lines 5276-5511
5276                                    // Do not need remove cell because row will be deleted.
5277                                    continue;
5278                            }
5279                        }
5280
5281                        row.remove();
5282                    }
5283                    /**
5284                     * Delete current col
5285                     *
5286                     * @param {WrappedRange} rng
5287                     * @return {Node}
5288                     */
5289
5290                }, {
5291                    key: "deleteCol",
5292                    value: function deleteCol(rng) {
5293                        var cell = dom.ancestor(rng.commonAncestor(), dom.isCell);
5294                        var row = external_jQuery_default()(cell).closest('tr');
5295                        var cellPos = row.children('td, th').index(external_jQuery_default()(cell));
5296                        var vTable = new TableResultAction(cell, TableResultAction.where.Column, TableResultAction.requestAction.Delete, external_jQuery_default()(row).closest('table')[0]);
5297                        var actions = vTable.getActionList();
5298
5299                        for (var actionIndex = 0; actionIndex < actions.length; actionIndex++) {
5300                            if (!actions[actionIndex]) {
5301                                continue;
5302                            }
5303
5304                            switch (actions[actionIndex].action) {
5305                                case TableResultAction.resultAction.Ignore:
5306                                    continue;
5307
5308                                case TableResultAction.resultAction.SubtractSpanCount: {
5309                                    var baseCell = actions[actionIndex].baseCell;
5310                                    var hasColspan = baseCell.colSpan && baseCell.colSpan > 1;
5311
5312                                    if (hasColspan) {
5313                                        var colspanNumber = baseCell.colSpan ? parseInt(baseCell.colSpan, 10) : 0;
5314
5315                                        if (colspanNumber > 2) {
5316                                            colspanNumber--;
5317                                            baseCell.setAttribute('colSpan', colspanNumber);
5318
5319                                            if (baseCell.cellIndex === cellPos) {
5320                                                baseCell.innerHTML = '';
5321                                            }
5322                                        } else if (colspanNumber === 2) {
5323                                            baseCell.removeAttribute('colSpan');
5324
5325                                            if (baseCell.cellIndex === cellPos) {
5326                                                baseCell.innerHTML = '';
5327                                            }
5328                                        }
5329                                    }
5330                                }
5331                                    continue;
5332
5333                                case TableResultAction.resultAction.RemoveCell:
5334                                    dom.remove(actions[actionIndex].baseCell, true);
5335                                    continue;
5336                            }
5337                        }
5338                    }
5339                    /**
5340                     * create empty table element
5341                     *
5342                     * @param {Number} rowCount
5343                     * @param {Number} colCount
5344                     * @return {Node}
5345                     */
5346
5347                }, {
5348                    key: "createTable",
5349                    value: function createTable(colCount, rowCount, options) {
5350                        var tds = [];
5351                        var tdHTML;
5352
5353                        for (var idxCol = 0; idxCol < colCount; idxCol++) {
5354                            tds.push('<td>' + dom.blank + '</td>');
5355                        }
5356
5357                        tdHTML = tds.join('');
5358                        var trs = [];
5359                        var trHTML;
5360
5361                        for (var idxRow = 0; idxRow < rowCount; idxRow++) {
5362                            trs.push('<tr>' + tdHTML + '</tr>');
5363                        }
5364
5365                        trHTML = trs.join('');
5366                        var $table = external_jQuery_default()('<table>' + trHTML + '</table>');
5367
5368                        if (options && options.tableClassName) {
5369                            $table.addClass(options.tableClassName);
5370                        }
5371
5372                        return $table[0];
5373                    }
5374                    /**
5375                     * Delete current table
5376                     *
5377                     * @param {WrappedRange} rng
5378                     * @return {Node}
5379                     */
5380
5381                }, {
5382                    key: "deleteTable",
5383                    value: function deleteTable(rng) {
5384                        var cell = dom.ancestor(rng.commonAncestor(), dom.isCell);
5385                        external_jQuery_default()(cell).closest('table').remove();
5386                    }
5387                }]);
5388
5389                return Table;
5390            }();
5391
5392
5393            ;// CONCATENATED MODULE: ./src/js/module/Editor.js
5394            function Editor_classCallCheck(instance, Constructor) {
5395                if (!(instance instanceof Constructor)) {
5396                    throw new TypeError("Cannot call a class as a function");
5397                }
5398            }
5399
5400            function Editor_defineProperties(target, props) {
5401                for (var i = 0; i < props.length; i++) {
5402                    var descriptor = props[i];
5403                    descriptor.enumerable = descriptor.enumerable || false;
5404                    descriptor.configurable = true;
5405                    if ("value" in descriptor) descriptor.writable = true;
5406                    Object.defineProperty(target, descriptor.key, descriptor);
5407                }
5408            }
5409
5410            function Editor_createClass(Constructor, protoProps, staticProps) {
5411                if (protoProps) Editor_defineProperties(Constructor.prototype, protoProps);
5412                if (staticProps) Editor_defineProperties(Constructor, staticProps);
5413                return Constructor;
5414            }
5415
5416
5417            var KEY_BOGUS = 'bogus';
5418            /**
5419             * @class Editor
5420             */
5421
5422            var Editor = /*#__PURE__*/function () {
5423                function Editor(context) {
5424                    var _this = this;
5425
5426                    Editor_classCallCheck(this, Editor);
5427
5428                    this.context = context;
5429                    this.$note = context.layoutInfo.note;
5430                    this.$editor = context.layoutInfo.editor;
5431                    this.$editable = context.layoutInfo.editable;
5432                    this.options = context.options;
5433                    this.lang = this.options.langInfo;
5434                    this.editable = this.$editable[0];
5435                    this.lastRange = null;
5436                    this.snapshot = null;
5437                    this.style = new Style();
5438                    this.table = new Table();
5439                    this.typing = new Typing(context);
5440                    this.bullet = new Bullet();
5441                    this.history = new History(context);
5442                    this.context.memo('help.escape', this.lang.help.escape);
5443                    this.context.memo('help.undo', this.lang.help.undo);
5444                    this.context.memo('help.redo', this.lang.help.redo);
5445                    this.context.memo('help.tab', this.lang.help.tab);
5446                    this.context.memo('help.untab', this.lang.help.untab);
5447                    this.context.memo('help.insertParagraph', this.lang.help.insertParagraph);
5448                    this.context.memo('help.insertOrderedList', this.lang.help.insertOrderedList);
5449                    this.context.memo('help.insertUnorderedList', this.lang.help.insertUnorderedList);
5450                    this.context.memo('help.indent', this.lang.help.indent);
5451                    this.context.memo('help.outdent', this.lang.help.outdent);
5452                    this.context.memo('help.formatPara', this.lang.help.formatPara);
5453                    this.context.memo('help.insertHorizontalRule', this.lang.help.insertHorizontalRule);
5454                    this.context.memo('help.fontName', this.lang.help.fontName); // native commands(with execCommand), generate function for execCommand
5455
5456                    var commands = ['bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', 'justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull', 'formatBlock', 'removeFormat', 'backColor'];
5457
5458                    for (var idx = 0, len = commands.length; idx < len; idx++) {
5459                        this[commands[idx]] = function (sCmd) {
5460                            return function (value) {
5461                                _this.beforeCommand();
5462
5463                                document.execCommand(sCmd, false, value);
5464
5465                                _this.afterCommand(true);
5466                            };
5467                        }(commands[idx]);
5468
5469                        this.context.memo('help.' + commands[idx], this.lang.help[commands[idx]]);
5470                    }
5471
5472                    this.fontName = this.wrapCommand(function (value) {
5473                        return _this.fontStyling('font-family', env.validFontName(value));
5474                    });
5475                    this.fontSize = this.wrapCommand(function (value) {
5476                        var unit = _this.currentStyle()['font-size-unit'];
5477
5478                        return _this.fontStyling('font-size', value + unit);
5479                    });
5480                    this.fontSizeUnit = this.wrapCommand(function (value) {
5481                        var size = _this.currentStyle()['font-size'];
5482
5483                        return _this.fontStyling('font-size', size + value);
5484                    });
5485
5486                    for (var _idx = 1; _idx <= 6; _idx++) {
5487                        this['formatH' + _idx] = function (idx) {
5488                            return function () {
5489                                _this.formatBlock('H' + idx);
5490                            };
5491                        }(_idx);
5492
5493                        this.context.memo('help.formatH' + _idx, this.lang.help['formatH' + _idx]);
5494                    }
5495
5496                    this.insertParagraph = this.wrapCommand(function () {
5497                        _this.typing.insertParagraph(_this.editable);
5498                    });
5499                    this.insertOrderedList = this.wrapCommand(function () {
5500                        _this.bullet.insertOrderedList(_this.editable);
5501                    });
5502                    this.insertUnorderedList = this.wrapCommand(function () {
5503                        _this.bullet.insertUnorderedList(_this.editable);
5504                    });
5505                    this.indent = this.wrapCommand(function () {
5506                        _this.bullet.indent(_this.editable);
5507                    });
5508                    this.outdent = this.wrapCommand(function () {
5509                        _this.bullet.outdent(_this.editable);
5510                    });
5511                    /**
vendor: 4,571 bytes, lines 5512-5625
5512                     * insertNode
5513                     * insert node
5514                     * @param {Node} node
5515                     */
5516
5517                    this.insertNode = this.wrapCommand(function (node) {
5518                        if (_this.isLimited(external_jQuery_default()(node).text().length)) {
5519                            return;
5520                        }
5521
5522                        var rng = _this.getLastRange();
5523
5524                        rng.insertNode(node);
5525
5526                        _this.setLastRange(range.createFromNodeAfter(node).select());
5527                    });
5528                    /**
5529                     * insert text
5530                     * @param {String} text
5531                     */
5532
5533                    this.insertText = this.wrapCommand(function (text) {
5534                        if (_this.isLimited(text.length)) {
5535                            return;
5536                        }
5537
5538                        var rng = _this.getLastRange();
5539
5540                        var textNode = rng.insertNode(dom.createText(text));
5541
5542                        _this.setLastRange(range.create(textNode, dom.nodeLength(textNode)).select());
5543                    });
5544                    /**
5545                     * paste HTML
5546                     * @param {String} markup
5547                     */
5548
5549                    this.pasteHTML = this.wrapCommand(function (markup) {
5550                        if (_this.isLimited(markup.length)) {
5551                            return;
5552                        }
5553
5554                        markup = _this.context.invoke('codeview.purify', markup);
5555
5556                        var contents = _this.getLastRange().pasteHTML(markup);
5557
5558                        _this.setLastRange(range.createFromNodeAfter(lists.last(contents)).select());
5559                    });
5560                    /**
5561                     * formatBlock
5562                     *
5563                     * @param {String} tagName
5564                     */
5565
5566                    this.formatBlock = this.wrapCommand(function (tagName, $target) {
5567                        var onApplyCustomStyle = _this.options.callbacks.onApplyCustomStyle;
5568
5569                        if (onApplyCustomStyle) {
5570                            onApplyCustomStyle.call(_this, $target, _this.context, _this.onFormatBlock);
5571                        } else {
5572                            _this.onFormatBlock(tagName, $target);
5573                        }
5574                    });
5575                    /**
5576                     * insert horizontal rule
5577                     */
5578
5579                    this.insertHorizontalRule = this.wrapCommand(function () {
5580                        var hrNode = _this.getLastRange().insertNode(dom.create('HR'));
5581
5582                        if (hrNode.nextSibling) {
5583                            _this.setLastRange(range.create(hrNode.nextSibling, 0).normalize().select());
5584                        }
5585                    });
5586                    /**
5587                     * lineHeight
5588                     * @param {String} value
5589                     */
5590
5591                    this.lineHeight = this.wrapCommand(function (value) {
5592                        _this.style.stylePara(_this.getLastRange(), {
5593                            lineHeight: value
5594                        });
5595                    });
5596                    /**
5597                     * create link (command)
5598                     *
5599                     * @param {Object} linkInfo
5600                     */
5601
5602                    this.createLink = this.wrapCommand(function (linkInfo) {
5603                        var linkUrl = linkInfo.url;
5604                        var linkText = linkInfo.text;
5605                        var isNewWindow = linkInfo.isNewWindow;
5606                        var checkProtocol = linkInfo.checkProtocol;
5607
5608                        var rng = linkInfo.range || _this.getLastRange();
5609
5610                        var additionalTextLength = linkText.length - rng.toString().length;
5611
5612                        if (additionalTextLength > 0 && _this.isLimited(additionalTextLength)) {
5613                            return;
5614                        }
5615
5616                        var isTextChanged = rng.toString() !== linkText; // handle spaced urls from input
5617
5618                        if (typeof linkUrl === 'string') {
5619                            linkUrl = linkUrl.trim();
5620                        }
5621
5622                        if (_this.options.onCreateLink) {
5623                            linkUrl = _this.options.onCreateLink(linkUrl);
5624                        } else if (checkProtocol) {
5625                            // if url doesn't have any protocol and n
vendor: 5,938 bytes, lines 5625-5759
5625ot even a relative or a label, use http:// as default
5626                            linkUrl = /^([A-Za-z][A-Za-z0-9+-.]*\:|#|\/)/.test(linkUrl) ? linkUrl : _this.options.defaultProtocol + linkUrl;
5627                        }
5628
5629                        var anchors = [];
5630
5631                        if (isTextChanged) {
5632                            rng = rng.deleteContents();
5633                            var anchor = rng.insertNode(external_jQuery_default()('<A>' + linkText + '</A>')[0]);
5634                            anchors.push(anchor);
5635                        } else {
5636                            anchors = _this.style.styleNodes(rng, {
5637                                nodeName: 'A',
5638                                expandClosestSibling: true,
5639                                onlyPartialContains: true
5640                            });
5641                        }
5642
5643                        external_jQuery_default().each(anchors, function (idx, anchor) {
5644                            external_jQuery_default()(anchor).attr('href', linkUrl);
5645
5646                            if (isNewWindow) {
5647                                external_jQuery_default()(anchor).attr('target', '_blank');
5648                            } else {
5649                                external_jQuery_default()(anchor).removeAttr('target');
5650                            }
5651                        });
5652
5653                        _this.setLastRange(_this.createRangeFromList(anchors).select());
5654                    });
5655                    /**
5656                     * setting color
5657                     *
5658                     * @param {Object} sObjColor  color code
5659                     * @param {String} sObjColor.foreColor foreground color
5660                     * @param {String} sObjColor.backColor background color
5661                     */
5662
5663                    this.color = this.wrapCommand(function (colorInfo) {
5664                        var foreColor = colorInfo.foreColor;
5665                        var backColor = colorInfo.backColor;
5666
5667                        if (foreColor) {
5668                            document.execCommand('foreColor', false, foreColor);
5669                        }
5670
5671                        if (backColor) {
5672                            document.execCommand('backColor', false, backColor);
5673                        }
5674                    });
5675                    /**
5676                     * Set foreground color
5677                     *
5678                     * @param {String} colorCode foreground color code
5679                     */
5680
5681                    this.foreColor = this.wrapCommand(function (colorInfo) {
5682                        document.execCommand('foreColor', false, colorInfo);
5683                    });
5684                    /**
5685                     * insert Table
5686                     *
5687                     * @param {String} dimension of table (ex : "5x5")
5688                     */
5689
5690                    this.insertTable = this.wrapCommand(function (dim) {
5691                        var dimension = dim.split('x');
5692
5693                        var rng = _this.getLastRange().deleteContents();
5694
5695                        rng.insertNode(_this.table.createTable(dimension[0], dimension[1], _this.options));
5696                    });
5697                    /**
5698                     * remove media object and Figure Elements if media object is img with Figure.
5699                     */
5700
5701                    this.removeMedia = this.wrapCommand(function () {
5702                        var $target = external_jQuery_default()(_this.restoreTarget()).parent();
5703
5704                        if ($target.closest('figure').length) {
5705                            $target.closest('figure').remove();
5706                        } else {
5707                            $target = external_jQuery_default()(_this.restoreTarget()).detach();
5708                        }
5709
5710                        _this.context.triggerEvent('media.delete', $target, _this.$editable);
5711                    });
5712                    /**
5713                     * float me
5714                     *
5715                     * @param {String} value
5716                     */
5717
5718                    this.floatMe = this.wrapCommand(function (value) {
5719                        var $target = external_jQuery_default()(_this.restoreTarget());
5720                        $target.toggleClass('note-float-left', value === 'left');
5721                        $target.toggleClass('note-float-right', value === 'right');
5722                        $target.css('float', value === 'none' ? '' : value);
5723                    });
5724                    /**
5725                     * resize overlay element
5726                     * @param {String} value
5727                     */
5728
5729                    this.resize = this.wrapCommand(function (value) {
5730                        var $target = external_jQuery_default()(_this.restoreTarget());
5731                        value = parseFloat(value);
5732
5733                        if (value === 0) {
5734                            $target.css('width', '');
5735                        } else {
5736                            $target.css({
5737                                width: value * 100 + '%',
5738                                height: ''
5739                            });
5740                        }
5741                    });
5742                }
5743
5744                Editor_createClass(Editor, [{
5745                    key: "initialize",
5746                    value: function initialize() {
5747                        var _this2 = this;
5748
5749                        // bind custom events
5750                        this.$editable.on('keydown', function (event) {
5751                            if (event.keyCode === key.code.ENTER) {
5752                                _this2.context.triggerEvent('enter', event);
5753                            }
5754
5755                            _this2.context.triggerEvent('keydown', event); // keep a snapshot to limit text on input event
5756
5757
5758                            _this2.snapshot = _this2.history.makeSnapshot();
5759                            _this2.hasKeyShortCut = false;
vendor: 4,915 bytes, lines 5760-5862
5760
5761                            if (!event.isDefaultPrevented()) {
5762                                if (_this2.options.shortcuts) {
5763                                    _this2.hasKeyShortCut = _this2.handleKeyMap(event);
5764                                } else {
5765                                    _this2.preventDefaultEditableShortCuts(event);
5766                                }
5767                            }
5768
5769                            if (_this2.isLimited(1, event)) {
5770                                var lastRange = _this2.getLastRange();
5771
5772                                if (lastRange.eo - lastRange.so === 0) {
5773                                    return false;
5774                                }
5775                            }
5776
5777                            _this2.setLastRange(); // record undo in the key event except keyMap.
5778
5779
5780                            if (_this2.options.recordEveryKeystroke) {
5781                                if (_this2.hasKeyShortCut === false) {
5782                                    _this2.history.recordUndo();
5783                                }
5784                            }
5785                        }).on('keyup', function (event) {
5786                            _this2.setLastRange();
5787
5788                            _this2.context.triggerEvent('keyup', event);
5789                        }).on('focus', function (event) {
5790                            _this2.setLastRange();
5791
5792                            _this2.context.triggerEvent('focus', event);
5793                        }).on('blur', function (event) {
5794                            _this2.context.triggerEvent('blur', event);
5795                        }).on('mousedown', function (event) {
5796                            _this2.context.triggerEvent('mousedown', event);
5797                        }).on('mouseup', function (event) {
5798                            _this2.setLastRange();
5799
5800                            _this2.history.recordUndo();
5801
5802                            _this2.context.triggerEvent('mouseup', event);
5803                        }).on('scroll', function (event) {
5804                            _this2.context.triggerEvent('scroll', event);
5805                        }).on('paste', function (event) {
5806                            _this2.setLastRange();
5807
5808                            _this2.context.triggerEvent('paste', event);
5809                        }).on('input', function () {
5810                            // To limit composition characters (e.g. Korean)
5811                            if (_this2.isLimited(0) && _this2.snapshot) {
5812                                _this2.history.applySnapshot(_this2.snapshot);
5813                            }
5814                        });
5815                        this.$editable.attr('spellcheck', this.options.spellCheck);
5816                        this.$editable.attr('autocorrect', this.options.spellCheck);
5817
5818                        if (this.options.disableGrammar) {
5819                            this.$editable.attr('data-gramm', false);
5820                        } // init content before set event
5821
5822
5823                        this.$editable.html(dom.html(this.$note) || dom.emptyPara);
5824                        this.$editable.on(env.inputEventName, func.debounce(function () {
5825                            _this2.context.triggerEvent('change', _this2.$editable.html(), _this2.$editable);
5826                        }, 10));
5827                        this.$editable.on('focusin', function (event) {
5828                            _this2.context.triggerEvent('focusin', event);
5829                        }).on('focusout', function (event) {
5830                            _this2.context.triggerEvent('focusout', event);
5831                        });
5832
5833                        if (this.options.airMode) {
5834                            if (this.options.overrideContextMenu) {
5835                                this.$editor.on('contextmenu', function (event) {
5836                                    _this2.context.triggerEvent('contextmenu', event);
5837
5838                                    return false;
5839                                });
5840                            }
5841                        } else {
5842                            if (this.options.width) {
5843                                this.$editor.outerWidth(this.options.width);
5844                            }
5845
5846                            if (this.options.height) {
5847                                this.$editable.outerHeight(this.options.height);
5848                            }
5849
5850                            if (this.options.maxHeight) {
5851                                this.$editable.css('max-height', this.options.maxHeight);
5852                            }
5853
5854                            if (this.options.minHeight) {
5855                                this.$editable.css('min-height', this.options.minHeight);
5856                            }
5857                        }
5858
5859                        this.history.recordUndo();
5860                        this.setLastRange();
5861                    }
5862                }, {
vendor: 100,780 bytes, lines 5863-8040
5863                    key: "destroy",
5864                    value: function destroy() {
5865                        this.$editable.off();
5866                    }
5867                }, {
5868                    key: "handleKeyMap",
5869                    value: function handleKeyMap(event) {
5870                        var keyMap = this.options.keyMap[env.isMac ? 'mac' : 'pc'];
5871                        var keys = [];
5872
5873                        if (event.metaKey) {
5874                            keys.push('CMD');
5875                        }
5876
5877                        if (event.ctrlKey && !event.altKey) {
5878                            keys.push('CTRL');
5879                        }
5880
5881                        if (event.shiftKey) {
5882                            keys.push('SHIFT');
5883                        }
5884
5885                        var keyName = key.nameFromCode[event.keyCode];
5886
5887                        if (keyName) {
5888                            keys.push(keyName);
5889                        }
5890
5891                        var eventName = keyMap[keys.join('+')];
5892
5893                        if (keyName === 'TAB' && !this.options.tabDisable) {
5894                            this.afterCommand();
5895                        } else if (eventName) {
5896                            if (this.context.invoke(eventName) !== false) {
5897                                event.preventDefault(); // if keyMap action was invoked
5898
5899                                return true;
5900                            }
5901                        } else if (key.isEdit(event.keyCode)) {
5902                            this.afterCommand();
5903                        }
5904
5905                        return false;
5906                    }
5907                }, {
5908                    key: "preventDefaultEditableShortCuts",
5909                    value: function preventDefaultEditableShortCuts(event) {
5910                        // B(Bold, 66) / I(Italic, 73) / U(Underline, 85)
5911                        if ((event.ctrlKey || event.metaKey) && lists.contains([66, 73, 85], event.keyCode)) {
5912                            event.preventDefault();
5913                        }
5914                    }
5915                }, {
5916                    key: "isLimited",
5917                    value: function isLimited(pad, event) {
5918                        pad = pad || 0;
5919
5920                        if (typeof event !== 'undefined') {
5921                            if (key.isMove(event.keyCode) || key.isNavigation(event.keyCode) || event.ctrlKey || event.metaKey || lists.contains([key.code.BACKSPACE, key.code.DELETE], event.keyCode)) {
5922                                return false;
5923                            }
5924                        }
5925
5926                        if (this.options.maxTextLength > 0) {
5927                            if (this.$editable.text().length + pad > this.options.maxTextLength) {
5928                                return true;
5929                            }
5930                        }
5931
5932                        return false;
5933                    }
5934                    /**
5935                     * create range
5936                     * @return {WrappedRange}
5937                     */
5938
5939                }, {
5940                    key: "createRange",
5941                    value: function createRange() {
5942                        this.focus();
5943                        this.setLastRange();
5944                        return this.getLastRange();
5945                    }
5946                    /**
5947                     * create a new range from the list of elements
5948                     *
5949                     * @param {list} dom element list
5950                     * @return {WrappedRange}
5951                     */
5952
5953                }, {
5954                    key: "createRangeFromList",
5955                    value: function createRangeFromList(lst) {
5956                        var startRange = range.createFromNodeBefore(lists.head(lst));
5957                        var startPoint = startRange.getStartPoint();
5958                        var endRange = range.createFromNodeAfter(lists.last(lst));
5959                        var endPoint = endRange.getEndPoint();
5960                        return range.create(startPoint.node, startPoint.offset, endPoint.node, endPoint.offset);
5961                    }
5962                    /**
5963                     * set the last range
5964                     *
5965                     * if given rng is exist, set rng as the last range
5966                     * or create a new range at the end of the document
5967                     *
5968                     * @param {WrappedRange} rng
5969                     */
5970
5971                }, {
5972                    key: "setLastRange",
5973                    value: function setLastRange(rng) {
5974                        if (rng) {
5975                            this.lastRange = rng;
5976                        } else {
5977                            this.lastRange = range.create(this.editable);
5978
5979                            if (external_jQuery_default()(this.lastRange.sc).closest('.note-editable').length === 0) {
5980                                this.lastRange = range.createFromBodyElement(this.editable);
5981                            }
5982                        }
5983                    }
5984                    /**
5985                     * get the last range
5986                     *
5987                     * if there is a saved last range, return it
5988                     * or create a new range and return it
5989                     *
5990                     * @return {WrappedRange}
5991                     */
5992
5993                }, {
5994                    key: "getLastRange",
5995                    value: function getLastRange() {
5996                        if (!this.lastRange) {
5997                            this.setLastRange();
5998                        }
5999
6000                        return this.lastRange;
6001                    }
6002                    /**
6003                     * saveRange
6004                     *
6005                     * save current range
6006                     *
6007                     * @param {Boolean} [thenCollapse=false]
6008                     */
6009
6010                }, {
6011                    key: "saveRange",
6012                    value: function saveRange(thenCollapse) {
6013                        if (thenCollapse) {
6014                            this.getLastRange().collapse().select();
6015                        }
6016                    }
6017                    /**
6018                     * restoreRange
6019                     *
6020                     * restore lately range
6021                     */
6022
6023                }, {
6024                    key: "restoreRange",
6025                    value: function restoreRange() {
6026                        if (this.lastRange) {
6027                            this.lastRange.select();
6028                            this.focus();
6029                        }
6030                    }
6031                }, {
6032                    key: "saveTarget",
6033                    value: function saveTarget(node) {
6034                        this.$editable.data('target', node);
6035                    }
6036                }, {
6037                    key: "clearTarget",
6038                    value: function clearTarget() {
6039                        this.$editable.removeData('target');
6040                    }
6041                }, {
6042                    key: "restoreTarget",
6043                    value: function restoreTarget() {
6044                        return this.$editable.data('target');
6045                    }
6046                    /**
6047                     * currentStyle
6048                     *
6049                     * current style
6050                     * @return {Object|Boolean} unfocus
6051                     */
6052
6053                }, {
6054                    key: "currentStyle",
6055                    value: function currentStyle() {
6056                        var rng = range.create();
6057
6058                        if (rng) {
6059                            rng = rng.normalize();
6060                        }
6061
6062                        return rng ? this.style.current(rng) : this.style.fromNode(this.$editable);
6063                    }
6064                    /**
6065                     * style from node
6066                     *
6067                     * @param {jQuery} $node
6068                     * @return {Object}
6069                     */
6070
6071                }, {
6072                    key: "styleFromNode",
6073                    value: function styleFromNode($node) {
6074                        return this.style.fromNode($node);
6075                    }
6076                    /**
6077                     * undo
6078                     */
6079
6080                }, {
6081                    key: "undo",
6082                    value: function undo() {
6083                        this.context.triggerEvent('before.command', this.$editable.html());
6084                        this.history.undo();
6085                        this.context.triggerEvent('change', this.$editable.html(), this.$editable);
6086                    }
6087                    /*
6088    * commit
6089    */
6090
6091                }, {
6092                    key: "commit",
6093                    value: function commit() {
6094                        this.context.triggerEvent('before.command', this.$editable.html());
6095                        this.history.commit();
6096                        this.context.triggerEvent('change', this.$editable.html(), this.$editable);
6097                    }
6098                    /**
6099                     * redo
6100                     */
6101
6102                }, {
6103                    key: "redo",
6104                    value: function redo() {
6105                        this.context.triggerEvent('before.command', this.$editable.html());
6106                        this.history.redo();
6107                        this.context.triggerEvent('change', this.$editable.html(), this.$editable);
6108                    }
6109                    /**
6110                     * before command
6111                     */
6112
6113                }, {
6114                    key: "beforeCommand",
6115                    value: function beforeCommand() {
6116                        this.context.triggerEvent('before.command', this.$editable.html()); // Set styleWithCSS before run a command
6117
6118                        document.execCommand('styleWithCSS', false, this.options.styleWithCSS); // keep focus on editable before command execution
6119
6120                        this.focus();
6121                    }
6122                    /**
6123                     * after command
6124                     * @param {Boolean} isPreventTrigger
6125                     */
6126
6127                }, {
6128                    key: "afterCommand",
6129                    value: function afterCommand(isPreventTrigger) {
6130                        this.normalizeContent();
6131                        this.history.recordUndo();
6132
6133                        if (!isPreventTrigger) {
6134                            this.context.triggerEvent('change', this.$editable.html(), this.$editable);
6135                        }
6136                    }
6137                    /**
6138                     * handle tab key
6139                     */
6140
6141                }, {
6142                    key: "tab",
6143                    value: function tab() {
6144                        var rng = this.getLastRange();
6145
6146                        if (rng.isCollapsed() && rng.isOnCell()) {
6147                            this.table.tab(rng);
6148                        } else {
6149                            if (this.options.tabSize === 0) {
6150                                return false;
6151                            }
6152
6153                            if (!this.isLimited(this.options.tabSize)) {
6154                                this.beforeCommand();
6155                                this.typing.insertTab(rng, this.options.tabSize);
6156                                this.afterCommand();
6157                            }
6158                        }
6159                    }
6160                    /**
6161                     * handle shift+tab key
6162                     */
6163
6164                }, {
6165                    key: "untab",
6166                    value: function untab() {
6167                        var rng = this.getLastRange();
6168
6169                        if (rng.isCollapsed() && rng.isOnCell()) {
6170                            this.table.tab(rng, true);
6171                        } else {
6172                            if (this.options.tabSize === 0) {
6173                                return false;
6174                            }
6175                        }
6176                    }
6177                    /**
6178                     * run given function between beforeCommand and afterCommand
6179                     */
6180
6181                }, {
6182                    key: "wrapCommand",
6183                    value: function wrapCommand(fn) {
6184                        return function () {
6185                            this.beforeCommand();
6186                            fn.apply(this, arguments);
6187                            this.afterCommand();
6188                        };
6189                    }
6190                    /**
6191                     * insert image
6192                     *
6193                     * @param {String} src
6194                     * @param {String|Function} param
6195                     * @return {Promise}
6196                     */
6197
6198                }, {
6199                    key: "insertImage",
6200                    value: function insertImage(src, param) {
6201                        var _this3 = this;
6202
6203                        return createImage(src, param).then(function ($image) {
6204                            _this3.beforeCommand();
6205
6206                            if (typeof param === 'function') {
6207                                param($image);
6208                            } else {
6209                                if (typeof param === 'string') {
6210                                    $image.attr('data-filename', param);
6211                                }
6212
6213                                $image.css('width', Math.min(_this3.$editable.width(), $image.width()));
6214                            }
6215
6216                            $image.show();
6217
6218                            _this3.getLastRange().insertNode($image[0]);
6219
6220                            _this3.setLastRange(range.createFromNodeAfter($image[0]).select());
6221
6222                            _this3.afterCommand();
6223                        }).fail(function (e) {
6224                            _this3.context.triggerEvent('image.upload.error', e);
6225                        });
6226                    }
6227                    /**
6228                     * insertImages
6229                     * @param {File[]} files
6230                     */
6231
6232                }, {
6233                    key: "insertImagesAsDataURL",
6234                    value: function insertImagesAsDataURL(files) {
6235                        var _this4 = this;
6236
6237                        external_jQuery_default().each(files, function (idx, file) {
6238                            var filename = file.name;
6239
6240                            if (_this4.options.maximumImageFileSize && _this4.options.maximumImageFileSize < file.size) {
6241                                _this4.context.triggerEvent('image.upload.error', _this4.lang.image.maximumFileSizeError);
6242                            } else {
6243                                readFileAsDataURL(file).then(function (dataURL) {
6244                                    return _this4.insertImage(dataURL, filename);
6245                                }).fail(function () {
6246                                    _this4.context.triggerEvent('image.upload.error');
6247                                });
6248                            }
6249                        });
6250                    }
6251                    /**
6252                     * insertImagesOrCallback
6253                     * @param {File[]} files
6254                     */
6255
6256                }, {
6257                    key: "insertImagesOrCallback",
6258                    value: function insertImagesOrCallback(files) {
6259                        var callbacks = this.options.callbacks; // If onImageUpload set,
6260
6261                        if (callbacks.onImageUpload) {
6262                            this.context.triggerEvent('image.upload', files); // else insert Image as dataURL
6263                        } else {
6264                            this.insertImagesAsDataURL(files);
6265                        }
6266                    }
6267                    /**
6268                     * return selected plain text
6269                     * @return {String} text
6270                     */
6271
6272                }, {
6273                    key: "getSelectedText",
6274                    value: function getSelectedText() {
6275                        var rng = this.getLastRange(); // if range on anchor, expand range with anchor
6276
6277                        if (rng.isOnAnchor()) {
6278                            rng = range.createFromNode(dom.ancestor(rng.sc, dom.isAnchor));
6279                        }
6280
6281                        return rng.toString();
6282                    }
6283                }, {
6284                    key: "onFormatBlock",
6285                    value: function onFormatBlock(tagName, $target) {
6286                        // [workaround] for MSIE, IE need `<`
6287                        document.execCommand('FormatBlock', false, env.isMSIE ? '<' + tagName + '>' : tagName); // support custom class
6288
6289                        if ($target && $target.length) {
6290                            // find the exact element has given tagName
6291                            if ($target[0].tagName.toUpperCase() !== tagName.toUpperCase()) {
6292                                $target = $target.find(tagName);
6293                            }
6294
6295                            if ($target && $target.length) {
6296                                var currentRange = this.createRange();
6297                                var $parent = external_jQuery_default()([currentRange.sc, currentRange.ec]).closest(tagName); // remove class added for current block
6298
6299                                $parent.removeClass();
6300                                var className = $target[0].className || '';
6301
6302                                if (className) {
6303                                    $parent.addClass(className);
6304                                }
6305                            }
6306                        }
6307                    }
6308                }, {
6309                    key: "formatPara",
6310                    value: function formatPara() {
6311                        this.formatBlock('P');
6312                    }
6313                }, {
6314                    key: "fontStyling",
6315                    value: function fontStyling(target, value) {
6316                        var rng = this.getLastRange();
6317
6318                        if (rng !== '') {
6319                            var spans = this.style.styleNodes(rng);
6320                            this.$editor.find('.note-status-output').html('');
6321                            external_jQuery_default()(spans).css(target, value); // [workaround] added styled bogus span for style
6322                            //  - also bogus character needed for cursor position
6323
6324                            if (rng.isCollapsed()) {
6325                                var firstSpan = lists.head(spans);
6326
6327                                if (firstSpan && !dom.nodeLength(firstSpan)) {
6328                                    firstSpan.innerHTML = dom.ZERO_WIDTH_NBSP_CHAR;
6329                                    range.createFromNode(firstSpan.firstChild).select();
6330                                    this.setLastRange();
6331                                    this.$editable.data(KEY_BOGUS, firstSpan);
6332                                }
6333                            } else {
6334                                this.setLastRange(this.createRangeFromList(spans).select());
6335                            }
6336                        } else {
6337                            var noteStatusOutput = external_jQuery_default().now();
6338                            this.$editor.find('.note-status-output').html('<div id="note-status-output-' + noteStatusOutput + '" class="alert alert-info">' + this.lang.output.noSelection + '</div>');
6339                            setTimeout(function () {
6340                                external_jQuery_default()('#note-status-output-' + noteStatusOutput).remove();
6341                            }, 5000);
6342                        }
6343                    }
6344                    /**
6345                     * unlink
6346                     *
6347                     * @type command
6348                     */
6349
6350                }, {
6351                    key: "unlink",
6352                    value: function unlink() {
6353                        var rng = this.getLastRange();
6354
6355                        if (rng.isOnAnchor()) {
6356                            var anchor = dom.ancestor(rng.sc, dom.isAnchor);
6357                            rng = range.createFromNode(anchor);
6358                            rng.select();
6359                            this.setLastRange();
6360                            this.beforeCommand();
6361                            document.execCommand('unlink');
6362                            this.afterCommand();
6363                        }
6364                    }
6365                    /**
6366                     * returns link info
6367                     *
6368                     * @return {Object}
6369                     * @return {WrappedRange} return.range
6370                     * @return {String} return.text
6371                     * @return {Boolean} [return.isNewWindow=true]
6372                     * @return {String} [return.url=""]
6373                     */
6374
6375                }, {
6376                    key: "getLinkInfo",
6377                    value: function getLinkInfo() {
6378                        var rng = this.getLastRange().expand(dom.isAnchor); // Get the first anchor on range(for edit).
6379
6380                        var $anchor = external_jQuery_default()(lists.head(rng.nodes(dom.isAnchor)));
6381                        var linkInfo = {
6382                            range: rng,
6383                            text: rng.toString(),
6384                            url: $anchor.length ? $anchor.attr('href') : ''
6385                        }; // When anchor exists,
6386
6387                        if ($anchor.length) {
6388                            // Set isNewWindow by checking its target.
6389                            linkInfo.isNewWindow = $anchor.attr('target') === '_blank';
6390                        }
6391
6392                        return linkInfo;
6393                    }
6394                }, {
6395                    key: "addRow",
6396                    value: function addRow(position) {
6397                        var rng = this.getLastRange(this.$editable);
6398
6399                        if (rng.isCollapsed() && rng.isOnCell()) {
6400                            this.beforeCommand();
6401                            this.table.addRow(rng, position);
6402                            this.afterCommand();
6403                        }
6404                    }
6405                }, {
6406                    key: "addCol",
6407                    value: function addCol(position) {
6408                        var rng = this.getLastRange(this.$editable);
6409
6410                        if (rng.isCollapsed() && rng.isOnCell()) {
6411                            this.beforeCommand();
6412                            this.table.addCol(rng, position);
6413                            this.afterCommand();
6414                        }
6415                    }
6416                }, {
6417                    key: "deleteRow",
6418                    value: function deleteRow() {
6419                        var rng = this.getLastRange(this.$editable);
6420
6421                        if (rng.isCollapsed() && rng.isOnCell()) {
6422                            this.beforeCommand();
6423                            this.table.deleteRow(rng);
6424                            this.afterCommand();
6425                        }
6426                    }
6427                }, {
6428                    key: "deleteCol",
6429                    value: function deleteCol() {
6430                        var rng = this.getLastRange(this.$editable);
6431
6432                        if (rng.isCollapsed() && rng.isOnCell()) {
6433                            this.beforeCommand();
6434                            this.table.deleteCol(rng);
6435                            this.afterCommand();
6436                        }
6437                    }
6438                }, {
6439                    key: "deleteTable",
6440                    value: function deleteTable() {
6441                        var rng = this.getLastRange(this.$editable);
6442
6443                        if (rng.isCollapsed() && rng.isOnCell()) {
6444                            this.beforeCommand();
6445                            this.table.deleteTable(rng);
6446                            this.afterCommand();
6447                        }
6448                    }
6449                    /**
6450                     * @param {Position} pos
6451                     * @param {jQuery} $target - target element
6452                     * @param {Boolean} [bKeepRatio] - keep ratio
6453                     */
6454
6455                }, {
6456                    key: "resizeTo",
6457                    value: function resizeTo(pos, $target, bKeepRatio) {
6458                        var imageSize;
6459
6460                        if (bKeepRatio) {
6461                            var newRatio = pos.y / pos.x;
6462                            var ratio = $target.data('ratio');
6463                            imageSize = {
6464                                width: ratio > newRatio ? pos.x : pos.y / ratio,
6465                                height: ratio > newRatio ? pos.x * ratio : pos.y
6466                            };
6467                        } else {
6468                            imageSize = {
6469                                width: pos.x,
6470                                height: pos.y
6471                            };
6472                        }
6473
6474                        $target.css(imageSize);
6475                    }
6476                    /**
6477                     * returns whether editable area has focus or not.
6478                     */
6479
6480                }, {
6481                    key: "hasFocus",
6482                    value: function hasFocus() {
6483                        return this.$editable.is(':focus');
6484                    }
6485                    /**
6486                     * set focus
6487                     */
6488
6489                }, {
6490                    key: "focus",
6491                    value: function focus() {
6492                        // [workaround] Screen will move when page is scolled in IE.
6493                        //  - do focus when not focused
6494                        if (!this.hasFocus()) {
6495                            this.$editable.focus();
6496                        }
6497                    }
6498                    /**
6499                     * returns whether contents is empty or not.
6500                     * @return {Boolean}
6501                     */
6502
6503                }, {
6504                    key: "isEmpty",
6505                    value: function isEmpty() {
6506                        return dom.isEmpty(this.$editable[0]) || dom.emptyPara === this.$editable.html();
6507                    }
6508                    /**
6509                     * Removes all contents and restores the editable instance to an _emptyPara_.
6510                     */
6511
6512                }, {
6513                    key: "empty",
6514                    value: function empty() {
6515                        this.context.invoke('code', dom.emptyPara);
6516                    }
6517                    /**
6518                     * normalize content
6519                     */
6520
6521                }, {
6522                    key: "normalizeContent",
6523                    value: function normalizeContent() {
6524                        this.$editable[0].normalize();
6525                    }
6526                }]);
6527
6528                return Editor;
6529            }();
6530
6531
6532            ;// CONCATENATED MODULE: ./src/js/module/Clipboard.js
6533            function Clipboard_classCallCheck(instance, Constructor) {
6534                if (!(instance instanceof Constructor)) {
6535                    throw new TypeError("Cannot call a class as a function");
6536                }
6537            }
6538
6539            function Clipboard_defineProperties(target, props) {
6540                for (var i = 0; i < props.length; i++) {
6541                    var descriptor = props[i];
6542                    descriptor.enumerable = descriptor.enumerable || false;
6543                    descriptor.configurable = true;
6544                    if ("value" in descriptor) descriptor.writable = true;
6545                    Object.defineProperty(target, descriptor.key, descriptor);
6546                }
6547            }
6548
6549            function Clipboard_createClass(Constructor, protoProps, staticProps) {
6550                if (protoProps) Clipboard_defineProperties(Constructor.prototype, protoProps);
6551                if (staticProps) Clipboard_defineProperties(Constructor, staticProps);
6552                return Constructor;
6553            }
6554
6555
6556            var Clipboard = /*#__PURE__*/function () {
6557                function Clipboard(context) {
6558                    Clipboard_classCallCheck(this, Clipboard);
6559
6560                    this.context = context;
6561                    this.$editable = context.layoutInfo.editable;
6562                }
6563
6564                Clipboard_createClass(Clipboard, [{
6565                    key: "initialize",
6566                    value: function initialize() {
6567                        this.$editable.on('paste', this.pasteByEvent.bind(this));
6568                    }
6569                    /**
6570                     * paste by clipboard event
6571                     *
6572                     * @param {Event} event
6573                     */
6574
6575                }, {
6576                    key: "pasteByEvent",
6577                    value: function pasteByEvent(event) {
6578                        var _this = this;
6579
6580                        var clipboardData = event.originalEvent.clipboardData;
6581
6582                        if (clipboardData && clipboardData.items && clipboardData.items.length) {
6583                            var item = clipboardData.items.length > 1 ? clipboardData.items[1] : lists.head(clipboardData.items);
6584
6585                            if (item.kind === 'file' && item.type.indexOf('image/') !== -1) {
6586                                // paste img file
6587                                this.context.invoke('editor.insertImagesOrCallback', [item.getAsFile()]);
6588                                event.preventDefault();
6589                            } else if (item.kind === 'string') {
6590                                // paste text with maxTextLength check
6591                                if (this.context.invoke('editor.isLimited', clipboardData.getData('Text').length)) {
6592                                    event.preventDefault();
6593                                }
6594                            }
6595                        } else if (window.clipboardData) {
6596                            // for IE
6597                            var text = window.clipboardData.getData('text');
6598
6599                            if (this.context.invoke('editor.isLimited', text.length)) {
6600                                event.preventDefault();
6601                            }
6602                        } // Call editor.afterCommand after proceeding default event handler
6603
6604
6605                        setTimeout(function () {
6606                            _this.context.invoke('editor.afterCommand');
6607                        }, 10);
6608                    }
6609                }]);
6610
6611                return Clipboard;
6612            }();
6613
6614
6615            ;// CONCATENATED MODULE: ./src/js/module/Dropzone.js
6616            function Dropzone_classCallCheck(instance, Constructor) {
6617                if (!(instance instanceof Constructor)) {
6618                    throw new TypeError("Cannot call a class as a function");
6619                }
6620            }
6621
6622            function Dropzone_defineProperties(target, props) {
6623                for (var i = 0; i < props.length; i++) {
6624                    var descriptor = props[i];
6625                    descriptor.enumerable = descriptor.enumerable || false;
6626                    descriptor.configurable = true;
6627                    if ("value" in descriptor) descriptor.writable = true;
6628                    Object.defineProperty(target, descriptor.key, descriptor);
6629                }
6630            }
6631
6632            function Dropzone_createClass(Constructor, protoProps, staticProps) {
6633                if (protoProps) Dropzone_defineProperties(Constructor.prototype, protoProps);
6634                if (staticProps) Dropzone_defineProperties(Constructor, staticProps);
6635                return Constructor;
6636            }
6637
6638
6639            var Dropzone = /*#__PURE__*/function () {
6640                function Dropzone(context) {
6641                    Dropzone_classCallCheck(this, Dropzone);
6642
6643                    this.context = context;
6644                    this.$eventListener = external_jQuery_default()(document);
6645                    this.$editor = context.layoutInfo.editor;
6646                    this.$editable = context.layoutInfo.editable;
6647                    this.options = context.options;
6648                    this.lang = this.options.langInfo;
6649                    this.documentEventHandlers = {};
6650                    this.$dropzone = external_jQuery_default()(['<div class="note-dropzone">', '<div class="note-dropzone-message"></div>', '</div>'].join('')).prependTo(this.$editor);
6651                }
6652
6653                /**
6654                 * attach Drag and Drop Events
6655                 */
6656
6657
6658                Dropzone_createClass(Dropzone, [{
6659                    key: "initialize",
6660                    value: function initialize() {
6661                        if (this.options.disableDragAndDrop) {
6662                            // prevent default drop event
6663                            this.documentEventHandlers.onDrop = function (e) {
6664                                e.preventDefault();
6665                            }; // do not consider outside of dropzone
6666
6667
6668                            this.$eventListener = this.$dropzone;
6669                            this.$eventListener.on('drop', this.documentEventHandlers.onDrop);
6670                        } else {
6671                            this.attachDragAndDropEvent();
6672                        }
6673                    }
6674                    /**
6675                     * attach Drag and Drop Events
6676                     */
6677
6678                }, {
6679                    key: "attachDragAndDropEvent",
6680                    value: function attachDragAndDropEvent() {
6681                        var _this = this;
6682
6683                        var collection = external_jQuery_default()();
6684                        var $dropzoneMessage = this.$dropzone.find('.note-dropzone-message');
6685
6686                        this.documentEventHandlers.onDragenter = function (e) {
6687                            var isCodeview = _this.context.invoke('codeview.isActivated');
6688
6689                            var hasEditorSize = _this.$editor.width() > 0 && _this.$editor.height() > 0;
6690
6691                            if (!isCodeview && !collection.length && hasEditorSize) {
6692                                _this.$editor.addClass('dragover');
6693
6694                                _this.$dropzone.width(_this.$editor.width());
6695
6696                                _this.$dropzone.height(_this.$editor.height());
6697
6698                                $dropzoneMessage.text(_this.lang.image.dragImageHere);
6699                            }
6700
6701                            collection = collection.add(e.target);
6702                        };
6703
6704                        this.documentEventHandlers.onDragleave = function (e) {
6705                            collection = collection.not(e.target); // If nodeName is BODY, then just make it over (fix for IE)
6706
6707                            if (!collection.length || e.target.nodeName === 'BODY') {
6708                                collection = external_jQuery_default()();
6709
6710                                _this.$editor.removeClass('dragover');
6711                            }
6712                        };
6713
6714                        this.documentEventHandlers.onDrop = function () {
6715                            collection = external_jQuery_default()();
6716
6717                            _this.$editor.removeClass('dragover');
6718                        }; // show dropzone on dragenter when dragging a object to document
6719                        // -but only if the editor is visible, i.e. has a positive width and height
6720
6721
6722                        this.$eventListener.on('dragenter', this.documentEventHandlers.onDragenter).on('dragleave', this.documentEventHandlers.onDragleave).on('drop', this.documentEventHandlers.onDrop); // change dropzone's message on hover.
6723
6724                        this.$dropzone.on('dragenter', function () {
6725                            _this.$dropzone.addClass('hover');
6726
6727                            $dropzoneMessage.text(_this.lang.image.dropImage);
6728                        }).on('dragleave', function () {
6729                            _this.$dropzone.removeClass('hover');
6730
6731                            $dropzoneMessage.text(_this.lang.image.dragImageHere);
6732                        }); // attach dropImage
6733
6734                        this.$dropzone.on('drop', function (event) {
6735                            var dataTransfer = event.originalEvent.dataTransfer; // stop the browser from opening the dropped content
6736
6737                            event.preventDefault();
6738
6739                            if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {
6740                                _this.$editable.focus();
6741
6742                                _this.context.invoke('editor.insertImagesOrCallback', dataTransfer.files);
6743                            } else {
6744                                external_jQuery_default().each(dataTransfer.types, function (idx, type) {
6745                                    // skip moz-specific types
6746                                    if (type.toLowerCase().indexOf('_moz_') > -1) {
6747                                        return;
6748                                    }
6749
6750                                    var content = dataTransfer.getData(type);
6751
6752                                    if (type.toLowerCase().indexOf('text') > -1) {
6753                                        _this.context.invoke('editor.pasteHTML', content);
6754                                    } else {
6755                                        external_jQuery_default()(content).each(function (idx, item) {
6756                                            _this.context.invoke('editor.insertNode', item);
6757                                        });
6758                                    }
6759                                });
6760                            }
6761                        }).on('dragover', false); // prevent default dragover event
6762                    }
6763                }, {
6764                    key: "destroy",
6765                    value: function destroy() {
6766                        var _this2 = this;
6767
6768                        Object.keys(this.documentEventHandlers).forEach(function (key) {
6769                            _this2.$eventListener.off(key.substr(2).toLowerCase(), _this2.documentEventHandlers[key]);
6770                        });
6771                        this.documentEventHandlers = {};
6772                    }
6773                }]);
6774
6775                return Dropzone;
6776            }();
6777
6778
6779            ;// CONCATENATED MODULE: ./src/js/module/Codeview.js
6780            function _createForOfIteratorHelper(o, allowArrayLike) {
6781                var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
6782                if (!it) {
6783                    if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
6784                        if (it) o = it;
6785                        var i = 0;
6786                        var F = function F() {
6787                        };
6788                        return {
6789                            s: F, n: function n() {
6790                                if (i >= o.length) return {done: true};
6791                                return {done: false, value: o[i++]};
6792                            }, e: function e(_e) {
6793                                throw _e;
6794                            }, f: F
6795                        };
6796                    }
6797                    throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
6798                }
6799                var normalCompletion = true, didErr = false, err;
6800                return {
6801                    s: function s() {
6802                        it = it.call(o);
6803                    }, n: function n() {
6804                        var step = it.next();
6805                        normalCompletion = step.done;
6806                        return step;
6807                    }, e: function e(_e2) {
6808                        didErr = true;
6809                        err = _e2;
6810                    }, f: function f() {
6811                        try {
6812                            if (!normalCompletion && it["return"] != null) it["return"]();
6813                        } finally {
6814                            if (didErr) throw err;
6815                        }
6816                    }
6817                };
6818            }
6819
6820            function _unsupportedIterableToArray(o, minLen) {
6821                if (!o) return;
6822                if (typeof o === "string") return _arrayLikeToArray(o, minLen);
6823                var n = Object.prototype.toString.call(o).slice(8, -1);
6824                if (n === "Object" && o.constructor) n = o.constructor.name;
6825                if (n === "Map" || n === "Set") return Array.from(o);
6826                if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
6827            }
6828
6829            function _arrayLikeToArray(arr, len) {
6830                if (len == null || len > arr.length) len = arr.length;
6831                for (var i = 0, arr2 = new Array(len); i < len; i++) {
6832                    arr2[i] = arr[i];
6833                }
6834                return arr2;
6835            }
6836
6837            function Codeview_classCallCheck(instance, Constructor) {
6838                if (!(instance instanceof Constructor)) {
6839                    throw new TypeError("Cannot call a class as a function");
6840                }
6841            }
6842
6843            function Codeview_defineProperties(target, props) {
6844                for (var i = 0; i < props.length; i++) {
6845                    var descriptor = props[i];
6846                    descriptor.enumerable = descriptor.enumerable || false;
6847                    descriptor.configurable = true;
6848                    if ("value" in descriptor) descriptor.writable = true;
6849                    Object.defineProperty(target, descriptor.key, descriptor);
6850                }
6851            }
6852
6853            function Codeview_createClass(Constructor, protoProps, staticProps) {
6854                if (protoProps) Codeview_defineProperties(Constructor.prototype, protoProps);
6855                if (staticProps) Codeview_defineProperties(Constructor, staticProps);
6856                return Constructor;
6857            }
6858
6859
6860            /**
6861             * @class Codeview
6862             */
6863
6864            var CodeView = /*#__PURE__*/function () {
6865                function CodeView(context) {
6866                    Codeview_classCallCheck(this, CodeView);
6867
6868                    this.context = context;
6869                    this.$editor = context.layoutInfo.editor;
6870                    this.$editable = context.layoutInfo.editable;
6871                    this.$codable = context.layoutInfo.codable;
6872                    this.options = context.options;
6873                    this.CodeMirrorConstructor = window.CodeMirror;
6874
6875                    if (this.options.codemirror.CodeMirrorConstructor) {
6876                        this.CodeMirrorConstructor = this.options.codemirror.CodeMirrorConstructor;
6877                    }
6878                }
6879
6880                Codeview_createClass(CodeView, [{
6881                    key: "sync",
6882                    value: function sync(html) {
6883                        var isCodeview = this.isActivated();
6884                        var CodeMirror = this.CodeMirrorConstructor;
6885
6886                        if (isCodeview) {
6887                            if (html) {
6888                                if (CodeMirror) {
6889                                    this.$codable.data('cmEditor').getDoc().setValue(html);
6890                                } else {
6891                                    this.$codable.val(html);
6892                                }
6893                            } else {
6894                                if (CodeMirror) {
6895                                    this.$codable.data('cmEditor').save();
6896                                }
6897                            }
6898                        }
6899                    }
6900                }, {
6901                    key: "initialize",
6902                    value: function initialize() {
6903                        var _this = this;
6904
6905                        this.$codable.on('keyup', function (event) {
6906                            if (event.keyCode === key.code.ESCAPE) {
6907                                _this.deactivate();
6908                            }
6909                        });
6910                    }
6911                    /**
6912                     * @return {Boolean}
6913                     */
6914
6915                }, {
6916                    key: "isActivated",
6917                    value: function isActivated() {
6918                        return this.$editor.hasClass('codeview');
6919                    }
6920                    /**
6921                     * toggle codeview
6922                     */
6923
6924                }, {
6925                    key: "toggle",
6926                    value: function toggle() {
6927                        if (this.isActivated()) {
6928                            this.deactivate();
6929                        } else {
6930                            this.activate();
6931                        }
6932
6933                        this.context.triggerEvent('codeview.toggled');
6934                    }
6935                    /**
6936                     * purify input value
6937                     * @param value
6938                     * @returns {*}
6939                     */
6940
6941                }, {
6942                    key: "purify",
6943                    value: function purify(value) {
6944                        if (this.options.codeviewFilter) {
6945                            // filter code view regex
6946                            value = value.replace(this.options.codeviewFilterRegex, ''); // allow specific iframe tag
6947
6948                            if (this.options.codeviewIframeFilter) {
6949                                var whitelist = this.options.codeviewIframeWhitelistSrc.concat(this.options.codeviewIframeWhitelistSrcBase);
6950                                value = value.replace(/(<iframe.*?>.*?(?:<\/iframe>)?)/gi, function (tag) {
6951                                    // remove if src attribute is duplicated
6952                                    if (/<.+src(?==?('|"|\s)?)[\s\S]+src(?=('|"|\s)?)[^>]*?>/i.test(tag)) {
6953                                        return '';
6954                                    }
6955
6956                                    var _iterator = _createForOfIteratorHelper(whitelist),
6957                                        _step;
6958
6959                                    try {
6960                                        for (_iterator.s(); !(_step = _iterator.n()).done;) {
6961                                            var src = _step.value;
6962
6963                                            // pass if src is trusted
6964                                            if (new RegExp('src="(https?:)?\/\/' + src.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + '\/(.+)"').test(tag)) {
6965                                                return tag;
6966                                            }
6967                                        }
6968                                    } catch (err) {
6969                                        _iterator.e(err);
6970                                    } finally {
6971                                        _iterator.f();
6972                                    }
6973
6974                                    return '';
6975                                });
6976                            }
6977                        }
6978
6979                        return value;
6980                    }
6981                    /**
6982                     * activate code view
6983                     */
6984
6985                }, {
6986                    key: "activate",
6987                    value: function activate() {
6988                        var _this2 = this;
6989
6990                        var CodeMirror = this.CodeMirrorConstructor;
6991                        this.$codable.val(dom.html(this.$editable, this.options.prettifyHtml));
6992                        this.$codable.height(this.$editable.height());
6993                        this.context.invoke('toolbar.updateCodeview', true);
6994                        this.context.invoke('airPopover.updateCodeview', true);
6995                        this.$editor.addClass('codeview');
6996                        this.$codable.focus(); // activate CodeMirror as codable
6997
6998                        if (CodeMirror) {
6999                            var cmEditor = CodeMirror.fromTextArea(this.$codable[0], this.options.codemirror); // CodeMirror TernServer
7000
7001                            if (this.options.codemirror.tern) {
7002                                var server = new CodeMirror.TernServer(this.options.codemirror.tern);
7003                                cmEditor.ternServer = server;
7004                                cmEditor.on('cursorActivity', function (cm) {
7005                                    server.updateArgHints(cm);
7006                                });
7007                            }
7008
7009                            cmEditor.on('blur', function (event) {
7010                                _this2.context.triggerEvent('blur.codeview', cmEditor.getValue(), event);
7011                            });
7012                            cmEditor.on('change', function () {
7013                                _this2.context.triggerEvent('change.codeview', cmEditor.getValue(), cmEditor);
7014                            }); // CodeMirror hasn't Padding.
7015
7016                            cmEditor.setSize(null, this.$editable.outerHeight());
7017                            this.$codable.data('cmEditor', cmEditor);
7018                        } else {
7019                            this.$codable.on('blur', function (event) {
7020                                _this2.context.triggerEvent('blur.codeview', _this2.$codable.val(), event);
7021                            });
7022                            this.$codable.on('input', function () {
7023                                _this2.context.triggerEvent('change.codeview', _this2.$codable.val(), _this2.$codable);
7024                            });
7025                        }
7026                    }
7027                    /**
7028                     * deactivate code view
7029                     */
7030
7031                }, {
7032                    key: "deactivate",
7033                    value: function deactivate() {
7034                        var CodeMirror = this.CodeMirrorConstructor; // deactivate CodeMirror as codable
7035
7036                        if (CodeMirror) {
7037                            var cmEditor = this.$codable.data('cmEditor');
7038                            this.$codable.val(cmEditor.getValue());
7039                            cmEditor.toTextArea();
7040                        }
7041
7042                        var value = this.purify(dom.value(this.$codable, this.options.prettifyHtml) || dom.emptyPara);
7043                        var isChange = this.$editable.html() !== value;
7044                        this.$editable.html(value);
7045                        this.$editable.height(this.options.height ? this.$codable.height() : 'auto');
7046                        this.$editor.removeClass('codeview');
7047
7048                        if (isChange) {
7049                            this.context.triggerEvent('change', this.$editable.html(), this.$editable);
7050                        }
7051
7052                        this.$editable.focus();
7053                        this.context.invoke('toolbar.updateCodeview', false);
7054                        this.context.invoke('airPopover.updateCodeview', false);
7055                    }
7056                }, {
7057                    key: "destroy",
7058                    value: function destroy() {
7059                        if (this.isActivated()) {
7060                            this.deactivate();
7061                        }
7062                    }
7063                }]);
7064
7065                return CodeView;
7066            }();
7067
7068
7069            ;// CONCATENATED MODULE: ./src/js/module/Statusbar.js
7070            function Statusbar_classCallCheck(instance, Constructor) {
7071                if (!(instance instanceof Constructor)) {
7072                    throw new TypeError("Cannot call a class as a function");
7073                }
7074            }
7075
7076            function Statusbar_defineProperties(target, props) {
7077                for (var i = 0; i < props.length; i++) {
7078                    var descriptor = props[i];
7079                    descriptor.enumerable = descriptor.enumerable || false;
7080                    descriptor.configurable = true;
7081                    if ("value" in descriptor) descriptor.writable = true;
7082                    Object.defineProperty(target, descriptor.key, descriptor);
7083                }
7084            }
7085
7086            function Statusbar_createClass(Constructor, protoProps, staticProps) {
7087                if (protoProps) Statusbar_defineProperties(Constructor.prototype, protoProps);
7088                if (staticProps) Statusbar_defineProperties(Constructor, staticProps);
7089                return Constructor;
7090            }
7091
7092
7093            var EDITABLE_PADDING = 24;
7094
7095            var Statusbar = /*#__PURE__*/function () {
7096                function Statusbar(context) {
7097                    Statusbar_classCallCheck(this, Statusbar);
7098
7099                    this.$document = external_jQuery_default()(document);
7100                    this.$statusbar = context.layoutInfo.statusbar;
7101                    this.$editable = context.layoutInfo.editable;
7102                    this.$codable = context.layoutInfo.codable;
7103                    this.options = context.options;
7104                }
7105
7106                Statusbar_createClass(Statusbar, [{
7107                    key: "initialize",
7108                    value: function initialize() {
7109                        var _this = this;
7110
7111                        if (this.options.airMode || this.options.disableResizeEditor) {
7112                            this.destroy();
7113                            return;
7114                        }
7115
7116                        this.$statusbar.on('mousedown', function (event) {
7117                            event.preventDefault();
7118                            event.stopPropagation();
7119
7120                            var editableTop = _this.$editable.offset().top - _this.$document.scrollTop();
7121
7122                            var editableCodeTop = _this.$codable.offset().top - _this.$document.scrollTop();
7123
7124                            var onMouseMove = function onMouseMove(event) {
7125                                var height = event.clientY - (editableTop + EDITABLE_PADDING);
7126                                var heightCode = event.clientY - (editableCodeTop + EDITABLE_PADDING);
7127                                height = _this.options.minheight > 0 ? Math.max(height, _this.options.minheight) : height;
7128                                height = _this.options.maxHeight > 0 ? Math.min(height, _this.options.maxHeight) : height;
7129                                heightCode = _this.options.minheight > 0 ? Math.max(heightCode, _this.options.minheight) : heightCode;
7130                                heightCode = _this.options.maxHeight > 0 ? Math.min(heightCode, _this.options.maxHeight) : heightCode;
7131
7132                                _this.$editable.height(height);
7133
7134                                _this.$codable.height(heightCode);
7135                            };
7136
7137                            _this.$document.on('mousemove', onMouseMove).one('mouseup', function () {
7138                                _this.$document.off('mousemove', onMouseMove);
7139                            });
7140                        });
7141                    }
7142                }, {
7143                    key: "destroy",
7144                    value: function destroy() {
7145                        this.$statusbar.off();
7146                        this.$statusbar.addClass('locked');
7147                    }
7148                }]);
7149
7150                return Statusbar;
7151            }();
7152
7153
7154            ;// CONCATENATED MODULE: ./src/js/module/Fullscreen.js
7155            function Fullscreen_classCallCheck(instance, Constructor) {
7156                if (!(instance instanceof Constructor)) {
7157                    throw new TypeError("Cannot call a class as a function");
7158                }
7159            }
7160
7161            function Fullscreen_defineProperties(target, props) {
7162                for (var i = 0; i < props.length; i++) {
7163                    var descriptor = props[i];
7164                    descriptor.enumerable = descriptor.enumerable || false;
7165                    descriptor.configurable = true;
7166                    if ("value" in descriptor) descriptor.writable = true;
7167                    Object.defineProperty(target, descriptor.key, descriptor);
7168                }
7169            }
7170
7171            function Fullscreen_createClass(Constructor, protoProps, staticProps) {
7172                if (protoProps) Fullscreen_defineProperties(Constructor.prototype, protoProps);
7173                if (staticProps) Fullscreen_defineProperties(Constructor, staticProps);
7174                return Constructor;
7175            }
7176
7177
7178            var Fullscreen = /*#__PURE__*/function () {
7179                function Fullscreen(context) {
7180                    var _this = this;
7181
7182                    Fullscreen_classCallCheck(this, Fullscreen);
7183
7184                    this.context = context;
7185                    this.$editor = context.layoutInfo.editor;
7186                    this.$toolbar = context.layoutInfo.toolbar;
7187                    this.$editable = context.layoutInfo.editable;
7188                    this.$codable = context.layoutInfo.codable;
7189                    this.$window = external_jQuery_default()(window);
7190                    this.$scrollbar = external_jQuery_default()('html, body');
7191                    this.scrollbarClassName = 'note-fullscreen-body';
7192
7193                    this.onResize = function () {
7194                        _this.resizeTo({
7195                            h: _this.$window.height() - _this.$toolbar.outerHeight()
7196                        });
7197                    };
7198                }
7199
7200                Fullscreen_createClass(Fullscreen, [{
7201                    key: "resizeTo",
7202                    value: function resizeTo(size) {
7203                        this.$editable.css('height', size.h);
7204                        this.$codable.css('height', size.h);
7205
7206                        if (this.$codable.data('cmeditor')) {
7207                            this.$codable.data('cmeditor').setsize(null, size.h);
7208                        }
7209                    }
7210                    /**
7211                     * toggle fullscreen
7212                     */
7213
7214                }, {
7215                    key: "toggle",
7216                    value: function toggle() {
7217                        this.$editor.toggleClass('fullscreen');
7218                        var isFullscreen = this.isFullscreen();
7219                        this.$scrollbar.toggleClass(this.scrollbarClassName, isFullscreen);
7220
7221                        if (isFullscreen) {
7222                            this.$editable.data('orgHeight', this.$editable.css('height'));
7223                            this.$editable.data('orgMaxHeight', this.$editable.css('maxHeight'));
7224                            this.$editable.css('maxHeight', '');
7225                            this.$window.on('resize', this.onResize).trigger('resize');
7226                        } else {
7227                            this.$window.off('resize', this.onResize);
7228                            this.resizeTo({
7229                                h: this.$editable.data('orgHeight')
7230                            });
7231                            this.$editable.css('maxHeight', this.$editable.css('orgMaxHeight'));
7232                        }
7233
7234                        this.context.invoke('toolbar.updateFullscreen', isFullscreen);
7235                    }
7236                }, {
7237                    key: "isFullscreen",
7238                    value: function isFullscreen() {
7239                        return this.$editor.hasClass('fullscreen');
7240                    }
7241                }, {
7242                    key: "destroy",
7243                    value: function destroy() {
7244                        this.$scrollbar.removeClass(this.scrollbarClassName);
7245                    }
7246                }]);
7247
7248                return Fullscreen;
7249            }();
7250
7251
7252            ;// CONCATENATED MODULE: ./src/js/module/Handle.js
7253            function Handle_classCallCheck(instance, Constructor) {
7254                if (!(instance instanceof Constructor)) {
7255                    throw new TypeError("Cannot call a class as a function");
7256                }
7257            }
7258
7259            function Handle_defineProperties(target, props) {
7260                for (var i = 0; i < props.length; i++) {
7261                    var descriptor = props[i];
7262                    descriptor.enumerable = descriptor.enumerable || false;
7263                    descriptor.configurable = true;
7264                    if ("value" in descriptor) descriptor.writable = true;
7265                    Object.defineProperty(target, descriptor.key, descriptor);
7266                }
7267            }
7268
7269            function Handle_createClass(Constructor, protoProps, staticProps) {
7270                if (protoProps) Handle_defineProperties(Constructor.prototype, protoProps);
7271                if (staticProps) Handle_defineProperties(Constructor, staticProps);
7272                return Constructor;
7273            }
7274
7275
7276            var Handle = /*#__PURE__*/function () {
7277                function Handle(context) {
7278                    var _this = this;
7279
7280                    Handle_classCallCheck(this, Handle);
7281
7282                    this.context = context;
7283                    this.$document = external_jQuery_default()(document);
7284                    this.$editingArea = context.layoutInfo.editingArea;
7285                    this.options = context.options;
7286                    this.lang = this.options.langInfo;
7287                    this.events = {
7288                        'summernote.mousedown': function summernoteMousedown(we, e) {
7289                            if (_this.update(e.target, e)) {
7290                                e.preventDefault();
7291                            }
7292                        },
7293                        'summernote.keyup summernote.scroll summernote.change summernote.dialog.shown': function summernoteKeyupSummernoteScrollSummernoteChangeSummernoteDialogShown() {
7294                            _this.update();
7295                        },
7296                        'summernote.disable summernote.blur': function summernoteDisableSummernoteBlur() {
7297                            _this.hide();
7298                        },
7299                        'summernote.codeview.toggled': function summernoteCodeviewToggled() {
7300                            _this.update();
7301                        }
7302                    };
7303                }
7304
7305                Handle_createClass(Handle, [{
7306                    key: "initialize",
7307                    value: function initialize() {
7308                        var _this2 = this;
7309
7310                        this.$handle = external_jQuery_default()(['<div class="note-handle">', '<div class="note-control-selection">', '<div class="note-control-selection-bg"></div>', '<div class="note-control-holder note-control-nw"></div>', '<div class="note-control-holder note-control-ne"></div>', '<div class="note-control-holder note-control-sw"></div>', '<div class="', this.options.disableResizeImage ? 'note-control-holder' : 'note-control-sizing', ' note-control-se"></div>', this.options.disableResizeImage ? '' : '<div class="note-control-selection-info"></div>', '</div>', '</div>'].join('')).prependTo(this.$editingArea);
7311                        this.$handle.on('mousedown', function (event) {
7312                            if (dom.isControlSizing(event.target)) {
7313                                event.preventDefault();
7314                                event.stopPropagation();
7315
7316                                var $target = _this2.$handle.find('.note-control-selection').data('target');
7317
7318                                var posStart = $target.offset();
7319
7320                                var scrollTop = _this2.$document.scrollTop();
7321
7322                                var onMouseMove = function onMouseMove(event) {
7323                                    _this2.context.invoke('editor.resizeTo', {
7324                                        x: event.clientX - posStart.left,
7325                                        y: event.clientY - (posStart.top - scrollTop)
7326                                    }, $target, !event.shiftKey);
7327
7328                                    _this2.update($target[0], event);
7329                                };
7330
7331                                _this2.$document.on('mousemove', onMouseMove).one('mouseup', function (e) {
7332                                    e.preventDefault();
7333
7334                                    _this2.$document.off('mousemove', onMouseMove);
7335
7336                                    _this2.context.invoke('editor.afterCommand');
7337                                });
7338
7339                                if (!$target.data('ratio')) {
7340                                    // original ratio.
7341                                    $target.data('ratio', $target.height() / $target.width());
7342                                }
7343                            }
7344                        }); // Listen for scrolling on the handle overlay.
7345
7346                        this.$handle.on('wheel', function (e) {
7347                            e.preventDefault();
7348
7349                            _this2.update();
7350                        });
7351                    }
7352                }, {
7353                    key: "destroy",
7354                    value: function destroy() {
7355                        this.$handle.remove();
7356                    }
7357                }, {
7358                    key: "update",
7359                    value: function update(target, event) {
7360                        if (this.context.isDisabled()) {
7361                            return false;
7362                        }
7363
7364                        var isImage = dom.isImg(target);
7365                        var $selection = this.$handle.find('.note-control-selection');
7366                        this.context.invoke('imagePopover.update', target, event);
7367
7368                        if (isImage) {
7369                            var $image = external_jQuery_default()(target);
7370                            var position = $image.position();
7371                            var pos = {
7372                                left: position.left + parseInt($image.css('marginLeft'), 10),
7373                                top: position.top + parseInt($image.css('marginTop'), 10)
7374                            }; // exclude margin
7375
7376                            var imageSize = {
7377                                w: $image.outerWidth(false),
7378                                h: $image.outerHeight(false)
7379                            };
7380                            $selection.css({
7381                                display: 'block',
7382                                left: pos.left,
7383                                top: pos.top,
7384                                width: imageSize.w,
7385                                height: imageSize.h
7386                            }).data('target', $image); // save current image element.
7387
7388                            var origImageObj = new Image();
7389                            origImageObj.src = $image.attr('src');
7390                            var sizingText = imageSize.w + 'x' + imageSize.h + ' (' + this.lang.image.original + ': ' + origImageObj.width + 'x' + origImageObj.height + ')';
7391                            $selection.find('.note-control-selection-info').text(sizingText);
7392                            this.context.invoke('editor.saveTarget', target);
7393                        } else {
7394                            this.hide();
7395                        }
7396
7397                        return isImage;
7398                    }
7399                    /**
7400                     * hide
7401                     *
7402                     * @param {jQuery} $handle
7403                     */
7404
7405                }, {
7406                    key: "hide",
7407                    value: function hide() {
7408                        this.context.invoke('editor.clearTarget');
7409                        this.$handle.children().hide();
7410                    }
7411                }]);
7412
7413                return Handle;
7414            }();
7415
7416
7417            ;// CONCATENATED MODULE: ./src/js/module/AutoLink.js
7418            function AutoLink_classCallCheck(instance, Constructor) {
7419                if (!(instance instanceof Constructor)) {
7420                    throw new TypeError("Cannot call a class as a function");
7421                }
7422            }
7423
7424            function AutoLink_defineProperties(target, props) {
7425                for (var i = 0; i < props.length; i++) {
7426                    var descriptor = props[i];
7427                    descriptor.enumerable = descriptor.enumerable || false;
7428                    descriptor.configurable = true;
7429                    if ("value" in descriptor) descriptor.writable = true;
7430                    Object.defineProperty(target, descriptor.key, descriptor);
7431                }
7432            }
7433
7434            function AutoLink_createClass(Constructor, protoProps, staticProps) {
7435                if (protoProps) AutoLink_defineProperties(Constructor.prototype, protoProps);
7436                if (staticProps) AutoLink_defineProperties(Constructor, staticProps);
7437                return Constructor;
7438            }
7439
7440
7441            var defaultScheme = 'http://';
7442            var linkPattern = /^([A-Za-z][A-Za-z0-9+-.]*\:[\/]{2}|tel:|mailto:[A-Z0-9._%+-]+@|xmpp:[A-Z0-9._%+-]+@)?(www\.)?(.+)$/i;
7443
7444            var AutoLink = /*#__PURE__*/function () {
7445                function AutoLink(context) {
7446                    var _this = this;
7447
7448                    AutoLink_classCallCheck(this, AutoLink);
7449
7450                    this.context = context;
7451                    this.options = context.options;
7452                    this.events = {
7453                        'summernote.keyup': function summernoteKeyup(we, e) {
7454                            if (!e.isDefaultPrevented()) {
7455                                _this.handleKeyup(e);
7456                            }
7457                        },
7458                        'summernote.keydown': function summernoteKeydown(we, e) {
7459                            _this.handleKeydown(e);
7460                        }
7461                    };
7462                }
7463
7464                AutoLink_createClass(AutoLink, [{
7465                    key: "initialize",
7466                    value: function initialize() {
7467                        this.lastWordRange = null;
7468                    }
7469                }, {
7470                    key: "destroy",
7471                    value: function destroy() {
7472                        this.lastWordRange = null;
7473                    }
7474                }, {
7475                    key: "replace",
7476                    value: function replace() {
7477                        if (!this.lastWordRange) {
7478                            return;
7479                        }
7480
7481                        var keyword = this.lastWordRange.toString();
7482                        var match = keyword.match(linkPattern);
7483
7484                        if (match && (match[1] || match[2])) {
7485                            var link = match[1] ? keyword : defaultScheme + keyword;
7486                            var urlText = this.options.showDomainOnlyForAutolink ? keyword.replace(/^(?:https?:\/\/)?(?:tel?:?)?(?:mailto?:?)?(?:xmpp?:?)?(?:www\.)?/i, '').split('/')[0] : keyword;
7487                            var node = external_jQuery_default()('<a></a>').html(urlText).attr('href', link)[0];
7488
7489                            if (this.context.options.linkTargetBlank) {
7490                                external_jQuery_default()(node).attr('target', '_blank');
7491                            }
7492
7493                            this.lastWordRange.insertNode(node);
7494                            this.lastWordRange = null;
7495                            this.context.invoke('editor.focus');
7496                        }
7497                    }
7498                }, {
7499                    key: "handleKeydown",
7500                    value: function handleKeydown(e) {
7501                        if (lists.contains([key.code.ENTER, key.code.SPACE], e.keyCode)) {
7502                            var wordRange = this.context.invoke('editor.createRange').getWordRange();
7503                            this.lastWordRange = wordRange;
7504                        }
7505                    }
7506                }, {
7507                    key: "handleKeyup",
7508                    value: function handleKeyup(e) {
7509                        if (lists.contains([key.code.ENTER, key.code.SPACE], e.keyCode)) {
7510                            this.replace();
7511                        }
7512                    }
7513                }]);
7514
7515                return AutoLink;
7516            }();
7517
7518
7519            ;// CONCATENATED MODULE: ./src/js/module/AutoSync.js
7520            function AutoSync_classCallCheck(instance, Constructor) {
7521                if (!(instance instanceof Constructor)) {
7522                    throw new TypeError("Cannot call a class as a function");
7523                }
7524            }
7525
7526            function AutoSync_defineProperties(target, props) {
7527                for (var i = 0; i < props.length; i++) {
7528                    var descriptor = props[i];
7529                    descriptor.enumerable = descriptor.enumerable || false;
7530                    descriptor.configurable = true;
7531                    if ("value" in descriptor) descriptor.writable = true;
7532                    Object.defineProperty(target, descriptor.key, descriptor);
7533                }
7534            }
7535
7536            function AutoSync_createClass(Constructor, protoProps, staticProps) {
7537                if (protoProps) AutoSync_defineProperties(Constructor.prototype, protoProps);
7538                if (staticProps) AutoSync_defineProperties(Constructor, staticProps);
7539                return Constructor;
7540            }
7541
7542
7543            /**
7544             * textarea auto sync.
7545             */
7546
7547            var AutoSync = /*#__PURE__*/function () {
7548                function AutoSync(context) {
7549                    var _this = this;
7550
7551                    AutoSync_classCallCheck(this, AutoSync);
7552
7553                    this.$note = context.layoutInfo.note;
7554                    this.events = {
7555                        'summernote.change': function summernoteChange() {
7556                            _this.$note.val(context.invoke('code'));
7557                        }
7558                    };
7559                }
7560
7561                AutoSync_createClass(AutoSync, [{
7562                    key: "shouldInitialize",
7563                    value: function shouldInitialize() {
7564                        return dom.isTextarea(this.$note[0]);
7565                    }
7566                }]);
7567
7568                return AutoSync;
7569            }();
7570
7571
7572            ;// CONCATENATED MODULE: ./src/js/module/AutoReplace.js
7573            function AutoReplace_classCallCheck(instance, Constructor) {
7574                if (!(instance instanceof Constructor)) {
7575                    throw new TypeError("Cannot call a class as a function");
7576                }
7577            }
7578
7579            function AutoReplace_defineProperties(target, props) {
7580                for (var i = 0; i < props.length; i++) {
7581                    var descriptor = props[i];
7582                    descriptor.enumerable = descriptor.enumerable || false;
7583                    descriptor.configurable = true;
7584                    if ("value" in descriptor) descriptor.writable = true;
7585                    Object.defineProperty(target, descriptor.key, descriptor);
7586                }
7587            }
7588
7589            function AutoReplace_createClass(Constructor, protoProps, staticProps) {
7590                if (protoProps) AutoReplace_defineProperties(Constructor.prototype, protoProps);
7591                if (staticProps) AutoReplace_defineProperties(Constructor, staticProps);
7592                return Constructor;
7593            }
7594
7595
7596            var AutoReplace = /*#__PURE__*/function () {
7597                function AutoReplace(context) {
7598                    var _this = this;
7599
7600                    AutoReplace_classCallCheck(this, AutoReplace);
7601
7602                    this.context = context;
7603                    this.options = context.options.replace || {};
7604                    this.keys = [key.code.ENTER, key.code.SPACE, key.code.PERIOD, key.code.COMMA, key.code.SEMICOLON, key.code.SLASH];
7605                    this.previousKeydownCode = null;
7606                    this.events = {
7607                        'summernote.keyup': function summernoteKeyup(we, e) {
7608                            if (!e.isDefaultPrevented()) {
7609                                _this.handleKeyup(e);
7610                            }
7611                        },
7612                        'summernote.keydown': function summernoteKeydown(we, e) {
7613                            _this.handleKeydown(e);
7614                        }
7615                    };
7616                }
7617
7618                AutoReplace_createClass(AutoReplace, [{
7619                    key: "shouldInitialize",
7620                    value: function shouldInitialize() {
7621                        return !!this.options.match;
7622                    }
7623                }, {
7624                    key: "initialize",
7625                    value: function initialize() {
7626                        this.lastWord = null;
7627                    }
7628                }, {
7629                    key: "destroy",
7630                    value: function destroy() {
7631                        this.lastWord = null;
7632                    }
7633                }, {
7634                    key: "replace",
7635                    value: function replace() {
7636                        if (!this.lastWord) {
7637                            return;
7638                        }
7639
7640                        var self = this;
7641                        var keyword = this.lastWord.toString();
7642                        this.options.match(keyword, function (match) {
7643                            if (match) {
7644                                var node = '';
7645
7646                                if (typeof match === 'string') {
7647                                    node = dom.createText(match);
7648                                } else if (match instanceof jQuery) {
7649                                    node = match[0];
7650                                } else if (match instanceof Node) {
7651                                    node = match;
7652                                }
7653
7654                                if (!node) return;
7655                                self.lastWord.insertNode(node);
7656                                self.lastWord = null;
7657                                self.context.invoke('editor.focus');
7658                            }
7659                        });
7660                    }
7661                }, {
7662                    key: "handleKeydown",
7663                    value: function handleKeydown(e) {
7664                        // this forces it to remember the last whole word, even if multiple termination keys are pressed
7665                        // before the previous key is let go.
7666                        if (this.previousKeydownCode && lists.contains(this.keys, this.previousKeydownCode)) {
7667                            this.previousKeydownCode = e.keyCode;
7668                            return;
7669                        }
7670
7671                        if (lists.contains(this.keys, e.keyCode)) {
7672                            var wordRange = this.context.invoke('editor.createRange').getWordRange();
7673                            this.lastWord = wordRange;
7674                        }
7675
7676                        this.previousKeydownCode = e.keyCode;
7677                    }
7678                }, {
7679                    key: "handleKeyup",
7680                    value: function handleKeyup(e) {
7681                        if (lists.contains(this.keys, e.keyCode)) {
7682                            this.replace();
7683                        }
7684                    }
7685                }]);
7686
7687                return AutoReplace;
7688            }();
7689
7690
7691            ;// CONCATENATED MODULE: ./src/js/module/Placeholder.js
7692            function Placeholder_classCallCheck(instance, Constructor) {
7693                if (!(instance instanceof Constructor)) {
7694                    throw new TypeError("Cannot call a class as a function");
7695                }
7696            }
7697
7698            function Placeholder_defineProperties(target, props) {
7699                for (var i = 0; i < props.length; i++) {
7700                    var descriptor = props[i];
7701                    descriptor.enumerable = descriptor.enumerable || false;
7702                    descriptor.configurable = true;
7703                    if ("value" in descriptor) descriptor.writable = true;
7704                    Object.defineProperty(target, descriptor.key, descriptor);
7705                }
7706            }
7707
7708            function Placeholder_createClass(Constructor, protoProps, staticProps) {
7709                if (protoProps) Placeholder_defineProperties(Constructor.prototype, protoProps);
7710                if (staticProps) Placeholder_defineProperties(Constructor, staticProps);
7711                return Constructor;
7712            }
7713
7714
7715            var Placeholder = /*#__PURE__*/function () {
7716                function Placeholder(context) {
7717                    var _this = this;
7718
7719                    Placeholder_classCallCheck(this, Placeholder);
7720
7721                    this.context = context;
7722                    this.$editingArea = context.layoutInfo.editingArea;
7723                    this.options = context.options;
7724
7725                    if (this.options.inheritPlaceholder === true) {
7726                        // get placeholder value from the original element
7727                        this.options.placeholder = this.context.$note.attr('placeholder') || this.options.placeholder;
7728                    }
7729
7730                    this.events = {
7731                        'summernote.init summernote.change': function summernoteInitSummernoteChange() {
7732                            _this.update();
7733                        },
7734                        'summernote.codeview.toggled': function summernoteCodeviewToggled() {
7735                            _this.update();
7736                        }
7737                    };
7738                }
7739
7740                Placeholder_createClass(Placeholder, [{
7741                    key: "shouldInitialize",
7742                    value: function shouldInitialize() {
7743                        return !!this.options.placeholder;
7744                    }
7745                }, {
7746                    key: "initialize",
7747                    value: function initialize() {
7748                        var _this2 = this;
7749
7750                        this.$placeholder = external_jQuery_default()('<div class="note-placeholder"></div>');
7751                        this.$placeholder.on('click', function () {
7752                            _this2.context.invoke('focus');
7753                        }).html(this.options.placeholder).prependTo(this.$editingArea);
7754                        this.update();
7755                    }
7756                }, {
7757                    key: "destroy",
7758                    value: function destroy() {
7759                        this.$placeholder.remove();
7760                    }
7761                }, {
7762                    key: "update",
7763                    value: function update() {
7764                        var isShow = !this.context.invoke('codeview.isActivated') && this.context.invoke('editor.isEmpty');
7765                        this.$placeholder.toggle(isShow);
7766                    }
7767                }]);
7768
7769                return Placeholder;
7770            }();
7771
7772
7773            ;// CONCATENATED MODULE: ./src/js/module/Buttons.js
7774            function Buttons_classCallCheck(instance, Constructor) {
7775                if (!(instance instanceof Constructor)) {
7776                    throw new TypeError("Cannot call a class as a function");
7777                }
7778            }
7779
7780            function Buttons_defineProperties(target, props) {
7781                for (var i = 0; i < props.length; i++) {
7782                    var descriptor = props[i];
7783                    descriptor.enumerable = descriptor.enumerable || false;
7784                    descriptor.configurable = true;
7785                    if ("value" in descriptor) descriptor.writable = true;
7786                    Object.defineProperty(target, descriptor.key, descriptor);
7787                }
7788            }
7789
7790            function Buttons_createClass(Constructor, protoProps, staticProps) {
7791                if (protoProps) Buttons_defineProperties(Constructor.prototype, protoProps);
7792                if (staticProps) Buttons_defineProperties(Constructor, staticProps);
7793                return Constructor;
7794            }
7795
7796
7797            var Buttons = /*#__PURE__*/function () {
7798                function Buttons(context) {
7799                    Buttons_classCallCheck(this, Buttons);
7800
7801                    this.ui = (external_jQuery_default()).summernote.ui;
7802                    this.context = context;
7803                    this.$toolbar = context.layoutInfo.toolbar;
7804                    this.options = context.options;
7805                    this.lang = this.options.langInfo;
7806                    this.invertedKeyMap = func.invertObject(this.options.keyMap[env.isMac ? 'mac' : 'pc']);
7807                }
7808
7809                Buttons_createClass(Buttons, [{
7810                    key: "representShortcut",
7811                    value: function representShortcut(editorMethod) {
7812                        var shortcut = this.invertedKeyMap[editorMethod];
7813
7814                        if (!this.options.shortcuts || !shortcut) {
7815                            return '';
7816                        }
7817
7818                        if (env.isMac) {
7819                            shortcut = shortcut.replace('CMD', '⌘').replace('SHIFT', '⇧');
7820                        }
7821
7822                        shortcut = shortcut.replace('BACKSLASH', '\\').replace('SLASH', '/').replace('LEFTBRACKET', '[').replace('RIGHTBRACKET', ']');
7823                        return ' (' + shortcut + ')';
7824                    }
7825                }, {
7826                    key: "button",
7827                    value: function button(o) {
7828                        if (!this.options.tooltip && o.tooltip) {
7829                            delete o.tooltip;
7830                        }
7831
7832                        o.container = this.options.container;
7833                        return this.ui.button(o);
7834                    }
7835                }, {
7836                    key: "initialize",
7837                    value: function initialize() {
7838                        this.addToolbarButtons();
7839                        this.addImagePopoverButtons();
7840                        this.addLinkPopoverButtons();
7841                        this.addTablePopoverButtons();
7842                        this.fontInstalledMap = {};
7843                    }
7844                }, {
7845                    key: "destroy",
7846                    value: function destroy() {
7847                        delete this.fontInstalledMap;
7848                    }
7849                }, {
7850                    key: "isFontInstalled",
7851                    value: function isFontInstalled(name) {
7852                        if (!Object.prototype.hasOwnProperty.call(this.fontInstalledMap, name)) {
7853                            this.fontInstalledMap[name] = env.isFontInstalled(name) || lists.contains(this.options.fontNamesIgnoreCheck, name);
7854                        }
7855
7856                        return this.fontInstalledMap[name];
7857                    }
7858                }, {
7859                    key: "isFontDeservedToAdd",
7860                    value: function isFontDeservedToAdd(name) {
7861                        name = name.toLowerCase();
7862                        return name !== '' && this.isFontInstalled(name) && env.genericFontFamilies.indexOf(name) === -1;
7863                    }
7864                }, {
7865                    key: "colorPalette",
7866                    value: function colorPalette(className, tooltip, backColor, foreColor) {
7867                        var _this = this;
7868
7869                        return this.ui.buttonGroup({
7870                            className: 'note-color ' + className,
7871                            children: [this.button({
7872                                className: 'note-current-color-button',
7873                                contents: this.ui.icon(this.options.icons.font + ' note-recent-color'),
7874                                tooltip: tooltip,
7875                                click: function click(e) {
7876                                    var $button = external_jQuery_default()(e.currentTarget);
7877
7878                                    if (backColor && foreColor) {
7879                                        _this.context.invoke('editor.color', {
7880                                            backColor: $button.attr('data-backColor'),
7881                                            foreColor: $button.attr('data-foreColor')
7882                                        });
7883                                    } else if (backColor) {
7884                                        _this.context.invoke('editor.color', {
7885                                            backColor: $button.attr('data-backColor')
7886                                        });
7887                                    } else if (foreColor) {
7888                                        _this.context.invoke('editor.color', {
7889                                            foreColor: $button.attr('data-foreColor')
7890                                        });
7891                                    }
7892                                },
7893                                callback: function callback($button) {
7894                                    var $recentColor = $button.find('.note-recent-color');
7895
7896                                    if (backColor) {
7897                                        $recentColor.css('background-color', _this.options.colorButton.backColor);
7898                                        $button.attr('data-backColor', _this.options.colorButton.backColor);
7899                                    }
7900
7901                                    if (foreColor) {
7902                                        $recentColor.css('color', _this.options.colorButton.foreColor);
7903                                        $button.attr('data-foreColor', _this.options.colorButton.foreColor);
7904                                    } else {
7905                                        $recentColor.css('color', 'transparent');
7906                                    }
7907                                }
7908                            }), this.button({
7909                                className: 'dropdown-toggle',
7910                                contents: this.ui.dropdownButtonContents('', this.options),
7911                                tooltip: this.lang.color.more,
7912                                data: {
7913                                    toggle: 'dropdown'
7914                                }
7915                            }), this.ui.dropdown({
7916                                items: (backColor ? ['<div class="note-palette">', '<div class="note-palette-title">' + this.lang.color.background + '</div>', '<div>', '<button type="button" class="note-color-reset btn btn-light btn-default" data-event="backColor" data-value="transparent">', this.lang.color.transparent, '</button>', '</div>', '<div class="note-holder" data-event="backColor"><!-- back colors --></div>', '<div>', '<button type="button" class="note-color-select btn btn-light btn-default" data-event="openPalette" data-value="backColorPicker-' + this.options.id + '">', this.lang.color.cpSelect, '</button>', '<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 + '">', '</div>', '<div class="note-holder-custom" id="backColorPalette-' + this.options.id + '" data-event="backColor"></div>', '</div>'].join('') : '') + (foreColor ? ['<div class="note-palette">', '<div class="note-palette-title">' + this.lang.color.foreground + '</div>', '<div>', '<button type="button" class="note-color-reset btn btn-light btn-default" data-event="removeFormat" data-value="foreColor">', this.lang.color.resetToDefault, '</button>', '</div>', '<div class="note-holder" data-event="foreColor"><!-- fore colors --></div>', '<div>', '<button type="button" class="note-color-select btn btn-light btn-default" data-event="openPalette" data-value="foreColorPicker-' + this.options.id + '">', this.lang.color.cpSelect, '</button>', '<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 + '">', '</div>', // Fix missing Div, Commented to find easily if it's wrong
7917                                    '<div class="note-holder-custom" id="foreColorPalette-' + this.options.id + '" data-event="foreColor"></div>', '</div>'].join('') : ''),
7918                                callback: function callback($dropdown) {
7919                                    $dropdown.find('.note-holder').each(function (idx, item) {
7920                                        var $holder = external_jQuery_default()(item);
7921                                        $holder.append(_this.ui.palette({
7922                                            colors: _this.options.colors,
7923                                            colorsName: _this.options.colorsName,
7924                                            eventName: $holder.data('event'),
7925                                            container: _this.options.container,
7926                                            tooltip: _this.options.tooltip
7927                                        }).render());
7928                                    });
7929                                    /* TODO: do we have to record recent custom colors within cookies? */
7930
7931                                    var customColors = [['#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF', '#FFFFFF']];
7932                                    $dropdown.find('.note-holder-custom').each(function (idx, item) {
7933                                        var $holder = external_jQuery_default()(item);
7934                                        $holder.append(_this.ui.palette({
7935                                            colors: customColors,
7936                                            colorsName: customColors,
7937                                            eventName: $holder.data('event'),
7938                                            container: _this.options.container,
7939                                            tooltip: _this.options.tooltip
7940                                        }).render());
7941                                    });
7942                                    $dropdown.find('input[type=color]').each(function (idx, item) {
7943                                        external_jQuery_default()(item).change(function () {
7944                                            var $chip = $dropdown.find('#' + external_jQuery_default()(this).data('event')).find('.note-color-btn').first();
7945                                            var color = this.value.toUpperCase();
7946                                            $chip.css('background-color', color).attr('aria-label', color).attr('data-value', color).attr('data-original-title', color);
7947                                            $chip.click();
7948                                        });
7949                                    });
7950                                },
7951                                click: function click(event) {
7952                                    event.stopPropagation();
7953                                    var $parent = external_jQuery_default()('.' + className).find('.note-dropdown-menu');
7954                                    var $button = external_jQuery_default()(event.target);
7955                                    var eventName = $button.data('event');
7956                                    var value = $button.attr('data-value');
7957
7958                                    if (eventName === 'openPalette') {
7959                                        var $picker = $parent.find('#' + value);
7960                                        var $palette = external_jQuery_default()($parent.find('#' + $picker.data('event')).find('.note-color-row')[0]); // Shift palette chips
7961
7962                                        var $chip = $palette.find('.note-color-btn').last().detach(); // Set chip attributes
7963
7964                                        var color = $picker.val();
7965                                        $chip.css('background-color', color).attr('aria-label', color).attr('data-value', color).attr('data-original-title', color);
7966                                        $palette.prepend($chip);
7967                                        $picker.click();
7968                                    } else {
7969                                        if (lists.contains(['backColor', 'foreColor'], eventName)) {
7970                                            var key = eventName === 'backColor' ? 'background-color' : 'color';
7971                                            var $color = $button.closest('.note-color').find('.note-recent-color');
7972                                            var $currentButton = $button.closest('.note-color').find('.note-current-color-button');
7973                                            $color.css(key, value);
7974                                            $currentButton.attr('data-' + eventName, value);
7975                                        }
7976
7977                                        _this.context.invoke('editor.' + eventName, value);
7978                                    }
7979                                }
7980                            })]
7981                        }).render();
7982                    }
7983                }, {
7984                    key: "addToolbarButtons",
7985                    value: function addToolbarButtons() {
7986                        var _this2 = this;
7987
7988                        this.context.memo('button.style', function () {
7989                            return _this2.ui.buttonGroup([_this2.button({
7990                                className: 'dropdown-toggle',
7991                                contents: _this2.ui.dropdownButtonContents(_this2.ui.icon(_this2.options.icons.magic), _this2.options),
7992                                tooltip: _this2.lang.style.style,
7993                                data: {
7994                                    toggle: 'dropdown'
7995                                }
7996                            }), _this2.ui.dropdown({
7997                                className: 'dropdown-style',
7998                                items: _this2.options.styleTags,
7999                                title: _this2.lang.style.style,
8000                                template: function template(item) {
8001                                    // TBD: need to be simplified
8002                                    if (typeof item === 'string') {
8003                                        item = {
8004                                            tag: item,
8005                                            title: Object.prototype.hasOwnProperty.call(_this2.lang.style, item) ? _this2.lang.style[item] : item
8006                                        };
8007                                    }
8008
8009                                    var tag = item.tag;
8010                                    var title = item.title;
8011                                    var style = item.style ? ' style="' + item.style + '" ' : '';
8012                                    var className = item.className ? ' class="' + item.className + '"' : '';
8013                                    return '<' + tag + style + className + '>' + title + '</' + tag + '>';
8014                                },
8015                                click: _this2.context.createInvokeHandler('editor.formatBlock')
8016                            })]).render();
8017                        });
8018
8019                        var _loop = function _loop(styleIdx, styleLen) {
8020                            var item = _this2.options.styleTags[styleIdx];
8021
8022                            _this2.context.memo('button.style.' + item, function () {
8023                                return _this2.button({
8024                                    className: 'note-btn-style-' + item,
8025                                    contents: '<div data-value="' + item + '">' + item.toUpperCase() + '</div>',
8026                                    tooltip: _this2.lang.style[item],
8027                                    click: _this2.context.createInvokeHandler('editor.formatBlock')
8028                                }).render();
8029                            });
8030                        };
8031
8032                        for (var styleIdx = 0, styleLen = this.options.styleTags.length; styleIdx < styleLen; styleIdx++) {
8033                            _loop(styleIdx, styleLen);
8034                        }
8035
8036                        this.context.memo('button.bold', function () {
8037                            return _this2.button({
8038                                className: 'note-btn-bold',
8039                                contents: _this2.ui.icon(_this2.options.icons.bold),
8040                                tooltip: _this2.lang.font.bold + _this2.representShortcut('bold'),
vendor: 7,827 bytes, lines 8041-8157
8041                                click: _this2.context.createInvokeHandlerAndUpdateState('editor.bold')
8042                            }).render();
8043                        });
8044                        this.context.memo('button.italic', function () {
8045                            return _this2.button({
8046                                className: 'note-btn-italic',
8047                                contents: _this2.ui.icon(_this2.options.icons.italic),
8048                                tooltip: _this2.lang.font.italic + _this2.representShortcut('italic'),
8049                                click: _this2.context.createInvokeHandlerAndUpdateState('editor.italic')
8050                            }).render();
8051                        });
8052                        this.context.memo('button.underline', function () {
8053                            return _this2.button({
8054                                className: 'note-btn-underline',
8055                                contents: _this2.ui.icon(_this2.options.icons.underline),
8056                                tooltip: _this2.lang.font.underline + _this2.representShortcut('underline'),
8057                                click: _this2.context.createInvokeHandlerAndUpdateState('editor.underline')
8058                            }).render();
8059                        });
8060                        this.context.memo('button.clear', function () {
8061                            return _this2.button({
8062                                contents: _this2.ui.icon(_this2.options.icons.eraser),
8063                                tooltip: _this2.lang.font.clear + _this2.representShortcut('removeFormat'),
8064                                click: _this2.context.createInvokeHandler('editor.removeFormat')
8065                            }).render();
8066                        });
8067                        this.context.memo('button.strikethrough', function () {
8068                            return _this2.button({
8069                                className: 'note-btn-strikethrough',
8070                                contents: _this2.ui.icon(_this2.options.icons.strikethrough),
8071                                tooltip: _this2.lang.font.strikethrough + _this2.representShortcut('strikethrough'),
8072                                click: _this2.context.createInvokeHandlerAndUpdateState('editor.strikethrough')
8073                            }).render();
8074                        });
8075                        this.context.memo('button.superscript', function () {
8076                            return _this2.button({
8077                                className: 'note-btn-superscript',
8078                                contents: _this2.ui.icon(_this2.options.icons.superscript),
8079                                tooltip: _this2.lang.font.superscript,
8080                                click: _this2.context.createInvokeHandlerAndUpdateState('editor.superscript')
8081                            }).render();
8082                        });
8083                        this.context.memo('button.subscript', function () {
8084                            return _this2.button({
8085                                className: 'note-btn-subscript',
8086                                contents: _this2.ui.icon(_this2.options.icons.subscript),
8087                                tooltip: _this2.lang.font.subscript,
8088                                click: _this2.context.createInvokeHandlerAndUpdateState('editor.subscript')
8089                            }).render();
8090                        });
8091                        this.context.memo('button.fontname', function () {
8092                            var styleInfo = _this2.context.invoke('editor.currentStyle');
8093
8094                            if (_this2.options.addDefaultFonts) {
8095                                // Add 'default' fonts into the fontnames array if not exist
8096                                external_jQuery_default().each(styleInfo['font-family'].split(','), function (idx, fontname) {
8097                                    fontname = fontname.trim().replace(/['"]+/g, '');
8098
8099                                    if (_this2.isFontDeservedToAdd(fontname)) {
8100                                        if (_this2.options.fontNames.indexOf(fontname) === -1) {
8101                                            _this2.options.fontNames.push(fontname);
8102                                        }
8103                                    }
8104                                });
8105                            }
8106
8107                            return _this2.ui.buttonGroup([_this2.button({
8108                                className: 'dropdown-toggle',
8109                                contents: _this2.ui.dropdownButtonContents('<span class="note-current-fontname"></span>', _this2.options),
8110                                tooltip: _this2.lang.font.name,
8111                                data: {
8112                                    toggle: 'dropdown'
8113                                }
8114                            }), _this2.ui.dropdownCheck({
8115                                className: 'dropdown-fontname',
8116                                checkClassName: _this2.options.icons.menuCheck,
8117                                items: _this2.options.fontNames.filter(_this2.isFontInstalled.bind(_this2)),
8118                                title: _this2.lang.font.name,
8119                                template: function template(item) {
8120                                    return '<span style="font-family: ' + env.validFontName(item) + '">' + item + '</span>';
8121                                },
8122                                click: _this2.context.createInvokeHandlerAndUpdateState('editor.fontName')
8123                            })]).render();
8124                        });
8125                        this.context.memo('button.fontsize', function () {
8126                            return _this2.ui.buttonGroup([_this2.button({
8127                                className: 'dropdown-toggle',
8128                                contents: _this2.ui.dropdownButtonContents('<span class="note-current-fontsize"></span>', _this2.options),
8129                                tooltip: _this2.lang.font.size,
8130                                data: {
8131                                    toggle: 'dropdown'
8132                                }
8133                            }), _this2.ui.dropdownCheck({
8134                                className: 'dropdown-fontsize',
8135                                checkClassName: _this2.options.icons.menuCheck,
8136                                items: _this2.options.fontSizes,
8137                                title: _this2.lang.font.size,
8138                                click: _this2.context.createInvokeHandlerAndUpdateState('editor.fontSize')
8139                            })]).render();
8140                        });
8141                        this.context.memo('button.fontsizeunit', function () {
8142                            return _this2.ui.buttonGroup([_this2.button({
8143                                className: 'dropdown-toggle',
8144                                contents: _this2.ui.dropdownButtonContents('<span class="note-current-fontsizeunit"></span>', _this2.options),
8145                                tooltip: _this2.lang.font.sizeunit,
8146                                data: {
8147                                    toggle: 'dropdown'
8148                                }
8149                            }), _this2.ui.dropdownCheck({
8150                                className: 'dropdown-fontsizeunit',
8151                                checkClassName: _this2.options.icons.menuCheck,
8152                                items: _this2.options.fontSizeUnits,
8153                                title: _this2.lang.font.sizeunit,
8154                                click: _this2.context.createInvokeHandlerAndUpdateState('editor.fontSizeUnit')
8155                            })]).render();
8156                        });
8157                        this.context.memo('button.color', function () {
vendor: 8,886 bytes, lines 8158-8279
8158                            return _this2.colorPalette('note-color-all', _this2.lang.color.recent, true, true);
8159                        });
8160                        this.context.memo('button.forecolor', function () {
8161                            return _this2.colorPalette('note-color-fore', _this2.lang.color.foreground, false, true);
8162                        });
8163                        this.context.memo('button.backcolor', function () {
8164                            return _this2.colorPalette('note-color-back', _this2.lang.color.background, true, false);
8165                        });
8166                        this.context.memo('button.ul', function () {
8167                            return _this2.button({
8168                                contents: _this2.ui.icon(_this2.options.icons.unorderedlist),
8169                                tooltip: _this2.lang.lists.unordered + _this2.representShortcut('insertUnorderedList'),
8170                                click: _this2.context.createInvokeHandler('editor.insertUnorderedList')
8171                            }).render();
8172                        });
8173                        this.context.memo('button.ol', function () {
8174                            return _this2.button({
8175                                contents: _this2.ui.icon(_this2.options.icons.orderedlist),
8176                                tooltip: _this2.lang.lists.ordered + _this2.representShortcut('insertOrderedList'),
8177                                click: _this2.context.createInvokeHandler('editor.insertOrderedList')
8178                            }).render();
8179                        });
8180                        var justifyLeft = this.button({
8181                            contents: this.ui.icon(this.options.icons.alignLeft),
8182                            tooltip: this.lang.paragraph.left + this.representShortcut('justifyLeft'),
8183                            click: this.context.createInvokeHandler('editor.justifyLeft')
8184                        });
8185                        var justifyCenter = this.button({
8186                            contents: this.ui.icon(this.options.icons.alignCenter),
8187                            tooltip: this.lang.paragraph.center + this.representShortcut('justifyCenter'),
8188                            click: this.context.createInvokeHandler('editor.justifyCenter')
8189                        });
8190                        var justifyRight = this.button({
8191                            contents: this.ui.icon(this.options.icons.alignRight),
8192                            tooltip: this.lang.paragraph.right + this.representShortcut('justifyRight'),
8193                            click: this.context.createInvokeHandler('editor.justifyRight')
8194                        });
8195                        var justifyFull = this.button({
8196                            contents: this.ui.icon(this.options.icons.alignJustify),
8197                            tooltip: this.lang.paragraph.justify + this.representShortcut('justifyFull'),
8198                            click: this.context.createInvokeHandler('editor.justifyFull')
8199                        });
8200                        var outdent = this.button({
8201                            contents: this.ui.icon(this.options.icons.outdent),
8202                            tooltip: this.lang.paragraph.outdent + this.representShortcut('outdent'),
8203                            click: this.context.createInvokeHandler('editor.outdent')
8204                        });
8205                        var indent = this.button({
8206                            contents: this.ui.icon(this.options.icons.indent),
8207                            tooltip: this.lang.paragraph.indent + this.representShortcut('indent'),
8208                            click: this.context.createInvokeHandler('editor.indent')
8209                        });
8210                        this.context.memo('button.justifyLeft', func.invoke(justifyLeft, 'render'));
8211                        this.context.memo('button.justifyCenter', func.invoke(justifyCenter, 'render'));
8212                        this.context.memo('button.justifyRight', func.invoke(justifyRight, 'render'));
8213                        this.context.memo('button.justifyFull', func.invoke(justifyFull, 'render'));
8214                        this.context.memo('button.outdent', func.invoke(outdent, 'render'));
8215                        this.context.memo('button.indent', func.invoke(indent, 'render'));
8216                        this.context.memo('button.paragraph', function () {
8217                            return _this2.ui.buttonGroup([_this2.button({
8218                                className: 'dropdown-toggle',
8219                                contents: _this2.ui.dropdownButtonContents(_this2.ui.icon(_this2.options.icons.alignLeft), _this2.options),
8220                                tooltip: _this2.lang.paragraph.paragraph,
8221                                data: {
8222                                    toggle: 'dropdown'
8223                                }
8224                            }), _this2.ui.dropdown([_this2.ui.buttonGroup({
8225                                className: 'note-align',
8226                                children: [justifyLeft, justifyCenter, justifyRight, justifyFull]
8227                            }), _this2.ui.buttonGroup({
8228                                className: 'note-list',
8229                                children: [outdent, indent]
8230                            })])]).render();
8231                        });
8232                        this.context.memo('button.height', function () {
8233                            return _this2.ui.buttonGroup([_this2.button({
8234                                className: 'dropdown-toggle',
8235                                contents: _this2.ui.dropdownButtonContents(_this2.ui.icon(_this2.options.icons.textHeight), _this2.options),
8236                                tooltip: _this2.lang.font.height,
8237                                data: {
8238                                    toggle: 'dropdown'
8239                                }
8240                            }), _this2.ui.dropdownCheck({
8241                                items: _this2.options.lineHeights,
8242                                checkClassName: _this2.options.icons.menuCheck,
8243                                className: 'dropdown-line-height',
8244                                title: _this2.lang.font.height,
8245                                click: _this2.context.createInvokeHandler('editor.lineHeight')
8246                            })]).render();
8247                        });
8248                        this.context.memo('button.table', function () {
8249                            return _this2.ui.buttonGroup([_this2.button({
8250                                className: 'dropdown-toggle',
8251                                contents: _this2.ui.dropdownButtonContents(_this2.ui.icon(_this2.options.icons.table), _this2.options),
8252                                tooltip: _this2.lang.table.table,
8253                                data: {
8254                                    toggle: 'dropdown'
8255                                }
8256                            }), _this2.ui.dropdown({
8257                                title: _this2.lang.table.table,
8258                                className: 'note-table',
8259                                items: ['<div class="note-dimension-picker">', '<div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"></div>', '<div class="note-dimension-picker-highlighted"></div>', '<div class="note-dimension-picker-unhighlighted"></div>', '</div>', '<div class="note-dimension-display">1 x 1</div>'].join('')
8260                            })], {
8261                                callback: function callback($node) {
8262                                    var $catcher = $node.find('.note-dimension-picker-mousecatcher');
8263                                    $catcher.css({
8264                                        width: _this2.options.insertTableMaxSize.col + 'em',
8265                                        height: _this2.options.insertTableMaxSize.row + 'em'
8266                                    }).mouseup(_this2.context.createInvokeHandler('editor.insertTable')).on('mousemove', _this2.tableMoveHandler.bind(_this2));
8267                                }
8268                            }).render();
8269                        });
8270                        this.context.memo('button.link', function () {
8271                            return _this2.button({
8272                                contents: _this2.ui.icon(_this2.options.icons.link),
8273                                tooltip: _this2.lang.link.link + _this2.representShortcut('linkDialog.show'),
8274                                click: _this2.context.createInvokeHandler('linkDialog.show')
8275                            }).render();
8276                        });
8277                        this.context.memo('button.picture', function () {
8278                            return _this2.button({
8279                                contents: _this2.ui.icon(_this2.options.icons.picture),
vendor: 20,408 bytes, lines 8280-8627
8280                                tooltip: _this2.lang.image.image,
8281                                click: _this2.context.createInvokeHandler('imageDialog.show')
8282                            }).render();
8283                        });
8284                        this.context.memo('button.video', function () {
8285                            return _this2.button({
8286                                contents: _this2.ui.icon(_this2.options.icons.video),
8287                                tooltip: _this2.lang.video.video,
8288                                click: _this2.context.createInvokeHandler('videoDialog.show')
8289                            }).render();
8290                        });
8291                        this.context.memo('button.hr', function () {
8292                            return _this2.button({
8293                                contents: _this2.ui.icon(_this2.options.icons.minus),
8294                                tooltip: _this2.lang.hr.insert + _this2.representShortcut('insertHorizontalRule'),
8295                                click: _this2.context.createInvokeHandler('editor.insertHorizontalRule')
8296                            }).render();
8297                        });
8298                        this.context.memo('button.fullscreen', function () {
8299                            return _this2.button({
8300                                className: 'btn-fullscreen note-codeview-keep',
8301                                contents: _this2.ui.icon(_this2.options.icons.arrowsAlt),
8302                                tooltip: _this2.lang.options.fullscreen,
8303                                click: _this2.context.createInvokeHandler('fullscreen.toggle')
8304                            }).render();
8305                        });
8306                        this.context.memo('button.codeview', function () {
8307                            return _this2.button({
8308                                className: 'btn-codeview note-codeview-keep',
8309                                contents: _this2.ui.icon(_this2.options.icons.code),
8310                                tooltip: _this2.lang.options.codeview,
8311                                click: _this2.context.createInvokeHandler('codeview.toggle')
8312                            }).render();
8313                        });
8314                        this.context.memo('button.redo', function () {
8315                            return _this2.button({
8316                                contents: _this2.ui.icon(_this2.options.icons.redo),
8317                                tooltip: _this2.lang.history.redo + _this2.representShortcut('redo'),
8318                                click: _this2.context.createInvokeHandler('editor.redo')
8319                            }).render();
8320                        });
8321                        this.context.memo('button.undo', function () {
8322                            return _this2.button({
8323                                contents: _this2.ui.icon(_this2.options.icons.undo),
8324                                tooltip: _this2.lang.history.undo + _this2.representShortcut('undo'),
8325                                click: _this2.context.createInvokeHandler('editor.undo')
8326                            }).render();
8327                        });
8328                        this.context.memo('button.help', function () {
8329                            return _this2.button({
8330                                contents: _this2.ui.icon(_this2.options.icons.question),
8331                                tooltip: _this2.lang.options.help,
8332                                click: _this2.context.createInvokeHandler('helpDialog.show')
8333                            }).render();
8334                        });
8335                    }
8336                    /**
8337                     * image: [
8338                     *   ['imageResize', ['resizeFull', 'resizeHalf', 'resizeQuarter', 'resizeNone']],
8339                     *   ['float', ['floatLeft', 'floatRight', 'floatNone']],
8340                     *   ['remove', ['removeMedia']],
8341                     * ],
8342                     */
8343
8344                }, {
8345                    key: "addImagePopoverButtons",
8346                    value: function addImagePopoverButtons() {
8347                        var _this3 = this;
8348
8349                        // Image Size Buttons
8350                        this.context.memo('button.resizeFull', function () {
8351                            return _this3.button({
8352                                contents: '<span class="note-fontsize-10">100%</span>',
8353                                tooltip: _this3.lang.image.resizeFull,
8354                                click: _this3.context.createInvokeHandler('editor.resize', '1')
8355                            }).render();
8356                        });
8357                        this.context.memo('button.resizeHalf', function () {
8358                            return _this3.button({
8359                                contents: '<span class="note-fontsize-10">50%</span>',
8360                                tooltip: _this3.lang.image.resizeHalf,
8361                                click: _this3.context.createInvokeHandler('editor.resize', '0.5')
8362                            }).render();
8363                        });
8364                        this.context.memo('button.resizeQuarter', function () {
8365                            return _this3.button({
8366                                contents: '<span class="note-fontsize-10">25%</span>',
8367                                tooltip: _this3.lang.image.resizeQuarter,
8368                                click: _this3.context.createInvokeHandler('editor.resize', '0.25')
8369                            }).render();
8370                        });
8371                        this.context.memo('button.resizeNone', function () {
8372                            return _this3.button({
8373                                contents: _this3.ui.icon(_this3.options.icons.rollback),
8374                                tooltip: _this3.lang.image.resizeNone,
8375                                click: _this3.context.createInvokeHandler('editor.resize', '0')
8376                            }).render();
8377                        }); // Float Buttons
8378
8379                        this.context.memo('button.floatLeft', function () {
8380                            return _this3.button({
8381                                contents: _this3.ui.icon(_this3.options.icons.floatLeft),
8382                                tooltip: _this3.lang.image.floatLeft,
8383                                click: _this3.context.createInvokeHandler('editor.floatMe', 'left')
8384                            }).render();
8385                        });
8386                        this.context.memo('button.floatRight', function () {
8387                            return _this3.button({
8388                                contents: _this3.ui.icon(_this3.options.icons.floatRight),
8389                                tooltip: _this3.lang.image.floatRight,
8390                                click: _this3.context.createInvokeHandler('editor.floatMe', 'right')
8391                            }).render();
8392                        });
8393                        this.context.memo('button.floatNone', function () {
8394                            return _this3.button({
8395                                contents: _this3.ui.icon(_this3.options.icons.rollback),
8396                                tooltip: _this3.lang.image.floatNone,
8397                                click: _this3.context.createInvokeHandler('editor.floatMe', 'none')
8398                            }).render();
8399                        }); // Remove Buttons
8400
8401                        this.context.memo('button.removeMedia', function () {
8402                            return _this3.button({
8403                                contents: _this3.ui.icon(_this3.options.icons.trash),
8404                                tooltip: _this3.lang.image.remove,
8405                                click: _this3.context.createInvokeHandler('editor.removeMedia')
8406                            }).render();
8407                        });
8408                    }
8409                }, {
8410                    key: "addLinkPopoverButtons",
8411                    value: function addLinkPopoverButtons() {
8412                        var _this4 = this;
8413
8414                        this.context.memo('button.linkDialogShow', function () {
8415                            return _this4.button({
8416                                contents: _this4.ui.icon(_this4.options.icons.link),
8417                                tooltip: _this4.lang.link.edit,
8418                                click: _this4.context.createInvokeHandler('linkDialog.show')
8419                            }).render();
8420                        });
8421                        this.context.memo('button.unlink', function () {
8422                            return _this4.button({
8423                                contents: _this4.ui.icon(_this4.options.icons.unlink),
8424                                tooltip: _this4.lang.link.unlink,
8425                                click: _this4.context.createInvokeHandler('editor.unlink')
8426                            }).render();
8427                        });
8428                    }
8429                    /**
8430                     * table : [
8431                     *  ['add', ['addRowDown', 'addRowUp', 'addColLeft', 'addColRight']],
8432                     *  ['delete', ['deleteRow', 'deleteCol', 'deleteTable']]
8433                     * ],
8434                     */
8435
8436                }, {
8437                    key: "addTablePopoverButtons",
8438                    value: function addTablePopoverButtons() {
8439                        var _this5 = this;
8440
8441                        this.context.memo('button.addRowUp', function () {
8442                            return _this5.button({
8443                                className: 'btn-md',
8444                                contents: _this5.ui.icon(_this5.options.icons.rowAbove),
8445                                tooltip: _this5.lang.table.addRowAbove,
8446                                click: _this5.context.createInvokeHandler('editor.addRow', 'top')
8447                            }).render();
8448                        });
8449                        this.context.memo('button.addRowDown', function () {
8450                            return _this5.button({
8451                                className: 'btn-md',
8452                                contents: _this5.ui.icon(_this5.options.icons.rowBelow),
8453                                tooltip: _this5.lang.table.addRowBelow,
8454                                click: _this5.context.createInvokeHandler('editor.addRow', 'bottom')
8455                            }).render();
8456                        });
8457                        this.context.memo('button.addColLeft', function () {
8458                            return _this5.button({
8459                                className: 'btn-md',
8460                                contents: _this5.ui.icon(_this5.options.icons.colBefore),
8461                                tooltip: _this5.lang.table.addColLeft,
8462                                click: _this5.context.createInvokeHandler('editor.addCol', 'left')
8463                            }).render();
8464                        });
8465                        this.context.memo('button.addColRight', function () {
8466                            return _this5.button({
8467                                className: 'btn-md',
8468                                contents: _this5.ui.icon(_this5.options.icons.colAfter),
8469                                tooltip: _this5.lang.table.addColRight,
8470                                click: _this5.context.createInvokeHandler('editor.addCol', 'right')
8471                            }).render();
8472                        });
8473                        this.context.memo('button.deleteRow', function () {
8474                            return _this5.button({
8475                                className: 'btn-md',
8476                                contents: _this5.ui.icon(_this5.options.icons.rowRemove),
8477                                tooltip: _this5.lang.table.delRow,
8478                                click: _this5.context.createInvokeHandler('editor.deleteRow')
8479                            }).render();
8480                        });
8481                        this.context.memo('button.deleteCol', function () {
8482                            return _this5.button({
8483                                className: 'btn-md',
8484                                contents: _this5.ui.icon(_this5.options.icons.colRemove),
8485                                tooltip: _this5.lang.table.delCol,
8486                                click: _this5.context.createInvokeHandler('editor.deleteCol')
8487                            }).render();
8488                        });
8489                        this.context.memo('button.deleteTable', function () {
8490                            return _this5.button({
8491                                className: 'btn-md',
8492                                contents: _this5.ui.icon(_this5.options.icons.trash),
8493                                tooltip: _this5.lang.table.delTable,
8494                                click: _this5.context.createInvokeHandler('editor.deleteTable')
8495                            }).render();
8496                        });
8497                    }
8498                }, {
8499                    key: "build",
8500                    value: function build($container, groups) {
8501                        for (var groupIdx = 0, groupLen = groups.length; groupIdx < groupLen; groupIdx++) {
8502                            var group = groups[groupIdx];
8503                            var groupName = Array.isArray(group) ? group[0] : group;
8504                            var buttons = Array.isArray(group) ? group.length === 1 ? [group[0]] : group[1] : [group];
8505                            var $group = this.ui.buttonGroup({
8506                                className: 'note-' + groupName
8507                            }).render();
8508
8509                            for (var idx = 0, len = buttons.length; idx < len; idx++) {
8510                                var btn = this.context.memo('button.' + buttons[idx]);
8511
8512                                if (btn) {
8513                                    $group.append(typeof btn === 'function' ? btn(this.context) : btn);
8514                                }
8515                            }
8516
8517                            $group.appendTo($container);
8518                        }
8519                    }
8520                    /**
8521                     * @param {jQuery} [$container]
8522                     */
8523
8524                }, {
8525                    key: "updateCurrentStyle",
8526                    value: function updateCurrentStyle($container) {
8527                        var $cont = $container || this.$toolbar;
8528                        var styleInfo = this.context.invoke('editor.currentStyle');
8529                        this.updateBtnStates($cont, {
8530                            '.note-btn-bold': function noteBtnBold() {
8531                                return styleInfo['font-bold'] === 'bold';
8532                            },
8533                            '.note-btn-italic': function noteBtnItalic() {
8534                                return styleInfo['font-italic'] === 'italic';
8535                            },
8536                            '.note-btn-underline': function noteBtnUnderline() {
8537                                return styleInfo['font-underline'] === 'underline';
8538                            },
8539                            '.note-btn-subscript': function noteBtnSubscript() {
8540                                return styleInfo['font-subscript'] === 'subscript';
8541                            },
8542                            '.note-btn-superscript': function noteBtnSuperscript() {
8543                                return styleInfo['font-superscript'] === 'superscript';
8544                            },
8545                            '.note-btn-strikethrough': function noteBtnStrikethrough() {
8546                                return styleInfo['font-strikethrough'] === 'strikethrough';
8547                            }
8548                        });
8549
8550                        if (styleInfo['font-family']) {
8551                            var fontNames = styleInfo['font-family'].split(',').map(function (name) {
8552                                return name.replace(/[\'\"]/g, '').replace(/\s+$/, '').replace(/^\s+/, '');
8553                            });
8554                            var fontName = lists.find(fontNames, this.isFontInstalled.bind(this));
8555                            $cont.find('.dropdown-fontname a').each(function (idx, item) {
8556                                var $item = external_jQuery_default()(item); // always compare string to avoid creating another func.
8557
8558                                var isChecked = $item.data('value') + '' === fontName + '';
8559                                $item.toggleClass('checked', isChecked);
8560                            });
8561                            $cont.find('.note-current-fontname').text(fontName).css('font-family', fontName);
8562                        }
8563
8564                        if (styleInfo['font-size']) {
8565                            var fontSize = styleInfo['font-size'];
8566                            $cont.find('.dropdown-fontsize a').each(function (idx, item) {
8567                                var $item = external_jQuery_default()(item); // always compare with string to avoid creating another func.
8568
8569                                var isChecked = $item.data('value') + '' === fontSize + '';
8570                                $item.toggleClass('checked', isChecked);
8571                            });
8572                            $cont.find('.note-current-fontsize').text(fontSize);
8573                            var fontSizeUnit = styleInfo['font-size-unit'];
8574                            $cont.find('.dropdown-fontsizeunit a').each(function (idx, item) {
8575                                var $item = external_jQuery_default()(item);
8576                                var isChecked = $item.data('value') + '' === fontSizeUnit + '';
8577                                $item.toggleClass('checked', isChecked);
8578                            });
8579                            $cont.find('.note-current-fontsizeunit').text(fontSizeUnit);
8580                        }
8581
8582                        if (styleInfo['line-height']) {
8583                            var lineHeight = styleInfo['line-height'];
8584                            $cont.find('.dropdown-line-height a').each(function (idx, item) {
8585                                var $item = external_jQuery_default()(item); // always compare with string to avoid creating another func.
8586
8587                                var isChecked = external_jQuery_default()(item).data('value') + '' === lineHeight + '';
8588                                $item.toggleClass('checked', isChecked);
8589                            });
8590                            $cont.find('.note-current-line-height').text(lineHeight);
8591                        }
8592                    }
8593                }, {
8594                    key: "updateBtnStates",
8595                    value: function updateBtnStates($container, infos) {
8596                        var _this6 = this;
8597
8598                        external_jQuery_default().each(infos, function (selector, pred) {
8599                            _this6.ui.toggleBtnActive($container.find(selector), pred());
8600                        });
8601                    }
8602                }, {
8603                    key: "tableMoveHandler",
8604                    value: function tableMoveHandler(event) {
8605                        var PX_PER_EM = 18;
8606                        var $picker = external_jQuery_default()(event.target.parentNode); // target is mousecatcher
8607
8608                        var $dimensionDisplay = $picker.next();
8609                        var $catcher = $picker.find('.note-dimension-picker-mousecatcher');
8610                        var $highlighted = $picker.find('.note-dimension-picker-highlighted');
8611                        var $unhighlighted = $picker.find('.note-dimension-picker-unhighlighted');
8612                        var posOffset; // HTML5 with jQuery - e.offsetX is undefined in Firefox
8613
8614                        if (event.offsetX === undefined) {
8615                            var posCatcher = external_jQuery_default()(event.target).offset();
8616                            posOffset = {
8617                                x: event.pageX - posCatcher.left,
8618                                y: event.pageY - posCatcher.top
8619                            };
8620                        } else {
8621                            posOffset = {
8622                                x: event.offsetX,
8623                                y: event.offsetY
8624                            };
8625                        }
8626
8627                        var dim = {
vendor: 62,027 bytes, lines 8628-9840
8628                            c: Math.ceil(posOffset.x / PX_PER_EM) || 1,
8629                            r: Math.ceil(posOffset.y / PX_PER_EM) || 1
8630                        };
8631                        $highlighted.css({
8632                            width: dim.c + 'em',
8633                            height: dim.r + 'em'
8634                        });
8635                        $catcher.data('value', dim.c + 'x' + dim.r);
8636
8637                        if (dim.c > 3 && dim.c < this.options.insertTableMaxSize.col) {
8638                            $unhighlighted.css({
8639                                width: dim.c + 1 + 'em'
8640                            });
8641                        }
8642
8643                        if (dim.r > 3 && dim.r < this.options.insertTableMaxSize.row) {
8644                            $unhighlighted.css({
8645                                height: dim.r + 1 + 'em'
8646                            });
8647                        }
8648
8649                        $dimensionDisplay.html(dim.c + ' x ' + dim.r);
8650                    }
8651                }]);
8652
8653                return Buttons;
8654            }();
8655
8656
8657            ;// CONCATENATED MODULE: ./src/js/module/Toolbar.js
8658            function Toolbar_classCallCheck(instance, Constructor) {
8659                if (!(instance instanceof Constructor)) {
8660                    throw new TypeError("Cannot call a class as a function");
8661                }
8662            }
8663
8664            function Toolbar_defineProperties(target, props) {
8665                for (var i = 0; i < props.length; i++) {
8666                    var descriptor = props[i];
8667                    descriptor.enumerable = descriptor.enumerable || false;
8668                    descriptor.configurable = true;
8669                    if ("value" in descriptor) descriptor.writable = true;
8670                    Object.defineProperty(target, descriptor.key, descriptor);
8671                }
8672            }
8673
8674            function Toolbar_createClass(Constructor, protoProps, staticProps) {
8675                if (protoProps) Toolbar_defineProperties(Constructor.prototype, protoProps);
8676                if (staticProps) Toolbar_defineProperties(Constructor, staticProps);
8677                return Constructor;
8678            }
8679
8680
8681            var Toolbar = /*#__PURE__*/function () {
8682                function Toolbar(context) {
8683                    Toolbar_classCallCheck(this, Toolbar);
8684
8685                    this.context = context;
8686                    this.$window = external_jQuery_default()(window);
8687                    this.$document = external_jQuery_default()(document);
8688                    this.ui = (external_jQuery_default()).summernote.ui;
8689                    this.$note = context.layoutInfo.note;
8690                    this.$editor = context.layoutInfo.editor;
8691                    this.$toolbar = context.layoutInfo.toolbar;
8692                    this.$editable = context.layoutInfo.editable;
8693                    this.$statusbar = context.layoutInfo.statusbar;
8694                    this.options = context.options;
8695                    this.isFollowing = false;
8696                    this.followScroll = this.followScroll.bind(this);
8697                }
8698
8699                Toolbar_createClass(Toolbar, [{
8700                    key: "shouldInitialize",
8701                    value: function shouldInitialize() {
8702                        return !this.options.airMode;
8703                    }
8704                }, {
8705                    key: "initialize",
8706                    value: function initialize() {
8707                        var _this = this;
8708
8709                        this.options.toolbar = this.options.toolbar || [];
8710
8711                        if (!this.options.toolbar.length) {
8712                            this.$toolbar.hide();
8713                        } else {
8714                            this.context.invoke('buttons.build', this.$toolbar, this.options.toolbar);
8715                        }
8716
8717                        if (this.options.toolbarContainer) {
8718                            this.$toolbar.appendTo(this.options.toolbarContainer);
8719                        }
8720
8721                        this.changeContainer(false);
8722                        this.$note.on('summernote.keyup summernote.mouseup summernote.change', function () {
8723                            _this.context.invoke('buttons.updateCurrentStyle');
8724                        });
8725                        this.context.invoke('buttons.updateCurrentStyle');
8726
8727                        if (this.options.followingToolbar) {
8728                            this.$window.on('scroll resize', this.followScroll);
8729                        }
8730                    }
8731                }, {
8732                    key: "destroy",
8733                    value: function destroy() {
8734                        this.$toolbar.children().remove();
8735
8736                        if (this.options.followingToolbar) {
8737                            this.$window.off('scroll resize', this.followScroll);
8738                        }
8739                    }
8740                }, {
8741                    key: "followScroll",
8742                    value: function followScroll() {
8743                        if (this.$editor.hasClass('fullscreen')) {
8744                            return false;
8745                        }
8746
8747                        var editorHeight = this.$editor.outerHeight();
8748                        var editorWidth = this.$editor.width();
8749                        var toolbarHeight = this.$toolbar.height();
8750                        var statusbarHeight = this.$statusbar.height(); // check if the web app is currently using another static bar
8751
8752                        var otherBarHeight = 0;
8753
8754                        if (this.options.otherStaticBar) {
8755                            otherBarHeight = external_jQuery_default()(this.options.otherStaticBar).outerHeight();
8756                        }
8757
8758                        var currentOffset = this.$document.scrollTop();
8759                        var editorOffsetTop = this.$editor.offset().top;
8760                        var editorOffsetBottom = editorOffsetTop + editorHeight;
8761                        var activateOffset = editorOffsetTop - otherBarHeight;
8762                        var deactivateOffsetBottom = editorOffsetBottom - otherBarHeight - toolbarHeight - statusbarHeight;
8763
8764                        if (!this.isFollowing && currentOffset > activateOffset && currentOffset < deactivateOffsetBottom - toolbarHeight) {
8765                            this.isFollowing = true;
8766                            this.$editable.css({
8767                                marginTop: this.$toolbar.outerHeight()
8768                            });
8769                            this.$toolbar.css({
8770                                position: 'fixed',
8771                                top: otherBarHeight,
8772                                width: editorWidth,
8773                                zIndex: 1000
8774                            });
8775                        } else if (this.isFollowing && (currentOffset < activateOffset || currentOffset > deactivateOffsetBottom)) {
8776                            this.isFollowing = false;
8777                            this.$toolbar.css({
8778                                position: 'relative',
8779                                top: 0,
8780                                width: '100%',
8781                                zIndex: 'auto'
8782                            });
8783                            this.$editable.css({
8784                                marginTop: ''
8785                            });
8786                        }
8787                    }
8788                }, {
8789                    key: "changeContainer",
8790                    value: function changeContainer(isFullscreen) {
8791                        if (isFullscreen) {
8792                            this.$toolbar.prependTo(this.$editor);
8793                        } else {
8794                            if (this.options.toolbarContainer) {
8795                                this.$toolbar.appendTo(this.options.toolbarContainer);
8796                            }
8797                        }
8798
8799                        if (this.options.followingToolbar) {
8800                            this.followScroll();
8801                        }
8802                    }
8803                }, {
8804                    key: "updateFullscreen",
8805                    value: function updateFullscreen(isFullscreen) {
8806                        this.ui.toggleBtnActive(this.$toolbar.find('.btn-fullscreen'), isFullscreen);
8807                        this.changeContainer(isFullscreen);
8808                    }
8809                }, {
8810                    key: "updateCodeview",
8811                    value: function updateCodeview(isCodeview) {
8812                        this.ui.toggleBtnActive(this.$toolbar.find('.btn-codeview'), isCodeview);
8813
8814                        if (isCodeview) {
8815                            this.deactivate();
8816                        } else {
8817                            this.activate();
8818                        }
8819                    }
8820                }, {
8821                    key: "activate",
8822                    value: function activate(isIncludeCodeview) {
8823                        var $btn = this.$toolbar.find('button');
8824
8825                        if (!isIncludeCodeview) {
8826                            $btn = $btn.not('.note-codeview-keep');
8827                        }
8828
8829                        this.ui.toggleBtn($btn, true);
8830                    }
8831                }, {
8832                    key: "deactivate",
8833                    value: function deactivate(isIncludeCodeview) {
8834                        var $btn = this.$toolbar.find('button');
8835
8836                        if (!isIncludeCodeview) {
8837                            $btn = $btn.not('.note-codeview-keep');
8838                        }
8839
8840                        this.ui.toggleBtn($btn, false);
8841                    }
8842                }]);
8843
8844                return Toolbar;
8845            }();
8846
8847
8848            ;// CONCATENATED MODULE: ./src/js/module/LinkDialog.js
8849            function LinkDialog_classCallCheck(instance, Constructor) {
8850                if (!(instance instanceof Constructor)) {
8851                    throw new TypeError("Cannot call a class as a function");
8852                }
8853            }
8854
8855            function LinkDialog_defineProperties(target, props) {
8856                for (var i = 0; i < props.length; i++) {
8857                    var descriptor = props[i];
8858                    descriptor.enumerable = descriptor.enumerable || false;
8859                    descriptor.configurable = true;
8860                    if ("value" in descriptor) descriptor.writable = true;
8861                    Object.defineProperty(target, descriptor.key, descriptor);
8862                }
8863            }
8864
8865            function LinkDialog_createClass(Constructor, protoProps, staticProps) {
8866                if (protoProps) LinkDialog_defineProperties(Constructor.prototype, protoProps);
8867                if (staticProps) LinkDialog_defineProperties(Constructor, staticProps);
8868                return Constructor;
8869            }
8870
8871
8872            var LinkDialog = /*#__PURE__*/function () {
8873                function LinkDialog(context) {
8874                    LinkDialog_classCallCheck(this, LinkDialog);
8875
8876                    this.context = context;
8877                    this.ui = (external_jQuery_default()).summernote.ui;
8878                    this.$body = external_jQuery_default()(document.body);
8879                    this.$editor = context.layoutInfo.editor;
8880                    this.options = context.options;
8881                    this.lang = this.options.langInfo;
8882                    context.memo('help.linkDialog.show', this.options.langInfo.help['linkDialog.show']);
8883                }
8884
8885                LinkDialog_createClass(LinkDialog, [{
8886                    key: "initialize",
8887                    value: function initialize() {
8888                        var $container = this.options.dialogsInBody ? this.$body : this.options.container;
8889                        var body = ['<div class="form-group note-form-group">', "<label for=\"note-dialog-link-txt-".concat(this.options.id, "\" class=\"note-form-label\">").concat(this.lang.link.textToDisplay, "</label>"), "<input id=\"note-dialog-link-txt-".concat(this.options.id, "\" class=\"note-link-text form-control note-form-control note-input\" type=\"text\"/>"), '</div>', '<div class="form-group note-form-group">', "<label for=\"note-dialog-link-url-".concat(this.options.id, "\" class=\"note-form-label\">").concat(this.lang.link.url, "</label>"), "<input id=\"note-dialog-link-url-".concat(this.options.id, "\" class=\"note-link-url form-control note-form-control note-input\" type=\"text\" value=\"http://\"/>"), '</div>', !this.options.disableLinkTarget ? external_jQuery_default()('<div></div>').append(this.ui.checkbox({
8890                            className: 'sn-checkbox-open-in-new-window',
8891                            text: this.lang.link.openInNewWindow,
8892                            checked: true
8893                        }).render()).html() : '', external_jQuery_default()('<div></div>').append(this.ui.checkbox({
8894                            className: 'sn-checkbox-use-protocol',
8895                            text: this.lang.link.useProtocol,
8896                            checked: true
8897                        }).render()).html()].join('');
8898                        var buttonClass = 'btn btn-primary note-btn note-btn-primary note-link-btn';
8899                        var footer = "<input type=\"button\" href=\"#\" class=\"".concat(buttonClass, "\" value=\"").concat(this.lang.link.insert, "\" disabled>");
8900                        this.$dialog = this.ui.dialog({
8901                            className: 'link-dialog',
8902                            title: this.lang.link.insert,
8903                            fade: this.options.dialogsFade,
8904                            body: body,
8905                            footer: footer
8906                        }).render().appendTo($container);
8907                    }
8908                }, {
8909                    key: "destroy",
8910                    value: function destroy() {
8911                        this.ui.hideDialog(this.$dialog);
8912                        this.$dialog.remove();
8913                    }
8914                }, {
8915                    key: "bindEnterKey",
8916                    value: function bindEnterKey($input, $btn) {
8917                        $input.on('keypress', function (event) {
8918                            if (event.keyCode === key.code.ENTER) {
8919                                event.preventDefault();
8920                                $btn.trigger('click');
8921                            }
8922                        });
8923                    }
8924                    /**
8925                     * toggle update button
8926                     */
8927
8928                }, {
8929                    key: "toggleLinkBtn",
8930                    value: function toggleLinkBtn($linkBtn, $linkText, $linkUrl) {
8931                        this.ui.toggleBtn($linkBtn, $linkText.val() && $linkUrl.val());
8932                    }
8933                    /**
8934                     * Show link dialog and set event handlers on dialog controls.
8935                     *
8936                     * @param {Object} linkInfo
8937                     * @return {Promise}
8938                     */
8939
8940                }, {
8941                    key: "showLinkDialog",
8942                    value: function showLinkDialog(linkInfo) {
8943                        var _this = this;
8944
8945                        return external_jQuery_default().Deferred(function (deferred) {
8946                            var $linkText = _this.$dialog.find('.note-link-text');
8947
8948                            var $linkUrl = _this.$dialog.find('.note-link-url');
8949
8950                            var $linkBtn = _this.$dialog.find('.note-link-btn');
8951
8952                            var $openInNewWindow = _this.$dialog.find('.sn-checkbox-open-in-new-window input[type=checkbox]');
8953
8954                            var $useProtocol = _this.$dialog.find('.sn-checkbox-use-protocol input[type=checkbox]');
8955
8956                            _this.ui.onDialogShown(_this.$dialog, function () {
8957                                _this.context.triggerEvent('dialog.shown'); // If no url was given and given text is valid URL then copy that into URL Field
8958
8959
8960                                if (!linkInfo.url && func.isValidUrl(linkInfo.text)) {
8961                                    linkInfo.url = linkInfo.text;
8962                                }
8963
8964                                $linkText.on('input paste propertychange', function () {
8965                                    // If linktext was modified by input events,
8966                                    // cloning text from linkUrl will be stopped.
8967                                    linkInfo.text = $linkText.val();
8968
8969                                    _this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);
8970                                }).val(linkInfo.text);
8971                                $linkUrl.on('input paste propertychange', function () {
8972                                    // Display same text on `Text to display` as default
8973                                    // when linktext has no text
8974                                    if (!linkInfo.text) {
8975                                        $linkText.val($linkUrl.val());
8976                                    }
8977
8978                                    _this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);
8979                                }).val(linkInfo.url);
8980
8981                                if (!env.isSupportTouch) {
8982                                    $linkUrl.trigger('focus');
8983                                }
8984
8985                                _this.toggleLinkBtn($linkBtn, $linkText, $linkUrl);
8986
8987                                _this.bindEnterKey($linkUrl, $linkBtn);
8988
8989                                _this.bindEnterKey($linkText, $linkBtn);
8990
8991                                var isNewWindowChecked = linkInfo.isNewWindow !== undefined ? linkInfo.isNewWindow : _this.context.options.linkTargetBlank;
8992                                $openInNewWindow.prop('checked', isNewWindowChecked);
8993                                var useProtocolChecked = linkInfo.url ? false : _this.context.options.useProtocol;
8994                                $useProtocol.prop('checked', useProtocolChecked);
8995                                $linkBtn.one('click', function (event) {
8996                                    event.preventDefault();
8997                                    deferred.resolve({
8998                                        range: linkInfo.range,
8999                                        url: $linkUrl.val(),
9000                                        text: $linkText.val(),
9001                                        isNewWindow: $openInNewWindow.is(':checked'),
9002                                        checkProtocol: $useProtocol.is(':checked')
9003                                    });
9004
9005                                    _this.ui.hideDialog(_this.$dialog);
9006                                });
9007                            });
9008
9009                            _this.ui.onDialogHidden(_this.$dialog, function () {
9010                                // detach events
9011                                $linkText.off();
9012                                $linkUrl.off();
9013                                $linkBtn.off();
9014
9015                                if (deferred.state() === 'pending') {
9016                                    deferred.reject();
9017                                }
9018                            });
9019
9020                            _this.ui.showDialog(_this.$dialog);
9021                        }).promise();
9022                    }
9023                    /**
9024                     * @param {Object} layoutInfo
9025                     */
9026
9027                }, {
9028                    key: "show",
9029                    value: function show() {
9030                        var _this2 = this;
9031
9032                        var linkInfo = this.context.invoke('editor.getLinkInfo');
9033                        this.context.invoke('editor.saveRange');
9034                        this.showLinkDialog(linkInfo).then(function (linkInfo) {
9035                            _this2.context.invoke('editor.restoreRange');
9036
9037                            _this2.context.invoke('editor.createLink', linkInfo);
9038                        }).fail(function () {
9039                            _this2.context.invoke('editor.restoreRange');
9040                        });
9041                    }
9042                }]);
9043
9044                return LinkDialog;
9045            }();
9046
9047
9048            ;// CONCATENATED MODULE: ./src/js/module/LinkPopover.js
9049            function LinkPopover_classCallCheck(instance, Constructor) {
9050                if (!(instance instanceof Constructor)) {
9051                    throw new TypeError("Cannot call a class as a function");
9052                }
9053            }
9054
9055            function LinkPopover_defineProperties(target, props) {
9056                for (var i = 0; i < props.length; i++) {
9057                    var descriptor = props[i];
9058                    descriptor.enumerable = descriptor.enumerable || false;
9059                    descriptor.configurable = true;
9060                    if ("value" in descriptor) descriptor.writable = true;
9061                    Object.defineProperty(target, descriptor.key, descriptor);
9062                }
9063            }
9064
9065            function LinkPopover_createClass(Constructor, protoProps, staticProps) {
9066                if (protoProps) LinkPopover_defineProperties(Constructor.prototype, protoProps);
9067                if (staticProps) LinkPopover_defineProperties(Constructor, staticProps);
9068                return Constructor;
9069            }
9070
9071
9072            var LinkPopover = /*#__PURE__*/function () {
9073                function LinkPopover(context) {
9074                    var _this = this;
9075
9076                    LinkPopover_classCallCheck(this, LinkPopover);
9077
9078                    this.context = context;
9079                    this.ui = (external_jQuery_default()).summernote.ui;
9080                    this.options = context.options;
9081                    this.events = {
9082                        'summernote.keyup summernote.mouseup summernote.change summernote.scroll': function summernoteKeyupSummernoteMouseupSummernoteChangeSummernoteScroll() {
9083                            _this.update();
9084                        },
9085                        'summernote.disable summernote.dialog.shown': function summernoteDisableSummernoteDialogShown() {
9086                            _this.hide();
9087                        },
9088                        'summernote.blur': function summernoteBlur(we, e) {
9089                            if (e.originalEvent && e.originalEvent.relatedTarget) {
9090                                if (!_this.$popover[0].contains(e.originalEvent.relatedTarget)) {
9091                                    _this.hide();
9092                                }
9093                            } else {
9094                                _this.hide();
9095                            }
9096                        }
9097                    };
9098                }
9099
9100                LinkPopover_createClass(LinkPopover, [{
9101                    key: "shouldInitialize",
9102                    value: function shouldInitialize() {
9103                        return !lists.isEmpty(this.options.popover.link);
9104                    }
9105                }, {
9106                    key: "initialize",
9107                    value: function initialize() {
9108                        this.$popover = this.ui.popover({
9109                            className: 'note-link-popover',
9110                            callback: function callback($node) {
9111                                var $content = $node.find('.popover-content,.note-popover-content');
9112                                $content.prepend('<span><a target="_blank"></a>&nbsp;</span>');
9113                            }
9114                        }).render().appendTo(this.options.container);
9115                        var $content = this.$popover.find('.popover-content,.note-popover-content');
9116                        this.context.invoke('buttons.build', $content, this.options.popover.link);
9117                        this.$popover.on('mousedown', function (e) {
9118                            e.preventDefault();
9119                        });
9120                    }
9121                }, {
9122                    key: "destroy",
9123                    value: function destroy() {
9124                        this.$popover.remove();
9125                    }
9126                }, {
9127                    key: "update",
9128                    value: function update() {
9129                        // Prevent focusing on editable when invoke('code') is executed
9130                        if (!this.context.invoke('editor.hasFocus')) {
9131                            this.hide();
9132                            return;
9133                        }
9134
9135                        var rng = this.context.invoke('editor.getLastRange');
9136
9137                        if (rng.isCollapsed() && rng.isOnAnchor()) {
9138                            var anchor = dom.ancestor(rng.sc, dom.isAnchor);
9139                            var href = external_jQuery_default()(anchor).attr('href');
9140                            this.$popover.find('a').attr('href', href).text(href);
9141                            var pos = dom.posFromPlaceholder(anchor);
9142                            var containerOffset = external_jQuery_default()(this.options.container).offset();
9143                            pos.top -= containerOffset.top;
9144                            pos.left -= containerOffset.left;
9145                            this.$popover.css({
9146                                display: 'block',
9147                                left: pos.left,
9148                                top: pos.top
9149                            });
9150                        } else {
9151                            this.hide();
9152                        }
9153                    }
9154                }, {
9155                    key: "hide",
9156                    value: function hide() {
9157                        this.$popover.hide();
9158                    }
9159                }]);
9160
9161                return LinkPopover;
9162            }();
9163
9164
9165            ;// CONCATENATED MODULE: ./src/js/module/ImageDialog.js
9166            function ImageDialog_classCallCheck(instance, Constructor) {
9167                if (!(instance instanceof Constructor)) {
9168                    throw new TypeError("Cannot call a class as a function");
9169                }
9170            }
9171
9172            function ImageDialog_defineProperties(target, props) {
9173                for (var i = 0; i < props.length; i++) {
9174                    var descriptor = props[i];
9175                    descriptor.enumerable = descriptor.enumerable || false;
9176                    descriptor.configurable = true;
9177                    if ("value" in descriptor) descriptor.writable = true;
9178                    Object.defineProperty(target, descriptor.key, descriptor);
9179                }
9180            }
9181
9182            function ImageDialog_createClass(Constructor, protoProps, staticProps) {
9183                if (protoProps) ImageDialog_defineProperties(Constructor.prototype, protoProps);
9184                if (staticProps) ImageDialog_defineProperties(Constructor, staticProps);
9185                return Constructor;
9186            }
9187
9188
9189            var ImageDialog = /*#__PURE__*/function () {
9190                function ImageDialog(context) {
9191                    ImageDialog_classCallCheck(this, ImageDialog);
9192
9193                    this.context = context;
9194                    this.ui = (external_jQuery_default()).summernote.ui;
9195                    this.$body = external_jQuery_default()(document.body);
9196                    this.$editor = context.layoutInfo.editor;
9197                    this.options = context.options;
9198                    this.lang = this.options.langInfo;
9199                }
9200
9201                ImageDialog_createClass(ImageDialog, [{
9202                    key: "initialize",
9203                    value: function initialize() {
9204                        var imageLimitation = '';
9205
9206                        if (this.options.maximumImageFileSize) {
9207                            var unit = Math.floor(Math.log(this.options.maximumImageFileSize) / Math.log(1024));
9208                            var readableSize = (this.options.maximumImageFileSize / Math.pow(1024, unit)).toFixed(2) * 1 + ' ' + ' KMGTP'[unit] + 'B';
9209                            imageLimitation = "<small>".concat(this.lang.image.maximumFileSize + ' : ' + readableSize, "</small>");
9210                        }
9211
9212                        var $container = this.options.dialogsInBody ? this.$body : this.options.container;
9213                        var body = ['<div class="form-group note-form-group note-group-select-from-files">', '<label for="note-dialog-image-file-' + this.options.id + '" class="note-form-label">' + this.lang.image.selectFromFiles + '</label>', '<input id="note-dialog-image-file-' + this.options.id + '" class="note-image-input form-control-file note-form-control note-input" ', ' type="file" name="files" accept="' + this.options.acceptImageFileTypes + '" multiple="multiple"/>', imageLimitation, '</div>', '<div class="form-group note-group-image-url">', '<label for="note-dialog-image-url-' + this.options.id + '" class="note-form-label">' + this.lang.image.url + '</label>', '<input id="note-dialog-image-url-' + this.options.id + '" class="note-image-url form-control note-form-control note-input" type="text"/>', '</div>'].join('');
9214                        var buttonClass = 'btn btn-primary note-btn note-btn-primary note-image-btn';
9215                        var footer = "<input type=\"button\" href=\"#\" class=\"".concat(buttonClass, "\" value=\"").concat(this.lang.image.insert, "\" disabled>");
9216                        this.$dialog = this.ui.dialog({
9217                            title: this.lang.image.insert,
9218                            fade: this.options.dialogsFade,
9219                            body: body,
9220                            footer: footer
9221                        }).render().appendTo($container);
9222                    }
9223                }, {
9224                    key: "destroy",
9225                    value: function destroy() {
9226                        this.ui.hideDialog(this.$dialog);
9227                        this.$dialog.remove();
9228                    }
9229                }, {
9230                    key: "bindEnterKey",
9231                    value: function bindEnterKey($input, $btn) {
9232                        $input.on('keypress', function (event) {
9233                            if (event.keyCode === key.code.ENTER) {
9234                                event.preventDefault();
9235                                $btn.trigger('click');
9236                            }
9237                        });
9238                    }
9239                }, {
9240                    key: "show",
9241                    value: function show() {
9242                        var _this = this;
9243
9244                        this.context.invoke('editor.saveRange');
9245                        this.showImageDialog().then(function (data) {
9246                            // [workaround] hide dialog before restore range for IE range focus
9247                            _this.ui.hideDialog(_this.$dialog);
9248
9249                            _this.context.invoke('editor.restoreRange');
9250
9251                            if (typeof data === 'string') {
9252                                // image url
9253                                // If onImageLinkInsert set,
9254                                if (_this.options.callbacks.onImageLinkInsert) {
9255                                    _this.context.triggerEvent('image.link.insert', data);
9256                                } else {
9257                                    _this.context.invoke('editor.insertImage', data);
9258                                }
9259                            } else {
9260                                // array of files
9261                                _this.context.invoke('editor.insertImagesOrCallback', data);
9262                            }
9263                        }).fail(function () {
9264                            _this.context.invoke('editor.restoreRange');
9265                        });
9266                    }
9267                    /**
9268                     * show image dialog
9269                     *
9270                     * @param {jQuery} $dialog
9271                     * @return {Promise}
9272                     */
9273
9274                }, {
9275                    key: "showImageDialog",
9276                    value: function showImageDialog() {
9277                        var _this2 = this;
9278
9279                        return external_jQuery_default().Deferred(function (deferred) {
9280                            var $imageInput = _this2.$dialog.find('.note-image-input');
9281
9282                            var $imageUrl = _this2.$dialog.find('.note-image-url');
9283
9284                            var $imageBtn = _this2.$dialog.find('.note-image-btn');
9285
9286                            _this2.ui.onDialogShown(_this2.$dialog, function () {
9287                                _this2.context.triggerEvent('dialog.shown'); // Cloning imageInput to clear element.
9288
9289
9290                                $imageInput.replaceWith($imageInput.clone().on('change', function (event) {
9291                                    deferred.resolve(event.target.files || event.target.value);
9292                                }).val(''));
9293                                $imageUrl.on('input paste propertychange', function () {
9294                                    _this2.ui.toggleBtn($imageBtn, $imageUrl.val());
9295                                }).val('');
9296
9297                                if (!env.isSupportTouch) {
9298                                    $imageUrl.trigger('focus');
9299                                }
9300
9301                                $imageBtn.click(function (event) {
9302                                    event.preventDefault();
9303                                    deferred.resolve($imageUrl.val());
9304                                });
9305
9306                                _this2.bindEnterKey($imageUrl, $imageBtn);
9307                            });
9308
9309                            _this2.ui.onDialogHidden(_this2.$dialog, function () {
9310                                $imageInput.off();
9311                                $imageUrl.off();
9312                                $imageBtn.off();
9313
9314                                if (deferred.state() === 'pending') {
9315                                    deferred.reject();
9316                                }
9317                            });
9318
9319                            _this2.ui.showDialog(_this2.$dialog);
9320                        });
9321                    }
9322                }]);
9323
9324                return ImageDialog;
9325            }();
9326
9327
9328            ;// CONCATENATED MODULE: ./src/js/module/ImagePopover.js
9329            function ImagePopover_classCallCheck(instance, Constructor) {
9330                if (!(instance instanceof Constructor)) {
9331                    throw new TypeError("Cannot call a class as a function");
9332                }
9333            }
9334
9335            function ImagePopover_defineProperties(target, props) {
9336                for (var i = 0; i < props.length; i++) {
9337                    var descriptor = props[i];
9338                    descriptor.enumerable = descriptor.enumerable || false;
9339                    descriptor.configurable = true;
9340                    if ("value" in descriptor) descriptor.writable = true;
9341                    Object.defineProperty(target, descriptor.key, descriptor);
9342                }
9343            }
9344
9345            function ImagePopover_createClass(Constructor, protoProps, staticProps) {
9346                if (protoProps) ImagePopover_defineProperties(Constructor.prototype, protoProps);
9347                if (staticProps) ImagePopover_defineProperties(Constructor, staticProps);
9348                return Constructor;
9349            }
9350
9351
9352            /**
9353             * Image popover module
9354             *  mouse events that show/hide popover will be handled by Handle.js.
9355             *  Handle.js will receive the events and invoke 'imagePopover.update'.
9356             */
9357
9358            var ImagePopover = /*#__PURE__*/function () {
9359                function ImagePopover(context) {
9360                    var _this = this;
9361
9362                    ImagePopover_classCallCheck(this, ImagePopover);
9363
9364                    this.context = context;
9365                    this.ui = (external_jQuery_default()).summernote.ui;
9366                    this.editable = context.layoutInfo.editable[0];
9367                    this.options = context.options;
9368                    this.events = {
9369                        'summernote.disable summernote.dialog.shown': function summernoteDisableSummernoteDialogShown() {
9370                            _this.hide();
9371                        },
9372                        'summernote.blur': function summernoteBlur(we, e) {
9373                            if (e.originalEvent && e.originalEvent.relatedTarget) {
9374                                if (!_this.$popover[0].contains(e.originalEvent.relatedTarget)) {
9375                                    _this.hide();
9376                                }
9377                            } else {
9378                                _this.hide();
9379                            }
9380                        }
9381                    };
9382                }
9383
9384                ImagePopover_createClass(ImagePopover, [{
9385                    key: "shouldInitialize",
9386                    value: function shouldInitialize() {
9387                        return !lists.isEmpty(this.options.popover.image);
9388                    }
9389                }, {
9390                    key: "initialize",
9391                    value: function initialize() {
9392                        this.$popover = this.ui.popover({
9393                            className: 'note-image-popover'
9394                        }).render().appendTo(this.options.container);
9395                        var $content = this.$popover.find('.popover-content,.note-popover-content');
9396                        this.context.invoke('buttons.build', $content, this.options.popover.image);
9397                        this.$popover.on('mousedown', function (e) {
9398                            e.preventDefault();
9399                        });
9400                    }
9401                }, {
9402                    key: "destroy",
9403                    value: function destroy() {
9404                        this.$popover.remove();
9405                    }
9406                }, {
9407                    key: "update",
9408                    value: function update(target, event) {
9409                        if (dom.isImg(target)) {
9410                            var position = external_jQuery_default()(target).offset();
9411                            var containerOffset = external_jQuery_default()(this.options.container).offset();
9412                            var pos = {};
9413
9414                            if (this.options.popatmouse) {
9415                                pos.left = event.pageX - 20;
9416                                pos.top = event.pageY;
9417                            } else {
9418                                pos = position;
9419                            }
9420
9421                            pos.top -= containerOffset.top;
9422                            pos.left -= containerOffset.left;
9423                            this.$popover.css({
9424                                display: 'block',
9425                                left: pos.left,
9426                                top: pos.top
9427                            });
9428                        } else {
9429                            this.hide();
9430                        }
9431                    }
9432                }, {
9433                    key: "hide",
9434                    value: function hide() {
9435                        this.$popover.hide();
9436                    }
9437                }]);
9438
9439                return ImagePopover;
9440            }();
9441
9442
9443            ;// CONCATENATED MODULE: ./src/js/module/TablePopover.js
9444            function TablePopover_classCallCheck(instance, Constructor) {
9445                if (!(instance instanceof Constructor)) {
9446                    throw new TypeError("Cannot call a class as a function");
9447                }
9448            }
9449
9450            function TablePopover_defineProperties(target, props) {
9451                for (var i = 0; i < props.length; i++) {
9452                    var descriptor = props[i];
9453                    descriptor.enumerable = descriptor.enumerable || false;
9454                    descriptor.configurable = true;
9455                    if ("value" in descriptor) descriptor.writable = true;
9456                    Object.defineProperty(target, descriptor.key, descriptor);
9457                }
9458            }
9459
9460            function TablePopover_createClass(Constructor, protoProps, staticProps) {
9461                if (protoProps) TablePopover_defineProperties(Constructor.prototype, protoProps);
9462                if (staticProps) TablePopover_defineProperties(Constructor, staticProps);
9463                return Constructor;
9464            }
9465
9466
9467            var TablePopover = /*#__PURE__*/function () {
9468                function TablePopover(context) {
9469                    var _this = this;
9470
9471                    TablePopover_classCallCheck(this, TablePopover);
9472
9473                    this.context = context;
9474                    this.ui = (external_jQuery_default()).summernote.ui;
9475                    this.options = context.options;
9476                    this.events = {
9477                        'summernote.mousedown': function summernoteMousedown(we, e) {
9478                            _this.update(e.target);
9479                        },
9480                        'summernote.keyup summernote.scroll summernote.change': function summernoteKeyupSummernoteScrollSummernoteChange() {
9481                            _this.update();
9482                        },
9483                        'summernote.disable summernote.dialog.shown': function summernoteDisableSummernoteDialogShown() {
9484                            _this.hide();
9485                        },
9486                        'summernote.blur': function summernoteBlur(we, e) {
9487                            if (e.originalEvent && e.originalEvent.relatedTarget) {
9488                                if (!_this.$popover[0].contains(e.originalEvent.relatedTarget)) {
9489                                    _this.hide();
9490                                }
9491                            } else {
9492                                _this.hide();
9493                            }
9494                        }
9495                    };
9496                }
9497
9498                TablePopover_createClass(TablePopover, [{
9499                    key: "shouldInitialize",
9500                    value: function shouldInitialize() {
9501                        return !lists.isEmpty(this.options.popover.table);
9502                    }
9503                }, {
9504                    key: "initialize",
9505                    value: function initialize() {
9506                        this.$popover = this.ui.popover({
9507                            className: 'note-table-popover'
9508                        }).render().appendTo(this.options.container);
9509                        var $content = this.$popover.find('.popover-content,.note-popover-content');
9510                        this.context.invoke('buttons.build', $content, this.options.popover.table); // [workaround] Disable Firefox's default table editor
9511
9512                        if (env.isFF) {
9513                            document.execCommand('enableInlineTableEditing', false, false);
9514                        }
9515
9516                        this.$popover.on('mousedown', function (e) {
9517                            e.preventDefault();
9518                        });
9519                    }
9520                }, {
9521                    key: "destroy",
9522                    value: function destroy() {
9523                        this.$popover.remove();
9524                    }
9525                }, {
9526                    key: "update",
9527                    value: function update(target) {
9528                        if (this.context.isDisabled()) {
9529                            return false;
9530                        }
9531
9532                        var isCell = dom.isCell(target) || dom.isCell(target === null || target === void 0 ? void 0 : target.parentElement);
9533
9534                        if (isCell) {
9535                            var pos = dom.posFromPlaceholder(target);
9536                            var containerOffset = external_jQuery_default()(this.options.container).offset();
9537                            pos.top -= containerOffset.top;
9538                            pos.left -= containerOffset.left;
9539                            this.$popover.css({
9540                                display: 'block',
9541                                left: pos.left,
9542                                top: pos.top
9543                            });
9544                        } else {
9545                            this.hide();
9546                        }
9547
9548                        return isCell;
9549                    }
9550                }, {
9551                    key: "hide",
9552                    value: function hide() {
9553                        this.$popover.hide();
9554                    }
9555                }]);
9556
9557                return TablePopover;
9558            }();
9559
9560
9561            ;// CONCATENATED MODULE: ./src/js/module/VideoDialog.js
9562            function VideoDialog_classCallCheck(instance, Constructor) {
9563                if (!(instance instanceof Constructor)) {
9564                    throw new TypeError("Cannot call a class as a function");
9565                }
9566            }
9567
9568            function VideoDialog_defineProperties(target, props) {
9569                for (var i = 0; i < props.length; i++) {
9570                    var descriptor = props[i];
9571                    descriptor.enumerable = descriptor.enumerable || false;
9572                    descriptor.configurable = true;
9573                    if ("value" in descriptor) descriptor.writable = true;
9574                    Object.defineProperty(target, descriptor.key, descriptor);
9575                }
9576            }
9577
9578            function VideoDialog_createClass(Constructor, protoProps, staticProps) {
9579                if (protoProps) VideoDialog_defineProperties(Constructor.prototype, protoProps);
9580                if (staticProps) VideoDialog_defineProperties(Constructor, staticProps);
9581                return Constructor;
9582            }
9583
9584
9585            var VideoDialog = /*#__PURE__*/function () {
9586                function VideoDialog(context) {
9587                    VideoDialog_classCallCheck(this, VideoDialog);
9588
9589                    this.context = context;
9590                    this.ui = (external_jQuery_default()).summernote.ui;
9591                    this.$body = external_jQuery_default()(document.body);
9592                    this.$editor = context.layoutInfo.editor;
9593                    this.options = context.options;
9594                    this.lang = this.options.langInfo;
9595                }
9596
9597                VideoDialog_createClass(VideoDialog, [{
9598                    key: "initialize",
9599                    value: function initialize() {
9600                        var $container = this.options.dialogsInBody ? this.$body : this.options.container;
9601                        var body = ['<div class="form-group note-form-group row-fluid">', "<label for=\"note-dialog-video-url-".concat(this.options.id, "\" class=\"note-form-label\">").concat(this.lang.video.url, " <small class=\"text-muted\">").concat(this.lang.video.providers, "</small></label>"), "<input id=\"note-dialog-video-url-".concat(this.options.id, "\" class=\"note-video-url form-control note-form-control note-input\" type=\"text\"/>"), '</div>'].join('');
9602                        var buttonClass = 'btn btn-primary note-btn note-btn-primary note-video-btn';
9603                        var footer = "<input type=\"button\" href=\"#\" class=\"".concat(buttonClass, "\" value=\"").concat(this.lang.video.insert, "\" disabled>");
9604                        this.$dialog = this.ui.dialog({
9605                            title: this.lang.video.insert,
9606                            fade: this.options.dialogsFade,
9607                            body: body,
9608                            footer: footer
9609                        }).render().appendTo($container);
9610                    }
9611                }, {
9612                    key: "destroy",
9613                    value: function destroy() {
9614                        this.ui.hideDialog(this.$dialog);
9615                        this.$dialog.remove();
9616                    }
9617                }, {
9618                    key: "bindEnterKey",
9619                    value: function bindEnterKey($input, $btn) {
9620                        $input.on('keypress', function (event) {
9621                            if (event.keyCode === key.code.ENTER) {
9622                                event.preventDefault();
9623                                $btn.trigger('click');
9624                            }
9625                        });
9626                    }
9627                }, {
9628                    key: "createVideoNode",
9629                    value: function createVideoNode(url) {
9630                        // video url patterns(youtube, instagram, vimeo, dailymotion, youku, peertube, mp4, ogg, webm)
9631                        var ytRegExp = /\/\/(?:(?:www|m)\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))([\w|-]{11})(?:(?:[\?&]t=)(\S+))?$/;
9632                        var ytRegExpForStart = /^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/;
9633                        var ytMatch = url.match(ytRegExp);
9634                        var gdRegExp = /(?:\.|\/\/)drive\.google\.com\/file\/d\/(.[a-zA-Z0-9_-]*)\/view/;
9635                        var gdMatch = url.match(gdRegExp);
9636                        var igRegExp = /(?:www\.|\/\/)instagram\.com\/p\/(.[a-zA-Z0-9_-]*)/;
9637                        var igMatch = url.match(igRegExp);
9638                        var vRegExp = /\/\/vine\.co\/v\/([a-zA-Z0-9]+)/;
9639                        var vMatch = url.match(vRegExp);
9640                        var vimRegExp = /\/\/(player\.)?vimeo\.com\/([a-z]*\/)*(\d+)[?]?.*/;
9641                        var vimMatch = url.match(vimRegExp);
9642                        var dmRegExp = /.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/;
9643                        var dmMatch = url.match(dmRegExp);
9644                        var youkuRegExp = /\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/;
9645                        var youkuMatch = url.match(youkuRegExp);
9646                        var peerTubeRegExp = /\/\/(.*)\/videos\/watch\/([^?]*)(?:\?(?:start=(\w*))?(?:&stop=(\w*))?(?:&loop=([10]))?(?:&autoplay=([10]))?(?:&muted=([10]))?)?/;
9647                        var peerTubeMatch = url.match(peerTubeRegExp);
9648                        var qqRegExp = /\/\/v\.qq\.com.*?vid=(.+)/;
9649                        var qqMatch = url.match(qqRegExp);
9650                        var qqRegExp2 = /\/\/v\.qq\.com\/x?\/?(page|cover).*?\/([^\/]+)\.html\??.*/;
9651                        var qqMatch2 = url.match(qqRegExp2);
9652                        var mp4RegExp = /^.+.(mp4|m4v)$/;
9653                        var mp4Match = url.match(mp4RegExp);
9654                        var oggRegExp = /^.+.(ogg|ogv)$/;
9655                        var oggMatch = url.match(oggRegExp);
9656                        var webmRegExp = /^.+.(webm)$/;
9657                        var webmMatch = url.match(webmRegExp);
9658                        var fbRegExp = /(?:www\.|\/\/)facebook\.com\/([^\/]+)\/videos\/([0-9]+)/;
9659                        var fbMatch = url.match(fbRegExp);
9660                        var $video;
9661
9662                        if (ytMatch && ytMatch[1].length === 11) {
9663                            var youtubeId = ytMatch[1];
9664                            var start = 0;
9665
9666                            if (typeof ytMatch[2] !== 'undefined') {
9667                                var ytMatchForStart = ytMatch[2].match(ytRegExpForStart);
9668
9669                                if (ytMatchForStart) {
9670                                    for (var n = [3600, 60, 1], i = 0, r = n.length; i < r; i++) {
9671                                        start += typeof ytMatchForStart[i + 1] !== 'undefined' ? n[i] * parseInt(ytMatchForStart[i + 1], 10) : 0;
9672                                    }
9673                                }
9674                            }
9675
9676                            $video = external_jQuery_default()('<iframe>').attr('frameborder', 0).attr('src', '//www.youtube.com/embed/' + youtubeId + (start > 0 ? '?start=' + start : '')).attr('width', '640').attr('height', '360');
9677                        } else if (gdMatch && gdMatch[0].length) {
9678                            $video = external_jQuery_default()('<iframe>').attr('frameborder', 0).attr('src', 'https://drive.google.com/file/d/' + gdMatch[1] + '/preview').attr('width', '640').attr('height', '480');
9679                        } else if (igMatch && igMatch[0].length) {
9680                            $video = external_jQuery_default()('<iframe>').attr('frameborder', 0).attr('src', 'https://instagram.com/p/' + igMatch[1] + '/embed/').attr('width', '612').attr('height', '710').attr('scrolling', 'no').attr('allowtransparency', 'true');
9681                        } else if (vMatch && vMatch[0].length) {
9682                            $video = external_jQuery_default()('<iframe>').attr('frameborder', 0).attr('src', vMatch[0] + '/embed/simple').attr('width', '600').attr('height', '600').attr('class', 'vine-embed');
9683                        } else if (vimMatch && vimMatch[3].length) {
9684                            $video = external_jQuery_default()('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>').attr('frameborder', 0).attr('src', '//player.vimeo.com/video/' + vimMatch[3]).attr('width', '640').attr('height', '360');
9685                        } else if (dmMatch && dmMatch[2].length) {
9686                            $video = external_jQuery_default()('<iframe>').attr('frameborder', 0).attr('src', '//www.dailymotion.com/embed/video/' + dmMatch[2]).attr('width', '640').attr('height', '360');
9687                        } else if (youkuMatch && youkuMatch[1].length) {
9688                            $video = external_jQuery_default()('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>').attr('frameborder', 0).attr('height', '498').attr('width', '510').attr('src', '//player.youku.com/embed/' + youkuMatch[1]);
9689                        } else if (peerTubeMatch && peerTubeMatch[0].length) {
9690                            var begin = 0;
9691                            if (peerTubeMatch[2] !== 'undefined') begin = peerTubeMatch[2];
9692                            var end = 0;
9693                            if (peerTubeMatch[3] !== 'undefined') end = peerTubeMatch[3];
9694                            var loop = 0;
9695                            if (peerTubeMatch[4] !== 'undefined') loop = peerTubeMatch[4];
9696                            var autoplay = 0;
9697                            if (peerTubeMatch[5] !== 'undefined') autoplay = peerTubeMatch[5];
9698                            var muted = 0;
9699                            if (peerTubeMatch[6] !== 'undefined') muted = peerTubeMatch[6];
9700                            $video = external_jQuery_default()('<iframe allowfullscreen sandbox="allow-same-origin allow-scripts allow-popups">').attr('frameborder', 0).attr('src', '//' + peerTubeMatch[1] + '/videos/embed/' + peerTubeMatch[2] + "?loop=" + loop + "&autoplay=" + autoplay + "&muted=" + muted + (begin > 0 ? '&start=' + begin : '') + (end > 0 ? '&end=' + start : '')).attr('width', '560').attr('height', '315');
9701                        } else if (qqMatch && qqMatch[1].length || qqMatch2 && qqMatch2[2].length) {
9702                            var vid = qqMatch && qqMatch[1].length ? qqMatch[1] : qqMatch2[2];
9703                            $video = external_jQuery_default()('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>').attr('frameborder', 0).attr('height', '310').attr('width', '500').attr('src', 'https://v.qq.com/txp/iframe/player.html?vid=' + vid + '&amp;auto=0');
9704                        } else if (mp4Match || oggMatch || webmMatch) {
9705                            $video = external_jQuery_default()('<video controls>').attr('src', url).attr('width', '640').attr('height', '360');
9706                        } else if (fbMatch && fbMatch[0].length) {
9707                            $video = external_jQuery_default()('<iframe>').attr('frameborder', 0).attr('src', 'https://www.facebook.com/plugins/video.php?href=' + encodeURIComponent(fbMatch[0]) + '&show_text=0&width=560').attr('width', '560').attr('height', '301').attr('scrolling', 'no').attr('allowtransparency', 'true');
9708                        } else {
9709                            // this is not a known video link. Now what, Cat? Now what?
9710                            return false;
9711                        }
9712
9713                        $video.addClass('note-video-clip');
9714                        return $video[0];
9715                    }
9716                }, {
9717                    key: "show",
9718                    value: function show() {
9719                        var _this = this;
9720
9721                        var text = this.context.invoke('editor.getSelectedText');
9722                        this.context.invoke('editor.saveRange');
9723                        this.showVideoDialog(text).then(function (url) {
9724                            // [workaround] hide dialog before restore range for IE range focus
9725                            _this.ui.hideDialog(_this.$dialog);
9726
9727                            _this.context.invoke('editor.restoreRange'); // build node
9728
9729
9730                            var $node = _this.createVideoNode(url);
9731
9732                            if ($node) {
9733                                // insert video node
9734                                _this.context.invoke('editor.insertNode', $node);
9735                            }
9736                        }).fail(function () {
9737                            _this.context.invoke('editor.restoreRange');
9738                        });
9739                    }
9740                    /**
9741                     * show video dialog
9742                     *
9743                     * @param {jQuery} $dialog
9744                     * @return {Promise}
9745                     */
9746
9747                }, {
9748                    key: "showVideoDialog",
9749                    value: function showVideoDialog() {
9750                        var _this2 = this;
9751
9752                        return external_jQuery_default().Deferred(function (deferred) {
9753                            var $videoUrl = _this2.$dialog.find('.note-video-url');
9754
9755                            var $videoBtn = _this2.$dialog.find('.note-video-btn');
9756
9757                            _this2.ui.onDialogShown(_this2.$dialog, function () {
9758                                _this2.context.triggerEvent('dialog.shown');
9759
9760                                $videoUrl.on('input paste propertychange', function () {
9761                                    _this2.ui.toggleBtn($videoBtn, $videoUrl.val());
9762                                });
9763
9764                                if (!env.isSupportTouch) {
9765                                    $videoUrl.trigger('focus');
9766                                }
9767
9768                                $videoBtn.click(function (event) {
9769                                    event.preventDefault();
9770                                    deferred.resolve($videoUrl.val());
9771                                });
9772
9773                                _this2.bindEnterKey($videoUrl, $videoBtn);
9774                            });
9775
9776                            _this2.ui.onDialogHidden(_this2.$dialog, function () {
9777                                $videoUrl.off();
9778                                $videoBtn.off();
9779
9780                                if (deferred.state() === 'pending') {
9781                                    deferred.reject();
9782                                }
9783                            });
9784
9785                            _this2.ui.showDialog(_this2.$dialog);
9786                        });
9787                    }
9788                }]);
9789
9790                return VideoDialog;
9791            }();
9792
9793
9794            ;// CONCATENATED MODULE: ./src/js/module/HelpDialog.js
9795            function HelpDialog_classCallCheck(instance, Constructor) {
9796                if (!(instance instanceof Constructor)) {
9797                    throw new TypeError("Cannot call a class as a function");
9798                }
9799            }
9800
9801            function HelpDialog_defineProperties(target, props) {
9802                for (var i = 0; i < props.length; i++) {
9803                    var descriptor = props[i];
9804                    descriptor.enumerable = descriptor.enumerable || false;
9805                    descriptor.configurable = true;
9806                    if ("value" in descriptor) descriptor.writable = true;
9807                    Object.defineProperty(target, descriptor.key, descriptor);
9808                }
9809            }
9810
9811            function HelpDialog_createClass(Constructor, protoProps, staticProps) {
9812                if (protoProps) HelpDialog_defineProperties(Constructor.prototype, protoProps);
9813                if (staticProps) HelpDialog_defineProperties(Constructor, staticProps);
9814                return Constructor;
9815            }
9816
9817
9818            var HelpDialog = /*#__PURE__*/function () {
9819                function HelpDialog(context) {
9820                    HelpDialog_classCallCheck(this, HelpDialog);
9821
9822                    this.context = context;
9823                    this.ui = (external_jQuery_default()).summernote.ui;
9824                    this.$body = external_jQuery_default()(document.body);
9825                    this.$editor = context.layoutInfo.editor;
9826                    this.options = context.options;
9827                    this.lang = this.options.langInfo;
9828                }
9829
9830                HelpDialog_createClass(HelpDialog, [{
9831                    key: "initialize",
9832                    value: function initialize() {
9833                        var $container = this.options.dialogsInBody ? this.$body : this.options.container;
9834                        var body = ['<p class="text-center">', '<a href="http://summernote.org/" target="_blank" rel="noopener noreferrer">Summernote 0.8.20</a> · ', '<a href="https://github.com/summernote/summernote" target="_blank" rel="noopener noreferrer">Project</a> · ', '<a href="https://github.com/summernote/summernote/issues" target="_blank" rel="noopener noreferrer">Issues</a>', '</p>'].join('');
9835                        this.$dialog = this.ui.dialog({
9836                            title: this.lang.options.help,
9837                            fade: this.options.dialogsFade,
9838                            body: this.createShortcutList(),
9839                            footer: body,
9840                            callback: function callback($node) {
vendor: 2,571 bytes, lines 9841-9897
9841                                $node.find('.modal-body,.note-modal-body').css({
9842                                    'max-height': 300,
9843                                    'overflow': 'scroll'
9844                                });
9845                            }
9846                        }).render().appendTo($container);
9847                    }
9848                }, {
9849                    key: "destroy",
9850                    value: function destroy() {
9851                        this.ui.hideDialog(this.$dialog);
9852                        this.$dialog.remove();
9853                    }
9854                }, {
9855                    key: "createShortcutList",
9856                    value: function createShortcutList() {
9857                        var _this = this;
9858
9859                        var keyMap = this.options.keyMap[env.isMac ? 'mac' : 'pc'];
9860                        return Object.keys(keyMap).map(function (key) {
9861                            var command = keyMap[key];
9862                            var $row = external_jQuery_default()('<div><div class="help-list-item"></div></div>');
9863                            $row.append(external_jQuery_default()('<label><kbd>' + key + '</kdb></label>').css({
9864                                'width': 180,
9865                                'margin-right': 10
9866                            })).append(external_jQuery_default()('<span></span>').html(_this.context.memo('help.' + command) || command));
9867                            return $row.html();
9868                        }).join('');
9869                    }
9870                    /**
9871                     * show help dialog
9872                     *
9873                     * @return {Promise}
9874                     */
9875
9876                }, {
9877                    key: "showHelpDialog",
9878                    value: function showHelpDialog() {
9879                        var _this2 = this;
9880
9881                        return external_jQuery_default().Deferred(function (deferred) {
9882                            _this2.ui.onDialogShown(_this2.$dialog, function () {
9883                                _this2.context.triggerEvent('dialog.shown');
9884
9885                                deferred.resolve();
9886                            });
9887
9888                            _this2.ui.showDialog(_this2.$dialog);
9889                        }).promise();
9890                    }
9891                }, {
9892                    key: "show",
9893                    value: function show() {
9894                        var _this3 = this;
9895
9896                        this.context.invoke('editor.saveRange');
9897                        this.showHelpDialog().then(function () {
vendor: 34,740 bytes, lines 9898-10591
9898                            _this3.context.invoke('editor.restoreRange');
9899                        });
9900                    }
9901                }]);
9902
9903                return HelpDialog;
9904            }();
9905
9906
9907            ;// CONCATENATED MODULE: ./src/js/module/AirPopover.js
9908            function AirPopover_classCallCheck(instance, Constructor) {
9909                if (!(instance instanceof Constructor)) {
9910                    throw new TypeError("Cannot call a class as a function");
9911                }
9912            }
9913
9914            function AirPopover_defineProperties(target, props) {
9915                for (var i = 0; i < props.length; i++) {
9916                    var descriptor = props[i];
9917                    descriptor.enumerable = descriptor.enumerable || false;
9918                    descriptor.configurable = true;
9919                    if ("value" in descriptor) descriptor.writable = true;
9920                    Object.defineProperty(target, descriptor.key, descriptor);
9921                }
9922            }
9923
9924            function AirPopover_createClass(Constructor, protoProps, staticProps) {
9925                if (protoProps) AirPopover_defineProperties(Constructor.prototype, protoProps);
9926                if (staticProps) AirPopover_defineProperties(Constructor, staticProps);
9927                return Constructor;
9928            }
9929
9930
9931            var AIRMODE_POPOVER_X_OFFSET = -5;
9932            var AIRMODE_POPOVER_Y_OFFSET = 5;
9933
9934            var AirPopover = /*#__PURE__*/function () {
9935                function AirPopover(context) {
9936                    var _this = this;
9937
9938                    AirPopover_classCallCheck(this, AirPopover);
9939
9940                    this.context = context;
9941                    this.ui = (external_jQuery_default()).summernote.ui;
9942                    this.options = context.options;
9943                    this.hidable = true;
9944                    this.onContextmenu = false;
9945                    this.pageX = null;
9946                    this.pageY = null;
9947                    this.events = {
9948                        'summernote.contextmenu': function summernoteContextmenu(e) {
9949                            if (_this.options.editing) {
9950                                e.preventDefault();
9951                                e.stopPropagation();
9952                                _this.onContextmenu = true;
9953
9954                                _this.update(true);
9955                            }
9956                        },
9957                        'summernote.mousedown': function summernoteMousedown(we, e) {
9958                            _this.pageX = e.pageX;
9959                            _this.pageY = e.pageY;
9960                        },
9961                        'summernote.keyup summernote.mouseup summernote.scroll': function summernoteKeyupSummernoteMouseupSummernoteScroll(we, e) {
9962                            if (_this.options.editing && !_this.onContextmenu) {
9963                                _this.pageX = e.pageX;
9964                                _this.pageY = e.pageY;
9965
9966                                _this.update();
9967                            }
9968
9969                            _this.onContextmenu = false;
9970                        },
9971                        'summernote.disable summernote.change summernote.dialog.shown summernote.blur': function summernoteDisableSummernoteChangeSummernoteDialogShownSummernoteBlur() {
9972                            _this.hide();
9973                        },
9974                        'summernote.focusout': function summernoteFocusout() {
9975                            if (!_this.$popover.is(':active,:focus')) {
9976                                _this.hide();
9977                            }
9978                        }
9979                    };
9980                }
9981
9982                AirPopover_createClass(AirPopover, [{
9983                    key: "shouldInitialize",
9984                    value: function shouldInitialize() {
9985                        return this.options.airMode && !lists.isEmpty(this.options.popover.air);
9986                    }
9987                }, {
9988                    key: "initialize",
9989                    value: function initialize() {
9990                        var _this2 = this;
9991
9992                        this.$popover = this.ui.popover({
9993                            className: 'note-air-popover'
9994                        }).render().appendTo(this.options.container);
9995                        var $content = this.$popover.find('.popover-content');
9996                        this.context.invoke('buttons.build', $content, this.options.popover.air); // disable hiding this popover preemptively by 'summernote.blur' event.
9997
9998                        this.$popover.on('mousedown', function () {
9999                            _this2.hidable = false;
10000                        }); // (re-)enable hiding after 'summernote.blur' has been handled (aka. ignored).
10001
10002                        this.$popover.on('mouseup', function () {
10003                            _this2.hidable = true;
10004                        });
10005                    }
10006                }, {
10007                    key: "destroy",
10008                    value: function destroy() {
10009                        this.$popover.remove();
10010                    }
10011                }, {
10012                    key: "update",
10013                    value: function update(forcelyOpen) {
10014                        var styleInfo = this.context.invoke('editor.currentStyle');
10015
10016                        if (styleInfo.range && (!styleInfo.range.isCollapsed() || forcelyOpen)) {
10017                            var rect = {
10018                                left: this.pageX,
10019                                top: this.pageY
10020                            };
10021                            var containerOffset = external_jQuery_default()(this.options.container).offset();
10022                            rect.top -= containerOffset.top;
10023                            rect.left -= containerOffset.left;
10024                            this.$popover.css({
10025                                display: 'block',
10026                                left: Math.max(rect.left, 0) + AIRMODE_POPOVER_X_OFFSET,
10027                                top: rect.top + AIRMODE_POPOVER_Y_OFFSET
10028                            });
10029                            this.context.invoke('buttons.updateCurrentStyle', this.$popover);
10030                        } else {
10031                            this.hide();
10032                        }
10033                    }
10034                }, {
10035                    key: "updateCodeview",
10036                    value: function updateCodeview(isCodeview) {
10037                        this.ui.toggleBtnActive(this.$popover.find('.btn-codeview'), isCodeview);
10038
10039                        if (isCodeview) {
10040                            this.hide();
10041                        }
10042                    }
10043                }, {
10044                    key: "hide",
10045                    value: function hide() {
10046                        if (this.hidable) {
10047                            this.$popover.hide();
10048                        }
10049                    }
10050                }]);
10051
10052                return AirPopover;
10053            }();
10054
10055
10056            ;// CONCATENATED MODULE: ./src/js/module/HintPopover.js
10057            function HintPopover_classCallCheck(instance, Constructor) {
10058                if (!(instance instanceof Constructor)) {
10059                    throw new TypeError("Cannot call a class as a function");
10060                }
10061            }
10062
10063            function HintPopover_defineProperties(target, props) {
10064                for (var i = 0; i < props.length; i++) {
10065                    var descriptor = props[i];
10066                    descriptor.enumerable = descriptor.enumerable || false;
10067                    descriptor.configurable = true;
10068                    if ("value" in descriptor) descriptor.writable = true;
10069                    Object.defineProperty(target, descriptor.key, descriptor);
10070                }
10071            }
10072
10073            function HintPopover_createClass(Constructor, protoProps, staticProps) {
10074                if (protoProps) HintPopover_defineProperties(Constructor.prototype, protoProps);
10075                if (staticProps) HintPopover_defineProperties(Constructor, staticProps);
10076                return Constructor;
10077            }
10078
10079
10080            var POPOVER_DIST = 5;
10081
10082            var HintPopover = /*#__PURE__*/function () {
10083                function HintPopover(context) {
10084                    var _this = this;
10085
10086                    HintPopover_classCallCheck(this, HintPopover);
10087
10088                    this.context = context;
10089                    this.ui = (external_jQuery_default()).summernote.ui;
10090                    this.$editable = context.layoutInfo.editable;
10091                    this.options = context.options;
10092                    this.hint = this.options.hint || [];
10093                    this.direction = this.options.hintDirection || 'bottom';
10094                    this.hints = Array.isArray(this.hint) ? this.hint : [this.hint];
10095                    this.events = {
10096                        'summernote.keyup': function summernoteKeyup(we, e) {
10097                            if (!e.isDefaultPrevented()) {
10098                                _this.handleKeyup(e);
10099                            }
10100                        },
10101                        'summernote.keydown': function summernoteKeydown(we, e) {
10102                            _this.handleKeydown(e);
10103                        },
10104                        'summernote.disable summernote.dialog.shown summernote.blur': function summernoteDisableSummernoteDialogShownSummernoteBlur() {
10105                            _this.hide();
10106                        }
10107                    };
10108                }
10109
10110                HintPopover_createClass(HintPopover, [{
10111                    key: "shouldInitialize",
10112                    value: function shouldInitialize() {
10113                        return this.hints.length > 0;
10114                    }
10115                }, {
10116                    key: "initialize",
10117                    value: function initialize() {
10118                        var _this2 = this;
10119
10120                        this.lastWordRange = null;
10121                        this.matchingWord = null;
10122                        this.$popover = this.ui.popover({
10123                            className: 'note-hint-popover',
10124                            hideArrow: true,
10125                            direction: ''
10126                        }).render().appendTo(this.options.container);
10127                        this.$popover.hide();
10128                        this.$content = this.$popover.find('.popover-content,.note-popover-content');
10129                        this.$content.on('click', '.note-hint-item', function (e) {
10130                            _this2.$content.find('.active').removeClass('active');
10131
10132                            external_jQuery_default()(e.currentTarget).addClass('active');
10133
10134                            _this2.replace();
10135                        });
10136                        this.$popover.on('mousedown', function (e) {
10137                            e.preventDefault();
10138                        });
10139                    }
10140                }, {
10141                    key: "destroy",
10142                    value: function destroy() {
10143                        this.$popover.remove();
10144                    }
10145                }, {
10146                    key: "selectItem",
10147                    value: function selectItem($item) {
10148                        this.$content.find('.active').removeClass('active');
10149                        $item.addClass('active');
10150                        this.$content[0].scrollTop = $item[0].offsetTop - this.$content.innerHeight() / 2;
10151                    }
10152                }, {
10153                    key: "moveDown",
10154                    value: function moveDown() {
10155                        var $current = this.$content.find('.note-hint-item.active');
10156                        var $next = $current.next();
10157
10158                        if ($next.length) {
10159                            this.selectItem($next);
10160                        } else {
10161                            var $nextGroup = $current.parent().next();
10162
10163                            if (!$nextGroup.length) {
10164                                $nextGroup = this.$content.find('.note-hint-group').first();
10165                            }
10166
10167                            this.selectItem($nextGroup.find('.note-hint-item').first());
10168                        }
10169                    }
10170                }, {
10171                    key: "moveUp",
10172                    value: function moveUp() {
10173                        var $current = this.$content.find('.note-hint-item.active');
10174                        var $prev = $current.prev();
10175
10176                        if ($prev.length) {
10177                            this.selectItem($prev);
10178                        } else {
10179                            var $prevGroup = $current.parent().prev();
10180
10181                            if (!$prevGroup.length) {
10182                                $prevGroup = this.$content.find('.note-hint-group').last();
10183                            }
10184
10185                            this.selectItem($prevGroup.find('.note-hint-item').last());
10186                        }
10187                    }
10188                }, {
10189                    key: "replace",
10190                    value: function replace() {
10191                        var $item = this.$content.find('.note-hint-item.active');
10192
10193                        if ($item.length) {
10194                            var node = this.nodeFromItem($item); // If matchingWord length = 0 -> capture OK / open hint / but as mention capture "" (\w*)
10195
10196                            if (this.matchingWord !== null && this.matchingWord.length === 0) {
10197                                this.lastWordRange.so = this.lastWordRange.eo; // Else si > 0 and normal case -> adjust range "before" for correct position of insertion
10198                            } else if (this.matchingWord !== null && this.matchingWord.length > 0 && !this.lastWordRange.isCollapsed()) {
10199                                var rangeCompute = this.lastWordRange.eo - this.lastWordRange.so - this.matchingWord.length;
10200
10201                                if (rangeCompute > 0) {
10202                                    this.lastWordRange.so += rangeCompute;
10203                                }
10204                            }
10205
10206                            this.lastWordRange.insertNode(node);
10207
10208                            if (this.options.hintSelect === 'next') {
10209                                var blank = document.createTextNode('');
10210                                external_jQuery_default()(node).after(blank);
10211                                range.createFromNodeBefore(blank).select();
10212                            } else {
10213                                range.createFromNodeAfter(node).select();
10214                            }
10215
10216                            this.lastWordRange = null;
10217                            this.hide();
10218                            this.context.invoke('editor.focus');
10219                            this.context.triggerEvent('change', this.$editable.html(), this.$editable);
10220                        }
10221                    }
10222                }, {
10223                    key: "nodeFromItem",
10224                    value: function nodeFromItem($item) {
10225                        var hint = this.hints[$item.data('index')];
10226                        var item = $item.data('item');
10227                        var node = hint.content ? hint.content(item) : item;
10228
10229                        if (typeof node === 'string') {
10230                            node = dom.createText(node);
10231                        }
10232
10233                        return node;
10234                    }
10235                }, {
10236                    key: "createItemTemplates",
10237                    value: function createItemTemplates(hintIdx, items) {
10238                        var hint = this.hints[hintIdx];
10239                        return items.map(function (item
10240                                                   /*, idx */
10241                        ) {
10242                            var $item = external_jQuery_default()('<div class="note-hint-item"></div>');
10243                            $item.append(hint.template ? hint.template(item) : item + '');
10244                            $item.data({
10245                                'index': hintIdx,
10246                                'item': item
10247                            });
10248                            return $item;
10249                        });
10250                    }
10251                }, {
10252                    key: "handleKeydown",
10253                    value: function handleKeydown(e) {
10254                        if (!this.$popover.is(':visible')) {
10255                            return;
10256                        }
10257
10258                        if (e.keyCode === key.code.ENTER) {
10259                            e.preventDefault();
10260                            this.replace();
10261                        } else if (e.keyCode === key.code.UP) {
10262                            e.preventDefault();
10263                            this.moveUp();
10264                        } else if (e.keyCode === key.code.DOWN) {
10265                            e.preventDefault();
10266                            this.moveDown();
10267                        }
10268                    }
10269                }, {
10270                    key: "searchKeyword",
10271                    value: function searchKeyword(index, keyword, callback) {
10272                        var hint = this.hints[index];
10273
10274                        if (hint && hint.match.test(keyword) && hint.search) {
10275                            var matches = hint.match.exec(keyword);
10276                            this.matchingWord = matches[0];
10277                            hint.search(matches[1], callback);
10278                        } else {
10279                            callback();
10280                        }
10281                    }
10282                }, {
10283                    key: "createGroup",
10284                    value: function createGroup(idx, keyword) {
10285                        var _this3 = this;
10286
10287                        var $group = external_jQuery_default()('<div class="note-hint-group note-hint-group-' + idx + '"></div>');
10288                        this.searchKeyword(idx, keyword, function (items) {
10289                            items = items || [];
10290
10291                            if (items.length) {
10292                                $group.html(_this3.createItemTemplates(idx, items));
10293
10294                                _this3.show();
10295                            }
10296                        });
10297                        return $group;
10298                    }
10299                }, {
10300                    key: "handleKeyup",
10301                    value: function handleKeyup(e) {
10302                        var _this4 = this;
10303
10304                        if (!lists.contains([key.code.ENTER, key.code.UP, key.code.DOWN], e.keyCode)) {
10305                            var _range = this.context.invoke('editor.getLastRange');
10306
10307                            var wordRange, keyword;
10308
10309                            if (this.options.hintMode === 'words') {
10310                                wordRange = _range.getWordsRange(_range);
10311                                keyword = wordRange.toString();
10312                                this.hints.forEach(function (hint) {
10313                                    if (hint.match.test(keyword)) {
10314                                        wordRange = _range.getWordsMatchRange(hint.match);
10315                                        return false;
10316                                    }
10317                                });
10318
10319                                if (!wordRange) {
10320                                    this.hide();
10321                                    return;
10322                                }
10323
10324                                keyword = wordRange.toString();
10325                            } else {
10326                                wordRange = _range.getWordRange();
10327                                keyword = wordRange.toString();
10328                            }
10329
10330                            if (this.hints.length && keyword) {
10331                                this.$content.empty();
10332                                var bnd = func.rect2bnd(lists.last(wordRange.getClientRects()));
10333                                var containerOffset = external_jQuery_default()(this.options.container).offset();
10334
10335                                if (bnd) {
10336                                    bnd.top -= containerOffset.top;
10337                                    bnd.left -= containerOffset.left;
10338                                    this.$popover.hide();
10339                                    this.lastWordRange = wordRange;
10340                                    this.hints.forEach(function (hint, idx) {
10341                                        if (hint.match.test(keyword)) {
10342                                            _this4.createGroup(idx, keyword).appendTo(_this4.$content);
10343                                        }
10344                                    }); // select first .note-hint-item
10345
10346                                    this.$content.find('.note-hint-item:first').addClass('active'); // set position for popover after group is created
10347
10348                                    if (this.direction === 'top') {
10349                                        this.$popover.css({
10350                                            left: bnd.left,
10351                                            top: bnd.top - this.$popover.outerHeight() - POPOVER_DIST
10352                                        });
10353                                    } else {
10354                                        this.$popover.css({
10355                                            left: bnd.left,
10356                                            top: bnd.top + bnd.height + POPOVER_DIST
10357                                        });
10358                                    }
10359                                }
10360                            } else {
10361                                this.hide();
10362                            }
10363                        }
10364                    }
10365                }, {
10366                    key: "show",
10367                    value: function show() {
10368                        this.$popover.show();
10369                    }
10370                }, {
10371                    key: "hide",
10372                    value: function hide() {
10373                        this.$popover.hide();
10374                    }
10375                }]);
10376
10377                return HintPopover;
10378            }();
10379
10380
10381            ;// CONCATENATED MODULE: ./src/js/settings.js
10382
10383
10384            (external_jQuery_default()).summernote = external_jQuery_default().extend((external_jQuery_default()).summernote, {
10385                version: '0.8.20',
10386                plugins: {},
10387                dom: dom,
10388                range: range,
10389                lists: lists,
10390                options: {
10391                    langInfo: (external_jQuery_default()).summernote.lang["en-US"],
10392                    editing: true,
10393                    modules: {
10394                        'editor': Editor,
10395                        'clipboard': Clipboard,
10396                        'dropzone': Dropzone,
10397                        'codeview': CodeView,
10398                        'statusbar': Statusbar,
10399                        'fullscreen': Fullscreen,
10400                        'handle': Handle,
10401                        // FIXME: HintPopover must be front of autolink
10402                        //  - Script error about range when Enter key is pressed on hint popover
10403                        'hintPopover': HintPopover,
10404                        'autoLink': AutoLink,
10405                        'autoSync': AutoSync,
10406                        'autoReplace': AutoReplace,
10407                        'placeholder': Placeholder,
10408                        'buttons': Buttons,
10409                        'toolbar': Toolbar,
10410                        'linkDialog': LinkDialog,
10411                        'linkPopover': LinkPopover,
10412                        'imageDialog': ImageDialog,
10413                        'imagePopover': ImagePopover,
10414                        'tablePopover': TablePopover,
10415                        'videoDialog': VideoDialog,
10416                        'helpDialog': HelpDialog,
10417                        'airPopover': AirPopover
10418                    },
10419                    buttons: {},
10420                    lang: 'en-US',
10421                    followingToolbar: false,
10422                    toolbarPosition: 'top',
10423                    otherStaticBar: '',
10424                    // toolbar
10425                    codeviewKeepButton: false,
10426                    toolbar: [['style', ['style']], ['font', ['bold', 'underline', 'clear']], ['fontname', ['fontname']], ['color', ['color']], ['para', ['ul', 'ol', 'paragraph']], ['table', ['table']], ['insert', ['link', 'picture', 'video','hr']], ['view', ['fullscreen', 'codeview', 'help']]],
10427                    // popover
10428                    popatmouse: true,
10429                    popover: {
10430                        image: [['resize', ['resizeFull', 'resizeHalf', 'resizeQuarter', 'resizeNone']], ['float', ['floatLeft', 'floatRight', 'floatNone']], ['remove', ['removeMedia']]],
10431                        link: [['link', ['linkDialogShow', 'unlink']]],
10432                        table: [['add', ['addRowDown', 'addRowUp', 'addColLeft', 'addColRight']], ['delete', ['deleteRow', 'deleteCol', 'deleteTable']]],
10433                        air: [['color', ['color']], ['font', ['bold', 'underline', 'clear']], ['para', ['ul', 'paragraph']], ['table', ['table']], ['insert', ['link', 'picture']], ['view', ['fullscreen', 'codeview']]]
10434                    },
10435                    // air mode: inline editor
10436                    airMode: false,
10437                    overrideContextMenu: false,
10438                    // TBD
10439                    width: null,
10440                    height: null,
10441                    linkTargetBlank: true,
10442                    useProtocol: true,
10443                    defaultProtocol: 'http://',
10444                    focus: false,
10445                    tabDisabled: false,
10446                    tabSize: 4,
10447                    styleWithCSS: false,
10448                    shortcuts: true,
10449                    textareaAutoSync: true,
10450                    tooltip: 'auto',
10451                    container: null,
10452                    maxTextLength: 0,
10453                    blockquoteBreakingLevel: 2,
10454                    spellCheck: true,
10455                    disableGrammar: false,
10456                    placeholder: null,
10457                    inheritPlaceholder: false,
10458                    // TODO: need to be documented
10459                    recordEveryKeystroke: false,
10460                    historyLimit: 200,
10461                    // TODO: need to be documented
10462                    showDomainOnlyForAutolink: false,
10463                    // TODO: need to be documented
10464                    hintMode: 'word',
10465                    hintSelect: 'after',
10466                    hintDirection: 'bottom',
10467                    styleTags: ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],
10468                    fontNames: ['Arial', 'Arial Black', 'Comic Sans MS', 'Courier New', 'Helvetica Neue', 'Helvetica', 'Impact', 'Lucida Grande', 'Tahoma', 'Times New Roman', 'Verdana'],
10469                    fontNamesIgnoreCheck: [],
10470                    addDefaultFonts: true,
10471                    fontSizes: ['8', '9', '10', '11', '12', '14', '18', '24', '36'],
10472                    fontSizeUnits: ['px', 'pt'],
10473                    // pallete colors(n x n)
10474                    colors: [['#000000', '#424242', '#636363', '#9C9C94', '#CEC6CE', '#EFEFEF', '#F7F7F7', '#FFFFFF'], ['#FF0000', '#FF9C00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', '#9C00FF', '#FF00FF'], ['#F7C6CE', '#FFE7CE', '#FFEFC6', '#D6EFD6', '#CEDEE7', '#CEE7F7', '#D6D6E7', '#E7D6DE'], ['#E79C9C', '#FFC69C', '#FFE79C', '#B5D6A5', '#A5C6CE', '#9CC6EF', '#B5A5D6', '#D6A5BD'], ['#E76363', '#F7AD6B', '#FFD663', '#94BD7B', '#73A5AD', '#6BADDE', '#8C7BC6', '#C67BA5'], ['#CE0000', '#E79439', '#EFC631', '#6BA54A', '#4A7B8C', '#3984C6', '#634AA5', '#A54A7B'], ['#9C0000', '#B56308', '#BD9400', '#397B21', '#104A5A', '#085294', '#311873', '#731842'], ['#630000', '#7B3900', '#846300', '#295218', '#083139', '#003163', '#21104A', '#4A1031']],
10475                    // http://chir.ag/projects/name-that-color/
10476                    colorsName: [['Black', 'Tundora', 'Dove Gray', 'Star Dust', 'Pale Slate', 'Gallery', 'Alabaster', 'White'], ['Red', 'Orange Peel', 'Yellow', 'Green', 'Cyan', 'Blue', 'Electric Violet', 'Magenta'], ['Azalea', 'Karry', 'Egg White', 'Zanah', 'Botticelli', 'Tropical Blue', 'Mischka', 'Twilight'], ['Tonys Pink', 'Peach Orange', 'Cream Brulee', 'Sprout', 'Casper', 'Perano', 'Cold Purple', 'Careys Pink'], ['Mandy', 'Rajah', 'Dandelion', 'Olivine', 'Gulf Stream', 'Viking', 'Blue Marguerite', 'Puce'], ['Guardsman Red', 'Fire Bush', 'Golden Dream', 'Chelsea Cucumber', 'Smalt Blue', 'Boston Blue', 'Butterfly Bush', 'Cadillac'], ['Sangria', 'Mai Tai', 'Buddha Gold', 'Forest Green', 'Eden', 'Venice Blue', 'Meteorite', 'Claret'], ['Rosewood', 'Cinnamon', 'Olive', 'Parsley', 'Tiber', 'Midnight Blue', 'Valentino', 'Loulou']],
10477                    colorButton: {
10478                        foreColor: '#000000',
10479                        backColor: '#FFFF00'
10480                    },
10481                    lineHeights: ['1.0', '1.2', '1.4', '1.5', '1.6', '1.8', '2.0', '3.0'],
10482                    tableClassName: 'table table-bordered',
10483                    insertTableMaxSize: {
10484                        col: 10,
10485                        row: 10
10486                    },
10487                    // By default, dialogs are attached in container.
10488                    dialogsInBody: false,
10489                    dialogsFade: false,
10490                    maximumImageFileSize: null,
10491                    acceptImageFileTypes: "image/*",
10492                    callbacks: {
10493                        onBeforeCommand: null,
10494                        onBlur: null,
10495                        onBlurCodeview: null,
10496                        onChange: null,
10497                        onChangeCodeview: null,
10498                        onDialogShown: null,
10499                        onEnter: null,
10500                        onFocus: null,
10501                        onImageLinkInsert: null,
10502                        onImageUpload: null,
10503                        onImageUploadError: null,
10504                        onInit: null,
10505                        onKeydown: null,
10506                        onKeyup: null,
10507                        onMousedown: null,
10508                        onMouseup: null,
10509                        onPaste: null,
10510                        onScroll: null
10511                    },
10512                    codemirror: {
10513                        mode: 'text/html',
10514                        htmlMode: true,
10515                        lineNumbers: true
10516                    },
10517                    codeviewFilter: true,
10518                    codeviewFilterRegex: /<\/*(?:applet|b(?:ase|gsound|link)|embed|frame(?:set)?|ilayer|l(?:ayer|ink)|meta|object|s(?:cript|tyle)|t(?:itle|extarea)|xml)[^>]*?>/gi,
10519                    codeviewIframeFilter: true,
10520                    codeviewIframeWhitelistSrc: [],
10521                    codeviewIframeWhitelistSrcBase: ['www.youtube.com', 'www.youtube-nocookie.com', 'www.facebook.com', 'vine.co', 'instagram.com', 'player.vimeo.com', 'www.dailymotion.com', 'player.youku.com', 'jumpingbean.tv', 'v.qq.com'],
10522                    keyMap: {
10523                        pc: {
10524                            'ESC': 'escape',
10525                            'ENTER': 'insertParagraph',
10526                            'CTRL+Z': 'undo',
10527                            'CTRL+Y': 'redo',
10528                            'TAB': 'tab',
10529                            'SHIFT+TAB': 'untab',
10530                            'CTRL+B': 'bold',
10531                            'CTRL+I': 'italic',
10532                            'CTRL+U': 'underline',
10533                            'CTRL+SHIFT+S': 'strikethrough',
10534                            'CTRL+BACKSLASH': 'removeFormat',
10535                            'CTRL+SHIFT+L': 'justifyLeft',
10536                            'CTRL+SHIFT+E': 'justifyCenter',
10537                            'CTRL+SHIFT+R': 'justifyRight',
10538                            'CTRL+SHIFT+J': 'justifyFull',
10539                            'CTRL+SHIFT+NUM7': 'insertUnorderedList',
10540                            'CTRL+SHIFT+NUM8': 'insertOrderedList',
10541                            'CTRL+LEFTBRACKET': 'outdent',
10542                            'CTRL+RIGHTBRACKET': 'indent',
10543                            'CTRL+NUM0': 'formatPara',
10544                            'CTRL+NUM1': 'formatH1',
10545                            'CTRL+NUM2': 'formatH2',
10546                            'CTRL+NUM3': 'formatH3',
10547                            'CTRL+NUM4': 'formatH4',
10548                            'CTRL+NUM5': 'formatH5',
10549                            'CTRL+NUM6': 'formatH6',
10550                            'CTRL+ENTER': 'insertHorizontalRule',
10551                            'CTRL+K': 'linkDialog.show'
10552                        },
10553                        mac: {
10554                            'ESC': 'escape',
10555                            'ENTER': 'insertParagraph',
10556                            'CMD+Z': 'undo',
10557                            'CMD+SHIFT+Z': 'redo',
10558                            'TAB': 'tab',
10559                            'SHIFT+TAB': 'untab',
10560                            'CMD+B': 'bold',
10561                            'CMD+I': 'italic',
10562                            'CMD+U': 'underline',
10563                            'CMD+SHIFT+S': 'strikethrough',
10564                            'CMD+BACKSLASH': 'removeFormat',
10565                            'CMD+SHIFT+L': 'justifyLeft',
10566                            'CMD+SHIFT+E': 'justifyCenter',
10567                            'CMD+SHIFT+R': 'justifyRight',
10568                            'CMD+SHIFT+J': 'justifyFull',
10569                            'CMD+SHIFT+NUM7': 'insertUnorderedList',
10570                            'CMD+SHIFT+NUM8': 'insertOrderedList',
10571                            'CMD+LEFTBRACKET': 'outdent',
10572                            'CMD+RIGHTBRACKET': 'indent',
10573                            'CMD+NUM0': 'formatPara',
10574                            'CMD+NUM1': 'formatH1',
10575                            'CMD+NUM2': 'formatH2',
10576                            'CMD+NUM3': 'formatH3',
10577                            'CMD+NUM4': 'formatH4',
10578                            'CMD+NUM5': 'formatH5',
10579                            'CMD+NUM6': 'formatH6',
10580                            'CMD+ENTER': 'insertHorizontalRule',
10581                            'CMD+K': 'linkDialog.show'
10582                        }
10583                    },
10584                    icons: {
10585                        'align': 'note-icon-align',
10586                        'alignCenter': 'note-icon-align-center',
10587                        'alignJustify': 'note-icon-align-justify',
10588                        'alignLeft': 'note-icon-align-left',
10589                        'alignRight': 'note-icon-align-right',
10590                        'rowBelow': 'note-icon-row-below',
10591                        'colBefore': 'note-icon-col-before',
10592                        'colAfter': 'note-icon-col-after',
10593                        'rowAbove': 'note-icon-row-above',
10594                        'rowRemove': 'note-icon-row-remove',
10595                        'colRemove': 'note-icon-col-remove',
10596                        'indent': 'note-icon-align-indent',
10597                        'outdent': 'note-icon-align-outdent',
10598                        'arrowsAlt': 'note-icon-arrows-alt',
10599                        'bold': 'note-icon-bold',
10600                        'caret': 'note-icon-caret',
10601                        'circle': 'note-icon-circle',
10602                        'close': 'note-icon-close',
10603                        'code': 'note-icon-code',
10604                        'eraser': 'note-icon-eraser',
10605                        'floatLeft': 'note-icon-float-left',
10606                        'floatRight': 'note-icon-float-right',
10607                        'font': 'note-icon-font',
10608                        'frame': 'note-icon-frame',
10609                        'italic': 'note-icon-italic',
10610                        'link': 'note-icon-link',
10611                        'unlink': 'note-icon-chain-broken',
10612                        'magic': 'note-icon-magic',
10613                        'menuCheck': 'note-icon-menu-check',
10614                        'minus': 'note-icon-minus',
10615                        'orderedlist': 'note-icon-orderedlist',
10616                        'pencil': 'note-icon-pencil',
10617                        'picture': 'note-icon-picture',
10618                        'question': 'note-icon-question',
10619                        'redo': 'note-icon-redo',
10620                        'rollback': 'note-icon-rollback',
10621                        'square': 'note-icon-square',
10622                        'strikethrough': 'note-icon-strikethrough',
10623                        'subscript': 'note-icon-subscript',
10624                        'superscript': 'note-icon-superscript',
10625                        'table': 'note-icon-table',
10626                        'textHeight': 'note-icon-text-height',
10627                        'trash': 'note-icon-trash',
10628                        'underline': 'note-icon-underline',
10629                        'undo': 'note-icon-undo',
10630                        'unorderedlist': 'note-icon-unorderedlist',
10631                        'video': 'note-icon-video'
10632                    }
10633                }
10634            });
10635            ;// CONCATENATED MODULE: ./src/js/renderer.js
10636            function _typeof(obj) {
10637                "@babel/helpers - typeof";
10638                if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
10639                    _typeof = function _typeof(obj) {
10640                        return typeof obj;
10641                    };
10642                } else {
10643                    _typeof = function _typeof(obj) {
10644                        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
10645                    };
10646                }
10647                return _typeof(obj);
10648            }
10649
10650            function renderer_classCallCheck(instance, Constructor) {
10651                if (!(instance instanceof Constructor)) {
10652                    throw new TypeError("Cannot call a class as a function");
10653                }
10654            }
10655
10656            function renderer_defineProperties(target, props) {
10657                for (var i = 0; i < props.length; i++) {
10658                    var descriptor = props[i];
10659                    descriptor.enumerable = descriptor.enumerable || false;
10660                    descriptor.configurable = true;
10661                    if ("value" in descriptor) descriptor.writable = true;
10662                    Object.defineProperty(target, descriptor.key, descriptor);
10663                }
10664            }
10665
10666            function renderer_createClass(Constructor, protoProps, staticProps) {
10667                if (protoProps) renderer_defineProperties(Constructor.prototype, protoProps);
10668                if (staticProps) renderer_defineProperties(Constructor, staticProps);
10669                return Constructor;
10670            }
10671
10672
10673            var Renderer = /*#__PURE__*/function () {
vendor: 4,243 bytes, lines 10674-10768
10674                function Renderer(markup, children, options, callback) {
10675                    renderer_classCallCheck(this, Renderer);
10676
10677                    this.markup = markup;
10678                    this.children = children;
10679                    this.options = options;
10680                    this.callback = callback;
10681                }
10682
10683                renderer_createClass(Renderer, [{
10684                    key: "render",
10685                    value: function render($parent) {
10686                        var $node = external_jQuery_default()(this.markup);
10687
10688                        if (this.options && this.options.contents) {
10689                            $node.html(this.options.contents);
10690                        }
10691
10692                        if (this.options && this.options.className) {
10693                            $node.addClass(this.options.className);
10694                        }
10695
10696                        if (this.options && this.options.data) {
10697                            external_jQuery_default().each(this.options.data, function (k, v) {
10698                                $node.attr('data-' + k, v);
10699                            });
10700                        }
10701
10702                        if (this.options && this.options.click) {
10703                            $node.on('click', this.options.click);
10704                        }
10705
10706                        if (this.children) {
10707                            var $container = $node.find('.note-children-container');
10708                            this.children.forEach(function (child) {
10709                                child.render($container.length ? $container : $node);
10710                            });
10711                        }
10712
10713                        if (this.callback) {
10714                            this.callback($node, this.options);
10715                        }
10716
10717                        if (this.options && this.options.callback) {
10718                            this.options.callback($node);
10719                        }
10720
10721                        if ($parent) {
10722                            $parent.append($node);
10723                        }
10724
10725                        return $node;
10726                    }
10727                }]);
10728
10729                return Renderer;
10730            }();
10731
10732            /* harmony default export */
10733            const renderer = ({
10734                create: function create(markup, callback) {
10735                    return function () {
10736                        var options = _typeof(arguments[1]) === 'object' ? arguments[1] : arguments[0];
10737                        var children = Array.isArray(arguments[0]) ? arguments[0] : [];
10738
10739                        if (options && options.children) {
10740                            children = options.children;
10741                        }
10742
10743                        return new Renderer(markup, children, options, callback);
10744                    };
10745                }
10746            });
10747            ;// CONCATENATED MODULE: ./src/styles/bs3/summernote-bs3.js
10748            function summernote_bs3_typeof(obj) {
10749                "@babel/helpers - typeof";
10750                if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
10751                    summernote_bs3_typeof = function _typeof(obj) {
10752                        return typeof obj;
10753                    };
10754                } else {
10755                    summernote_bs3_typeof = function _typeof(obj) {
10756                        return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
10757                    };
10758                }
10759                return summernote_bs3_typeof(obj);
10760            }
10761
10762
10763            var editor = renderer.create('<div class="note-editor note-frame panel panel-default"></div>');
10764            var toolbar = renderer.create('<div class="panel-heading note-toolbar" role="toolbar"></div>');
10765            var editingArea = renderer.create('<div class="note-editing-area"></div>');
10766            var codable = renderer.create('<textarea class="note-codable" aria-multiline="true"></textarea>');
10767            var editable = renderer.create('<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"></div>');
10768            var statusbar = renderer.create(['<output class="note-status-output" role="status" aria-l
vendor: 11,390 bytes, lines 10768-10960
10768ive="polite"></output>', '<div class="note-statusbar" role="status">', '<div class="note-resizebar" aria-label="Resize">', '<div class="note-icon-bar"></div>', '<div class="note-icon-bar"></div>', '<div class="note-icon-bar"></div>', '</div>', '</div>'].join(''));
10769            var airEditor = renderer.create('<div class="note-editor note-airframe"></div>');
10770            var airEditable = renderer.create(['<div class="note-editable" contentEditable="true" role="textbox" aria-multiline="true"></div>', '<output class="note-status-output" role="status" aria-live="polite"></output>'].join(''));
10771            var buttonGroup = renderer.create('<div class="note-btn-group btn-group"></div>');
10772            var dropdown = renderer.create('<ul class="note-dropdown-menu dropdown-menu"></ul>', function ($node, options) {
10773                var markup = Array.isArray(options.items) ? options.items.map(function (item) {
10774                    var value = typeof item === 'string' ? item : item.value || '';
10775                    var content = options.template ? options.template(item) : item;
10776                    var option = summernote_bs3_typeof(item) === 'object' ? item.option : undefined;
10777                    var dataValue = 'data-value="' + value + '"';
10778                    var dataOption = option !== undefined ? ' data-option="' + option + '"' : '';
10779                    return '<li aria-label="' + value + '"><a href="#" ' + (dataValue + dataOption) + '>' + content + '</a></li>';
10780                }).join('') : options.items;
10781                $node.html(markup).attr({
10782                    'aria-label': options.title
10783                });
10784
10785                if (options && options.codeviewKeepButton) {
10786                    $node.addClass('note-codeview-keep');
10787                }
10788            });
10789
10790            var dropdownButtonContents = function dropdownButtonContents(contents, options) {
10791                return contents + ' ' + icon(options.icons.caret, 'span');
10792            };
10793
10794            var dropdownCheck = renderer.create('<ul class="note-dropdown-menu dropdown-menu note-check"></ul>', function ($node, options) {
10795                var markup = Array.isArray(options.items) ? options.items.map(function (item) {
10796                    var value = typeof item === 'string' ? item : item.value || '';
10797                    var content = options.template ? options.template(item) : item;
10798                    return '<li aria-label="' + item + '"><a href="#" data-value="' + value + '">' + icon(options.checkClassName) + ' ' + content + '</a></li>';
10799                }).join('') : options.items;
10800                $node.html(markup).attr({
10801                    'aria-label': options.title
10802                });
10803
10804                if (options && options.codeviewKeepButton) {
10805                    $node.addClass('note-codeview-keep');
10806                }
10807            });
10808            var dialog = renderer.create('<div class="modal note-modal" aria-hidden="false" tabindex="-1" role="dialog"></div>', function ($node, options) {
10809                if (options.fade) {
10810                    $node.addClass('fade');
10811                }
10812
10813                $node.attr({
10814                    'aria-label': options.title
10815                });
10816                $node.html(['<div class="modal-dialog">', '<div class="modal-content">', options.title ? '<div class="modal-header">' + '<button type="button" class="close" data-dismiss="modal" aria-label="Close" aria-hidden="true">&times;</button>' + '<h4 class="modal-title">' + options.title + '</h4>' + '</div>' : '', '<div class="modal-body">' + options.body + '</div>', options.footer ? '<div class="modal-footer">' + options.footer + '</div>' : '', '</div>', '</div>'].join(''));
10817            });
10818            var popover = renderer.create(['<div class="note-popover popover in">', '<div class="arrow"></div>', '<div class="popover-content note-children-container"></div>', '</div>'].join(''), function ($node, options) {
10819                var direction = typeof options.direction !== 'undefined' ? options.direction : 'bottom';
10820                $node.addClass(direction);
10821
10822                if (options.hideArrow) {
10823                    $node.find('.arrow').hide();
10824                }
10825            });
10826            var summernote_bs3_checkbox = renderer.create('<div class="checkbox"></div>', function ($node, options) {
10827                $node.html(['<label' + (options.id ? ' for="note-' + options.id + '"' : '') + '>', '<input type="checkbox"' + (options.id ? ' id="note-' + options.id + '"' : ''), options.checked ? ' checked' : '', ' aria-checked="' + (options.checked ? 'true' : 'false') + '"/>', options.text ? options.text : '', '</label>'].join(''));
10828            });
10829
10830            var icon = function icon(iconClassName, tagName) {
10831                if (iconClassName.match(/^</)) {
10832                    return iconClassName;
10833                }
10834
10835                tagName = tagName || 'i';
10836                return '<' + tagName + ' class="' + iconClassName + '"></' + tagName + '>';
10837            };
10838
10839            var ui = function ui(editorOptions) {
10840                return {
10841                    editor: editor,
10842                    toolbar: toolbar,
10843                    editingArea: editingArea,
10844                    codable: codable,
10845                    editable: editable,
10846                    statusbar: statusbar,
10847                    airEditor: airEditor,
10848                    airEditable: airEditable,
10849                    buttonGroup: buttonGroup,
10850                    dropdown: dropdown,
10851                    dropdownButtonContents: dropdownButtonContents,
10852                    dropdownCheck: dropdownCheck,
10853                    dialog: dialog,
10854                    popover: popover,
10855                    checkbox: summernote_bs3_checkbox,
10856                    icon: icon,
10857                    options: editorOptions,
10858                    palette: function palette($node, options) {
10859                        return renderer.create('<div class="note-color-palette"></div>', function ($node, options) {
10860                            var contents = [];
10861
10862                            for (var row = 0, rowSize = options.colors.length; row < rowSize; row++) {
10863                                var eventName = options.eventName;
10864                                var colors = options.colors[row];
10865                                var colorsName = options.colorsName[row];
10866                                var buttons = [];
10867
10868                                for (var col = 0, colSize = colors.length; col < colSize; col++) {
10869                                    var color = colors[col];
10870                                    var colorName = colorsName[col];
10871                                    buttons.push(['<button type="button" class="note-color-btn"', 'style="background-color:', color, '" ', 'data-event="', eventName, '" ', 'data-value="', color, '" ', 'title="', colorName, '" ', 'aria-label="', colorName, '" ', 'data-toggle="button" tabindex="-1"></button>'].join(''));
10872                                }
10873
10874                                contents.push('<div class="note-color-row">' + buttons.join('') + '</div>');
10875                            }
10876
10877                            $node.html(contents.join(''));
10878
10879                            if (options.tooltip) {
10880                                $node.find('.note-color-btn').tooltip({
10881                                    container: options.container || editorOptions.container,
10882                                    trigger: 'hover',
10883                                    placement: 'bottom'
10884                                });
10885                            }
10886                        })($node, options);
10887                    },
10888                    button: function button($node, options) {
10889                        return renderer.create('<button type="button" class="note-btn btn btn-default btn-sm" tabindex="-1"></button>', function ($node, options) {
10890                            if (options && options.tooltip) {
10891                                $node.attr({
10892                                    title: options.tooltip,
10893                                    'aria-label': options.tooltip
10894                                }).tooltip({
10895                                    container: options.container || editorOptions.container,
10896                                    trigger: 'hover',
10897                                    placement: 'bottom'
10898                                }).on('click', function (e) {
10899                                    external_jQuery_default()(e.currentTarget).tooltip('hide');
10900                                });
10901                            }
10902
10903                            if (options && options.codeviewButton) {
10904                                $node.addClass('note-codeview-keep');
10905                            }
10906                        })($node, options);
10907                    },
10908                    toggleBtn: function toggleBtn($btn, isEnable) {
10909                        $btn.toggleClass('disabled', !isEnable);
10910                        $btn.attr('disabled', !isEnable);
10911                    },
10912                    toggleBtnActive: function toggleBtnActive($btn, isActive) {
10913                        $btn.toggleClass('active', isActive);
10914                    },
10915                    onDialogShown: function onDialogShown($dialog, handler) {
10916                        $dialog.one('shown.bs.modal', handler);
10917                    },
10918                    onDialogHidden: function onDialogHidden($dialog, handler) {
10919                        $dialog.one('hidden.bs.modal', handler);
10920                    },
10921                    showDialog: function showDialog($dialog) {
10922                        $dialog.modal('show');
10923                    },
10924                    hideDialog: function hideDialog($dialog) {
10925                        $dialog.modal('hide');
10926                    },
10927                    createLayout: function createLayout($note) {
10928                        var $editor = (editorOptions.airMode ? airEditor([editingArea([codable(), airEditable()])]) : editorOptions.toolbarPosition === 'bottom' ? editor([editingArea([codable(), editable()]), toolbar(), statusbar()]) : editor([toolbar(), editingArea([codable(), editable()]), statusbar()])).render();
10929                        $editor.insertAfter($note);
10930                        return {
10931                            note: $note,
10932                            editor: $editor,
10933                            toolbar: $editor.find('.note-toolbar'),
10934                            editingArea: $editor.find('.note-editing-area'),
10935                            editable: $editor.find('.note-editable'),
10936                            codable: $editor.find('.note-codable'),
10937                            statusbar: $editor.find('.note-statusbar')
10938                        };
10939                    },
10940                    removeLayout: function removeLayout($note, layoutInfo) {
10941                        $note.html(layoutInfo.editable.html());
10942                        layoutInfo.editor.remove();
10943                        $note.show();
10944                    }
10945                };
10946            };
10947
10948            (external_jQuery_default()).summernote = external_jQuery_default().extend((external_jQuery_default()).summernote, {
10949                ui_template: ui,
10950                "interface": 'bs3'
10951            });
10952        })();
10953
10954        /******/
10955        return __webpack_exports__;
10956        /******/
10957    })()
10958        ;
10959});
10960//# sourceMappingURL=summernote.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.