1
1
/*
2
- Trix 2.1.12
3
- Copyright © 2024 37signals, LLC
2
+ Trix 2.1.14
3
+ Copyright © 2025 37signals, LLC
4
4
*/
5
5
(function (global, factory) {
6
6
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -9,7 +9,7 @@ Copyright © 2024 37signals, LLC
9
9
})(this, (function () { 'use strict';
10
10
11
11
var name = "trix";
12
- var version = "2.1.12 ";
12
+ var version = "2.1.14 ";
13
13
var description = "A rich text editor for everyday writing";
14
14
var main = "dist/trix.umd.min.js";
15
15
var module = "dist/trix.esm.min.js";
@@ -80,7 +80,7 @@ Copyright © 2024 37signals, LLC
80
80
start: "yarn build-assets && concurrently --kill-others --names js,css,dev-server 'yarn watch' 'yarn build-css --watch' 'yarn dev'"
81
81
};
82
82
var dependencies = {
83
- dompurify: "^3.2.3 "
83
+ dompurify: "^3.2.5 "
84
84
};
85
85
var _package = {
86
86
name: name,
1742
1742
}
1743
1743
}
1744
1744
1745
- /*! @license DOMPurify 3.2.3 | (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.3 /LICENSE */
1745
+ /*! @license DOMPurify 3.2.5 | (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.5 /LICENSE */
1746
1746
1747
1747
const {
1748
1748
entries,
@@ -1781,8 +1781,10 @@ $\
1781
1781
};
1782
1782
}
1783
1783
const arrayForEach = unapply(Array.prototype.forEach);
1784
+ const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
1784
1785
const arrayPop = unapply(Array.prototype.pop);
1785
1786
const arrayPush = unapply(Array.prototype.push);
1787
+ const arraySplice = unapply(Array.prototype.splice);
1786
1788
const stringToLowerCase = unapply(String.prototype.toLowerCase);
1787
1789
const stringToString = unapply(String.prototype.toString);
1788
1790
const stringMatch = unapply(String.prototype.match);
1800
1802
*/
1801
1803
function unapply(func) {
1802
1804
return function (thisArg) {
1805
+ if (thisArg instanceof RegExp) {
1806
+ thisArg.lastIndex = 0;
1807
+ }
1803
1808
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1804
1809
args[_key - 1] = arguments[_key];
1805
1810
}
1936
1941
// eslint-disable-next-line unicorn/better-regex
1937
1942
const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
1938
1943
const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
1939
- const TMPLIT_EXPR = seal(/\$\{[\w\W]*} /gm); // eslint-disable-line unicorn/better-regex
1944
+ const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
1940
1945
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
1941
1946
const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
1942
1947
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
2038
2043
function createDOMPurify() {
2039
2044
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
2040
2045
const DOMPurify = root => createDOMPurify(root);
2041
- DOMPurify.version = '3.2.3 ';
2046
+ DOMPurify.version = '3.2.5 ';
2042
2047
DOMPurify.removed = [];
2043
- if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document) {
2048
+ if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element ) {
2044
2049
// Not running in a browser, provide a factory function
2045
2050
// so that you can pass your own Window
2046
2051
DOMPurify.isSupported = false;
2643
2648
allowedTags: ALLOWED_TAGS
2644
2649
});
2645
2650
/* Detect mXSS attempts abusing namespace confusion */
2646
- if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
2651
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w! ]/g, currentNode.innerHTML) && regExpTest(/<[/\w! ]/g, currentNode.textContent)) {
2647
2652
_forceRemove(currentNode);
2648
2653
return true;
2649
2654
}
@@ -3059,7 +3064,11 @@ $\
3059
3064
}
3060
3065
arrayPush(hooks[entryPoint], hookFunction);
3061
3066
};
3062
- DOMPurify.removeHook = function (entryPoint) {
3067
+ DOMPurify.removeHook = function (entryPoint, hookFunction) {
3068
+ if (hookFunction !== undefined) {
3069
+ const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
3070
+ return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
3071
+ }
3063
3072
return arrayPop(hooks[entryPoint]);
3064
3073
};
3065
3074
DOMPurify.removeHooks = function (entryPoint) {
@@ -13580,11 +13589,11 @@ $\
13580
13589
} else if (this.parentNode) {
13581
13590
const toolbarId = "trix-toolbar-".concat(this.trixId);
13582
13591
this.setAttribute("toolbar", toolbarId);
13583
- const element = makeElement("trix-toolbar", {
13592
+ this.internalToolbar = makeElement("trix-toolbar", {
13584
13593
id: toolbarId
13585
13594
});
13586
- this.parentNode.insertBefore(element , this);
13587
- return element ;
13595
+ this.parentNode.insertBefore(this.internalToolbar , this);
13596
+ return this.internalToolbar ;
13588
13597
} else {
13589
13598
return undefined;
13590
13599
}
@@ -13628,6 +13637,14 @@ $\
13628
13637
(_this$editor = this.editor) === null || _this$editor === void 0 || _this$editor.loadHTML(this.defaultValue);
13629
13638
}
13630
13639
13640
+ // Element callbacks
13641
+
13642
+ attributeChangedCallback(name, oldValue, newValue) {
13643
+ if (name === "connected" && this.isConnected && oldValue != null && oldValue !== newValue) {
13644
+ requestAnimationFrame(() => this.reconnect());
13645
+ }
13646
+ }
13647
+
13631
13648
// Controller delegate methods
13632
13649
13633
13650
notify(message, data) {
@@ -13665,13 +13682,25 @@ $\
13665
13682
}
13666
13683
this.editorController.registerSelectionManager();
13667
13684
_classPrivateFieldGet(this, _delegate).connectedCallback();
13685
+ this.toggleAttribute("connected", true);
13668
13686
autofocus(this);
13669
13687
}
13670
13688
}
13671
13689
disconnectedCallback() {
13672
13690
var _this$editorControlle2;
13673
13691
(_this$editorControlle2 = this.editorController) === null || _this$editorControlle2 === void 0 || _this$editorControlle2.unregisterSelectionManager();
13674
13692
_classPrivateFieldGet(this, _delegate).disconnectedCallback();
13693
+ this.toggleAttribute("connected", false);
13694
+ }
13695
+ reconnect() {
13696
+ this.removeInternalToolbar();
13697
+ this.disconnectedCallback();
13698
+ this.connectedCallback();
13699
+ }
13700
+ removeInternalToolbar() {
13701
+ var _this$internalToolbar;
13702
+ (_this$internalToolbar = this.internalToolbar) === null || _this$internalToolbar === void 0 || _this$internalToolbar.remove();
13703
+ this.internalToolbar = null;
13675
13704
}
13676
13705
13677
13706
// Form support
@@ -13699,6 +13728,7 @@ $\
13699
13728
}
13700
13729
}
13701
13730
_defineProperty(TrixEditorElement, "formAssociated", "ElementInternals" in window);
13731
+ _defineProperty(TrixEditorElement, "observedAttributes", ["connected"]);
13702
13732
13703
13733
var elements = /*#__PURE__*/Object.freeze({
13704
13734
__proto__: null,
0 commit comments