@richscripts/richtexteditor 2.14.0 → 2.15.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 +173 -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 +33 -54
- 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 +58 -22
- package/package.json +25 -3
- package/react/index.js +118 -37
- package/react/index.mjs +29 -0
- package/richtexteditor/all_plugins.js +7113 -1111
- package/richtexteditor/all_plugins.min.js +62 -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 +1017 -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 +1023 -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 +1023 -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 +1023 -2
- package/richtexteditor/lang/rte-lang-ja.js +1023 -2
- package/richtexteditor/lang/rte-lang-kn.js +1 -0
- package/richtexteditor/lang/rte-lang-ko.js +1023 -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 +1023 -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 +1023 -2
- package/richtexteditor/lang/rte-lang-pt.js +1023 -2
- package/richtexteditor/lang/rte-lang-ro.js +1 -0
- package/richtexteditor/lang/rte-lang-ru.js +1023 -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 +1017 -2
- package/richtexteditor/lang/rte-lang-zh-Hant.js +1017 -2
- package/richtexteditor/plugins/a11yenhance.js +2 -1
- package/richtexteditor/plugins/a11yenhance.min.js +1 -1
- package/richtexteditor/plugins/accessibilitychecker.js +252 -60
- package/richtexteditor/plugins/accessibilitychecker.min.js +1 -1
- package/richtexteditor/plugins/aitoolkit.js +966 -303
- package/richtexteditor/plugins/aitoolkit.min.js +7 -7
- package/richtexteditor/plugins/all_plugins.js +7113 -1111
- package/richtexteditor/plugins/all_plugins.min.js +62 -59
- package/richtexteditor/plugins/autocorrect.js +66 -31
- package/richtexteditor/plugins/autocorrect.min.js +1 -1
- package/richtexteditor/plugins/autoembed.js +17 -0
- 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 +458 -59
- package/richtexteditor/plugins/comments.min.js +4 -3
- package/richtexteditor/plugins/contentminimap.js +25 -6
- package/richtexteditor/plugins/contentminimap.min.js +1 -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 +220 -51
- package/richtexteditor/plugins/documentimport.min.js +4 -4
- package/richtexteditor/plugins/documentoutline.js +88 -38
- package/richtexteditor/plugins/documentoutline.min.js +1 -1
- package/richtexteditor/plugins/docxexport.js +204 -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 +110 -56
- 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 +53 -8
- 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 +1 -1
- package/richtexteditor/plugins/html2pdf.min.js +1 -1
- package/richtexteditor/plugins/imageeditor.js +12 -6
- 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 +21 -3
- package/richtexteditor/plugins/insertcode.min.js +4 -4
- package/richtexteditor/plugins/insertemoji.js +112 -15
- package/richtexteditor/plugins/insertemoji.min.js +1 -1
- package/richtexteditor/plugins/insertgallery.js +42 -36
- package/richtexteditor/plugins/insertgallery.min.js +1 -1
- package/richtexteditor/plugins/inserttemplate.js +33 -17
- 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 +88 -25
- package/richtexteditor/plugins/mentionplugin.min.js +1 -1
- package/richtexteditor/plugins/mermaiddiagram.js +9 -3
- 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/pdfexport.js +235 -35
- package/richtexteditor/plugins/pdfexport.min.js +12 -12
- 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 +29 -15
- 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 +169 -37
- package/richtexteditor/plugins/revisionhistory.min.js +3 -3
- package/richtexteditor/plugins/rubyannotation.js +19 -9
- package/richtexteditor/plugins/rubyannotation.min.js +1 -1
- package/richtexteditor/plugins/sanitizer.js +86 -4
- package/richtexteditor/plugins/sanitizer.min.js +1 -1
- package/richtexteditor/plugins/slashcommand.js +30 -16
- package/richtexteditor/plugins/slashcommand.min.js +2 -2
- package/richtexteditor/plugins/smartchips.js +36 -22
- package/richtexteditor/plugins/smartchips.min.js +2 -2
- package/richtexteditor/plugins/spellcheck.js +17 -8
- package/richtexteditor/plugins/spellcheck.min.js +2 -2
- package/richtexteditor/plugins/stateinspector.js +19 -9
- package/richtexteditor/plugins/stateinspector.min.js +2 -2
- package/richtexteditor/plugins/structured-content-bridge.js +56 -24
- package/richtexteditor/plugins/structured-content-bridge.min.js +7 -7
- 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 +18 -5
- 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 +9 -4
- 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 +131 -50
- package/richtexteditor/rte-headless.js +19 -4
- package/richtexteditor/rte-webcomponent.js +89 -16
- package/richtexteditor/rte.js +133 -52
- package/richtexteditor/runtime/colorpicker_more_ns.htm +93 -16
- package/scripts/build-angular.mjs +97 -0
- package/svelte/index.d.ts +2 -1
- package/svelte/index.js +80 -9
- package/vue/index.js +130 -34
- package/angular/component.ts +0 -297
- package/angular/index.ts +0 -24
|
@@ -1,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(){z(!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"],ze(),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"],_e(),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||z(!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 z(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(),_("")}}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,_(l),S()}}function _(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="",!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=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 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 $(){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 _e(){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 = {};
|
|
@@ -158,24 +172,24 @@ function RTE_Plugin_SmartChips() {
|
|
|
158
172
|
body.innerHTML = "";
|
|
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 () {
|
|
@@ -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
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_smartchips=RTE_Plugin_SmartChips,RTE_DefaultConfig.chipResolver=RTE_DefaultConfig.chipResolver||null,RTE_DefaultConfig.chipDateFormat=RTE_DefaultConfig.chipDateFormat||null;function RTE_Plugin_SmartChips(){var
|
|
2
|
-
`);try{var t=
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_smartchips=RTE_Plugin_SmartChips,RTE_DefaultConfig.chipResolver=RTE_DefaultConfig.chipResolver||null,RTE_DefaultConfig.chipDateFormat=RTE_DefaultConfig.chipDateFormat||null;function RTE_Plugin_SmartChips(){var m=this,b,c;m.PluginName="SmartChips",m.InitConfig=function(e){b=e};function i(e,t){for(var a=b&&b["text_"+e]||t,n=2;n<arguments.length;n++)a=a.split("{"+(n-2)+"}").join(String(arguments[n]));return a}m.InitEditor=function(e){c=e,c.attachEvent("exec_command_insertdatechip",function(t){t.returnValue=!0,m.OpenDateChip()}),c.attachEvent("exec_command_insertchip",function(t){t.returnValue=!0,m.OpenChipMenu()}),L()};function o(e,t,a,n){var s=e.ownerDocument.createElement(t);return a&&(s.style.cssText=a),n&&(s.className=n),e.appendChild(s),s}function k(e){return String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function x(e){if(b.chipDateFormat&&typeof b.chipDateFormat=="function")try{return String(b.chipDateFormat(e))}catch{}var t=b&&b.text_uilocale;if(t&&!/^en(-|$)/i.test(t)&&typeof Intl<"u"&&Intl.DateTimeFormat)try{return new Intl.DateTimeFormat(t,{year:"numeric",month:"short",day:"numeric"}).format(e)}catch{}return I[e.getMonth()]+" "+e.getDate()+", "+e.getFullYear()}function R(e){function t(a){return(a<10?"0":"")+a}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())}var A={date:'<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6"><rect x="2" y="3" width="12" height="11" rx="1.5"/><path d="M2 6.5h12"/><path d="M5 1.5v3"/><path d="M11 1.5v3"/></svg>',person:'<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6"><circle cx="8" cy="5" r="2.6"/><path d="M3 13.5c0-2.5 2.2-4 5-4s5 1.5 5 4"/></svg>',link:'<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6"><path d="M6.5 9.5a3 3 0 004.2 0l2-2a3 3 0 10-4.2-4.2L7.4 4.3"/><path d="M9.5 6.5a3 3 0 00-4.2 0l-2 2a3 3 0 104.2 4.2l1-1"/></svg>'};function S(e,t,a,n){var s=A[e]||"",p='class="rte-chip rte-chip-'+k(e)+'" data-rte-chip="'+k(e)+'" data-rte-chip-value="'+k(a||t)+'" contenteditable="false"',h='<span class="rte-chip-icon">'+s+'</span><span class="rte-chip-label">'+k(t)+"</span>";if(e==="link"&&n){var v=/^(javascript|data|vbscript):/i.test(n)?"#":n;return"<a "+p+' href="'+k(v)+'" target="_blank" rel="noopener noreferrer">'+h+"</a>"}return"<span "+p+">"+h+"</span>"}function C(e,t,a,n){L(),c.insertHTML(S(e,t,a,n)+"\u200B"),c.focus()}m.OpenDateChip=function(){var e=c.createDialog(c.getLangText&&c.getLangText("insertdatechiptitle")||"Date","rte-dialog-datechip"),t=typeof e.close=="function"?function(){e.close()}:function(){c.closeCurrentPopup()},a=o(e,"div","","rte-chip-dialog rte-chip-date-dialog");o(a,"div","","rte-chip-dialog-copy").textContent=i("ch_datecopy","Choose a quick date or insert a custom date chip.");function n(f,g){var r=o(a,"button","","rte-chip-quick");return r.type="button",r.textContent=f+" \u2014 "+x(g),r.onmouseover=function(){r.style.background="#eef2ff"},r.onmouseout=function(){r.style.background="transparent"},r.textContent="",o(r,"span","","rte-chip-quick-label").textContent=f,o(r,"span","","rte-chip-quick-value").textContent=x(g),r.onmouseover=null,r.onmouseout=null,r.setAttribute("aria-label",i("ch_insertlabel","Insert {0}, {1}",f,x(g))),r.onclick=function(){t(),C("date",x(g),R(g))},r}var s=new Date(c.__chipNow||Date.now());function p(f,g){var r=new Date(f.getTime());return r.setDate(r.getDate()+g),r}n(i("ch_today","Today"),s),n(i("ch_tomorrow","Tomorrow"),p(s,1)),n(i("ch_yesterday","Yesterday"),p(s,-1)),n(i("ch_nextweek","Next week"),p(s,7));var h=o(a,"div","","rte-chip-pick-row"),v=o(h,"input","","rte-chip-input");v.type="date",v.value=R(s),v.setAttribute("aria-label",i("ch_customdate","Custom date"));var _=o(h,"button","","rte-chip-action rte-chip-action-primary");_.type="button",_.textContent=i("insert","Insert"),_.onclick=function(){var f=(v.value||"").split("-");if(f.length===3){var g=new Date(parseInt(f[0],10),parseInt(f[1],10)-1,parseInt(f[2],10));t(),C("date",x(g),v.value)}else t()},setTimeout(function(){v.focus()},0)},m.OpenChipMenu=function(){var e=c.createDialog(c.getLangText&&c.getLangText("insertchiptitle")||"Insert chip","rte-dialog-chip"),t=typeof e.close=="function"?function(){e.close()}:function(){c.closeCurrentPopup()},a=o(e,"div","","rte-chip-dialog rte-chip-menu-dialog");o(a,"div","","rte-chip-dialog-copy").textContent=i("ch_chipcopy","Insert a date, person, or link chip into the document.");var n=o(a,"div","","rte-chip-type-tabs");n.setAttribute("role","tablist"),n.setAttribute("aria-label",i("ch_chiptype","Chip type"));var s=[["date",i("ch_date","Date")],["person",i("ch_person","Person")],["link",i("link","Link")]],p="date",h=o(a,"div","","rte-chip-dialog-body"),v={};s.forEach(function(r){var u=o(n,"button","","rte-chip-type-tab");u.type="button",u.textContent=r[1],u.setAttribute("role","tab"),u.setAttribute("aria-selected",r[0]===p?"true":"false"),v[r[0]]=u,u.onclick=function(){p=r[0],_(),f()}});function _(){s.forEach(function(r){var u=r[0]===p;v[r[0]].classList.toggle("is-selected",u),v[r[0]].setAttribute("aria-selected",u?"true":"false")})}function f(){if(h.innerHTML="",p==="date"){var r=o(h,"div","","rte-chip-field-label");r.textContent=i("ch_insertdate","Insert a date chip:");var u=o(h,"input","","rte-chip-input");u.type="date",u.value=R(new Date(c.__chipNow||Date.now())),u.setAttribute("aria-label",i("ch_datevalue","Date chip value")),g(function(){var l=(u.value||"").split("-");if(l.length===3){var T=new Date(+l[0],+l[1]-1,+l[2]);t(),C("date",x(T),u.value)}})}else{var D=o(h,"div","","rte-chip-field-label");D.textContent=p==="person"?i("ch_name","Name (or search):"):i("ch_url","URL:");var d=o(h,"input","","rte-chip-input");d.type=p==="link"?"url":"text",d.placeholder=p==="person"?i("ch_nameph","Jane Doe"):"https://example.com",d.setAttribute("aria-label",p==="person"?i("ch_personname","Person chip name"):i("ch_linkurl","Link chip URL"));var w=o(h,"div","","rte-chip-results");w.setAttribute("role","listbox"),w.setAttribute("aria-label",i("ch_suggestions","Chip suggestions")),b.chipResolver&&typeof b.chipResolver=="function"&&(d.oninput=function(){var l=d.value.trim();if(w.innerHTML="",!!l)try{var T=b.chipResolver(l,p);T&&T.then&&T.then(function(M){w.innerHTML="",(M||[]).slice(0,6).forEach(function(y){var E=o(w,"button","","rte-chip-suggestion");E.type="button",E.textContent=y.label||y.value,E.setAttribute("role","option"),E.onclick=function(){t(),C(p,y.label||y.value,y.value||y.label,y.href)}})})}catch{}}),g(function(){var l=d.value.trim();if(!l){t();return}if(p==="link"){if(/^(javascript|data|vbscript|file):/i.test(l)){d.style.borderColor="#dc2626",d.placeholder=i("ch_invalidurl","Enter a valid http(s) URL"),d.value="";return}if(!/^https?:\/\//i.test(l))if(/^[a-z0-9.-]+\.[a-z]{2,}([\/?#].*)?$/i.test(l))l="https://"+l;else{d.style.borderColor="#dc2626",d.placeholder=i("ch_invalidurl","Enter a valid http(s) URL"),d.value="";return}t(),C("link",l.replace(/^https?:\/\//i,"").replace(/\/$/,""),l,l)}else t(),C("person",l,l)}),setTimeout(function(){d.focus()},0)}}function g(r){var u=o(h,"div","","rte-chip-dialog-footer"),D=o(u,"button","","rte-chip-action rte-chip-action-primary");D.type="button",D.textContent=i("insert","Insert"),D.onclick=r}_(),f()};function L(){var e=[".rte-chip{display:inline-flex;align-items:center;gap:4px;padding:2px 8px 2px 6px;margin:0 1px;border:1px solid rgba(100,116,139,.16);border-radius:999px;background:linear-gradient(180deg,#f8fbff,#eef4ff);color:#315277;font-size:.92em;line-height:1.45;white-space:nowrap;text-decoration:none;vertical-align:baseline;cursor:default;user-select:none;box-shadow:0 1px 2px rgba(15,23,42,.06)}",".rte-chip-icon{display:inline-flex;align-items:center;opacity:.9}",".rte-chip-date{background:linear-gradient(180deg,#f0fdff,#e6f8fb);color:#0e7490;border-color:rgba(14,116,144,.18)}",".rte-chip-person{background:linear-gradient(180deg,#f6f7ff,#eef2ff);color:#3730a3;border-color:rgba(55,48,163,.18)}",".rte-chip-link{background:linear-gradient(180deg,#f5fff8,#ecfdf4);color:#15803d;border-color:rgba(21,128,61,.18);cursor:pointer}",".rte-chip-link:hover{text-decoration:underline}"].join(`
|
|
2
|
+
`);try{var t=c.getDocument();if(!t)return;var a=t.head||t.getElementsByTagName&&t.getElementsByTagName("head")[0]||t.documentElement;if(a&&!t.querySelector("style[data-rte-smartchips]")){var n=t.createElement("style");n.setAttribute("data-rte-smartchips","1"),n.textContent=e,a.appendChild(n),c&&typeof c.ensureStyleSheetLive=="function"&&c.ensureStyleSheetLive(t,n,"rte-smartchips-st",n.textContent)}}catch{}}}
|
|
@@ -26,6 +26,13 @@ function RTE_Plugin_SpellCheck() {
|
|
|
26
26
|
obj.PluginName = "SpellCheck";
|
|
27
27
|
|
|
28
28
|
obj.InitConfig = function (argconfig) { config = argconfig; };
|
|
29
|
+
// 2026-10-18 the words read config.text_ keys (language packs), English as the fallback; {0} / {1} fill a template.
|
|
30
|
+
// tools/i18n/plugin-bars-language.mjs
|
|
31
|
+
function pText(key, fallback) {
|
|
32
|
+
var s = (config && config["text_" + key]) || fallback;
|
|
33
|
+
for (var i = 2; i < arguments.length; i++) s = s.split("{" + (i - 2) + "}").join(String(arguments[i]));
|
|
34
|
+
return s;
|
|
35
|
+
}
|
|
29
36
|
|
|
30
37
|
obj.InitEditor = function (argeditor) {
|
|
31
38
|
editor = argeditor;
|
|
@@ -59,7 +66,9 @@ function RTE_Plugin_SpellCheck() {
|
|
|
59
66
|
try { if (!editor.InvokeEventHook || !editor.InvokeEventHook("customdialog", "spellcheck", msg)) { /* fall through to toast */ } } catch (e) { }
|
|
60
67
|
try {
|
|
61
68
|
var editable = editor.getEditable();
|
|
62
|
-
|
|
69
|
+
// 2026-10-14 The toast is a message for the person, so it goes to the host page (where its stylesheet is),
|
|
70
|
+
// never into the editable's own body, where it would be saved with the content. tools/spellcheck/spellcheck-toast.mjs
|
|
71
|
+
var host = (editor && editor.iframe && editor.iframe.ownerDocument) || editable.ownerDocument;
|
|
63
72
|
var t = host.createElement("div");
|
|
64
73
|
t.className = "rte-spell-toast";
|
|
65
74
|
t.setAttribute("role", "status");
|
|
@@ -100,13 +109,13 @@ function RTE_Plugin_SpellCheck() {
|
|
|
100
109
|
editable.setAttribute("spellcheck", "true");
|
|
101
110
|
editable.focus();
|
|
102
111
|
} catch (e) { }
|
|
103
|
-
notify((editor.getLangText && editor.getLangText("spellchecknative")) || "Browser spell-check is on
|
|
112
|
+
notify((editor.getLangText && editor.getLangText("spellchecknative")) || "Browser spell-check is on \u2014 misspellings are underlined as you type.");
|
|
104
113
|
return;
|
|
105
114
|
}
|
|
106
115
|
|
|
107
116
|
var text;
|
|
108
117
|
try { text = editor.getEditable().innerText || ""; } catch (e) { text = ""; }
|
|
109
|
-
if (!text.trim()) { notify("Nothing to check."); return; }
|
|
118
|
+
if (!text.trim()) { notify(pText("sp_nothing", "Nothing to check.")); return; }
|
|
110
119
|
|
|
111
120
|
var dlg = editor.createDialog(
|
|
112
121
|
(editor.getLangText && editor.getLangText("spellchecktitle")) || "Spelling",
|
|
@@ -115,7 +124,7 @@ function RTE_Plugin_SpellCheck() {
|
|
|
115
124
|
var close = typeof dlg.close === "function" ? function () { dlg.close(); } : function () { editor.closeCurrentPopup(); };
|
|
116
125
|
var wrap = append(dlg, "div", "box-sizing:border-box;width:min(420px,calc(100vw - 32px));max-height:60vh;overflow:auto;padding:14px;font:13px -apple-system,Segoe UI,sans-serif");
|
|
117
126
|
var status = append(wrap, "div", "color:#64748b;margin-bottom:8px");
|
|
118
|
-
status.innerText = "Checking
|
|
127
|
+
status.innerText = pText("sp_checking", "Checking\u2026");
|
|
119
128
|
var list = append(wrap, "div", "");
|
|
120
129
|
|
|
121
130
|
function renderIssues(issues) {
|
|
@@ -155,14 +164,14 @@ function RTE_Plugin_SpellCheck() {
|
|
|
155
164
|
try {
|
|
156
165
|
var p = config.spellCheckResolver(text);
|
|
157
166
|
if (p && typeof p.then === "function") {
|
|
158
|
-
p.then(function (r) { finish(r || []); }, function () { status.innerText = "Spell-check service error."; });
|
|
159
|
-
setTimeout(function () { if (!done) { status.innerText = "Spell-check timed out."; done = true; } }, 12000);
|
|
167
|
+
p.then(function (r) { finish(r || []); }, function () { status.innerText = pText("sp_serviceerror", "Spell-check service error."); });
|
|
168
|
+
setTimeout(function () { if (!done) { status.innerText = pText("sp_timeout", "Spell-check timed out."); done = true; } }, 12000);
|
|
160
169
|
} else { finish(p || []); }
|
|
161
|
-
} catch (e) { status.innerText = "Spell-check error."; }
|
|
170
|
+
} catch (e) { status.innerText = pText("sp_error", "Spell-check error."); }
|
|
162
171
|
|
|
163
172
|
var footer = append(wrap, "div", "display:flex;justify-content:flex-end;margin-top:12px");
|
|
164
173
|
var closeBtn = append(footer, "button", "padding:6px 14px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;cursor:pointer");
|
|
165
|
-
closeBtn.type = "button"; closeBtn.textContent = "Done"; closeBtn.onclick = function () { close(); editor.focus(); };
|
|
174
|
+
closeBtn.type = "button"; closeBtn.textContent = pText("sp_done", "Done"); closeBtn.onclick = function () { close(); editor.focus(); };
|
|
166
175
|
};
|
|
167
176
|
|
|
168
177
|
function injectStyles() {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_spellcheck=RTE_Plugin_SpellCheck,RTE_DefaultConfig.spellCheckResolver=RTE_DefaultConfig.spellCheckResolver||null,typeof RTE_DefaultConfig.spellCheckEnabled>"u"&&(RTE_DefaultConfig.spellCheckEnabled=!0);function RTE_Plugin_SpellCheck(){var
|
|
2
|
-
`);try{var r=e&&e.iframe&&e.iframe.ownerDocument||document;if(!r.querySelector("style[data-rte-spellcheck]")){var
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_spellcheck=RTE_Plugin_SpellCheck,RTE_DefaultConfig.spellCheckResolver=RTE_DefaultConfig.spellCheckResolver||null,typeof RTE_DefaultConfig.spellCheckEnabled>"u"&&(RTE_DefaultConfig.spellCheckEnabled=!0);function RTE_Plugin_SpellCheck(){var d=this,s,e;d.PluginName="SpellCheck",d.InitConfig=function(n){s=n};function u(n,r){for(var t=s&&s["text_"+n]||r,o=2;o<arguments.length;o++)t=t.split("{"+(o-2)+"}").join(String(arguments[o]));return t}d.InitEditor=function(n){e=n;try{var r=e.getEditable&&e.getEditable();r&&r.setAttribute("spellcheck",s.spellCheckEnabled===!1?"false":"true")}catch{}e.attachEvent("exec_command_spellcheck",function(t){t.returnValue=!0,d.RunSpellCheck()}),R()};function c(n,r,t,o){var i=n.ownerDocument.createElement(r);return t&&(i.style.cssText=t),o&&(i.className=o),n.appendChild(i),i}function E(n){return String(n??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function T(n){try{!e.InvokeEventHook||e.InvokeEventHook("customdialog","spellcheck",n)}catch{}try{var r=e.getEditable(),t=e&&e.iframe&&e.iframe.ownerDocument||r.ownerDocument,o=t.createElement("div");o.className="rte-spell-toast",o.setAttribute("role","status"),o.setAttribute("aria-live","polite"),o.textContent=n,t.body.appendChild(o),setTimeout(function(){o.parentNode&&o.parentNode.removeChild(o)},2600)}catch{}}function S(n,r){try{for(var t=e.getEditable(),o=e.getDocument(),i=o.createTreeWalker(t,NodeFilter.SHOW_TEXT,null),l,h=new RegExp("\\b"+n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"\\b");l=i.nextNode();){var g=l.parentNode;if(!(g&&(g.nodeName==="CODE"||g.nodeName==="PRE"))){var p=l.data.search(h);if(p>=0)return l.data=l.data.substring(0,p)+r+l.data.substring(p+n.length),!0}}}catch{}return!1}d.RunSpellCheck=function(){if(!s.spellCheckResolver||typeof s.spellCheckResolver!="function"){try{var n=e.getEditable();n.setAttribute("spellcheck","true"),n.focus()}catch{}T(e.getLangText&&e.getLangText("spellchecknative")||"Browser spell-check is on \u2014 misspellings are underlined as you type.");return}var r;try{r=e.getEditable().innerText||""}catch{r=""}if(!r.trim()){T(u("sp_nothing","Nothing to check."));return}var t=e.createDialog(e.getLangText&&e.getLangText("spellchecktitle")||"Spelling","rte-dialog-spell"),o=typeof t.close=="function"?function(){t.close()}:function(){e.closeCurrentPopup()},i=c(t,"div","box-sizing:border-box;width:min(420px,calc(100vw - 32px));max-height:60vh;overflow:auto;padding:14px;font:13px -apple-system,Segoe UI,sans-serif"),l=c(i,"div","color:#64748b;margin-bottom:8px");l.innerText=u("sp_checking","Checking\u2026");var h=c(i,"div","");function g(a){if(h.innerHTML="",!a||!a.length){l.innerText=e.getLangText&&e.getLangText("spellcheckclean")||"No spelling issues found.";return}l.innerText=a.length+" issue"+(a.length===1?"":"s")+" found.",a.forEach(function(f){if(!(!f||!f.word)){var m=c(h,"div","padding:8px 0;border-bottom:1px solid rgba(15,23,42,.08)","rte-spell-row"),w=c(m,"div","font-weight:600;color:#b91c1c;margin-bottom:4px");w.textContent=f.word;var k=c(m,"div","display:flex;flex-wrap:wrap;gap:6px"),_=(f.suggestions||[]).slice(0,6);_.length||(c(k,"span","font-size:12px;color:#94a3b8").textContent="(no suggestions)"),_.forEach(function(y){var C=c(k,"button","font-size:12px;padding:4px 9px;border:1px solid #cbd5e1;border-radius:6px;background:#f8fbff;color:#315277;cursor:pointer");C.type="button",C.textContent=y,C.onclick=function(){S(f.word,y)&&(m.style.opacity="0.45",w.innerHTML=E(f.word)+' → <span style="color:#16a34a">'+E(y)+"</span>",k.innerHTML="")}})}})}var p=!1;function x(a){p||(p=!0,g(a))}try{var v=s.spellCheckResolver(r);v&&typeof v.then=="function"?(v.then(function(a){x(a||[])},function(){l.innerText=u("sp_serviceerror","Spell-check service error.")}),setTimeout(function(){p||(l.innerText=u("sp_timeout","Spell-check timed out."),p=!0)},12e3)):x(v||[])}catch{l.innerText=u("sp_error","Spell-check error.")}var D=c(i,"div","display:flex;justify-content:flex-end;margin-top:12px"),b=c(D,"button","padding:6px 14px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;cursor:pointer");b.type="button",b.textContent=u("sp_done","Done"),b.onclick=function(){o(),e.focus()}};function R(){var n=["/* 2026-07-12 spell-check feedback precision */",".rte-spell-toast{position:fixed;left:50%;bottom:28px;transform:translateX(-50%);max-width:calc(100vw - 32px);padding:9px 12px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:#172033;font:600 13px/1.35 -apple-system,Segoe UI,sans-serif;z-index:2147483600;box-shadow:0 10px 24px rgba(15,23,42,.14)}",".rte-spell-row:last-child{border-bottom:0}"].join(`
|
|
2
|
+
`);try{var r=e&&e.iframe&&e.iframe.ownerDocument||document;if(!r.querySelector("style[data-rte-spellcheck]")){var t=r.createElement("style");t.setAttribute("data-rte-spellcheck","1"),t.textContent=n,(r.head||r.documentElement).appendChild(t),e&&typeof e.ensureStyleSheetLive=="function"&&e.ensureStyleSheetLive(r,t,"rte-spellcheck-st",t.textContent)}}catch{}}}
|