summernote
Version:
Super simple WYSIWYG editor
1,919 lines (1,809 loc) • 381 kB
JavaScript
/*!
*
* Super simple WYSIWYG editor v0.9.1
* https://summernote.org
*
* Copyright 2013~ Hackerwins and contributors
* Summernote may be freely distributed under the MIT license.
*
* Date: 2024-10-09T10:28Z
*
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("jquery"));
else if(typeof define === 'function' && define.amd)
define(["jquery"], factory);
else {
var a = typeof exports === 'object' ? factory(require("jquery")) : factory(root["jQuery"]);
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(self, (__WEBPACK_EXTERNAL_MODULE__8938__) => {
return /******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 7000:
/***/ ((__unused_webpack_module, __unused_webpack___webpack_exports__, __webpack_require__) => {
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8938);
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
(jquery__WEBPACK_IMPORTED_MODULE_0___default().summernote) = (jquery__WEBPACK_IMPORTED_MODULE_0___default().summernote) || {
lang: {}
};
jquery__WEBPACK_IMPORTED_MODULE_0___default().extend(true, (jquery__WEBPACK_IMPORTED_MODULE_0___default().summernote).lang, {
'en-US': {
font: {
bold: 'Bold',
italic: 'Italic',
underline: 'Underline',
clear: 'Remove Font Style',
height: 'Line Height',
name: 'Font Family',
strikethrough: 'Strikethrough',
subscript: 'Subscript',
superscript: 'Superscript',
size: 'Font Size',
sizeunit: 'Font Size Unit'
},
image: {
image: 'Picture',
insert: 'Insert Image',
resizeFull: 'Resize full',
resizeHalf: 'Resize half',
resizeQuarter: 'Resize quarter',
resizeNone: 'Original size',
floatLeft: 'Float Left',
floatRight: 'Float Right',
floatNone: 'Remove float',
shapeRounded: 'Shape: Rounded',
shapeCircle: 'Shape: Circle',
shapeThumbnail: 'Shape: Thumbnail',
shapeNone: 'Shape: None',
dragImageHere: 'Drag image or text here',
dropImage: 'Drop image or Text',
selectFromFiles: 'Select from files',
maximumFileSize: 'Maximum file size',
maximumFileSizeError: 'Maximum file size exceeded.',
url: 'Image URL',
remove: 'Remove Image',
original: 'Original'
},
video: {
video: 'Video',
videoLink: 'Video Link',
insert: 'Insert Video',
url: 'Video URL',
providers: '(YouTube, Google Drive, Vimeo, Vine, Instagram, DailyMotion, Youku, Peertube)'
},
link: {
link: 'Link',
insert: 'Insert Link',
unlink: 'Unlink',
edit: 'Edit',
textToDisplay: 'Text to display',
url: 'To what URL should this link go?',
openInNewWindow: 'Open in new window'
},
table: {
table: 'Table',
addRowAbove: 'Add row above',
addRowBelow: 'Add row below',
addColLeft: 'Add column left',
addColRight: 'Add column right',
delRow: 'Delete row',
delCol: 'Delete column',
delTable: 'Delete table'
},
hr: {
insert: 'Insert Horizontal Rule'
},
style: {
style: 'Style',
p: 'Normal',
blockquote: 'Quote',
pre: 'Code',
h1: 'Header 1',
h2: 'Header 2',
h3: 'Header 3',
h4: 'Header 4',
h5: 'Header 5',
h6: 'Header 6'
},
lists: {
unordered: 'Unordered list',
ordered: 'Ordered list'
},
options: {
help: 'Help',
fullscreen: 'Full Screen',
codeview: 'Code View'
},
paragraph: {
paragraph: 'Paragraph',
outdent: 'Outdent',
indent: 'Indent',
left: 'Align left',
center: 'Align center',
right: 'Align right',
justify: 'Justify full'
},
color: {
recent: 'Recent Color',
more: 'More Color',
background: 'Background Color',
foreground: 'Text Color',
transparent: 'Transparent',
setTransparent: 'Set transparent',
reset: 'Reset',
resetToDefault: 'Reset to default',
cpSelect: 'Select'
},
shortcut: {
shortcuts: 'Keyboard shortcuts',
close: 'Close',
textFormatting: 'Text formatting',
action: 'Action',
paragraphFormatting: 'Paragraph formatting',
documentStyle: 'Document Style',
extraKeys: 'Extra keys'
},
help: {
'escape': 'Escape',
'insertParagraph': 'Insert Paragraph',
'undo': 'Undo the last command',
'redo': 'Redo the last command',
'tab': 'Tab',
'untab': 'Untab',
'bold': 'Set a bold style',
'italic': 'Set a italic style',
'underline': 'Set a underline style',
'strikethrough': 'Set a strikethrough style',
'removeFormat': 'Clean a style',
'justifyLeft': 'Set left align',
'justifyCenter': 'Set center align',
'justifyRight': 'Set right align',
'justifyFull': 'Set full align',
'insertUnorderedList': 'Toggle unordered list',
'insertOrderedList': 'Toggle ordered list',
'outdent': 'Outdent on current paragraph',
'indent': 'Indent on current paragraph',
'formatPara': 'Change current block\'s format as a paragraph(P tag)',
'formatH1': 'Change current block\'s format as H1',
'formatH2': 'Change current block\'s format as H2',
'formatH3': 'Change current block\'s format as H3',
'formatH4': 'Change current block\'s format as H4',
'formatH5': 'Change current block\'s format as H5',
'formatH6': 'Change current block\'s format as H6',
'insertHorizontalRule': 'Insert horizontal rule',
'linkDialog.show': 'Show Link Dialog'
},
history: {
undo: 'Undo',
redo: 'Redo'
},
specialChar: {
specialChar: 'SPECIAL CHARACTERS',
select: 'Select Special characters'
},
output: {
noSelection: 'No Selection Made!'
}
}
});
/***/ }),
/***/ 8938:
/***/ ((module) => {
module.exports = __WEBPACK_EXTERNAL_MODULE__8938__;
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// EXTERNAL MODULE: external {"root":"jQuery","commonjs":"jquery","commonjs2":"jquery","amd":"jquery"}
var external_root_jQuery_commonjs_jquery_commonjs2_jquery_amd_jquery_ = __webpack_require__(8938);
var external_root_jQuery_commonjs_jquery_commonjs2_jquery_amd_jquery_default = /*#__PURE__*/__webpack_require__.n(external_root_jQuery_commonjs_jquery_commonjs2_jquery_amd_jquery_);
// EXTERNAL MODULE: ./src/lang/summernote-en-US.js
var summernote_en_US = __webpack_require__(7000);
;// CONCATENATED MODULE: ./src/js/core/env.js
/**
* returns whether font is installed or not.
*
* @param {String} fontName
* @return {Boolean}
*/
var genericFontFamilies = ['sans-serif', 'serif', 'monospace', 'cursive', 'fantasy'];
function validFontName(fontName) {
return external_root_jQuery_commonjs_jquery_commonjs2_jquery_amd_jquery_default().inArray(fontName.toLowerCase(), genericFontFamilies) === -1 ? "'".concat(fontName, "'") : fontName;
}
function createIsFontInstalledFunc() {
var testText = "mw";
var fontSize = "20px";
var canvasWidth = 40;
var canvasHeight = 20;
var canvas = document.createElement("canvas");
var context = canvas.getContext("2d", {
willReadFrequently: true
});
canvas.width = canvasWidth;
canvas.height = canvasHeight;
context.textAlign = "center";
context.fillStyle = "black";
context.textBaseline = "middle";
function getPxInfo(font, testFontName) {
context.clearRect(0, 0, canvasWidth, canvasHeight);
context.font = fontSize + ' ' + validFontName(font) + ', "' + testFontName + '"';
context.fillText(testText, canvasWidth / 2, canvasHeight / 2);
// Get pixel information
var pxInfo = context.getImageData(0, 0, canvasWidth, canvasHeight).data;
return pxInfo.join("");
}
return function (fontName) {
var testFontName = fontName === 'Comic Sans MS' ? 'Courier New' : 'Comic Sans MS';
var testInfo = getPxInfo(testFontName, testFontName);
var fontInfo = getPxInfo(fontName, testFontName);
return testInfo !== fontInfo;
};
}
var userAgent = navigator.userAgent;
var isMSIE = /MSIE|Trident/i.test(userAgent);
var browserVersion;
if (isMSIE) {
var matches = /MSIE (\d+[.]\d+)/.exec(userAgent);
if (matches) {
browserVersion = parseFloat(matches[1]);
}
matches = /Trident\/.*rv:([0-9]{1,}[.0-9]{0,})/.exec(userAgent);
if (matches) {
browserVersion = parseFloat(matches[1]);
}
}
var isEdge = /Edge\/\d+/.test(userAgent);
var isSupportTouch = 'ontouchstart' in window || navigator.MaxTouchPoints > 0 || navigator.msMaxTouchPoints > 0;
// [workaround] IE doesn't have input events for contentEditable
// - see: https://goo.gl/4bfIvA
var inputEventName = isMSIE ? 'DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted' : 'input';
/**
* @class core.env
*
* Object which check platform and agent
*
* @singleton
* @alternateClassName env
*/
/* harmony default export */ const env = ({
isMac: navigator.appVersion.indexOf('Mac') > -1,
isMSIE: isMSIE,
isEdge: isEdge,
isFF: !isEdge && /firefox/i.test(userAgent),
isPhantom: /PhantomJS/i.test(userAgent),
isWebkit: !isEdge && /webkit/i.test(userAgent),
isChrome: !isEdge && /chrome/i.test(userAgent),
isSafari: !isEdge && /safari/i.test(userAgent) && !/chrome/i.test(userAgent),
browserVersion: browserVersion,
isSupportTouch: isSupportTouch,
isFontInstalled: createIsFontInstalledFunc(),
isW3CRangeSupport: !!document.createRange,
inputEventName: inputEventName,
genericFontFamilies: genericFontFamilies,
validFontName: validFontName
});
;// CONCATENATED MODULE: ./src/js/core/func.js
/**
* @class core.func
*
* func utils (for high-order func's arg)
*
* @singleton
* @alternateClassName func
*/
function eq(itemA) {
return function (itemB) {
return itemA === itemB;
};
}
function eq2(itemA, itemB) {
return itemA === itemB;
}
function peq2(propName) {
return function (itemA, itemB) {
return itemA[propName] === itemB[propName];
};
}
function ok() {
return true;
}
function fail() {
return false;
}
function not(f) {
return function () {
return !f.apply(f, arguments);
};
}
function and(fA, fB) {
return function (item) {
return fA(item) && fB(item);
};
}
function func_self(a) {
return a;
}
function invoke(obj, method) {
return function () {
return obj[method].apply(obj, arguments);
};
}
var idCounter = 0;
/**
* reset globally-unique id
*
*/
function resetUniqueId() {
idCounter = 0;
}
/**
* generate a globally-unique id
*
* @param {String} [prefix]
*/
function uniqueId(prefix) {
var id = ++idCounter + '';
return prefix ? prefix + id : id;
}
/**
* returns bnd (bounds) from rect
*
* - IE Compatibility Issue: http://goo.gl/sRLOAo
* - Scroll Issue: http://goo.gl/sNjUc
*
* @param {Rect} rect
* @return {Object} bounds
* @return {Number} bounds.top
* @return {Number} bounds.left
* @return {Number} bounds.width
* @return {Number} bounds.height
*/
function rect2bnd(rect) {
var $document = external_root_jQuery_commonjs_jquery_commonjs2_jquery_amd_jquery_default()(document);
return {
top: rect.top + $document.scrollTop(),
left: rect.left + $document.scrollLeft(),
width: rect.right - rect.left,
height: rect.bottom - rect.top
};
}
/**
* returns a copy of the object where the keys have become the values and the values the keys.
* @param {Object} obj
* @return {Object}
*/
function invertObject(obj) {
var inverted = {};
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
inverted[obj[key]] = key;
}
}
return inverted;
}
/**
* @param {String} namespace
* @param {String} [prefix]
* @return {String}
*/
function namespaceToCamel(namespace, prefix) {
prefix = prefix || '';
return prefix + namespace.split('.').map(function (name) {
return name.substring(0, 1).toUpperCase() + name.substring(1);
}).join('');
}
/**
* Returns a function, that, as long as it continues to be invoked, will not
* be triggered. The function will be called after it stops being called for
* N milliseconds. If `immediate` is passed, trigger the function on the
* leading edge, instead of the trailing.
* @param {Function} func
* @param {Number} wait
* @param {Boolean} immediate
* @return {Function}
*/
function debounce(func, wait, immediate) {
var timeout;
return function () {
var context = this;
var args = arguments;
var later = function later() {
timeout = null;
if (!immediate) {
func.apply(context, args);
}
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) {
func.apply(context, args);
}
};
}
/**
*
* @param {String} url
* @return {Boolean}
*/
function isValidUrl(url) {
var expression = /[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi;
return expression.test(url);
}
/* harmony default export */ const func = ({
eq: eq,
eq2: eq2,
peq2: peq2,
ok: ok,
fail: fail,
self: func_self,
not: not,
and: and,
invoke: invoke,
resetUniqueId: resetUniqueId,
uniqueId: uniqueId,
rect2bnd: rect2bnd,
invertObject: invertObject,
namespaceToCamel: namespaceToCamel,
debounce: debounce,
isValidUrl: isValidUrl
});
;// CONCATENATED MODULE: ./src/js/core/lists.js
/**
* returns the first item of an array.
*
* @param {Array} array
*/
function head(array) {
return array[0];
}
/**
* returns the last item of an array.
*
* @param {Array} array
*/
function last(array) {
return array[array.length - 1];
}
/**
* returns everything but the last entry of the array.
*
* @param {Array} array
*/
function initial(array) {
return array.slice(0, array.length - 1);
}
/**
* returns the rest of the items in an array.
*
* @param {Array} array
*/
function tail(array) {
return array.slice(1);
}
/**
* returns item of array
*/
function find(array, pred) {
for (var idx = 0, len = array.length; idx < len; idx++) {
var item = array[idx];
if (pred(item)) {
return item;
}
}
}
/**
* returns true if all of the values in the array pass the predicate truth test.
*/
function lists_all(array, pred) {
for (var idx = 0, len = array.length; idx < len; idx++) {
if (!pred(array[idx])) {
return false;
}
}
return true;
}
/**
* returns true if the value is present in the list.
*/
function contains(array, item) {
if (array && array.length && item) {
if (array.indexOf) {
return array.indexOf(item) !== -1;
} else if (array.contains) {
// `DOMTokenList` doesn't implement `.indexOf`, but it implements `.contains`
return array.contains(item);
}
}
return false;
}
/**
* get sum from a list
*
* @param {Array} array - array
* @param {Function} fn - iterator
*/
function sum(array, fn) {
fn = fn || func.self;
return array.reduce(function (memo, v) {
return memo + fn(v);
}, 0);
}
/**
* returns a copy of the collection with array type.
* @param {Collection} collection - collection eg) node.childNodes, ...
*/
function from(collection) {
var result = [];
var length = collection.length;
var idx = -1;
while (++idx < length) {
result[idx] = collection[idx];
}
return result;
}
/**
* returns whether list is empty or not
*/
function isEmpty(array) {
return !array || !array.length;
}
/**
* cluster elements by predicate function.
*
* @param {Array} array - array
* @param {Function} fn - predicate function for cluster rule
* @param {Array[]}
*/
function clusterBy(array, fn) {
if (!array.length) {
return [];
}
var aTail = tail(array);
return aTail.reduce(function (memo, v) {
var aLast = last(memo);
if (fn(last(aLast), v)) {
aLast[aLast.length] = v;
} else {
memo[memo.length] = [v];
}
return memo;
}, [[head(array)]]);
}
/**
* returns a copy of the array with all false values removed
*
* @param {Array} array - array
* @param {Function} fn - predicate function for cluster rule
*/
function compact(array) {
var aResult = [];
for (var idx = 0, len = array.length; idx < len; idx++) {
if (array[idx]) {
aResult.push(array[idx]);
}
}
return aResult;
}
/**
* produces a duplicate-free version of the array
*
* @param {Array} array
*/
function unique(array) {
var results = [];
for (var idx = 0, len = array.length; idx < len; idx++) {
if (!contains(results, array[idx])) {
results.push(array[idx]);
}
}
return results;
}
/**
* returns next item.
* @param {Array} array
*/
function next(array, item) {
if (array && array.length && item) {
var idx = array.indexOf(item);
return idx === -1 ? null : array[idx + 1];
}
return null;
}
/**
* returns prev item.
* @param {Array} array
*/
function prev(array, item) {
if (array && array.length && item) {
var idx = array.indexOf(item);
return idx === -1 ? null : array[idx - 1];
}
return null;
}
/**
* @class core.list
*
* list utils
*
* @singleton
* @alternateClassName list
*/
/* harmony default export */ const lists = ({
head: head,
last: last,
initial: initial,
tail: tail,
prev: prev,
next: next,
find: find,
contains: contains,
all: lists_all,
sum: sum,
from: from,
isEmpty: isEmpty,
clusterBy: clusterBy,
compact: compact,
unique: unique
});
;// CONCATENATED MODULE: ./src/js/core/dom.js
var NBSP_CHAR = String.fromCharCode(160);
var ZERO_WIDTH_NBSP_CHAR = "\uFEFF";
/**
* @method isEditable
*
* returns whether node is `note-editable` or not.
*
* @param {Node} node
* @return {Boolean}
*/
function isEditable(node) {
return node && external_root_jQuery_commonjs_jquery_commonjs2_jquery_amd_jquery_default()(node).hasClass('note-editable');
}
/**
* @method isControlSizing
*
* returns whether node is `note-control-sizing` or not.
*
* @param {Node} node
* @return {Boolean}
*/
function isControlSizing(node) {
return node && external_root_jQuery_commonjs_jquery_commonjs2_jquery_amd_jquery_default()(node).hasClass('note-control-sizing');
}
/**
* @method makePredByNodeName
*
* returns predicate which judge whether nodeName is same
*
* @param {String} nodeName
* @return {Function}
*/
function makePredByNodeName(nodeName) {
nodeName = nodeName.toUpperCase();
return function (node) {
return node && node.nodeName.toUpperCase() === nodeName;
};
}
/**
* @method isText
*
*
*
* @param {Node} node
* @return {Boolean} true if node's type is text(3)
*/
function isText(node) {
return node && node.nodeType === 3;
}
/**
* @method isElement
*
*
*
* @param {Node} node
* @return {Boolean} true if node's type is element(1)
*/
function isElement(node) {
return node && node.nodeType === 1;
}
/**
* ex) br, col, embed, hr, img, input, ...
* @see http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements
*/
function isVoid(node) {
return node && /^BR|^IMG|^HR|^IFRAME|^BUTTON|^INPUT|^AUDIO|^VIDEO|^EMBED/.test(node.nodeName.toUpperCase());
}
function isPara(node) {
if (isEditable(node)) {
return false;
}
// Chrome(v31.0), FF(v25.0.1) use DIV for paragraph
return node && /^DIV|^P|^LI|^H[1-7]/.test(node.nodeName.toUpperCase());
}
function isHeading(node) {
return node && /^H[1-7]/.test(node.nodeName.toUpperCase());
}
var isPre = makePredByNodeName('PRE');
var isLi = makePredByNodeName('LI');
function isPurePara(node) {
return isPara(node) && !isLi(node);
}
var isTable = makePredByNodeName('TABLE');
var isData = makePredByNodeName('DATA');
function isInline(node) {
return !isBodyContainer(node) && !isList(node) && !isHr(node) && !isPara(node) && !isTable(node) && !isBlockquote(node) && !isData(node);
}
function isList(node) {
return node && /^UL|^OL/.test(node.nodeName.toUpperCase());
}
var isHr = makePredByNodeName('HR');
function isCell(node) {
return node && /^TD|^TH/.test(node.nodeName.toUpperCase());
}
var isBlockquote = makePredByNodeName('BLOCKQUOTE');
function isBodyContainer(node) {
return isCell(node) || isBlockquote(node) || isEditable(node);
}
var isAnchor = makePredByNodeName('A');
function isParaInline(node) {
return isInline(node) && !!ancestor(node, isPara);
}
function isBodyInline(node) {
return isInline(node) && !ancestor(node, isPara);
}
var isBody = makePredByNodeName('BODY');
/**
* returns whether nodeB is closest sibling of nodeA
*
* @param {Node} nodeA
* @param {Node} nodeB
* @return {Boolean}
*/
function isClosestSibling(nodeA, nodeB) {
return nodeA.nextSibling === nodeB || nodeA.previousSibling === nodeB;
}
/**
* returns array of closest siblings with node
*
* @param {Node} node
* @param {function} [pred] - predicate function
* @return {Node[]}
*/
function withClosestSiblings(node, pred) {
pred = pred || func.ok;
var siblings = [];
if (node.previousSibling && pred(node.previousSibling)) {
siblings.push(node.previousSibling);
}
siblings.push(node);
if (node.nextSibling && pred(node.nextSibling)) {
siblings.push(node.nextSibling);
}
return siblings;
}
/**
* blank HTML for cursor position
* - [workaround] old IE only works with
* - [workaround] IE11 and other browser works with bogus br
*/
var blankHTML = env.isMSIE && env.browserVersion < 11 ? ' ' : '<br>';
/**
* @method nodeLength
*
* returns #text's text size or element's childNodes size
*
* @param {Node} node
*/
function nodeLength(node) {
if (isText(node)) {
return node.nodeValue.length;
}
if (node) {
return node.childNodes.length;
}
return 0;
}
/**
* returns whether deepest child node is empty or not.
*
* @param {Node} node
* @return {Boolean}
*/
function deepestChildIsEmpty(node) {
do {
if (node.firstElementChild === null || node.firstElementChild.innerHTML === '') break;
} while (node = node.firstElementChild);
return dom_isEmpty(node);
}
/**
* returns whether node is empty or not.
*
* @param {Node} node
* @return {Boolean}
*/
function dom_isEmpty(node) {
var len = nodeLength(node);
if (len === 0) {
return true;
} else if (!isText(node) && len === 1 && node.innerHTML === blankHTML) {
// ex) <p><br></p>, <span><br></span>
return true;
} else if (lists.all(node.childNodes, isText) && node.innerHTML === '') {
// ex) <p></p>, <span></span>
return true;
}
return false;
}
/**
* padding blankHTML if node is empty (for cursor position)
*/
function paddingBlankHTML(node) {
if (!isVoid(node) && !nodeLength(node)) {
node.innerHTML = blankHTML;
}
}
/**
* find nearest ancestor predicate hit
*
* @param {Node} node
* @param {Function} pred - predicate function
*/
function ancestor(node, pred) {
while (node) {
if (pred(node)) {
return node;
}
if (isEditable(node)) {
break;
}
node = node.parentNode;
}
return null;
}
/**
* find nearest ancestor only single child blood line and predicate hit
*
* @param {Node} node
* @param {Function} pred - predicate function
*/
function singleChildAncestor(node, pred) {
node = node.parentNode;
while (node) {
if (nodeLength(node) !== 1) {
break;
}
if (pred(node)) {
return node;
}
if (isEditable(node)) {
break;
}
node = node.parentNode;
}
return null;
}
/**
* returns new array of ancestor nodes (until predicate hit).
*
* @param {Node} node
* @param {Function} [optional] pred - predicate function
*/
function listAncestor(node, pred) {
pred = pred || func.fail;
var ancestors = [];
ancestor(node, function (el) {
if (!isEditable(el)) {
ancestors.push(el);
}
return pred(el);
});
return ancestors;
}
/**
* find farthest ancestor predicate hit
*/
function lastAncestor(node, pred) {
var ancestors = listAncestor(node);
return lists.last(ancestors.filter(pred));
}
/**
* returns common ancestor node between two nodes.
*
* @param {Node} nodeA
* @param {Node} nodeB
*/
function commonAncestor(nodeA, nodeB) {
var ancestors = listAncestor(nodeA);
for (var n = nodeB; n; n = n.parentNode) {
if (ancestors.indexOf(n) > -1) return n;
}
return null; // difference document area
}
/**
* listing all previous siblings (until predicate hit).
*
* @param {Node} node
* @param {Function} [optional] pred - predicate function
*/
function listPrev(node, pred) {
pred = pred || func.fail;
var nodes = [];
while (node) {
if (pred(node)) {
break;
}
nodes.push(node);
node = node.previousSibling;
}
return nodes;
}
/**
* listing next siblings (until predicate hit).
*
* @param {Node} node
* @param {Function} [pred] - predicate function
*/
function listNext(node, pred) {
pred = pred || func.fail;
var nodes = [];
while (node) {
if (pred(node)) {
break;
}
nodes.push(node);
node = node.nextSibling;
}
return nodes;
}
/**
* listing descendant nodes
*
* @param {Node} node
* @param {Function} [pred] - predicate function
*/
function listDescendant(node, pred) {
var descendants = [];
pred = pred || func.ok;
// start DFS(depth first search) with node
(function fnWalk(current) {
if (node !== current && pred(current)) {
descendants.push(current);
}
for (var idx = 0, len = current.childNodes.length; idx < len; idx++) {
fnWalk(current.childNodes[idx]);
}
})(node);
return descendants;
}
/**
* wrap node with new tag.
*
* @param {Node} node
* @param {Node} tagName of wrapper
* @return {Node} - wrapper
*/
function wrap(node, wrapperName) {
var parent = node.parentNode;
var wrapper = external_root_jQuery_commonjs_jquery_commonjs2_jquery_amd_jquery_default()('<' + wrapperName + '>')[0];
parent.insertBefore(wrapper, node);
wrapper.appendChild(node);
return wrapper;
}
/**
* insert node after preceding
*
* @param {Node} node
* @param {Node} preceding - predicate function
*/
function insertAfter(node, preceding) {
var next = preceding.nextSibling;
var parent = preceding.parentNode;
if (next) {
parent.insertBefore(node, next);
} else {
parent.appendChild(node);
}
return node;
}
/**
* append elements.
*
* @param {Node} node
* @param {Collection} aChild
*/
function appendChildNodes(node, aChild, isSkipPaddingBlankHTML) {
external_root_jQuery_commonjs_jquery_commonjs2_jquery_amd_jquery_default().each(aChild, function (idx, child) {
// special case: appending a pure UL/OL to a LI element creates inaccessible LI element
// e.g. press enter in last LI which has UL/OL-subelements
// Therefore, if current node is LI element with no child nodes (text-node) and appending a list, add a br before
if (!isSkipPaddingBlankHTML && isLi(node) && node.firstChild === null && isList(child)) {
node.appendChild(create("br"));
}
node.appendChild(child);
});
return node;
}
/**
* returns whether boundaryPoint is left edge or not.
*
* @param {BoundaryPoint} point
* @return {Boolean}
*/
function isLeftEdgePoint(point) {
return point.offset === 0;
}
/**
* returns whether boundaryPoint is right edge or not.
*
* @param {BoundaryPoint} point
* @return {Boolean}
*/
function isRightEdgePoint(point) {
return point.offset === nodeLength(point.node);
}
/**
* returns whether boundaryPoint is edge or not.
*
* @param {BoundaryPoint} point
* @return {Boolean}
*/
function isEdgePoint(point) {
return isLeftEdgePoint(point) || isRightEdgePoint(point);
}
/**
* returns whether node is left edge of ancestor or not.
*
* @param {Node} node
* @param {Node} ancestor
* @return {Boolean}
*/
function isLeftEdgeOf(node, ancestor) {
while (node && node !== ancestor) {
if (position(node) !== 0) {
return false;
}
node = node.parentNode;
}
return true;
}
/**
* returns whether node is right edge of ancestor or not.
*
* @param {Node} node
* @param {Node} ancestor
* @return {Boolean}
*/
function isRightEdgeOf(node, ancestor) {
if (!ancestor) {
return false;
}
while (node && node !== ancestor) {
if (position(node) !== nodeLength(node.parentNode) - 1) {
return false;
}
node = node.parentNode;
}
return true;
}
/**
* returns whether point is left edge of ancestor or not.
* @param {BoundaryPoint} point
* @param {Node} ancestor
* @return {Boolean}
*/
function isLeftEdgePointOf(point, ancestor) {
return isLeftEdgePoint(point) && isLeftEdgeOf(point.node, ancestor);
}
/**
* returns whether point is right edge of ancestor or not.
* @param {BoundaryPoint} point
* @param {Node} ancestor
* @return {Boolean}
*/
function isRightEdgePointOf(point, ancestor) {
return isRightEdgePoint(point) && isRightEdgeOf(point.node, ancestor);
}
/**
* returns offset from parent.
*
* @param {Node} node
*/
function position(node) {
var offset = 0;
while (node = node.previousSibling) {
offset += 1;
}
return offset;
}
function hasChildren(node) {
return !!(node && node.childNodes && node.childNodes.length);
}
/**
* returns previous boundaryPoint
*
* @param {BoundaryPoint} point
* @param {Boolean} isSkipInnerOffset
* @return {BoundaryPoint}
*/
function prevPoint(point, isSkipInnerOffset) {
var node;
var offset;
if (point.offset === 0) {
if (isEditable(point.node)) {
return null;
}
node = point.node.parentNode;
offset = position(point.node);
} else if (hasChildren(point.node)) {
node = point.node.childNodes[point.offset - 1];
offset = nodeLength(node);
} else {
node = point.node;
offset = isSkipInnerOffset ? 0 : point.offset - 1;
}
return {
node: node,
offset: offset
};
}
/**
* returns next boundaryPoint
*
* @param {BoundaryPoint} point
* @param {Boolean} isSkipInnerOffset
* @return {BoundaryPoint}
*/
function nextPoint(point, isSkipInnerOffset) {
var node, offset;
if (nodeLength(point.node) === point.offset) {
if (isEditable(point.node)) {
return null;
}
var nextTextNode = getNextTextNode(point.node);
if (nextTextNode) {
node = nextTextNode;
offset = 0;
} else {
node = point.node.parentNode;
offset = position(point.node) + 1;
}
} else if (hasChildren(point.node)) {
node = point.node.childNodes[point.offset];
offset = 0;
} else {
node = point.node;
offset = isSkipInnerOffset ? nodeLength(point.node) : point.offset + 1;
}
return {
node: node,
offset: offset
};
}
/**
* Find next boundaryPoint for preorder / depth first traversal of the DOM
* returns next boundaryPoint with empty node
*
* @param {BoundaryPoint} point
* @param {Boolean} isSkipInnerOffset
* @return {BoundaryPoint}
*/
function nextPointWithEmptyNode(point, isSkipInnerOffset) {
var node,
offset = 0;
if (nodeLength(point.node) === point.offset) {
if (isEditable(point.node)) {
return null;
}
node = point.node.parentNode;
offset = position(point.node) + 1;
// if parent node is editable, return current node's sibling node.
if (isEditable(node)) {
node = point.node.nextSibling;
offset = 0;
}
} else if (hasChildren(point.node)) {
node = point.node.childNodes[point.offset];
offset = 0;
} else {
node = point.node;
offset = isSkipInnerOffset ? nodeLength(point.node) : point.offset + 1;
}
return {
node: node,
offset: offset
};
}
/*
* returns the next Text node index or 0 if not found.
*/
function getNextTextNode(actual) {
if (!actual.nextSibling) return undefined;
if (actual.parent !== actual.nextSibling.parent) return undefined;
if (isText(actual.nextSibling)) return actual.nextSibling;else return getNextTextNode(actual.nextSibling);
}
/**
* returns whether pointA and pointB is same or not.
*
* @param {BoundaryPoint} pointA
* @param {BoundaryPoint} pointB
* @return {Boolean}
*/
function isSamePoint(pointA, pointB) {
return pointA.node === pointB.node && pointA.offset === pointB.offset;
}
/**
* returns whether point is visible (can set cursor) or not.
*
* @param {BoundaryPoint} point
* @return {Boolean}
*/
function isVisiblePoint(point) {
if (isText(point.node) || !hasChildren(point.node) || dom_isEmpty(point.node)) {
return true;
}
var leftNode = point.node.childNodes[point.offset - 1];
var rightNode = point.node.childNodes[point.offset];
if ((!leftNode || isVoid(leftNode)) && (!rightNode || isVoid(rightNode)) || isTable(rightNode)) {
return true;
}
return false;
}
/**
* @method prevPointUtil
*
* @param {BoundaryPoint} point
* @param {Function} pred
* @return {BoundaryPoint}
*/
function prevPointUntil(point, pred) {
while (point) {
if (pred(point)) {
return point;
}
point = prevPoint(point);
}
return null;
}
/**
* @method nextPointUntil
*
* @param {BoundaryPoint} point
* @param {Function} pred
* @return {BoundaryPoint}
*/
function nextPointUntil(point, pred) {
while (point) {
if (pred(point)) {
return point;
}
point = nextPoint(point);
}
return null;
}
/**
* returns whether point has character or not.
*
* @param {Point} point
* @return {Boolean}
*/
function isCharPoint(point) {
if (!isText(point.node)) {
return false;
}
var ch = point.node.nodeValue.charAt(point.offset - 1);
return ch && ch !== ' ' && ch !== NBSP_CHAR;
}
/**
* returns whether point has space or not.
*
* @param {Point} point
* @return {Boolean}
*/
function isSpacePoint(point) {
if (!isText(point.node)) {
return false;
}
var ch = point.node.nodeValue.charAt(point.offset - 1);
return ch === ' ' || ch === NBSP_CHAR;
}
/**
* @method walkPoint - preorder / depth first traversal of the DOM
*
* @param {BoundaryPoint} startPoint
* @param {BoundaryPoint} endPoint
* @param {Function} handler
* @param {Boolean} isSkipInnerOffset
*/
function walkPoint(startPoint, endPoint, handler, isSkipInnerOffset) {
var point = startPoint;
while (point && point.node) {
handler(point);
if (isSamePoint(point, endPoint)) {
break;
}
var isSkipOffset = isSkipInnerOffset && startPoint.node !== point.node && endPoint.node !== point.node;
point = nextPointWithEmptyNode(point, isSkipOffset);
}
}
/**
* @method makeOffsetPath
*
* return offsetPath(array of offset) from ancestor
*
* @param {Node} ancestor - ancestor node
* @param {Node} node
*/
function makeOffsetPath(ancestor, node) {
var ancestors = listAncestor(node, func.eq(ancestor));
return ancestors.map(position).reverse();
}
/**
* @method fromOffsetPath
*
* return element from offsetPath(array of offset)
*
* @param {Node} ancestor - ancestor node
* @param {array} offsets - offsetPath
*/
function fromOffsetPath(ancestor, offsets) {
var current = ancestor;
for (var i = 0, len = offsets.length; i < len; i++) {
if (current.childNodes.length <= offsets[i]) {
current = current.childNodes[current.childNodes.length - 1];
} else {
current = current.childNodes[offsets[i]];
}
}
return current;
}
/**
* @method splitNode
*
* split element or #text
*
* @param {BoundaryPoint} point
* @param {Object} [options]
* @param {Boolean} [options.isSkipPaddingBlankHTML] - default: false
* @param {Boolean} [options.isNotSplitEdgePoint] - default: false
* @param {Boolean} [options.isDiscardEmptySplits] - default: false
* @return {Node} right node of boundaryPoint
*/
function splitNode(point, options) {
var isSkipPaddingBlankHTML = options && options.isSkipPaddingBlankHTML;
var isNotSplitEdgePoint = options && options.isNotSplitEdgePoint;
var isDiscardEmptySplits = options && options.isDiscardEmptySplits;
if (isDiscardEmptySplits) {
isSkipPaddingBlankHTML = true;
}
// edge case
if (isEdgePoint(point) && (isText(point.node) || isNotSplitEdgePoint)) {
if (isLeftEdgePoint(point)) {
return point.node;
} else if (isRightEdgePoint(point)) {
return point.node.nextSibling;
}
}
// split #text
if (isText(point.node)) {
return point.node.splitText(point.offset);
} else {
var childNode = point.node.childNodes[point.offset];
var childNodes = listNext(childNode);
var clone = insertAfter(point.node.cloneNode(false), point.node);
appendChildNodes(clone, childNodes);
if (!isSkipPaddingBlankHTML) {
paddingBlankHTML(point.node);
paddingBlankHTML(clone);
}
if (isDiscardEmptySplits) {
if (dom_isEmpty(point.node)) {
remove(point.node);
}
if (dom_isEmpty(clone)) {
remove(clone);
return point.node.nextSibling;
}
}
return clone;
}
}
/**
* @method splitTree
*
* split tree by point
*
* @param {Node} root - split root
* @param {BoundaryPoint} point
* @param {Object} [options]
* @param {Boolean} [options.isSkipPaddingBlankHTML] - default: false
* @param {Boolean} [options.isNotSplitEdgePoint] - default: false
* @return {Node} right node of boundaryPoint
*/
function splitTree(root, point, options) {
// ex) [#text, <span>, <p>]
var ancestors = listAncestor(point.node, func.eq(root));
if (!ancestors.length) {
return null;
} else if (ancestors.length === 1) {
return splitNode(point, options);
}
// Filter elements with sibling elements
if (ancestors.length > 2) {
var domList = ancestors.slice(0, ancestors.length - 1);
var ifHasNextSibling = domList.find(function (item) {
return item.nextSibling;
});
if (ifHasNextSibling && point.offset != 0 && isRightEdgePoint(point)) {
var nestSibling = ifHasNextSibling.nextSibling;
var textNode;
if (nestSibling.nodeType == 1) {
textNode = nestSibling.childNodes[0];
ancestors = listAncestor(textNode, func.eq(root));
point = {
node: textNode,
offset: 0
};
} else if (nestSibling.nodeType == 3 && !nestSibling.data.match(/[\n\r]/g)) {
textNode = nestSibling;
ancestors = listAncestor(textNode, func.eq(root));
point = {
node: textNode,
offset: 0
};
}
}
}
return ancestors.reduce(function (node, parent) {
if (node === point.node) {
node = splitNode(point, options);
}
return splitNode({
node: parent,
offset: node ? position(node) : nodeLength(parent)
}, options);
});
}
/**
* split point
*
* @param {Point} point
* @param {Boolean} isInline
* @return {Object}
*/
function splitPoint(point, isInline) {
// find splitRoot, container
// - inline: splitRoot is a child of paragraph
// - block: splitRoot is a child of bodyContainer
var pred = isInline ? isPara : isBodyContainer;
var ancestors = listAncestor(point.node, pred);
var topAncestor = lists.last(ancestors) || point.node;
var splitRoot, container;
if (pred(topAncestor)) {
splitRoot = ancestors[ancestors.length - 2];
container = topAncestor;
} else {
splitRoot = topAncestor;
container = splitRoot.parentNode;
}
// if splitRoot is exists, split with splitTree
var pivot = splitRoot && splitTree(splitRoot, point, {
isSkipPaddingBlankHTML: isInline,
isNotSplitEdgePoint: isInline
});
// if container is point.node, find pivot with point.offset
if (!pivot && container === point.node) {
pivot = point.node.childNodes[point.offset];
}
return {
rightNode: pivot,
container: container
};
}
function create(nodeName) {
return document.createElement(nodeName);
}
function createText(text) {
return document.createTextNode(text);
}
/**
* @method remove
*
* remove node, (isRemoveChild: remove child or not)
*
* @param {Node} node
* @param {Boolean} isRemoveChild
*/
function remove(node, isRemoveChild) {
if (!node || !node.parentNode) {
return;
}
if (node.removeNode) {
return node.removeNode(isRemoveChild);
}
var parent = node.parentNode;
if (!isRemoveChild) {
var nodes = [];
for (var i = 0, len = node.childNodes.length; i < len; i++) {
nodes.push(node.childNodes[i]);
}
for (var _i = 0, _len = nodes.length; _i < _len; _i++) {
parent.insertBefore(nodes[_i], node);
}
}
parent.removeChild(node);
}
/**
* @method removeWhile
*
* @param {Node} node
* @param {Function} pred
*/
function removeWhile(node, pred) {
while (node) {
if (isEditable(node) || !pred(node)) {
break;
}
var parent = node.parentNode;
remove(node);
node = parent;
}
}
/**
* @method replace
*
* replace node with provided nodeName
*
* @param {Node} node
* @param {String} nodeName
* @return {Node} - new node
*/
function replace(node, nodeName) {
if (node.nodeName.toUpperCase() === nodeName.toUpperCase()) {
return node;
}
var newNode = create(nodeName);
if (node.style.cssText) {
newNode.style.cssText = node.style.cssText;
}
appendChildNodes(newNode, lists.from(node.childNodes));
insertAfter(newNode, node);
remove(node);
return newNode;
}
var isTextarea = makePredByNodeName('TEXTAREA');
/**
* @param {jQuery} $node
* @param {Boolean} [stripLinebreaks] - default: false
*/
function value($node, stripLinebreaks) {
var val = isTextarea($node[0]) ? $node.val() : $node.html();
if (stripLinebreaks) {
return val.replace(/[\n\r]/g, '');
}
return val;
}
/**
* @method html
*
* get the HTML contents of node
*
* @param {jQuery} $node
* @param {Boolean} [isNewlineOnBlock]
*/
function html($node, isNewlineOnBlock) {
var markup = value($node);
if (isNewlineOnBlock) {
var regexTag = /<(\/?)(\b(?!!)[^>\s]*)(.*?)(\s*\/?>)/g;
markup = markup.replace(regexTag, function (match, endSlash, name) {
name = name.toUpperCase();
var isEndOfInlineContainer = /^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(name) && !!endSlash;
var isBlockNode = /^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(name);
return match + (isEndOfInlineContainer || isBlockNode ? '\n' : '');
});
markup = markup.trim();
}
return markup;
}
function posFromPlaceholder(placeholder) {
var $placeholder = external_root_jQuery_commonjs_jquery_commonjs2_jquery_amd_jquery_default()(placeholder);
var pos = $placeholder.offset();
var height = $placeholder.outerHeight(true); // include margin
return {
left: pos.left,
top: pos.top + height
};
}
function attachEvents($node, events) {
Object.keys(events).forEach(function (key) {
$node.on(key, events[key]);
});
}
function detachEvents($node, events) {
Object.keys(events).forEach(function (key) {
$node.off(key, events[key]);
});
}
/**
* @method isCustomStyleTag
*
* assert if a node contains a "note-styletag" class,
* which implies that's a custom-made style tag node
*
* @param {Node} an HTML DOM node
*/
function isCustomStyleTag(node) {
return node && !isText(node) && lists.contains(node.classList, 'note-styletag');
}
/* harmony default export */ const dom = ({
/** @property {String} NBSP_CHAR */
NBSP_CHAR: NBSP_CHAR,
/** @property {String} ZERO_WIDTH_NBSP_CHAR */
ZERO_WIDTH_NBSP_CHAR: ZERO_WIDTH_NBSP_CHAR,
/** @property {String} blank */
blank: blankHTML,
/** @property {String} emptyPara */
emptyPara: "<p>".concat(blankHTML, "</p>"),
makePredByNodeName: makePredByNodeName,
isEditable: isEditable,
isControlSizing: isControlSizing,
isText: isText,
isElement: isElement,
isVoid: isVoid,
isPara: isPara,
isPurePara: isPurePara,
isHeading: isHeading,
isInline: isInline,
isBlock: func.not(isInline),
isBodyInline: isBodyInline,
isBody: isBody,
isParaInline: isParaInline,
isPre: isPre,
isList: isList,
isTable: isTable,
isData: isData,
isCell: isCell,
isBlockquote: isBlockquote,
isBodyContainer: isBodyContainer,
isAnchor: isAnchor,
isDiv: makePredByNodeName('DIV'),
isLi: isLi,
isBR: makePredByNodeName('BR'),
isSpan: makePredByNodeName('SPAN'),
isB: makePredByNodeName('B'),
isU: makePredByNodeName('U'),
isS: makePredByNodeName('S'),
isI: makePredByNodeName('I'),
isImg: makePredByNodeName('IMG'),
isTextarea: isTextarea,
deepestChildIsEmpty: deepestChildIsEmpty,
isEmpty: dom_isEmpty,
isEmptyAnchor: func.and(isAnchor, dom_isEmpty),
isClosestSibling: isClosestSibling,
withClosestSiblings: withClosestSiblings,
nodeLength: nodeLength,
isLeftEdgePoint: isLeftEdgePoint,
isRightEdgePoint: isRightEdgePoint,
isEdgePoint: isEdgePoint,
isLeftEdgeOf: isLeftEdgeOf,
isRightEdgeOf: isRightEdgeOf,
isLeftEdgePointOf: isLeftEdgePointOf,
isRightEdgePointOf: isRightEdgePointOf,
prevPoint: prevPoint,
nextPoint: nextPoint,
nextPointWithEmptyNode: nextPointWithEmptyNode,
isSamePoint: isSamePoint,
isVisiblePoint: isVisiblePoint,
prevPointUntil: prevPointUntil,
nextPointUntil: nextPointUntil,
isCharPoint: isCharPoint,
isSpacePoint: isSpacePoint,
walkPoint: walkPoint,
ancestor: ancestor,
singleChildAncestor: singleChildAncestor,
listAncestor: listAncestor,
lastAncestor: lastAncestor,
listNext: listNext,
listPrev: listPrev,
listDescendant: listDescendant,
commonAncestor: commonAncestor,
wrap: wrap,
insertAfter: insertAfter,
appendChildNodes: appendChildNodes,
position: position,
hasChildren: hasChildren,
makeOffsetPath: makeOffsetPath,
fromOffsetPath: fromOffsetPath,
splitTree: splitTree,
splitPoint: splitPoint,
create: create,
createText: createText,
remove: remove,
removeWhile: removeWhile,
replace: replace,
html: html,
value: value,
posFromPlaceholder: posFromPlaceholder,
attachEvents: attachEvents,
detachEvents: detachEvents,
isCustomStyleTag: isCustomStyleTag
});
;// CONCATENATED MODULE: ./src/js/Context.js
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var Context = /*#__PURE__*/function () {
/**
* @param {jQuery} $note
* @param {Object} options
*/
function Context($note, options) {
_classCallCheck(this, Context);
this.$note = $note;
this.memos = {};
this.modules = {};
this.layoutInfo = {};
this.options = external_root_jQuery_commonjs_jquery_commonjs2_jquery_amd_jquery_default().extend(true, {}, options);
// init ui with options
(external_root_jQuery_commonjs_jquery_commonjs2_jquery_amd_jquery_default()).summernote.ui = external_root_jQuery_commonjs_jquery_commonjs2