@richscripts/richtexteditor 2.14.1 → 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 +7001 -1078
- 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 +7001 -1078
- 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 +47 -8
- 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 +6 -6
- package/richtexteditor/plugins/formattingmarks.min.js +1 -1
- package/richtexteditor/plugins/gapcursor.js +60 -0
- package/richtexteditor/plugins/gapcursor.min.js +1 -1
- package/richtexteditor/plugins/ghostcomplete.js +1 -1
- package/richtexteditor/plugins/html2pdf.js +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 +62 -3
- 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 +130 -50
- package/richtexteditor/rte-headless.js +19 -4
- package/richtexteditor/rte-webcomponent.js +89 -16
- package/richtexteditor/rte.js +132 -52
- 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_docxexport=RTE_Plugin_DocxExport,typeof RTE_DefaultConfig.docxExport>"u"&&(RTE_DefaultConfig.docxExport=!0);function RTE_Plugin_DocxExport(){var
|
|
2
|
-
`),a="",d=0;d<n.length;d++)if(d&&(a+="<w:r>"+L(t)+"<w:br/></w:r>"),!!n[d]){var i=e?"w:delText":"w:t";a+="<w:r>"+L(t)+"<"+i+' xml:space="preserve">'+P(n[d])+"</"+i+">",a+="</w:r>"}return a}function Y(r){var t=r.getAttribute("data-author")||r.getAttribute("data-comment-author")||"RichTextEditor",e=r.getAttribute("data-date")||new Date().toISOString().replace(/\.\d+Z$/,"Z");return' w:author="'+P(t)+'" w:date="'+P(e)+'"'}function R(r,t,e,n){for(var a="",d=0;d<r.childNodes.length;d++){var i=r.childNodes[d];if(i.nodeType===3){var p=(i.nodeValue||"").replace(/[\r\n\t]+/g," ");p&&(a+=M(p,t,!1));continue}if(i.nodeType===1){var c=i.tagName.toLowerCase();if(!(c==="script"||c==="style")){if(c==="br"){a+="<w:r>"+L(t)+"<w:br/></w:r>";continue}if(i.getAttribute&&i.getAttribute("data-tex")){a+=re(i.getAttribute("data-tex"));continue}if((c==="sup"||c==="span")&&i.getAttribute("data-footnote")){a+=k(e,"footnote",i.getAttribute("data-footnote"));continue}if((c==="sup"||c==="span")&&i.getAttribute("data-endnote")){a+=k(e,"endnote",i.getAttribute("data-endnote"));continue}if(i.classList&&i.classList.contains("rte-fn-ref")){var v=i.getAttribute("data-fn-id"),h=v?J(r.ownerDocument,v):"";a+=k(e,"footnote",h||i.textContent||"");continue}if(c==="img"){a+=K(i,e);continue}var m=C(i,t);if(c==="a"&&i.getAttribute("href")){var w=i.getAttribute("href"),s=R(i,m,e,n);if(w.charAt(0)==="#")a+='<w:hyperlink w:anchor="'+P(w.slice(1))+'">'+s+"</w:hyperlink>";else{var l=e.rel("hyperlink",w,"External");a+='<w:hyperlink r:id="'+l+'">'+s+"</w:hyperlink>"}continue}if(c==="ins"||c==="del"){var u=c==="del",o="";(function g(x,T){for(var b=0;b<x.childNodes.length;b++){var y=x.childNodes[b];if(y.nodeType===3){o+=M((y.nodeValue||"").replace(/[\r\n\t]+/g," "),T,u);continue}y.nodeType===1&&g(y,C(y,T))}})(i,m),a+="<w:"+c+' w:id="'+n.n+++'"'+Y(i)+">"+o+"</w:"+c+">";continue}if(i.getAttribute&&i.getAttribute("data-comment")){var f=e.commentSeq++;e.comments.push({id:f,author:i.getAttribute("data-comment-author")||"RichTextEditor user",initials:i.getAttribute("data-comment-initials")||"RTE",text:i.getAttribute("data-comment")}),a+='<w:commentRangeStart w:id="'+f+'"/>'+R(i,m,e,n)+'<w:commentRangeEnd w:id="'+f+'"/><w:r><w:commentReference w:id="'+f+'"/></w:r>';continue}a+=R(i,m,e,n)}}}return a}function J(r,t){try{var e=r.querySelector('.rte-fn-note[data-fn-id="'+t+'"]');return e?(e.textContent||"").replace(/\s+/g," ").trim():""}catch{return""}}function k(r,t,e){var n=r.noteSeq++;return(t==="endnote"?r.endnotes:r.footnotes).push({id:n,text:e||""}),'<w:r><w:rPr><w:vertAlign w:val="superscript"/></w:rPr><w:'+t+'Reference w:id="'+n+'"/></w:r>'}function K(r,t){var e=ee(r);if(!e)return"";var n="image"+(t.media.length+1)+".png";t.media.push({name:n,bytes:e.bytes});var a=t.rel("image","media/"+n),d=Math.round(e.width*914400/96),i=Math.round(e.height*914400/96),p=t.media.length;return'<w:r><w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"><wp:extent cx="'+d+'" cy="'+i+'"/><wp:docPr id="'+p+'" name="Picture '+p+'" descr="'+P(r.getAttribute("alt")||"")+'"/><a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:nvPicPr><pic:cNvPr id="'+p+'" name="Picture '+p+'"/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="'+a+'"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="'+d+'" cy="'+i+'"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing></w:r>'}function ee(r){try{var t=r.naturalWidth||r.width,e=r.naturalHeight||r.height;if(!t||!e)return null;var n=Math.min(1,1600/Math.max(t,e)),a=Math.max(1,Math.round(t*n)),d=Math.max(1,Math.round(e*n)),i=document.createElement("canvas");i.width=a,i.height=d,i.getContext("2d").drawImage(r,0,0,a,d);var p=i.toDataURL("image/png"),c=p.indexOf(",");if(c<0)return null;for(var v=atob(p.slice(c+1)),h=new Uint8Array(v.length),m=0;m<v.length;m++)h[m]=v.charCodeAt(m);return{bytes:h,width:a,height:d}}catch{return null}}var z={alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",pi:"\u03C0",rho:"\u03C1",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",varphi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",Gamma:"\u0393",Delta:"\u0394",Theta:"\u0398",Lambda:"\u039B",Xi:"\u039E",Pi:"\u03A0",Sigma:"\u03A3",Phi:"\u03A6",Psi:"\u03A8",Omega:"\u03A9",pm:"\xB1",mp:"\u2213",times:"\xD7",div:"\xF7",cdot:"\u22C5",neq:"\u2260",leq:"\u2264",geq:"\u2265",approx:"\u2248",equiv:"\u2261",propto:"\u221D",infty:"\u221E",partial:"\u2202",nabla:"\u2207",to:"\u2192",rightarrow:"\u2192",leftarrow:"\u2190",Rightarrow:"\u21D2",Leftrightarrow:"\u21D4",in:"\u2208",notin:"\u2209",subset:"\u2282",subseteq:"\u2286",cup:"\u222A",cap:"\u2229",emptyset:"\u2205",forall:"\u2200",exists:"\u2203",neg:"\xAC",land:"\u2227",lor:"\u2228",dots:"\u2026",ldots:"\u2026",cdots:"\u22EF",langle:"\u27E8",rangle:"\u27E9",lfloor:"\u230A",rfloor:"\u230B",lceil:"\u2308",rceil:"\u2309",quad:" ",",":" ",";":" "},te=/^(sin|cos|tan|cot|sec|csc|sinh|cosh|tanh|log|ln|lg|exp|det|dim|gcd|arg|max|min|sup|inf)$/;function re(r){var t=String(r||"").trim();if(!t)return"";var e=0;function n(l){return l?"<m:r><m:t>"+P(l)+"</m:t></m:r>":""}function a(){return d(),t.charAt(e)==="{"?(e++,p("}")):i()}function d(){for(;e<t.length&&/\s/.test(t.charAt(e));)e++}function i(){if(d(),t.charAt(e)==="\\")return c();var l=t.charAt(e++);return n(l)}function p(l){for(var u="",o=0;e<t.length;){var f=t.charAt(e);if(f==="{"&&o++,f===l&&o===0){e++;break}f===l&&o--,u+=w()}return u}function c(){e++;var l=/^[A-Za-z]+/.exec(t.slice(e)),u=l?l[0]:t.charAt(e);switch(e+=u.length,u){case"frac":case"dfrac":case"tfrac":return"<m:f><m:fPr/><m:num>"+a()+"</m:num><m:den>"+a()+"</m:den></m:f>";case"sqrt":{d();var o="";return t.charAt(e)==="["&&(e++,o=p("]")),'<m:rad><m:radPr><m:degHide m:val="'+(o?"0":"1")+'"/></m:radPr><m:deg>'+o+"</m:deg><m:e>"+a()+"</m:e></m:rad>"}case"sum":case"prod":case"int":case"oint":case"bigcup":case"bigcap":{for(var f={sum:"\u2211",prod:"\u220F",int:"\u222B",oint:"\u222E",bigcup:"\u22C3",bigcap:"\u22C2"}[u],g="",x="",T=0;T<2;T++)if(d(),t.charAt(e)==="_")e++,g=a();else if(t.charAt(e)==="^")e++,x=a();else break;return'<m:nary><m:naryPr><m:chr m:val="'+f+'"/><m:subHide m:val="'+(g?"0":"1")+'"/><m:supHide m:val="'+(x?"0":"1")+'"/></m:naryPr><m:sub>'+g+"</m:sub><m:sup>"+x+"</m:sup><m:e>"+m()+"</m:e></m:nary>"}case"left":{for(var b=v(),y="",A=0;e<t.length;){if(t.slice(e,e+5)==="\\left"&&A++,t.slice(e,e+6)==="\\right"){if(A===0){e+=6;var S=v();return h(b,S,y)}A--}y+=w()}return h(b,")",y)}case"right":return v(),"";case"lim":{d();var D="";return t.charAt(e)==="_"&&(e++,D=a()),"<m:limLow><m:e>"+n("lim")+"</m:e><m:lim>"+D+"</m:lim></m:limLow>"}case"operatorname":return"<m:func><m:funcPr/><m:fName>"+a()+"</m:fName><m:e>"+a()+"</m:e></m:func>";case"hat":case"vec":case"tilde":case"bar":case"overline":case"dot":case"ddot":{var E={hat:"\u0302",vec:"\u20D7",tilde:"\u0303",dot:"\u0307",ddot:"\u0308"}[u];return u==="bar"||u==="overline"?'<m:bar><m:barPr><m:pos m:val="top"/></m:barPr><m:e>'+a()+"</m:e></m:bar>":'<m:acc><m:accPr><m:chr m:val="'+E+'"/></m:accPr><m:e>'+a()+"</m:e></m:acc>"}case"underline":return'<m:bar><m:barPr><m:pos m:val="bot"/></m:barPr><m:e>'+a()+"</m:e></m:bar>";case"boxed":return"<m:borderBox><m:e>"+a()+"</m:e></m:borderBox>";case"text":case"mathrm":case"mathbf":case"mathit":return a();case"\\":return n(" ");default:return te.test(u)?"<m:func><m:funcPr/><m:fName>"+n(u)+"</m:fName><m:e>"+a()+"</m:e></m:func>":z[u]!==void 0?n(z[u]):n(u)}}function v(){if(d(),t.charAt(e)==="\\"){e++;var l=/^[A-Za-z]+|^./.exec(t.slice(e)),u=l?l[0]:"";return e+=u.length,z[u]||u}return t.charAt(e++)}function h(l,u,o){return'<m:d><m:dPr><m:begChr m:val="'+P(l)+'"/><m:endChr m:val="'+P(u)+'"/></m:dPr><m:e>'+o+"</m:e></m:d>"}function m(){for(var l="";e<t.length&&t.charAt(e)!=="}";)l+=w();return l}function w(){if(d(),e>=t.length)return"";var l=t.charAt(e);if(l==="\\")return c();if(l==="{")return e++,p("}");if(l==="^"||l==="_"){e++;var u=a();return l==="^"?"<m:sSup><m:sSupPr/><m:e>"+n("")+"</m:e><m:sup>"+u+"</m:sup></m:sSup>":"<m:sSub><m:sSubPr/><m:e>"+n("")+"</m:e><m:sub>"+u+"</m:sub></m:sSub>"}for(var o="";e<t.length&&!/[\\{}^_]/.test(t.charAt(e));)o+=t.charAt(e++);if((t.charAt(e)==="^"||t.charAt(e)==="_")&&o){var f=o.slice(-1);o=o.slice(0,-1);var g=t.charAt(e);e++;var x=a();d();var T="";if((t.charAt(e)==="^"||t.charAt(e)==="_")&&t.charAt(e)!==g){var b=t.charAt(e);e++,T=a()}var y=n(o);return T?y+"<m:sSubSup><m:sSubSupPr/><m:e>"+n(f)+"</m:e><m:sub>"+(g==="_"?x:T)+"</m:sub><m:sup>"+(g==="^"?x:T)+"</m:sup></m:sSubSup>":y+(g==="^"?"<m:sSup><m:sSupPr/><m:e>"+n(f)+"</m:e><m:sup>"+x+"</m:sup></m:sSup>":"<m:sSub><m:sSubPr/><m:e>"+n(f)+"</m:e><m:sub>"+x+"</m:sub></m:sSub>")}return n(o)}for(var s="";e<t.length;)s+=w();return"<m:oMath>"+s+"</m:oMath>"}function ne(r,t){var e="",n={n:1},a={bold:!1,italic:!1,underline:!1,strike:!1,sizeHalfPoints:0,color:null,highlight:null,vertAlign:null,mono:!1};function d(m){if(!m||!m.style)return 0;var w=m.style.marginLeft||m.style.paddingLeft||"",s=/^\s*(-?[\d.]+)\s*([a-z%]*)\s*$/i.exec(w);if(!s)return 0;var l=parseFloat(s[1]);if(!l||l<=0)return 0;var u=(s[2]||"px").toLowerCase(),o=u==="px"?l:u==="pt"?l*(4/3):u==="in"?l*96:u==="cm"?l*37.795:u==="mm"?l*3.7795:u==="em"||u==="rem"?l*16:0;return Math.round(o*15)}function i(m,w,s){s=s||{};var l="";if(s.heading&&(l+='<w:pStyle w:val="Heading'+s.heading+'"/>'),s.quote&&(l+='<w:pStyle w:val="Quote"/><w:ind w:left="720"/>'),s.pre&&(l+='<w:pStyle w:val="Code"/>'),s.numId&&(l+='<w:numPr><w:ilvl w:val="'+(s.level||0)+'"/><w:numId w:val="'+s.numId+'"/></w:numPr>'),s.pageBreakBefore&&(l+="<w:pageBreakBefore/>"),!s.quote){var u=d(m);u>0&&(l+='<w:ind w:left="'+u+'"/>')}var o=m&&m.style?m.style.textAlign:"";o==="center"||o==="right"?l+='<w:jc w:val="'+o+'"/>':o==="justify"&&(l+='<w:jc w:val="both"/>');var f=m?R(m,w,t,n):"";return"<w:p>"+(l?"<w:pPr>"+l+"</w:pPr>":"")+f+"</w:p>"}function p(m,w,s,l){var u=m.tagName.toLowerCase()==="ol",o=++t.numSeq;t.numbering[o]=u?"decimal":"bullet";for(var f="",g=0;g<m.childNodes.length;g++){var x=m.childNodes[g];if(!(x.nodeType!==1||x.tagName.toLowerCase()!=="li")){for(var T=x.ownerDocument.createElement("li"),b=0;b<x.childNodes.length;b++){var y=x.childNodes[b];y.nodeType===1&&/^(ul|ol)$/.test(y.tagName.toLowerCase())||T.appendChild(y.cloneNode(!0))}f+=i(T,C(x,w),{numId:o,level:s,pageBreakBefore:l}),l=!1;for(var A=0;A<x.childNodes.length;A++){var S=x.childNodes[A];S.nodeType===1&&/^(ul|ol)$/.test(S.tagName.toLowerCase())&&(f+=p(S,w,Math.min(8,s+1),!1))}}}return f}function c(m,w){for(var s='<w:tbl><w:tblPr><w:tblW w:w="0" w:type="auto"/><w:tblBorders>'+["top","left","bottom","right","insideH","insideV"].map(function(ue){return"<w:"+ue+' w:val="single" w:sz="4" w:space="0" w:color="BFBFBF"/>'}).join("")+"</w:tblBorders></w:tblPr>",l=m.getElementsByTagName("tr"),u=0;u<l.length;u++){for(var o=[],f=0;f<l[u].childNodes.length;f++){var g=l[u].childNodes[f];if(g.nodeType===1){var x=g.tagName.toLowerCase();(x==="td"||x==="th")&&o.push({node:g,header:x==="th"})}}if(o.length){var T=o.length&&o[0].header;s+="<w:tr>"+(T?"<w:trPr><w:tblHeader/></w:trPr>":"");for(var b=0;b<o.length;b++){var y=parseInt(o[b].node.getAttribute("colspan")||"1",10)||1,A=C(o[b].node,w);o[b].header&&(A.bold=!0);for(var S="",D=o[b].node.childNodes,E=!1,B=0;B<D.length;B++)if(D[B].nodeType===1&&/^(p|div|ul|ol|table|h[1-6]|blockquote)$/.test(D[B].tagName.toLowerCase())){E=!0;break}S=E?v(o[b].node,A):i(o[b].node,A,{}),S||(S="<w:p/>"),s+="<w:tc><w:tcPr>"+(y>1?'<w:gridSpan w:val="'+y+'"/>':"")+(o[b].header?'<w:shd w:val="clear" w:color="auto" w:fill="F1F3F7"/>':"")+"</w:tcPr>"+S+"</w:tc>"}s+="</w:tr>"}}return s+"</w:tbl><w:p/>"}function v(m,w){for(var s="",l=!1,u=0;u<m.childNodes.length;u++){var o=m.childNodes[u];if(o.nodeType===3){(o.nodeValue||"").trim()&&(s+="<w:p>"+M(o.nodeValue.replace(/\s+/g," "),w,!1)+"</w:p>");continue}if(o.nodeType===1){var f=o.tagName.toLowerCase();if(!(f==="script"||f==="style"||f==="noscript")&&!(o.classList&&(o.classList.contains("rte-footnotes")||o.classList.contains("rte-fn-note")))){if((o.getAttribute("data-rte-page-break")!==null||/always|page/.test(o.style&&(o.style.pageBreakBefore||o.style.breakBefore)||""))&&(l=!0),f==="hr"){s+='<w:p><w:pPr><w:pBdr><w:bottom w:val="single" w:sz="6" w:space="1" w:color="C8CDD4"/></w:pBdr></w:pPr></w:p>';continue}if(f==="ul"||f==="ol"){s+=p(o,w,0,l),l=!1;continue}if(f==="table"){s+=c(o,w);continue}if(H[f]){s+=i(o,C(o,w),{heading:H[f],pageBreakBefore:l}),l=!1;continue}if(f==="blockquote"){s+=i(o,C(o,w),{quote:!0,pageBreakBefore:l}),l=!1;continue}if(f==="pre"){s+=i(o,C(o,w),{pre:!0,pageBreakBefore:l}),l=!1;continue}if(f==="p"||f==="div"||f==="section"||f==="article"||f==="figure"||f==="address"){if(h(o)){s+=v(o,C(o,w));continue}s+=i(o,C(o,w),{pageBreakBefore:l}),l=!1;continue}s+=i(o,C(o,w),{pageBreakBefore:l}),l=!1}}}return s}function h(m){for(var w=0;w<m.childNodes.length;w++){var s=m.childNodes[w];if(s.nodeType===1&&/^(p|div|ul|ol|table|h[1-6]|blockquote|pre|hr|section|article)$/.test(s.tagName.toLowerCase()))return!0}return!1}return e=v(r,a),e||"<w:p/>"}function ae(){var r=null;try{typeof N.getDocumentPageSetup=="function"&&(r=N.getDocumentPageSetup())}catch{}r=r||{};var t={letter:[12240,15840],legal:[12240,20160],tabloid:[15840,24480],a3:[16838,23811],a4:[11906,16838],a5:[8391,11906]},e=t[String(r.format||"letter").toLowerCase()]||t.letter,n=String(r.orientation||"").toLowerCase()==="landscape",a=n?e[1]:e[0],d=n?e[0]:e[1];function i(c,v){if(typeof c=="number"&&isFinite(c))return Math.round(c*1440);var h=/^\s*(-?[\d.]+)\s*(mm|cm|in|px|pt)?\s*$/.exec(String(c||""));if(!h)return v;var m=parseFloat(h[1]);switch(h[2]){case"mm":return Math.round(m*1440/25.4);case"cm":return Math.round(m*1440/2.54);case"pt":return Math.round(m*20);case"px":return Math.round(m*15);default:return Math.round(m*1440)}}var p=r.margins||{};return'<w:sectPr><w:pgSz w:w="'+a+'" w:h="'+d+'"'+(n?' w:orient="landscape"':"")+'/><w:pgMar w:top="'+i(p.top,1440)+'" w:right="'+i(p.right,1440)+'" w:bottom="'+i(p.bottom,1440)+'" w:left="'+i(p.left,1440)+'" w:header="720" w:footer="720" w:gutter="0"/></w:sectPr>'}function $(r){return new Promise(function(t,e){try{let g=function(x,T){i.push({name:x,bytes:_(T)})};var f=g,n=document.createElement("div");n.innerHTML=N.getHTMLCode()||"",document.body.appendChild(n),n.style.cssText="position:absolute;left:-99999px;top:0;width:800px;";var a=new O,d=ne(n,a);n.parentNode.removeChild(n);var i=[],p=a.footnotes.length>0,c=a.endnotes.length>0,v=a.comments.length>0;g("[Content_Types].xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Default Extension="png" ContentType="image/png"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/><Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/>'+(p?'<Override PartName="/word/footnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"/>':"")+(c?'<Override PartName="/word/endnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"/>':"")+(v?'<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"/>':"")+'<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types>'),g("_rels/.rels",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rIdDoc" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/><Relationship Id="rIdCore" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rIdApp" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/></Relationships>');for(var h="http://schemas.openxmlformats.org/officeDocument/2006/relationships/",m='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rIdStyles" Type="'+h+'styles" Target="styles.xml"/><Relationship Id="rIdNum" Type="'+h+'numbering" Target="numbering.xml"/>'+(p?'<Relationship Id="rIdFn" Type="'+h+'footnotes" Target="footnotes.xml"/>':"")+(c?'<Relationship Id="rIdEn" Type="'+h+'endnotes" Target="endnotes.xml"/>':"")+(v?'<Relationship Id="rIdCm" Type="'+h+'comments" Target="comments.xml"/>':""),w=0;w<a.rels.length;w++){var s=a.rels[w];m+='<Relationship Id="'+s.id+'" Type="'+h+s.type+'" Target="'+P(s.target)+'"'+(s.mode?' TargetMode="'+s.mode+'"':"")+"/>"}g("word/_rels/document.xml.rels",m+"</Relationships>"),g("word/document.xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="'+F.w+'" xmlns:r="'+F.r+'" xmlns:m="'+F.m+'"><w:body>'+d+ae()+"</w:body></w:document>"),g("word/styles.xml",oe()),g("word/numbering.xml",ie(a)),p&&g("word/footnotes.xml",X(a.footnotes,"footnote")),c&&g("word/endnotes.xml",X(a.endnotes,"endnote")),v&&g("word/comments.xml",le(a.comments));var l=r.title||U.docxExportTitle||document.title||"Document",u=r.author||U.docxExportAuthor||"RichTextEditor";g("docProps/core.xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:title>'+P(l)+"</dc:title><dc:creator>"+P(u)+"</dc:creator><cp:lastModifiedBy>"+P(u)+'</cp:lastModifiedBy><dcterms:created xsi:type="dcterms:W3CDTF">'+new Date().toISOString().replace(/\.\d+Z$/,"Z")+"</dcterms:created></cp:coreProperties>"),g("docProps/app.xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"><Application>RichTextEditor</Application></Properties>');for(var o=0;o<a.media.length;o++)i.push({name:"word/media/"+a.media[o].name,bytes:a.media[o].bytes});j(i).then(t,e)}catch(g){e(g)}})}function oe(){for(var r="",t=1;t<=6;t++){var e=[36,30,26,24,22,20][t-1];r+='<w:style w:type="paragraph" w:styleId="Heading'+t+'"><w:name w:val="heading '+t+'"/><w:basedOn w:val="Normal"/><w:pPr><w:outlineLvl w:val="'+(t-1)+'"/><w:spacing w:before="240" w:after="120"/></w:pPr><w:rPr><w:b/><w:sz w:val="'+e+'"/><w:szCs w:val="'+e+'"/></w:rPr></w:style>'}return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="'+F.w+'"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:rPrDefault></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/></w:style>'+r+'<w:style w:type="paragraph" w:styleId="Quote"><w:name w:val="Quote"/><w:basedOn w:val="Normal"/><w:rPr><w:i/><w:color w:val="4A5568"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Code"><w:name w:val="Code"/><w:basedOn w:val="Normal"/><w:rPr><w:rFonts w:ascii="Consolas" w:hAnsi="Consolas"/></w:rPr></w:style></w:styles>'}function ie(r){for(var t="",e="",n=Object.keys(r.numbering),a=0;a<n.length;a++){for(var d=n[a],i=r.numbering[d],p="",c=0;c<9;c++)p+='<w:lvl w:ilvl="'+c+'"><w:start w:val="1"/><w:numFmt w:val="'+(i==="bullet"?"bullet":"decimal")+'"/><w:lvlText w:val="'+(i==="bullet"?"\uF0B7":"%"+(c+1)+".")+'"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="'+720*(c+1)+'" w:hanging="360"/></w:pPr>'+(i==="bullet"?'<w:rPr><w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/></w:rPr>':"")+"</w:lvl>";t+='<w:abstractNum w:abstractNumId="'+d+'">'+p+"</w:abstractNum>",e+='<w:num w:numId="'+d+'"><w:abstractNumId w:val="'+d+'"/></w:num>'}return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:numbering xmlns:w="'+F.w+'">'+t+e+"</w:numbering>"}function X(r,t){for(var e="<w:"+t+' w:type="separator" w:id="-1"><w:p><w:r><w:separator/></w:r></w:p></w:'+t+"><w:"+t+' w:type="continuationSeparator" w:id="0"><w:p><w:r><w:continuationSeparator/></w:r></w:p></w:'+t+">",n=0;n<r.length;n++)e+="<w:"+t+' w:id="'+r[n].id+'"><w:p><w:r><w:rPr><w:vertAlign w:val="superscript"/></w:rPr><w:'+t+'Ref/></w:r><w:r><w:t xml:space="preserve"> '+P(r[n].text)+"</w:t></w:r></w:p></w:"+t+">";return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:'+t+'s xmlns:w="'+F.w+'">'+e+"</w:"+t+"s>"}function le(r){for(var t="",e=0;e<r.length;e++){var n=r[e];t+='<w:comment w:id="'+n.id+'" w:author="'+P(n.author)+'" w:initials="'+P(n.initials)+'" w:date="'+new Date().toISOString().replace(/\.\d+Z$/,"Z")+'"><w:p><w:r><w:t xml:space="preserve">'+P(n.text)+"</w:t></w:r></w:p></w:comment>"}return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments xmlns:w="'+F.w+'">'+t+"</w:comments>"}function V(r){return!r||typeof r!="string"?"":r.replace(/\.docx?$/i,"").replace(/[\\/:*?"<>|]+/g,"").trim().slice(0,120)}function se(){var r=new Date;function t(e){return(e<10?"0":"")+e}return"Export-"+String(r.getFullYear()).slice(2)+t(r.getMonth()+1)+t(r.getDate())+"-"+t(r.getHours())+t(r.getMinutes())+t(r.getSeconds())}function me(r,t){var e=URL.createObjectURL(r),n=document.createElement("a");return n.href=e,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),setTimeout(function(){URL.revokeObjectURL(e)},4e3),t}}
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_docxexport=RTE_Plugin_DocxExport,typeof RTE_DefaultConfig.docxExport>"u"&&(RTE_DefaultConfig.docxExport=!0);function RTE_Plugin_DocxExport(){var Q=this,X,U;Q.PluginName="DocxExport",Q.InitConfig=function(r){X=r},Q.InitEditor=function(r){U=r,X.docxExport!==!1&&(U.getDocxBlob=function(t){return ne(t||{})},U.exportToDocx=function(t,e){return ne(e||{}).then(function(n){var a=ie(t)||ie(X.docxExportFileName)||Ce();return Se(n,a+".docx")})},U.attachEvent("exec_command_exportdocx",function(t){t.returnValue=!0,t.stopBubble=!0;try{U.exportToDocx().catch(function(e){window.console&&console.error("docxexport:",e)})}catch(e){window.console&&console.error("docxexport:",e)}}))};var $={w:"http://schemas.openxmlformats.org/wordprocessingml/2006/main",r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",m:"http://schemas.openxmlformats.org/officeDocument/2006/math"};function T(r){return String(r??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g,"")}var le=(function(){var r=[],t,e,n;for(e=0;e<256;e++){for(t=e,n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;r[e]=t>>>0}return r})();function se(r){for(var t=4294967295,e=0;e<r.length;e++)t=le[(t^r[e])&255]^t>>>8;return(t^4294967295)>>>0}function ee(r){return new TextEncoder().encode(r)}function ue(r){if(typeof CompressionStream>"u")return Promise.resolve(null);try{var t=new CompressionStream("deflate-raw"),e=t.writable.getWriter();return e.write(r),e.close(),new Response(t.readable).arrayBuffer().then(function(n){return new Uint8Array(n)})}catch{return Promise.resolve(null)}}function me(r){var t=r.map(function(e){return ue(e.bytes).then(function(n){var a=n&&n.length<e.bytes.length;return{name:e.name,raw:e.bytes,data:a?n:e.bytes,method:a?8:0}})});return Promise.all(t).then(function(e){for(var n=[],a=[],c=0,s=0;s<e.length;s++){var d=e[s],p=ee(d.name),v=se(d.raw),x=new DataView(new ArrayBuffer(30));x.setUint32(0,67324752,!0),x.setUint16(4,20,!0),x.setUint16(6,2048,!0),x.setUint16(8,d.method,!0),x.setUint32(14,v,!0),x.setUint32(18,d.data.length,!0),x.setUint32(22,d.raw.length,!0),x.setUint16(26,p.length,!0);var h=new DataView(new ArrayBuffer(46));h.setUint32(0,33639248,!0),h.setUint16(4,20,!0),h.setUint16(6,20,!0),h.setUint16(8,2048,!0),h.setUint16(10,d.method,!0),h.setUint32(16,v,!0),h.setUint32(20,d.data.length,!0),h.setUint32(24,d.raw.length,!0),h.setUint16(28,p.length,!0),h.setUint32(42,c,!0),n.push(new Uint8Array(x.buffer),p,d.data),a.push(new Uint8Array(h.buffer),p),c+=30+p.length+d.data.length}var C=a.reduce(function(b,i){return b+i.length},0),P=new DataView(new ArrayBuffer(22));return P.setUint32(0,101010256,!0),P.setUint16(8,e.length,!0),P.setUint16(10,e.length,!0),P.setUint32(12,C,!0),P.setUint32(16,c,!0),new Blob(n.concat(a,[new Uint8Array(P.buffer)]),{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"})})}function te(){this.rels=[],this.media=[],this.footnotes=[],this.endnotes=[],this.comments=[],this.numbering={},this.relSeq=0,this.noteSeq=1,this.commentSeq=0,this.numSeq=0}te.prototype.rel=function(r,t,e){var n="rId"+ ++this.relSeq;return this.rels.push({id:n,type:r,target:t,mode:e}),n};var re={h1:1,h2:2,h3:3,h4:4,h5:5,h6:6};function N(r,t){var e={bold:t.bold,italic:t.italic,underline:t.underline,strike:t.strike,sizeHalfPoints:t.sizeHalfPoints,color:t.color,highlight:t.highlight,vertAlign:t.vertAlign,mono:t.mono,font:t.font,smallCaps:t.smallCaps,spacingTw:t.spacingTw,lang:t.lang};r.getAttribute&&r.getAttribute("lang")&&(e.lang=String(r.getAttribute("lang")).replace(/[^A-Za-z0-9-]/g,""));var n=r.tagName?r.tagName.toLowerCase():"";(n==="b"||n==="strong")&&(e.bold=!0),(n==="i"||n==="em")&&(e.italic=!0),n==="u"&&(e.underline=!0),(n==="s"||n==="strike")&&(e.strike=!0),n==="sup"&&(e.vertAlign="superscript"),n==="sub"&&(e.vertAlign="subscript"),(n==="code"||n==="kbd"||n==="samp"||n==="pre")&&(e.mono=!0),n==="mark"&&(e.highlight=e.highlight||"FFFF00");var a=r.style;if(a){/bold|^[6-9]00$/.test(a.fontWeight||"")&&(e.bold=!0),a.fontStyle==="italic"&&(e.italic=!0);var c=a.textDecorationLine||a.textDecoration||"";if(c.indexOf("underline")>=0&&(e.underline=!0),c.indexOf("line-through")>=0&&(e.strike=!0),a.color){var s=ae(a.color);s&&(e.color=s)}if(a.backgroundColor){var d=ae(a.backgroundColor);d&&(e.highlight=d)}if(a.fontFamily){var p=String(a.fontFamily).split(",")[0].replace(/^\s*['"]?|['"]?\s*$/g,"");p&&(e.font=p)}if((/small-caps/.test(a.fontVariant||"")||/small-caps/.test(a.fontVariantCaps||""))&&(e.smallCaps=!0),a.letterSpacing&&a.letterSpacing!=="normal"){var v=/^\s*(-?[\d.]+)\s*(px|pt|em)?\s*$/.exec(a.letterSpacing);if(v){var x=parseFloat(v[1])*(v[2]==="pt"?1.3333333333333333:v[2]==="em"?16:1);e.spacingTw=Math.round(x*15)}}if(a.fontSize){var h=ce(a.fontSize);h&&(e.sizeHalfPoints=Math.round(h*2))}}return e}function ae(r){var t=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(String(r).replace(/\s/g,""));if(t){var e=t[1];return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),e.toUpperCase()}var n=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i.exec(String(r));if(!n)return null;function a(c){var s=Number(c).toString(16).toUpperCase();return s.length<2?"0"+s:s}return a(n[1])+a(n[2])+a(n[3])}function ce(r){var t=/^\s*([\d.]+)\s*(px|pt|em|rem|%)?\s*$/.exec(String(r));if(!t)return null;var e=parseFloat(t[1]);if(!isFinite(e))return null;switch(t[2]){case"pt":return e;case"em":case"rem":return e*11;case"%":return e/100*11;default:return e*.75}}function Y(r){var t="",e=r.mono?"Consolas":r.font||"";return e&&(t+='<w:rFonts w:ascii="'+T(e)+'" w:hAnsi="'+T(e)+'"/>'),r.bold&&(t+="<w:b/>"),r.italic&&(t+="<w:i/>"),r.smallCaps&&(t+="<w:smallCaps/>"),r.underline&&(t+='<w:u w:val="single"/>'),r.strike&&(t+="<w:strike/>"),r.color&&(t+='<w:color w:val="'+r.color+'"/>'),r.spacingTw&&(t+='<w:spacing w:val="'+r.spacingTw+'"/>'),r.highlight&&(t+='<w:shd w:val="clear" w:color="auto" w:fill="'+r.highlight+'"/>'),r.vertAlign&&(t+='<w:vertAlign w:val="'+r.vertAlign+'"/>'),r.sizeHalfPoints&&(t+='<w:sz w:val="'+r.sizeHalfPoints+'"/><w:szCs w:val="'+r.sizeHalfPoints+'"/>'),r.lang&&(t+='<w:lang w:val="'+r.lang+'"/>'),t?"<w:rPr>"+t+"</w:rPr>":""}function j(r,t,e){if(!r)return"";for(var n=String(r).split(`
|
|
2
|
+
`),a="",c=0;c<n.length;c++)if(c&&(a+="<w:r>"+Y(t)+"<w:br/></w:r>"),!!n[c]){var s=e?"w:delText":"w:t";a+="<w:r>"+Y(t)+"<"+s+' xml:space="preserve">'+T(n[c])+"</"+s+">",a+="</w:r>"}return a}function pe(r){var t=r.getAttribute("data-author")||r.getAttribute("data-comment-author")||"RichTextEditor",e=r.getAttribute("data-date")||new Date().toISOString().replace(/\.\d+Z$/,"Z");return' w:author="'+T(t)+'" w:date="'+T(e)+'"'}function Z(r,t,e,n){for(var a="",c=0;c<r.childNodes.length;c++){var s=r.childNodes[c];if(s.nodeType===3){var d=(s.nodeValue||"").replace(/[\r\n\t]+/g," ");d&&(a+=j(d,t,!1));continue}if(s.nodeType===1){var p=s.tagName.toLowerCase();if(!(p==="script"||p==="style")){if(p==="br"){a+="<w:r>"+Y(t)+"<w:br/></w:r>";continue}if(s.getAttribute&&s.getAttribute("data-tex")){a+=he(s.getAttribute("data-tex"));continue}if((p==="sup"||p==="span")&&s.getAttribute("data-footnote")){a+=J(e,"footnote",s.getAttribute("data-footnote"));continue}if((p==="sup"||p==="span")&&s.getAttribute("data-endnote")){a+=J(e,"endnote",s.getAttribute("data-endnote"));continue}if(s.classList&&s.classList.contains("rte-fn-ref")){var v=s.getAttribute("data-fn-id"),x=v?fe(r.ownerDocument,v):"";a+=J(e,"footnote",x||s.textContent||"");continue}if(p==="img"){a+=de(s,e);continue}var h=N(s,t);if(p==="a"&&s.getAttribute("href")){var C=s.getAttribute("href"),P=Z(s,h,e,n);if(C.charAt(0)==="#")a+='<w:hyperlink w:anchor="'+T(C.slice(1))+'">'+P+"</w:hyperlink>";else{var b=e.rel("hyperlink",C,"External");a+='<w:hyperlink r:id="'+b+'">'+P+"</w:hyperlink>"}continue}if(p==="ins"||p==="del"){var i=p==="del",m="";(function o(w,u){for(var f=0;f<w.childNodes.length;f++){var g=w.childNodes[f];if(g.nodeType===3){m+=j((g.nodeValue||"").replace(/[\r\n\t]+/g," "),u,i);continue}g.nodeType===1&&o(g,N(g,u))}})(s,h),a+="<w:"+p+' w:id="'+n.n+++'"'+pe(s)+">"+m+"</w:"+p+">";continue}if(s.getAttribute&&s.getAttribute("data-comment")){var l=e.commentSeq++;e.comments.push({id:l,author:s.getAttribute("data-comment-author")||"RichTextEditor user",initials:s.getAttribute("data-comment-initials")||"RTE",text:s.getAttribute("data-comment")}),a+='<w:commentRangeStart w:id="'+l+'"/>'+Z(s,h,e,n)+'<w:commentRangeEnd w:id="'+l+'"/><w:r><w:commentReference w:id="'+l+'"/></w:r>';continue}a+=Z(s,h,e,n)}}}return a}function fe(r,t){try{var e=r.querySelector('.rte-fn-note[data-fn-id="'+t+'"]');if(!e)return"";for(var n=e.cloneNode(!0),a=n.querySelectorAll(".rte-fn-back"),c=0;c<a.length;c++)a[c].parentNode.removeChild(a[c]);return(n.textContent||"").replace(/\s+/g," ").trim()}catch{return""}}function J(r,t,e){var n=r.noteSeq++;return(t==="endnote"?r.endnotes:r.footnotes).push({id:n,text:e||""}),'<w:r><w:rPr><w:vertAlign w:val="superscript"/></w:rPr><w:'+t+'Reference w:id="'+n+'"/></w:r>'}function de(r,t){var e=we(r);if(!e)return"";var n="image"+(t.media.length+1)+".png";t.media.push({name:n,bytes:e.bytes});var a=t.rel("image","media/"+n),c=G(r.getAttribute("width"))||G(r.style&&r.style.width),s=G(r.getAttribute("height"))||G(r.style&&r.style.height);c&&!s&&(s=c*e.height/e.width),s&&!c&&(c=s*e.width/e.height);var d=Math.round((c||e.width)*914400/96),p=Math.round((s||e.height)*914400/96),v=t.media.length;return'<w:r><w:drawing><wp:inline distT="0" distB="0" distL="0" distR="0" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"><wp:extent cx="'+d+'" cy="'+p+'"/><wp:docPr id="'+v+'" name="Picture '+v+'" descr="'+T(r.getAttribute("alt")||"")+'"/><a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:nvPicPr><pic:cNvPr id="'+v+'" name="Picture '+v+'"/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip r:embed="'+a+'"/><a:stretch><a:fillRect/></a:stretch></pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="'+d+'" cy="'+p+'"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic></a:graphicData></a:graphic></wp:inline></w:drawing></w:r>'}function G(r){var t=/^\s*([\d.]+)\s*(px)?\s*$/.exec(r==null?"":String(r));return t?parseFloat(t[1]):0}function we(r){try{var t=r.naturalWidth||r.width,e=r.naturalHeight||r.height;if(!t||!e)return null;var n=Math.min(1,1600/Math.max(t,e)),a=Math.max(1,Math.round(t*n)),c=Math.max(1,Math.round(e*n)),s=document.createElement("canvas");s.width=a,s.height=c,s.getContext("2d").drawImage(r,0,0,a,c);var d=s.toDataURL("image/png"),p=d.indexOf(",");if(p<0)return null;for(var v=atob(d.slice(p+1)),x=new Uint8Array(v.length),h=0;h<v.length;h++)x[h]=v.charCodeAt(h);return{bytes:x,width:a,height:c}}catch{return null}}var K={alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",pi:"\u03C0",rho:"\u03C1",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",varphi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",Gamma:"\u0393",Delta:"\u0394",Theta:"\u0398",Lambda:"\u039B",Xi:"\u039E",Pi:"\u03A0",Sigma:"\u03A3",Phi:"\u03A6",Psi:"\u03A8",Omega:"\u03A9",pm:"\xB1",mp:"\u2213",times:"\xD7",div:"\xF7",cdot:"\u22C5",neq:"\u2260",leq:"\u2264",geq:"\u2265",approx:"\u2248",equiv:"\u2261",propto:"\u221D",infty:"\u221E",partial:"\u2202",nabla:"\u2207",to:"\u2192",rightarrow:"\u2192",leftarrow:"\u2190",Rightarrow:"\u21D2",Leftrightarrow:"\u21D4",in:"\u2208",notin:"\u2209",subset:"\u2282",subseteq:"\u2286",cup:"\u222A",cap:"\u2229",emptyset:"\u2205",forall:"\u2200",exists:"\u2203",neg:"\xAC",land:"\u2227",lor:"\u2228",dots:"\u2026",ldots:"\u2026",cdots:"\u22EF",langle:"\u27E8",rangle:"\u27E9",lfloor:"\u230A",rfloor:"\u230B",lceil:"\u2308",rceil:"\u2309",quad:" ",",":" ",";":" "},ge=/^(sin|cos|tan|cot|sec|csc|sinh|cosh|tanh|log|ln|lg|exp|det|dim|gcd|arg|max|min|sup|inf)$/;function he(r){var t=String(r||"").trim();if(!t)return"";var e=0;function n(b){return b?"<m:r><m:t>"+T(b)+"</m:t></m:r>":""}function a(){return c(),t.charAt(e)==="{"?(e++,d("}")):s()}function c(){for(;e<t.length&&/\s/.test(t.charAt(e));)e++}function s(){if(c(),t.charAt(e)==="\\")return p();var b=t.charAt(e++);return n(b)}function d(b){for(var i="",m=0;e<t.length;){var l=t.charAt(e);if(l==="{"&&m++,l===b&&m===0){e++;break}l===b&&m--,i+=C()}return i}function p(){e++;var b=/^[A-Za-z]+/.exec(t.slice(e)),i=b?b[0]:t.charAt(e);switch(e+=i.length,i){case"frac":case"dfrac":case"tfrac":return"<m:f><m:fPr/><m:num>"+a()+"</m:num><m:den>"+a()+"</m:den></m:f>";case"sqrt":{c();var m="";return t.charAt(e)==="["&&(e++,m=d("]")),'<m:rad><m:radPr><m:degHide m:val="'+(m?"0":"1")+'"/></m:radPr><m:deg>'+m+"</m:deg><m:e>"+a()+"</m:e></m:rad>"}case"sum":case"prod":case"int":case"oint":case"bigcup":case"bigcap":{for(var l={sum:"\u2211",prod:"\u220F",int:"\u222B",oint:"\u222E",bigcup:"\u22C3",bigcap:"\u22C2"}[i],o="",w="",u=0;u<2;u++)if(c(),t.charAt(e)==="_")e++,o=a();else if(t.charAt(e)==="^")e++,w=a();else break;return'<m:nary><m:naryPr><m:chr m:val="'+l+'"/><m:subHide m:val="'+(o?"0":"1")+'"/><m:supHide m:val="'+(w?"0":"1")+'"/></m:naryPr><m:sub>'+o+"</m:sub><m:sup>"+w+"</m:sup><m:e>"+h()+"</m:e></m:nary>"}case"left":{for(var f=v(),g="",y=0;e<t.length;){if(t.slice(e,e+5)==="\\left"&&y++,t.slice(e,e+6)==="\\right"){if(y===0){e+=6;var A=v();return x(f,A,g)}y--}g+=C()}return x(f,")",g)}case"right":return v(),"";case"lim":{c();var S="";return t.charAt(e)==="_"&&(e++,S=a()),"<m:limLow><m:e>"+n("lim")+"</m:e><m:lim>"+S+"</m:lim></m:limLow>"}case"operatorname":return"<m:func><m:funcPr/><m:fName>"+a()+"</m:fName><m:e>"+a()+"</m:e></m:func>";case"hat":case"vec":case"tilde":case"bar":case"overline":case"dot":case"ddot":{var R={hat:"\u0302",vec:"\u20D7",tilde:"\u0303",dot:"\u0307",ddot:"\u0308"}[i];return i==="bar"||i==="overline"?'<m:bar><m:barPr><m:pos m:val="top"/></m:barPr><m:e>'+a()+"</m:e></m:bar>":'<m:acc><m:accPr><m:chr m:val="'+R+'"/></m:accPr><m:e>'+a()+"</m:e></m:acc>"}case"underline":return'<m:bar><m:barPr><m:pos m:val="bot"/></m:barPr><m:e>'+a()+"</m:e></m:bar>";case"boxed":return"<m:borderBox><m:e>"+a()+"</m:e></m:borderBox>";case"text":case"mathrm":case"mathbf":case"mathit":return a();case"\\":return n(" ");default:return ge.test(i)?"<m:func><m:funcPr/><m:fName>"+n(i)+"</m:fName><m:e>"+a()+"</m:e></m:func>":K[i]!==void 0?n(K[i]):n(i)}}function v(){if(c(),t.charAt(e)==="\\"){e++;var b=/^[A-Za-z]+|^./.exec(t.slice(e)),i=b?b[0]:"";return e+=i.length,K[i]||i}return t.charAt(e++)}function x(b,i,m){return'<m:d><m:dPr><m:begChr m:val="'+T(b)+'"/><m:endChr m:val="'+T(i)+'"/></m:dPr><m:e>'+m+"</m:e></m:d>"}function h(){for(var b="";e<t.length&&t.charAt(e)!=="}";)b+=C();return b}function C(){if(c(),e>=t.length)return"";var b=t.charAt(e);if(b==="\\")return p();if(b==="{")return e++,d("}");if(b==="^"||b==="_"){e++;var i=a();return b==="^"?"<m:sSup><m:sSupPr/><m:e>"+n("")+"</m:e><m:sup>"+i+"</m:sup></m:sSup>":"<m:sSub><m:sSubPr/><m:e>"+n("")+"</m:e><m:sub>"+i+"</m:sub></m:sSub>"}for(var m="";e<t.length&&!/[\\{}^_]/.test(t.charAt(e));)m+=t.charAt(e++);if((t.charAt(e)==="^"||t.charAt(e)==="_")&&m){var l=m.slice(-1);m=m.slice(0,-1);var o=t.charAt(e);e++;var w=a();c();var u="";if((t.charAt(e)==="^"||t.charAt(e)==="_")&&t.charAt(e)!==o){var f=t.charAt(e);e++,u=a()}var g=n(m);return u?g+"<m:sSubSup><m:sSubSupPr/><m:e>"+n(l)+"</m:e><m:sub>"+(o==="_"?w:u)+"</m:sub><m:sup>"+(o==="^"?w:u)+"</m:sup></m:sSubSup>":g+(o==="^"?"<m:sSup><m:sSupPr/><m:e>"+n(l)+"</m:e><m:sup>"+w+"</m:sup></m:sSup>":"<m:sSub><m:sSubPr/><m:e>"+n(l)+"</m:e><m:sub>"+w+"</m:sub></m:sSub>")}return n(m)}for(var P="";e<t.length;)P+=C();return"<m:oMath>"+P+"</m:oMath>"}function ve(r,t){var e="",n={n:1},a={bold:!1,italic:!1,underline:!1,strike:!1,sizeHalfPoints:0,color:null,highlight:null,vertAlign:null,mono:!1};function c(i){var m=/^\s*(-?[\d.]+)\s*(px|pt|in|cm|mm|em|rem)?\s*$/i.exec(i==null?"":String(i));if(!m)return 0;var l=parseFloat(m[1]),o=(m[2]||"px").toLowerCase(),w=o==="px"?l:o==="pt"?l*4/3:o==="in"?l*96:o==="cm"?l*37.795:o==="mm"?l*3.7795:l*16;return Math.round(w*15)}function s(i){if(!i||!i.style)return 0;var m=i.style.marginLeft||i.style.paddingLeft||"",l=/^\s*(-?[\d.]+)\s*([a-z%]*)\s*$/i.exec(m);if(!l)return 0;var o=parseFloat(l[1]);if(!o||o<=0)return 0;var w=(l[2]||"px").toLowerCase(),u=w==="px"?o:w==="pt"?o*(4/3):w==="in"?o*96:w==="cm"?o*37.795:w==="mm"?o*3.7795:w==="em"||w==="rem"?o*16:0;return Math.round(u*15)}function d(i,m,l){l=l||{};var o="";l.heading&&(o+='<w:pStyle w:val="Heading'+l.heading+'"/>'),l.quote&&(o+='<w:pStyle w:val="Quote"/><w:ind w:left="720"/>'),l.pre&&(o+='<w:pStyle w:val="Code"/>'),l.caption&&(o+='<w:pStyle w:val="Caption"/>'),l.numId&&(o+='<w:numPr><w:ilvl w:val="'+(l.level||0)+'"/><w:numId w:val="'+l.numId+'"/></w:numPr>'),l.pageBreakBefore&&(o+="<w:pageBreakBefore/>"),i&&i.getAttribute&&(String(i.getAttribute("dir")||"").toLowerCase()==="rtl"||i.style&&i.style.direction==="rtl")&&(o+="<w:bidi/>");var w=i&&i.style?String(i.style.lineHeight||""):"",u;if((u=/^\s*([\d.]+)\s*$/.exec(w))&&parseFloat(u[1])>0?o+='<w:spacing w:line="'+Math.round(parseFloat(u[1])*240)+'" w:lineRule="auto"/>':(u=/^\s*([\d.]+)%\s*$/.exec(w))&&parseFloat(u[1])>0?o+='<w:spacing w:line="'+Math.round(parseFloat(u[1])*2.4)+'" w:lineRule="auto"/>':(u=/^\s*([\d.]+)(px|pt)\s*$/.exec(w))&&parseFloat(u[1])>0&&(o+='<w:spacing w:line="'+Math.round(parseFloat(u[1])*(u[2]==="pt"?20:15))+'" w:lineRule="exact"/>'),!l.quote){var f=s(i),g=c(i&&i.style?i.style.textIndent:"");(f>0||g)&&(o+="<w:ind"+(f>0?' w:left="'+f+'"':"")+(g>0?' w:firstLine="'+g+'"':g<0?' w:hanging="'+-g+'"':"")+"/>")}var y=i&&i.style?i.style.textAlign:"";y==="center"||y==="right"?o+='<w:jc w:val="'+y+'"/>':y==="justify"&&(o+='<w:jc w:val="both"/>');var A=i?Z(i,m,t,n):"";return"<w:p>"+(o?"<w:pPr>"+o+"</w:pPr>":"")+A+"</w:p>"}function p(i,m,l,o){if(i.classList&&i.classList.contains("rte-task-list")){for(var w="",u=0;u<i.childNodes.length;u++){var f=i.childNodes[u];if(!(f.nodeType!==1||f.tagName.toLowerCase()!=="li")){for(var g=f.ownerDocument.createElement("p"),y=0;y<f.childNodes.length;y++){var A=f.childNodes[y];A.nodeType===1&&(/^(ul|ol)$/.test(A.tagName.toLowerCase())||A.classList&&A.classList.contains("rte-task-checkbox"))||g.appendChild(A.cloneNode(!0))}var S=f.getAttribute("data-checked")==="true";g.insertBefore(f.ownerDocument.createTextNode((S?"\u2612":"\u2610")+" "),g.firstChild),g.style.marginLeft=24*(l+1)+"px",w+=d(g,N(f,m),{pageBreakBefore:o}),o=!1;for(var R=0;R<f.childNodes.length;R++){var F=f.childNodes[R];F.nodeType===1&&/^(ul|ol)$/.test(F.tagName.toLowerCase())&&(w+=p(F,m,Math.min(8,l+1),!1))}}}return w}var L=i.tagName.toLowerCase()==="ol",H=++t.numSeq;t.numbering[H]=L?"decimal":"bullet";var E=L?parseInt(i.getAttribute("start"),10):1;if(isNaN(E)&&(E=1),E!==1&&((t.numStart||(t.numStart={}))[H]={level:l,start:E}),L){var M=String(i.style&&i.style.listStyleType||"").toLowerCase(),I=i.getAttribute("type")||"",k=/^(lower-alpha|lower-latin)$/.test(M)||I==="a"?"lowerLetter":/^(upper-alpha|upper-latin)$/.test(M)||I==="A"?"upperLetter":M==="lower-roman"||I==="i"?"lowerRoman":M==="upper-roman"||I==="I"?"upperRoman":"";k&&((t.numFmtAt||(t.numFmtAt={}))[H]={level:l,fmt:k})}for(var _="",O=0;O<i.childNodes.length;O++){var D=i.childNodes[O];if(!(D.nodeType!==1||D.tagName.toLowerCase()!=="li")){for(var B=D.ownerDocument.createElement("li"),W=0;W<D.childNodes.length;W++){var z=D.childNodes[W];z.nodeType===1&&/^(ul|ol)$/.test(z.tagName.toLowerCase())||B.appendChild(z.cloneNode(!0))}_+=d(B,N(D,m),{numId:H,level:l,pageBreakBefore:o}),o=!1;for(var q=0;q<D.childNodes.length;q++){var V=D.childNodes[q];V.nodeType===1&&/^(ul|ol)$/.test(V.tagName.toLowerCase())&&(_+=p(V,m,Math.min(8,l+1),!1))}}}return _}var v=9360;function x(i){for(var m=[],l=i.children,o=0;o<l.length;o++)if(l[o].tagName&&l[o].tagName.toLowerCase()==="colgroup")for(var w=0;w<l[o].children.length;w++)l[o].children[w].tagName.toLowerCase()==="col"&&m.push(l[o].children[w]);if(!m.length)return"";for(var u=[],f=0;f<m.length;f++){var g=m[f].style&&m[f].style.width||m[f].getAttribute("width")||"",y;if(y=/^\s*([\d.]+)%\s*$/.exec(g))u.push(Math.round(parseFloat(y[1])/100*v));else if(y=/^\s*([\d.]+)(px)?\s*$/.exec(g))u.push(Math.round(parseFloat(y[1])*15));else return""}return"<w:tblGrid>"+u.map(function(A){return'<w:gridCol w:w="'+A+'"/>'}).join("")+"</w:tblGrid>"}function h(i){var m=/^\s*([\d.]+)%\s*$/.exec(i.style&&i.style.width||i.getAttribute("width")||"");return m?'<w:tblW w:w="'+Math.round(parseFloat(m[1])*50)+'" w:type="pct"/>':'<w:tblW w:w="0" w:type="auto"/>'}function C(i,m){var l="<w:tbl><w:tblPr>"+h(i)+"<w:tblBorders>"+["top","left","bottom","right","insideH","insideV"].map(function(z){return"<w:"+z+' w:val="single" w:sz="4" w:space="0" w:color="BFBFBF"/>'}).join("")+"</w:tblBorders></w:tblPr>"+x(i),o=i.getElementsByTagName("tr"),w={};function u(z){var q=w[z];q.left--;var V=q.span;return q.left||delete w[z],"<w:tc><w:tcPr>"+(V>1?'<w:gridSpan w:val="'+V+'"/>':"")+"<w:vMerge/></w:tcPr><w:p/></w:tc>"}for(var f=0;f<o.length;f++){for(var g=[],y=0;y<o[f].childNodes.length;y++){var A=o[f].childNodes[y];if(A.nodeType===1){var S=A.tagName.toLowerCase();(S==="td"||S==="th")&&g.push({node:A,header:S==="th"})}}if(g.length){var R=g.length&&g[0].header;l+="<w:tr>"+(R?"<w:trPr><w:tblHeader/></w:trPr>":"");for(var F=0,L=0;L<g.length;L++){for(;w[F];){var H=w[F].span;l+=u(F),F+=H}var E=parseInt(g[L].node.getAttribute("colspan")||"1",10)||1,M=parseInt(g[L].node.getAttribute("rowspan")||"1",10)||1;M>1&&(w[F]={left:M-1,span:E});var I=N(g[L].node,m);g[L].header&&(I.bold=!0);for(var k="",_=g[L].node.childNodes,O=!1,D=0;D<_.length;D++)if(_[D].nodeType===1&&/^(p|div|ul|ol|table|h[1-6]|blockquote)$/.test(_[D].tagName.toLowerCase())){O=!0;break}k=O?P(g[L].node,I):d(g[L].node,I,{}),k||(k="<w:p/>"),l+="<w:tc><w:tcPr>"+(E>1?'<w:gridSpan w:val="'+E+'"/>':"")+(M>1?'<w:vMerge w:val="restart"/>':"")+(g[L].header?'<w:shd w:val="clear" w:color="auto" w:fill="F1F3F7"/>':"")+"</w:tcPr>"+k+"</w:tc>",F+=E}for(var B=F;B<F+64;B++)if(w[B]){var W=w[B].span;l+=u(B),B+=W-1}l+="</w:tr>"}}return l+"</w:tbl><w:p/>"}function P(i,m){for(var l="",o=!1,w=0;w<i.childNodes.length;w++){var u=i.childNodes[w];if(u.nodeType===3){(u.nodeValue||"").trim()&&(l+="<w:p>"+j(u.nodeValue.replace(/\s+/g," "),m,!1)+"</w:p>");continue}if(u.nodeType===1){var f=u.tagName.toLowerCase();if(!(f==="script"||f==="style"||f==="noscript")&&!(u.classList&&(u.classList.contains("rte-footnotes")||u.classList.contains("rte-fn-note")))&&!((u.getAttribute("data-rte-page-break")!==null||/always|page/.test(u.style&&(u.style.pageBreakBefore||u.style.breakBefore)||""))&&(o=!0,u.getAttribute("data-rte-page-break")!==null))){if(f==="hr"){l+='<w:p><w:pPr><w:pBdr><w:bottom w:val="single" w:sz="6" w:space="1" w:color="C8CDD4"/></w:pBdr></w:pPr></w:p>';continue}if(f==="ul"||f==="ol"){l+=p(u,m,0,o),o=!1;continue}if(f==="table"){var g=u.caption;g&&(g.textContent||"").replace(/\s+/g,"")&&(l+=d(g,N(g,m),{caption:!0})),l+=C(u,m);continue}var y=null;if(f==="figure"){for(var A=0;A<u.children.length;A++)if(u.children[A].tagName.toLowerCase()==="figcaption"){y=u.children[A];break}}if(f==="figure"&&y){var S=y,R=S.parentNode,F=S.nextSibling;R.removeChild(S);try{l+=d(u,N(u,m),{pageBreakBefore:o})}finally{R.insertBefore(S,F)}o=!1,(S.textContent||"").replace(/\s+/g,"")&&(l+=d(S,N(S,m),{caption:!0}));continue}if(re[f]){l+=d(u,N(u,m),{heading:re[f],pageBreakBefore:o}),o=!1;continue}if(f==="blockquote"){l+=d(u,N(u,m),{quote:!0,pageBreakBefore:o}),o=!1;continue}if(f==="pre"){l+=d(u,N(u,m),{pre:!0,pageBreakBefore:o}),o=!1;continue}if(f==="p"||f==="div"||f==="section"||f==="article"||f==="figure"||f==="address"){if(b(u)){l+=P(u,N(u,m));continue}l+=d(u,N(u,m),{pageBreakBefore:o}),o=!1;continue}l+=d(u,N(u,m),{pageBreakBefore:o}),o=!1}}}return l}function b(i){for(var m=0;m<i.childNodes.length;m++){var l=i.childNodes[m];if(l.nodeType===1&&/^(p|div|ul|ol|table|h[1-6]|blockquote|pre|hr|section|article)$/.test(l.tagName.toLowerCase()))return!0}return!1}return e=P(r,a),e||"<w:p/>"}function xe(){var r=null;try{typeof U.getDocumentPageSetup=="function"&&(r=U.getDocumentPageSetup())}catch{}r=r||{};var t={letter:[12240,15840],legal:[12240,20160],tabloid:[15840,24480],a3:[16838,23811],a4:[11906,16838],a5:[8391,11906]},e=t[String(r.format||"letter").toLowerCase()]||t.letter,n=String(r.orientation||"").toLowerCase()==="landscape",a=n?e[1]:e[0],c=n?e[0]:e[1];function s(p,v){if(typeof p=="number"&&isFinite(p))return Math.round(p*1440);var x=/^\s*(-?[\d.]+)\s*(mm|cm|in|px|pt)?\s*$/.exec(String(p||""));if(!x)return v;var h=parseFloat(x[1]);switch(x[2]){case"mm":return Math.round(h*1440/25.4);case"cm":return Math.round(h*1440/2.54);case"pt":return Math.round(h*20);case"px":return Math.round(h*15);default:return Math.round(h*1440)}}var d=r.margins||{};return'<w:sectPr><w:pgSz w:w="'+a+'" w:h="'+c+'"'+(n?' w:orient="landscape"':"")+'/><w:pgMar w:top="'+s(d.top,1440)+'" w:right="'+s(d.right,1440)+'" w:bottom="'+s(d.bottom,1440)+'" w:left="'+s(d.left,1440)+'" w:header="720" w:footer="720" w:gutter="0"/></w:sectPr>'}function ne(r){try{return be(r)}catch(t){return Promise.reject(t)}}function be(r){var t=document.createElement("div");t.innerHTML=U.getHTMLCode()||"";var e=U.getEditable().querySelectorAll("ol,ul"),n=t.querySelectorAll("ol,ul");if(e.length===n.length)for(var a=0;a<e.length;a++){var c=e[a].ownerDocument.defaultView.getComputedStyle(e[a]).listStyleType;c&&(n[a].style.listStyleType=c)}document.body.appendChild(t),t.style.cssText="position:absolute;left:-99999px;top:0;width:800px;";var s=[].slice.call(t.querySelectorAll("img")).filter(function(p){return!(p.complete&&p.naturalWidth)}),d=s.length?Promise.all(s.map(function(p){return new Promise(function(v){p.addEventListener("load",v),p.addEventListener("error",v),setTimeout(v,5e3)})})):Promise.resolve();return d.then(function(){return ye(t,r)})}function ye(r,t){return new Promise(function(e,n){try{let o=function(w,u){s.push({name:w,bytes:ee(u)})};var l=o,a=new te,c=ve(r,a);r.parentNode.removeChild(r);var s=[],d=a.footnotes.length>0,p=a.endnotes.length>0,v=a.comments.length>0;o("[Content_Types].xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Default Extension="png" ContentType="image/png"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/><Override PartName="/word/numbering.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"/>'+(d?'<Override PartName="/word/footnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"/>':"")+(p?'<Override PartName="/word/endnotes.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"/>':"")+(v?'<Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"/>':"")+'<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/></Types>'),o("_rels/.rels",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rIdDoc" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/><Relationship Id="rIdCore" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rIdApp" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/></Relationships>');for(var x="http://schemas.openxmlformats.org/officeDocument/2006/relationships/",h='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rIdStyles" Type="'+x+'styles" Target="styles.xml"/><Relationship Id="rIdNum" Type="'+x+'numbering" Target="numbering.xml"/>'+(d?'<Relationship Id="rIdFn" Type="'+x+'footnotes" Target="footnotes.xml"/>':"")+(p?'<Relationship Id="rIdEn" Type="'+x+'endnotes" Target="endnotes.xml"/>':"")+(v?'<Relationship Id="rIdCm" Type="'+x+'comments" Target="comments.xml"/>':""),C=0;C<a.rels.length;C++){var P=a.rels[C];h+='<Relationship Id="'+P.id+'" Type="'+x+P.type+'" Target="'+T(P.target)+'"'+(P.mode?' TargetMode="'+P.mode+'"':"")+"/>"}o("word/_rels/document.xml.rels",h+"</Relationships>"),o("word/document.xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:document xmlns:w="'+$.w+'" xmlns:r="'+$.r+'" xmlns:m="'+$.m+'"><w:body>'+c+xe()+"</w:body></w:document>"),o("word/styles.xml",Pe()),o("word/numbering.xml",Ae(a)),d&&o("word/footnotes.xml",oe(a.footnotes,"footnote")),p&&o("word/endnotes.xml",oe(a.endnotes,"endnote")),v&&o("word/comments.xml",Te(a.comments));var b=t.title||X.docxExportTitle||document.title||"Document",i=t.author||X.docxExportAuthor||"RichTextEditor";o("docProps/core.xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dc:title>'+T(b)+"</dc:title><dc:creator>"+T(i)+"</dc:creator><cp:lastModifiedBy>"+T(i)+'</cp:lastModifiedBy><dcterms:created xsi:type="dcterms:W3CDTF">'+new Date().toISOString().replace(/\.\d+Z$/,"Z")+"</dcterms:created></cp:coreProperties>"),o("docProps/app.xml",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"><Application>RichTextEditor</Application></Properties>');for(var m=0;m<a.media.length;m++)s.push({name:"word/media/"+a.media[m].name,bytes:a.media[m].bytes});me(s).then(e,n)}catch(o){r&&r.parentNode&&r.parentNode.removeChild(r),n(o)}})}function Pe(){for(var r="",t=1;t<=6;t++){var e=[36,30,26,24,22,20][t-1];r+='<w:style w:type="paragraph" w:styleId="Heading'+t+'"><w:name w:val="heading '+t+'"/><w:basedOn w:val="Normal"/><w:pPr><w:outlineLvl w:val="'+(t-1)+'"/><w:spacing w:before="240" w:after="120"/></w:pPr><w:rPr><w:b/><w:sz w:val="'+e+'"/><w:szCs w:val="'+e+'"/></w:rPr></w:style>'}return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:styles xmlns:w="'+$.w+'"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="Calibri" w:hAnsi="Calibri"/><w:sz w:val="22"/><w:szCs w:val="22"/></w:rPr></w:rPrDefault></w:docDefaults><w:style w:type="paragraph" w:default="1" w:styleId="Normal"><w:name w:val="Normal"/></w:style>'+r+'<w:style w:type="paragraph" w:styleId="Quote"><w:name w:val="Quote"/><w:basedOn w:val="Normal"/><w:rPr><w:i/><w:color w:val="4A5568"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Code"><w:name w:val="Code"/><w:basedOn w:val="Normal"/><w:rPr><w:rFonts w:ascii="Consolas" w:hAnsi="Consolas"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Caption"><w:name w:val="caption"/><w:basedOn w:val="Normal"/><w:next w:val="Normal"/><w:qFormat/><w:rPr><w:i/><w:color w:val="44546A"/><w:sz w:val="18"/><w:szCs w:val="18"/></w:rPr></w:style></w:styles>'}function Ae(r){for(var t="",e="",n=Object.keys(r.numbering),a=0;a<n.length;a++){for(var c=n[a],s=r.numbering[c],d="",p=0;p<9;p++)d+='<w:lvl w:ilvl="'+p+'"><w:start w:val="'+(r.numStart&&r.numStart[c]&&r.numStart[c].level===p?r.numStart[c].start:1)+'"/><w:numFmt w:val="'+(s==="bullet"?"bullet":r.numFmtAt&&r.numFmtAt[c]&&r.numFmtAt[c].level===p?r.numFmtAt[c].fmt:"decimal")+'"/><w:lvlText w:val="'+(s==="bullet"?"\uF0B7":"%"+(p+1)+".")+'"/><w:lvlJc w:val="left"/><w:pPr><w:ind w:left="'+720*(p+1)+'" w:hanging="360"/></w:pPr>'+(s==="bullet"?'<w:rPr><w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/></w:rPr>':"")+"</w:lvl>";t+='<w:abstractNum w:abstractNumId="'+c+'">'+d+"</w:abstractNum>",e+='<w:num w:numId="'+c+'"><w:abstractNumId w:val="'+c+'"/></w:num>'}return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:numbering xmlns:w="'+$.w+'">'+t+e+"</w:numbering>"}function oe(r,t){for(var e="<w:"+t+' w:type="separator" w:id="-1"><w:p><w:r><w:separator/></w:r></w:p></w:'+t+"><w:"+t+' w:type="continuationSeparator" w:id="0"><w:p><w:r><w:continuationSeparator/></w:r></w:p></w:'+t+">",n=0;n<r.length;n++)e+="<w:"+t+' w:id="'+r[n].id+'"><w:p><w:r><w:rPr><w:vertAlign w:val="superscript"/></w:rPr><w:'+t+'Ref/></w:r><w:r><w:t xml:space="preserve"> '+T(r[n].text)+"</w:t></w:r></w:p></w:"+t+">";return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:'+t+'s xmlns:w="'+$.w+'">'+e+"</w:"+t+"s>"}function Te(r){for(var t="",e=0;e<r.length;e++){var n=r[e];t+='<w:comment w:id="'+n.id+'" w:author="'+T(n.author)+'" w:initials="'+T(n.initials)+'" w:date="'+new Date().toISOString().replace(/\.\d+Z$/,"Z")+'"><w:p><w:r><w:t xml:space="preserve">'+T(n.text)+"</w:t></w:r></w:p></w:comment>"}return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><w:comments xmlns:w="'+$.w+'">'+t+"</w:comments>"}function ie(r){return!r||typeof r!="string"?"":r.replace(/\.docx?$/i,"").replace(/[\\/:*?"<>|]+/g,"").trim().slice(0,120)}function Ce(){var r=new Date;function t(e){return(e<10?"0":"")+e}return"Export-"+String(r.getFullYear()).slice(2)+t(r.getMonth()+1)+t(r.getDate())+"-"+t(r.getHours())+t(r.getMinutes())+t(r.getSeconds())}function Se(r,t){var e=URL.createObjectURL(r),n=document.createElement("a");return n.href=e,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),setTimeout(function(){URL.revokeObjectURL(e)},4e3),t}}
|
|
@@ -125,11 +125,15 @@ function RTE_Plugin_DragHandle() {
|
|
|
125
125
|
// ---- the move itself (shared by pointer and keyboard) ----------------
|
|
126
126
|
|
|
127
127
|
function moveBlock(block, beforeEl) {
|
|
128
|
+
// 2026-10-14 Read-only (designMode off) or comments-only: a move changes the document, so it does nothing. tools/review/readonly-audit.mjs
|
|
129
|
+
try { if (String(editor.getDocument().designMode).toLowerCase() === "off" || (editor.getCommentsOnly && editor.getCommentsOnly())) return false; } catch (e) { /* ignore */ }
|
|
128
130
|
var ed = getEditable();
|
|
129
131
|
if (!ed || !block || block.parentNode !== ed) return false;
|
|
130
132
|
if (beforeEl === block || (beforeEl && beforeEl.parentNode !== ed)) return false;
|
|
131
133
|
// Inserting before its own next sibling is a no-op move.
|
|
132
134
|
if (beforeEl === block.nextSibling) return false;
|
|
135
|
+
// 2026-10-14 Suggesting mode refuses a move (the track hook's "move"); see trackedchanges.js.
|
|
136
|
+
if (editor.__trackHook && editor.__trackHook("move", { direction: 0 }) === true) return false;
|
|
133
137
|
ed.insertBefore(block, beforeEl || null);
|
|
134
138
|
// Keep the caret with the block that moved — losing the caret is what
|
|
135
139
|
// makes programmatic moves feel broken (same lesson as tabletools sort).
|
|
@@ -163,6 +167,25 @@ function RTE_Plugin_DragHandle() {
|
|
|
163
167
|
|
|
164
168
|
function onKeyDown(e) {
|
|
165
169
|
if (config.dragHandleKeyboard === false) return;
|
|
170
|
+
// 2026-10-17 Shift+F10 / the Menu key with no text selected open the block menu for the caret's block: it
|
|
171
|
+
// opened only from a mouse click on the grip, so block colour (no shortcut of its own) was mouse-only. With text
|
|
172
|
+
// selected these keys stay the AI actions (the core's handler). tools/blocks/block-menu-keyboard.mjs
|
|
173
|
+
if ((e.key === "ContextMenu" || (e.key === "F10" && e.shiftKey && !e.altKey)) && !e.ctrlKey && !e.metaKey && config.dragHandleEnabled !== false) {
|
|
174
|
+
var kdoc = getDoc(), ked = getEditable(), ksel = kdoc && kdoc.getSelection();
|
|
175
|
+
if (ked && ksel && ksel.rangeCount && ksel.isCollapsed) {
|
|
176
|
+
var kblock = topBlockOf(ksel.anchorNode && ksel.anchorNode.nodeType === 3 ? ksel.anchorNode.parentNode : ksel.anchorNode);
|
|
177
|
+
if (kblock && blocks().indexOf(kblock) >= 0) {
|
|
178
|
+
e.preventDefault();
|
|
179
|
+
e.stopPropagation();
|
|
180
|
+
hoverBlock = null;
|
|
181
|
+
onHover({ target: kblock });
|
|
182
|
+
var kreturn = ksel.getRangeAt(0).cloneRange();
|
|
183
|
+
openBlockMenu(kblock);
|
|
184
|
+
if (blockMenu) blockMenu.__returnRange = kreturn;
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
166
189
|
if (!e.altKey || !e.shiftKey || e.ctrlKey || e.metaKey) return;
|
|
167
190
|
if (e.key !== "ArrowUp" && e.key !== "ArrowDown") return;
|
|
168
191
|
if (nudge(e.key === "ArrowUp" ? -1 : 1)) {
|
|
@@ -180,7 +203,7 @@ function RTE_Plugin_DragHandle() {
|
|
|
180
203
|
grip.className = "rte-drag-grip";
|
|
181
204
|
grip.setAttribute("contenteditable", "false");
|
|
182
205
|
grip.setAttribute("aria-hidden", "true");
|
|
183
|
-
grip.textContent = "
|
|
206
|
+
grip.textContent = "\u283f"; // ⠿
|
|
184
207
|
host.appendChild(grip);
|
|
185
208
|
}
|
|
186
209
|
if (!indicator || !indicator.parentNode) {
|
|
@@ -227,7 +250,7 @@ function RTE_Plugin_DragHandle() {
|
|
|
227
250
|
|
|
228
251
|
function onMouseDown(e) {
|
|
229
252
|
if (e.target !== grip || !hoverBlock) return;
|
|
230
|
-
dragging = { block: hoverBlock };
|
|
253
|
+
dragging = { block: hoverBlock, x: e.clientX, y: e.clientY, moved: false };
|
|
231
254
|
dropBefore = null;
|
|
232
255
|
e.preventDefault();
|
|
233
256
|
e.stopPropagation();
|
|
@@ -238,6 +261,7 @@ function RTE_Plugin_DragHandle() {
|
|
|
238
261
|
|
|
239
262
|
function onDragMove(e) {
|
|
240
263
|
if (!dragging) return;
|
|
264
|
+
if (!dragging.moved && (Math.abs(e.clientX - dragging.x) > 3 || Math.abs(e.clientY - dragging.y) > 3)) dragging.moved = true;
|
|
241
265
|
e.preventDefault();
|
|
242
266
|
var doc = getDoc();
|
|
243
267
|
var ed = getEditable();
|
|
@@ -272,11 +296,14 @@ function RTE_Plugin_DragHandle() {
|
|
|
272
296
|
if (!dragging) return;
|
|
273
297
|
var block = dragging.block;
|
|
274
298
|
var target = dropBefore;
|
|
299
|
+
var click = !dragging.moved;
|
|
275
300
|
dragging = null;
|
|
276
301
|
hideIndicator();
|
|
277
302
|
var ed = getEditable();
|
|
278
303
|
if (ed && ed.classList) ed.classList.remove("rte-drag-active");
|
|
279
304
|
if (grip) grip.classList.remove("rte-drag-grip-held");
|
|
305
|
+
// A press that never moved is a click on the handle: it opens the block menu and moves nothing.
|
|
306
|
+
if (click) { openBlockMenu(block); hideGrip(); return; }
|
|
280
307
|
hideGrip();
|
|
281
308
|
// Dropping a block onto itself moves nothing.
|
|
282
309
|
if (target !== block) moveBlock(block, target);
|
|
@@ -287,6 +314,231 @@ function RTE_Plugin_DragHandle() {
|
|
|
287
314
|
try { if (typeof editor.fireChange === "function") editor.fireChange(); } catch (e) {}
|
|
288
315
|
}
|
|
289
316
|
|
|
317
|
+
// ---- block menu ------------------------------------------------------
|
|
318
|
+
// 2026-10-12 a click on the handle opens the block's actions, as BlockNote and Plate offer: Duplicate, Move up,
|
|
319
|
+
// Move down, and turning the block into a paragraph or heading. Clicking the handle without dragging used to move
|
|
320
|
+
// the block to the end of the document. tools/blocks/block-menu.mjs
|
|
321
|
+
|
|
322
|
+
var blockMenu = null;
|
|
323
|
+
var blockMenuListeners = null;
|
|
324
|
+
|
|
325
|
+
// 2026-10-17 labels speak the page's language: their own config.text_ key first, then - when a non-English
|
|
326
|
+
// language pack is loaded (text_language is not "Language") - the pack's existing translation, else English.
|
|
327
|
+
// tools/i18n/block-menu-language.mjs
|
|
328
|
+
function label(own, packKey, fallback) {
|
|
329
|
+
if (config && config["text_" + own]) return config["text_" + own];
|
|
330
|
+
if (packKey && config && config.text_language && config.text_language !== "Language" && config["text_" + packKey]) return config["text_" + packKey];
|
|
331
|
+
return fallback;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function closeBlockMenu() {
|
|
335
|
+
var doc = getDoc();
|
|
336
|
+
if (blockMenuListeners && doc) {
|
|
337
|
+
doc.removeEventListener("mousedown", blockMenuListeners.mousedown, true);
|
|
338
|
+
doc.removeEventListener("keydown", blockMenuListeners.keydown, true);
|
|
339
|
+
if (blockMenuListeners.outer) {
|
|
340
|
+
blockMenuListeners.outer.removeEventListener("keydown", blockMenuListeners.keydown, true);
|
|
341
|
+
blockMenuListeners.outer.removeEventListener("mousedown", blockMenuListeners.mousedown, true);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
blockMenuListeners = null;
|
|
345
|
+
if (blockMenu && blockMenu.parentNode) blockMenu.parentNode.removeChild(blockMenu);
|
|
346
|
+
blockMenu = null;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// Put the caret in the block, so the core commands below act on it.
|
|
350
|
+
function placeCaretIn(block) {
|
|
351
|
+
try {
|
|
352
|
+
var doc = getDoc();
|
|
353
|
+
var r = doc.createRange();
|
|
354
|
+
r.selectNodeContents(block);
|
|
355
|
+
r.collapse(true);
|
|
356
|
+
var sel = editor.getSelection();
|
|
357
|
+
sel.removeAllRanges();
|
|
358
|
+
sel.addRange(r);
|
|
359
|
+
} catch (e) {}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
function turnInto(block, tag) {
|
|
363
|
+
return function () {
|
|
364
|
+
placeCaretIn(block);
|
|
365
|
+
try { editor.execCommand("formatblock", tag); } catch (e) {}
|
|
366
|
+
fireChange();
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// 2026-10-17 alignment from the block menu (BlockNote and Plate offer it; competitor matrix U4): the editor's own
|
|
371
|
+
// justify commands on that block, so they undo like the toolbar buttons. tools/blocks/block-menu-align.mjs
|
|
372
|
+
function alignOf(block) {
|
|
373
|
+
var a = "";
|
|
374
|
+
try { a = (block.ownerDocument.defaultView.getComputedStyle(block).textAlign || "").toLowerCase(); } catch (e) {}
|
|
375
|
+
if (a === "center" || a === "-webkit-center") return "center";
|
|
376
|
+
if (a === "right" || a === "-webkit-right") return "right";
|
|
377
|
+
if (a === "justify") return "justify";
|
|
378
|
+
if (a === "end") { try { return block.ownerDocument.defaultView.getComputedStyle(block).direction === "rtl" ? "left" : "right"; } catch (e) { return "right"; } }
|
|
379
|
+
return "left";
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function alignBlock(block, command) {
|
|
383
|
+
return function () {
|
|
384
|
+
placeCaretIn(block);
|
|
385
|
+
try { editor.execCommand(command); } catch (e) {}
|
|
386
|
+
fireChange();
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function setActiveItem(item) {
|
|
391
|
+
if (!blockMenu || !item) return;
|
|
392
|
+
var all = blockMenu.querySelectorAll(".rte-block-menu-active");
|
|
393
|
+
for (var n = 0; n < all.length; n++) all[n].classList.remove("rte-block-menu-active");
|
|
394
|
+
item.classList.add("rte-block-menu-active");
|
|
395
|
+
blockMenu.__activeItem = item;
|
|
396
|
+
try { item.focus(); } catch (x) { /* focus is best effort (Firefox: designMode) */ }
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// 2026-10-17 colour from the block menu (BlockNote's block menu has text and background colours; competitor
|
|
400
|
+
// matrix U4): the editor's own forecolor / backcolor commands over the whole block, so they undo like the
|
|
401
|
+
// toolbar's colour panels; Default / None clear it the way the panels' Automatic does. Text colours keep 4.5:1
|
|
402
|
+
// on white. tools/blocks/block-menu-colour.mjs
|
|
403
|
+
var BLOCK_TEXT_COLOURS = [["Grey", "#57606a"], ["Red", "#c62828"], ["Orange", "#b45309"], ["Green", "#2e7d32"], ["Blue", "#1d4ed8"], ["Purple", "#6d28d9"]];
|
|
404
|
+
var BLOCK_BACK_COLOURS = [["Yellow", "#fff3bf"], ["Green", "#dcfce7"], ["Blue", "#dbeafe"], ["Pink", "#fce7f3"], ["Grey", "#f1f5f9"]];
|
|
405
|
+
|
|
406
|
+
function colourBlock(block, command, value) {
|
|
407
|
+
return function () {
|
|
408
|
+
try {
|
|
409
|
+
var doc = getDoc();
|
|
410
|
+
var r = doc.createRange();
|
|
411
|
+
r.selectNodeContents(block);
|
|
412
|
+
var sel = editor.getSelection();
|
|
413
|
+
sel.removeAllRanges();
|
|
414
|
+
sel.addRange(r);
|
|
415
|
+
editor.execCommand(command, value);
|
|
416
|
+
placeCaretIn(block);
|
|
417
|
+
} catch (e) {}
|
|
418
|
+
fireChange();
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
function colourItems(block) {
|
|
423
|
+
var textWord = label("blockmenu_textcolour", "forecolor", "Text"), backWord = label("blockmenu_backcolour", "backcolor", "Background");
|
|
424
|
+
var list = [{ label: label("blockmenu_back", "", "Back"), run: function () { openBlockMenu(block); } }, { separator: true },
|
|
425
|
+
{ label: textWord + ": " + label("blockmenu_default", "colorauto", "Default"), run: colourBlock(block, "forecolor", "") }];
|
|
426
|
+
for (var c = 0; c < BLOCK_TEXT_COLOURS.length; c++) list.push({ label: textWord + ": " + label("blockmenu_colour_" + BLOCK_TEXT_COLOURS[c][0].toLowerCase(), "", BLOCK_TEXT_COLOURS[c][0]), swatch: BLOCK_TEXT_COLOURS[c][1], run: colourBlock(block, "forecolor", BLOCK_TEXT_COLOURS[c][1]) });
|
|
427
|
+
list.push({ separator: true });
|
|
428
|
+
list.push({ label: backWord + ": " + label("blockmenu_none", "colorauto", "None"), run: colourBlock(block, "backcolor", "") });
|
|
429
|
+
for (var g = 0; g < BLOCK_BACK_COLOURS.length; g++) list.push({ label: backWord + ": " + label("blockmenu_colour_" + BLOCK_BACK_COLOURS[g][0].toLowerCase(), "", BLOCK_BACK_COLOURS[g][0]), swatch: BLOCK_BACK_COLOURS[g][1], run: colourBlock(block, "backcolor", BLOCK_BACK_COLOURS[g][1]) });
|
|
430
|
+
return list;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function openBlockMenu(block, view) {
|
|
434
|
+
closeBlockMenu();
|
|
435
|
+
if (!grip || !grip.parentNode) return;
|
|
436
|
+
var doc = grip.ownerDocument;
|
|
437
|
+
var host = grip.parentNode;
|
|
438
|
+
var list = blocks();
|
|
439
|
+
var i = list.indexOf(block);
|
|
440
|
+
if (i < 0) return;
|
|
441
|
+
var items = [
|
|
442
|
+
{ label: label("blockmenu_duplicate", "", "Duplicate"), run: function () { placeCaretIn(block); try { editor.duplicateCurrentBlock(); } catch (e) {} fireChange(); } },
|
|
443
|
+
{ label: label("blockmenu_moveup", "", "Move up"), enabled: i > 0, run: function () { moveBlock(block, list[i - 1]); } },
|
|
444
|
+
{ label: label("blockmenu_movedown", "", "Move down"), enabled: i < list.length - 1, run: function () { moveBlock(block, list[i + 1].nextSibling); } },
|
|
445
|
+
{ label: label("blockmenu_paragraph", "normal", "Paragraph"), run: turnInto(block, "<p>") },
|
|
446
|
+
{ label: label("blockmenu_heading1", "h1", "Heading 1"), run: turnInto(block, "<h1>") },
|
|
447
|
+
{ label: label("blockmenu_heading2", "h2", "Heading 2"), run: turnInto(block, "<h2>") },
|
|
448
|
+
{ label: label("blockmenu_heading3", "h3", "Heading 3"), run: turnInto(block, "<h3>") }
|
|
449
|
+
];
|
|
450
|
+
var current = alignOf(block);
|
|
451
|
+
items.push({ label: label("blockmenu_colour", "", "Colour\u2026"), run: function () { openBlockMenu(block, "colour"); } });
|
|
452
|
+
items.push({ separator: true });
|
|
453
|
+
items.push({ label: label("blockmenu_alignleft", "justifyleft", "Align left"), radio: true, checked: current === "left", run: alignBlock(block, "justifyleft") });
|
|
454
|
+
items.push({ label: label("blockmenu_aligncentre", "justifycenter", "Align centre"), radio: true, checked: current === "center", run: alignBlock(block, "justifycenter") });
|
|
455
|
+
items.push({ label: label("blockmenu_alignright", "justifyright", "Align right"), radio: true, checked: current === "right", run: alignBlock(block, "justifyright") });
|
|
456
|
+
items.push({ label: label("blockmenu_justify", "justifyfull", "Justify"), radio: true, checked: current === "justify", run: alignBlock(block, "justifyfull") });
|
|
457
|
+
if (view === "colour") items = colourItems(block);
|
|
458
|
+
blockMenu = doc.createElement("div");
|
|
459
|
+
blockMenu.className = "rte-block-menu";
|
|
460
|
+
blockMenu.setAttribute("role", "menu");
|
|
461
|
+
blockMenu.setAttribute("aria-label", ((typeof config !== "undefined" && config && config.text_blk_actions) || "Block actions"));
|
|
462
|
+
blockMenu.setAttribute("contenteditable", "false");
|
|
463
|
+
blockMenu.style.left = grip.style.left || "0px";
|
|
464
|
+
blockMenu.style.top = ((parseInt(grip.style.top, 10) || 0) + 26) + "px";
|
|
465
|
+
for (var k = 0; k < items.length; k++) {
|
|
466
|
+
var it = items[k];
|
|
467
|
+
if (it.separator) {
|
|
468
|
+
var sep = doc.createElement("div");
|
|
469
|
+
sep.setAttribute("role", "separator");
|
|
470
|
+
sep.className = "rte-block-menu-separator";
|
|
471
|
+
blockMenu.appendChild(sep);
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
var el = doc.createElement("div");
|
|
475
|
+
el.setAttribute("role", it.radio ? "menuitemradio" : "menuitem");
|
|
476
|
+
if (it.radio) el.setAttribute("aria-checked", it.checked ? "true" : "false");
|
|
477
|
+
el.setAttribute("tabindex", "-1");
|
|
478
|
+
el.setAttribute("aria-disabled", it.enabled === false ? "true" : "false");
|
|
479
|
+
el.className = "rte-block-menu-item" + (it.enabled === false ? " rte-block-menu-disabled" : "");
|
|
480
|
+
if (it.swatch) {
|
|
481
|
+
var sw = doc.createElement("span");
|
|
482
|
+
sw.className = "rte-block-menu-swatch";
|
|
483
|
+
sw.setAttribute("aria-hidden", "true");
|
|
484
|
+
sw.style.backgroundColor = it.swatch;
|
|
485
|
+
el.appendChild(sw);
|
|
486
|
+
el.appendChild(doc.createTextNode(it.label));
|
|
487
|
+
} else el.textContent = it.label;
|
|
488
|
+
el.addEventListener("mousedown", function (e) { e.preventDefault(); });
|
|
489
|
+
el.addEventListener("click", (function (item) {
|
|
490
|
+
return function (e) {
|
|
491
|
+
e.preventDefault();
|
|
492
|
+
e.stopPropagation();
|
|
493
|
+
if (item.enabled === false) return;
|
|
494
|
+
closeBlockMenu();
|
|
495
|
+
item.run();
|
|
496
|
+
};
|
|
497
|
+
})(it));
|
|
498
|
+
blockMenu.appendChild(el);
|
|
499
|
+
}
|
|
500
|
+
host.appendChild(blockMenu);
|
|
501
|
+
blockMenuListeners = {
|
|
502
|
+
mousedown: function (e) { if (blockMenu && !blockMenu.contains(e.target)) closeBlockMenu(); },
|
|
503
|
+
keydown: function (e) {
|
|
504
|
+
if (!blockMenu) return;
|
|
505
|
+
var items = [].slice.call(blockMenu.querySelectorAll(".rte-block-menu-item:not(.rte-block-menu-disabled)"));
|
|
506
|
+
var at = items.indexOf(doc.activeElement);
|
|
507
|
+
if (at < 0 && blockMenu.__activeItem) at = items.indexOf(blockMenu.__activeItem);
|
|
508
|
+
if (e.key === "Escape" || e.key === "Esc") {
|
|
509
|
+
e.preventDefault();
|
|
510
|
+
var returnRange = blockMenu.__returnRange;
|
|
511
|
+
closeBlockMenu();
|
|
512
|
+
// 2026-10-14 the editable focus() does not move focus from the host page into the editing
|
|
513
|
+
// frame, so focus fell to the page body; editor.focus() does (WCAG 2.4.3). tools/blocks/block-menu.mjs
|
|
514
|
+
try { if (typeof editor.focus === "function") editor.focus(); else { var ed = getEditable(); if (ed && ed.focus) ed.focus(); } } catch (x) { /* focus is best effort */ }
|
|
515
|
+
// opened from the keyboard: the caret goes back where it was (WebKit lost it on focus)
|
|
516
|
+
if (returnRange) { try { var rsel = doc.getSelection(); rsel.removeAllRanges(); rsel.addRange(returnRange); } catch (x) { /* best effort */ } }
|
|
517
|
+
} else if ((e.key === "ArrowDown" || e.key === "ArrowUp") && items.length) {
|
|
518
|
+
e.preventDefault();
|
|
519
|
+
var next = e.key === "ArrowDown" ? (at + 1) % items.length : (at <= 0 ? items.length - 1 : at - 1);
|
|
520
|
+
setActiveItem(items[next]);
|
|
521
|
+
} else if ((e.key === "Enter" || e.key === " " || e.key === "Spacebar") && at >= 0) {
|
|
522
|
+
e.preventDefault();
|
|
523
|
+
items[at].click();
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
doc.addEventListener("mousedown", blockMenuListeners.mousedown, true);
|
|
528
|
+
doc.addEventListener("keydown", blockMenuListeners.keydown, true);
|
|
529
|
+
// Focus can sit in the page around the frame (Firefox after a click), so the page hears Escape too.
|
|
530
|
+
var outer = null;
|
|
531
|
+
try { outer = editor.iframe && editor.iframe.ownerDocument; } catch (x) { outer = null; }
|
|
532
|
+
if (outer && outer !== doc) {
|
|
533
|
+
blockMenuListeners.outer = outer;
|
|
534
|
+
outer.addEventListener("keydown", blockMenuListeners.keydown, true);
|
|
535
|
+
outer.addEventListener("mousedown", blockMenuListeners.mousedown, true);
|
|
536
|
+
}
|
|
537
|
+
// The menu takes focus, so the keyboard reaches it (and Escape can close it).
|
|
538
|
+
var firstItem = blockMenu.querySelector(".rte-block-menu-item:not(.rte-block-menu-disabled)");
|
|
539
|
+
if (firstItem) setActiveItem(firstItem);
|
|
540
|
+
}
|
|
541
|
+
|
|
290
542
|
// ---- styles ----------------------------------------------------------
|
|
291
543
|
|
|
292
544
|
function injectStyles(doc) {
|
|
@@ -302,7 +554,19 @@ function RTE_Plugin_DragHandle() {
|
|
|
302
554
|
".rte-drag-indicator{position:absolute;display:none;height:2px;background:#1474ea;" +
|
|
303
555
|
"border-radius:1px;pointer-events:none;z-index:19;}" +
|
|
304
556
|
".rte-drag-active{cursor:grabbing;}" +
|
|
305
|
-
".rte-drag-active *{cursor:grabbing !important;}"
|
|
557
|
+
".rte-drag-active *{cursor:grabbing !important;}" +
|
|
558
|
+
".rte-block-menu{position:absolute;z-index:50;min-width:150px;padding:4px;background:#fff;" +
|
|
559
|
+
"border:1px solid #cbd5e1;border-radius:8px;box-shadow:0 8px 24px rgba(15,23,42,.14);" +
|
|
560
|
+
"font:13px/1.2 system-ui,sans-serif;color:#0f172a;}" +
|
|
561
|
+
".rte-block-menu-item{padding:6px 10px;border-radius:5px;cursor:pointer;white-space:nowrap;}" +
|
|
562
|
+
".rte-block-menu-item:hover,.rte-block-menu-item:focus,.rte-block-menu-item.rte-block-menu-active{background:#e0e7ff;outline:none;}" +
|
|
563
|
+
".rte-block-menu-disabled{color:#94a3b8;cursor:default;}" +
|
|
564
|
+
".rte-block-menu-disabled:hover{background:none;}" +
|
|
565
|
+
".rte-block-menu-separator{height:1px;margin:4px 6px;background:#e2e8f0;}" +
|
|
566
|
+
".rte-block-menu-swatch{display:inline-block;width:12px;height:12px;margin-right:8px;vertical-align:-1px;border:1px solid rgba(0,0,0,.25);border-radius:3px;}" +
|
|
567
|
+
".rte-block-menu-item[aria-checked=true]{font-weight:600;}" +
|
|
568
|
+
".rte-block-menu-item[aria-checked]::before{content:'';display:inline-block;width:14px;}" +
|
|
569
|
+
".rte-block-menu-item[aria-checked=true]::before{content:'\\2713';}"
|
|
306
570
|
));
|
|
307
571
|
(doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement).appendChild(st);
|
|
308
572
|
// A <style> ELEMENT is governed by style-src: under a strict policy the browser
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_draghandle=RTE_Plugin_DragHandle,typeof RTE_DefaultConfig.dragHandleEnabled>"u"&&(RTE_DefaultConfig.dragHandleEnabled=!0),typeof RTE_DefaultConfig.dragHandleKeyboard>"u"&&(RTE_DefaultConfig.dragHandleKeyboard=!0);function RTE_Plugin_DragHandle(){var E=this,f,i,T=null,a=null,o=null,s=null,d=null,p=null;E.PluginName="DragHandle",E.InitConfig=function(e){f=e},E.InitEditor=function(e){i=e,v();try{i.attachEvent("ready",v)}catch{}try{i.attachEvent("aftersethtml",v)}catch{}setTimeout(v,0),i.moveBlock=function(t,r){return y(t,r)},i.moveBlockUp=function(){return D(-1)},i.moveBlockDown=function(){return D(1)},i.setDragHandleEnabled=function(t){return f.dragHandleEnabled=!!t,t||b(),!!t},i.isDragHandleEnabled=function(){return f.dragHandleEnabled!==!1}};function v(){var e=h();if(!(!e||e===T)){T=e,M(e);var t=l();t&&(e.addEventListener("mousemove",A),e.addEventListener("mousedown",B,!0),e.addEventListener("mousemove",S,!0),e.addEventListener("mouseup",_,!0),e.addEventListener("keydown",R),e.addEventListener("mouseleave",function(){d||b()}))}}function h(){try{return i.getDocument()}catch{return null}}function l(){try{return i.getEditable()}catch{return null}}function x(){var e=l();if(!e)return[];for(var t=[],r=0;r<e.children.length;r++){var n=e.children[r];n.nodeType===1&&(n.getAttribute&&(n.getAttribute("data-rte-page-overlay")==="true"||n.getAttribute("data-rte-linenumbers")==="true")||t.push(n))}return t}function k(e){for(var t=l(),r=e&&e.nodeType===3?e.parentNode:e,n=null;r&&r!==t;)n=r,r=r.parentNode;return r===t&&n&&n.nodeType===1?n:null}function H(){try{var e=i.getSelection();return!e||e.rangeCount===0?null:k(e.getRangeAt(0).startContainer)}catch{return null}}function y(e,t){var r=l();if(!r||!e||e.parentNode!==r||t===e||t&&t.parentNode!==r||t===e.nextSibling)return!1;r.insertBefore(e,t||null);try{var n=h(),u=n.createRange();u.selectNodeContents(e),u.collapse(!0);var c=i.getSelection();c.removeAllRanges(),c.addRange(u)}catch{}return K(),!0}function D(e){var t=H();if(!t)return!1;var r=x(),n=r.indexOf(t);return n<0?!1:e<0?n===0?!1:y(t,r[n-1]):n>=r.length-1?!1:y(t,r[n+1].nextSibling)}function R(e){f.dragHandleKeyboard!==!1&&(!e.altKey||!e.shiftKey||e.ctrlKey||e.metaKey||e.key!=="ArrowUp"&&e.key!=="ArrowDown"||D(e.key==="ArrowUp"?-1:1)&&(e.preventDefault(),e.stopPropagation()))}function w(e,t){var r=t.parentNode||e.body;(!a||!a.parentNode)&&(a=e.createElement("div"),a.className="rte-drag-grip",a.setAttribute("contenteditable","false"),a.setAttribute("aria-hidden","true"),a.textContent="\u283F",r.appendChild(a)),(!o||!o.parentNode)&&(o=e.createElement("div"),o.className="rte-drag-indicator",o.setAttribute("contenteditable","false"),o.setAttribute("aria-hidden","true"),r.appendChild(o))}function b(){a&&(a.style.display="none"),s=null}function N(){o&&(o.style.display="none")}function A(e){if(!(d||f.dragHandleEnabled===!1)){var t=h(),r=l();if(!(!t||!r)){var n=null;if(e.target!==a){if(r.contains(e.target)&&(n=k(e.target)),!n||x().indexOf(n)<0){b();return}if(!(n===s&&a&&a.style.display!=="none")){w(t,r),s=n;var u=!1;try{u=t.defaultView.getComputedStyle(r).direction==="rtl"}catch{}a.style.display="block",a.style.top=n.offsetTop+"px",u?a.style.left=n.offsetLeft+n.offsetWidth+4+"px":a.style.left=Math.max(0,n.offsetLeft-22)+"px"}}}}}function B(e){if(!(e.target!==a||!s)){d={block:s},p=null,e.preventDefault(),e.stopPropagation();var t=l();t&&t.classList&&t.classList.add("rte-drag-active"),a&&a.classList.add("rte-drag-grip-held")}}function S(e){if(d){e.preventDefault();var t=h(),r=l();if(!(!t||!r)){w(t,r);var n=x();if(n.length){var u=r.getBoundingClientRect(),c=e.clientY-u.top+(r.scrollTop||0);p=null;for(var g=null,C=0;C<n.length;C++){var m=n[C],I=m.offsetTop+m.offsetHeight/2;if(c<I){p=m,g=m.offsetTop;break}}if(g===null){var L=n[n.length-1];g=L.offsetTop+L.offsetHeight}o.style.display="block",o.style.top=Math.max(0,g-1)+"px",o.style.left=r.offsetLeft+"px",o.style.width=r.offsetWidth+"px"}}}}function _(){if(d){var e=d.block,t=p;d=null,N();var r=l();r&&r.classList&&r.classList.remove("rte-drag-active"),a&&a.classList.remove("rte-drag-grip-held"),b(),t!==e&&y(e,t)}}function K(){try{typeof i.updateDesign=="function"&&i.updateDesign()}catch{}try{typeof i.fireChange=="function"&&i.fireChange()}catch{}}function M(e){if(!e.getElementById("rte-drag-handle-styles")){var t=e.createElement("style");t.id="rte-drag-handle-styles",t.appendChild(e.createTextNode(".rte-drag-grip{position:absolute;display:none;width:18px;text-align:center;color:#94a3b8;font-size:14px;line-height:1.4;cursor:grab;user-select:none;z-index:20;border-radius:4px;}.rte-drag-grip:hover{background:rgba(148,163,184,.18);color:#475569;}.rte-drag-grip-held{cursor:grabbing;color:#1474ea;}.rte-drag-indicator{position:absolute;display:none;height:2px;background:#1474ea;border-radius:1px;pointer-events:none;z-index:19;}.rte-drag-active{cursor:grabbing;}.rte-drag-active *{cursor:grabbing !important;}")),(e.head||e.getElementsByTagName("head")[0]||e.documentElement).appendChild(t),i&&typeof i.ensureStyleSheetLive=="function"&&i.ensureStyleSheetLive(e,t,"rte-drag-handle-styles",t.textContent)}}}
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_draghandle=RTE_Plugin_DragHandle,typeof RTE_DefaultConfig.dragHandleEnabled>"u"&&(RTE_DefaultConfig.dragHandleEnabled=!0),typeof RTE_DefaultConfig.dragHandleKeyboard>"u"&&(RTE_DefaultConfig.dragHandleKeyboard=!0);function RTE_Plugin_DragHandle(){var G=this,f,a,q=null,i=null,p=null,E=null,m=null,S=null;G.PluginName="DragHandle",G.InitConfig=function(e){f=e},G.InitEditor=function(e){a=e,H();try{a.attachEvent("ready",H)}catch{}try{a.attachEvent("aftersethtml",H)}catch{}setTimeout(H,0),a.moveBlock=function(t,r){return D(t,r)},a.moveBlockUp=function(){return W(-1)},a.moveBlockDown=function(){return W(1)},a.setDragHandleEnabled=function(t){return f.dragHandleEnabled=!!t,t||N(),!!t},a.isDragHandleEnabled=function(){return f.dragHandleEnabled!==!1}};function H(){var e=k();if(!(!e||e===q)){q=e,le(e);var t=b();t&&(e.addEventListener("mousemove",X),e.addEventListener("mousedown",re,!0),e.addEventListener("mousemove",ne,!0),e.addEventListener("mouseup",ae,!0),e.addEventListener("keydown",ee),e.addEventListener("mouseleave",function(){m||N()}))}}function k(){try{return a.getDocument()}catch{return null}}function b(){try{return a.getEditable()}catch{return null}}function A(){var e=b();if(!e)return[];for(var t=[],r=0;r<e.children.length;r++){var n=e.children[r];n.nodeType===1&&(n.getAttribute&&(n.getAttribute("data-rte-page-overlay")==="true"||n.getAttribute("data-rte-linenumbers")==="true")||t.push(n))}return t}function z(e){for(var t=b(),r=e&&e.nodeType===3?e.parentNode:e,n=null;r&&r!==t;)n=r,r=r.parentNode;return r===t&&n&&n.nodeType===1?n:null}function $(){try{var e=a.getSelection();return!e||e.rangeCount===0?null:z(e.getRangeAt(0).startContainer)}catch{return null}}function D(e,t){try{if(String(a.getDocument().designMode).toLowerCase()==="off"||a.getCommentsOnly&&a.getCommentsOnly())return!1}catch{}var r=b();if(!r||!e||e.parentNode!==r||t===e||t&&t.parentNode!==r||t===e.nextSibling||a.__trackHook&&a.__trackHook("move",{direction:0})===!0)return!1;r.insertBefore(e,t||null);try{var n=k(),o=n.createRange();o.selectNodeContents(e),o.collapse(!0);var u=a.getSelection();u.removeAllRanges(),u.addRange(o)}catch{}return R(),!0}function W(e){var t=$();if(!t)return!1;var r=A(),n=r.indexOf(t);return n<0?!1:e<0?n===0?!1:D(t,r[n-1]):n>=r.length-1?!1:D(t,r[n+1].nextSibling)}function ee(e){if(f.dragHandleKeyboard!==!1){if((e.key==="ContextMenu"||e.key==="F10"&&e.shiftKey&&!e.altKey)&&!e.ctrlKey&&!e.metaKey&&f.dragHandleEnabled!==!1){var t=k(),r=b(),n=t&&t.getSelection();if(r&&n&&n.rangeCount&&n.isCollapsed){var o=z(n.anchorNode&&n.anchorNode.nodeType===3?n.anchorNode.parentNode:n.anchorNode);if(o&&A().indexOf(o)>=0){e.preventDefault(),e.stopPropagation(),E=null,X({target:o});var u=n.getRangeAt(0).cloneRange();P(o),l&&(l.__returnRange=u);return}}}!e.altKey||!e.shiftKey||e.ctrlKey||e.metaKey||e.key!=="ArrowUp"&&e.key!=="ArrowDown"||W(e.key==="ArrowUp"?-1:1)&&(e.preventDefault(),e.stopPropagation())}}function V(e,t){var r=t.parentNode||e.body;(!i||!i.parentNode)&&(i=e.createElement("div"),i.className="rte-drag-grip",i.setAttribute("contenteditable","false"),i.setAttribute("aria-hidden","true"),i.textContent="\u283F",r.appendChild(i)),(!p||!p.parentNode)&&(p=e.createElement("div"),p.className="rte-drag-indicator",p.setAttribute("contenteditable","false"),p.setAttribute("aria-hidden","true"),r.appendChild(p))}function N(){i&&(i.style.display="none"),E=null}function te(){p&&(p.style.display="none")}function X(e){if(!(m||f.dragHandleEnabled===!1)){var t=k(),r=b();if(!(!t||!r)){var n=null;if(e.target!==i){if(r.contains(e.target)&&(n=z(e.target)),!n||A().indexOf(n)<0){N();return}if(!(n===E&&i&&i.style.display!=="none")){V(t,r),E=n;var o=!1;try{o=t.defaultView.getComputedStyle(r).direction==="rtl"}catch{}i.style.display="block",i.style.top=n.offsetTop+"px",o?i.style.left=n.offsetLeft+n.offsetWidth+4+"px":i.style.left=Math.max(0,n.offsetLeft-22)+"px"}}}}}function re(e){if(!(e.target!==i||!E)){m={block:E,x:e.clientX,y:e.clientY,moved:!1},S=null,e.preventDefault(),e.stopPropagation();var t=b();t&&t.classList&&t.classList.add("rte-drag-active"),i&&i.classList.add("rte-drag-grip-held")}}function ne(e){if(m){!m.moved&&(Math.abs(e.clientX-m.x)>3||Math.abs(e.clientY-m.y)>3)&&(m.moved=!0),e.preventDefault();var t=k(),r=b();if(!(!t||!r)){V(t,r);var n=A();if(n.length){var o=r.getBoundingClientRect(),u=e.clientY-o.top+(r.scrollTop||0);S=null;for(var s=null,x=0;x<n.length;x++){var w=n[x],v=w.offsetTop+w.offsetHeight/2;if(u<v){S=w,s=w.offsetTop;break}}if(s===null){var L=n[n.length-1];s=L.offsetTop+L.offsetHeight}p.style.display="block",p.style.top=Math.max(0,s-1)+"px",p.style.left=r.offsetLeft+"px",p.style.width=r.offsetWidth+"px"}}}}function ae(){if(m){var e=m.block,t=S,r=!m.moved;m=null,te();var n=b();if(n&&n.classList&&n.classList.remove("rte-drag-active"),i&&i.classList.remove("rte-drag-grip-held"),r){P(e),N();return}N(),t!==e&&D(e,t)}}function R(){try{typeof a.updateDesign=="function"&&a.updateDesign()}catch{}try{typeof a.fireChange=="function"&&a.fireChange()}catch{}}var l=null,g=null;function d(e,t,r){return f&&f["text_"+e]?f["text_"+e]:t&&f&&f.text_language&&f.text_language!=="Language"&&f["text_"+t]?f["text_"+t]:r}function O(){var e=k();g&&e&&(e.removeEventListener("mousedown",g.mousedown,!0),e.removeEventListener("keydown",g.keydown,!0),g.outer&&(g.outer.removeEventListener("keydown",g.keydown,!0),g.outer.removeEventListener("mousedown",g.mousedown,!0))),g=null,l&&l.parentNode&&l.parentNode.removeChild(l),l=null}function M(e){try{var t=k(),r=t.createRange();r.selectNodeContents(e),r.collapse(!0);var n=a.getSelection();n.removeAllRanges(),n.addRange(r)}catch{}}function j(e,t){return function(){M(e);try{a.execCommand("formatblock",t)}catch{}R()}}function oe(e){var t="";try{t=(e.ownerDocument.defaultView.getComputedStyle(e).textAlign||"").toLowerCase()}catch{}if(t==="center"||t==="-webkit-center")return"center";if(t==="right"||t==="-webkit-right")return"right";if(t==="justify")return"justify";if(t==="end")try{return e.ownerDocument.defaultView.getComputedStyle(e).direction==="rtl"?"left":"right"}catch{return"right"}return"left"}function I(e,t){return function(){M(e);try{a.execCommand(t)}catch{}R()}}function F(e){if(!(!l||!e)){for(var t=l.querySelectorAll(".rte-block-menu-active"),r=0;r<t.length;r++)t[r].classList.remove("rte-block-menu-active");e.classList.add("rte-block-menu-active"),l.__activeItem=e;try{e.focus()}catch{}}}var T=[["Grey","#57606a"],["Red","#c62828"],["Orange","#b45309"],["Green","#2e7d32"],["Blue","#1d4ed8"],["Purple","#6d28d9"]],B=[["Yellow","#fff3bf"],["Green","#dcfce7"],["Blue","#dbeafe"],["Pink","#fce7f3"],["Grey","#f1f5f9"]];function K(e,t,r){return function(){try{var n=k(),o=n.createRange();o.selectNodeContents(e);var u=a.getSelection();u.removeAllRanges(),u.addRange(o),a.execCommand(t,r),M(e)}catch{}R()}}function ie(e){for(var t=d("blockmenu_textcolour","forecolor","Text"),r=d("blockmenu_backcolour","backcolor","Background"),n=[{label:d("blockmenu_back","","Back"),run:function(){P(e)}},{separator:!0},{label:t+": "+d("blockmenu_default","colorauto","Default"),run:K(e,"forecolor","")}],o=0;o<T.length;o++)n.push({label:t+": "+d("blockmenu_colour_"+T[o][0].toLowerCase(),"",T[o][0]),swatch:T[o][1],run:K(e,"forecolor",T[o][1])});n.push({separator:!0}),n.push({label:r+": "+d("blockmenu_none","colorauto","None"),run:K(e,"backcolor","")});for(var u=0;u<B.length;u++)n.push({label:r+": "+d("blockmenu_colour_"+B[u][0].toLowerCase(),"",B[u][0]),swatch:B[u][1],run:K(e,"backcolor",B[u][1])});return n}function P(e,t){if(O(),!(!i||!i.parentNode)){var r=i.ownerDocument,n=i.parentNode,o=A(),u=o.indexOf(e);if(!(u<0)){var s=[{label:d("blockmenu_duplicate","","Duplicate"),run:function(){M(e);try{a.duplicateCurrentBlock()}catch{}R()}},{label:d("blockmenu_moveup","","Move up"),enabled:u>0,run:function(){D(e,o[u-1])}},{label:d("blockmenu_movedown","","Move down"),enabled:u<o.length-1,run:function(){D(e,o[u+1].nextSibling)}},{label:d("blockmenu_paragraph","normal","Paragraph"),run:j(e,"<p>")},{label:d("blockmenu_heading1","h1","Heading 1"),run:j(e,"<h1>")},{label:d("blockmenu_heading2","h2","Heading 2"),run:j(e,"<h2>")},{label:d("blockmenu_heading3","h3","Heading 3"),run:j(e,"<h3>")}],x=oe(e);s.push({label:d("blockmenu_colour","","Colour\u2026"),run:function(){P(e,"colour")}}),s.push({separator:!0}),s.push({label:d("blockmenu_alignleft","justifyleft","Align left"),radio:!0,checked:x==="left",run:I(e,"justifyleft")}),s.push({label:d("blockmenu_aligncentre","justifycenter","Align centre"),radio:!0,checked:x==="center",run:I(e,"justifycenter")}),s.push({label:d("blockmenu_alignright","justifyright","Align right"),radio:!0,checked:x==="right",run:I(e,"justifyright")}),s.push({label:d("blockmenu_justify","justifyfull","Justify"),radio:!0,checked:x==="justify",run:I(e,"justifyfull")}),t==="colour"&&(s=ie(e)),l=r.createElement("div"),l.className="rte-block-menu",l.setAttribute("role","menu"),l.setAttribute("aria-label",typeof f<"u"&&f&&f.text_blk_actions||"Block actions"),l.setAttribute("contenteditable","false"),l.style.left=i.style.left||"0px",l.style.top=(parseInt(i.style.top,10)||0)+26+"px";for(var w=0;w<s.length;w++){var v=s[w];if(v.separator){var L=r.createElement("div");L.setAttribute("role","separator"),L.className="rte-block-menu-separator",l.appendChild(L);continue}var h=r.createElement("div");if(h.setAttribute("role",v.radio?"menuitemradio":"menuitem"),v.radio&&h.setAttribute("aria-checked",v.checked?"true":"false"),h.setAttribute("tabindex","-1"),h.setAttribute("aria-disabled",v.enabled===!1?"true":"false"),h.className="rte-block-menu-item"+(v.enabled===!1?" rte-block-menu-disabled":""),v.swatch){var U=r.createElement("span");U.className="rte-block-menu-swatch",U.setAttribute("aria-hidden","true"),U.style.backgroundColor=v.swatch,h.appendChild(U),h.appendChild(r.createTextNode(v.label))}else h.textContent=v.label;h.addEventListener("mousedown",function(c){c.preventDefault()}),h.addEventListener("click",(function(c){return function(y){y.preventDefault(),y.stopPropagation(),c.enabled!==!1&&(O(),c.run())}})(v)),l.appendChild(h)}n.appendChild(l),g={mousedown:function(c){l&&!l.contains(c.target)&&O()},keydown:function(c){if(l){var y=[].slice.call(l.querySelectorAll(".rte-block-menu-item:not(.rte-block-menu-disabled)")),C=y.indexOf(r.activeElement);if(C<0&&l.__activeItem&&(C=y.indexOf(l.__activeItem)),c.key==="Escape"||c.key==="Esc"){c.preventDefault();var Q=l.__returnRange;O();try{if(typeof a.focus=="function")a.focus();else{var Y=b();Y&&Y.focus&&Y.focus()}}catch{}if(Q)try{var Z=r.getSelection();Z.removeAllRanges(),Z.addRange(Q)}catch{}}else if((c.key==="ArrowDown"||c.key==="ArrowUp")&&y.length){c.preventDefault();var ue=c.key==="ArrowDown"?(C+1)%y.length:C<=0?y.length-1:C-1;F(y[ue])}else(c.key==="Enter"||c.key===" "||c.key==="Spacebar")&&C>=0&&(c.preventDefault(),y[C].click())}}},r.addEventListener("mousedown",g.mousedown,!0),r.addEventListener("keydown",g.keydown,!0);var _=null;try{_=a.iframe&&a.iframe.ownerDocument}catch{_=null}_&&_!==r&&(g.outer=_,_.addEventListener("keydown",g.keydown,!0),_.addEventListener("mousedown",g.mousedown,!0));var J=l.querySelector(".rte-block-menu-item:not(.rte-block-menu-disabled)");J&&F(J)}}}function le(e){if(!e.getElementById("rte-drag-handle-styles")){var t=e.createElement("style");t.id="rte-drag-handle-styles",t.appendChild(e.createTextNode(".rte-drag-grip{position:absolute;display:none;width:18px;text-align:center;color:#94a3b8;font-size:14px;line-height:1.4;cursor:grab;user-select:none;z-index:20;border-radius:4px;}.rte-drag-grip:hover{background:rgba(148,163,184,.18);color:#475569;}.rte-drag-grip-held{cursor:grabbing;color:#1474ea;}.rte-drag-indicator{position:absolute;display:none;height:2px;background:#1474ea;border-radius:1px;pointer-events:none;z-index:19;}.rte-drag-active{cursor:grabbing;}.rte-drag-active *{cursor:grabbing !important;}.rte-block-menu{position:absolute;z-index:50;min-width:150px;padding:4px;background:#fff;border:1px solid #cbd5e1;border-radius:8px;box-shadow:0 8px 24px rgba(15,23,42,.14);font:13px/1.2 system-ui,sans-serif;color:#0f172a;}.rte-block-menu-item{padding:6px 10px;border-radius:5px;cursor:pointer;white-space:nowrap;}.rte-block-menu-item:hover,.rte-block-menu-item:focus,.rte-block-menu-item.rte-block-menu-active{background:#e0e7ff;outline:none;}.rte-block-menu-disabled{color:#94a3b8;cursor:default;}.rte-block-menu-disabled:hover{background:none;}.rte-block-menu-separator{height:1px;margin:4px 6px;background:#e2e8f0;}.rte-block-menu-swatch{display:inline-block;width:12px;height:12px;margin-right:8px;vertical-align:-1px;border:1px solid rgba(0,0,0,.25);border-radius:3px;}.rte-block-menu-item[aria-checked=true]{font-weight:600;}.rte-block-menu-item[aria-checked]::before{content:'';display:inline-block;width:14px;}.rte-block-menu-item[aria-checked=true]::before{content:'\\2713';}")),(e.head||e.getElementsByTagName("head")[0]||e.documentElement).appendChild(t),a&&typeof a.ensureStyleSheetLive=="function"&&a.ensureStyleSheetLive(e,t,"rte-drag-handle-styles",t.textContent)}}}
|