@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
|
@@ -59,13 +59,19 @@ function RTE_Plugin_SlashCommand() {
|
|
|
59
59
|
|
|
60
60
|
injectStyles();
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
// 2026-10-03 Bound through editor.bindDocumentEvent, so the listeners follow the live document:
|
|
63
|
+
// shell plugins move the iframe during the init loop, and listeners added to editdoc here stayed
|
|
64
|
+
// on the dead document (this feature never fired). tools/keyboard/plugin-listeners.mjs
|
|
65
|
+
var on = function (type, fn, capture) {
|
|
66
|
+
if (editor.bindDocumentEvent) editor.bindDocumentEvent(type, fn, capture);
|
|
67
|
+
else editor.getDocument().addEventListener(type, fn, capture);
|
|
68
|
+
};
|
|
69
|
+
on("keydown", onEditDocKeyDown, true);
|
|
70
|
+
on("input", onEditDocInput, true);
|
|
71
|
+
on("compositionstart", function () { composing = true; });
|
|
72
|
+
on("compositionend", function () { composing = false; });
|
|
73
|
+
on("mousedown", function () { closePopup(); }, true);
|
|
74
|
+
on("blur", function () { setTimeout(closePopup, 150); }, true);
|
|
69
75
|
|
|
70
76
|
window.addEventListener("scroll", onHostScrollOrResize, true);
|
|
71
77
|
window.addEventListener("resize", onHostScrollOrResize, true);
|
|
@@ -291,9 +297,9 @@ function RTE_Plugin_SlashCommand() {
|
|
|
291
297
|
if (typeof editor.setTableLayoutMode === "function") {
|
|
292
298
|
push("Insert", "layouttable", "Layout table", "Insert a borderless table for positioning content (role=presentation)", ["layout", "table", "grid", "email", "columns", "presentation"], iconTable(),
|
|
293
299
|
function () { editor.insertLayoutTable(2, 2); });
|
|
294
|
-
push("Tools", "tablelayoutmode", "Mark table as layout", "This table only positions content
|
|
300
|
+
push("Tools", "tablelayoutmode", "Mark table as layout", "This table only positions content \u2014 stop screen readers announcing it as data", ["layout", "table", "presentation", "accessibility", "screen reader"], iconTable(),
|
|
295
301
|
function () { editor.setTableLayoutMode("layout"); });
|
|
296
|
-
push("Tools", "tabledatamode", "Mark table as data", "This table states relationships
|
|
302
|
+
push("Tools", "tabledatamode", "Mark table as data", "This table states relationships \u2014 restore its header cells", ["data", "table", "header", "accessibility"], iconTable(),
|
|
297
303
|
function () { editor.setTableLayoutMode("data", null, { promoteFirstRow: true }); });
|
|
298
304
|
}
|
|
299
305
|
if (typeof editor.moveBlockUp === "function") {
|
|
@@ -401,7 +407,7 @@ function RTE_Plugin_SlashCommand() {
|
|
|
401
407
|
// this menu without any error. These checks are re-run by refreshDefaults()
|
|
402
408
|
// after all plugins have initialised and again each time the menu opens.
|
|
403
409
|
if (typeof editor.exportToPdf === "function") {
|
|
404
|
-
push("Tools", "exportpdf", "Export to PDF", "Real text, not a screenshot
|
|
410
|
+
push("Tools", "exportpdf", "Export to PDF", "Real text, not a screenshot \u2014 selectable, searchable and screen-reader friendly", ["pdf", "export", "download", "save", "print", "text", "accessible", "searchable"], iconPdfText(),
|
|
405
411
|
function () { editor.exportToPdf(); });
|
|
406
412
|
}
|
|
407
413
|
if (typeof editor.exportToDocx === "function") {
|
|
@@ -439,6 +445,8 @@ function RTE_Plugin_SlashCommand() {
|
|
|
439
445
|
function () { editor.copyAsMarkdown(); });
|
|
440
446
|
push("Tools", "downloadmarkdown", "Download as Markdown", "Save the document as a .md file", ["markdown", "md", "download", "export", "save", "file"], iconMarkdown(),
|
|
441
447
|
function () { editor.downloadMarkdown(); });
|
|
448
|
+
push("Tools", "markdownmode", "Edit as Markdown", "Show the document as Markdown text, and back to the visual view", ["markdown", "md", "source", "text", "edit", "mode"], iconMarkdown(),
|
|
449
|
+
function () { editor.toggleMarkdownMode(); });
|
|
442
450
|
}
|
|
443
451
|
if (typeof editor.toggleTypewriterMode === "function") {
|
|
444
452
|
push("Tools", "typewriter", "Typewriter mode", "Keep the caret line centred as you type", ["typewriter", "center", "scroll", "focus", "distraction", "zen"], iconTypewriter(),
|
|
@@ -451,6 +459,10 @@ function RTE_Plugin_SlashCommand() {
|
|
|
451
459
|
function () { editor.execCommand("inserttable"); });
|
|
452
460
|
push("Insert", "image", "Image", "Upload or embed an image", ["picture", "photo", "img"], iconImage(),
|
|
453
461
|
function () { editor.execCommand("imageupload"); });
|
|
462
|
+
if (typeof editor.openImageGenerator === "function") {
|
|
463
|
+
push("Insert", "generate-image", "Generate image", "Describe an image and insert it (your own image provider)", ["picture", "generate", "ai", "draw", "image", "create"], iconImage(),
|
|
464
|
+
function () { editor.openImageGenerator(); });
|
|
465
|
+
}
|
|
454
466
|
push("Insert", "link", "Link", "Insert a hyperlink", ["url", "anchor"], iconLink(),
|
|
455
467
|
function () { editor.execCommand("insertlink"); });
|
|
456
468
|
push("Insert", "emoji", "Emoji", "Insert an emoji", ["smiley", "icon"], iconEmoji(),
|
|
@@ -641,18 +653,18 @@ function RTE_Plugin_SlashCommand() {
|
|
|
641
653
|
if (host && host.classList && host.classList.contains("rte-dark")) popupEl.className += " rte-slash-popup-dark";
|
|
642
654
|
} catch (e) {}
|
|
643
655
|
popupEl.setAttribute("role", "listbox");
|
|
644
|
-
popupEl.setAttribute("aria-label", "Slash commands");
|
|
656
|
+
popupEl.setAttribute("aria-label", (config && config.text_slash_aria) || "Slash commands");
|
|
645
657
|
popupHost.body.appendChild(popupEl);
|
|
646
658
|
}
|
|
647
659
|
|
|
648
660
|
function renderItems() {
|
|
649
661
|
if (!popupEl) return;
|
|
650
|
-
popupEl.innerHTML = "";
|
|
662
|
+
popupEl.innerHTML = __RTE_TT("");
|
|
651
663
|
|
|
652
664
|
if (!filtered.length) {
|
|
653
665
|
var empty = popupHost.createElement("div");
|
|
654
666
|
empty.className = "rte-slash-empty";
|
|
655
|
-
empty.textContent = "No matching commands";
|
|
667
|
+
empty.textContent = (config && config.text_slash_none) || "No matching commands";
|
|
656
668
|
popupEl.appendChild(empty);
|
|
657
669
|
return;
|
|
658
670
|
}
|
|
@@ -676,7 +688,7 @@ function RTE_Plugin_SlashCommand() {
|
|
|
676
688
|
|
|
677
689
|
var icon = popupHost.createElement("span");
|
|
678
690
|
icon.className = "rte-slash-item-icon";
|
|
679
|
-
icon.innerHTML = cmd.iconSvg || iconDot();
|
|
691
|
+
icon.innerHTML = __RTE_TT(cmd.iconSvg || iconDot());
|
|
680
692
|
item.appendChild(icon);
|
|
681
693
|
|
|
682
694
|
var body = popupHost.createElement("span");
|
|
@@ -799,8 +811,10 @@ function RTE_Plugin_SlashCommand() {
|
|
|
799
811
|
var r = rects && rects.length ? rects[rects.length - 1] : null;
|
|
800
812
|
if (!r) r = trigger.range.getBoundingClientRect();
|
|
801
813
|
|
|
802
|
-
|
|
803
|
-
var
|
|
814
|
+
// the caret rect is in iframe pixels, scaled on screen inside a transform:scale() ancestor
|
|
815
|
+
var sk = iframe.offsetWidth && ir.width > 0 ? ir.width / iframe.offsetWidth : 1;
|
|
816
|
+
var left = ir.left + (r.left || 0) * sk + window.pageXOffset;
|
|
817
|
+
var top = ir.top + (r.bottom || r.top || 0) * sk + window.pageYOffset + 4;
|
|
804
818
|
|
|
805
819
|
popupEl.style.position = "absolute";
|
|
806
820
|
popupEl.style.left = left + "px";
|
|
@@ -809,8 +823,8 @@ function RTE_Plugin_SlashCommand() {
|
|
|
809
823
|
// Flip up if would overflow viewport
|
|
810
824
|
var vh = window.innerHeight || document.documentElement.clientHeight;
|
|
811
825
|
var popupRect = popupEl.getBoundingClientRect();
|
|
812
|
-
if (popupRect.bottom > vh - 8 && (ir.top + (r.top || 0)) > popupRect.height + 16) {
|
|
813
|
-
popupEl.style.top = (ir.top + (r.top || 0) + window.pageYOffset - popupRect.height - 4) + "px";
|
|
826
|
+
if (popupRect.bottom > vh - 8 && (ir.top + (r.top || 0) * sk) > popupRect.height + 16) {
|
|
827
|
+
popupEl.style.top = (ir.top + (r.top || 0) * sk + window.pageYOffset - popupRect.height - 4) + "px";
|
|
814
828
|
}
|
|
815
829
|
}
|
|
816
830
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_slashcommand=RTE_Plugin_SlashCommand;function RTE_Plugin_SlashCommand(){var T=this,d,e,v=null,a=null,g=null,h=[],m=[],p=0,E=!1,R=!1;T.PluginName="SlashCommand",T.InitConfig=function(o){d=o,d.slashCommandEnabled!==!1&&(d.slashCommandTrigger=d.slashCommandTrigger||"/",d.slashCommandMaxItems=d.slashCommandMaxItems||40,d.slashCommandIncludeAi=d.slashCommandIncludeAi!==!1,d.slashCommands=d.slashCommands||null)},T.InitEditor=function(o){if(e=o,d.slashCommandEnabled!==!1){if(e.slashCommands={register:P,remove:te,list:function(){return B(),h.slice()},open:function(){O(!0)},close:f,isOpen:function(){return!!a}},h=N(),Array.isArray(d.slashCommands))for(var t=0;t<d.slashCommands.length;t++)P(d.slashCommands[t]);setTimeout(B,0),he();var n=e.getDocument();n.addEventListener("keydown",re,!0),n.addEventListener("input",ie,!0),n.addEventListener("compositionstart",function(){E=!0}),n.addEventListener("compositionend",function(){E=!1}),n.addEventListener("mousedown",function(){f()},!0),n.addEventListener("blur",function(){setTimeout(f,150)},!0),window.addEventListener("scroll",U,!0),window.addEventListener("resize",U,!0)}};function P(o){if(!(!o||!o.id)){var t=F(o.id);t>=0?h[t]=b(o):h.push(b(o))}}var H={};function B(){if(e){for(var o=[],t=0;t<h.length;t++)h[t]._default||o.push(h[t]);for(var n=N(),i=[],s=0;s<n.length;s++){var l=n[s].id;if(!H[l]){for(var c=!1,r=0;r<o.length;r++)if(o[r].id===l){c=!0;break}c||i.push(n[s])}}h=i.concat(o)}}function te(o){H[o]=!0;var t=F(o);t>=0&&h.splice(t,1)}function F(o){for(var t=0;t<h.length;t++)if(h[t].id===o)return t;return-1}function I(o,t){try{var n=String(o).toLowerCase().replace(/[^a-z0-9_]/g,"_");if(d&&d["text_"+n]&&e&&typeof e.getLangText=="function")return e.getLangText(n)}catch{}return t}function b(o){var t=o.section||"Blocks";return{id:o.id,section:I("slash_section_"+t,t),title:I("slash_"+o.id,o.title||o.id),description:I("slash_"+o.id+"_desc",o.description||""),keywords:(o.keywords||[]).slice(),icon:o.icon||"",iconSvg:o.iconSvg||"",run:o.run||o.action}}var oe={P:1,DIV:1,H1:1,H2:1,H3:1,H4:1,H5:1,H6:1,BLOCKQUOTE:1,PRE:1,LI:1};function ne(){var o=e.getSelection();if(!o||o.rangeCount===0)return null;for(var t=o.getRangeAt(0).startContainer,n=e.getEditable();t&&t!==n;){if(t.nodeType===1&&oe[t.nodeName])return t;t=t.parentNode}return null}function C(o){var t=ne();if(o=o.toUpperCase(),t&&!t.textContent.trim()){var n=e.getDocument(),i=n.createElement(o);i.appendChild(n.createElement("br")),t.parentNode.replaceChild(i,t);var s=n.createRange();s.setStart(i,0),s.setEnd(i,0);var l=e.getSelection();l.removeAllRanges(),l.addRange(s);return}e.execCommand("formatblock",o)}function N(){var o=[];function t(r,u,x,w,k,Qe,Ge){var ee=b({id:u,section:r,title:x,description:w,keywords:k,iconSvg:Qe,run:Ge});ee._default=!0,o.push(ee)}if(t("Blocks","heading1","Heading 1","Large section heading",["h1","title"],S("1"),function(){C("H1")}),t("Blocks","heading2","Heading 2","Medium section heading",["h2","subtitle"],S("2"),function(){C("H2")}),t("Blocks","heading3","Heading 3","Small section heading",["h3"],S("3"),function(){C("H3")}),t("Blocks","paragraph","Paragraph","Plain body text",["p","text","body"],pe(),function(){C("P")}),t("Blocks","bulletlist","Bulleted list","Unordered list",["ul","bullets","list"],fe(),function(){e.execCommand("insertunorderedlist")}),t("Blocks","numberlist","Numbered list","Ordered list",["ol","numbered"],ge(),function(){e.execCommand("insertorderedlist")}),t("Blocks","quote","Quote","Block quotation",["blockquote"],me(),function(){e.execCommand("insertblockquote")}),t("Blocks","code","Code block","Monospaced code block",["pre","snippet"],ve(),function(){e.isCommandEnabled&&e.isCommandEnabled("insertcode")?e.execCommand("insertcode"):e.execCommand("formatblock","PRE")}),t("Blocks","divider","Divider","Horizontal rule",["hr","line","separator"],ke(),function(){e.execCommand("inserthorizontalrule")}),(!e.isCommandEnabled||e.isCommandEnabled("insertcallout"))&&t("Blocks","callout","Callout","Highlighted info / warning box",["admonition","info","warning","note","tip"],Te(),function(){e.execCommand("insertcallout")}),(!e.isCommandEnabled||e.isCommandEnabled("insertcolumns"))&&t("Blocks","columns","Columns","Multi-column layout",["layout","grid","column"],Ee(),function(){e.execCommand("insertcolumns")}),(!e.isCommandEnabled||e.isCommandEnabled("inserttoggle"))&&t("Blocks","toggle","Toggle list","Collapsible toggle block",["collapse","details","accordion","expand"],Be(),function(){e.execCommand("inserttoggle")}),(!e.isCommandEnabled||e.isCommandEnabled("insertmath"))&&t("Insert","equation","Equation","Insert a math equation (TeX)",["math","latex","tex","formula","katex"],Ie(),function(){e.execCommand("insertmath")}),(!e.isCommandEnabled||e.isCommandEnabled("inserttodolist"))&&t("Blocks","todolist","To-do list","Checklist with clickable checkboxes",["task","todo","checklist","checkbox","check"],ze(),function(){e.execCommand("inserttodolist")}),(!e.isCommandEnabled||e.isCommandEnabled("insertdiagram"))&&t("Insert","diagram","Diagram","Insert a Mermaid diagram",["mermaid","flowchart","sequence","gantt","graph","uml"],Se(),function(){e.execCommand("insertdiagram")}),(!e.isCommandEnabled||e.isCommandEnabled("insertbookmark"))&&t("Insert","bookmark","Bookmark","Insert a link preview card",["link","url","embed","preview","card"],Ae(),function(){e.execCommand("insertbookmark")}),(!e.isCommandEnabled||e.isCommandEnabled("spellcheck"))&&t("Tools","spellcheck","Spell check","Check spelling",["spelling","grammar","proofread","typo"],V(),function(){e.execCommand("spellcheck")}),(!e.isCommandEnabled||e.isCommandEnabled("insertdatechip"))&&t("Insert","datechip","Date chip","Insert an interactive date chip",["date","calendar","chip","today"],K(),function(){e.execCommand("insertdatechip")}),(!e.isCommandEnabled||e.isCommandEnabled("insertchip"))&&t("Insert","chip","Smart chip","Insert a date / person / link chip",["chip","person","mention","link","pill"],K(),function(){e.execCommand("insertchip")}),(!e.isCommandEnabled||e.isCommandEnabled("emailexport"))&&t("Tools","emailexport","Export email HTML","Inline-styled HTML for email",["email","inline","mail","newsletter","html"],Le(),function(){e.execCommand("emailexport")}),typeof e.openFindDialog=="function"&&t("Tools","findreplace","Find & replace","Search the document and replace text",["find","replace","search","query","substitute"],_e(),function(){e.openFindDialog()}),typeof e.showShortcuts=="function"&&t("Tools","shortcuts","Keyboard shortcuts","Show the keyboard shortcut cheat sheet (Ctrl+/)",["keyboard","shortcuts","hotkeys","keys","help","cheat"],qe(),function(){e.showShortcuts()}),typeof e.foldAtCaret=="function"&&(t("Tools","foldsection","Fold section","Collapse the section under the current heading",["fold","collapse","heading","outline","section"],J(),function(){e.foldAtCaret()}),t("Tools","unfoldall","Unfold all","Expand every collapsed heading section",["unfold","expand","headings","collapse"],J(),function(){e.unfoldAll&&e.unfoldAll()})),(!e.isCommandEnabled||e.isCommandEnabled("readaloud"))&&t("Tools","readaloud","Read aloud","Speak the selection or document (text-to-speech)",["tts","speak","speech","voice","accessibility","narrate"],W(),function(){e.execCommand("readaloud")}),typeof e.sortTableAtCaret=="function"&&(t("Tools","sorttableasc","Sort table by this column","Sort the table rows by the column the caret is in",["sort","table","column","order","ascending"],D(),function(){e.sortTableAtCaret("asc")}),t("Tools","sorttabledesc","Sort table (descending)","Sort the table rows by this column, largest first",["sort","table","column","descending","reverse"],D(),function(){e.sortTableAtCaret("desc")}),t("Tools","tablerownumbers","Number table rows","Add or remove an automatic row-numbering column",["number","rows","table","count","index"],D(),function(){e.execCommand("tablerownumbers")})),typeof e.setTableLayoutMode=="function"&&(t("Insert","layouttable","Layout table","Insert a borderless table for positioning content (role=presentation)",["layout","table","grid","email","columns","presentation"],y(),function(){e.insertLayoutTable(2,2)}),t("Tools","tablelayoutmode","Mark table as layout","This table only positions content \u2014 stop screen readers announcing it as data",["layout","table","presentation","accessibility","screen reader"],y(),function(){e.setTableLayoutMode("layout")}),t("Tools","tabledatamode","Mark table as data","This table states relationships \u2014 restore its header cells",["data","table","header","accessibility"],y(),function(){e.setTableLayoutMode("data",null,{promoteFirstRow:!0})})),typeof e.moveBlockUp=="function"&&(t("Tools","moveblockup","Move block up","Move this paragraph or block above the previous one (Alt+Shift+Up)",["move","block","up","reorder","drag"],Q(),function(){e.moveBlockUp()}),t("Tools","moveblockdown","Move block down","Move this paragraph or block below the next one (Alt+Shift+Down)",["move","block","down","reorder","drag"],Q(),function(){e.moveBlockDown()})),typeof e.toggleRtlUserInterface=="function"&&t("Tools","rtlui","Mirror editor for RTL","Flip the toolbar, menus and dialogs for right-to-left languages",["rtl","mirror","interface","toolbar","arabic","hebrew"],j(),function(){e.toggleRtlUserInterface()}),typeof e.setTextDirection=="function"&&(t("Tools","rtl","Right-to-left","Set this paragraph to right-to-left (Arabic, Hebrew, Persian)",["rtl","arabic","hebrew","persian","urdu","direction","bidi"],j(),function(){e.setTextDirection("rtl")}),t("Tools","ltr","Left-to-right","Set this paragraph to left-to-right",["ltr","direction","bidi"],je(),function(){e.setTextDirection("ltr")}),t("Tools","autodir","Detect text direction","Set each paragraph's direction from its own content",["direction","detect","auto","rtl","bidi"],j(),function(){e.autoDetectTextDirection()})),typeof e.toggleFormattingMarks=="function"&&t("Tools","formattingmarks","Formatting marks","Show paragraph marks, block outlines and invisible characters",["marks","pilcrow","paragraph","invisible","whitespace","nbsp"],De(),function(){e.toggleFormattingMarks()}),typeof e.toggleWatermark=="function"&&t("Tools","watermark","Watermark","Draw DRAFT or CONFIDENTIAL behind the content",["watermark","draft","confidential","background","stamp"],Re(),function(){e.toggleWatermark()}),typeof e.toggleLineNumbers=="function"&&t("Tools","linenumbers","Line numbers","Number every line in the margin, as pleadings and transcripts require",["line","numbers","margin","pleading","legal","transcript"],Pe(),function(){e.toggleLineNumbers()}),typeof e.togglePermanentPen=="function"&&t("Tools","permanentpen","Permanent pen","Keep typing in a fixed annotation format until switched off",["pen","marker","annotate","highlight","review"],G(),function(){e.togglePermanentPen()}),typeof e.checkLinks=="function"&&t("Tools","checklinks","Check links","Find broken anchors, unsafe schemes and unlabelled links",["link","check","broken","audit","url","accessibility"],He(),function(){e.highlightLinkIssues(!0),e.checkLinks()}),typeof e.getMergeFieldDefinitions=="function"){for(var n=e.getMergeFieldDefinitions(),i=0;i<n.length;i++)(function(r){!r||!r.id||t("Insert","mergefield-"+r.id,r.label||r.id,"Insert the "+(r.label||r.id)+" merge field",["merge","field","placeholder","variable","mail merge",r.id],X(),function(){e.insertMergeField(r.id)})})(n[i]);t("Tools","mergepreview","Preview merge fields","Swap merge-field placeholders for sample data",["merge","preview","sample","data","placeholder"],X(),function(){e.toggleMergeFieldPreview()})}if(typeof e.listCrossReferenceTargets=="function"){var s=[];try{s=e.listCrossReferenceTargets()}catch{s=[]}for(var l=0;l<s.length&&l<40;l++)(function(r){if(!(!r||!r.id)){var u=r.number?r.number+" "+r.label:r.label;t("Insert","xref-"+r.id,"Reference: "+u,"Insert a cross-reference to this "+r.type+" that updates itself",["cross","reference","xref","see","refer",r.type,r.number||""],Y(),function(){e.insertCrossReference(r.id,r.number?"label":"text")})}})(s[l])}if(typeof e.insertTableOfContents=="function"&&t("Insert","toc","Table of contents","Insert a contents block that updates itself from your headings",["toc","contents","outline","index","headings"],Fe(),function(){e.insertTableOfContents()}),typeof e.insertFootnote=="function"&&t("Insert","footnote","Footnote","Insert a numbered footnote reference and note",["footnote","note","citation","reference","endnote","cite"],Ne(),function(){e.insertFootnote()}),typeof e.toggleFormatPainter=="function"&&t("Tools","formatpainter","Format painter","Copy formatting here, then select the text to paint it onto",["format","painter","brush","copy","style","clone"],Oe(),function(){e.toggleFormatPainter()}),typeof e.changeCase=="function"&&(t("Tools","caseupper","UPPERCASE","Convert the selection to upper case",["case","upper","caps","capitals"],M(),function(){e.changeCase("upper")}),t("Tools","caselower","lowercase","Convert the selection to lower case",["case","lower","small"],M(),function(){e.changeCase("lower")}),t("Tools","casetitle","Title Case","Capitalise each significant word in the selection",["case","title","headline","capitalise","capitalize"],M(),function(){e.changeCase("title")}),t("Tools","casesentence","Sentence case","Capitalise the first letter of each sentence",["case","sentence","capitalise","capitalize"],M(),function(){e.changeCase("sentence")})),typeof e.requestGhostText=="function"&&t("Tools","aicomplete","AI complete","Suggest an inline AI completion of the current sentence",["ai","complete","autocomplete","ghost","suggest","continue","copilot"],Ke(),function(){e.requestGhostText()}),typeof e.exportToPdf=="function"&&t("Tools","exportpdf","Export to PDF","Real text, not a screenshot \u2014 selectable, searchable and screen-reader friendly",["pdf","export","download","save","print","text","accessible","searchable"],We(),function(){e.exportToPdf()}),typeof e.exportToDocx=="function"&&t("Tools","exportdocx","Export to Word (.docx)","A real OOXML document, built in the browser with no upload",["word","docx","ooxml","export","download","save","office"],$(),function(){e.exportToDocx()}),typeof e.openImportDialog=="function"&&t("Tools","import-document","Import document","Open a Markdown, HTML, text, or Word file into the editor",["import","open","file","word","docx","markdown","upload"],$(),function(){e.openImportDialog({})}),typeof e.getReadabilityStats=="function"&&t("Tools","readability-stats","Readability statistics","Flesch reading ease, grade level, and reading time",["readability","flesch","grade","reading","stats","score"],V(),function(){e.execCommand("readability")}),typeof e.insertCrossReference=="function"&&t("Insert","crossreference","Cross-reference","Insert a live reference to a heading, figure, table, or bookmark",["cross","reference","xref","see","figure","heading"],Y(),function(){e.execCommand("insertcrossreference")}),e.restrictedEditing&&t("Tools","restrictedediting","Restricted editing","Lock the document and mark only the regions others may edit",["restrict","lock","protect","editable","region","permission"],G(),function(){e.execCommand("restrictedediting")}),e.dictation&&t("Tools","dictation","Dictation","Speak and have your words typed into the document",["dictate","speech","voice","microphone","talk"],W(),function(){e.execCommand("dictation")}),typeof e.copyAsMarkdown=="function"&&(t("Tools","copymarkdown","Copy as Markdown","Copy the whole document to the clipboard as Markdown",["markdown","md","copy","clipboard","export"],Z(),function(){e.copyAsMarkdown()}),t("Tools","downloadmarkdown","Download as Markdown","Save the document as a .md file",["markdown","md","download","export","save","file"],Z(),function(){e.downloadMarkdown()})),typeof e.toggleTypewriterMode=="function"&&(t("Tools","typewriter","Typewriter mode","Keep the caret line centred as you type",["typewriter","center","scroll","focus","distraction","zen"],Ue(),function(){e.toggleTypewriterMode()}),t("Tools","focusmode","Focus mode","Dim everything except the current paragraph",["focus","dim","highlight","distraction","zen","concentrate"],Ve(),function(){e.toggleFocusMode()})),t("Insert","table","Table","Insert a table",["grid","rows","columns"],y(),function(){e.execCommand("inserttable")}),t("Insert","image","Image","Upload or embed an image",["picture","photo","img"],xe(),function(){e.execCommand("imageupload")}),t("Insert","link","Link","Insert a hyperlink",["url","anchor"],we(),function(){e.execCommand("insertlink")}),t("Insert","emoji","Emoji","Insert an emoji",["smiley","icon"],be(),function(){e.execCommand("insertemoji")}),t("Insert","template","Template","Insert from template gallery",["snippet"],Ce(),function(){e.execCommand("inserttemplate")}),t("Insert","date","Today's date","Insert the current date",["time","now"],ye(),function(){e.execCommand("insertdate")}),d.slashCommandIncludeAi&&Array.isArray(d.aiToolkitActions))for(var c=0;c<d.aiToolkitActions.length;c++)(function(r){o.push(b({id:"ai-"+r.id,section:"AI",title:r.title||r.id,description:r.description||"",keywords:["ai",r.id],iconSvg:d["svgCode_aiassist_"+(r.icon||r.id)]||d.svgCode_aiassist||"",run:function(){var u=e.aiToolkit;if(u){if(r.id==="chat-panel"&&typeof u.openChatPanel=="function"){u.openChatPanel();return}if(r.id==="review-panel"&&typeof u.openReviewPanel=="function"){u.openReviewPanel();return}if(r.id==="open-dialog"&&typeof u.openDialog=="function"){u.openDialog();return}if(typeof u.runQuickAction=="function"){u.runQuickAction(r.id);return}typeof u.resolveAction=="function"&&u.resolveAction(r.id)}}}))})(d.aiToolkitActions[c]);return o}function re(o){if(!E){if(a)switch(o.key){case"ArrowDown":o.preventDefault(),o.stopPropagation(),_(1);return;case"ArrowUp":o.preventDefault(),o.stopPropagation(),_(-1);return;case"Enter":case"Tab":if(m.length){o.preventDefault(),o.stopPropagation(),A();return}f();return;case"Escape":case"Esc":o.preventDefault(),o.stopPropagation(),f();return}if(o.key===d.slashCommandTrigger&&!o.ctrlKey&&!o.metaKey&&!o.altKey){if(!ae())return;R=!1,setTimeout(function(){R||O(!1)},0)}}}function ie(){a&&se()}function ae(){var o=e.getSelection();if(!o||o.rangeCount===0||!o.isCollapsed)return!1;for(var t=o.getRangeAt(0),n=t.startContainer,i=t.startOffset,s=e.getEditable(),l=n.nodeType===1?n:n.parentNode;l&&l!==s;){var c=l.nodeName;if(c==="CODE"||c==="PRE")return!1;l=l.parentNode}if(n.nodeType===3){if(i===0)return!0;var r=n.nodeValue.charAt(i-1);return/\s/.test(r)}return!0}function O(o){B(),f();var t=e.getSelection();if(!(!t||t.rangeCount===0)){var n=t.getRangeAt(0).cloneRange();g={range:n,startNode:n.startContainer,startOffset:n.startOffset,triggerCharCount:o?0:1,query:""},le(),L(),z("")}}function f(){a&&a.parentNode&&a.parentNode.removeChild(a),a=null,g=null,m=[],p=0}function se(){if(g){var o=e.getSelection();if(!o||o.rangeCount===0||!o.isCollapsed){f();return}var t=o.getRangeAt(0),n=t.startContainer;if(n!==g.startNode){f();return}var i=t.startOffset;if(i<g.startOffset){f();return}var s=(n.nodeType===3?n.nodeValue:"")||"",l=s.substring(g.startOffset,i);if(/\s/.test(l)){f();return}g.query=l,z(l),L()}}function z(o){var t=(o||"").toLowerCase();m=h.filter(function(n){if(!t||n.title.toLowerCase().indexOf(t)!==-1||n.description&&n.description.toLowerCase().indexOf(t)!==-1)return!0;for(var i=0;i<n.keywords.length;i++)if(String(n.keywords[i]).toLowerCase().indexOf(t)!==-1)return!0;return!1}).slice(0,d.slashCommandMaxItems),p=0,ce()}function le(){v=e.iframe.ownerDocument,a=v.createElement("div"),a.className="rte-slash-popup";try{var o=e.container||e.getEditable&&e.getEditable().closest&&e.getEditable().closest(".richtexteditor");o&&o.classList&&o.classList.contains("rte-dark")&&(a.className+=" rte-slash-popup-dark")}catch{}a.setAttribute("role","listbox"),a.setAttribute("aria-label","Slash commands"),v.body.appendChild(a)}function ce(){if(a){if(a.innerHTML="",!m.length){var o=v.createElement("div");o.className="rte-slash-empty",o.textContent="No matching commands",a.appendChild(o);return}for(var t="",n=0;n<m.length;n++)(function(i,s){if(i.section!==t){var l=v.createElement("div");l.className="rte-slash-section",l.textContent=i.section,a.appendChild(l),t=i.section}var c=v.createElement("button");c.type="button",c.className="rte-slash-item"+(s===p?" rte-slash-item-active":""),c.setAttribute("role","option"),c.setAttribute("aria-selected",s===p?"true":"false"),c.setAttribute("data-index",s);var r=v.createElement("span");r.className="rte-slash-item-icon",r.innerHTML=i.iconSvg||Me(),c.appendChild(r);var u=v.createElement("span");u.className="rte-slash-item-body";var x=v.createElement("span");if(x.className="rte-slash-item-title",x.textContent=i.title,u.appendChild(x),i.description){var w=v.createElement("span");w.className="rte-slash-item-desc",w.textContent=i.description,u.appendChild(w)}c.appendChild(u),c.addEventListener("mousedown",function(k){k.preventDefault(),k.stopPropagation(),p=s,A()}),c.addEventListener("click",function(k){a&&(k.preventDefault(),k.stopPropagation(),p=s,A())}),c.addEventListener("mouseenter",function(){p!==s&&(p=s,q())}),a.appendChild(c)})(m[n],n)}}function q(){if(a){for(var o=a.querySelectorAll(".rte-slash-item"),t=0;t<o.length;t++){var n=+o[t].getAttribute("data-index"),i=n===p;o[t].classList.toggle("rte-slash-item-active",i),o[t].setAttribute("aria-selected",i?"true":"false")}de()}}function de(){if(a){var o=a.querySelector(".rte-slash-item-active");if(o){var t=o.offsetTop,n=t+o.offsetHeight;t<a.scrollTop?a.scrollTop=t:n>a.scrollTop+a.clientHeight&&(a.scrollTop=n-a.clientHeight)}}}function _(o){m.length&&(p=(p+o+m.length)%m.length,q())}function A(){if(!m.length){f();return}var o=m[p],t=g;if(f(),!(!o||!t)){ue(t);var n=e.getDocument();n.activeElement!==e.getEditable()&&!n.hasFocus()&&e.focus();try{o.run(e)}catch(i){console.warn("Slash command failed:",i)}}}function ue(o){var t=o.startNode;if(t){var n=o.startOffset-(o.triggerCharCount||0);n<0&&(n=0);var i=e.getSelection();if(!(!i||i.rangeCount===0)){var s=i.getRangeAt(0),l,c;t.nodeType===3&&s.startContainer===t?(l=t,c=s.startOffset):(l=s.startContainer,c=s.startOffset);var r=e.getDocument().createRange();r.setStart(t,n),r.setEnd(l,c);try{r.deleteContents()}catch{return}i.removeAllRanges(),i.addRange(r)}}}function L(){if(!(!a||!g)){var o=e.iframe,t=o.getBoundingClientRect(),n=g.range.getClientRects(),i=n&&n.length?n[n.length-1]:null;i||(i=g.range.getBoundingClientRect());var s=t.left+(i.left||0)+window.pageXOffset,l=t.top+(i.bottom||i.top||0)+window.pageYOffset+4;a.style.position="absolute",a.style.left=s+"px",a.style.top=l+"px";var c=window.innerHeight||document.documentElement.clientHeight,r=a.getBoundingClientRect();r.bottom>c-8&&t.top+(i.top||0)>r.height+16&&(a.style.top=t.top+(i.top||0)+window.pageYOffset-r.height-4+"px")}}function U(){a&&L()}function he(){var o=e&&e.iframe&&e.iframe.ownerDocument||document;if(!o.querySelector("style[data-rte-slashcommand]")){var t=o.createElement("style");t.setAttribute("data-rte-slashcommand","1"),t.textContent=["/* 2026-07-03 slash command polish */",".rte-slash-popup{position:absolute;z-index:2147483000;min-width:280px;max-width:min(390px,calc(100vw - 24px));max-height:min(360px,64vh);overflow-y:auto;overscroll-behavior:contain;padding:6px;background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,251,255,.96));background-clip:padding-box;border:1px solid rgba(148,163,184,.22);box-shadow:0 16px 36px rgba(29,78,216,.14),0 2px 8px rgba(15,23,42,.08);border-radius:8px;font-family:Aptos,'Segoe UI',sans-serif;font-size:13px;color:#172033;scrollbar-width:thin}",".rte-slash-section{position:sticky;top:0;z-index:1;margin:4px 0 2px;padding:6px 8px 4px;background:linear-gradient(180deg,rgba(248,251,255,.98),rgba(248,251,255,.86));color:#52657e;font-size:10px;font-weight:850;letter-spacing:.08em;text-transform:uppercase}",".rte-slash-item{display:grid;grid-template-columns:28px minmax(0,1fr);align-items:center;gap:8px;width:100%;min-height:40px;padding:6px 8px;border:0;background:transparent;text-align:left;cursor:pointer;color:inherit;font:inherit;border-radius:8px}",".rte-slash-item:hover,.rte-slash-item-active{background:#eef4ff;color:#1559d6}",".rte-slash-item:focus-visible{outline:2px solid rgba(37,99,235,.22);outline-offset:2px}",".rte-slash-item-icon{flex:0 0 28px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;color:#315277;background:#ffffff;border-radius:8px;box-shadow:inset 0 0 0 1px rgba(148,163,184,.18)}",".rte-slash-item-active .rte-slash-item-icon{color:#1559d6;background:#ffffff}",".rte-slash-item-icon svg{display:block;width:16px;height:16px;pointer-events:none}",".rte-slash-item-body{display:flex;flex-direction:column;min-width:0;flex:1}",".rte-slash-item-title{font-weight:780;font-size:13px;line-height:1.24;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".rte-slash-item-desc{font-size:11px;color:#64748b;line-height:1.24;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".rte-slash-item-active .rte-slash-item-desc{color:#315277}",".rte-slash-empty{padding:16px;color:#52657e;font-size:12px;font-weight:700;text-align:center}",".rte-slash-popup-dark{background:linear-gradient(180deg,#1e293b,#0f172a);border-color:#334155;color:#e2e8f0;box-shadow:0 20px 46px rgba(0,0,0,.5),0 2px 8px rgba(0,0,0,.4)}",".rte-slash-popup-dark .rte-slash-section{background:linear-gradient(180deg,rgba(30,41,59,.98),rgba(30,41,59,.86));color:#94a3b8}",".rte-slash-popup-dark .rte-slash-item:hover,.rte-slash-popup-dark .rte-slash-item-active{background:#1d4ed8;color:#fff}",".rte-slash-popup-dark .rte-slash-item-icon{color:#cbd5e1;background:#0f172a;box-shadow:inset 0 0 0 1px rgba(148,163,184,.25)}",".rte-slash-popup-dark .rte-slash-item-active .rte-slash-item-icon{color:#fff;background:#1e3a8a}",".rte-slash-popup-dark .rte-slash-item-desc{color:#94a3b8}",".rte-slash-popup-dark .rte-slash-item-active .rte-slash-item-desc{color:#dbeafe}",".rte-slash-popup-dark .rte-slash-empty{color:#94a3b8}"].join(`
|
|
2
|
-
`),o.head.appendChild(t),e&&typeof e.ensureStyleSheetLive=="function"&&e.ensureStyleSheetLive(o,t,"rte-slashcommand-style",t.textContent)}}function S(o){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4v16"/><path d="M14 4v16"/><path d="M6 12h8"/><text x="16" y="18" font-size="9" font-weight="700" fill="currentColor" stroke="none" font-family="-apple-system,Segoe UI,sans-serif">'+o+"</text></svg>"}function pe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 4h5"/><path d="M13 4v16"/><path d="M17 4v16"/><path d="M13 4a4 4 0 000 8h0"/></svg>'}function fe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="5" cy="7" r="1"/><circle cx="5" cy="12" r="1"/><circle cx="5" cy="17" r="1"/><path d="M9 7h11"/><path d="M9 12h11"/><path d="M9 17h11"/></svg>'}function ge(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6h1v3"/><path d="M4 9h2"/><path d="M4 14h2a1 1 0 010 2H4v1h2"/><path d="M9 7h11"/><path d="M9 12h11"/><path d="M9 17h11"/></svg>'}function me(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 8c-2 0-3 1.5-3 4s1 4 3 4V8z"/><path d="M16 8c-2 0-3 1.5-3 4s1 4 3 4V8z"/></svg>'}function ve(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 8l-4 4 4 4"/><path d="M15 8l4 4-4 4"/></svg>'}function ke(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12h16"/><path d="M4 6h10"/><path d="M4 18h10"/></svg>'}function y(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="5" width="16" height="14" rx="1"/><path d="M4 10h16"/><path d="M4 15h16"/><path d="M10 5v14"/><path d="M16 5v14"/></svg>'}function xe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><circle cx="9" cy="10" r="1.5"/><path d="M21 16l-5-5-8 8"/></svg>'}function we(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 14a4 4 0 005.7 0l3-3a4 4 0 10-5.7-5.7L11 7"/><path d="M14 10a4 4 0 00-5.7 0l-3 3a4 4 0 105.7 5.7L13 17"/></svg>'}function be(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><path d="M8 14c1 1.5 2.5 2 4 2s3-.5 4-2"/><circle cx="9" cy="10" r=".8"/><circle cx="15" cy="10" r=".8"/></svg>'}function Ce(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="4" width="16" height="16" rx="2"/><path d="M4 9h16"/><path d="M9 9v11"/></svg>'}function ye(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="6" width="16" height="14" rx="1.5"/><path d="M4 10h16"/><path d="M9 3v4"/><path d="M15 3v4"/></svg>'}function Me(){return'<svg viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="3"/></svg>'}function Te(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M12 9v4"/><path d="M12 16h.01"/></svg>'}function Ee(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="7" height="16" rx="1"/><rect x="14" y="4" width="7" height="16" rx="1"/></svg>'}function Be(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 6l6 6-6 6"/></svg>'}function Ie(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 5h9l-5 14"/><path d="M14 11h6"/><path d="M14 16h6"/></svg>'}function Ae(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 10h18"/><circle cx="7" cy="7.5" r=".6" fill="currentColor"/></svg>'}function V(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 17l4-10 4 10"/><path d="M5.5 13.5h5"/><path d="M14 14a2.5 2.5 0 105 0v-3"/><path d="M14 20l2 2 4-4"/></svg>'}function K(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="7" width="18" height="10" rx="5"/><circle cx="8" cy="12" r="1.6"/><path d="M12 12h6"/></svg>'}function Le(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M4 7l8 6 8-6"/></svg>'}function Se(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="6" height="5" rx="1"/><rect x="15" y="3" width="6" height="5" rx="1"/><rect x="9" y="16" width="6" height="5" rx="1"/><path d="M6 8v3h12V8M12 11v5"/></svg>'}function W(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 9v6h4l5 4V5L8 9H4z"/><path d="M16 8.5a4 4 0 010 7"/><path d="M19 6a7 7 0 010 12"/></svg>'}function Q(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v18"/><path d="M8 7l4-4 4 4"/><path d="M8 17l4 4 4-4"/></svg>'}function j(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6H10a3 3 0 000 6h3"/><path d="M13 6v12"/><path d="M17 6v12"/><path d="M7 18l-3-3 3-3"/></svg>'}function je(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 6H7a3 3 0 000 6h3"/><path d="M11 6v12"/><path d="M7 6v12"/><path d="M17 12l3 3-3 3"/></svg>'}function De(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 4v16"/><path d="M17 4v16"/><path d="M13 4H9a4 4 0 000 8h4"/></svg>'}function Re(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="16" rx="2"/><path d="M7 15l4-5 3 3 3-4"/></svg>'}function Pe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6h1v4"/><path d="M4 14h2l-2 3h2"/><path d="M10 7h10"/><path d="M10 12h10"/><path d="M10 17h10"/></svg>'}function D(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 4v16"/><path d="M4 8l3-4 3 4"/><path d="M14 6h6"/><path d="M14 12h5"/><path d="M14 18h3"/></svg>'}function G(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3l6 6L9 21H3v-6z"/><path d="M13 5l6 6"/></svg>'}function He(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 13a4 4 0 005.7 0l2-2a4 4 0 10-5.7-5.7l-1 1"/><path d="M13 11a4 4 0 00-5.7 0l-2 2a4 4 0 105.7 5.7l1-1"/><path d="M16 18l2 2 4-4"/></svg>'}function X(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 4H7a2 2 0 00-2 2v3a2 2 0 01-2 2 2 2 0 012 2v3a2 2 0 002 2h2"/><path d="M15 4h2a2 2 0 012 2v3a2 2 0 002 2 2 2 0 00-2 2v3a2 2 0 01-2 2h-2"/></svg>'}function Y(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7h8"/><path d="M4 12h5"/><path d="M4 17h8"/><path d="M14 12h6"/><path d="M17 9l3 3-3 3"/></svg>'}function Fe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6h7"/><path d="M4 11h9"/><path d="M4 16h5"/><path d="M17 6h3"/><path d="M17 11h3"/><path d="M17 16h3"/></svg>'}function Ne(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6h9"/><path d="M4 11h9"/><path d="M4 18h16"/><path d="M17 4v6"/><path d="M20 7h-6"/></svg>'}function Oe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 3h11a2 2 0 012 2v4a2 2 0 01-2 2H6z"/><path d="M12 11v3"/><path d="M10 14h4v5a2 2 0 01-4 0z"/></svg>'}function M(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 18L8 6l5 12"/><path d="M4.6 14.5h6.8"/><path d="M21 11.5a3 3 0 00-6 0"/><path d="M21 11.5V18"/><path d="M21 15.5a3 3 0 11-6 0 3 3 0 016 0z"/></svg>'}function ze(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="7" height="7" rx="1.5"/><path d="M4.5 7.5 6 9l2.5-3"/><line x1="13" y1="6" x2="21" y2="6"/><line x1="13" y1="13" x2="21" y2="13"/><line x1="3" y1="17" x2="21" y2="17"/><line x1="3" y1="20.5" x2="14" y2="20.5"/></svg>'}function J(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 6l3 3 3-3"/><path d="M9 18l3-3 3 3"/><line x1="4" y1="12" x2="20" y2="12"/></svg>'}function qe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="6" width="20" height="12" rx="2"/><path d="M6 10h.01M10 10h.01M14 10h.01M18 10h.01M6 14h.01M18 14h.01M9 14h6"/></svg>'}function _e(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="10.5" cy="10.5" r="6.5"/><line x1="15.5" y1="15.5" x2="21" y2="21"/></svg>'}function Ue(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="9" width="18" height="7" rx="1"/><path d="M7 9V5h10v4"/><line x1="7" y1="20" x2="17" y2="20"/></svg>'}function Ve(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M3 12h3M18 12h3M12 3v3M12 18v3"/></svg>'}function Z(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="5" width="20" height="14" rx="2"/><path d="M6 15V9l3 3 3-3v6"/><path d="M17 9v6M14.5 12.5L17 15l2.5-2.5"/></svg>'}function Ke(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 21V9a7 7 0 0114 0v12l-3-2-2 2-2-2-2 2-3-2z"/><circle cx="9.5" cy="10" r="1" fill="currentColor"/><circle cx="14.5" cy="10" r="1" fill="currentColor"/></svg>'}function We(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7a2 2 0 00-2 2v14a2 2 0 002 2h10a2 2 0 002-2V8z"/><path d="M14 3v5h5"/><path d="M9 13h6M9 17h4"/></svg>'}function $(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7a2 2 0 00-2 2v14a2 2 0 002 2h10a2 2 0 002-2V8z"/><path d="M14 3v5h5"/><path d="M8.5 12l1.3 5 2.2-3.6 2.2 3.6 1.3-5"/></svg>'}}
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_slashcommand=RTE_Plugin_SlashCommand;function RTE_Plugin_SlashCommand(){var T=this,c,e,v=null,s=null,m=null,h=[],g=[],p=0,E=!1,P=!1;T.PluginName="SlashCommand",T.InitConfig=function(o){c=o,c.slashCommandEnabled!==!1&&(c.slashCommandTrigger=c.slashCommandTrigger||"/",c.slashCommandMaxItems=c.slashCommandMaxItems||40,c.slashCommandIncludeAi=c.slashCommandIncludeAi!==!1,c.slashCommands=c.slashCommands||null)},T.InitEditor=function(o){if(e=o,c.slashCommandEnabled!==!1){if(e.slashCommands={register:H,remove:oe,list:function(){return B(),h.slice()},open:function(){_(!0)},close:f,isOpen:function(){return!!s}},h=O(),Array.isArray(c.slashCommands))for(var t=0;t<c.slashCommands.length;t++)H(c.slashCommands[t]);setTimeout(B,0),pe();var n=function(i,a,l){e.bindDocumentEvent?e.bindDocumentEvent(i,a,l):e.getDocument().addEventListener(i,a,l)};n("keydown",ie,!0),n("input",ae,!0),n("compositionstart",function(){E=!0}),n("compositionend",function(){E=!1}),n("mousedown",function(){f()},!0),n("blur",function(){setTimeout(f,150)},!0),window.addEventListener("scroll",V,!0),window.addEventListener("resize",V,!0)}};function H(o){if(!(!o||!o.id)){var t=N(o.id);t>=0?h[t]=b(o):h.push(b(o))}}var F={};function B(){if(e){for(var o=[],t=0;t<h.length;t++)h[t]._default||o.push(h[t]);for(var n=O(),i=[],a=0;a<n.length;a++){var l=n[a].id;if(!F[l]){for(var d=!1,r=0;r<o.length;r++)if(o[r].id===l){d=!0;break}d||i.push(n[a])}}h=i.concat(o)}}function oe(o){F[o]=!0;var t=N(o);t>=0&&h.splice(t,1)}function N(o){for(var t=0;t<h.length;t++)if(h[t].id===o)return t;return-1}function I(o,t){try{var n=String(o).toLowerCase().replace(/[^a-z0-9_]/g,"_");if(c&&c["text_"+n]&&e&&typeof e.getLangText=="function")return e.getLangText(n)}catch{}return t}function b(o){var t=o.section||"Blocks";return{id:o.id,section:I("slash_section_"+t,t),title:I("slash_"+o.id,o.title||o.id),description:I("slash_"+o.id+"_desc",o.description||""),keywords:(o.keywords||[]).slice(),icon:o.icon||"",iconSvg:o.iconSvg||"",run:o.run||o.action}}var ne={P:1,DIV:1,H1:1,H2:1,H3:1,H4:1,H5:1,H6:1,BLOCKQUOTE:1,PRE:1,LI:1};function re(){var o=e.getSelection();if(!o||o.rangeCount===0)return null;for(var t=o.getRangeAt(0).startContainer,n=e.getEditable();t&&t!==n;){if(t.nodeType===1&&ne[t.nodeName])return t;t=t.parentNode}return null}function C(o){var t=re();if(o=o.toUpperCase(),t&&!t.textContent.trim()){var n=e.getDocument(),i=n.createElement(o);i.appendChild(n.createElement("br")),t.parentNode.replaceChild(i,t);var a=n.createRange();a.setStart(i,0),a.setEnd(i,0);var l=e.getSelection();l.removeAllRanges(),l.addRange(a);return}e.execCommand("formatblock",o)}function O(){var o=[];function t(r,u,x,w,k,Ge,Qe){var te=b({id:u,section:r,title:x,description:w,keywords:k,iconSvg:Ge,run:Qe});te._default=!0,o.push(te)}if(t("Blocks","heading1","Heading 1","Large section heading",["h1","title"],j("1"),function(){C("H1")}),t("Blocks","heading2","Heading 2","Medium section heading",["h2","subtitle"],j("2"),function(){C("H2")}),t("Blocks","heading3","Heading 3","Small section heading",["h3"],j("3"),function(){C("H3")}),t("Blocks","paragraph","Paragraph","Plain body text",["p","text","body"],fe(),function(){C("P")}),t("Blocks","bulletlist","Bulleted list","Unordered list",["ul","bullets","list"],me(),function(){e.execCommand("insertunorderedlist")}),t("Blocks","numberlist","Numbered list","Ordered list",["ol","numbered"],ge(),function(){e.execCommand("insertorderedlist")}),t("Blocks","quote","Quote","Block quotation",["blockquote"],ve(),function(){e.execCommand("insertblockquote")}),t("Blocks","code","Code block","Monospaced code block",["pre","snippet"],ke(),function(){e.isCommandEnabled&&e.isCommandEnabled("insertcode")?e.execCommand("insertcode"):e.execCommand("formatblock","PRE")}),t("Blocks","divider","Divider","Horizontal rule",["hr","line","separator"],xe(),function(){e.execCommand("inserthorizontalrule")}),(!e.isCommandEnabled||e.isCommandEnabled("insertcallout"))&&t("Blocks","callout","Callout","Highlighted info / warning box",["admonition","info","warning","note","tip"],Te(),function(){e.execCommand("insertcallout")}),(!e.isCommandEnabled||e.isCommandEnabled("insertcolumns"))&&t("Blocks","columns","Columns","Multi-column layout",["layout","grid","column"],Ee(),function(){e.execCommand("insertcolumns")}),(!e.isCommandEnabled||e.isCommandEnabled("inserttoggle"))&&t("Blocks","toggle","Toggle list","Collapsible toggle block",["collapse","details","accordion","expand"],Be(),function(){e.execCommand("inserttoggle")}),(!e.isCommandEnabled||e.isCommandEnabled("insertmath"))&&t("Insert","equation","Equation","Insert a math equation (TeX)",["math","latex","tex","formula","katex"],Ie(),function(){e.execCommand("insertmath")}),(!e.isCommandEnabled||e.isCommandEnabled("inserttodolist"))&&t("Blocks","todolist","To-do list","Checklist with clickable checkboxes",["task","todo","checklist","checkbox","check"],_e(),function(){e.execCommand("inserttodolist")}),(!e.isCommandEnabled||e.isCommandEnabled("insertdiagram"))&&t("Insert","diagram","Diagram","Insert a Mermaid diagram",["mermaid","flowchart","sequence","gantt","graph","uml"],je(),function(){e.execCommand("insertdiagram")}),(!e.isCommandEnabled||e.isCommandEnabled("insertbookmark"))&&t("Insert","bookmark","Bookmark","Insert a link preview card",["link","url","embed","preview","card"],Ae(),function(){e.execCommand("insertbookmark")}),(!e.isCommandEnabled||e.isCommandEnabled("spellcheck"))&&t("Tools","spellcheck","Spell check","Check spelling",["spelling","grammar","proofread","typo"],W(),function(){e.execCommand("spellcheck")}),(!e.isCommandEnabled||e.isCommandEnabled("insertdatechip"))&&t("Insert","datechip","Date chip","Insert an interactive date chip",["date","calendar","chip","today"],G(),function(){e.execCommand("insertdatechip")}),(!e.isCommandEnabled||e.isCommandEnabled("insertchip"))&&t("Insert","chip","Smart chip","Insert a date / person / link chip",["chip","person","mention","link","pill"],G(),function(){e.execCommand("insertchip")}),(!e.isCommandEnabled||e.isCommandEnabled("emailexport"))&&t("Tools","emailexport","Export email HTML","Inline-styled HTML for email",["email","inline","mail","newsletter","html"],Se(),function(){e.execCommand("emailexport")}),typeof e.openFindDialog=="function"&&t("Tools","findreplace","Find & replace","Search the document and replace text",["find","replace","search","query","substitute"],qe(),function(){e.openFindDialog()}),typeof e.showShortcuts=="function"&&t("Tools","shortcuts","Keyboard shortcuts","Show the keyboard shortcut cheat sheet (Ctrl+/)",["keyboard","shortcuts","hotkeys","keys","help","cheat"],ze(),function(){e.showShortcuts()}),typeof e.foldAtCaret=="function"&&(t("Tools","foldsection","Fold section","Collapse the section under the current heading",["fold","collapse","heading","outline","section"],$(),function(){e.foldAtCaret()}),t("Tools","unfoldall","Unfold all","Expand every collapsed heading section",["unfold","expand","headings","collapse"],$(),function(){e.unfoldAll&&e.unfoldAll()})),(!e.isCommandEnabled||e.isCommandEnabled("readaloud"))&&t("Tools","readaloud","Read aloud","Speak the selection or document (text-to-speech)",["tts","speak","speech","voice","accessibility","narrate"],Q(),function(){e.execCommand("readaloud")}),typeof e.sortTableAtCaret=="function"&&(t("Tools","sorttableasc","Sort table by this column","Sort the table rows by the column the caret is in",["sort","table","column","order","ascending"],L(),function(){e.sortTableAtCaret("asc")}),t("Tools","sorttabledesc","Sort table (descending)","Sort the table rows by this column, largest first",["sort","table","column","descending","reverse"],L(),function(){e.sortTableAtCaret("desc")}),t("Tools","tablerownumbers","Number table rows","Add or remove an automatic row-numbering column",["number","rows","table","count","index"],L(),function(){e.execCommand("tablerownumbers")})),typeof e.setTableLayoutMode=="function"&&(t("Insert","layouttable","Layout table","Insert a borderless table for positioning content (role=presentation)",["layout","table","grid","email","columns","presentation"],y(),function(){e.insertLayoutTable(2,2)}),t("Tools","tablelayoutmode","Mark table as layout","This table only positions content \u2014 stop screen readers announcing it as data",["layout","table","presentation","accessibility","screen reader"],y(),function(){e.setTableLayoutMode("layout")}),t("Tools","tabledatamode","Mark table as data","This table states relationships \u2014 restore its header cells",["data","table","header","accessibility"],y(),function(){e.setTableLayoutMode("data",null,{promoteFirstRow:!0})})),typeof e.moveBlockUp=="function"&&(t("Tools","moveblockup","Move block up","Move this paragraph or block above the previous one (Alt+Shift+Up)",["move","block","up","reorder","drag"],X(),function(){e.moveBlockUp()}),t("Tools","moveblockdown","Move block down","Move this paragraph or block below the next one (Alt+Shift+Down)",["move","block","down","reorder","drag"],X(),function(){e.moveBlockDown()})),typeof e.toggleRtlUserInterface=="function"&&t("Tools","rtlui","Mirror editor for RTL","Flip the toolbar, menus and dialogs for right-to-left languages",["rtl","mirror","interface","toolbar","arabic","hebrew"],D(),function(){e.toggleRtlUserInterface()}),typeof e.setTextDirection=="function"&&(t("Tools","rtl","Right-to-left","Set this paragraph to right-to-left (Arabic, Hebrew, Persian)",["rtl","arabic","hebrew","persian","urdu","direction","bidi"],D(),function(){e.setTextDirection("rtl")}),t("Tools","ltr","Left-to-right","Set this paragraph to left-to-right",["ltr","direction","bidi"],De(),function(){e.setTextDirection("ltr")}),t("Tools","autodir","Detect text direction","Set each paragraph's direction from its own content",["direction","detect","auto","rtl","bidi"],D(),function(){e.autoDetectTextDirection()})),typeof e.toggleFormattingMarks=="function"&&t("Tools","formattingmarks","Formatting marks","Show paragraph marks, block outlines and invisible characters",["marks","pilcrow","paragraph","invisible","whitespace","nbsp"],Le(),function(){e.toggleFormattingMarks()}),typeof e.toggleWatermark=="function"&&t("Tools","watermark","Watermark","Draw DRAFT or CONFIDENTIAL behind the content",["watermark","draft","confidential","background","stamp"],Re(),function(){e.toggleWatermark()}),typeof e.toggleLineNumbers=="function"&&t("Tools","linenumbers","Line numbers","Number every line in the margin, as pleadings and transcripts require",["line","numbers","margin","pleading","legal","transcript"],Pe(),function(){e.toggleLineNumbers()}),typeof e.togglePermanentPen=="function"&&t("Tools","permanentpen","Permanent pen","Keep typing in a fixed annotation format until switched off",["pen","marker","annotate","highlight","review"],Y(),function(){e.togglePermanentPen()}),typeof e.checkLinks=="function"&&t("Tools","checklinks","Check links","Find broken anchors, unsafe schemes and unlabelled links",["link","check","broken","audit","url","accessibility"],He(),function(){e.highlightLinkIssues(!0),e.checkLinks()}),typeof e.getMergeFieldDefinitions=="function"){for(var n=e.getMergeFieldDefinitions(),i=0;i<n.length;i++)(function(r){!r||!r.id||t("Insert","mergefield-"+r.id,r.label||r.id,"Insert the "+(r.label||r.id)+" merge field",["merge","field","placeholder","variable","mail merge",r.id],J(),function(){e.insertMergeField(r.id)})})(n[i]);t("Tools","mergepreview","Preview merge fields","Swap merge-field placeholders for sample data",["merge","preview","sample","data","placeholder"],J(),function(){e.toggleMergeFieldPreview()})}if(typeof e.listCrossReferenceTargets=="function"){var a=[];try{a=e.listCrossReferenceTargets()}catch{a=[]}for(var l=0;l<a.length&&l<40;l++)(function(r){if(!(!r||!r.id)){var u=r.number?r.number+" "+r.label:r.label;t("Insert","xref-"+r.id,"Reference: "+u,"Insert a cross-reference to this "+r.type+" that updates itself",["cross","reference","xref","see","refer",r.type,r.number||""],Z(),function(){e.insertCrossReference(r.id,r.number?"label":"text")})}})(a[l])}if(typeof e.insertTableOfContents=="function"&&t("Insert","toc","Table of contents","Insert a contents block that updates itself from your headings",["toc","contents","outline","index","headings"],Fe(),function(){e.insertTableOfContents()}),typeof e.insertFootnote=="function"&&t("Insert","footnote","Footnote","Insert a numbered footnote reference and note",["footnote","note","citation","reference","endnote","cite"],Ne(),function(){e.insertFootnote()}),typeof e.toggleFormatPainter=="function"&&t("Tools","formatpainter","Format painter","Copy formatting here, then select the text to paint it onto",["format","painter","brush","copy","style","clone"],Oe(),function(){e.toggleFormatPainter()}),typeof e.changeCase=="function"&&(t("Tools","caseupper","UPPERCASE","Convert the selection to upper case",["case","upper","caps","capitals"],M(),function(){e.changeCase("upper")}),t("Tools","caselower","lowercase","Convert the selection to lower case",["case","lower","small"],M(),function(){e.changeCase("lower")}),t("Tools","casetitle","Title Case","Capitalise each significant word in the selection",["case","title","headline","capitalise","capitalize"],M(),function(){e.changeCase("title")}),t("Tools","casesentence","Sentence case","Capitalise the first letter of each sentence",["case","sentence","capitalise","capitalize"],M(),function(){e.changeCase("sentence")})),typeof e.requestGhostText=="function"&&t("Tools","aicomplete","AI complete","Suggest an inline AI completion of the current sentence",["ai","complete","autocomplete","ghost","suggest","continue","copilot"],Ke(),function(){e.requestGhostText()}),typeof e.exportToPdf=="function"&&t("Tools","exportpdf","Export to PDF","Real text, not a screenshot \u2014 selectable, searchable and screen-reader friendly",["pdf","export","download","save","print","text","accessible","searchable"],We(),function(){e.exportToPdf()}),typeof e.exportToDocx=="function"&&t("Tools","exportdocx","Export to Word (.docx)","A real OOXML document, built in the browser with no upload",["word","docx","ooxml","export","download","save","office"],ee(),function(){e.exportToDocx()}),typeof e.openImportDialog=="function"&&t("Tools","import-document","Import document","Open a Markdown, HTML, text, or Word file into the editor",["import","open","file","word","docx","markdown","upload"],ee(),function(){e.openImportDialog({})}),typeof e.getReadabilityStats=="function"&&t("Tools","readability-stats","Readability statistics","Flesch reading ease, grade level, and reading time",["readability","flesch","grade","reading","stats","score"],W(),function(){e.execCommand("readability")}),typeof e.insertCrossReference=="function"&&t("Insert","crossreference","Cross-reference","Insert a live reference to a heading, figure, table, or bookmark",["cross","reference","xref","see","figure","heading"],Z(),function(){e.execCommand("insertcrossreference")}),e.restrictedEditing&&t("Tools","restrictedediting","Restricted editing","Lock the document and mark only the regions others may edit",["restrict","lock","protect","editable","region","permission"],Y(),function(){e.execCommand("restrictedediting")}),e.dictation&&t("Tools","dictation","Dictation","Speak and have your words typed into the document",["dictate","speech","voice","microphone","talk"],Q(),function(){e.execCommand("dictation")}),typeof e.copyAsMarkdown=="function"&&(t("Tools","copymarkdown","Copy as Markdown","Copy the whole document to the clipboard as Markdown",["markdown","md","copy","clipboard","export"],R(),function(){e.copyAsMarkdown()}),t("Tools","downloadmarkdown","Download as Markdown","Save the document as a .md file",["markdown","md","download","export","save","file"],R(),function(){e.downloadMarkdown()}),t("Tools","markdownmode","Edit as Markdown","Show the document as Markdown text, and back to the visual view",["markdown","md","source","text","edit","mode"],R(),function(){e.toggleMarkdownMode()})),typeof e.toggleTypewriterMode=="function"&&(t("Tools","typewriter","Typewriter mode","Keep the caret line centred as you type",["typewriter","center","scroll","focus","distraction","zen"],Ue(),function(){e.toggleTypewriterMode()}),t("Tools","focusmode","Focus mode","Dim everything except the current paragraph",["focus","dim","highlight","distraction","zen","concentrate"],Ve(),function(){e.toggleFocusMode()})),t("Insert","table","Table","Insert a table",["grid","rows","columns"],y(),function(){e.execCommand("inserttable")}),t("Insert","image","Image","Upload or embed an image",["picture","photo","img"],K(),function(){e.execCommand("imageupload")}),typeof e.openImageGenerator=="function"&&t("Insert","generate-image","Generate image","Describe an image and insert it (your own image provider)",["picture","generate","ai","draw","image","create"],K(),function(){e.openImageGenerator()}),t("Insert","link","Link","Insert a hyperlink",["url","anchor"],we(),function(){e.execCommand("insertlink")}),t("Insert","emoji","Emoji","Insert an emoji",["smiley","icon"],be(),function(){e.execCommand("insertemoji")}),t("Insert","template","Template","Insert from template gallery",["snippet"],Ce(),function(){e.execCommand("inserttemplate")}),t("Insert","date","Today's date","Insert the current date",["time","now"],ye(),function(){e.execCommand("insertdate")}),c.slashCommandIncludeAi&&Array.isArray(c.aiToolkitActions))for(var d=0;d<c.aiToolkitActions.length;d++)(function(r){o.push(b({id:"ai-"+r.id,section:"AI",title:r.title||r.id,description:r.description||"",keywords:["ai",r.id],iconSvg:c["svgCode_aiassist_"+(r.icon||r.id)]||c.svgCode_aiassist||"",run:function(){var u=e.aiToolkit;if(u){if(r.id==="chat-panel"&&typeof u.openChatPanel=="function"){u.openChatPanel();return}if(r.id==="review-panel"&&typeof u.openReviewPanel=="function"){u.openReviewPanel();return}if(r.id==="open-dialog"&&typeof u.openDialog=="function"){u.openDialog();return}if(typeof u.runQuickAction=="function"){u.runQuickAction(r.id);return}typeof u.resolveAction=="function"&&u.resolveAction(r.id)}}}))})(c.aiToolkitActions[d]);return o}function ie(o){if(!E){if(s)switch(o.key){case"ArrowDown":o.preventDefault(),o.stopPropagation(),U(1);return;case"ArrowUp":o.preventDefault(),o.stopPropagation(),U(-1);return;case"Enter":case"Tab":if(g.length){o.preventDefault(),o.stopPropagation(),A();return}f();return;case"Escape":case"Esc":o.preventDefault(),o.stopPropagation(),f();return}if(o.key===c.slashCommandTrigger&&!o.ctrlKey&&!o.metaKey&&!o.altKey){if(!se())return;P=!1,setTimeout(function(){P||_(!1)},0)}}}function ae(){s&&le()}function se(){var o=e.getSelection();if(!o||o.rangeCount===0||!o.isCollapsed)return!1;for(var t=o.getRangeAt(0),n=t.startContainer,i=t.startOffset,a=e.getEditable(),l=n.nodeType===1?n:n.parentNode;l&&l!==a;){var d=l.nodeName;if(d==="CODE"||d==="PRE")return!1;l=l.parentNode}if(n.nodeType===3){if(i===0)return!0;var r=n.nodeValue.charAt(i-1);return/\s/.test(r)}return!0}function _(o){B(),f();var t=e.getSelection();if(!(!t||t.rangeCount===0)){var n=t.getRangeAt(0).cloneRange();m={range:n,startNode:n.startContainer,startOffset:n.startOffset,triggerCharCount:o?0:1,query:""},ce(),S(),z("")}}function f(){s&&s.parentNode&&s.parentNode.removeChild(s),s=null,m=null,g=[],p=0}function le(){if(m){var o=e.getSelection();if(!o||o.rangeCount===0||!o.isCollapsed){f();return}var t=o.getRangeAt(0),n=t.startContainer;if(n!==m.startNode){f();return}var i=t.startOffset;if(i<m.startOffset){f();return}var a=(n.nodeType===3?n.nodeValue:"")||"",l=a.substring(m.startOffset,i);if(/\s/.test(l)){f();return}m.query=l,z(l),S()}}function z(o){var t=(o||"").toLowerCase();g=h.filter(function(n){if(!t||n.title.toLowerCase().indexOf(t)!==-1||n.description&&n.description.toLowerCase().indexOf(t)!==-1)return!0;for(var i=0;i<n.keywords.length;i++)if(String(n.keywords[i]).toLowerCase().indexOf(t)!==-1)return!0;return!1}).slice(0,c.slashCommandMaxItems),p=0,de()}function ce(){v=e.iframe.ownerDocument,s=v.createElement("div"),s.className="rte-slash-popup";try{var o=e.container||e.getEditable&&e.getEditable().closest&&e.getEditable().closest(".richtexteditor");o&&o.classList&&o.classList.contains("rte-dark")&&(s.className+=" rte-slash-popup-dark")}catch{}s.setAttribute("role","listbox"),s.setAttribute("aria-label",c&&c.text_slash_aria||"Slash commands"),v.body.appendChild(s)}function de(){if(s){if(s.innerHTML=__RTE_TT(""),!g.length){var o=v.createElement("div");o.className="rte-slash-empty",o.textContent=c&&c.text_slash_none||"No matching commands",s.appendChild(o);return}for(var t="",n=0;n<g.length;n++)(function(i,a){if(i.section!==t){var l=v.createElement("div");l.className="rte-slash-section",l.textContent=i.section,s.appendChild(l),t=i.section}var d=v.createElement("button");d.type="button",d.className="rte-slash-item"+(a===p?" rte-slash-item-active":""),d.setAttribute("role","option"),d.setAttribute("aria-selected",a===p?"true":"false"),d.setAttribute("data-index",a);var r=v.createElement("span");r.className="rte-slash-item-icon",r.innerHTML=__RTE_TT(i.iconSvg||Me()),d.appendChild(r);var u=v.createElement("span");u.className="rte-slash-item-body";var x=v.createElement("span");if(x.className="rte-slash-item-title",x.textContent=i.title,u.appendChild(x),i.description){var w=v.createElement("span");w.className="rte-slash-item-desc",w.textContent=i.description,u.appendChild(w)}d.appendChild(u),d.addEventListener("mousedown",function(k){k.preventDefault(),k.stopPropagation(),p=a,A()}),d.addEventListener("click",function(k){s&&(k.preventDefault(),k.stopPropagation(),p=a,A())}),d.addEventListener("mouseenter",function(){p!==a&&(p=a,q())}),s.appendChild(d)})(g[n],n)}}function q(){if(s){for(var o=s.querySelectorAll(".rte-slash-item"),t=0;t<o.length;t++){var n=+o[t].getAttribute("data-index"),i=n===p;o[t].classList.toggle("rte-slash-item-active",i),o[t].setAttribute("aria-selected",i?"true":"false")}ue()}}function ue(){if(s){var o=s.querySelector(".rte-slash-item-active");if(o){var t=o.offsetTop,n=t+o.offsetHeight;t<s.scrollTop?s.scrollTop=t:n>s.scrollTop+s.clientHeight&&(s.scrollTop=n-s.clientHeight)}}}function U(o){g.length&&(p=(p+o+g.length)%g.length,q())}function A(){if(!g.length){f();return}var o=g[p],t=m;if(f(),!(!o||!t)){he(t);var n=e.getDocument();n.activeElement!==e.getEditable()&&!n.hasFocus()&&e.focus();try{o.run(e)}catch(i){console.warn("Slash command failed:",i)}}}function he(o){var t=o.startNode;if(t){var n=o.startOffset-(o.triggerCharCount||0);n<0&&(n=0);var i=e.getSelection();if(!(!i||i.rangeCount===0)){var a=i.getRangeAt(0),l,d;t.nodeType===3&&a.startContainer===t?(l=t,d=a.startOffset):(l=a.startContainer,d=a.startOffset);var r=e.getDocument().createRange();r.setStart(t,n),r.setEnd(l,d);try{r.deleteContents()}catch{return}i.removeAllRanges(),i.addRange(r)}}}function S(){if(!(!s||!m)){var o=e.iframe,t=o.getBoundingClientRect(),n=m.range.getClientRects(),i=n&&n.length?n[n.length-1]:null;i||(i=m.range.getBoundingClientRect());var a=o.offsetWidth&&t.width>0?t.width/o.offsetWidth:1,l=t.left+(i.left||0)*a+window.pageXOffset,d=t.top+(i.bottom||i.top||0)*a+window.pageYOffset+4;s.style.position="absolute",s.style.left=l+"px",s.style.top=d+"px";var r=window.innerHeight||document.documentElement.clientHeight,u=s.getBoundingClientRect();u.bottom>r-8&&t.top+(i.top||0)*a>u.height+16&&(s.style.top=t.top+(i.top||0)*a+window.pageYOffset-u.height-4+"px")}}function V(){s&&S()}function pe(){var o=e&&e.iframe&&e.iframe.ownerDocument||document;if(!o.querySelector("style[data-rte-slashcommand]")){var t=o.createElement("style");t.setAttribute("data-rte-slashcommand","1"),t.textContent=["/* 2026-07-03 slash command polish */",".rte-slash-popup{position:absolute;z-index:2147483000;min-width:280px;max-width:min(390px,calc(100vw - 24px));max-height:min(360px,64vh);overflow-y:auto;overscroll-behavior:contain;padding:6px;background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,251,255,.96));background-clip:padding-box;border:1px solid rgba(148,163,184,.22);box-shadow:0 16px 36px rgba(29,78,216,.14),0 2px 8px rgba(15,23,42,.08);border-radius:8px;font-family:Aptos,'Segoe UI',sans-serif;font-size:13px;color:#172033;scrollbar-width:thin}",".rte-slash-section{position:sticky;top:0;z-index:1;margin:4px 0 2px;padding:6px 8px 4px;background:linear-gradient(180deg,rgba(248,251,255,.98),rgba(248,251,255,.86));color:#52657e;font-size:10px;font-weight:850;letter-spacing:.08em;text-transform:uppercase}",".rte-slash-item{display:grid;grid-template-columns:28px minmax(0,1fr);align-items:center;gap:8px;width:100%;min-height:40px;padding:6px 8px;border:0;background:transparent;text-align:left;cursor:pointer;color:inherit;font:inherit;border-radius:8px}",".rte-slash-item:hover,.rte-slash-item-active{background:#eef4ff;color:#1559d6}",".rte-slash-item:focus-visible{outline:2px solid rgba(37,99,235,.22);outline-offset:2px}",".rte-slash-item-icon{flex:0 0 28px;width:28px;height:28px;display:inline-flex;align-items:center;justify-content:center;color:#315277;background:#ffffff;border-radius:8px;box-shadow:inset 0 0 0 1px rgba(148,163,184,.18)}",".rte-slash-item-active .rte-slash-item-icon{color:#1559d6;background:#ffffff}",".rte-slash-item-icon svg{display:block;width:16px;height:16px;pointer-events:none}",".rte-slash-item-body{display:flex;flex-direction:column;min-width:0;flex:1}",".rte-slash-item-title{font-weight:780;font-size:13px;line-height:1.24;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".rte-slash-item-desc{font-size:11px;color:#64748b;line-height:1.24;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}",".rte-slash-item-active .rte-slash-item-desc{color:#315277}",".rte-slash-empty{padding:16px;color:#52657e;font-size:12px;font-weight:700;text-align:center}",".rte-slash-popup-dark{background:linear-gradient(180deg,#1e293b,#0f172a);border-color:#334155;color:#e2e8f0;box-shadow:0 20px 46px rgba(0,0,0,.5),0 2px 8px rgba(0,0,0,.4)}",".rte-slash-popup-dark .rte-slash-section{background:linear-gradient(180deg,rgba(30,41,59,.98),rgba(30,41,59,.86));color:#94a3b8}",".rte-slash-popup-dark .rte-slash-item:hover,.rte-slash-popup-dark .rte-slash-item-active{background:#1d4ed8;color:#fff}",".rte-slash-popup-dark .rte-slash-item-icon{color:#cbd5e1;background:#0f172a;box-shadow:inset 0 0 0 1px rgba(148,163,184,.25)}",".rte-slash-popup-dark .rte-slash-item-active .rte-slash-item-icon{color:#fff;background:#1e3a8a}",".rte-slash-popup-dark .rte-slash-item-desc{color:#94a3b8}",".rte-slash-popup-dark .rte-slash-item-active .rte-slash-item-desc{color:#dbeafe}",".rte-slash-popup-dark .rte-slash-empty{color:#94a3b8}"].join(`
|
|
2
|
+
`),o.head.appendChild(t),e&&typeof e.ensureStyleSheetLive=="function"&&e.ensureStyleSheetLive(o,t,"rte-slashcommand-style",t.textContent)}}function j(o){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4v16"/><path d="M14 4v16"/><path d="M6 12h8"/><text x="16" y="18" font-size="9" font-weight="700" fill="currentColor" stroke="none" font-family="-apple-system,Segoe UI,sans-serif">'+o+"</text></svg>"}function fe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 4h5"/><path d="M13 4v16"/><path d="M17 4v16"/><path d="M13 4a4 4 0 000 8h0"/></svg>'}function me(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="5" cy="7" r="1"/><circle cx="5" cy="12" r="1"/><circle cx="5" cy="17" r="1"/><path d="M9 7h11"/><path d="M9 12h11"/><path d="M9 17h11"/></svg>'}function ge(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6h1v3"/><path d="M4 9h2"/><path d="M4 14h2a1 1 0 010 2H4v1h2"/><path d="M9 7h11"/><path d="M9 12h11"/><path d="M9 17h11"/></svg>'}function ve(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 8c-2 0-3 1.5-3 4s1 4 3 4V8z"/><path d="M16 8c-2 0-3 1.5-3 4s1 4 3 4V8z"/></svg>'}function ke(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 8l-4 4 4 4"/><path d="M15 8l4 4-4 4"/></svg>'}function xe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 12h16"/><path d="M4 6h10"/><path d="M4 18h10"/></svg>'}function y(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="5" width="16" height="14" rx="1"/><path d="M4 10h16"/><path d="M4 15h16"/><path d="M10 5v14"/><path d="M16 5v14"/></svg>'}function K(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><circle cx="9" cy="10" r="1.5"/><path d="M21 16l-5-5-8 8"/></svg>'}function we(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10 14a4 4 0 005.7 0l3-3a4 4 0 10-5.7-5.7L11 7"/><path d="M14 10a4 4 0 00-5.7 0l-3 3a4 4 0 105.7 5.7L13 17"/></svg>'}function be(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="9"/><path d="M8 14c1 1.5 2.5 2 4 2s3-.5 4-2"/><circle cx="9" cy="10" r=".8"/><circle cx="15" cy="10" r=".8"/></svg>'}function Ce(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="4" width="16" height="16" rx="2"/><path d="M4 9h16"/><path d="M9 9v11"/></svg>'}function ye(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="6" width="16" height="14" rx="1.5"/><path d="M4 10h16"/><path d="M9 3v4"/><path d="M15 3v4"/></svg>'}function Me(){return'<svg viewBox="0 0 24 24" fill="currentColor"><circle cx="12" cy="12" r="3"/></svg>'}function Te(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M12 9v4"/><path d="M12 16h.01"/></svg>'}function Ee(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="7" height="16" rx="1"/><rect x="14" y="4" width="7" height="16" rx="1"/></svg>'}function Be(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 6l6 6-6 6"/></svg>'}function Ie(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 5h9l-5 14"/><path d="M14 11h6"/><path d="M14 16h6"/></svg>'}function Ae(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 10h18"/><circle cx="7" cy="7.5" r=".6" fill="currentColor"/></svg>'}function W(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 17l4-10 4 10"/><path d="M5.5 13.5h5"/><path d="M14 14a2.5 2.5 0 105 0v-3"/><path d="M14 20l2 2 4-4"/></svg>'}function G(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="7" width="18" height="10" rx="5"/><circle cx="8" cy="12" r="1.6"/><path d="M12 12h6"/></svg>'}function Se(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2"/><path d="M4 7l8 6 8-6"/></svg>'}function je(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="3" width="6" height="5" rx="1"/><rect x="15" y="3" width="6" height="5" rx="1"/><rect x="9" y="16" width="6" height="5" rx="1"/><path d="M6 8v3h12V8M12 11v5"/></svg>'}function Q(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 9v6h4l5 4V5L8 9H4z"/><path d="M16 8.5a4 4 0 010 7"/><path d="M19 6a7 7 0 010 12"/></svg>'}function X(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3v18"/><path d="M8 7l4-4 4 4"/><path d="M8 17l4 4 4-4"/></svg>'}function D(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6H10a3 3 0 000 6h3"/><path d="M13 6v12"/><path d="M17 6v12"/><path d="M7 18l-3-3 3-3"/></svg>'}function De(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 6H7a3 3 0 000 6h3"/><path d="M11 6v12"/><path d="M7 6v12"/><path d="M17 12l3 3-3 3"/></svg>'}function Le(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 4v16"/><path d="M17 4v16"/><path d="M13 4H9a4 4 0 000 8h4"/></svg>'}function Re(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="16" rx="2"/><path d="M7 15l4-5 3 3 3-4"/></svg>'}function Pe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6h1v4"/><path d="M4 14h2l-2 3h2"/><path d="M10 7h10"/><path d="M10 12h10"/><path d="M10 17h10"/></svg>'}function L(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 4v16"/><path d="M4 8l3-4 3 4"/><path d="M14 6h6"/><path d="M14 12h5"/><path d="M14 18h3"/></svg>'}function Y(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M15 3l6 6L9 21H3v-6z"/><path d="M13 5l6 6"/></svg>'}function He(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 13a4 4 0 005.7 0l2-2a4 4 0 10-5.7-5.7l-1 1"/><path d="M13 11a4 4 0 00-5.7 0l-2 2a4 4 0 105.7 5.7l1-1"/><path d="M16 18l2 2 4-4"/></svg>'}function J(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 4H7a2 2 0 00-2 2v3a2 2 0 01-2 2 2 2 0 012 2v3a2 2 0 002 2h2"/><path d="M15 4h2a2 2 0 012 2v3a2 2 0 002 2 2 2 0 00-2 2v3a2 2 0 01-2 2h-2"/></svg>'}function Z(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7h8"/><path d="M4 12h5"/><path d="M4 17h8"/><path d="M14 12h6"/><path d="M17 9l3 3-3 3"/></svg>'}function Fe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6h7"/><path d="M4 11h9"/><path d="M4 16h5"/><path d="M17 6h3"/><path d="M17 11h3"/><path d="M17 16h3"/></svg>'}function Ne(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M4 6h9"/><path d="M4 11h9"/><path d="M4 18h16"/><path d="M17 4v6"/><path d="M20 7h-6"/></svg>'}function Oe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 3h11a2 2 0 012 2v4a2 2 0 01-2 2H6z"/><path d="M12 11v3"/><path d="M10 14h4v5a2 2 0 01-4 0z"/></svg>'}function M(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 18L8 6l5 12"/><path d="M4.6 14.5h6.8"/><path d="M21 11.5a3 3 0 00-6 0"/><path d="M21 11.5V18"/><path d="M21 15.5a3 3 0 11-6 0 3 3 0 016 0z"/></svg>'}function _e(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="7" height="7" rx="1.5"/><path d="M4.5 7.5 6 9l2.5-3"/><line x1="13" y1="6" x2="21" y2="6"/><line x1="13" y1="13" x2="21" y2="13"/><line x1="3" y1="17" x2="21" y2="17"/><line x1="3" y1="20.5" x2="14" y2="20.5"/></svg>'}function $(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 6l3 3 3-3"/><path d="M9 18l3-3 3 3"/><line x1="4" y1="12" x2="20" y2="12"/></svg>'}function ze(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="6" width="20" height="12" rx="2"/><path d="M6 10h.01M10 10h.01M14 10h.01M18 10h.01M6 14h.01M18 14h.01M9 14h6"/></svg>'}function qe(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="10.5" cy="10.5" r="6.5"/><line x1="15.5" y1="15.5" x2="21" y2="21"/></svg>'}function Ue(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="9" width="18" height="7" rx="1"/><path d="M7 9V5h10v4"/><line x1="7" y1="20" x2="17" y2="20"/></svg>'}function Ve(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M3 12h3M18 12h3M12 3v3M12 18v3"/></svg>'}function R(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="5" width="20" height="14" rx="2"/><path d="M6 15V9l3 3 3-3v6"/><path d="M17 9v6M14.5 12.5L17 15l2.5-2.5"/></svg>'}function Ke(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 21V9a7 7 0 0114 0v12l-3-2-2 2-2-2-2 2-3-2z"/><circle cx="9.5" cy="10" r="1" fill="currentColor"/><circle cx="14.5" cy="10" r="1" fill="currentColor"/></svg>'}function We(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7a2 2 0 00-2 2v14a2 2 0 002 2h10a2 2 0 002-2V8z"/><path d="M14 3v5h5"/><path d="M9 13h6M9 17h4"/></svg>'}function ee(){return'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3H7a2 2 0 00-2 2v14a2 2 0 002 2h10a2 2 0 002-2V8z"/><path d="M14 3v5h5"/><path d="M8.5 12l1.3 5 2.2-3.6 2.2 3.6 1.3-5"/></svg>'}}
|
|
@@ -23,6 +23,14 @@ function RTE_Plugin_SmartChips() {
|
|
|
23
23
|
obj.PluginName = "SmartChips";
|
|
24
24
|
|
|
25
25
|
obj.InitConfig = function (argconfig) { config = argconfig; };
|
|
26
|
+
// 2026-10-18 the dialogs' words read config.text_ keys (language packs), English as the fallback; {0} / {1} fill a
|
|
27
|
+
// template. The chip's own date text is document content and keeps its format.
|
|
28
|
+
// tools/i18n/smart-chips-language.mjs
|
|
29
|
+
function chText(key, fallback) {
|
|
30
|
+
var s = (config && config["text_" + key]) || fallback;
|
|
31
|
+
for (var i = 2; i < arguments.length; i++) s = s.split("{" + (i - 2) + "}").join(String(arguments[i]));
|
|
32
|
+
return s;
|
|
33
|
+
}
|
|
26
34
|
|
|
27
35
|
obj.InitEditor = function (argeditor) {
|
|
28
36
|
editor = argeditor;
|
|
@@ -47,6 +55,12 @@ function RTE_Plugin_SmartChips() {
|
|
|
47
55
|
if (config.chipDateFormat && typeof config.chipDateFormat === "function") {
|
|
48
56
|
try { return String(config.chipDateFormat(d)); } catch (e) { /* fall through */ }
|
|
49
57
|
}
|
|
58
|
+
// 2026-10-18 with a language pack the date is written in its locale (2026年10月18日, 18.10.2026); an English
|
|
59
|
+
// page keeps "Oct 18, 2026". tools/i18n/date-chip-locale.mjs
|
|
60
|
+
var locale = config && config.text_uilocale;
|
|
61
|
+
if (locale && !/^en(-|$)/i.test(locale) && typeof Intl !== "undefined" && Intl.DateTimeFormat) {
|
|
62
|
+
try { return new Intl.DateTimeFormat(locale, { year: "numeric", month: "short", day: "numeric" }).format(d); } catch (e) { /* English */ }
|
|
63
|
+
}
|
|
50
64
|
return MONTHS[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
|
|
51
65
|
}
|
|
52
66
|
function isoDate(d) {
|
|
@@ -74,7 +88,7 @@ function RTE_Plugin_SmartChips() {
|
|
|
74
88
|
function insertChip(type, label, value, href) {
|
|
75
89
|
injectStyles();
|
|
76
90
|
// trailing zero-width space so the caret lands after the atomic pill
|
|
77
|
-
editor.insertHTML(chipHtml(type, label, value, href) + "
|
|
91
|
+
editor.insertHTML(chipHtml(type, label, value, href) + "\u200b");
|
|
78
92
|
editor.focus();
|
|
79
93
|
}
|
|
80
94
|
|
|
@@ -84,11 +98,11 @@ function RTE_Plugin_SmartChips() {
|
|
|
84
98
|
var dlg = editor.createDialog((editor.getLangText && editor.getLangText("insertdatechiptitle")) || "Date", "rte-dialog-datechip");
|
|
85
99
|
var close = typeof dlg.close === "function" ? function () { dlg.close(); } : function () { editor.closeCurrentPopup(); };
|
|
86
100
|
var wrap = append(dlg, "div", "", "rte-chip-dialog rte-chip-date-dialog");
|
|
87
|
-
append(wrap, "div", "", "rte-chip-dialog-copy").textContent = "Choose a quick date or insert a custom date chip.";
|
|
101
|
+
append(wrap, "div", "", "rte-chip-dialog-copy").textContent = chText("ch_datecopy", "Choose a quick date or insert a custom date chip.");
|
|
88
102
|
|
|
89
103
|
function quick(label, d) {
|
|
90
104
|
var b = append(wrap, "button", "", "rte-chip-quick");
|
|
91
|
-
b.type = "button"; b.textContent = label + "
|
|
105
|
+
b.type = "button"; b.textContent = label + " \u2014 " + fmtDate(d);
|
|
92
106
|
b.onmouseover = function () { b.style.background = "#eef2ff"; };
|
|
93
107
|
b.onmouseout = function () { b.style.background = "transparent"; };
|
|
94
108
|
b.textContent = "";
|
|
@@ -96,23 +110,23 @@ function RTE_Plugin_SmartChips() {
|
|
|
96
110
|
append(b, "span", "", "rte-chip-quick-value").textContent = fmtDate(d);
|
|
97
111
|
b.onmouseover = null;
|
|
98
112
|
b.onmouseout = null;
|
|
99
|
-
b.setAttribute("aria-label", "
|
|
113
|
+
b.setAttribute("aria-label", chText("ch_insertlabel", "Insert {0}, {1}", label, fmtDate(d)));
|
|
100
114
|
b.onclick = function () { close(); insertChip("date", fmtDate(d), isoDate(d)); };
|
|
101
115
|
return b;
|
|
102
116
|
}
|
|
103
117
|
var now = new Date(editor.__chipNow || Date.now());
|
|
104
118
|
function addDays(base, n) { var x = new Date(base.getTime()); x.setDate(x.getDate() + n); return x; }
|
|
105
|
-
quick("Today", now);
|
|
106
|
-
quick("Tomorrow", addDays(now, 1));
|
|
107
|
-
quick("Yesterday", addDays(now, -1));
|
|
108
|
-
quick("Next week", addDays(now, 7));
|
|
119
|
+
quick(chText("ch_today", "Today"), now);
|
|
120
|
+
quick(chText("ch_tomorrow", "Tomorrow"), addDays(now, 1));
|
|
121
|
+
quick(chText("ch_yesterday", "Yesterday"), addDays(now, -1));
|
|
122
|
+
quick(chText("ch_nextweek", "Next week"), addDays(now, 7));
|
|
109
123
|
|
|
110
124
|
var pickRow = append(wrap, "div", "", "rte-chip-pick-row");
|
|
111
125
|
var di = append(pickRow, "input", "", "rte-chip-input");
|
|
112
126
|
di.type = "date"; di.value = isoDate(now);
|
|
113
|
-
di.setAttribute("aria-label", "Custom date");
|
|
127
|
+
di.setAttribute("aria-label", chText("ch_customdate", "Custom date"));
|
|
114
128
|
var go = append(pickRow, "button", "", "rte-chip-action rte-chip-action-primary");
|
|
115
|
-
go.type = "button"; go.textContent = "Insert";
|
|
129
|
+
go.type = "button"; go.textContent = chText("insert", "Insert");
|
|
116
130
|
go.onclick = function () {
|
|
117
131
|
var parts = (di.value || "").split("-");
|
|
118
132
|
if (parts.length === 3) {
|
|
@@ -129,12 +143,12 @@ function RTE_Plugin_SmartChips() {
|
|
|
129
143
|
var dlg = editor.createDialog((editor.getLangText && editor.getLangText("insertchiptitle")) || "Insert chip", "rte-dialog-chip");
|
|
130
144
|
var close = typeof dlg.close === "function" ? function () { dlg.close(); } : function () { editor.closeCurrentPopup(); };
|
|
131
145
|
var wrap = append(dlg, "div", "", "rte-chip-dialog rte-chip-menu-dialog");
|
|
132
|
-
append(wrap, "div", "", "rte-chip-dialog-copy").textContent = "Insert a date, person, or link chip into the document.";
|
|
146
|
+
append(wrap, "div", "", "rte-chip-dialog-copy").textContent = chText("ch_chipcopy", "Insert a date, person, or link chip into the document.");
|
|
133
147
|
|
|
134
148
|
var typeRow = append(wrap, "div", "", "rte-chip-type-tabs");
|
|
135
149
|
typeRow.setAttribute("role", "tablist");
|
|
136
|
-
typeRow.setAttribute("aria-label", "Chip type");
|
|
137
|
-
var types = [["date", "Date"], ["person", "Person"], ["link", "Link"]];
|
|
150
|
+
typeRow.setAttribute("aria-label", chText("ch_chiptype", "Chip type"));
|
|
151
|
+
var types = [["date", chText("ch_date", "Date")], ["person", chText("ch_person", "Person")], ["link", chText("link", "Link")]];
|
|
138
152
|
var current = "date";
|
|
139
153
|
var body = append(wrap, "div", "", "rte-chip-dialog-body");
|
|
140
154
|
var typeButtons = {};
|
|
@@ -155,37 +169,37 @@ function RTE_Plugin_SmartChips() {
|
|
|
155
169
|
}
|
|
156
170
|
|
|
157
171
|
function renderBody() {
|
|
158
|
-
body.innerHTML = "";
|
|
172
|
+
body.innerHTML = __RTE_TT("");
|
|
159
173
|
if (current === "date") {
|
|
160
174
|
var note = append(body, "div", "", "rte-chip-field-label");
|
|
161
|
-
note.textContent = "Insert a date chip:";
|
|
175
|
+
note.textContent = chText("ch_insertdate", "Insert a date chip:");
|
|
162
176
|
var di = append(body, "input", "", "rte-chip-input");
|
|
163
177
|
di.type = "date"; di.value = isoDate(new Date(editor.__chipNow || Date.now()));
|
|
164
|
-
di.setAttribute("aria-label", "Date chip value");
|
|
178
|
+
di.setAttribute("aria-label", chText("ch_datevalue", "Date chip value"));
|
|
165
179
|
addInsert(function () {
|
|
166
180
|
var p = (di.value || "").split("-");
|
|
167
181
|
if (p.length === 3) { var d = new Date(+p[0], +p[1] - 1, +p[2]); close(); insertChip("date", fmtDate(d), di.value); }
|
|
168
182
|
});
|
|
169
183
|
} else {
|
|
170
184
|
var lbl = append(body, "div", "", "rte-chip-field-label");
|
|
171
|
-
lbl.textContent = current === "person" ? "Name (or search):" : "URL:";
|
|
185
|
+
lbl.textContent = current === "person" ? chText("ch_name", "Name (or search):") : chText("ch_url", "URL:");
|
|
172
186
|
var input = append(body, "input", "", "rte-chip-input");
|
|
173
187
|
input.type = current === "link" ? "url" : "text";
|
|
174
|
-
input.placeholder = current === "person" ? "Jane Doe" : "https://example.com";
|
|
175
|
-
input.setAttribute("aria-label", current === "person" ? "Person chip name" : "Link chip URL");
|
|
188
|
+
input.placeholder = current === "person" ? chText("ch_nameph", "Jane Doe") : "https://example.com";
|
|
189
|
+
input.setAttribute("aria-label", current === "person" ? chText("ch_personname", "Person chip name") : chText("ch_linkurl", "Link chip URL"));
|
|
176
190
|
var results = append(body, "div", "", "rte-chip-results");
|
|
177
191
|
results.setAttribute("role", "listbox");
|
|
178
|
-
results.setAttribute("aria-label", "Chip suggestions");
|
|
192
|
+
results.setAttribute("aria-label", chText("ch_suggestions", "Chip suggestions"));
|
|
179
193
|
// BYOK resolver: live suggestions
|
|
180
194
|
if (config.chipResolver && typeof config.chipResolver === "function") {
|
|
181
195
|
input.oninput = function () {
|
|
182
196
|
var q = input.value.trim();
|
|
183
|
-
results.innerHTML = "";
|
|
197
|
+
results.innerHTML = __RTE_TT("");
|
|
184
198
|
if (!q) return;
|
|
185
199
|
try {
|
|
186
200
|
var p = config.chipResolver(q, current);
|
|
187
201
|
if (p && p.then) p.then(function (list) {
|
|
188
|
-
results.innerHTML = "";
|
|
202
|
+
results.innerHTML = __RTE_TT("");
|
|
189
203
|
(list || []).slice(0, 6).forEach(function (it) {
|
|
190
204
|
var r = append(results, "button", "", "rte-chip-suggestion");
|
|
191
205
|
r.type = "button"; r.textContent = it.label || it.value;
|
|
@@ -202,11 +216,11 @@ function RTE_Plugin_SmartChips() {
|
|
|
202
216
|
// Validate the URL: reject javascript:/data:/vbscript:/file:,
|
|
203
217
|
// prefix https:// only on bare domains, else refuse.
|
|
204
218
|
if (/^(javascript|data|vbscript|file):/i.test(v)) {
|
|
205
|
-
input.style.borderColor = "#dc2626"; input.placeholder = "Enter a valid http(s) URL"; input.value = ""; return;
|
|
219
|
+
input.style.borderColor = "#dc2626"; input.placeholder = chText("ch_invalidurl", "Enter a valid http(s) URL"); input.value = ""; return;
|
|
206
220
|
}
|
|
207
221
|
if (!/^https?:\/\//i.test(v)) {
|
|
208
222
|
if (/^[a-z0-9.-]+\.[a-z]{2,}([\/?#].*)?$/i.test(v)) v = "https://" + v;
|
|
209
|
-
else { input.style.borderColor = "#dc2626"; input.placeholder = "Enter a valid http(s) URL"; input.value = ""; return; }
|
|
223
|
+
else { input.style.borderColor = "#dc2626"; input.placeholder = chText("ch_invalidurl", "Enter a valid http(s) URL"); input.value = ""; return; }
|
|
210
224
|
}
|
|
211
225
|
close();
|
|
212
226
|
insertChip("link", v.replace(/^https?:\/\//i, "").replace(/\/$/, ""), v, v);
|
|
@@ -221,7 +235,7 @@ function RTE_Plugin_SmartChips() {
|
|
|
221
235
|
function addInsert(fn) {
|
|
222
236
|
var foot = append(body, "div", "", "rte-chip-dialog-footer");
|
|
223
237
|
var ok = append(foot, "button", "", "rte-chip-action rte-chip-action-primary");
|
|
224
|
-
ok.type = "button"; ok.textContent = "Insert"; ok.onclick = fn;
|
|
238
|
+
ok.type = "button"; ok.textContent = chText("insert", "Insert"); ok.onclick = fn;
|
|
225
239
|
}
|
|
226
240
|
highlight(); renderBody();
|
|
227
241
|
};
|