UNPKG

vue2-rich-editor

Version:

A rich text editor component for Vue 2

1,610 lines (1,304 loc) 1.31 MB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["vue2-rich-editor"] = factory(); else root["vue2-rich-editor"] = factory(); })((typeof self !== 'undefined' ? self : this), function() { return /******/ (function() { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 655: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var classof = __webpack_require__(36955); var $String = String; module.exports = function (argument) { if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string'); return $String(argument); }; /***/ }), /***/ 681: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var parent = __webpack_require__(96754); module.exports = parent; /***/ }), /***/ 828: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; var defineWellKnownSymbol = __webpack_require__(27735); // `Symbol.customMatcher` well-known symbol // https://github.com/tc39/proposal-pattern-matching defineWellKnownSymbol('customMatcher'); /***/ }), /***/ 1103: /***/ (function(module) { "use strict"; module.exports = function (exec) { try { return { error: false, value: exec() }; } catch (error) { return { error: true, value: error }; } }; /***/ }), /***/ 1165: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var parent = __webpack_require__(45796); module.exports = parent; /***/ }), /***/ 1292: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var classofRaw = __webpack_require__(81496); var uncurryThis = __webpack_require__(42936); module.exports = function (fn) { // Nashorn bug: // https://github.com/zloirock/core-js/issues/1128 // https://github.com/zloirock/core-js/issues/1130 if (classofRaw(fn) === 'Function') return uncurryThis(fn); }; /***/ }), /***/ 1469: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var arraySpeciesConstructor = __webpack_require__(87433); // `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate module.exports = function (originalArray, length) { return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length); }; /***/ }), /***/ 1562: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var parent = __webpack_require__(1165); module.exports = parent; /***/ }), /***/ 1625: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(79504); module.exports = uncurryThis({}.isPrototypeOf); /***/ }), /***/ 1767: /***/ (function(module) { "use strict"; // `GetIteratorDirect(obj)` abstract operation // https://tc39.es/ecma262/#sec-getiteratordirect module.exports = function (obj) { return { iterator: obj, next: obj.next, done: false }; }; /***/ }), /***/ 1857: /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) { "use strict"; // EXPORTS __webpack_require__.d(__webpack_exports__, { A: function() { return /* binding */ _callSuper; } }); // EXTERNAL MODULE: ./node_modules/core-js-pure/full/reflect/construct.js var construct = __webpack_require__(35318); // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/getPrototypeOf.js var getPrototypeOf = __webpack_require__(19707); ;// ./node_modules/@babel/runtime-corejs3/helpers/esm/isNativeReflectConstruct.js function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // EXTERNAL MODULE: ./node_modules/@babel/runtime-corejs3/helpers/esm/possibleConstructorReturn.js + 1 modules var possibleConstructorReturn = __webpack_require__(14684); ;// ./node_modules/@babel/runtime-corejs3/helpers/esm/callSuper.js function _callSuper(t, o, e) { return o = (0,getPrototypeOf/* default */.A)(o), (0,possibleConstructorReturn/* default */.A)(t, _isNativeReflectConstruct() ? construct(o, e || [], (0,getPrototypeOf/* default */.A)(t).constructor) : o.apply(t, e)); } /***/ }), /***/ 2008: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(46518); var $filter = (__webpack_require__(59213).filter); var arrayMethodHasSpeciesSupport = __webpack_require__(70597); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter'); // `Array.prototype.filter` method // https://tc39.es/ecma262/#sec-array.prototype.filter // with adding support of @@species $({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, { filter: function filter(callbackfn /* , thisArg */) { return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); /***/ }), /***/ 2145: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var call = __webpack_require__(30933); var isObject = __webpack_require__(95146); var isSymbol = __webpack_require__(23597); var getMethod = __webpack_require__(91990); var ordinaryToPrimitive = __webpack_require__(16710); var wellKnownSymbol = __webpack_require__(61019); var $TypeError = TypeError; var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive module.exports = function (input, pref) { if (!isObject(input) || isSymbol(input)) return input; var exoticToPrim = getMethod(input, TO_PRIMITIVE); var result; if (exoticToPrim) { if (pref === undefined) pref = 'default'; result = call(exoticToPrim, input, pref); if (!isObject(result) || isSymbol(result)) return result; throw new $TypeError("Can't convert object to primitive value"); } if (pref === undefined) pref = 'number'; return ordinaryToPrimitive(input, pref); }; /***/ }), /***/ 2293: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var anObject = __webpack_require__(28551); var aConstructor = __webpack_require__(35548); var isNullOrUndefined = __webpack_require__(64117); var wellKnownSymbol = __webpack_require__(78227); var SPECIES = wellKnownSymbol('species'); // `SpeciesConstructor` abstract operation // https://tc39.es/ecma262/#sec-speciesconstructor module.exports = function (O, defaultConstructor) { var C = anObject(O).constructor; var S; return C === undefined || isNullOrUndefined(S = anObject(C)[SPECIES]) ? defaultConstructor : aConstructor(S); }; /***/ }), /***/ 2355: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var parent = __webpack_require__(16140); module.exports = parent; /***/ }), /***/ 2360: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* global ActiveXObject -- old IE, WSH */ var anObject = __webpack_require__(28551); var definePropertiesModule = __webpack_require__(96801); var enumBugKeys = __webpack_require__(88727); var hiddenKeys = __webpack_require__(30421); var html = __webpack_require__(20397); var documentCreateElement = __webpack_require__(4055); var sharedKey = __webpack_require__(66119); var GT = '>'; var LT = '<'; var PROTOTYPE = 'prototype'; var SCRIPT = 'script'; var IE_PROTO = sharedKey('IE_PROTO'); var EmptyConstructor = function () { /* empty */ }; var scriptTag = function (content) { return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; }; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype var NullProtoObjectViaActiveX = function (activeXDocument) { activeXDocument.write(scriptTag('')); activeXDocument.close(); var temp = activeXDocument.parentWindow.Object; // eslint-disable-next-line no-useless-assignment -- avoid memory leak activeXDocument = null; return temp; }; // Create object with fake `null` prototype: use iframe Object with cleared prototype var NullProtoObjectViaIFrame = function () { // Thrash, waste and sodomy: IE GC bug var iframe = documentCreateElement('iframe'); var JS = 'java' + SCRIPT + ':'; var iframeDocument; iframe.style.display = 'none'; html.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475 iframe.src = String(JS); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(scriptTag('document.F=Object')); iframeDocument.close(); return iframeDocument.F; }; // Check for document.domain and active x support // No need to use active x approach when document.domain is not set // see https://github.com/es-shims/es5-shim/issues/150 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 // avoid IE GC bug var activeXDocument; var NullProtoObject = function () { try { activeXDocument = new ActiveXObject('htmlfile'); } catch (error) { /* ignore */ } NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) // old IE : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument); // WSH var length = enumBugKeys.length; while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; return NullProtoObject(); }; hiddenKeys[IE_PROTO] = true; // `Object.create` method // https://tc39.es/ecma262/#sec-object.create // eslint-disable-next-line es/no-object-create -- safe module.exports = Object.create || function create(O, Properties) { var result; if (O !== null) { EmptyConstructor[PROTOTYPE] = anObject(O); result = new EmptyConstructor(); EmptyConstructor[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = NullProtoObject(); return Properties === undefined ? result : definePropertiesModule.f(result, Properties); }; /***/ }), /***/ 2478: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(79504); var toObject = __webpack_require__(48981); var floor = Math.floor; var charAt = uncurryThis(''.charAt); var replace = uncurryThis(''.replace); var stringSlice = uncurryThis(''.slice); // eslint-disable-next-line redos/no-vulnerable -- safe var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g; var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g; // `GetSubstitution` abstract operation // https://tc39.es/ecma262/#sec-getsubstitution module.exports = function (matched, str, position, captures, namedCaptures, replacement) { var tailPos = position + matched.length; var m = captures.length; var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; if (namedCaptures !== undefined) { namedCaptures = toObject(namedCaptures); symbols = SUBSTITUTION_SYMBOLS; } return replace(replacement, symbols, function (match, ch) { var capture; switch (charAt(ch, 0)) { case '$': return '$'; case '&': return matched; case '`': return stringSlice(str, 0, position); case "'": return stringSlice(str, tailPos); case '<': capture = namedCaptures[stringSlice(ch, 1, -1)]; break; default: // \d\d? var n = +ch; if (n === 0) return match; if (n > m) { var f = floor(n / 10); if (f === 0) return match; if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1); return match; } capture = captures[n - 1]; } return capture === undefined ? '' : capture; }); }; /***/ }), /***/ 2542: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(4942); var getBuiltIn = __webpack_require__(91983); var hasOwn = __webpack_require__(90505); var toString = __webpack_require__(74039); var shared = __webpack_require__(27577); var NATIVE_SYMBOL_REGISTRY = __webpack_require__(55512); var StringToSymbolRegistry = shared('string-to-symbol-registry'); var SymbolToStringRegistry = shared('symbol-to-string-registry'); // `Symbol.for` method // https://tc39.es/ecma262/#sec-symbol.for $({ target: 'Symbol', stat: true, forced: !NATIVE_SYMBOL_REGISTRY }, { 'for': function (key) { var string = toString(key); if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; var symbol = getBuiltIn('Symbol')(string); StringToSymbolRegistry[string] = symbol; SymbolToStringRegistry[symbol] = string; return symbol; } }); /***/ }), /***/ 2632: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(42936); module.exports = uncurryThis([].slice); /***/ }), /***/ 2673: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(42936); module.exports = uncurryThis({}.isPrototypeOf); /***/ }), /***/ 2892: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(46518); var IS_PURE = __webpack_require__(96395); var DESCRIPTORS = __webpack_require__(43724); var globalThis = __webpack_require__(44576); var path = __webpack_require__(19167); var uncurryThis = __webpack_require__(79504); var isForced = __webpack_require__(92796); var hasOwn = __webpack_require__(39297); var inheritIfRequired = __webpack_require__(23167); var isPrototypeOf = __webpack_require__(1625); var isSymbol = __webpack_require__(10757); var toPrimitive = __webpack_require__(72777); var fails = __webpack_require__(79039); var getOwnPropertyNames = (__webpack_require__(38480).f); var getOwnPropertyDescriptor = (__webpack_require__(77347).f); var defineProperty = (__webpack_require__(24913).f); var thisNumberValue = __webpack_require__(31240); var trim = (__webpack_require__(43802).trim); var NUMBER = 'Number'; var NativeNumber = globalThis[NUMBER]; var PureNumberNamespace = path[NUMBER]; var NumberPrototype = NativeNumber.prototype; var TypeError = globalThis.TypeError; var stringSlice = uncurryThis(''.slice); var charCodeAt = uncurryThis(''.charCodeAt); // `ToNumeric` abstract operation // https://tc39.es/ecma262/#sec-tonumeric var toNumeric = function (value) { var primValue = toPrimitive(value, 'number'); return typeof primValue == 'bigint' ? primValue : toNumber(primValue); }; // `ToNumber` abstract operation // https://tc39.es/ecma262/#sec-tonumber var toNumber = function (argument) { var it = toPrimitive(argument, 'number'); var first, third, radix, maxCode, digits, length, index, code; if (isSymbol(it)) throw new TypeError('Cannot convert a Symbol value to a number'); if (typeof it == 'string' && it.length > 2) { it = trim(it); first = charCodeAt(it, 0); if (first === 43 || first === 45) { third = charCodeAt(it, 2); if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix } else if (first === 48) { switch (charCodeAt(it, 1)) { // fast equal of /^0b[01]+$/i case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0o[0-7]+$/i case 79: case 111: radix = 8; maxCode = 55; break; default: return +it; } digits = stringSlice(it, 2); length = digits.length; for (index = 0; index < length; index++) { code = charCodeAt(digits, index); // parseInt parses a string to a first unavailable symbol // but ToNumber should return NaN if a string contains unavailable symbols if (code < 48 || code > maxCode) return NaN; } return parseInt(digits, radix); } } return +it; }; var FORCED = isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1')); var calledWithNew = function (dummy) { // includes check on 1..constructor(foo) case return isPrototypeOf(NumberPrototype, dummy) && fails(function () { thisNumberValue(dummy); }); }; // `Number` constructor // https://tc39.es/ecma262/#sec-number-constructor var NumberWrapper = function Number(value) { var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value)); return calledWithNew(this) ? inheritIfRequired(Object(n), this, NumberWrapper) : n; }; NumberWrapper.prototype = NumberPrototype; if (FORCED && !IS_PURE) NumberPrototype.constructor = NumberWrapper; $({ global: true, constructor: true, wrap: true, forced: FORCED }, { Number: NumberWrapper }); // Use `internal/copy-constructor-properties` helper in `core-js@4` var copyConstructorProperties = function (target, source) { for (var keys = DESCRIPTORS ? getOwnPropertyNames(source) : ( // ES3: 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + // ES2015 (in case, if modules with ES2015 Number statics required before): 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' + // ESNext 'fromString,range' ).split(','), j = 0, key; keys.length > j; j++) { if (hasOwn(source, key = keys[j]) && !hasOwn(target, key)) { defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } } }; if (IS_PURE && PureNumberNamespace) copyConstructorProperties(path[NUMBER], PureNumberNamespace); if (FORCED || IS_PURE) copyConstructorProperties(path[NUMBER], NativeNumber); /***/ }), /***/ 3150: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var parent = __webpack_require__(22845); module.exports = parent; /***/ }), /***/ 3296: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; // TODO: Remove this module from `core-js@4` since it's replaced to module below __webpack_require__(45806); /***/ }), /***/ 3362: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; // TODO: Remove this module from `core-js@4` since it's split to modules listed below __webpack_require__(10436); __webpack_require__(16499); __webpack_require__(82003); __webpack_require__(7743); __webpack_require__(51481); __webpack_require__(40280); /***/ }), /***/ 3451: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(46518); var uncurryThis = __webpack_require__(79504); var hiddenKeys = __webpack_require__(30421); var isObject = __webpack_require__(20034); var hasOwn = __webpack_require__(39297); var defineProperty = (__webpack_require__(24913).f); var getOwnPropertyNamesModule = __webpack_require__(38480); var getOwnPropertyNamesExternalModule = __webpack_require__(10298); var isExtensible = __webpack_require__(34124); var uid = __webpack_require__(33392); var FREEZING = __webpack_require__(92744); var REQUIRED = false; var METADATA = uid('meta'); var id = 0; var setMetadata = function (it) { defineProperty(it, METADATA, { value: { objectID: 'O' + id++, // object ID weakData: {} // weak collections IDs } }); }; var fastKey = function (it, create) { // return a primitive with prefix if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if (!hasOwn(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return 'F'; // not necessary to add metadata if (!create) return 'E'; // add missing metadata setMetadata(it); // return object ID } return it[METADATA].objectID; }; var getWeakData = function (it, create) { if (!hasOwn(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return true; // not necessary to add metadata if (!create) return false; // add missing metadata setMetadata(it); // return the store of weak collections IDs } return it[METADATA].weakData; }; // add metadata on freeze-family methods calling var onFreeze = function (it) { if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it); return it; }; var enable = function () { meta.enable = function () { /* empty */ }; REQUIRED = true; var getOwnPropertyNames = getOwnPropertyNamesModule.f; var splice = uncurryThis([].splice); var test = {}; test[METADATA] = 1; // prevent exposing of metadata key if (getOwnPropertyNames(test).length) { getOwnPropertyNamesModule.f = function (it) { var result = getOwnPropertyNames(it); for (var i = 0, length = result.length; i < length; i++) { if (result[i] === METADATA) { splice(result, i, 1); break; } } return result; }; $({ target: 'Object', stat: true, forced: true }, { getOwnPropertyNames: getOwnPropertyNamesExternalModule.f }); } }; var meta = module.exports = { enable: enable, fastKey: fastKey, getWeakData: getWeakData, onFreeze: onFreeze }; hiddenKeys[METADATA] = true; /***/ }), /***/ 3532: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var userAgent = __webpack_require__(43455); module.exports = /web0s(?!.*chrome)/i.test(userAgent); /***/ }), /***/ 3560: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var check = function (it) { return it && it.Math === Math && it; }; // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 module.exports = // eslint-disable-next-line es/no-global-this -- safe check(typeof globalThis == 'object' && globalThis) || check(typeof window == 'object' && window) || // eslint-disable-next-line no-restricted-globals -- safe check(typeof self == 'object' && self) || check(typeof __webpack_require__.g == 'object' && __webpack_require__.g) || check(typeof this == 'object' && this) || // eslint-disable-next-line no-new-func -- fallback function () { return this; }() || Function('return this')(); /***/ }), /***/ 3606: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var toIntegerOrInfinity = __webpack_require__(86339); var min = Math.min; // `ToLength` abstract operation // https://tc39.es/ecma262/#sec-tolength module.exports = function (argument) { var len = toIntegerOrInfinity(argument); return len > 0 ? min(len, 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 }; /***/ }), /***/ 3707: /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ NA: function() { return /* binding */ appendPopup; }, /* harmony export */ Su: function() { return /* binding */ calculatePopupPosition; }, /* harmony export */ iy: function() { return /* binding */ setPopupPosition; } /* harmony export */ }); /* unused harmony export getPopupContainer */ /* harmony import */ var _core_editor_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(70375); /** * Popup Helper Utility * Helps popups append to the yjd-rich-editor instead of document.body * Now supports multiple editor instances with separate popup containers */ /** * Get the appropriate container for popups * @param {string} editorId - Optional editor instance ID * @returns {HTMLElement} Container element for popups */ function getPopupContainer() { var editorId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var editor; if (editorId) { // Get specific editor instance editor = _core_editor_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A.getInstanceById(editorId); } else { // Try to get current editor instance editor = _core_editor_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .A.getCurrentInstance(); } if (editor) { return editor.getPopupContainer(); } // Fallback to document.body if no editor instance return document.body; } /** * Append popup to the appropriate container * @param {HTMLElement} popup - Popup element to append * @param {string} editorId - Optional editor instance ID */ function appendPopup(popup) { var editorId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var container = getPopupContainer(editorId); // Remove from current parent if exists if (popup.parentNode) { popup.parentNode.removeChild(popup); } container.appendChild(popup); // If appending to popup container, enable pointer events if (container.classList.contains('rich-editor-popup-container')) { popup.style.pointerEvents = 'auto'; } } /** * Get popup dimensions by temporarily showing it if needed * @param {HTMLElement} popup - Popup element * @returns {Object} Object with width and height */ function getPopupDimensions(popup) { if (!popup) return { width: 300, height: 200 }; // Try getBoundingClientRect first var rect = popup.getBoundingClientRect(); if (rect.width > 0 && rect.height > 0) { return { width: rect.width, height: rect.height }; } // Try offsetWidth/offsetHeight if (popup.offsetWidth > 0 && popup.offsetHeight > 0) { return { width: popup.offsetWidth, height: popup.offsetHeight }; } // Check if popup is hidden var computedStyle = window.getComputedStyle(popup); var isHidden = computedStyle.display === 'none' || computedStyle.visibility === 'hidden'; if (isHidden) { // Temporarily show popup to get dimensions var originalDisplay = popup.style.display; var originalVisibility = popup.style.visibility; var originalPosition = popup.style.position; var originalTop = popup.style.top; var originalLeft = popup.style.left; var originalZIndex = popup.style.zIndex; // Make popup visible but off-screen popup.style.display = 'block'; popup.style.visibility = 'visible'; popup.style.position = 'absolute'; popup.style.top = '-9999px'; popup.style.left = '-9999px'; popup.style.zIndex = '-1'; // Force reflow popup.offsetHeight; // Get dimensions var tempRect = popup.getBoundingClientRect(); var width = tempRect.width > 0 ? tempRect.width : 300; var height = tempRect.height > 0 ? tempRect.height : 200; // Restore original styles popup.style.display = originalDisplay; popup.style.visibility = originalVisibility; popup.style.position = originalPosition; popup.style.top = originalTop; popup.style.left = originalLeft; popup.style.zIndex = originalZIndex; return { width: width, height: height }; } // Last resort: try computed styles var computedWidth = parseInt(computedStyle.width); var computedHeight = parseInt(computedStyle.height); return { width: computedWidth > 0 ? computedWidth : 300, height: computedHeight > 0 ? computedHeight : 200 }; } /** * Calculate position for popup relative to anchor element * @param {HTMLElement} anchor - Anchor element * @param {HTMLElement} popup - Popup element * @param {Object} options - Positioning options * @returns {Object} Position object with top and left values */ function calculatePopupPosition(anchor, popup) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var _options$offsetX = options.offsetX, offsetX = _options$offsetX === void 0 ? 0 : _options$offsetX, _options$offsetY = options.offsetY, offsetY = _options$offsetY === void 0 ? 5 : _options$offsetY, _options$preferTop = options.preferTop, preferTop = _options$preferTop === void 0 ? false : _options$preferTop, _options$preferLeft = options.preferLeft, preferLeft = _options$preferLeft === void 0 ? false : _options$preferLeft; var anchorRect = anchor.getBoundingClientRect(); var container = getPopupContainer(); var isInWrapper = container.classList.contains('rich-editor-popup-container'); var top, left; if (isInWrapper) { // Position relative to wrapper var wrapperRect = container.getBoundingClientRect(); // Calculate position relative to wrapper top = anchorRect.top - wrapperRect.top + anchorRect.height + offsetY; left = anchorRect.left - wrapperRect.left + offsetX; // Get popup dimensions using the helper function var _getPopupDimensions = getPopupDimensions(popup), popupWidth = _getPopupDimensions.width, popupHeight = _getPopupDimensions.height; // Check if popup would overflow bottom of wrapper if (top + popupHeight > wrapperRect.height && !preferTop) { top = anchorRect.top - wrapperRect.top - popupHeight - offsetY; } // Check if popup would overflow right of wrapper if (left + popupWidth + 5 > wrapperRect.width && !preferLeft) { left = wrapperRect.width - popupWidth - offsetX - 5; } // Ensure popup doesn't go off-screen if (left < 0) left = offsetX; if (top < 0) top = offsetY; } else { // Fallback to document.body positioning top = anchorRect.bottom + window.scrollY + offsetY; left = anchorRect.left + window.scrollX + offsetX; // Get popup dimensions using the helper function var _getPopupDimensions2 = getPopupDimensions(popup), _popupWidth = _getPopupDimensions2.width, _popupHeight = _getPopupDimensions2.height; // Check if popup would overflow right edge if (left + _popupWidth > window.innerWidth && !preferLeft) { left = window.innerWidth - _popupWidth - offsetX; } // Check if popup would overflow bottom edge if (top + _popupHeight > window.innerHeight + window.scrollY && !preferTop) { top = anchorRect.top + window.scrollY - _popupHeight - offsetY; } // Ensure popup doesn't go off-screen if (left < 0) left = offsetX; if (top < 0) top = offsetY; } return { top: top, left: left }; } /** * Set popup position * @param {HTMLElement} popup - Popup element * @param {Object} position - Position object with top and left values */ function setPopupPosition(popup, position) { popup.style.position = 'absolute'; popup.style.top = "".concat(position.top, "px"); popup.style.left = "".concat(position.left, "px"); popup.style.zIndex = '1000'; } /***/ }), /***/ 3717: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; // based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js var uncurryThis = __webpack_require__(79504); var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 var base = 36; var tMin = 1; var tMax = 26; var skew = 38; var damp = 700; var initialBias = 72; var initialN = 128; // 0x80 var delimiter = '-'; // '\x2D' var regexNonASCII = /[^\0-\u007E]/; // non-ASCII chars var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process'; var baseMinusTMin = base - tMin; var $RangeError = RangeError; var exec = uncurryThis(regexSeparators.exec); var floor = Math.floor; var fromCharCode = String.fromCharCode; var charCodeAt = uncurryThis(''.charCodeAt); var join = uncurryThis([].join); var push = uncurryThis([].push); var replace = uncurryThis(''.replace); var split = uncurryThis(''.split); var toLowerCase = uncurryThis(''.toLowerCase); /** * Creates an array containing the numeric code points of each Unicode * character in the string. While JavaScript uses UCS-2 internally, * this function will convert a pair of surrogate halves (each of which * UCS-2 exposes as separate characters) into a single code point, * matching UTF-16. */ var ucs2decode = function (string) { var output = []; var counter = 0; var length = string.length; while (counter < length) { var value = charCodeAt(string, counter++); if (value >= 0xD800 && value <= 0xDBFF && counter < length) { // It's a high surrogate, and there is a next character. var extra = charCodeAt(string, counter++); if ((extra & 0xFC00) === 0xDC00) { // Low surrogate. push(output, ((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); } else { // It's an unmatched surrogate; only append this code unit, in case the // next code unit is the high surrogate of a surrogate pair. push(output, value); counter--; } } else { push(output, value); } } return output; }; /** * Converts a digit/integer into a basic code point. */ var digitToBasic = function (digit) { // 0..25 map to ASCII a..z or A..Z // 26..35 map to ASCII 0..9 return digit + 22 + 75 * (digit < 26); }; /** * Bias adaptation function as per section 3.4 of RFC 3492. * https://tools.ietf.org/html/rfc3492#section-3.4 */ var adapt = function (delta, numPoints, firstTime) { var k = 0; delta = firstTime ? floor(delta / damp) : delta >> 1; delta += floor(delta / numPoints); while (delta > baseMinusTMin * tMax >> 1) { delta = floor(delta / baseMinusTMin); k += base; } return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); }; /** * Converts a string of Unicode symbols (e.g. a domain name label) to a * Punycode string of ASCII-only symbols. */ var encode = function (input) { var output = []; // Convert the input in UCS-2 to an array of Unicode code points. input = ucs2decode(input); // Cache the length. var inputLength = input.length; // Initialize the state. var n = initialN; var delta = 0; var bias = initialBias; var i, currentValue; // Handle the basic code points. for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue < 0x80) { push(output, fromCharCode(currentValue)); } } var basicLength = output.length; // number of basic code points. var handledCPCount = basicLength; // number of code points that have been handled; // Finish the basic string with a delimiter unless it's empty. if (basicLength) { push(output, delimiter); } // Main encoding loop: while (handledCPCount < inputLength) { // All non-basic code points < n have been handled already. Find the next larger one: var m = maxInt; for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue >= n && currentValue < m) { m = currentValue; } } // Increase `delta` enough to advance the decoder's <n,i> state to <m,0>, but guard against overflow. var handledCPCountPlusOne = handledCPCount + 1; if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { throw new $RangeError(OVERFLOW_ERROR); } delta += (m - n) * handledCPCountPlusOne; n = m; for (i = 0; i < input.length; i++) { currentValue = input[i]; if (currentValue < n && ++delta > maxInt) { throw new $RangeError(OVERFLOW_ERROR); } if (currentValue === n) { // Represent delta as a generalized variable-length integer. var q = delta; var k = base; while (true) { var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; if (q < t) break; var qMinusT = q - t; var baseMinusT = base - t; push(output, fromCharCode(digitToBasic(t + qMinusT % baseMinusT))); q = floor(qMinusT / baseMinusT); k += base; } push(output, fromCharCode(digitToBasic(q))); bias = adapt(delta, handledCPCountPlusOne, handledCPCount === basicLength); delta = 0; handledCPCount++; } } delta++; n++; } return join(output, ''); }; module.exports = function (input) { var encoded = []; var labels = split(replace(toLowerCase(input), regexSeparators, '\u002E'), '.'); var i, label; for (i = 0; i < labels.length; i++) { label = labels[i]; push(encoded, exec(regexNonASCII, label) ? 'xn--' + encode(label) : label); } return join(encoded, '.'); }; /***/ }), /***/ 3843: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $forEach = (__webpack_require__(16757).forEach); var arrayMethodIsStrict = __webpack_require__(40110); var STRICT_METHOD = arrayMethodIsStrict('forEach'); // `Array.prototype.forEach` method implementation // https://tc39.es/ecma262/#sec-array.prototype.foreach module.exports = !STRICT_METHOD ? function forEach(callbackfn /* , thisArg */) { return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); // eslint-disable-next-line es/no-array-prototype-foreach -- safe } : [].forEach; /***/ }), /***/ 3984: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* global ActiveXObject -- old IE, WSH */ var anObject = __webpack_require__(33935); var definePropertiesModule = __webpack_require__(22073); var enumBugKeys = __webpack_require__(96607); var hiddenKeys = __webpack_require__(58461); var html = __webpack_require__(58709); var documentCreateElement = __webpack_require__(87999); var sharedKey = __webpack_require__(47391); var GT = '>'; var LT = '<'; var PROTOTYPE = 'prototype'; var SCRIPT = 'script'; var IE_PROTO = sharedKey('IE_PROTO'); var EmptyConstructor = function () {/* empty */}; var scriptTag = function (content) { return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT; }; // Create object with fake `null` prototype: use ActiveX Object with cleared prototype var NullProtoObjectViaActiveX = function (activeXDocument) { activeXDocument.write(scriptTag('')); activeXDocument.close(); var temp = activeXDocument.parentWindow.Object; // eslint-disable-next-line no-useless-assignment -- avoid memory leak activeXDocument = null; return temp; }; // Create object with fake `null` prototype: use iframe Object with cleared prototype var NullProtoObjectViaIFrame = function () { // Thrash, waste and sodomy: IE GC bug var iframe = documentCreateElement('iframe'); var JS = 'java' + SCRIPT + ':'; var iframeDocument; iframe.style.display = 'none'; html.appendChild(iframe); // https://github.com/zloirock/core-js/issues/475 iframe.src = String(JS); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(scriptTag('document.F=Object')); iframeDocument.close(); return iframeDocument.F; }; // Check for document.domain and active x support // No need to use active x approach when document.domain is not set // see https://github.com/es-shims/es5-shim/issues/150 // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346 // avoid IE GC bug var activeXDocument; var NullProtoObject = function () { try { activeXDocument = new ActiveXObject('htmlfile'); } catch (error) {/* ignore */} NullProtoObject = typeof document != 'undefined' ? document.domain && activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) // old IE : NullProtoObjectViaIFrame() : NullProtoObjectViaActiveX(activeXDocument); // WSH var length = enumBugKeys.length; while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]]; return NullProtoObject(); }; hiddenKeys[IE_PROTO] = true; // `Object.create` method // https://tc39.es/ecma262/#sec-object.create // eslint-disable-next-line es/no-object-create -- safe module.exports = Object.create || function create(O, Properties) { var result; if (O !== null) { EmptyConstructor[PROTOTYPE] = anObject(O); result = new EmptyConstructor(); EmptyConstructor[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = NullProtoObject(); return Properties === undefined ? result : definePropertiesModule.f(result, Properties); }; /***/ }), /***/ 4055: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(44576); var isObject = __webpack_require__(20034); var document = globalThis.document; // typeof document.createElement is 'object' in old IE var EXISTS = isObject(document) && isObject(document.createElement); module.exports = function (it) { return EXISTS ? document.createElement(it) : {}; }; /***/ }), /***/ 4324: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var parent = __webpack_require__(90749); module.exports = parent; /***/ }), /***/ 4417: /***/ (function(module) { "use strict"; module.exports = function (url, options) { if (!options) { options = {}; } if (!url) { return url; } url = String(url.__esModule ? url.default : url); // If url is already wrapped in quotes, remove them if (/^['"].*['"]$/.test(url)) { url = url.slice(1, -1); } if (options.hash) { url += options.hash; } // Should url be wrapped? // See https://drafts.csswg.org/css-values-3/#urls if (/["'() \t\n]|(%20)/.test(url) || options.needQuotes) { return "\"".concat(url.replace(/"/g, '\\"').replace(/\n/g, "\\n"), "\""); } return url; }; /***/ }), /***/ 4446: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var uncurryThis = __webpack_require__(42936); var aCallable = __webpack_require__(83618); var isObject = __webpack_require__(95146); var hasOwn = __webpack_require__(90505); var arraySlice = __webpack_require__(2632); var NATIVE_BIND = __webpack_require__(53792); var $Function = Function; var concat = uncurryThis([].concat); var join = uncurryThis([].join); var factories = {}; var construct = function (C, argsLength, args) { if (!hasOwn(factories, argsLength)) { var list = []; var i = 0; for (; i < argsLength; i++) list[i] = 'a[' + i + ']'; factories[argsLength] = $Function('C,a', 'return new C(' + join(list, ',') + ')'); } return factories[argsLength](C, args); }; // `Function.prototype.bind` method implementation // https://tc39.es/ecma262/#sec-function.prototype.bind // eslint-disable-next-line es/no-function-prototype-bind -- detection module.exports = NATIVE_BIND ? $Function.bind : function bind(that /* , ...args */) { var F = aCallable(this); var Prototype = F.prototype; var partArgs = arraySlice(arguments, 1); var boundFunction = function bound(/* args... */ ) { var args = concat(partArgs, arraySlice(arguments)); return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args); }; if (isObject(Prototype)) boundFunction.prototype = Prototype; return boundFunction; }; /***/ }), /***/ 4495: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; /* eslint-disable es/no-symbol -- required for testing */ var V8_VERSION = __webpack_require__(39519); var fails = __webpack_require__(79039); var globalThis = __webpack_require__(44576); var $String = globalThis.String; // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing module.exports = !!Object.getOwnPropertySymbols && !fails(function () { var symbol = Symbol('symbol detection'); // Chrome 38 Symbol has incorrect toString conversion // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will, // of course, fail. return !$String(symbol) || !(Object(symbol) instanceof Symbol) || // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances !Symbol.sham && V8_VERSION && V8_VERSION < 41; }); /***/ }), /***/ 4625: /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) { "use strict"; var $ = __webpack_require__(4942); var globalThis = __webpack_require__(3560); var apply = __webpack_require__(55553); var slice = __webpack_require__(2632); var newPromiseCapabilityModule = __webpack_require__(14147); var aCallable = __webpack_require__(83618); var perform = __webpack_require__(19415); var Promise = globalThis.Promise; var ACCEPT_ARGUMENTS = false; // Avoiding the use of polyfills of the previous iteration of this proposal // that does not accept arguments of the callback var FORCED = !Promise || !Promise['try'] || perform(function () { Promise['try'](function (argument) { ACCEPT_ARGUMENTS = argument === 8; }, 8); }).error || !ACCEPT_ARGUMENTS; // `Promise.try` method // https://tc39.es/ecma262/#sec-promise.try $({ target: 'Promise', stat: true, forced: FORCED }, { 'try': function (callbackfn /* , ...args */) { var args = arguments.length > 1 ? slice(arguments, 1) : []; var promiseCapability = newPromiseCapabilityModule.f(this); var result = perform(function () { return apply(aCallable(callbackfn), undefined, args); }); (result.error ? promiseCapability.reject : promiseCapability.resolve)(result.value); return promiseCapability.promise; } }); /***/ }), /***/ 4942: /***/ (function(module, __unused_webpack_exports, __webpack_require__) { "use strict"; var globalThis = __webpack_require__(3560); var apply = __webpack_require__(55553); var uncurryThis = __webpack_require__(1292); var isCallable = __webpack_require__(52909); var getOwnPropertyDescriptor = (__webpack_require__(78971).f); var isForced = __webpack_require__(88692); var path = __webpack_require__(7015); var bind = __webpack_require__(64904); var createNonEnumerableProperty = __webpack_require__(9619); var hasOwn = __webpack_require__(90505); // add debugging info __webpack_require__(19205); var wrapConstructor = function (NativeConstructor) { var Wrapper = function (a, b, c) { if (this instanceof Wrapper) { switch (arguments.length) { case 0: return new NativeConstructor(); case 1: return new NativeConstructor(a); case 2: return new NativeConstructor(a, b); } return new NativeConstructor(a, b, c); } return apply(NativeConstructor, this, arguments); }; Wrapper.prototype = NativeConstructor.prototype; return Wrapper; }; /* options.target - name of the target object options.global - target is the global object options.stat - export as static methods of target options.proto - export as prototype methods of target options.real - real prototype method for the `pure` version options.forced - export even if the native feature is available options.bind - bind methods to the target, required for the `pure` version options.wrap - wrap constructors to preventing global pollution, required for the `pure` version options.unsafe - use the simple assignment of property instead of delete + defineProperty options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.dontCallGetSet - prevent calling a getter on target options.name - the .name of the function if it does not match the key */ module.exports = function (options, source) { var TARGET = options.target; var GLOBAL = options.global; var STATIC = options.stat; var PROTO = options.proto; var nativeSource = GLOBAL ? globalThis : STATIC ? globalThis[TARGET] : globalThis[TARGET] && globalThis[TARGET].prototype; var target = GLOBAL ? path : path[TARGET] || createNonEnumerableProperty(path, TARGET, {})[TARGET]; var targetPrototype = target.prototype; var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE; var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor; for (key in source) { FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contains in native USE_NATIVE = !FORCED && nativeSource && hasOwn(nativeSource, key); targetProperty = target[key]; if (USE_NATIVE) if (options.dontCallGetSet) { descriptor = getOwnPropertyDescriptor(nativeSource, key); nativeProperty = descriptor && descriptor.value; } else nativeProperty = nativeSource[key]; // export native or implementation sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key]; if (!FORCED && !PROTO && typeof targetProperty == typeof sourceProperty) continue; // bind methods to global for calling from export context if (options.bind && USE_NATIVE) resultProperty = bind(sourceProperty, globalThis); // wrap global constructors for prevent changes in this version else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty); // make static versions for prototype methods else if (PROTO && isCallable(sourceProperty)) resultProperty = uncurryThis(sourceProperty); // default case else resultProperty = sourceProperty; // add a flag to not completely full polyfills if (options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) { createNonEnumerableProperty(resultProperty, 'sham', true); } createNonEnumerableProperty(target, key, resultProperty); if (PROTO) { VIRTUAL_PROTOTYPE = TARGET + 'Prototype'; if (!hasOwn(path, VIRTUAL_PROTOTYPE)) { createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {}); } // export virtual prototype methods createNonEnumerableProperty(path[VIRTUAL_PROTOTYPE], key, sourceProperty); // export real prototype methods if (options.real && targetPrototype && (FORCED || !targetPrototype[key])) { createNonEnumerableProperty(targetPrototype, key, sourceProperty); } } } }; /***/ }), /***/ 5506: /*