Skip to content

Commit 6814f71

Browse files
authored
Merge pull request rails#54990 from flavorjones/flavorjones/bump-trix-2.1.14
dep: bump trix to v2.1.14
2 parents c4348e0 + a53734b commit 6814f71

File tree

1 file changed

+43
-13
lines changed
  • actiontext/app/assets/javascripts

1 file changed

+43
-13
lines changed

actiontext/app/assets/javascripts/trix.js

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
Trix 2.1.12
3-
Copyright © 2024 37signals, LLC
2+
Trix 2.1.14
3+
Copyright © 2025 37signals, LLC
44
*/
55
(function (global, factory) {
66
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -9,7 +9,7 @@ Copyright © 2024 37signals, LLC
99
})(this, (function () { 'use strict';
1010

1111
var name = "trix";
12-
var version = "2.1.12";
12+
var version = "2.1.14";
1313
var description = "A rich text editor for everyday writing";
1414
var main = "dist/trix.umd.min.js";
1515
var module = "dist/trix.esm.min.js";
@@ -80,7 +80,7 @@ Copyright © 2024 37signals, LLC
8080
start: "yarn build-assets && concurrently --kill-others --names js,css,dev-server 'yarn watch' 'yarn build-css --watch' 'yarn dev'"
8181
};
8282
var dependencies = {
83-
dompurify: "^3.2.3"
83+
dompurify: "^3.2.5"
8484
};
8585
var _package = {
8686
name: name,
@@ -1742,7 +1742,7 @@ $\
17421742
}
17431743
}
17441744

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 */
17461746

17471747
const {
17481748
entries,
@@ -1781,8 +1781,10 @@ $\
17811781
};
17821782
}
17831783
const arrayForEach = unapply(Array.prototype.forEach);
1784+
const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
17841785
const arrayPop = unapply(Array.prototype.pop);
17851786
const arrayPush = unapply(Array.prototype.push);
1787+
const arraySplice = unapply(Array.prototype.splice);
17861788
const stringToLowerCase = unapply(String.prototype.toLowerCase);
17871789
const stringToString = unapply(String.prototype.toString);
17881790
const stringMatch = unapply(String.prototype.match);
@@ -1800,6 +1802,9 @@ $\
18001802
*/
18011803
function unapply(func) {
18021804
return function (thisArg) {
1805+
if (thisArg instanceof RegExp) {
1806+
thisArg.lastIndex = 0;
1807+
}
18031808
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
18041809
args[_key - 1] = arguments[_key];
18051810
}
@@ -1936,7 +1941,7 @@ $\
19361941
// eslint-disable-next-line unicorn/better-regex
19371942
const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
19381943
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
19401945
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
19411946
const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
19421947
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,9 +2043,9 @@ $\
20382043
function createDOMPurify() {
20392044
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
20402045
const DOMPurify = root => createDOMPurify(root);
2041-
DOMPurify.version = '3.2.3';
2046+
DOMPurify.version = '3.2.5';
20422047
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) {
20442049
// Not running in a browser, provide a factory function
20452050
// so that you can pass your own Window
20462051
DOMPurify.isSupported = false;
@@ -2643,7 +2648,7 @@ $\
26432648
allowedTags: ALLOWED_TAGS
26442649
});
26452650
/* 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)) {
26472652
_forceRemove(currentNode);
26482653
return true;
26492654
}
@@ -3059,7 +3064,11 @@ $\
30593064
}
30603065
arrayPush(hooks[entryPoint], hookFunction);
30613066
};
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+
}
30633072
return arrayPop(hooks[entryPoint]);
30643073
};
30653074
DOMPurify.removeHooks = function (entryPoint) {
@@ -13580,11 +13589,11 @@ $\
1358013589
} else if (this.parentNode) {
1358113590
const toolbarId = "trix-toolbar-".concat(this.trixId);
1358213591
this.setAttribute("toolbar", toolbarId);
13583-
const element = makeElement("trix-toolbar", {
13592+
this.internalToolbar = makeElement("trix-toolbar", {
1358413593
id: toolbarId
1358513594
});
13586-
this.parentNode.insertBefore(element, this);
13587-
return element;
13595+
this.parentNode.insertBefore(this.internalToolbar, this);
13596+
return this.internalToolbar;
1358813597
} else {
1358913598
return undefined;
1359013599
}
@@ -13628,6 +13637,14 @@ $\
1362813637
(_this$editor = this.editor) === null || _this$editor === void 0 || _this$editor.loadHTML(this.defaultValue);
1362913638
}
1363013639

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+
1363113648
// Controller delegate methods
1363213649

1363313650
notify(message, data) {
@@ -13665,13 +13682,25 @@ $\
1366513682
}
1366613683
this.editorController.registerSelectionManager();
1366713684
_classPrivateFieldGet(this, _delegate).connectedCallback();
13685+
this.toggleAttribute("connected", true);
1366813686
autofocus(this);
1366913687
}
1367013688
}
1367113689
disconnectedCallback() {
1367213690
var _this$editorControlle2;
1367313691
(_this$editorControlle2 = this.editorController) === null || _this$editorControlle2 === void 0 || _this$editorControlle2.unregisterSelectionManager();
1367413692
_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;
1367513704
}
1367613705

1367713706
// Form support
@@ -13699,6 +13728,7 @@ $\
1369913728
}
1370013729
}
1370113730
_defineProperty(TrixEditorElement, "formAssociated", "ElementInternals" in window);
13731+
_defineProperty(TrixEditorElement, "observedAttributes", ["connected"]);
1370213732

1370313733
var elements = /*#__PURE__*/Object.freeze({
1370413734
__proto__: null,

0 commit comments

Comments
 (0)