UNPKG

@toast-ui/editor

Version:

GFM Markdown Wysiwyg Editor - Productive and Extensible

1,845 lines (1,437 loc) 826 kB
/*! * @toast-ui/editor * @version 3.0.0-alpha.1 | Wed Jun 16 2021 * @author NHN FE Development Lab <dl_javascript@nhn.com> * @license MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("prosemirror-commands"), require("prosemirror-history"), require("prosemirror-inputrules"), require("prosemirror-keymap"), require("prosemirror-model"), require("prosemirror-state"), require("prosemirror-transform"), require("prosemirror-view")); else if(typeof define === 'function' && define.amd) define(["prosemirror-commands", "prosemirror-history", "prosemirror-inputrules", "prosemirror-keymap", "prosemirror-model", "prosemirror-state", "prosemirror-transform", "prosemirror-view"], factory); else if(typeof exports === 'object') exports["toastui"] = factory(require("prosemirror-commands"), require("prosemirror-history"), require("prosemirror-inputrules"), require("prosemirror-keymap"), require("prosemirror-model"), require("prosemirror-state"), require("prosemirror-transform"), require("prosemirror-view")); else root["toastui"] = root["toastui"] || {}, root["toastui"]["Editor"] = factory(root[undefined], root[undefined], root[undefined], root[undefined], root[undefined], root[undefined], root[undefined], root[undefined]); })(self, function(__WEBPACK_EXTERNAL_MODULE__818__, __WEBPACK_EXTERNAL_MODULE__168__, __WEBPACK_EXTERNAL_MODULE__925__, __WEBPACK_EXTERNAL_MODULE__703__, __WEBPACK_EXTERNAL_MODULE__959__, __WEBPACK_EXTERNAL_MODULE__676__, __WEBPACK_EXTERNAL_MODULE__747__, __WEBPACK_EXTERNAL_MODULE__754__) { return /******/ (function() { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ 928: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /* eslint-disable complexity */ /** * @fileoverview Returns the first index at which a given element can be found in the array. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var isArray = __webpack_require__(322); /** * @module array */ /** * Returns the first index at which a given element can be found in the array * from start index(default 0), or -1 if it is not present. * It compares searchElement to elements of the Array using strict equality * (the same method used by the ===, or triple-equals, operator). * @param {*} searchElement Element to locate in the array * @param {Array} array Array that will be traversed. * @param {number} startIndex Start index in array for searching (default 0) * @returns {number} the First index at which a given element, or -1 if it is not present * @memberof module:array * @example * var inArray = require('tui-code-snippet/array/inArray'); // node, commonjs * * var arr = ['one', 'two', 'three', 'four']; * var idx1 = inArray('one', arr, 3); // -1 * var idx2 = inArray('one', arr); // 0 */ function inArray(searchElement, array, startIndex) { var i; var length; startIndex = startIndex || 0; if (!isArray(array)) { return -1; } if (Array.prototype.indexOf) { return Array.prototype.indexOf.call(array, searchElement, startIndex); } length = array.length; for (i = startIndex; startIndex >= 0 && i < length; i += 1) { if (array[i] === searchElement) { return i; } } return -1; } module.exports = inArray; /***/ }), /***/ 690: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Execute the provided callback once for each property of object(or element of array) which actually exist. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var isArray = __webpack_require__(322); var forEachArray = __webpack_require__(893); var forEachOwnProperties = __webpack_require__(956); /** * @module collection */ /** * Execute the provided callback once for each property of object(or element of array) which actually exist. * If the object is Array-like object(ex-arguments object), It needs to transform to Array.(see 'ex2' of example). * If the callback function returns false, the loop will be stopped. * Callback function(iteratee) is invoked with three arguments: * 1) The value of the property(or The value of the element) * 2) The name of the property(or The index of the element) * 3) The object being traversed * @param {Object} obj The object that will be traversed * @param {function} iteratee Callback function * @param {Object} [context] Context(this) of callback function * @memberof module:collection * @example * var forEach = require('tui-code-snippet/collection/forEach'); // node, commonjs * * var sum = 0; * * forEach([1,2,3], function(value){ * sum += value; * }); * alert(sum); // 6 * * // In case of Array-like object * var array = Array.prototype.slice.call(arrayLike); // change to array * forEach(array, function(value){ * sum += value; * }); */ function forEach(obj, iteratee, context) { if (isArray(obj)) { forEachArray(obj, iteratee, context); } else { forEachOwnProperties(obj, iteratee, context); } } module.exports = forEach; /***/ }), /***/ 893: /***/ (function(module) { /** * @fileoverview Execute the provided callback once for each element present in the array(or Array-like object) in ascending order. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ /** * Execute the provided callback once for each element present * in the array(or Array-like object) in ascending order. * If the callback function returns false, the loop will be stopped. * Callback function(iteratee) is invoked with three arguments: * 1) The value of the element * 2) The index of the element * 3) The array(or Array-like object) being traversed * @param {Array|Arguments|NodeList} arr The array(or Array-like object) that will be traversed * @param {function} iteratee Callback function * @param {Object} [context] Context(this) of callback function * @memberof module:collection * @example * var forEachArray = require('tui-code-snippet/collection/forEachArray'); // node, commonjs * * var sum = 0; * * forEachArray([1,2,3], function(value){ * sum += value; * }); * alert(sum); // 6 */ function forEachArray(arr, iteratee, context) { var index = 0; var len = arr.length; context = context || null; for (; index < len; index += 1) { if (iteratee.call(context, arr[index], index, arr) === false) { break; } } } module.exports = forEachArray; /***/ }), /***/ 956: /***/ (function(module) { /** * @fileoverview Execute the provided callback once for each property of object which actually exist. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ /** * Execute the provided callback once for each property of object which actually exist. * If the callback function returns false, the loop will be stopped. * Callback function(iteratee) is invoked with three arguments: * 1) The value of the property * 2) The name of the property * 3) The object being traversed * @param {Object} obj The object that will be traversed * @param {function} iteratee Callback function * @param {Object} [context] Context(this) of callback function * @memberof module:collection * @example * var forEachOwnProperties = require('tui-code-snippet/collection/forEachOwnProperties'); // node, commonjs * * var sum = 0; * * forEachOwnProperties({a:1,b:2,c:3}, function(value){ * sum += value; * }); * alert(sum); // 6 */ function forEachOwnProperties(obj, iteratee, context) { var key; context = context || null; for (key in obj) { if (obj.hasOwnProperty(key)) { if (iteratee.call(context, obj[key], key, obj) === false) { break; } } } } module.exports = forEachOwnProperties; /***/ }), /***/ 990: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Transform the Array-like object to Array. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var forEachArray = __webpack_require__(893); /** * Transform the Array-like object to Array. * In low IE (below 8), Array.prototype.slice.call is not perfect. So, try-catch statement is used. * @param {*} arrayLike Array-like object * @returns {Array} Array * @memberof module:collection * @example * var toArray = require('tui-code-snippet/collection/toArray'); // node, commonjs * * var arrayLike = { * 0: 'one', * 1: 'two', * 2: 'three', * 3: 'four', * length: 4 * }; * var result = toArray(arrayLike); * * alert(result instanceof Array); // true * alert(result); // one,two,three,four */ function toArray(arrayLike) { var arr; try { arr = Array.prototype.slice.call(arrayLike); } catch (e) { arr = []; forEachArray(arrayLike, function(value) { arr.push(value); }); } return arr; } module.exports = toArray; /***/ }), /***/ 755: /***/ (function(module) { /** * @fileoverview Get event collection for specific HTML element * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var EVENT_KEY = '_feEventKey'; /** * Get event collection for specific HTML element * @param {HTMLElement} element - HTML element * @param {string} type - event type * @returns {array} * @private */ function safeEvent(element, type) { var events = element[EVENT_KEY]; var handlers; if (!events) { events = element[EVENT_KEY] = {}; } handlers = events[type]; if (!handlers) { handlers = events[type] = []; } return handlers; } module.exports = safeEvent; /***/ }), /***/ 349: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Unbind DOM events * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var isString = __webpack_require__(758); var forEach = __webpack_require__(690); var safeEvent = __webpack_require__(755); /** * Unbind DOM events * If a handler function is not passed, remove all events of that type. * @param {HTMLElement} element - element to unbind events * @param {(string|object)} types - Space splitted events names or eventName:handler object * @param {function} [handler] - handler function * @memberof module:domEvent * @example * // Following the example of domEvent#on * * // Unbind one event from an element. * off(div, 'click', toggle); * * // Unbind multiple events with a same handler from multiple elements at once. * // Use event names splitted by a space. * off(element, 'mouseenter mouseleave', changeColor); * * // Unbind multiple events with different handlers from an element at once. * // Use an object which of key is an event name and value is a handler function. * off(div, { * keydown: highlight, * keyup: dehighlight * }); * * // Unbind events without handlers. * off(div, 'drag'); */ function off(element, types, handler) { if (isString(types)) { forEach(types.split(/\s+/g), function(type) { unbindEvent(element, type, handler); }); return; } forEach(types, function(func, type) { unbindEvent(element, type, func); }); } /** * Unbind DOM events * If a handler function is not passed, remove all events of that type. * @param {HTMLElement} element - element to unbind events * @param {string} type - events name * @param {function} [handler] - handler function * @private */ function unbindEvent(element, type, handler) { var events = safeEvent(element, type); var index; if (!handler) { forEach(events, function(item) { removeHandler(element, type, item.wrappedHandler); }); events.splice(0, events.length); } else { forEach(events, function(item, idx) { if (handler === item.handler) { removeHandler(element, type, item.wrappedHandler); index = idx; return false; } return true; }); events.splice(index, 1); } } /** * Remove an event handler * @param {HTMLElement} element - An element to remove an event * @param {string} type - event type * @param {function} handler - event handler * @private */ function removeHandler(element, type, handler) { if ('removeEventListener' in element) { element.removeEventListener(type, handler); } else if ('detachEvent' in element) { element.detachEvent('on' + type, handler); } } module.exports = off; /***/ }), /***/ 348: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Bind DOM events * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var isString = __webpack_require__(758); var forEach = __webpack_require__(690); var safeEvent = __webpack_require__(755); /** * Bind DOM events. * @param {HTMLElement} element - element to bind events * @param {(string|object)} types - Space splitted events names or eventName:handler object * @param {(function|object)} handler - handler function or context for handler method * @param {object} [context] context - context for handler method. * @memberof module:domEvent * @example * var div = document.querySelector('div'); * * // Bind one event to an element. * on(div, 'click', toggle); * * // Bind multiple events with a same handler to multiple elements at once. * // Use event names splitted by a space. * on(div, 'mouseenter mouseleave', changeColor); * * // Bind multiple events with different handlers to an element at once. * // Use an object which of key is an event name and value is a handler function. * on(div, { * keydown: highlight, * keyup: dehighlight * }); * * // Set a context for handler method. * var name = 'global'; * var repository = {name: 'CodeSnippet'}; * on(div, 'drag', function() { * console.log(this.name); * }, repository); * // Result when you drag a div: "CodeSnippet" */ function on(element, types, handler, context) { if (isString(types)) { forEach(types.split(/\s+/g), function(type) { bindEvent(element, type, handler, context); }); return; } forEach(types, function(func, type) { bindEvent(element, type, func, handler); }); } /** * Bind DOM events * @param {HTMLElement} element - element to bind events * @param {string} type - events name * @param {function} handler - handler function or context for handler method * @param {object} [context] context - context for handler method. * @private */ function bindEvent(element, type, handler, context) { /** * Event handler * @param {Event} e - event object */ function eventHandler(e) { handler.call(context || element, e || window.event); } if ('addEventListener' in element) { element.addEventListener(type, eventHandler); } else if ('attachEvent' in element) { element.attachEvent('on' + type, eventHandler); } memorizeHandler(element, type, handler, eventHandler); } /** * Memorize DOM event handler for unbinding. * @param {HTMLElement} element - element to bind events * @param {string} type - events name * @param {function} handler - handler function that user passed at on() use * @param {function} wrappedHandler - handler function that wrapped by domevent for implementing some features * @private */ function memorizeHandler(element, type, handler, wrappedHandler) { var events = safeEvent(element, type); var existInEvents = false; forEach(events, function(obj) { if (obj.handler === handler) { existInEvents = true; return false; } return true; }); if (!existInEvents) { events.push({ handler: handler, wrappedHandler: wrappedHandler }); } } module.exports = on; /***/ }), /***/ 24: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Set className value * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var isArray = __webpack_require__(322); var isUndefined = __webpack_require__(929); /** * Set className value * @param {(HTMLElement|SVGElement)} element - target element * @param {(string|string[])} cssClass - class names * @private */ function setClassName(element, cssClass) { cssClass = isArray(cssClass) ? cssClass.join(' ') : cssClass; cssClass = cssClass.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); if (isUndefined(element.className.baseVal)) { element.className = cssClass; return; } element.className.baseVal = cssClass; } module.exports = setClassName; /***/ }), /***/ 204: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Add css class to element * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var forEach = __webpack_require__(690); var inArray = __webpack_require__(928); var getClass = __webpack_require__(902); var setClassName = __webpack_require__(24); /** * domUtil module * @module domUtil */ /** * Add css class to element * @param {(HTMLElement|SVGElement)} element - target element * @param {...string} cssClass - css classes to add * @memberof module:domUtil */ function addClass(element) { var cssClass = Array.prototype.slice.call(arguments, 1); var classList = element.classList; var newClass = []; var origin; if (classList) { forEach(cssClass, function(name) { element.classList.add(name); }); return; } origin = getClass(element); if (origin) { cssClass = [].concat(origin.split(/\s+/), cssClass); } forEach(cssClass, function(cls) { if (inArray(cls, newClass) < 0) { newClass.push(cls); } }); setClassName(element, newClass); } module.exports = addClass; /***/ }), /***/ 522: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Setting element style * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var isString = __webpack_require__(758); var forEach = __webpack_require__(690); /** * Setting element style * @param {(HTMLElement|SVGElement)} element - element to setting style * @param {(string|object)} key - style prop name or {prop: value} pair object * @param {string} [value] - style value * @memberof module:domUtil */ function css(element, key, value) { var style = element.style; if (isString(key)) { style[key] = value; return; } forEach(key, function(v, k) { style[k] = v; }); } module.exports = css; /***/ }), /***/ 902: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Get HTML element's design classes. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var isUndefined = __webpack_require__(929); /** * Get HTML element's design classes. * @param {(HTMLElement|SVGElement)} element target element * @returns {string} element css class name * @memberof module:domUtil */ function getClass(element) { if (!element || !element.className) { return ''; } if (isUndefined(element.className.baseVal)) { return element.className; } return element.className.baseVal; } module.exports = getClass; /***/ }), /***/ 714: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Check element has specific css class * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var inArray = __webpack_require__(928); var getClass = __webpack_require__(902); /** * Check element has specific css class * @param {(HTMLElement|SVGElement)} element - target element * @param {string} cssClass - css class * @returns {boolean} * @memberof module:domUtil */ function hasClass(element, cssClass) { var origin; if (element.classList) { return element.classList.contains(cssClass); } origin = getClass(element).split(/\s+/); return inArray(cssClass, origin) > -1; } module.exports = hasClass; /***/ }), /***/ 471: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Check element match selector * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var inArray = __webpack_require__(928); var toArray = __webpack_require__(990); var elProto = Element.prototype; var matchSelector = elProto.matches || elProto.webkitMatchesSelector || elProto.mozMatchesSelector || elProto.msMatchesSelector || function(selector) { var doc = this.document || this.ownerDocument; return inArray(this, toArray(doc.querySelectorAll(selector))) > -1; }; /** * Check element match selector * @param {HTMLElement} element - element to check * @param {string} selector - selector to check * @returns {boolean} is selector matched to element? * @memberof module:domUtil */ function matches(element, selector) { return matchSelector.call(element, selector); } module.exports = matches; /***/ }), /***/ 462: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Remove css class from element * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var forEachArray = __webpack_require__(893); var inArray = __webpack_require__(928); var getClass = __webpack_require__(902); var setClassName = __webpack_require__(24); /** * Remove css class from element * @param {(HTMLElement|SVGElement)} element - target element * @param {...string} cssClass - css classes to remove * @memberof module:domUtil */ function removeClass(element) { var cssClass = Array.prototype.slice.call(arguments, 1); var classList = element.classList; var origin, newClass; if (classList) { forEachArray(cssClass, function(name) { classList.remove(name); }); return; } origin = getClass(element).split(/\s+/); newClass = []; forEachArray(origin, function(name) { if (inArray(name, cssClass) < 0) { newClass.push(name); } }); setClassName(element, newClass); } module.exports = removeClass; /***/ }), /***/ 969: /***/ (function(module) { /** * @fileoverview Extend the target object from other objects. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ /** * @module object */ /** * Extend the target object from other objects. * @param {object} target - Object that will be extended * @param {...object} objects - Objects as sources * @returns {object} Extended object * @memberof module:object */ function extend(target, objects) { // eslint-disable-line no-unused-vars var hasOwnProp = Object.prototype.hasOwnProperty; var source, prop, i, len; for (i = 1, len = arguments.length; i < len; i += 1) { source = arguments[i]; for (prop in source) { if (hasOwnProp.call(source, prop)) { target[prop] = source[prop]; } } } return target; } module.exports = extend; /***/ }), /***/ 254: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Request image ping. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var forEachOwnProperties = __webpack_require__(956); /** * @module request */ /** * Request image ping. * @param {String} url url for ping request * @param {Object} trackingInfo infos for make query string * @returns {HTMLElement} * @memberof module:request * @example * var imagePing = require('tui-code-snippet/request/imagePing'); // node, commonjs * * imagePing('https://www.google-analytics.com/collect', { * v: 1, * t: 'event', * tid: 'trackingid', * cid: 'cid', * dp: 'dp', * dh: 'dh' * }); */ function imagePing(url, trackingInfo) { var trackingElement = document.createElement('img'); var queryString = ''; forEachOwnProperties(trackingInfo, function(value, key) { queryString += '&' + key + '=' + value; }); queryString = queryString.substring(1); trackingElement.src = url + '?' + queryString; trackingElement.style.display = 'none'; document.body.appendChild(trackingElement); document.body.removeChild(trackingElement); return trackingElement; } module.exports = imagePing; /***/ }), /***/ 391: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Send hostname on DOMContentLoaded. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var isUndefined = __webpack_require__(929); var imagePing = __webpack_require__(254); var ms7days = 7 * 24 * 60 * 60 * 1000; /** * Check if the date has passed 7 days * @param {number} date - milliseconds * @returns {boolean} * @private */ function isExpired(date) { var now = new Date().getTime(); return now - date > ms7days; } /** * Send hostname on DOMContentLoaded. * To prevent hostname set tui.usageStatistics to false. * @param {string} appName - application name * @param {string} trackingId - GA tracking ID * @ignore */ function sendHostname(appName, trackingId) { var url = 'https://www.google-analytics.com/collect'; var hostname = location.hostname; var hitType = 'event'; var eventCategory = 'use'; var applicationKeyForStorage = 'TOAST UI ' + appName + ' for ' + hostname + ': Statistics'; var date = window.localStorage.getItem(applicationKeyForStorage); // skip if the flag is defined and is set to false explicitly if (!isUndefined(window.tui) && window.tui.usageStatistics === false) { return; } // skip if not pass seven days old if (date && !isExpired(date)) { return; } window.localStorage.setItem(applicationKeyForStorage, new Date().getTime()); setTimeout(function() { if (document.readyState === 'interactive' || document.readyState === 'complete') { imagePing(url, { v: 1, t: hitType, tid: trackingId, cid: hostname, dp: hostname, dh: appName, el: appName, ec: eventCategory }); } }, 1000); } module.exports = sendHostname; /***/ }), /***/ 516: /***/ (function(module) { /** * @fileoverview Creates a debounced function that delays invoking fn until after delay milliseconds has elapsed since the last time the debouced function was invoked. * @author NHN FE Development Lab <dl_javascript.nhn.com> */ /** * @module tricks */ /** * Creates a debounced function that delays invoking fn until after delay milliseconds has elapsed * since the last time the debouced function was invoked. * @param {function} fn The function to debounce. * @param {number} [delay=0] The number of milliseconds to delay * @returns {function} debounced function. * @memberof module:tricks * @example * var debounce = require('tui-code-snippet/tricks/debounce'); // node, commonjs * * function someMethodToInvokeDebounced() {} * * var debounced = debounce(someMethodToInvokeDebounced, 300); * * // invoke repeatedly * debounced(); * debounced(); * debounced(); * debounced(); * debounced(); * debounced(); // last invoke of debounced() * * // invoke someMethodToInvokeDebounced() after 300 milliseconds. */ function debounce(fn, delay) { var timer, args; /* istanbul ignore next */ delay = delay || 0; function debounced() { // eslint-disable-line require-jsdoc args = Array.prototype.slice.call(arguments); window.clearTimeout(timer); timer = window.setTimeout(function() { fn.apply(null, args); }, delay); } return debounced; } module.exports = debounce; /***/ }), /***/ 423: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Creates a throttled function that only invokes fn at most once per every interval milliseconds. * @author NHN FE Development Lab <dl_javascript.nhn.com> */ var debounce = __webpack_require__(516); /** * Creates a throttled function that only invokes fn at most once per every interval milliseconds. * You can use this throttle short time repeatedly invoking functions. (e.g MouseMove, Resize ...) * if you need reuse throttled method. you must remove slugs (e.g. flag variable) related with throttling. * @param {function} fn function to throttle * @param {number} [interval=0] the number of milliseconds to throttle invocations to. * @returns {function} throttled function * @memberof module:tricks * @example * var throttle = require('tui-code-snippet/tricks/throttle'); // node, commonjs * * function someMethodToInvokeThrottled() {} * * var throttled = throttle(someMethodToInvokeThrottled, 300); * * // invoke repeatedly * throttled(); // invoke (leading) * throttled(); * throttled(); // invoke (near 300 milliseconds) * throttled(); * throttled(); * throttled(); // invoke (near 600 milliseconds) * // ... * // invoke (trailing) * * // if you need reuse throttled method. then invoke reset() * throttled.reset(); */ function throttle(fn, interval) { var base; var isLeading = true; var tick = function(_args) { fn.apply(null, _args); base = null; }; var debounced, stamp, args; /* istanbul ignore next */ interval = interval || 0; debounced = debounce(tick, interval); function throttled() { // eslint-disable-line require-jsdoc args = Array.prototype.slice.call(arguments); if (isLeading) { tick(args); isLeading = false; return; } stamp = Number(new Date()); base = base || stamp; // pass array directly because `debounce()`, `tick()` are already use // `apply()` method to invoke developer's `fn` handler. // // also, this `debounced` line invoked every time for implements // `trailing` features. debounced(args); if ((stamp - base) >= interval) { tick(args); } } function reset() { // eslint-disable-line require-jsdoc isLeading = true; base = null; } throttled.reset = reset; return throttled; } module.exports = throttle; /***/ }), /***/ 322: /***/ (function(module) { /** * @fileoverview Check whether the given variable is an instance of Array or not. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ /** * Check whether the given variable is an instance of Array or not. * If the given variable is an instance of Array, return true. * @param {*} obj - Target for checking * @returns {boolean} Is array instance? * @memberof module:type */ function isArray(obj) { return obj instanceof Array; } module.exports = isArray; /***/ }), /***/ 326: /***/ (function(module) { /** * @fileoverview Check whether the given variable is a string or not. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ /** * Check whether the given variable is a boolean or not. * If the given variable is a boolean, return true. * @param {*} obj - Target for checking * @returns {boolean} Is boolean? * @memberof module:type */ function isBoolean(obj) { return typeof obj === 'boolean' || obj instanceof Boolean; } module.exports = isBoolean; /***/ }), /***/ 65: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Check whether the given variable is existing or not. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var isUndefined = __webpack_require__(929); var isNull = __webpack_require__(934); /** * Check whether the given variable is existing or not. * If the given variable is not null and not undefined, returns true. * @param {*} param - Target for checking * @returns {boolean} Is existy? * @memberof module:type * @example * var isExisty = require('tui-code-snippet/type/isExisty'); // node, commonjs * * isExisty(''); //true * isExisty(0); //true * isExisty([]); //true * isExisty({}); //true * isExisty(null); //false * isExisty(undefined); //false */ function isExisty(param) { return !isUndefined(param) && !isNull(param); } module.exports = isExisty; /***/ }), /***/ 404: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Check whether the given variable is falsy or not. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var isTruthy = __webpack_require__(790); /** * Check whether the given variable is falsy or not. * If the given variable is null or undefined or false, returns true. * @param {*} obj - Target for checking * @returns {boolean} Is falsy? * @memberof module:type */ function isFalsy(obj) { return !isTruthy(obj); } module.exports = isFalsy; /***/ }), /***/ 294: /***/ (function(module) { /** * @fileoverview Check whether the given variable is a function or not. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ /** * Check whether the given variable is a function or not. * If the given variable is a function, return true. * @param {*} obj - Target for checking * @returns {boolean} Is function? * @memberof module:type */ function isFunction(obj) { return obj instanceof Function; } module.exports = isFunction; /***/ }), /***/ 934: /***/ (function(module) { /** * @fileoverview Check whether the given variable is null or not. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ /** * Check whether the given variable is null or not. * If the given variable(arguments[0]) is null, returns true. * @param {*} obj - Target for checking * @returns {boolean} Is null? * @memberof module:type */ function isNull(obj) { return obj === null; } module.exports = isNull; /***/ }), /***/ 321: /***/ (function(module) { /** * @fileoverview Check whether the given variable is a number or not. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ /** * Check whether the given variable is a number or not. * If the given variable is a number, return true. * @param {*} obj - Target for checking * @returns {boolean} Is number? * @memberof module:type */ function isNumber(obj) { return typeof obj === 'number' || obj instanceof Number; } module.exports = isNumber; /***/ }), /***/ 73: /***/ (function(module) { /** * @fileoverview Check whether the given variable is an object or not. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ /** * Check whether the given variable is an object or not. * If the given variable is an object, return true. * @param {*} obj - Target for checking * @returns {boolean} Is object? * @memberof module:type */ function isObject(obj) { return obj === Object(obj); } module.exports = isObject; /***/ }), /***/ 758: /***/ (function(module) { /** * @fileoverview Check whether the given variable is a string or not. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ /** * Check whether the given variable is a string or not. * If the given variable is a string, return true. * @param {*} obj - Target for checking * @returns {boolean} Is string? * @memberof module:type */ function isString(obj) { return typeof obj === 'string' || obj instanceof String; } module.exports = isString; /***/ }), /***/ 790: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { /** * @fileoverview Check whether the given variable is truthy or not. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ var isExisty = __webpack_require__(65); /** * Check whether the given variable is truthy or not. * If the given variable is not null or not undefined or not false, returns true. * (It regards 0 as true) * @param {*} obj - Target for checking * @returns {boolean} Is truthy? * @memberof module:type */ function isTruthy(obj) { return isExisty(obj) && obj !== false; } module.exports = isTruthy; /***/ }), /***/ 929: /***/ (function(module) { /** * @fileoverview Check whether the given variable is undefined or not. * @author NHN FE Development Lab <dl_javascript@nhn.com> */ /** * Check whether the given variable is undefined or not. * If the given variable is undefined, returns true. * @param {*} obj - Target for checking * @returns {boolean} Is undefined? * @memberof module:type */ function isUndefined(obj) { return obj === undefined; // eslint-disable-line no-undefined } module.exports = isUndefined; /***/ }), /***/ 818: /***/ (function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE__818__; /***/ }), /***/ 168: /***/ (function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE__168__; /***/ }), /***/ 925: /***/ (function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE__925__; /***/ }), /***/ 703: /***/ (function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE__703__; /***/ }), /***/ 959: /***/ (function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE__959__; /***/ }), /***/ 676: /***/ (function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE__676__; /***/ }), /***/ 747: /***/ (function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE__747__; /***/ }), /***/ 754: /***/ (function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE__754__; /***/ }) /******/ }); /************************************************************************/ /******/ // 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 */ /******/ !function() { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function() { return module['default']; } : /******/ function() { return module; }; /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ }(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ !function() { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = function(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/global */ /******/ !function() { /******/ __webpack_require__.g = (function() { /******/ if (typeof globalThis === 'object') return globalThis; /******/ try { /******/ return this || new Function('return this')(); /******/ } catch (e) { /******/ if (typeof window === 'object') return window; /******/ } /******/ })(); /******/ }(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ !function() { /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } /******/ }(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. !function() { // EXPORTS __webpack_require__.d(__webpack_exports__, { "default": function() { return /* binding */ src; } }); // UNUSED EXPORTS: Editor, EditorCore ;// CONCATENATED MODULE: ../../node_modules/tslib/tslib.es6.js /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */ var extendStatics = function(d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; } return __assign.apply(this, arguments); } function __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __decorate(decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; } function __param(paramIndex, decorator) { return function (target, key) { decorator(target, key, paramIndex); } } function __metadata(metadataKey, metadataValue) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var __createBinding = Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); function __exportStar(m, o) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } /** @deprecated */ function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } /** @deprecated */ function __spreadArrays() { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; } function __spreadArray(to, from) { for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i]; return to; } function __await(v) { return this instanceof __await ? (this.v = v, this) : new __await(v); } function __asyncGenerator(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var g = generator.apply(thisArg, _arguments || []), i, q = []; return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } function fulfill(value) { resume("next", value); } function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } } function __asyncDelegator(o) { var i, p; return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } } function __asyncValues(o) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); var m = o[Symbol.asyncIterator], i; return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } } function __makeTemplateObject(cooked, raw) { if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } return cooked; }; var __setModuleDefault = Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }; function __importStar(mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (