@richscripts/richtexteditor 2.14.1 → 2.16.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.
- package/README.md +182 -10
- package/angular/build-manifest.json +23 -0
- package/angular/index.d.ts +71 -76
- package/angular/index.mjs +2 -0
- package/angular/package.json +4 -0
- package/headless/index.d.ts +3 -1
- package/headless/index.js +72 -16
- package/index.d.ts +40 -52
- package/integrations/initialization-scope.js +27 -0
- package/integrations/native-mount.js +30 -0
- package/integrations/shared.d.ts +23 -1
- package/integrations/shared.js +68 -22
- package/package.json +25 -3
- package/react/index.js +118 -37
- package/react/index.mjs +29 -0
- package/richtexteditor/all_plugins.js +8816 -2373
- package/richtexteditor/all_plugins.min.js +77 -59
- package/richtexteditor/lang/emoji/LICENSE-CLDR.txt +41 -0
- package/richtexteditor/lang/emoji/rte-emoji-de.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-es.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-fr.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-it.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-ja.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-ko.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-nl.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-pt-pt.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-pt.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-ru.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-zh-Hans.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-zh-Hant.js +3 -0
- package/richtexteditor/lang/rte-lang-af.js +1 -0
- package/richtexteditor/lang/rte-lang-ar.js +1 -0
- package/richtexteditor/lang/rte-lang-bg.js +1 -0
- package/richtexteditor/lang/rte-lang-bn.js +1 -0
- package/richtexteditor/lang/rte-lang-bs.js +1 -0
- package/richtexteditor/lang/rte-lang-ca.js +1 -0
- package/richtexteditor/lang/rte-lang-cs.js +1 -0
- package/richtexteditor/lang/rte-lang-cy.js +1 -0
- package/richtexteditor/lang/rte-lang-da.js +1 -0
- package/richtexteditor/lang/rte-lang-de.js +1050 -2
- package/richtexteditor/lang/rte-lang-el.js +1 -0
- package/richtexteditor/lang/rte-lang-en.js +1 -0
- package/richtexteditor/lang/rte-lang-es.js +1056 -2
- package/richtexteditor/lang/rte-lang-et.js +1 -0
- package/richtexteditor/lang/rte-lang-fa.js +1 -0
- package/richtexteditor/lang/rte-lang-fi.js +1 -0
- package/richtexteditor/lang/rte-lang-fil.js +1 -0
- package/richtexteditor/lang/rte-lang-fj.js +1 -0
- package/richtexteditor/lang/rte-lang-fr.js +1056 -2
- package/richtexteditor/lang/rte-lang-ga.js +1 -0
- package/richtexteditor/lang/rte-lang-gu.js +1 -0
- package/richtexteditor/lang/rte-lang-he.js +1 -0
- package/richtexteditor/lang/rte-lang-hi.js +1 -0
- package/richtexteditor/lang/rte-lang-hr.js +1 -0
- package/richtexteditor/lang/rte-lang-ht.js +1 -0
- package/richtexteditor/lang/rte-lang-hu.js +1 -0
- package/richtexteditor/lang/rte-lang-id.js +1 -0
- package/richtexteditor/lang/rte-lang-is.js +1 -0
- package/richtexteditor/lang/rte-lang-it.js +1056 -2
- package/richtexteditor/lang/rte-lang-ja.js +1056 -2
- package/richtexteditor/lang/rte-lang-kn.js +1 -0
- package/richtexteditor/lang/rte-lang-ko.js +1056 -2
- package/richtexteditor/lang/rte-lang-lt.js +1 -0
- package/richtexteditor/lang/rte-lang-lv.js +1 -0
- package/richtexteditor/lang/rte-lang-mg.js +1 -0
- package/richtexteditor/lang/rte-lang-mi.js +1 -0
- package/richtexteditor/lang/rte-lang-ml.js +1 -0
- package/richtexteditor/lang/rte-lang-mr.js +1 -0
- package/richtexteditor/lang/rte-lang-ms.js +1 -0
- package/richtexteditor/lang/rte-lang-mt.js +1 -0
- package/richtexteditor/lang/rte-lang-mww.js +1 -0
- package/richtexteditor/lang/rte-lang-nb.js +1 -0
- package/richtexteditor/lang/rte-lang-nl.js +1056 -2
- package/richtexteditor/lang/rte-lang-otq.js +1 -0
- package/richtexteditor/lang/rte-lang-pa.js +1 -0
- package/richtexteditor/lang/rte-lang-pl.js +1 -0
- package/richtexteditor/lang/rte-lang-pt-pt.js +1056 -2
- package/richtexteditor/lang/rte-lang-pt.js +1056 -2
- package/richtexteditor/lang/rte-lang-ro.js +1 -0
- package/richtexteditor/lang/rte-lang-ru.js +1056 -2
- package/richtexteditor/lang/rte-lang-sk.js +1 -0
- package/richtexteditor/lang/rte-lang-sl.js +1 -0
- package/richtexteditor/lang/rte-lang-sm.js +1 -0
- package/richtexteditor/lang/rte-lang-sr-Cyrl.js +1 -0
- package/richtexteditor/lang/rte-lang-sr-Latn.js +1 -0
- package/richtexteditor/lang/rte-lang-sv.js +1 -0
- package/richtexteditor/lang/rte-lang-sw.js +1 -0
- package/richtexteditor/lang/rte-lang-ta.js +1 -0
- package/richtexteditor/lang/rte-lang-te.js +1 -0
- package/richtexteditor/lang/rte-lang-th.js +1 -0
- package/richtexteditor/lang/rte-lang-tlh-Latn.js +1 -0
- package/richtexteditor/lang/rte-lang-tlh-Piqd.js +1 -0
- package/richtexteditor/lang/rte-lang-to.js +1 -0
- package/richtexteditor/lang/rte-lang-tr.js +1 -0
- package/richtexteditor/lang/rte-lang-ty.js +1 -0
- package/richtexteditor/lang/rte-lang-uk.js +1 -0
- package/richtexteditor/lang/rte-lang-ur.js +1 -0
- package/richtexteditor/lang/rte-lang-vi.js +1 -0
- package/richtexteditor/lang/rte-lang-yua.js +1 -0
- package/richtexteditor/lang/rte-lang-zh-Hans.js +1050 -2
- package/richtexteditor/lang/rte-lang-zh-Hant.js +1050 -2
- package/richtexteditor/plugins/a11yenhance.js +4 -1
- package/richtexteditor/plugins/a11yenhance.min.js +1 -1
- package/richtexteditor/plugins/accessibilitychecker.js +256 -64
- package/richtexteditor/plugins/accessibilitychecker.min.js +1 -1
- package/richtexteditor/plugins/aitoolkit.js +1057 -386
- package/richtexteditor/plugins/aitoolkit.min.js +7 -7
- package/richtexteditor/plugins/all_plugins.js +8816 -2373
- package/richtexteditor/plugins/all_plugins.min.js +77 -59
- package/richtexteditor/plugins/autocorrect.js +66 -31
- package/richtexteditor/plugins/autocorrect.min.js +1 -1
- package/richtexteditor/plugins/autoembed.js +18 -1
- package/richtexteditor/plugins/autoembed.min.js +1 -1
- package/richtexteditor/plugins/blocktypes.js +18 -9
- package/richtexteditor/plugins/blocktypes.min.js +1 -1
- package/richtexteditor/plugins/bookmarkcard.js +12 -5
- package/richtexteditor/plugins/bookmarkcard.min.js +2 -2
- package/richtexteditor/plugins/changecase.js +72 -19
- package/richtexteditor/plugins/changecase.min.js +1 -1
- package/richtexteditor/plugins/charlimit.js +62 -2
- package/richtexteditor/plugins/charlimit.min.js +2 -2
- package/richtexteditor/plugins/comments.js +460 -61
- package/richtexteditor/plugins/comments.min.js +4 -3
- package/richtexteditor/plugins/contentminimap.js +28 -9
- package/richtexteditor/plugins/contentminimap.min.js +1 -1
- package/richtexteditor/plugins/crdt-engine.js +27 -1
- package/richtexteditor/plugins/crossreference.js +1 -1
- package/richtexteditor/plugins/crossreference.min.js +1 -1
- package/richtexteditor/plugins/dialoga11y.js +26 -4
- package/richtexteditor/plugins/dialoga11y.min.js +1 -1
- package/richtexteditor/plugins/dictation.js +1 -1
- package/richtexteditor/plugins/documentimport.js +250 -59
- package/richtexteditor/plugins/documentimport.min.js +4 -4
- package/richtexteditor/plugins/documentoutline.js +47 -8
- package/richtexteditor/plugins/documentoutline.min.js +1 -1
- package/richtexteditor/plugins/docxexport.js +233 -32
- package/richtexteditor/plugins/docxexport.min.js +2 -2
- package/richtexteditor/plugins/draghandle.js +267 -3
- package/richtexteditor/plugins/draghandle.min.js +1 -1
- package/richtexteditor/plugins/emailtoolkit.js +28 -14
- package/richtexteditor/plugins/emailtoolkit.min.js +1 -1
- package/richtexteditor/plugins/emojiautocomplete.js +111 -57
- package/richtexteditor/plugins/emojiautocomplete.min.js +1 -1
- package/richtexteditor/plugins/footnotes.js +65 -11
- package/richtexteditor/plugins/footnotes.min.js +1 -1
- package/richtexteditor/plugins/formatpainter.js +10 -0
- package/richtexteditor/plugins/formatpainter.min.js +1 -1
- package/richtexteditor/plugins/formattingmarks.js +6 -6
- package/richtexteditor/plugins/formattingmarks.min.js +1 -1
- package/richtexteditor/plugins/gapcursor.js +60 -0
- package/richtexteditor/plugins/gapcursor.min.js +1 -1
- package/richtexteditor/plugins/ghostcomplete.js +1 -1
- package/richtexteditor/plugins/html2pdf.js +8 -8
- package/richtexteditor/plugins/html2pdf.min.js +1 -1
- package/richtexteditor/plugins/imageeditor.js +31 -12
- package/richtexteditor/plugins/imageeditor.min.js +1 -1
- package/richtexteditor/plugins/importstyles.js +1 -1
- package/richtexteditor/plugins/inlinecode.js +25 -0
- package/richtexteditor/plugins/inlinecode.min.js +1 -1
- package/richtexteditor/plugins/insertcode.js +29 -11
- package/richtexteditor/plugins/insertcode.min.js +6 -6
- package/richtexteditor/plugins/insertemoji.js +113 -16
- package/richtexteditor/plugins/insertemoji.min.js +1 -1
- package/richtexteditor/plugins/insertgallery.js +46 -40
- package/richtexteditor/plugins/insertgallery.min.js +1 -1
- package/richtexteditor/plugins/inserttemplate.js +43 -19
- package/richtexteditor/plugins/inserttemplate.min.js +1 -1
- package/richtexteditor/plugins/keyboarda11y.js +66 -3
- package/richtexteditor/plugins/keyboarda11y.min.js +1 -1
- package/richtexteditor/plugins/layouttable.js +20 -0
- package/richtexteditor/plugins/layouttable.min.js +1 -1
- package/richtexteditor/plugins/linkchecker.js +29 -9
- package/richtexteditor/plugins/linkchecker.min.js +1 -1
- package/richtexteditor/plugins/localdraft.js +51 -7
- package/richtexteditor/plugins/localdraft.min.js +1 -1
- package/richtexteditor/plugins/markdownexport.js +159 -0
- package/richtexteditor/plugins/markdownexport.min.js +2 -2
- package/richtexteditor/plugins/mathdialog.js +11 -5
- package/richtexteditor/plugins/mathdialog.min.js +1 -1
- package/richtexteditor/plugins/mentionplugin.js +90 -27
- package/richtexteditor/plugins/mentionplugin.min.js +1 -1
- package/richtexteditor/plugins/mermaiddiagram.js +14 -8
- package/richtexteditor/plugins/mermaiddiagram.min.js +2 -2
- package/richtexteditor/plugins/multilevellist.js +4 -0
- package/richtexteditor/plugins/multilevellist.min.js +1 -1
- package/richtexteditor/plugins/nodetypes.js +1 -1
- package/richtexteditor/plugins/nodetypes.min.js +1 -1
- package/richtexteditor/plugins/pagination.js +2 -2
- package/richtexteditor/plugins/pagination.min.js +1 -1
- package/richtexteditor/plugins/pdfexport.js +1752 -1167
- package/richtexteditor/plugins/pdfexport.min.js +28 -13
- package/richtexteditor/plugins/permanentpen.js +3 -3
- package/richtexteditor/plugins/permanentpen.min.js +1 -1
- package/richtexteditor/plugins/readabilitystats.js +25 -11
- package/richtexteditor/plugins/readabilitystats.min.js +1 -1
- package/richtexteditor/plugins/readaloud.js +30 -16
- package/richtexteditor/plugins/readaloud.min.js +1 -1
- package/richtexteditor/plugins/restrictedediting.js +166 -0
- package/richtexteditor/plugins/restrictedediting.min.js +2 -2
- package/richtexteditor/plugins/revisionhistory.js +173 -41
- package/richtexteditor/plugins/revisionhistory.min.js +3 -3
- package/richtexteditor/plugins/rubyannotation.js +21 -11
- package/richtexteditor/plugins/rubyannotation.min.js +1 -1
- package/richtexteditor/plugins/sanitizer.js +119 -7
- package/richtexteditor/plugins/sanitizer.min.js +1 -1
- package/richtexteditor/plugins/slashcommand.js +32 -18
- package/richtexteditor/plugins/slashcommand.min.js +2 -2
- package/richtexteditor/plugins/smartchips.js +39 -25
- package/richtexteditor/plugins/smartchips.min.js +2 -2
- package/richtexteditor/plugins/spellcheck.js +20 -11
- package/richtexteditor/plugins/spellcheck.min.js +2 -2
- package/richtexteditor/plugins/stateinspector.js +21 -11
- package/richtexteditor/plugins/stateinspector.min.js +2 -2
- package/richtexteditor/plugins/structured-content-bridge.js +90 -32
- package/richtexteditor/plugins/structured-content-bridge.min.js +8 -8
- package/richtexteditor/plugins/tableofcontents.js +5 -2
- package/richtexteditor/plugins/tableofcontents.min.js +1 -1
- package/richtexteditor/plugins/tabletools.js +388 -3
- package/richtexteditor/plugins/tabletools.min.js +1 -1
- package/richtexteditor/plugins/textdirection.js +19 -6
- package/richtexteditor/plugins/textdirection.min.js +1 -1
- package/richtexteditor/plugins/textpartlanguage.js +161 -32
- package/richtexteditor/plugins/textpartlanguage.min.js +1 -1
- package/richtexteditor/plugins/todolist.js +90 -6
- package/richtexteditor/plugins/todolist.min.js +1 -1
- package/richtexteditor/plugins/trackedchanges.js +1812 -25
- package/richtexteditor/plugins/trackedchanges.min.js +5 -3
- package/richtexteditor/plugins/wordexport.js +2 -2
- package/richtexteditor/plugins/yjscollab.js +11 -6
- package/richtexteditor/plugins/yjscollab.min.js +1 -1
- package/richtexteditor/plugins/zz_richtextbox_dialog_style.js +22 -13
- package/richtexteditor/plugins/zz_richtextbox_dialog_style.min.js +1 -1
- package/richtexteditor/rte-config.js +144 -86
- package/richtexteditor/rte-headless.js +19 -4
- package/richtexteditor/rte-watchdog.js +3 -1
- package/richtexteditor/rte-webcomponent.js +91 -16
- package/richtexteditor/rte.js +146 -88
- package/richtexteditor/runtime/colorpicker_more_ns.htm +3 -1
- package/scripts/build-angular.mjs +97 -0
- package/svelte/index.d.ts +2 -1
- package/svelte/index.js +80 -9
- package/vue/index.js +130 -34
- package/angular/component.ts +0 -297
- package/angular/index.ts +0 -24
|
@@ -1,4 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
// Trusted Types: the same guarded helper rte.js defines, for when this file loads before (or without) rte.js.
|
|
2
|
+
// tools/csp/trusted-types.mjs
|
|
3
|
+
if (!window.RTE_TrustedTypes) window.RTE_TrustedTypes = (function () {
|
|
4
|
+
var policy;
|
|
5
|
+
function get() {
|
|
6
|
+
if (policy !== undefined) return policy;
|
|
7
|
+
policy = null;
|
|
8
|
+
try {
|
|
9
|
+
if (window.trustedTypes && window.trustedTypes.createPolicy)
|
|
10
|
+
policy = window.trustedTypes.createPolicy("richtexteditor", {
|
|
11
|
+
createHTML: function (s) { return s; },
|
|
12
|
+
createScriptURL: function (s) { return s; }
|
|
13
|
+
});
|
|
14
|
+
} catch (e) {
|
|
15
|
+
policy = null;
|
|
16
|
+
if (window.console && console.warn) console.warn("RichTextEditor: could not create the Trusted Types policy \"richtexteditor\" - add it to the page's trusted-types directive. " + e.message);
|
|
17
|
+
}
|
|
18
|
+
return policy;
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
html: function (s) { var p = get(); return p ? p.createHTML(s == null ? "" : String(s)) : s; },
|
|
22
|
+
scriptURL: function (s) { var p = get(); return p ? p.createScriptURL(String(s)) : s; }
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
function __RTE_TT(s) { return window.RTE_TrustedTypes.html(s); }
|
|
26
|
+
|
|
27
|
+
var pendingLoadsByBasePath = Object.create(null);
|
|
28
|
+
var failedLoadsByBasePath = Object.create(null);
|
|
2
29
|
|
|
3
30
|
var INLINE_CONTAINER_TAGS = {
|
|
4
31
|
a: true,
|
|
@@ -138,7 +165,7 @@ function getPlainTextFromHtml(html) {
|
|
|
138
165
|
// Japanese hiragana/katakana, and the ideographic iteration marks. Hangul is
|
|
139
166
|
// intentionally excluded — Korean is written with inter-word spaces, so it is
|
|
140
167
|
// counted as whitespace-delimited tokens like Latin text (matching Word/Docs).
|
|
141
|
-
var CJK_WORD_CHAR = /[
|
|
168
|
+
var CJK_WORD_CHAR = /[\u3005\u3007\u3040-\u30ff\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/g;
|
|
142
169
|
|
|
143
170
|
function countWords(value) {
|
|
144
171
|
var normalized = normalizePlainText(value);
|
|
@@ -1346,7 +1373,7 @@ function finalizeVirtualNode(node) {
|
|
|
1346
1373
|
|
|
1347
1374
|
if (node.nodeType === 3) {
|
|
1348
1375
|
node.textContent = node.nodeValue || "";
|
|
1349
|
-
node.outerHTML = escapeHtml(node.nodeValue || "");
|
|
1376
|
+
node.outerHTML = __RTE_TT(escapeHtml(node.nodeValue || ""));
|
|
1350
1377
|
return node;
|
|
1351
1378
|
}
|
|
1352
1379
|
|
|
@@ -1367,23 +1394,23 @@ function finalizeVirtualNode(node) {
|
|
|
1367
1394
|
|
|
1368
1395
|
var tagName = getElementTagName(node);
|
|
1369
1396
|
if (!tagName) {
|
|
1370
|
-
node.outerHTML = childHtml;
|
|
1397
|
+
node.outerHTML = __RTE_TT(childHtml);
|
|
1371
1398
|
return node;
|
|
1372
1399
|
}
|
|
1373
1400
|
|
|
1374
1401
|
if (tagName === "body") {
|
|
1375
|
-
node.outerHTML = childHtml;
|
|
1402
|
+
node.outerHTML = __RTE_TT(childHtml);
|
|
1376
1403
|
return node;
|
|
1377
1404
|
}
|
|
1378
1405
|
|
|
1379
1406
|
var attrs = node._attrs || {};
|
|
1380
1407
|
var attrString = buildAttributeString(attrs);
|
|
1381
1408
|
if (HTML_VOID_TAGS[tagName]) {
|
|
1382
|
-
node.outerHTML = "<" + tagName + attrString + " />";
|
|
1409
|
+
node.outerHTML = __RTE_TT("<" + tagName + attrString + " />");
|
|
1383
1410
|
return node;
|
|
1384
1411
|
}
|
|
1385
1412
|
|
|
1386
|
-
node.outerHTML = "<" + tagName + attrString + ">" + childHtml + "</" + tagName + ">";
|
|
1413
|
+
node.outerHTML = __RTE_TT("<" + tagName + attrString + ">" + childHtml + "</" + tagName + ">");
|
|
1387
1414
|
return node;
|
|
1388
1415
|
}
|
|
1389
1416
|
|
|
@@ -1452,12 +1479,12 @@ function createVirtualDocumentBody(html) {
|
|
|
1452
1479
|
function getDocumentBody(html) {
|
|
1453
1480
|
if (typeof document !== "undefined" && document.implementation && document.implementation.createHTMLDocument) {
|
|
1454
1481
|
var doc = document.implementation.createHTMLDocument("");
|
|
1455
|
-
doc.body.innerHTML = html || "";
|
|
1482
|
+
doc.body.innerHTML = __RTE_TT(html || "");
|
|
1456
1483
|
return doc.body;
|
|
1457
1484
|
}
|
|
1458
1485
|
|
|
1459
1486
|
if (typeof DOMParser !== "undefined") {
|
|
1460
|
-
return new DOMParser().parseFromString("<!doctype html><html><body>" + (html || "") + "</body></html>", "text/html").body;
|
|
1487
|
+
return new DOMParser().parseFromString(__RTE_TT("<!doctype html><html><body>" + (html || "") + "</body></html>"), "text/html").body;
|
|
1461
1488
|
}
|
|
1462
1489
|
|
|
1463
1490
|
return createVirtualDocumentBody(html);
|
|
@@ -1798,7 +1825,7 @@ function parseBlockNode(node) {
|
|
|
1798
1825
|
}
|
|
1799
1826
|
var orderedListAttrs = {};
|
|
1800
1827
|
if (startValue) {
|
|
1801
|
-
orderedListAttrs.start = parseInt(startValue, 10)
|
|
1828
|
+
orderedListAttrs.start = (isFinite(parseInt(startValue, 10)) ? parseInt(startValue, 10) : 1);
|
|
1802
1829
|
}
|
|
1803
1830
|
if (orderedListType) {
|
|
1804
1831
|
orderedListAttrs.orderedListType = orderedListType;
|
|
@@ -2538,7 +2565,7 @@ function escapeHtml(value) {
|
|
|
2538
2565
|
}
|
|
2539
2566
|
|
|
2540
2567
|
function escapeAttribute(value) {
|
|
2541
|
-
return escapeHtml(value).replace(/"/g, """);
|
|
2568
|
+
return escapeHtml(value === undefined || value === null ? "" : String(value)).replace(/"/g, """);
|
|
2542
2569
|
}
|
|
2543
2570
|
|
|
2544
2571
|
function buildAttributeString(attrs) {
|
|
@@ -2791,7 +2818,7 @@ function serializeNode(node, inlineMode) {
|
|
|
2791
2818
|
|
|
2792
2819
|
if (node.type === "orderedList") {
|
|
2793
2820
|
var listAttrs = {};
|
|
2794
|
-
if (node.attrs && node.attrs.start) {
|
|
2821
|
+
if (node.attrs && node.attrs.start !== undefined && node.attrs.start !== null) {
|
|
2795
2822
|
listAttrs.start = node.attrs.start;
|
|
2796
2823
|
}
|
|
2797
2824
|
if (node.attrs) {
|
|
@@ -3192,8 +3219,8 @@ function validateNode(node, path, mode, issues) {
|
|
|
3192
3219
|
|
|
3193
3220
|
if (node.type === "bulletList" || node.type === "orderedList") {
|
|
3194
3221
|
if (node.type === "orderedList" && node.attrs && node.attrs.start !== undefined) {
|
|
3195
|
-
if (typeof node.attrs.start !== "number" || node.attrs.start
|
|
3196
|
-
issues.push(createValidationIssue(path + ".attrs.start", "Ordered lists require a
|
|
3222
|
+
if (typeof node.attrs.start !== "number" || !isFinite(node.attrs.start) || Math.floor(node.attrs.start) !== node.attrs.start || Math.abs(node.attrs.start) > 9007199254740991) {
|
|
3223
|
+
issues.push(createValidationIssue(path + ".attrs.start", "Ordered lists require a finite safe integer start value."));
|
|
3197
3224
|
}
|
|
3198
3225
|
}
|
|
3199
3226
|
if (node.type === "orderedList" && node.attrs && node.attrs.orderedListType !== undefined) {
|
|
@@ -3928,12 +3955,12 @@ function getMarkdownListMatch(line) {
|
|
|
3928
3955
|
};
|
|
3929
3956
|
}
|
|
3930
3957
|
|
|
3931
|
-
var orderedMatch = /^(\s*)(\d
|
|
3958
|
+
var orderedMatch = /^(\s*)(\d{1,9})\.\s+(.*)$/.exec(line);
|
|
3932
3959
|
if (orderedMatch) {
|
|
3933
3960
|
return {
|
|
3934
3961
|
indent: orderedMatch[1].length,
|
|
3935
3962
|
ordered: true,
|
|
3936
|
-
start: parseInt(orderedMatch[2], 10)
|
|
3963
|
+
start: parseInt(orderedMatch[2], 10),
|
|
3937
3964
|
text: orderedMatch[3],
|
|
3938
3965
|
marker: orderedMatch[2] + ".",
|
|
3939
3966
|
contentIndent: orderedMatch[1].length + orderedMatch[2].length + 2,
|
|
@@ -4923,8 +4950,13 @@ function serializeMarkdownBlocks(nodes) {
|
|
|
4923
4950
|
|
|
4924
4951
|
if (node.type === "bulletList" || node.type === "orderedList") {
|
|
4925
4952
|
var listParts = [];
|
|
4926
|
-
var start = node.type === "orderedList" && node.attrs && node.attrs.start ? parseInt(node.attrs.start, 10)
|
|
4953
|
+
var start = node.type === "orderedList" && node.attrs && node.attrs.start !== undefined ? parseInt(node.attrs.start, 10) : 1;
|
|
4954
|
+
if (!isFinite(start)) start = 1;
|
|
4927
4955
|
var listItems = node.content || [];
|
|
4956
|
+
if (node.type === "orderedList" && (start < 0 || start + Math.max(0, listItems.length - 1) > 999999999)) {
|
|
4957
|
+
parts.push(serializeNode(node, false));
|
|
4958
|
+
continue;
|
|
4959
|
+
}
|
|
4928
4960
|
for (var itemIndex = 0; itemIndex < listItems.length; itemIndex++) {
|
|
4929
4961
|
var prefix = node.type === "orderedList" ? (start + itemIndex) + ". " : "- ";
|
|
4930
4962
|
listParts.push(serializeMarkdownListItem(listItems[itemIndex].content || [], prefix));
|
|
@@ -5069,15 +5101,28 @@ function installStructuredContentBridge() {
|
|
|
5069
5101
|
}
|
|
5070
5102
|
|
|
5071
5103
|
function ensureStylesheet(href) {
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5104
|
+
return new Promise(function (resolve, reject) {
|
|
5105
|
+
var existing = document.querySelector('link[data-rte-style="' + href + '"]');
|
|
5106
|
+
if (existing && (existing.getAttribute("data-rte-loaded") === "true" || existing.sheet)) {
|
|
5107
|
+
resolve();
|
|
5108
|
+
return;
|
|
5109
|
+
}
|
|
5110
|
+
var link = existing || document.createElement("link");
|
|
5111
|
+
link.addEventListener("load", function () {
|
|
5112
|
+
link.setAttribute("data-rte-loaded", "true");
|
|
5113
|
+
resolve();
|
|
5114
|
+
}, { once: true });
|
|
5115
|
+
link.addEventListener("error", function () {
|
|
5116
|
+
if (link.parentNode) link.parentNode.removeChild(link);
|
|
5117
|
+
reject(new Error("Failed to load " + href));
|
|
5118
|
+
}, { once: true });
|
|
5119
|
+
if (!existing) {
|
|
5120
|
+
link.rel = "stylesheet";
|
|
5121
|
+
link.href = href;
|
|
5122
|
+
link.setAttribute("data-rte-style", href);
|
|
5123
|
+
document.head.appendChild(link);
|
|
5124
|
+
}
|
|
5125
|
+
});
|
|
5081
5126
|
}
|
|
5082
5127
|
|
|
5083
5128
|
function loadScript(src) {
|
|
@@ -5099,7 +5144,7 @@ function loadScript(src) {
|
|
|
5099
5144
|
}
|
|
5100
5145
|
|
|
5101
5146
|
var script = document.createElement("script");
|
|
5102
|
-
script.src = src;
|
|
5147
|
+
script.src = window.RTE_TrustedTypes.scriptURL(src);
|
|
5103
5148
|
script.async = false;
|
|
5104
5149
|
script.setAttribute("data-rte-script", src);
|
|
5105
5150
|
script.onload = function () {
|
|
@@ -5107,6 +5152,7 @@ function loadScript(src) {
|
|
|
5107
5152
|
resolve(script);
|
|
5108
5153
|
};
|
|
5109
5154
|
script.onerror = function () {
|
|
5155
|
+
if (script.parentNode) script.parentNode.removeChild(script);
|
|
5110
5156
|
reject(new Error("Failed to load " + src));
|
|
5111
5157
|
};
|
|
5112
5158
|
|
|
@@ -5123,18 +5169,30 @@ function loadRichTextEditorAssets(options) {
|
|
|
5123
5169
|
|
|
5124
5170
|
var basePath = trimTrailingSlash(options && options.basePath ? options.basePath : "/richtexteditor");
|
|
5125
5171
|
|
|
5126
|
-
if (
|
|
5172
|
+
if (pendingLoadsByBasePath[basePath]) {
|
|
5173
|
+
return pendingLoadsByBasePath[basePath];
|
|
5174
|
+
}
|
|
5175
|
+
|
|
5176
|
+
if (window.RichTextEditor && !failedLoadsByBasePath[basePath]) {
|
|
5127
5177
|
return Promise.resolve(installStructuredContentBridge());
|
|
5128
5178
|
}
|
|
5129
5179
|
|
|
5130
5180
|
if (!pendingLoadsByBasePath[basePath]) {
|
|
5131
|
-
ensureStylesheet(basePath + "/rte_theme_default.css");
|
|
5132
|
-
|
|
5181
|
+
var themeReady = ensureStylesheet(basePath + "/rte_theme_default.css");
|
|
5182
|
+
var scriptsReady = loadScript(basePath + "/rte.js")
|
|
5133
5183
|
.then(function () {
|
|
5184
|
+
if (window.RTE_DefaultConfig) window.RTE_DefaultConfig.url_base = basePath;
|
|
5134
5185
|
return loadScript(basePath + "/plugins/all_plugins.js");
|
|
5135
|
-
})
|
|
5186
|
+
});
|
|
5187
|
+
pendingLoadsByBasePath[basePath] = Promise.all([themeReady, scriptsReady])
|
|
5136
5188
|
.then(function () {
|
|
5189
|
+
delete failedLoadsByBasePath[basePath];
|
|
5137
5190
|
return installStructuredContentBridge();
|
|
5191
|
+
})
|
|
5192
|
+
.catch(function (error) {
|
|
5193
|
+
delete pendingLoadsByBasePath[basePath];
|
|
5194
|
+
failedLoadsByBasePath[basePath] = true;
|
|
5195
|
+
throw error;
|
|
5138
5196
|
});
|
|
5139
5197
|
}
|
|
5140
5198
|
|
|
@@ -5175,4 +5233,4 @@ window.RichTextEditorStructuredBridge = {
|
|
|
5175
5233
|
setEditorValue: setEditorValue,
|
|
5176
5234
|
toMarkdown: toMarkdown,
|
|
5177
5235
|
validateStructuredContent: validateStructuredContent
|
|
5178
|
-
};
|
|
5236
|
+
};
|