@wiris/mathtype-ckeditor5 8.13.4 → 8.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@
5
5
  })(this, (function (exports, ckeditor5) { 'use strict';
6
6
 
7
7
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
8
- /*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */
8
+ /*! @license DOMPurify 3.3.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.0/LICENSE */
9
9
 
10
10
  const {
11
11
  entries,
@@ -34,12 +34,18 @@
34
34
  };
35
35
  }
36
36
  if (!apply) {
37
- apply = function apply(fun, thisValue, args) {
38
- return fun.apply(thisValue, args);
37
+ apply = function apply(func, thisArg) {
38
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
39
+ args[_key - 2] = arguments[_key];
40
+ }
41
+ return func.apply(thisArg, args);
39
42
  };
40
43
  }
41
44
  if (!construct) {
42
- construct = function construct(Func, args) {
45
+ construct = function construct(Func) {
46
+ for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
47
+ args[_key2 - 1] = arguments[_key2];
48
+ }
43
49
  return new Func(...args);
44
50
  };
45
51
  }
@@ -68,8 +74,8 @@
68
74
  if (thisArg instanceof RegExp) {
69
75
  thisArg.lastIndex = 0;
70
76
  }
71
- for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
72
- args[_key - 1] = arguments[_key];
77
+ for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
78
+ args[_key3 - 1] = arguments[_key3];
73
79
  }
74
80
  return apply(func, thisArg, args);
75
81
  };
@@ -80,12 +86,12 @@
80
86
  * @param func - The constructor function to be wrapped and called.
81
87
  * @returns A new function that constructs an instance of the given constructor function with the provided arguments.
82
88
  */
83
- function unconstruct(func) {
89
+ function unconstruct(Func) {
84
90
  return function () {
85
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
86
- args[_key2] = arguments[_key2];
91
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
92
+ args[_key4] = arguments[_key4];
87
93
  }
88
- return construct(func, args);
94
+ return construct(Func, args);
89
95
  };
90
96
  }
91
97
  /**
@@ -184,8 +190,8 @@
184
190
  return fallbackValue;
185
191
  }
186
192
 
187
- const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
188
- const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
193
+ const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'search', 'section', 'select', 'shadow', 'slot', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
194
+ const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'enterkeyhint', 'exportparts', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'inputmode', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'part', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
189
195
  const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
190
196
  // List of SVG elements that are disallowed by default.
191
197
  // We still need to know them so that we can do namespace
@@ -198,8 +204,8 @@
198
204
  const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
199
205
  const text = freeze(['#text']);
200
206
 
201
- const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
202
- const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
207
+ const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'exportparts', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inert', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'part', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'slot', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
208
+ const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'mask-type', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
203
209
  const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
204
210
  const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
205
211
 
@@ -297,7 +303,7 @@
297
303
  function createDOMPurify() {
298
304
  let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
299
305
  const DOMPurify = root => createDOMPurify(root);
300
- DOMPurify.version = '3.2.6';
306
+ DOMPurify.version = '3.3.0';
301
307
  DOMPurify.removed = [];
302
308
  if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
303
309
  // Not running in a browser, provide a factory function
@@ -408,6 +414,21 @@
408
414
  let FORBID_TAGS = null;
409
415
  /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
410
416
  let FORBID_ATTR = null;
417
+ /* Config object to store ADD_TAGS/ADD_ATTR functions (when used as functions) */
418
+ const EXTRA_ELEMENT_HANDLING = Object.seal(create(null, {
419
+ tagCheck: {
420
+ writable: true,
421
+ configurable: false,
422
+ enumerable: true,
423
+ value: null
424
+ },
425
+ attributeCheck: {
426
+ writable: true,
427
+ configurable: false,
428
+ enumerable: true,
429
+ value: null
430
+ }
431
+ }));
411
432
  /* Decide if ARIA attributes are okay */
412
433
  let ALLOW_ARIA_ATTR = true;
413
434
  /* Decide if custom data attributes are okay */
@@ -600,16 +621,24 @@
600
621
  }
601
622
  /* Merge configuration parameters */
602
623
  if (cfg.ADD_TAGS) {
603
- if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
604
- ALLOWED_TAGS = clone(ALLOWED_TAGS);
624
+ if (typeof cfg.ADD_TAGS === 'function') {
625
+ EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
626
+ } else {
627
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
628
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
629
+ }
630
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
605
631
  }
606
- addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
607
632
  }
608
633
  if (cfg.ADD_ATTR) {
609
- if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
610
- ALLOWED_ATTR = clone(ALLOWED_ATTR);
634
+ if (typeof cfg.ADD_ATTR === 'function') {
635
+ EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
636
+ } else {
637
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
638
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
639
+ }
640
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
611
641
  }
612
- addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
613
642
  }
614
643
  if (cfg.ADD_URI_SAFE_ATTR) {
615
644
  addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
@@ -917,7 +946,7 @@
917
946
  return true;
918
947
  }
919
948
  /* Remove element if anything forbids its presence */
920
- if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
949
+ if (!(EXTRA_ELEMENT_HANDLING.tagCheck instanceof Function && EXTRA_ELEMENT_HANDLING.tagCheck(tagName)) && (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName])) {
921
950
  /* Check if we have a custom element to handle */
922
951
  if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
923
952
  if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
@@ -989,12 +1018,12 @@
989
1018
  (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
990
1019
  XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
991
1020
  We don't need to check the value; it's always URI safe. */
992
- if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1021
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
993
1022
  if (
994
1023
  // First condition does a very basic check if a) it's basically a valid custom element tagname AND
995
1024
  // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
996
1025
  // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
997
- _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
1026
+ _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName, lcTag)) ||
998
1027
  // Alternative, second condition checks if it's an `is`-attribute, AND
999
1028
  // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1000
1029
  lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
@@ -1073,7 +1102,12 @@
1073
1102
  value = SANITIZE_NAMED_PROPS_PREFIX + value;
1074
1103
  }
1075
1104
  /* Work around a security issue with comments inside attributes */
1076
- if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
1105
+ if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i, value)) {
1106
+ _removeAttribute(name, currentNode);
1107
+ continue;
1108
+ }
1109
+ /* Make sure we cannot easily use animated hrefs, even if animations are allowed */
1110
+ if (lcName === 'attributename' && stringMatch(value, 'href')) {
1077
1111
  _removeAttribute(name, currentNode);
1078
1112
  continue;
1079
1113
  }
@@ -3457,6 +3491,13 @@
3457
3491
  }
3458
3492
  }
3459
3493
  /**
3494
+ * A map from event target to event handlers so we can remove the event
3495
+ * listeners in removeElementEvents
3496
+ *
3497
+ * @type {Map<EventTarget, Object>}
3498
+ * @static
3499
+ */ static elementEventsMap = new Map();
3500
+ /**
3460
3501
  * Adds the a callback function, for a certain event target, to the following event types:
3461
3502
  * - dblclick
3462
3503
  * - mousedown
@@ -3467,24 +3508,29 @@
3467
3508
  * @param {Function} mouseupHandler - function to run when on mouseup event.
3468
3509
  * @static
3469
3510
  */ static addElementEvents(eventTarget, doubleClickHandler, mousedownHandler, mouseupHandler) {
3511
+ // Make sure not to leak event listeners if we've already added events to
3512
+ // this element
3513
+ Util.removeElementEvents(eventTarget);
3514
+ let entry = {};
3515
+ Util.elementEventsMap.set(eventTarget, entry);
3470
3516
  if (doubleClickHandler) {
3471
- this.callbackDblclick = (event)=>{
3517
+ entry.callbackDblclick = (event)=>{
3472
3518
  const realEvent = event || window.event;
3473
3519
  const element = realEvent.srcElement ? realEvent.srcElement : realEvent.target;
3474
3520
  doubleClickHandler(element, realEvent);
3475
3521
  };
3476
- Util.addEvent(eventTarget, "dblclick", this.callbackDblclick);
3522
+ Util.addEvent(eventTarget, "dblclick", entry.callbackDblclick);
3477
3523
  }
3478
3524
  if (mousedownHandler) {
3479
- this.callbackMousedown = (event)=>{
3525
+ entry.callbackMousedown = (event)=>{
3480
3526
  const realEvent = event || window.event;
3481
3527
  const element = realEvent.srcElement ? realEvent.srcElement : realEvent.target;
3482
3528
  mousedownHandler(element, realEvent);
3483
3529
  };
3484
- Util.addEvent(eventTarget, "mousedown", this.callbackMousedown);
3530
+ Util.addEvent(eventTarget, "mousedown", entry.callbackMousedown);
3485
3531
  }
3486
3532
  if (mouseupHandler) {
3487
- this.callbackMouseup = (event)=>{
3533
+ entry.callbackMouseup = (event)=>{
3488
3534
  const realEvent = event || window.event;
3489
3535
  const element = realEvent.srcElement ? realEvent.srcElement : realEvent.target;
3490
3536
  mouseupHandler(element, realEvent);
@@ -3493,8 +3539,8 @@
3493
3539
  // while the mouse is outside the editor text field.
3494
3540
  // This is a workaround: we trigger the event independently of where the mouse
3495
3541
  // is when we release its button.
3496
- Util.addEvent(document, "mouseup", this.callbackMouseup);
3497
- Util.addEvent(eventTarget, "mouseup", this.callbackMouseup);
3542
+ Util.addEvent(document, "mouseup", entry.callbackMouseup);
3543
+ Util.addEvent(eventTarget, "mouseup", entry.callbackMouseup);
3498
3544
  }
3499
3545
  }
3500
3546
  /**
@@ -3505,10 +3551,15 @@
3505
3551
  * @param {EventTarget} eventTarget - event target.
3506
3552
  * @static
3507
3553
  */ static removeElementEvents(eventTarget) {
3508
- Util.removeEvent(eventTarget, "dblclick", this.callbackDblclick);
3509
- Util.removeEvent(eventTarget, "mousedown", this.callbackMousedown);
3510
- Util.removeEvent(document, "mouseup", this.callbackMouseup);
3511
- Util.removeEvent(eventTarget, "mouseup", this.callbackMouseup);
3554
+ let entry = Util.elementEventsMap.get(eventTarget);
3555
+ if (!entry) {
3556
+ return;
3557
+ }
3558
+ Util.elementEventsMap.delete(eventTarget);
3559
+ Util.removeEvent(eventTarget, "dblclick", entry.callbackDblclick);
3560
+ Util.removeEvent(eventTarget, "mousedown", entry.callbackMousedown);
3561
+ Util.removeEvent(document, "mouseup", entry.callbackMouseup);
3562
+ Util.removeEvent(eventTarget, "mouseup", entry.callbackMouseup);
3512
3563
  }
3513
3564
  /**
3514
3565
  * Adds a class name to a HTMLElement.
@@ -7232,11 +7283,11 @@
7232
7283
  this.closeDiv.setAttribute("role", "button");
7233
7284
  this.closeDiv.setAttribute("tabindex", 3);
7234
7285
  // Apply styles and events after the creation as createElement doesn't process them correctly
7235
- let generalStyle = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(closeIcon)})`;
7236
- let hoverStyle = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(closeHoverIcon)})`;
7237
- this.closeDiv.setAttribute("style", generalStyle);
7238
- this.closeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7239
- this.closeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7286
+ const generalStyleClose = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(closeIcon)})`;
7287
+ const hoverStyleClose = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(closeHoverIcon)})`;
7288
+ this.closeDiv.setAttribute("style", generalStyleClose);
7289
+ this.closeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyleClose);
7290
+ this.closeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyleClose);
7240
7291
  // To identifiy the element in automated testing
7241
7292
  this.closeDiv.setAttribute("data-testid", "mtcteditor-close-button");
7242
7293
  attributes = {};
@@ -7246,11 +7297,11 @@
7246
7297
  this.stackDiv = Util.createElement("a", attributes);
7247
7298
  this.stackDiv.setAttribute("role", "button");
7248
7299
  this.stackDiv.setAttribute("tabindex", 2);
7249
- generalStyle = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(minsIcon)})`;
7250
- hoverStyle = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(minsHoverIcon)})`;
7251
- this.stackDiv.setAttribute("style", generalStyle);
7252
- this.stackDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7253
- this.stackDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7300
+ const generalStyleStack = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(minsIcon)})`;
7301
+ const hoverStyleStack = `background-size: 10px; background-image: url(data:image/svg+xml;base64,${window.btoa(minsHoverIcon)})`;
7302
+ this.stackDiv.setAttribute("style", generalStyleStack);
7303
+ this.stackDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyleStack);
7304
+ this.stackDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyleStack);
7254
7305
  // To identifiy the element in automated testing
7255
7306
  this.stackDiv.setAttribute("data-testid", "mtcteditor-fullscreen-disable-button");
7256
7307
  attributes = {};
@@ -7260,11 +7311,11 @@
7260
7311
  this.maximizeDiv = Util.createElement("a", attributes);
7261
7312
  this.maximizeDiv.setAttribute("role", "button");
7262
7313
  this.maximizeDiv.setAttribute("tabindex", 2);
7263
- generalStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(fullsIcon)})`;
7264
- hoverStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(fullsHoverIcon)})`;
7265
- this.maximizeDiv.setAttribute("style", generalStyle);
7266
- this.maximizeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7267
- this.maximizeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7314
+ const generalStyleMaximize = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(fullsIcon)})`;
7315
+ const hoverStyleMaximize = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(fullsHoverIcon)})`;
7316
+ this.maximizeDiv.setAttribute("style", generalStyleMaximize);
7317
+ this.maximizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyleMaximize);
7318
+ this.maximizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyleMaximize);
7268
7319
  // To identifiy the element in automated testing
7269
7320
  this.maximizeDiv.setAttribute("data-testid", "mtcteditor-fullscreen-enable-button");
7270
7321
  attributes = {};
@@ -7274,11 +7325,11 @@
7274
7325
  this.minimizeDiv = Util.createElement("a", attributes);
7275
7326
  this.minimizeDiv.setAttribute("role", "button");
7276
7327
  this.minimizeDiv.setAttribute("tabindex", 1);
7277
- generalStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minIcon)})`;
7278
- hoverStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minHoverIcon)})`;
7279
- this.minimizeDiv.setAttribute("style", generalStyle);
7280
- this.minimizeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7281
- this.minimizeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7328
+ const generalStyleMinimize = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minIcon)})`;
7329
+ const hoverStyleMinimize = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minHoverIcon)})`;
7330
+ this.minimizeDiv.setAttribute("style", generalStyleMinimize);
7331
+ this.minimizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyleMinimize);
7332
+ this.minimizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyleMinimize);
7282
7333
  // To identify the element in automated testing
7283
7334
  this.minimizeDiv.setAttribute("data-testid", "mtcteditor-minimize-button");
7284
7335
  attributes = {};
@@ -7830,8 +7881,8 @@
7830
7881
  const generalStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minIcon)})`;
7831
7882
  const hoverStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minHoverIcon)})`;
7832
7883
  this.minimizeDiv.setAttribute("style", generalStyle);
7833
- this.minimizeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7834
- this.minimizeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7884
+ this.minimizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyle);
7885
+ this.minimizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyle);
7835
7886
  this.restoreModalProperties();
7836
7887
  if (typeof this.resizerBR !== "undefined" && typeof this.resizerTL !== "undefined") {
7837
7888
  this.setResizeButtonsVisibility();
@@ -7873,8 +7924,8 @@
7873
7924
  const generalStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(maxIcon)})`;
7874
7925
  const hoverStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(maxHoverIcon)})`;
7875
7926
  this.minimizeDiv.setAttribute("style", generalStyle);
7876
- this.minimizeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7877
- this.minimizeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7927
+ this.minimizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyle);
7928
+ this.minimizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyle);
7878
7929
  }
7879
7930
  }
7880
7931
  /**
@@ -7901,8 +7952,8 @@
7901
7952
  const generalStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minIcon)})`;
7902
7953
  const hoverStyle = `background-size: 10px; background-repeat: no-repeat; background-image: url(data:image/svg+xml;base64,${window.btoa(minHoverIcon)})`;
7903
7954
  this.minimizeDiv.setAttribute("style", generalStyle);
7904
- this.minimizeDiv.setAttribute("onmouseover", `this.style = "${hoverStyle}";`);
7905
- this.minimizeDiv.setAttribute("onmouseout", `this.style = "${generalStyle}";`);
7955
+ this.minimizeDiv.addEventListener("mouseover", (e)=>e.target.style = hoverStyle);
7956
+ this.minimizeDiv.addEventListener("mouseout", (e)=>e.target.style = generalStyle);
7906
7957
  // Set size to 80% screen with a max size.
7907
7958
  this.setSize(parseInt(window.innerHeight * 0.8, 10), parseInt(window.innerWidth * 0.8, 10));
7908
7959
  if (this.container.clientHeight > 700) {
@@ -9767,7 +9818,8 @@
9767
9818
  Util.addElementEvents(eventTarget, (element, event)=>{
9768
9819
  this.doubleClickHandler(element, event);
9769
9820
  // Avoid creating the double click listener more than once for each element.
9770
- event.stopImmediatePropagation();
9821
+ // This also allows CKEditor4 to add their own double click listener.
9822
+ event.preventDefault();
9771
9823
  }, (element, event)=>{
9772
9824
  this.mousedownHandler(element, event);
9773
9825
  }, (element, event)=>{
@@ -11107,11 +11159,10 @@
11107
11159
  const languageObject = this.editorObject.config.get("language");
11108
11160
  if (languageObject != null) {
11109
11161
  if (typeof languageObject === "object") {
11110
- // eslint-disable-next-line no-prototype-builtins
11111
- if (languageObject.hasOwnProperty("ui")) {
11162
+ if (Object.prototype.hasOwnProperty.call(languageObject, "ui")) {
11112
11163
  return languageObject.ui;
11113
11164
  }
11114
- return languageObject;
11165
+ return this.editorObject.locale.uiLanguage;
11115
11166
  }
11116
11167
  return languageObject;
11117
11168
  }
@@ -11420,7 +11471,7 @@
11420
11471
 
11421
11472
  var chemIcon = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->\n<svg version=\"1.1\" id=\"Layer_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n\t viewBox=\"0 0 40.3 49.5\" style=\"enable-background:new 0 0 40.3 49.5;\" xml:space=\"preserve\">\n<style type=\"text/css\">\n\t.st0{fill:#A4CF61;}\n</style>\n<path class=\"st0\" d=\"M39.2,12.1c0-1.9-1.1-3.6-2.7-4.4L24.5,0.9l0,0c-0.7-0.4-1.5-0.6-2.4-0.6c-0.9,0-1.7,0.2-2.4,0.6l0,0L2.3,10.8\n\tl0,0C0.9,11.7,0,13.2,0,14.9h0v19.6h0c0,1.7,0.9,3.3,2.3,4.1l0,0l17.4,9.9l0,0c0.7,0.4,1.5,0.6,2.4,0.6c0.9,0,1.7-0.2,2.4-0.6l0,0\n\tl12.2-6.9h0c1.5-0.8,2.6-2.5,2.6-4.3c0-2.7-2.2-4.9-4.9-4.9c-0.9,0-1.8,0.3-2.5,0.7l0,0l-9.7,5.6l-12.3-7V17.8l12.3-7l9.9,5.7l0,0\n\tc0.7,0.4,1.5,0.6,2.4,0.6C37,17,39.2,14.8,39.2,12.1\"/>\n</svg>\n";
11422
11473
 
11423
- var version = "8.13.4";
11474
+ var version = "8.14.0";
11424
11475
  var packageInfo = {
11425
11476
  version: version};
11426
11477