@richscripts/richtexteditor 2.14.1 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +182 -10
- package/angular/build-manifest.json +23 -0
- package/angular/index.d.ts +71 -76
- package/angular/index.mjs +2 -0
- package/angular/package.json +4 -0
- package/headless/index.d.ts +3 -1
- package/headless/index.js +72 -16
- package/index.d.ts +40 -52
- package/integrations/initialization-scope.js +27 -0
- package/integrations/native-mount.js +30 -0
- package/integrations/shared.d.ts +23 -1
- package/integrations/shared.js +68 -22
- package/package.json +25 -3
- package/react/index.js +118 -37
- package/react/index.mjs +29 -0
- package/richtexteditor/all_plugins.js +8816 -2373
- package/richtexteditor/all_plugins.min.js +77 -59
- package/richtexteditor/lang/emoji/LICENSE-CLDR.txt +41 -0
- package/richtexteditor/lang/emoji/rte-emoji-de.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-es.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-fr.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-it.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-ja.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-ko.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-nl.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-pt-pt.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-pt.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-ru.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-zh-Hans.js +3 -0
- package/richtexteditor/lang/emoji/rte-emoji-zh-Hant.js +3 -0
- package/richtexteditor/lang/rte-lang-af.js +1 -0
- package/richtexteditor/lang/rte-lang-ar.js +1 -0
- package/richtexteditor/lang/rte-lang-bg.js +1 -0
- package/richtexteditor/lang/rte-lang-bn.js +1 -0
- package/richtexteditor/lang/rte-lang-bs.js +1 -0
- package/richtexteditor/lang/rte-lang-ca.js +1 -0
- package/richtexteditor/lang/rte-lang-cs.js +1 -0
- package/richtexteditor/lang/rte-lang-cy.js +1 -0
- package/richtexteditor/lang/rte-lang-da.js +1 -0
- package/richtexteditor/lang/rte-lang-de.js +1050 -2
- package/richtexteditor/lang/rte-lang-el.js +1 -0
- package/richtexteditor/lang/rte-lang-en.js +1 -0
- package/richtexteditor/lang/rte-lang-es.js +1056 -2
- package/richtexteditor/lang/rte-lang-et.js +1 -0
- package/richtexteditor/lang/rte-lang-fa.js +1 -0
- package/richtexteditor/lang/rte-lang-fi.js +1 -0
- package/richtexteditor/lang/rte-lang-fil.js +1 -0
- package/richtexteditor/lang/rte-lang-fj.js +1 -0
- package/richtexteditor/lang/rte-lang-fr.js +1056 -2
- package/richtexteditor/lang/rte-lang-ga.js +1 -0
- package/richtexteditor/lang/rte-lang-gu.js +1 -0
- package/richtexteditor/lang/rte-lang-he.js +1 -0
- package/richtexteditor/lang/rte-lang-hi.js +1 -0
- package/richtexteditor/lang/rte-lang-hr.js +1 -0
- package/richtexteditor/lang/rte-lang-ht.js +1 -0
- package/richtexteditor/lang/rte-lang-hu.js +1 -0
- package/richtexteditor/lang/rte-lang-id.js +1 -0
- package/richtexteditor/lang/rte-lang-is.js +1 -0
- package/richtexteditor/lang/rte-lang-it.js +1056 -2
- package/richtexteditor/lang/rte-lang-ja.js +1056 -2
- package/richtexteditor/lang/rte-lang-kn.js +1 -0
- package/richtexteditor/lang/rte-lang-ko.js +1056 -2
- package/richtexteditor/lang/rte-lang-lt.js +1 -0
- package/richtexteditor/lang/rte-lang-lv.js +1 -0
- package/richtexteditor/lang/rte-lang-mg.js +1 -0
- package/richtexteditor/lang/rte-lang-mi.js +1 -0
- package/richtexteditor/lang/rte-lang-ml.js +1 -0
- package/richtexteditor/lang/rte-lang-mr.js +1 -0
- package/richtexteditor/lang/rte-lang-ms.js +1 -0
- package/richtexteditor/lang/rte-lang-mt.js +1 -0
- package/richtexteditor/lang/rte-lang-mww.js +1 -0
- package/richtexteditor/lang/rte-lang-nb.js +1 -0
- package/richtexteditor/lang/rte-lang-nl.js +1056 -2
- package/richtexteditor/lang/rte-lang-otq.js +1 -0
- package/richtexteditor/lang/rte-lang-pa.js +1 -0
- package/richtexteditor/lang/rte-lang-pl.js +1 -0
- package/richtexteditor/lang/rte-lang-pt-pt.js +1056 -2
- package/richtexteditor/lang/rte-lang-pt.js +1056 -2
- package/richtexteditor/lang/rte-lang-ro.js +1 -0
- package/richtexteditor/lang/rte-lang-ru.js +1056 -2
- package/richtexteditor/lang/rte-lang-sk.js +1 -0
- package/richtexteditor/lang/rte-lang-sl.js +1 -0
- package/richtexteditor/lang/rte-lang-sm.js +1 -0
- package/richtexteditor/lang/rte-lang-sr-Cyrl.js +1 -0
- package/richtexteditor/lang/rte-lang-sr-Latn.js +1 -0
- package/richtexteditor/lang/rte-lang-sv.js +1 -0
- package/richtexteditor/lang/rte-lang-sw.js +1 -0
- package/richtexteditor/lang/rte-lang-ta.js +1 -0
- package/richtexteditor/lang/rte-lang-te.js +1 -0
- package/richtexteditor/lang/rte-lang-th.js +1 -0
- package/richtexteditor/lang/rte-lang-tlh-Latn.js +1 -0
- package/richtexteditor/lang/rte-lang-tlh-Piqd.js +1 -0
- package/richtexteditor/lang/rte-lang-to.js +1 -0
- package/richtexteditor/lang/rte-lang-tr.js +1 -0
- package/richtexteditor/lang/rte-lang-ty.js +1 -0
- package/richtexteditor/lang/rte-lang-uk.js +1 -0
- package/richtexteditor/lang/rte-lang-ur.js +1 -0
- package/richtexteditor/lang/rte-lang-vi.js +1 -0
- package/richtexteditor/lang/rte-lang-yua.js +1 -0
- package/richtexteditor/lang/rte-lang-zh-Hans.js +1050 -2
- package/richtexteditor/lang/rte-lang-zh-Hant.js +1050 -2
- package/richtexteditor/plugins/a11yenhance.js +4 -1
- package/richtexteditor/plugins/a11yenhance.min.js +1 -1
- package/richtexteditor/plugins/accessibilitychecker.js +256 -64
- package/richtexteditor/plugins/accessibilitychecker.min.js +1 -1
- package/richtexteditor/plugins/aitoolkit.js +1057 -386
- package/richtexteditor/plugins/aitoolkit.min.js +7 -7
- package/richtexteditor/plugins/all_plugins.js +8816 -2373
- package/richtexteditor/plugins/all_plugins.min.js +77 -59
- package/richtexteditor/plugins/autocorrect.js +66 -31
- package/richtexteditor/plugins/autocorrect.min.js +1 -1
- package/richtexteditor/plugins/autoembed.js +18 -1
- package/richtexteditor/plugins/autoembed.min.js +1 -1
- package/richtexteditor/plugins/blocktypes.js +18 -9
- package/richtexteditor/plugins/blocktypes.min.js +1 -1
- package/richtexteditor/plugins/bookmarkcard.js +12 -5
- package/richtexteditor/plugins/bookmarkcard.min.js +2 -2
- package/richtexteditor/plugins/changecase.js +72 -19
- package/richtexteditor/plugins/changecase.min.js +1 -1
- package/richtexteditor/plugins/charlimit.js +62 -2
- package/richtexteditor/plugins/charlimit.min.js +2 -2
- package/richtexteditor/plugins/comments.js +460 -61
- package/richtexteditor/plugins/comments.min.js +4 -3
- package/richtexteditor/plugins/contentminimap.js +28 -9
- package/richtexteditor/plugins/contentminimap.min.js +1 -1
- package/richtexteditor/plugins/crdt-engine.js +27 -1
- package/richtexteditor/plugins/crossreference.js +1 -1
- package/richtexteditor/plugins/crossreference.min.js +1 -1
- package/richtexteditor/plugins/dialoga11y.js +26 -4
- package/richtexteditor/plugins/dialoga11y.min.js +1 -1
- package/richtexteditor/plugins/dictation.js +1 -1
- package/richtexteditor/plugins/documentimport.js +250 -59
- package/richtexteditor/plugins/documentimport.min.js +4 -4
- package/richtexteditor/plugins/documentoutline.js +47 -8
- package/richtexteditor/plugins/documentoutline.min.js +1 -1
- package/richtexteditor/plugins/docxexport.js +233 -32
- package/richtexteditor/plugins/docxexport.min.js +2 -2
- package/richtexteditor/plugins/draghandle.js +267 -3
- package/richtexteditor/plugins/draghandle.min.js +1 -1
- package/richtexteditor/plugins/emailtoolkit.js +28 -14
- package/richtexteditor/plugins/emailtoolkit.min.js +1 -1
- package/richtexteditor/plugins/emojiautocomplete.js +111 -57
- package/richtexteditor/plugins/emojiautocomplete.min.js +1 -1
- package/richtexteditor/plugins/footnotes.js +65 -11
- package/richtexteditor/plugins/footnotes.min.js +1 -1
- package/richtexteditor/plugins/formatpainter.js +10 -0
- package/richtexteditor/plugins/formatpainter.min.js +1 -1
- package/richtexteditor/plugins/formattingmarks.js +6 -6
- package/richtexteditor/plugins/formattingmarks.min.js +1 -1
- package/richtexteditor/plugins/gapcursor.js +60 -0
- package/richtexteditor/plugins/gapcursor.min.js +1 -1
- package/richtexteditor/plugins/ghostcomplete.js +1 -1
- package/richtexteditor/plugins/html2pdf.js +8 -8
- package/richtexteditor/plugins/html2pdf.min.js +1 -1
- package/richtexteditor/plugins/imageeditor.js +31 -12
- package/richtexteditor/plugins/imageeditor.min.js +1 -1
- package/richtexteditor/plugins/importstyles.js +1 -1
- package/richtexteditor/plugins/inlinecode.js +25 -0
- package/richtexteditor/plugins/inlinecode.min.js +1 -1
- package/richtexteditor/plugins/insertcode.js +29 -11
- package/richtexteditor/plugins/insertcode.min.js +6 -6
- package/richtexteditor/plugins/insertemoji.js +113 -16
- package/richtexteditor/plugins/insertemoji.min.js +1 -1
- package/richtexteditor/plugins/insertgallery.js +46 -40
- package/richtexteditor/plugins/insertgallery.min.js +1 -1
- package/richtexteditor/plugins/inserttemplate.js +43 -19
- package/richtexteditor/plugins/inserttemplate.min.js +1 -1
- package/richtexteditor/plugins/keyboarda11y.js +66 -3
- package/richtexteditor/plugins/keyboarda11y.min.js +1 -1
- package/richtexteditor/plugins/layouttable.js +20 -0
- package/richtexteditor/plugins/layouttable.min.js +1 -1
- package/richtexteditor/plugins/linkchecker.js +29 -9
- package/richtexteditor/plugins/linkchecker.min.js +1 -1
- package/richtexteditor/plugins/localdraft.js +51 -7
- package/richtexteditor/plugins/localdraft.min.js +1 -1
- package/richtexteditor/plugins/markdownexport.js +159 -0
- package/richtexteditor/plugins/markdownexport.min.js +2 -2
- package/richtexteditor/plugins/mathdialog.js +11 -5
- package/richtexteditor/plugins/mathdialog.min.js +1 -1
- package/richtexteditor/plugins/mentionplugin.js +90 -27
- package/richtexteditor/plugins/mentionplugin.min.js +1 -1
- package/richtexteditor/plugins/mermaiddiagram.js +14 -8
- package/richtexteditor/plugins/mermaiddiagram.min.js +2 -2
- package/richtexteditor/plugins/multilevellist.js +4 -0
- package/richtexteditor/plugins/multilevellist.min.js +1 -1
- package/richtexteditor/plugins/nodetypes.js +1 -1
- package/richtexteditor/plugins/nodetypes.min.js +1 -1
- package/richtexteditor/plugins/pagination.js +2 -2
- package/richtexteditor/plugins/pagination.min.js +1 -1
- package/richtexteditor/plugins/pdfexport.js +1752 -1167
- package/richtexteditor/plugins/pdfexport.min.js +28 -13
- package/richtexteditor/plugins/permanentpen.js +3 -3
- package/richtexteditor/plugins/permanentpen.min.js +1 -1
- package/richtexteditor/plugins/readabilitystats.js +25 -11
- package/richtexteditor/plugins/readabilitystats.min.js +1 -1
- package/richtexteditor/plugins/readaloud.js +30 -16
- package/richtexteditor/plugins/readaloud.min.js +1 -1
- package/richtexteditor/plugins/restrictedediting.js +166 -0
- package/richtexteditor/plugins/restrictedediting.min.js +2 -2
- package/richtexteditor/plugins/revisionhistory.js +173 -41
- package/richtexteditor/plugins/revisionhistory.min.js +3 -3
- package/richtexteditor/plugins/rubyannotation.js +21 -11
- package/richtexteditor/plugins/rubyannotation.min.js +1 -1
- package/richtexteditor/plugins/sanitizer.js +119 -7
- package/richtexteditor/plugins/sanitizer.min.js +1 -1
- package/richtexteditor/plugins/slashcommand.js +32 -18
- package/richtexteditor/plugins/slashcommand.min.js +2 -2
- package/richtexteditor/plugins/smartchips.js +39 -25
- package/richtexteditor/plugins/smartchips.min.js +2 -2
- package/richtexteditor/plugins/spellcheck.js +20 -11
- package/richtexteditor/plugins/spellcheck.min.js +2 -2
- package/richtexteditor/plugins/stateinspector.js +21 -11
- package/richtexteditor/plugins/stateinspector.min.js +2 -2
- package/richtexteditor/plugins/structured-content-bridge.js +90 -32
- package/richtexteditor/plugins/structured-content-bridge.min.js +8 -8
- package/richtexteditor/plugins/tableofcontents.js +5 -2
- package/richtexteditor/plugins/tableofcontents.min.js +1 -1
- package/richtexteditor/plugins/tabletools.js +388 -3
- package/richtexteditor/plugins/tabletools.min.js +1 -1
- package/richtexteditor/plugins/textdirection.js +19 -6
- package/richtexteditor/plugins/textdirection.min.js +1 -1
- package/richtexteditor/plugins/textpartlanguage.js +161 -32
- package/richtexteditor/plugins/textpartlanguage.min.js +1 -1
- package/richtexteditor/plugins/todolist.js +90 -6
- package/richtexteditor/plugins/todolist.min.js +1 -1
- package/richtexteditor/plugins/trackedchanges.js +1812 -25
- package/richtexteditor/plugins/trackedchanges.min.js +5 -3
- package/richtexteditor/plugins/wordexport.js +2 -2
- package/richtexteditor/plugins/yjscollab.js +11 -6
- package/richtexteditor/plugins/yjscollab.min.js +1 -1
- package/richtexteditor/plugins/zz_richtextbox_dialog_style.js +22 -13
- package/richtexteditor/plugins/zz_richtextbox_dialog_style.min.js +1 -1
- package/richtexteditor/rte-config.js +144 -86
- package/richtexteditor/rte-headless.js +19 -4
- package/richtexteditor/rte-watchdog.js +3 -1
- package/richtexteditor/rte-webcomponent.js +91 -16
- package/richtexteditor/rte.js +146 -88
- package/richtexteditor/runtime/colorpicker_more_ns.htm +3 -1
- package/scripts/build-angular.mjs +97 -0
- package/svelte/index.d.ts +2 -1
- package/svelte/index.js +80 -9
- package/vue/index.js +130 -34
- package/angular/component.ts +0 -297
- package/angular/index.ts +0 -24
|
@@ -1 +1 @@
|
|
|
1
|
-
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_footnotes=RTE_Plugin_Footnotes,typeof RTE_DefaultConfig.footnotesTitle>"u"&&(RTE_DefaultConfig.footnotesTitle="Footnotes"),typeof RTE_DefaultConfig.footnotesNumbering>"u"&&(RTE_DefaultConfig.footnotesNumbering="decimal"),typeof RTE_DefaultConfig.footnotesMarkerPrefix>"u"&&(RTE_DefaultConfig.footnotesMarkerPrefix=""),typeof RTE_DefaultConfig.footnotesMarkerSuffix>"u"&&(RTE_DefaultConfig.footnotesMarkerSuffix="");function RTE_Plugin_Footnotes(){var g=this,
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_footnotes=RTE_Plugin_Footnotes,typeof RTE_DefaultConfig.footnotesTitle>"u"&&(RTE_DefaultConfig.footnotesTitle="Footnotes"),typeof RTE_DefaultConfig.footnotesNumbering>"u"&&(RTE_DefaultConfig.footnotesNumbering="decimal"),typeof RTE_DefaultConfig.footnotesMarkerPrefix>"u"&&(RTE_DefaultConfig.footnotesMarkerPrefix=""),typeof RTE_DefaultConfig.footnotesMarkerSuffix>"u"&&(RTE_DefaultConfig.footnotesMarkerSuffix="");function RTE_Plugin_Footnotes(){var g=this,u,a,q=null,k=!1;g.PluginName="Footnotes",g.InitConfig=function(t){u=t},g.InitEditor=function(t){a=t,a.attachEvent("exec_command_insertfootnote",function(e){e.returnValue=!0,g.InsertFootnote()}),S();try{a.attachEvent("ready",S)}catch{}try{a.attachEvent("aftersethtml",function(){S(),p()})}catch{}setTimeout(function(){S(),p()},0),a.insertFootnote=function(e){return g.InsertFootnote(e)},a.getFootnotes=function(){return g.List()},a.syncFootnotes=function(){return D()},a.getFootnotesCss=function(){return P()}};function S(){var t=x();t&&(J(t),t!==q&&(z(),q=t))}function x(){try{return a.getDocument()}catch{return null}}function m(){try{return a.getEditable()}catch{return null}}function z(){var t=m();if(t){t.addEventListener("keyup",p),t.addEventListener("cut",p),t.addEventListener("paste",p);try{h&&h.disconnect(),h=new MutationObserver(function(){R||p()}),h.observe(t,{childList:!0,subtree:!0,characterData:!0})}catch{}t.addEventListener("drop",p),t.addEventListener("click",function(e){var r=L(e.target,"rte-fn-ref",t),n=L(e.target,"rte-fn-back",t),o=null;if(r?o=_(r.getAttribute("data-fn-id")):n&&(o=$(n.getAttribute("data-fn-id"))),!!o){e.preventDefault();try{o.scrollIntoView({block:"center"})}catch{o.scrollIntoView()}G(o)}})}}var h=null,R=!1;function B(){R=!0;try{D()}finally{if(h)try{h.takeRecords()}catch{}R=!1}}function p(){k||(k=!0,setTimeout(function(){k=!1,B()},0))}function L(t,e,r){for(;t&&t!==r;){if(t.nodeType===1&&t.classList&&t.classList.contains(e))return t;t=t.parentNode}return null}function F(){return"fn"+Math.floor(Math.random()*1e9).toString(36)+(V++).toString(36)}var V=0;function Q(){var t=m();return t?Array.prototype.slice.call(t.querySelectorAll("sup.rte-fn-ref[data-fn-id]")):[]}function C(){var t=m();return t?t.querySelector("section.rte-footnotes"):null}function $(t){var e=m();return e?e.querySelector('sup.rte-fn-ref[data-fn-id="'+E(t)+'"]'):null}function E(t){return String(t).replace(/["\\]/g,"\\$&")}g.InsertFootnote=function(t){var e=x(),r=m();if(!e||!r)return null;var n=F(),o=e.createElement("sup");o.className="rte-fn-ref",o.setAttribute("data-fn-id",n),o.setAttribute("contenteditable","false"),o.setAttribute("id","fnref-"+n),o.textContent="0";var l=!1;try{typeof a.insertElement=="function"&&(a.insertElement(o),l=!0)}catch{}if(!l)try{var f=a.getSelection();if(f&&f.rangeCount){var i=f.getRangeAt(0);i.collapse(!1),i.insertNode(o),i.setStartAfter(o),i.collapse(!0),f.removeAllRanges(),f.addRange(i),l=!0}}catch{}l||r.appendChild(o);var s=w(e).querySelector("ol.rte-fn-list"),d=e.createElement("li");d.className="rte-fn-note",d.setAttribute("data-fn-id",n),d.setAttribute("id","fn-"+n),t!=null&&String(t)!==""&&d.appendChild(e.createTextNode(String(t)));var c=e.createElement("a");c.className="rte-fn-back",c.setAttribute("data-fn-id",n),c.setAttribute("href","#fnref-"+n),c.setAttribute("contenteditable","false"),c.setAttribute("title",typeof u<"u"&&u&&u.text_fn_backref||"Back to reference"),c.textContent="\u21A9",d.appendChild(c),s.appendChild(d),D();try{var b=e.createRange();b.setStart(d,0),b.collapse(!0);var y=a.getSelection();y.removeAllRanges(),y.addRange(b),typeof a.focus=="function"&&a.focus()}catch{}return H(),n};function w(t){var e=m(),r=C();if(r)return r;r=t.createElement("section"),r.className="rte-footnotes";var n=String(u.footnotesTitle==null?"":u.footnotesTitle);if(n){var o=t.createElement("h2");o.className="rte-fn-title",o.textContent=n,r.appendChild(o)}var l=t.createElement("ol");return l.className="rte-fn-list",r.appendChild(l),e.appendChild(r),r}function D(){var t=x(),e=C(),r=Q();if(!r.length)return e&&I(e.querySelectorAll("li.rte-fn-note")),e&&e.parentNode&&e.parentNode.removeChild(e),[];if(!t)return[];e||(e=w(t));var n=e.querySelector("ol.rte-fn-list");n||(n=t.createElement("ol"),n.className="rte-fn-list",e.appendChild(n));for(var o={},l=[],f=0;f<r.length;f++){var i=r[f],s=i.getAttribute("data-fn-id"),d=null;if(o[s]){d=s;var c=F();i.setAttribute("data-fn-id",c),i.setAttribute("id","fnref-"+c),s=c}o[s]=!0;var b=String(f+1),y=String(u.footnotesMarkerPrefix||"")+b+String(u.footnotesMarkerSuffix||"");i.textContent!==y&&(i.textContent=y),i.setAttribute("data-fn-number",b),i.getAttribute("contenteditable")!=="false"&&i.setAttribute("contenteditable","false"),i.getAttribute("id")!=="fnref-"+s&&i.setAttribute("id","fnref-"+s);var v=n.querySelector('li.rte-fn-note[data-fn-id="'+E(s)+'"]');v||(v=_(t,n,s,d)),v.setAttribute("data-fn-number",b),n.appendChild(v),l.push({id:s,number:f+1,text:M(v)})}for(var T=Array.prototype.slice.call(n.querySelectorAll("li.rte-fn-note")),A=0;A<T.length;A++)o[T[A].getAttribute("data-fn-id")]||(I([T[A]]),n.removeChild(T[A]));return n.getAttribute("data-numbering")!==u.footnotesNumbering&&n.setAttribute("data-numbering",u.footnotesNumbering),l}var N={};function I(t){for(var e=0;e<t.length;e++){var r=t[e].getAttribute("data-fn-id");r&&(N[r]=t[e])}}function _(t,e,r,n){var o=N[r];if(o)return delete N[r],o;var l=n?e.querySelector('li.rte-fn-note[data-fn-id="'+E(n)+'"]')||N[n]:null;if(l){o=l.cloneNode(!0);for(var f=o.querySelectorAll("a.rte-fn-back"),i=0;i<f.length;i++)f[i].setAttribute("data-fn-id",r),f[i].setAttribute("href","#fnref-"+r)}else o=t.createElement("li"),o.className="rte-fn-note";return o.setAttribute("data-fn-id",r),o.setAttribute("id","fn-"+r),o}function M(t){if(!t)return"";for(var e=t.cloneNode(!0),r=e.querySelectorAll?e.querySelectorAll("a.rte-fn-back"):[],n=0;n<r.length;n++)r[n].parentNode&&r[n].parentNode.removeChild(r[n]);return(e.textContent||"").replace(/\u21a9/g,"").trim()}g.List=function(){var t=C();if(!t)return[];for(var e=[],r=t.querySelectorAll("li.rte-fn-note"),n=0;n<r.length;n++)e.push({id:r[n].getAttribute("data-fn-id"),number:parseInt(r[n].getAttribute("data-fn-number"),10)||n+1,text:M(r[n])});return e};function G(t){!t||!t.classList||(t.classList.add("rte-fn-flash"),setTimeout(function(){try{t.classList.remove("rte-fn-flash")}catch{}},900))}function H(){try{typeof a.updateDesign=="function"&&a.updateDesign()}catch{}try{typeof a.fireChange=="function"&&a.fireChange()}catch{}}function P(){var t=String(u.footnotesNumbering||"decimal");return"sup.rte-fn-ref{cursor:pointer;font-size:.72em;line-height:0;vertical-align:super;color:#1474ea;font-weight:700;padding:0 .12em;user-select:none;}sup.rte-fn-ref:hover{text-decoration:underline;}section.rte-footnotes{margin-top:2em;padding-top:.85em;border-top:1px solid #ddd;font-size:.88em;color:#333;}section.rte-footnotes h2.rte-fn-title{font-size:1em;font-weight:700;margin:0 0 .5em;}ol.rte-fn-list{list-style:"+t+";padding-left:1.6em;margin:0;}ol.rte-fn-list>li{margin:.25em 0;}a.rte-fn-back{text-decoration:none;color:#1474ea;cursor:pointer;user-select:none;}.rte-fn-flash{background:#fff3b0;transition:background .5s ease;}"}function J(t){if(t){var e=t.getElementById("rte-footnotes-styles"),r=P();if(e){if(e.getAttribute("data-css")===r)return;e.parentNode&&e.parentNode.removeChild(e)}var n=t.createElement("style");n.id="rte-footnotes-styles",n.setAttribute("data-css",r),n.appendChild(t.createTextNode(r)),(t.head||t.getElementsByTagName("head")[0]||t.documentElement).appendChild(n),a&&typeof a.ensureStyleSheetLive=="function"&&a.ensureStyleSheetLive(t,n,"rte-footnotes-styles",r)}}}
|
|
@@ -66,6 +66,16 @@ function RTE_Plugin_FormatPainter() {
|
|
|
66
66
|
editor.cancelFormatPainter = function () { return obj.Cancel(); };
|
|
67
67
|
editor.isFormatPainterActive = function () { return !!captured; };
|
|
68
68
|
editor.getCapturedFormatting = function () { return captured ? cloneProps(captured.props) : null; };
|
|
69
|
+
|
|
70
|
+
// 2026-10-17 Ctrl/Cmd+Alt+C copies the selection's formatting and Ctrl/Cmd+Alt+V applies it, as in Google Docs. A key
|
|
71
|
+
// that reports a character other than c / v is AltGr typing (Ctrl+Alt on Windows) and is left alone.
|
|
72
|
+
// tools/keyboard/format-case-keys.mjs
|
|
73
|
+
(editor.bindDocumentEvent ? function (fn) { editor.bindDocumentEvent("keydown", fn, true); } : function (fn) { editor.getDocument().addEventListener("keydown", fn, true); })(function (e) {
|
|
74
|
+
if (!(e.ctrlKey || e.metaKey) || !e.altKey || e.shiftKey) return;
|
|
75
|
+
var k = e.key;
|
|
76
|
+
if (k === "c" || k === "C") { e.preventDefault(); obj.Copy(); }
|
|
77
|
+
else if (k === "v" || k === "V") { if (!captured) return; e.preventDefault(); obj.Paint(); }
|
|
78
|
+
});
|
|
69
79
|
};
|
|
70
80
|
|
|
71
81
|
function setup() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_formatpainter=RTE_Plugin_FormatPainter,typeof RTE_DefaultConfig.formatPainterProperties>"u"&&(RTE_DefaultConfig.formatPainterProperties=["font-family","font-size","font-weight","font-style","text-decoration-line","color","background-color","letter-spacing","text-transform","font-variant"]);function RTE_Plugin_FormatPainter(){var i=this,p,a,u=null,v=!1,
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_formatpainter=RTE_Plugin_FormatPainter,typeof RTE_DefaultConfig.formatPainterProperties>"u"&&(RTE_DefaultConfig.formatPainterProperties=["font-family","font-size","font-weight","font-style","text-decoration-line","color","background-color","letter-spacing","text-transform","font-variant"]);function RTE_Plugin_FormatPainter(){var i=this,p,a,u=null,v=!1,E=null,N={B:1,STRONG:1,I:1,EM:1,U:1,S:1,STRIKE:1,FONT:1,BIG:1,SMALL:1};i.PluginName="FormatPainter",i.InitConfig=function(e){p=e},i.InitEditor=function(e){a=e,a.attachEvent("exec_command_formatpainter",function(t){t.returnValue=!0,i.Toggle()}),d();try{a.attachEvent("ready",d)}catch{}try{a.attachEvent("aftersethtml",d)}catch{}setTimeout(d,0),a.copyFormatting=function(){return i.Copy()},a.pasteFormatting=function(){return i.Paint()},a.toggleFormatPainter=function(t){return i.Toggle(t)},a.cancelFormatPainter=function(){return i.Cancel()},a.isFormatPainterActive=function(){return!!u},a.getCapturedFormatting=function(){return u?P(u.props):null},(a.bindDocumentEvent?function(t){a.bindDocumentEvent("keydown",t,!0)}:function(t){a.getDocument().addEventListener("keydown",t,!0)})(function(t){if(!(!(t.ctrlKey||t.metaKey)||!t.altKey||t.shiftKey)){var r=t.key;if(r==="c"||r==="C")t.preventDefault(),i.Copy();else if(r==="v"||r==="V"){if(!u)return;t.preventDefault(),i.Paint()}}})};function d(){var e=y();if(e&&(F(e),e!==E)){E=e;var t=m();t&&(t.addEventListener("mouseup",function(){u&&setTimeout(function(){u&&i.Paint()},0)}),t.addEventListener("keydown",function(r){r.key==="Escape"&&u&&(i.Cancel(),r.preventDefault())}))}}function y(){try{return a.getDocument()}catch{return null}}function m(){try{return a.getEditable()}catch{return null}}function P(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function T(){try{var e=a.getSelection();if(!e||e.rangeCount===0)return null;var t=e.getRangeAt(0).startContainer;return t&&t.nodeType===3&&(t=t.parentNode),t&&t.nodeType===1?t:null}catch{return null}}i.Copy=function(){var e=T(),t=y();if(!e||!t)return null;for(var r=t.defaultView||window,n=r.getComputedStyle(e),l=m(),o=l?r.getComputedStyle(l):null,f={},s=p.formatPainterProperties||[],c=0;c<s.length;c++){var h=s[c],C=n.getPropertyValue(h);C&&(o&&C===o.getPropertyValue(h)||(f[h]=C))}return f["background-color"]&&/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/.test(f["background-color"])&&delete f["background-color"],u={props:f},b(!0),P(f)},i.Paint=function(){if(!u)return!1;var e=y(),t;try{t=a.getSelection()}catch{return!1}if(!e||!t||t.rangeCount===0||t.getRangeAt(0).collapsed)return!1;var r=e.createElement("span");r.className="rte-painted";var n=u.props;for(var l in n)n.hasOwnProperty(l)&&r.style.setProperty(l,n[l]);var o=null;try{o=a.surroundElement(r)}catch{o=null}return o?(A(o,p.formatPainterProperties||[]),w(o),v||i.Cancel(),L(),!0):!1};function A(e,t){for(var r=e.getElementsByTagName("*"),n=Array.prototype.slice.call(r),l=0;l<n.length;l++){var o=n[l];if(o.style){for(var f=0;f<t.length;f++)o.style.removeProperty(t[f]);o.style.removeProperty("font"),o.style.removeProperty("text-decoration")}o.nodeName==="FONT"&&(o.removeAttribute("color"),o.removeAttribute("face"),o.removeAttribute("size"))}for(var s=0;s<n.length;s++){var c=n[s];N[c.nodeName]&&c.parentNode&&g(c)}S(e)}function S(e){for(var t=Array.prototype.slice.call(e.getElementsByTagName("*")),r=0;r<t.length;r++){var n=t[r];if(n.getAttribute&&n.getAttribute("style")===""&&n.removeAttribute("style"),n.nodeName==="SPAN"&&n.classList&&n.classList.contains("rte-painted")&&n.parentNode){g(n);continue}n.nodeName==="SPAN"&&!n.attributes.length&&n.parentNode&&g(n)}e.getAttribute&&e.getAttribute("style")===""&&e.removeAttribute("style")}function g(e){for(var t=e.parentNode;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}function w(e){for(var t=0;t<32;t++){var r=e.parentNode;if(!r||r.nodeType!==1||r.nodeName!=="SPAN"||!r.classList||!r.classList.contains("rte-painted")||!D(r,e))return;g(r)}}function D(e,t){for(var r=0;r<e.childNodes.length;r++){var n=e.childNodes[r];if(n!==t&&!(n.nodeType===3&&n.nodeValue.length===0))return!1}return!0}i.Toggle=function(e){return v=!!e,u?(i.Cancel(),!1):(i.Copy(),!!u)},i.Cancel=function(){return u=null,v=!1,b(!1),!0};function b(e){var t=m();!t||!t.classList||(e?t.classList.add("rte-format-painting"):t.classList.remove("rte-format-painting"))}function L(){try{typeof a.updateDesign=="function"&&a.updateDesign()}catch{}try{typeof a.fireChange=="function"&&a.fireChange()}catch{}}function R(){return".rte-format-painting,.rte-format-painting *{cursor:copy !important;}"}function F(e){if(e&&!e.getElementById("rte-format-painter-styles")){var t=e.createElement("style");t.id="rte-format-painter-styles",t.appendChild(e.createTextNode(R())),(e.head||e.getElementsByTagName("head")[0]||e.documentElement).appendChild(t),a&&typeof a.ensureStyleSheetLive=="function"&&a.ensureStyleSheetLive(e,t,"rte-format-painter-styles",t.textContent)}}}
|
|
@@ -35,11 +35,11 @@ function RTE_Plugin_FormattingMarks() {
|
|
|
35
35
|
// differently. These are what people are actually hunting when they turn
|
|
36
36
|
// formatting marks on after pasting from somewhere else.
|
|
37
37
|
var INVISIBLES = [
|
|
38
|
-
{ ch: "
|
|
39
|
-
{ ch: "
|
|
40
|
-
{ ch: "
|
|
41
|
-
{ ch: "
|
|
42
|
-
{ ch: "
|
|
38
|
+
{ ch: "\xa0", cls: "rte-fm-nbsp", label: "\xb7" }, // non-breaking space
|
|
39
|
+
{ ch: "\u200b", cls: "rte-fm-zwsp", label: "\u2400" }, // zero-width space
|
|
40
|
+
{ ch: "\u200e", cls: "rte-fm-bidi", label: "\u200e" }, // LTR mark
|
|
41
|
+
{ ch: "\u200f", cls: "rte-fm-bidi", label: "\u200f" }, // RTL mark
|
|
42
|
+
{ ch: "\xad", cls: "rte-fm-shy", label: "-" } // soft hyphen
|
|
43
43
|
];
|
|
44
44
|
|
|
45
45
|
obj.PluginName = "FormattingMarks";
|
|
@@ -167,7 +167,7 @@ function RTE_Plugin_FormattingMarks() {
|
|
|
167
167
|
// browser turns back into a space when the next character arrives. Wrapped in a
|
|
168
168
|
// non-editable marker it never could, and saved as a hard . Leave the one
|
|
169
169
|
// right before the caret alone; it is marked once the caret moves on.
|
|
170
|
-
if (def && text[i] === "
|
|
170
|
+
if (def && text[i] === "\xa0" && i === keepStart - 1 && keepStart === keepEnd) def = null;
|
|
171
171
|
if (!def) { buf += text[i]; continue; }
|
|
172
172
|
if (buf) { pieces.push({ node: frag.appendChild(doc.createTextNode(buf)), marker: false }); buf = ""; }
|
|
173
173
|
var span = doc.createElement("span");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_formattingmarks=RTE_Plugin_FormattingMarks,typeof RTE_DefaultConfig.formattingMarkPilcrow>"u"&&(RTE_DefaultConfig.formattingMarkPilcrow=!0),typeof RTE_DefaultConfig.formattingMarkBlocks>"u"&&(RTE_DefaultConfig.formattingMarkBlocks=!0),typeof RTE_DefaultConfig.formattingMarkInvisibles>"u"&&(RTE_DefaultConfig.formattingMarkInvisibles=!0);function RTE_Plugin_FormattingMarks(){var m=this,C,o,S=null,u=!1,A=!1,
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_formattingmarks=RTE_Plugin_FormattingMarks,typeof RTE_DefaultConfig.formattingMarkPilcrow>"u"&&(RTE_DefaultConfig.formattingMarkPilcrow=!0),typeof RTE_DefaultConfig.formattingMarkBlocks>"u"&&(RTE_DefaultConfig.formattingMarkBlocks=!0),typeof RTE_DefaultConfig.formattingMarkInvisibles>"u"&&(RTE_DefaultConfig.formattingMarkInvisibles=!0);function RTE_Plugin_FormattingMarks(){var m=this,C,o,S=null,u=!1,A=!1,N=!1,v=[{ch:"\xA0",cls:"rte-fm-nbsp",label:"\xB7"},{ch:"\u200B",cls:"rte-fm-zwsp",label:"\u2400"},{ch:"\u200E",cls:"rte-fm-bidi",label:"\u200E"},{ch:"\u200F",cls:"rte-fm-bidi",label:"\u200F"},{ch:"\xAD",cls:"rte-fm-shy",label:"-"}];m.PluginName="FormattingMarks",m.InitConfig=function(e){C=e},m.InitEditor=function(e){o=e,o.attachEvent("exec_command_formattingmarks",function(t){t.returnValue=!0,m.Toggle()}),E();try{o.attachEvent("ready",E)}catch{}try{o.attachEvent("aftersethtml",function(){E(),u&&_()})}catch{}setTimeout(E,0),o.setFormattingMarks=function(t){return u=!!t,I(),u},o.toggleFormattingMarks=function(){return m.Toggle()},o.isFormattingMarks=function(){return u},o.getFormattingMarksCss=function(){return O()}},m.Toggle=function(){return u=!u,I(),u};function E(){var e=R();if(e&&(H(e),W(),e!==S)){S=e;var t=h();t&&(t.addEventListener("keyup",function(){u&&_()}),t.addEventListener("paste",function(){u&&_()}))}}function R(){try{return o.getDocument()}catch{return null}}function h(){try{return o.getEditable()}catch{return null}}function _(){N||(N=!0,setTimeout(function(){N=!1,F()},0))}function I(){var e=h();e&&(e.classList&&(e.classList.toggle("rte-fm-on",u),e.classList.toggle("rte-fm-pilcrow",u&&C.formattingMarkPilcrow!==!1),e.classList.toggle("rte-fm-blocks",u&&C.formattingMarkBlocks!==!1)),u&&C.formattingMarkInvisibles!==!1?F():L())}function L(){var e=h();if(e)for(var t=e.querySelectorAll("span[data-rte-fm]"),n=0;n<t.length;n++){var r=t[n],a=r.parentNode;a&&(a.replaceChild(r.ownerDocument.createTextNode(r.getAttribute("data-rte-fm-char")||""),r),a.normalize())}}function F(){var e=h(),t=R();if(!(!e||!t)){L();for(var n={},r=0;r<v.length;r++)n[v[r].ch]=v[r];for(var a=t.createTreeWalker(e,4,null,!1),i=[],f;f=a.nextNode();)if(f.nodeValue){for(var l=0;l<v.length;l++)if(f.nodeValue.indexOf(v[l].ch)>=0){i.push(f);break}}for(var s=0;s<i.length;s++)V(t,i[s],n)}}function V(e,t,n){var r=t.nodeValue,a=t.parentNode;if(!a||a.nodeName==="CODE"||a.nodeName==="PRE")return;for(var i=e.getSelection?e.getSelection():null,f=i&&i.rangeCount?i.getRangeAt(0):null,l=f&&f.startContainer===t?f.startOffset:-1,s=f&&f.endContainer===t?f.endOffset:-1,w=e.createDocumentFragment(),c=[],g="",d=0;d<r.length;d++){var b=n[r[d]];if(b&&r[d]==="\xA0"&&d===l-1&&l===s&&(b=null),!b){g+=r[d];continue}g&&(c.push({node:w.appendChild(e.createTextNode(g)),marker:!1}),g="");var p=e.createElement("span");p.setAttribute("data-rte-fm","1"),p.setAttribute("data-rte-fm-char",r[d]),p.className=b.cls,p.setAttribute("contenteditable","false"),p.textContent=b.label,c.push({node:w.appendChild(p),marker:!0})}if(g&&c.push({node:w.appendChild(e.createTextNode(g)),marker:!1}),a.replaceChild(w,t),l<0&&s<0)return;function q(x){for(var y=0,D=0;D<c.length;D++){var T=c[D];if(T.marker){if(x<=y)return{node:a,offset:Array.prototype.indexOf.call(a.childNodes,T.node)};y+=1}else{var P=T.node.nodeValue.length;if(x<=y+P)return{node:T.node,offset:x-y};y+=P}}var J=c[c.length-1].node;return{node:a,offset:Array.prototype.indexOf.call(a.childNodes,J)+1}}try{var k=e.createRange(),M=q(l>=0?l:0),B=s>=0?q(s):M;l<0?k.setStart(f.startContainer,f.startOffset):k.setStart(M.node,M.offset),s<0?k.setEnd(f.endContainer,f.endOffset):k.setEnd(B.node,B.offset),i.removeAllRanges(),i.addRange(k)}catch{}}function z(){var e=h();if(!e)return function(){};var t=Array.prototype.slice.call(e.querySelectorAll("span[data-rte-fm]"));if(!t.length)return function(){};for(var n=[],r=0;r<t.length;r++){var a=t[r],i=a.ownerDocument.createTextNode(a.getAttribute("data-rte-fm-char")||"");n.push({span:a,parent:a.parentNode,text:i}),a.parentNode&&a.parentNode.replaceChild(i,a)}return function(){for(var l=0;l<n.length;l++){var s=n[l];s.text.parentNode&&s.text.parentNode.replaceChild(s.span,s.text)}}}function W(){if(!A){for(var e=["getHTMLCode","getJSON","getHTMLContent","getText"],t=!1,n=0;n<e.length;n++)(function(r){var a=o[r];if(!(typeof a!="function"||a.__rteFmWrapped)){var i=function(){var f=z();try{return a.apply(o,arguments)}finally{f()}};i.__rteFmWrapped=!0,o[r]=i,t=!0}})(e[n]);t&&(A=!0)}}function O(){return".rte-fm-pilcrow p::after,.rte-fm-pilcrow h1::after,.rte-fm-pilcrow h2::after,.rte-fm-pilcrow h3::after,.rte-fm-pilcrow h4::after,.rte-fm-pilcrow h5::after,.rte-fm-pilcrow h6::after,.rte-fm-pilcrow li::after,.rte-fm-pilcrow blockquote::after{content:'\\00b6';color:#9aa4b5;opacity:.65;font-weight:400;}.rte-fm-blocks p,.rte-fm-blocks h1,.rte-fm-blocks h2,.rte-fm-blocks h3,.rte-fm-blocks h4,.rte-fm-blocks h5,.rte-fm-blocks h6,.rte-fm-blocks ul,.rte-fm-blocks ol,.rte-fm-blocks blockquote,.rte-fm-blocks table,.rte-fm-blocks div{outline:1px dashed rgba(120,140,170,.45);outline-offset:1px;}span[data-rte-fm]{color:#c2410c;opacity:.75;user-select:none;}.rte-fm-nbsp{background:rgba(194,65,12,.10);border-radius:2px;}.rte-fm-zwsp,.rte-fm-shy,.rte-fm-bidi{background:rgba(194,65,12,.18);border-radius:2px;font-size:.8em;vertical-align:middle;}"}function H(e){if(e){var t=e.getElementById("rte-formatting-marks-styles"),n=O();if(t){if(t.getAttribute("data-css")===n)return;t.parentNode&&t.parentNode.removeChild(t)}var r=e.createElement("style");r.id="rte-formatting-marks-styles",r.setAttribute("data-css",n),r.appendChild(e.createTextNode(n)),(e.head||e.getElementsByTagName("head")[0]||e.documentElement).appendChild(r),o&&typeof o.ensureStyleSheetLive=="function"&&o.ensureStyleSheetLive(e,r,"rte-formatting-marks-styles",r.textContent)}}}
|
|
@@ -137,6 +137,9 @@ function RTE_Plugin_GapCursor() {
|
|
|
137
137
|
var ed = getEditable();
|
|
138
138
|
var doc = getDoc();
|
|
139
139
|
if (!ed || !doc) return null;
|
|
140
|
+
// 2026-10-14 Suggesting mode: an empty paragraph is not tracked yet, so the track hook refuses it.
|
|
141
|
+
// tools/review/suggesting-structure-audit.mjs
|
|
142
|
+
if (editor.__trackHook && editor.__trackHook("insert-block", {}) === true) return null;
|
|
140
143
|
// Resolve against the hint-free list, then insert relative to that node.
|
|
141
144
|
hideHint();
|
|
142
145
|
var p = makeParagraph(doc);
|
|
@@ -151,6 +154,8 @@ function RTE_Plugin_GapCursor() {
|
|
|
151
154
|
var ed = getEditable();
|
|
152
155
|
var doc = getDoc();
|
|
153
156
|
if (!ed || !doc || !el) return null;
|
|
157
|
+
// 2026-10-14 Suggesting mode: an empty paragraph is not tracked yet, so the track hook refuses it.
|
|
158
|
+
if (editor.__trackHook && editor.__trackHook("insert-block", {}) === true) return null;
|
|
154
159
|
var p = makeParagraph(doc);
|
|
155
160
|
if (after) el.parentNode.insertBefore(p, el.nextSibling);
|
|
156
161
|
else el.parentNode.insertBefore(p, el);
|
|
@@ -182,8 +187,60 @@ function RTE_Plugin_GapCursor() {
|
|
|
182
187
|
return (n && n.parentNode === ed) ? n : null;
|
|
183
188
|
}
|
|
184
189
|
|
|
190
|
+
// 2026-10-03 Is the caret at the edge of a block it can be INSIDE (table, code block, figure)?
|
|
191
|
+
// Atomic blocks (rule, image, embed) hold no caret, so they always count as the edge.
|
|
192
|
+
// vertical: the first/last row (tables) and the first/last visual line; otherwise the very
|
|
193
|
+
// first/last character position. tools/keyboard/gapcursor-edges.mjs
|
|
194
|
+
function caretAtEdge(block, range, forward, vertical) {
|
|
195
|
+
if (!/^(TABLE|PRE|FIGURE)$/.test(block.nodeName)) return true;
|
|
196
|
+
var scope = block;
|
|
197
|
+
if (block.nodeName === "TABLE") {
|
|
198
|
+
var cell = range.startContainer;
|
|
199
|
+
while (cell && cell !== block && !/^(TD|TH)$/.test(cell.nodeName)) cell = cell.parentNode;
|
|
200
|
+
var rows = block.rows;
|
|
201
|
+
if (!cell || cell === block || !rows || !rows.length) return true;
|
|
202
|
+
var edgeRow = forward ? rows[rows.length - 1] : rows[0];
|
|
203
|
+
if (vertical) {
|
|
204
|
+
if (cell.parentNode !== edgeRow) return false;
|
|
205
|
+
} else {
|
|
206
|
+
var edgeCell = forward ? edgeRow.cells[edgeRow.cells.length - 1] : edgeRow.cells[0];
|
|
207
|
+
if (cell !== edgeCell) return false;
|
|
208
|
+
}
|
|
209
|
+
scope = cell;
|
|
210
|
+
}
|
|
211
|
+
var doc = scope.ownerDocument;
|
|
212
|
+
if (vertical) {
|
|
213
|
+
var rc = null;
|
|
214
|
+
try {
|
|
215
|
+
var rects = range.getClientRects();
|
|
216
|
+
rc = rects && rects.length ? rects[0] : null;
|
|
217
|
+
if (!rc || !rc.height) {
|
|
218
|
+
var n = range.startContainer.nodeType === 3 ? range.startContainer.parentNode : range.startContainer;
|
|
219
|
+
rc = n && n.getBoundingClientRect ? n.getBoundingClientRect() : null;
|
|
220
|
+
}
|
|
221
|
+
} catch (er) { rc = null; }
|
|
222
|
+
if (!rc || !rc.height) return true;
|
|
223
|
+
var sr = scope.getBoundingClientRect();
|
|
224
|
+
var lh = Math.max(rc.height, 12);
|
|
225
|
+
return forward ? (sr.bottom - rc.bottom < lh) : (rc.top - sr.top < lh);
|
|
226
|
+
}
|
|
227
|
+
var r = doc.createRange();
|
|
228
|
+
if (forward) { r.setStart(range.endContainer, range.endOffset); r.setEnd(scope, scope.childNodes.length); }
|
|
229
|
+
else { r.setStart(scope, 0); r.setEnd(range.startContainer, range.startOffset); }
|
|
230
|
+
if (r.toString().replace(/\u200b/g, "") !== "") return false;
|
|
231
|
+
// a line break or an object between the caret and the edge is still a position to travel to
|
|
232
|
+
// (a filler <br> as the scope's last child is not)
|
|
233
|
+
var objs = r.cloneContents().querySelectorAll("br,img,hr,video,iframe,svg,canvas");
|
|
234
|
+
for (var i = 0; i < objs.length; i++) if (!(forward && objs[i].nodeName === "BR" && i === objs.length - 1 && scope.lastChild && scope.lastChild.nodeName === "BR")) return false;
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
|
|
185
238
|
function onKeyDown(e) {
|
|
186
239
|
var key = e.key;
|
|
240
|
+
// 2026-10-02 A modified arrow is not caret travel: Alt+Up / Alt+Down move the block (or the
|
|
241
|
+
// table row), Shift+Arrow extends the selection - neither may insert a gap paragraph above or
|
|
242
|
+
// below a table at the document edge. tools/keyboard/move-block.mjs
|
|
243
|
+
if (e.altKey || e.shiftKey || e.ctrlKey || e.metaKey) return;
|
|
187
244
|
var forward = (key === "ArrowDown" || key === "ArrowRight" || key === "End" || key === "PageDown");
|
|
188
245
|
var back = (key === "ArrowUp" || key === "ArrowLeft" || key === "Home" || key === "PageUp");
|
|
189
246
|
if (!forward && !back) return;
|
|
@@ -199,6 +256,9 @@ function RTE_Plugin_GapCursor() {
|
|
|
199
256
|
var kids = blocks();
|
|
200
257
|
var index = kids.indexOf(block);
|
|
201
258
|
if (index < 0) return;
|
|
259
|
+
// Only from the block's EDGE in that direction: inside a table or code block the key must
|
|
260
|
+
// first travel there (Home in any cell, or ArrowUp from row 2, used to jump out of the table).
|
|
261
|
+
if (!caretAtEdge(block, sel.getRangeAt(0), forward, key === "ArrowUp" || key === "ArrowDown" || key === "PageUp" || key === "PageDown")) return;
|
|
202
262
|
|
|
203
263
|
if (forward) {
|
|
204
264
|
var next = kids[index + 1];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_gapcursor=RTE_Plugin_GapCursor,typeof RTE_DefaultConfig.gapCursorClick>"u"&&(RTE_DefaultConfig.gapCursorClick=!0),typeof RTE_DefaultConfig.gapCursorKeys>"u"&&(RTE_DefaultConfig.gapCursorKeys=!0),typeof RTE_DefaultConfig.gapCursorHint>"u"&&(RTE_DefaultConfig.gapCursorHint=!0);function RTE_Plugin_GapCursor(){var
|
|
1
|
+
window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_gapcursor=RTE_Plugin_GapCursor,typeof RTE_DefaultConfig.gapCursorClick>"u"&&(RTE_DefaultConfig.gapCursorClick=!0),typeof RTE_DefaultConfig.gapCursorKeys>"u"&&(RTE_DefaultConfig.gapCursorKeys=!0),typeof RTE_DefaultConfig.gapCursorHint>"u"&&(RTE_DefaultConfig.gapCursorHint=!0);function RTE_Plugin_GapCursor(){var D=this,y,i,_=null;D.PluginName="GapCursor";var U={TABLE:1,HR:1,IMG:1,FIGURE:1,IFRAME:1,VIDEO:1,AUDIO:1,OBJECT:1,EMBED:1,CANVAS:1,SVG:1,PRE:1};D.InitConfig=function(t){y=t},D.InitEditor=function(t){i=t,b();try{i.attachEvent("ready",b)}catch{}try{i.attachEvent("aftersethtml",b)}catch{}setTimeout(b,0),i.insertParagraphAt=function(e){return h(e)},i.insertParagraphAfter=function(e){return S(e,!0)},i.insertParagraphBefore=function(e){return S(e,!1)},i.getGapPositions=function(){return A()}};function m(){try{return i.getDocument()}catch{return null}}function l(){try{return i.getEditable()}catch{return null}}function b(){var t=m(),e=l();!t||!e||t===_||(_=t,z(t),y.gapCursorKeys!==!1&&e.addEventListener("keydown",F,!0),y.gapCursorClick!==!1&&e.addEventListener("click",V,!0),y.gapCursorHint!==!1&&e.addEventListener("mousemove",$,!0))}function p(t){return!!(t&&t.nodeType===1&&U[t.nodeName])}function P(t){return!!(t&&t.nodeType===1&&t.className==="rte-gap-hint")}function c(){var t=l(),e=[];if(!t)return e;for(var r=0;r<t.children.length;r++)P(t.children[r])||e.push(t.children[r]);return e}function A(){var t=[],e=c();if(!e.length)return t;p(e[0])&&t.push(0);for(var r=0;r<e.length-1;r++)p(e[r])&&p(e[r+1])&&t.push(r+1);return p(e[e.length-1])&&t.push(e.length),t}function x(t){var e=t.createElement("p");return e.appendChild(t.createElement("br")),e}function h(t){var e=l(),r=m();if(!e||!r||i.__trackHook&&i.__trackHook("insert-block",{})===!0)return null;E();var n=x(r),a=c()[t]||null;return e.insertBefore(n,a),w(n),G(),n}function S(t,e){var r=l(),n=m();if(!r||!n||!t||i.__trackHook&&i.__trackHook("insert-block",{})===!0)return null;var a=x(n);return e?t.parentNode.insertBefore(a,t.nextSibling):t.parentNode.insertBefore(a,t),w(a),G(),a}function w(t){try{var e=t.ownerDocument,r=e.createRange();r.setStart(t,0),r.collapse(!0);var n=i.getSelection();n.removeAllRanges(),n.addRange(r),i.focus()}catch{}}function M(t){for(var e=l(),r=t&&t.nodeType===3?t.parentNode:t;r&&r.parentNode&&r.parentNode!==e;)r=r.parentNode;return r&&r.parentNode===e?r:null}function j(t,e,r,n){if(!/^(TABLE|PRE|FIGURE)$/.test(t.nodeName))return!0;var a=t;if(t.nodeName==="TABLE"){for(var o=e.startContainer;o&&o!==t&&!/^(TD|TH)$/.test(o.nodeName);)o=o.parentNode;var s=t.rows;if(!o||o===t||!s||!s.length)return!0;var g=r?s[s.length-1]:s[0];if(n){if(o.parentNode!==g)return!1}else{var d=r?g.cells[g.cells.length-1]:g.cells[0];if(o!==d)return!1}a=o}var N=a.ownerDocument;if(n){var f=null;try{var T=e.getClientRects();if(f=T&&T.length?T[0]:null,!f||!f.height){var k=e.startContainer.nodeType===3?e.startContainer.parentNode:e.startContainer;f=k&&k.getBoundingClientRect?k.getBoundingClientRect():null}}catch{f=null}if(!f||!f.height)return!0;var O=a.getBoundingClientRect(),K=Math.max(f.height,12);return r?O.bottom-f.bottom<K:f.top-O.top<K}var v=N.createRange();if(r?(v.setStart(e.endContainer,e.endOffset),v.setEnd(a,a.childNodes.length)):(v.setStart(a,0),v.setEnd(e.startContainer,e.startOffset)),v.toString().replace(/\u200b/g,"")!=="")return!1;for(var B=v.cloneContents().querySelectorAll("br,img,hr,video,iframe,svg,canvas"),R=0;R<B.length;R++)if(!(r&&B[R].nodeName==="BR"&&R===B.length-1&&a.lastChild&&a.lastChild.nodeName==="BR"))return!1;return!0}function F(t){var e=t.key;if(!(t.altKey||t.shiftKey||t.ctrlKey||t.metaKey)){var r=e==="ArrowDown"||e==="ArrowRight"||e==="End"||e==="PageDown",n=e==="ArrowUp"||e==="ArrowLeft"||e==="Home"||e==="PageUp";if(!(!r&&!n)){var a=l();if(!(!a||!a.children.length)){var o=i.getSelection();if(!(!o||!o.rangeCount)){var s=M(o.getRangeAt(0).startContainer);if(p(s)){var g=c(),d=g.indexOf(s);if(!(d<0)&&j(s,o.getRangeAt(0),r,e==="ArrowUp"||e==="ArrowDown"||e==="PageUp"||e==="PageDown"))if(r){var N=g[d+1];if(N&&!p(N))return;t.preventDefault(),t.stopPropagation(),h(d+1)}else{var f=g[d-1];if(f&&!p(f))return;t.preventDefault(),t.stopPropagation(),h(d)}}}}}}}function V(t){var e=l();if(!(!e||t.target!==e)){E();var r=H(t.clientY);r!==null&&(t.preventDefault(),t.stopPropagation(),h(r))}}function H(t){var e=c();if(!e.length)return null;var r=A();if(!r.length)return null;for(var n=0;n<e.length;n++){var a=e[n].getBoundingClientRect();if(t<a.top)return I(r,n);if(t<=a.bottom)return null}return I(r,e.length)}function I(t,e){return t.indexOf(e)>=0?e:null}var u=null,C=null,Y=10;function $(t){var e=l();if(e&&!P(t.target)){if(t.target===e){var r=H(t.clientY);if(r===null){E();return}L(r);return}var n=q(t.clientY);if(n===null){E();return}L(n)}}function q(t){for(var e=c(),r=A(),n=0;n<r.length;n++){var a=r[n],o;if(a===0?o=e[0].getBoundingClientRect().top:o=e[a-1].getBoundingClientRect().bottom,Math.abs(t-o)<=Y)return a}return null}function L(t){var e=l(),r=m();if(!(!e||!r)){u||(u=r.createElement("div"),u.className="rte-gap-hint",u.setAttribute("contenteditable","false"),u.setAttribute("aria-hidden","true"),u.addEventListener("mousedown",function(a){a.preventDefault(),a.stopPropagation(),C!==null&&h(C)},!0));var n=c()[t]||null;if(u.parentNode===e&&u.nextSibling===n){C=t;return}e.insertBefore(u,n),C=t}}function E(){u&&u.parentNode&&u.parentNode.removeChild(u),C=null}function G(){E();try{typeof i.updateDesign=="function"&&i.updateDesign()}catch{}try{typeof i.fireChange=="function"&&i.fireChange()}catch{}}function J(){return".rte-gap-hint{height:6px;margin:1px 0;position:relative;cursor:text;pointer-events:auto;background:transparent;}.rte-gap-hint::before{content:'';position:absolute;left:0;right:0;top:2px;border-top:2px solid #2563eb;opacity:.65;}.rte-gap-hint::after{content:'';position:absolute;left:-3px;top:0;width:6px;height:6px;border-radius:50%;background:#2563eb;}"}function z(t){if(t){var e=J(),r=t.getElementById("rte-gapcursor-styles");if(r){if(r.getAttribute("data-css")===e)return;r.parentNode&&r.parentNode.removeChild(r)}var n=t.createElement("style");n.id="rte-gapcursor-styles",n.setAttribute("data-css",e),n.appendChild(t.createTextNode(e)),(t.head||t.getElementsByTagName("head")[0]||t.documentElement).appendChild(n),i&&typeof i.ensureStyleSheetLive=="function"&&i.ensureStyleSheetLive(t,n,"rte-gapcursor-styles",n.textContent)}}}
|
|
@@ -246,7 +246,7 @@ function RTE_Plugin_GhostComplete() {
|
|
|
246
246
|
var tip = (host.ownerDocument || document).createElement("div");
|
|
247
247
|
tip.className = "rte-ghost-hint";
|
|
248
248
|
tip.setAttribute("role", "status");
|
|
249
|
-
tip.textContent = "AI completion isn't configured
|
|
249
|
+
tip.textContent = "AI completion isn't configured \u2014 supply config.ghostTextResolver (or editor.setGhostTextResolver) to enable inline suggestions.";
|
|
250
250
|
tip.style.cssText = "position:absolute;left:50%;bottom:12px;transform:translateX(-50%);z-index:20;" +
|
|
251
251
|
"max-width:90%;padding:7px 14px;border-radius:8px;background:#1f2937;color:#f9fafb;" +
|
|
252
252
|
"font:12px/1.5 -apple-system,Segoe UI,sans-serif;box-shadow:0 4px 14px rgba(0,0,0,.25);pointer-events:none";
|
|
@@ -160,18 +160,18 @@ function RTE_Plugin_Html2PDF() {
|
|
|
160
160
|
|
|
161
161
|
var div2 = __Append(dialoginner, "div", "position:relative;text-align:center;");
|
|
162
162
|
|
|
163
|
-
div2.innerHTML = "Loading...";
|
|
163
|
+
div2.innerHTML = __RTE_TT("Loading...");
|
|
164
164
|
|
|
165
165
|
var imgrect = __Append(dialoginner, "div", "position:relative;text-align:center;")
|
|
166
166
|
|
|
167
167
|
window.html2pdf_callback = function (win) {
|
|
168
168
|
|
|
169
169
|
if (!win.html2pdf) {
|
|
170
|
-
div2.innerHTML = "Failed to load script.";
|
|
170
|
+
div2.innerHTML = __RTE_TT("Failed to load script.");
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
div2.innerHTML = "Exporting...";
|
|
174
|
+
div2.innerHTML = __RTE_TT("Exporting...");
|
|
175
175
|
|
|
176
176
|
// Honor the document's own page setup (paper size, orientation and
|
|
177
177
|
// margins) so the exported PDF matches the paginated page view and the
|
|
@@ -193,7 +193,7 @@ function RTE_Plugin_Html2PDF() {
|
|
|
193
193
|
|
|
194
194
|
var dataurl = img.getAttribute('src');
|
|
195
195
|
if (dataurl.indexOf("base64") == -1) {
|
|
196
|
-
div2.innerHTML = "Error, no data.";
|
|
196
|
+
div2.innerHTML = __RTE_TT("Error, no data.");
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -208,7 +208,7 @@ function RTE_Plugin_Html2PDF() {
|
|
|
208
208
|
bin[i] = str.charCodeAt(i);
|
|
209
209
|
var blob = new Blob([new Uint8Array(bin)], { type: "application/pdf" })
|
|
210
210
|
var url = URL.createObjectURL(blob);
|
|
211
|
-
div2.innerHTML = Math.ceil(str.length / 1024) + "KB Exported<br/><a href='" + url + "' target=_blank>Download PDF</a>";
|
|
211
|
+
div2.innerHTML = __RTE_TT(Math.ceil(str.length / 1024) + "KB Exported<br/><a href='" + url + "' target=_blank>Download PDF</a>");
|
|
212
212
|
|
|
213
213
|
var pdflink = div2.querySelector("a");
|
|
214
214
|
|
|
@@ -229,7 +229,7 @@ function RTE_Plugin_Html2PDF() {
|
|
|
229
229
|
imglink.setAttribute("href", imgurl);
|
|
230
230
|
imglink.setAttribute("target", "_blank");
|
|
231
231
|
imglink.download = "Export-" + ymd + "-" + hms + ".jpg";
|
|
232
|
-
imglink.innerText = "Download Img";
|
|
232
|
+
imglink.innerText = ((typeof config !== "undefined" && config && config.text_pdf_dlimg) || "Download Img");
|
|
233
233
|
|
|
234
234
|
//dialoginner.close();
|
|
235
235
|
|
|
@@ -248,10 +248,10 @@ function RTE_Plugin_Html2PDF() {
|
|
|
248
248
|
|
|
249
249
|
iframe = __Append(div1, "iframe", "align-self:center;flex:99;width:100%;height:0px;border:0px;", "rte-editable");
|
|
250
250
|
iframe.contentDocument.open("text/html");
|
|
251
|
-
iframe.contentDocument.write("<html><head><link id='url-css-preview' rel='stylesheet' href='" + editor.htmlEncode(config.previewCssUrl) + "'/>"
|
|
251
|
+
iframe.contentDocument.write(__RTE_TT("<html><head><link id='url-css-preview' rel='stylesheet' href='" + editor.htmlEncode(config.previewCssUrl) + "'/>"
|
|
252
252
|
+ "<script src='" + editor.htmlEncode(resolveScriptUrl()) + "'></script></head><body style='padding:10px;margin:0px'>"
|
|
253
253
|
+ editor.getHTMLCode() + "</body>"
|
|
254
|
-
+ "<script>window.onload=function(){setTimeout(function(){parent.html2pdf_callback(window)},100)}</script></html>")
|
|
254
|
+
+ "<script>window.onload=function(){setTimeout(function(){parent.html2pdf_callback(window)},100)}</script></html>"))
|
|
255
255
|
iframe.contentDocument.close();
|
|
256
256
|
|
|
257
257
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
RTE_DefaultConfig.svgCode_html2pdf||(RTE_DefaultConfig.svgCode_html2pdf='<svg viewBox="-2 -2 36 36" fill="#5F6368"><polygon points="30 11 30 9 22 9 22 23 24 23 24 17 29 17 29 15 24 15 24 11 30 11"></polygon><path d="M8,9H2V23H4V18H8a2,2,0,0,0,2-2V11A2,2,0,0,0,8,9Zm0,7H4V11H8Z"></path><path d="M16,23H12V9h4a4,4,0,0,1,4,4v6A4,4,0,0,1,16,23Zm-2-2h2a2,2,0,0,0,2-2V13a2,2,0,0,0-2-2H14Z"></path><title>PDF</title></svg>'),RTE_DefaultConfig.plugin_html2pdf=RTE_Plugin_Html2PDF,typeof RTE_DefaultConfig.html2pdfScriptUrl>"u"&&(RTE_DefaultConfig.html2pdfScriptUrl=null);function RTE_Plugin_Html2PDF(){var
|
|
1
|
+
RTE_DefaultConfig.svgCode_html2pdf||(RTE_DefaultConfig.svgCode_html2pdf='<svg viewBox="-2 -2 36 36" fill="#5F6368"><polygon points="30 11 30 9 22 9 22 23 24 23 24 17 29 17 29 15 24 15 24 11 30 11"></polygon><path d="M8,9H2V23H4V18H8a2,2,0,0,0,2-2V11A2,2,0,0,0,8,9Zm0,7H4V11H8Z"></path><path d="M16,23H12V9h4a4,4,0,0,1,4,4v6A4,4,0,0,1,16,23Zm-2-2h2a2,2,0,0,0,2-2V13a2,2,0,0,0-2-2H14Z"></path><title>PDF</title></svg>'),RTE_DefaultConfig.plugin_html2pdf=RTE_Plugin_Html2PDF,typeof RTE_DefaultConfig.html2pdfScriptUrl>"u"&&(RTE_DefaultConfig.html2pdfScriptUrl=null);function RTE_Plugin_Html2PDF(){var y="/plugins/vendor/html2pdf.bundle.min.js";function T(t){try{return new URL(t,document.baseURI||location.href).href}catch{return t}}function H(){if(a&&a.html2pdfScriptUrl)return T(a.html2pdfScriptUrl);var t=a&&a.url_base?String(a.url_base).replace(/\/+$/,""):"";return T(t?t+y:"."+y)}var u=this,a,i;u.PluginName="Html2PDF",u.InitConfig=function(t){a=t},u.InitEditor=function(t){i=t,i.attachEvent("exec_command_html2pdf",function(e,r,o){u.DoHtml2PDF(),e.returnValue=!0}),i.toolbarFactoryMap.html2pdf=function(e){var r=i.createToolbarButton(e);return r.style.backgroundColor="",r}},u.GetPdfPageOptions=function(){var t={format:"letter",orientation:"portrait",margin:.5},e=null;try{i&&typeof i.getDocumentPageSetup=="function"&&(e=i.getDocumentPageSetup())}catch{e=null}if(!e||typeof e!="object")return t;var r={a3:1,a4:1,a5:1,letter:1,legal:1,tabloid:1},o=String(e.format||"").toLowerCase(),n=String(e.orientation||"").toLowerCase()==="landscape"?"landscape":t.orientation,l={format:r[o]?o:t.format,orientation:n,margin:t.margin},c=e.margins;if(c&&typeof c=="object"){var h=g(c.top),f=g(c.right),s=g(c.bottom),v=g(c.left);h!==null&&f!==null&&s!==null&&v!==null&&(l.margin=[h,f,s,v])}return l};function g(t){if(typeof t=="number"&&isFinite(t))return t;if(typeof t!="string")return null;var e=/^\s*(-?[\d.]+)\s*(mm|cm|in|px|pt)?\s*$/.exec(t);if(!e)return null;var r=parseFloat(e[1]);if(!isFinite(r))return null;switch(e[2]){case"mm":return r/25.4;case"cm":return r/2.54;case"pt":return r/72;case"px":return r/96;default:return r}}function p(t,e,r,o){var n=t.ownerDocument.createElement(e);return r&&(n.style.cssText=r),o&&(n.className=o),t.appendChild(n),n}function P(t){for(var e=t.split(","),r=e[0].match(/:(.*?);/)[1],o=atob(e[1]),n=o.length,l=new Uint8Array(n);n--;)l[n]=o.charCodeAt(n);return new Blob([l],{type:r})}u.DoHtml2PDF=function(){var t=i.createDialog("Html2PDF","rte-dialog-html2pdf"),e=p(t,"div","position:relative;text-align:center;");e.innerHTML=__RTE_TT("Loading...");var r=p(t,"div","position:relative;text-align:center;");window.html2pdf_callback=function(n){if(!n.html2pdf){e.innerHTML=__RTE_TT("Failed to load script.");return}e.innerHTML=__RTE_TT("Exporting...");var l=u.GetPdfPageOptions(),c={margin:l.margin,filename:"myfile.pdf",image:{type:"jpeg",quality:.98},html2canvas:{scale:2},jsPDF:{unit:"in",format:l.format,orientation:l.orientation}},h=n.html2pdf().set(c).from(n.document.body).outputImg();h.then(function(f){var s=f.getAttribute("src");if(s.indexOf("base64")==-1){e.innerHTML=__RTE_TT("Error, no data.");return}var v=P(s),x=URL.createObjectURL(v);f.setAttribute("src",x);var C=n.html2pdf().set(c).from(n.document.body).outputPdf();C.then(function(d){for(var D=new Array(d.length),b=0;b<d.length;b++)D[b]=d.charCodeAt(b);var U=new Blob([new Uint8Array(D)],{type:"application/pdf"}),F=URL.createObjectURL(U);e.innerHTML=__RTE_TT(Math.ceil(d.length/1024)+"KB Exported<br/><a href='"+F+"' target=_blank>Download PDF</a>");var w=e.querySelector("a"),m=new Date,E=String(m.getFullYear()*1e4+(m.getMonth()+1)*100+m.getDate()).substring(2),R=String(1e6+m.getHours()*1e4+m.getMinutes()*100+m.getSeconds()).substring(1);w.download="Export-"+E+"-"+R+".pdf",w.click(),f.style.cssText="max-width:300px;max-height:200px;margin:5px;padding:10px;border:solid 1px #eee;box-shadow:2px 2px 6px #eee",r.appendChild(f),p(r,"br");var _=p(r,"a");_.setAttribute("href",x),_.setAttribute("target","_blank"),_.download="Export-"+E+"-"+R+".jpg",_.innerText=typeof a<"u"&&a&&a.text_pdf_dlimg||"Download Img"}).catch(function(d){console.error(d)})}).catch(function(f){console.error(f)})};var o=p(t,"div","position:relative;text-align:center;");iframe=p(o,"iframe","align-self:center;flex:99;width:100%;height:0px;border:0px;","rte-editable"),iframe.contentDocument.open("text/html"),iframe.contentDocument.write(__RTE_TT("<html><head><link id='url-css-preview' rel='stylesheet' href='"+i.htmlEncode(a.previewCssUrl)+"'/><script src='"+i.htmlEncode(H())+"'><\/script></head><body style='padding:10px;margin:0px'>"+i.getHTMLCode()+"</body><script>window.onload=function(){setTimeout(function(){parent.html2pdf_callback(window)},100)}<\/script></html>")),iframe.contentDocument.close()}}
|
|
@@ -16,6 +16,12 @@ function RTE_Plugin_ImageEditor() {
|
|
|
16
16
|
|
|
17
17
|
obj.PluginName = "ImageEditor";
|
|
18
18
|
|
|
19
|
+
// 2026-10-18 the words read config.text_ keys (language packs), English as the fallback; {0} fills a template.
|
|
20
|
+
// tools/i18n/plugin-panels-language.mjs
|
|
21
|
+
function pText(key, fallback, arg) {
|
|
22
|
+
var s = (config && config["text_" + key]) || fallback;
|
|
23
|
+
return arg === undefined ? s : s.split("{0}").join(String(arg));
|
|
24
|
+
}
|
|
19
25
|
obj.InitConfig = function (argconfig) {
|
|
20
26
|
config = argconfig;
|
|
21
27
|
}
|
|
@@ -85,7 +91,7 @@ function RTE_Plugin_ImageEditor() {
|
|
|
85
91
|
if (!img)
|
|
86
92
|
return;
|
|
87
93
|
|
|
88
|
-
var dialoginner = editor.createDialog("
|
|
94
|
+
var dialoginner = editor.createDialog(pText("ie_title", "Image editor"), "rte-dialog-imageeditor");
|
|
89
95
|
|
|
90
96
|
dialoginner.style.width = "90%";
|
|
91
97
|
dialoginner.style.height = "90%";
|
|
@@ -153,16 +159,16 @@ function RTE_Plugin_ImageEditor() {
|
|
|
153
159
|
var imgeditor = new win.tui.ImageEditor(win.document.querySelector('#tui-image-editor'), options);
|
|
154
160
|
|
|
155
161
|
var btns = win.document.querySelector('.tui-image-editor-header-buttons');
|
|
156
|
-
btns.innerHTML = '';
|
|
162
|
+
btns.innerHTML = __RTE_TT('');
|
|
157
163
|
var savebtn = __Append(btns, "button", "");
|
|
158
|
-
savebtn.innerText = "Save";
|
|
164
|
+
savebtn.innerText = pText("ie_save", "Save");
|
|
159
165
|
var status = __Append(btns, "div", "margin-left:10px;font-size:12px;color:#b42318;", "rte-imageeditor-upload-status");
|
|
160
166
|
status.setAttribute("role", "status");
|
|
161
167
|
status.setAttribute("aria-live", "polite");
|
|
162
168
|
savebtn.onclick = function () {
|
|
163
169
|
status.innerText = "";
|
|
164
170
|
savebtn.disabled = true;
|
|
165
|
-
savebtn.innerText = "Saving...";
|
|
171
|
+
savebtn.innerText = pText("ie_saving", "Saving...");
|
|
166
172
|
|
|
167
173
|
var dataurl = imgeditor.toDataURL();
|
|
168
174
|
var uploadHandler = config.file_upload_handler || window.rte_file_upload_handler;
|
|
@@ -175,7 +181,20 @@ function RTE_Plugin_ImageEditor() {
|
|
|
175
181
|
|
|
176
182
|
var file = dataURLToBlob(dataurl);
|
|
177
183
|
|
|
178
|
-
|
|
184
|
+
// A handler that throws would leave Save disabled with "Saving..." forever.
|
|
185
|
+
// Turn the exception into the same visible error the callback path shows.
|
|
186
|
+
var restoreSave = function (message) {
|
|
187
|
+
savebtn.disabled = false;
|
|
188
|
+
savebtn.innerText = pText("ie_save", "Save");
|
|
189
|
+
status.innerText = message;
|
|
190
|
+
};
|
|
191
|
+
try {
|
|
192
|
+
uploadHandler(file, onUploaded);
|
|
193
|
+
} catch (ex) {
|
|
194
|
+
restoreSave(pText("ie_uploadfailed", "Upload failed: {0}", ex && ex.message ? ex.message : "error"));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function onUploaded(url, error) {
|
|
179
198
|
if (url) {
|
|
180
199
|
img.src = url;
|
|
181
200
|
editor.notifySelectionChange();
|
|
@@ -183,23 +202,23 @@ function RTE_Plugin_ImageEditor() {
|
|
|
183
202
|
return;
|
|
184
203
|
}
|
|
185
204
|
savebtn.disabled = false;
|
|
186
|
-
savebtn.innerText = "Save";
|
|
205
|
+
savebtn.innerText = pText("ie_save", "Save");
|
|
187
206
|
// Show what the server actually said. Blaming the connection sent
|
|
188
207
|
// people chasing a network problem when the real answer was a
|
|
189
208
|
// rejected file type or a size limit.
|
|
190
209
|
status.innerText = error
|
|
191
|
-
? ("Upload failed: "
|
|
192
|
-
: "The upload did not return a file URL. Please try again.";
|
|
193
|
-
}
|
|
210
|
+
? pText("ie_uploadfailed", "Upload failed: {0}", error)
|
|
211
|
+
: pText("ie_nourl", "The upload did not return a file URL. Please try again.");
|
|
212
|
+
}
|
|
194
213
|
|
|
195
214
|
|
|
196
215
|
}
|
|
197
216
|
|
|
198
217
|
}
|
|
199
218
|
|
|
200
|
-
iframe = __Append(dialoginner, "iframe", "align-self:center;flex:99;width:100%;height:100
|
|
219
|
+
var iframe = __Append(dialoginner, "iframe", "align-self:center;flex:99;width:100%;height:100%;border:0px;", "rte-editable");
|
|
201
220
|
iframe.contentDocument.open("text/html");
|
|
202
|
-
iframe.contentDocument.write("<html><head><base href='" + editor.htmlEncode(location.href) + "'/>"
|
|
221
|
+
iframe.contentDocument.write(__RTE_TT("<html><head><base href='" + editor.htmlEncode(location.href) + "'/>"
|
|
203
222
|
+ "<link id='url-css-preview' rel='stylesheet' href='" + editor.htmlEncode(scriptbase + "tui-color-picker.min.css") + "'/>"
|
|
204
223
|
+ "<link id='url-css-preview' rel='stylesheet' href='" + editor.htmlEncode(scriptbase + "tui-image-editor.min.css") + "'/>"
|
|
205
224
|
+ "<script src='" + editor.htmlEncode(scriptbase + "fabric.min.js") + "'></script>"
|
|
@@ -207,7 +226,7 @@ function RTE_Plugin_ImageEditor() {
|
|
|
207
226
|
+ "<script src='" + editor.htmlEncode(scriptbase + "tui-code-snippet.min.js") + "'></script>"
|
|
208
227
|
+ "<script src='" + editor.htmlEncode(scriptbase + "tui-image-editor.min.js") + "'></script>"
|
|
209
228
|
+ "</head><body style='padding:10px;margin:0px'><div id='tui-image-editor'></div></body>"
|
|
210
|
-
+ "<script>window.onload=function(){setTimeout(function(){parent.rte_image_editor_callback(window)},100)}</script></html>")
|
|
229
|
+
+ "<script>window.onload=function(){setTimeout(function(){parent.rte_image_editor_callback(window)},100)}</script></html>"))
|
|
211
230
|
iframe.contentDocument.close();
|
|
212
231
|
}
|
|
213
232
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
RTE_DefaultConfig.svgCode_imageeditor||(RTE_DefaultConfig.svgCode_imageeditor='<svg viewBox="-2 -2 20 20" fill="#5F6368"><style>.st0{fill:#f6f6f6}.st1{fill:#424242}.st2{fill:none}.st3{fill:#f0eff1}</style><path class="st0" d="M1 0v6H0v10h10v-1h6V0z" id="outline"/><g id="icon_x5F_bg"><path class="st1" d="M2 5h1v1H2zM2 3h1v1H2zM2 1h1v1H2zM4 1h1.001v1H4zM6 1h1v1H6zM8 1h1v1H8zM10 1h1v1h-1zM12 1h1v1h-1zM14 1h1v1h-1zM14 3h1v1h-1zM14 5h1v1h-1zM14 7h1v1h-1zM14 9h1v1h-1zM14 10.999h1V12h-1zM14 13h1v1h-1zM12 13h1v1h-1zM11 11V5H5v1H4V4h8v7z"/><circle class="st1" cx="6.192" cy="9.807" r=".807"/><path class="st1" d="M1 7v8h8V7H1zm1 7.001v-.28l2.537-1.463L7.554 14l.001.001H2zm6-.93l-3.463-1.982L2 12.491v-4.49h6v5.07zM10 13h1v1h-1z"/></g><g id="icon_x5F_fg"><path class="st2" d="M2 14h5.554v.001H2z"/><path class="st3" d="M11 5v6h-1V6H5V5z"/><path class="st3" d="M2 12.491l2.537-1.402L8 13.071v-5.07H2v4.49zM6.192 9a.807.807 0 1 1 .001 1.615A.807.807 0 0 1 6.192 9z"/><path class="st3" d="M2 13.721V14h5.554l-3.017-1.742z"/></g></svg>'),RTE_DefaultConfig.plugin_imageeditor=RTE_Plugin_ImageEditor;function RTE_Plugin_ImageEditor(){var
|
|
1
|
+
RTE_DefaultConfig.svgCode_imageeditor||(RTE_DefaultConfig.svgCode_imageeditor='<svg viewBox="-2 -2 20 20" fill="#5F6368"><style>.st0{fill:#f6f6f6}.st1{fill:#424242}.st2{fill:none}.st3{fill:#f0eff1}</style><path class="st0" d="M1 0v6H0v10h10v-1h6V0z" id="outline"/><g id="icon_x5F_bg"><path class="st1" d="M2 5h1v1H2zM2 3h1v1H2zM2 1h1v1H2zM4 1h1.001v1H4zM6 1h1v1H6zM8 1h1v1H8zM10 1h1v1h-1zM12 1h1v1h-1zM14 1h1v1h-1zM14 3h1v1h-1zM14 5h1v1h-1zM14 7h1v1h-1zM14 9h1v1h-1zM14 10.999h1V12h-1zM14 13h1v1h-1zM12 13h1v1h-1zM11 11V5H5v1H4V4h8v7z"/><circle class="st1" cx="6.192" cy="9.807" r=".807"/><path class="st1" d="M1 7v8h8V7H1zm1 7.001v-.28l2.537-1.463L7.554 14l.001.001H2zm6-.93l-3.463-1.982L2 12.491v-4.49h6v5.07zM10 13h1v1h-1z"/></g><g id="icon_x5F_fg"><path class="st2" d="M2 14h5.554v.001H2z"/><path class="st3" d="M11 5v6h-1V6H5V5z"/><path class="st3" d="M2 12.491l2.537-1.402L8 13.071v-5.07H2v4.49zM6.192 9a.807.807 0 1 1 .001 1.615A.807.807 0 0 1 6.192 9z"/><path class="st3" d="M2 13.721V14h5.554l-3.017-1.742z"/></g></svg>'),RTE_DefaultConfig.plugin_imageeditor=RTE_Plugin_ImageEditor;function RTE_Plugin_ImageEditor(){var g=this,u,t;g.PluginName="ImageEditor";function s(i,a,e){var n=u&&u["text_"+i]||a;return e===void 0?n:n.split("{0}").join(String(e))}g.InitConfig=function(i){u=i},g.InitEditor=function(i){t=i,t.attachEvent("exec_command_imageeditor",function(a,e,n){g.DoImageEditor(),a.returnValue=!0}),t.toolbarFactoryMap.imageeditor=function(a){var e=t.createToolbarButton(a);return e.style.backgroundColor="",e}};function v(i,a,e,n){var o=i.ownerDocument.createElement(a);return e&&(o.style.cssText=e),n&&(o.className=n),i.appendChild(o),o}var b={"image/png":".png","image/jpeg":".jpg","image/jpg":".jpg","image/webp":".webp","image/gif":".gif","image/bmp":".bmp","image/avif":".avif"};function z(i,a){for(var e=i.split(","),n=e[0].match(/:(.*?);/)[1],o=atob(e[1]),c=o.length,h=new Uint8Array(c);c--;)h[c]=o.charCodeAt(c);var d=a||"image-"+new Date().getTime()+(b[n]||".png");try{return new File([h],d,{type:n})}catch{var r=new Blob([h],{type:n});return r.name=d,r}}g.DoImageEditor=function(){var i=t.getSelectedControl();if(i){var a=t.createDialog(s("ie_title","Image editor"),"rte-dialog-imageeditor");a.style.width="90%",a.style.height="90%";var e=u.url_base+"/plugins/tui.image-editor/";window.rte_image_editor_callback=function(o){try{o.tui=o.tui||{},o.tui.usageStatistics=!1}catch{}var c={usageStatistics:!1,includeUI:{loadImage:{path:i.src,name:"RteImage"},usageStatistics:!1,theme:{"common.bi.image":"","common.bisize.width":"0","common.bisize.height":"0","menu.normalIcon.path":e+"svg/icon-d.svg","menu.activeIcon.path":e+"svg/icon-b.svg","menu.disabledIcon.path":e+"svg/icon-a.svg","menu.hoverIcon.path":e+"svg/icon-c.svg","submenu.normalIcon.path":e+"svg/icon-d.svg","submenu.normalIcon.name":"icon-d","submenu.activeIcon.path":e+"svg/icon-c.svg","submenu.activeIcon.name":"icon-c"},menuBarPosition:"bottom"},cssMaxWidth:700,cssMaxHeight:500,selectionStyle:{cornerSize:20,rotatingPointOffset:70}},h=new o.tui.ImageEditor(o.document.querySelector("#tui-image-editor"),c),d=o.document.querySelector(".tui-image-editor-header-buttons");d.innerHTML=__RTE_TT("");var r=v(d,"button","");r.innerText=s("ie_save","Save");var m=v(d,"div","margin-left:10px;font-size:12px;color:#b42318;","rte-imageeditor-upload-status");m.setAttribute("role","status"),m.setAttribute("aria-live","polite"),r.onclick=function(){m.innerText="",r.disabled=!0,r.innerText=s("ie_saving","Saving...");var f=h.toDataURL(),p=u.file_upload_handler||window.rte_file_upload_handler;if(!p){i.src=f,t.notifySelectionChange(),a.close();return}var M=z(f),T=function(l){r.disabled=!1,r.innerText=s("ie_save","Save"),m.innerText=l};try{p(M,y)}catch(l){T(s("ie_uploadfailed","Upload failed: {0}",l&&l.message?l.message:"error"))}function y(l,_){if(l){i.src=l,t.notifySelectionChange(),a.close();return}r.disabled=!1,r.innerText=s("ie_save","Save"),m.innerText=_?s("ie_uploadfailed","Upload failed: {0}",_):s("ie_nourl","The upload did not return a file URL. Please try again.")}}};var n=v(a,"iframe","align-self:center;flex:99;width:100%;height:100%;border:0px;","rte-editable");n.contentDocument.open("text/html"),n.contentDocument.write(__RTE_TT("<html><head><base href='"+t.htmlEncode(location.href)+"'/><link id='url-css-preview' rel='stylesheet' href='"+t.htmlEncode(e+"tui-color-picker.min.css")+"'/><link id='url-css-preview' rel='stylesheet' href='"+t.htmlEncode(e+"tui-image-editor.min.css")+"'/><script src='"+t.htmlEncode(e+"fabric.min.js")+"'><\/script><script src='"+t.htmlEncode(e+"tui-color-picker.min.js")+"'><\/script><script src='"+t.htmlEncode(e+"tui-code-snippet.min.js")+"'><\/script><script src='"+t.htmlEncode(e+"tui-image-editor.min.js")+"'><\/script></head><body style='padding:10px;margin:0px'><div id='tui-image-editor'></div></body><script>window.onload=function(){setTimeout(function(){parent.rte_image_editor_callback(window)},100)}<\/script></html>")),n.contentDocument.close()}}}
|
|
@@ -292,7 +292,7 @@ function RTE_Plugin_ImportStyles() {
|
|
|
292
292
|
for (var key2 in truncated) if (truncated.hasOwnProperty(key2)) dropped += truncated[key2];
|
|
293
293
|
if (dropped) {
|
|
294
294
|
try {
|
|
295
|
-
console.warn("[RichTextEditor] importStyles: " + dropped + " class(es) omitted
|
|
295
|
+
console.warn("[RichTextEditor] importStyles: " + dropped + " class(es) omitted \u2014 " +
|
|
296
296
|
"importStylesLimit is " + limit + " per dropdown. Raise the limit or narrow " +
|
|
297
297
|
"importStylesSheets / importStylesFilter.");
|
|
298
298
|
} catch (e) {}
|
|
@@ -240,7 +240,10 @@ function RTE_Plugin_InlineCode() {
|
|
|
240
240
|
if (!range) return false;
|
|
241
241
|
if (!editable.contains(range.startContainer)) return false;
|
|
242
242
|
|
|
243
|
+
// 2026-10-04 a caret is put back at its place in the word afterwards
|
|
244
|
+
var caretNode = range.collapsed ? range.startContainer : null, caretOff = range.startOffset, wordStart = 0;
|
|
243
245
|
if (range.collapsed && !expandToWord(range)) return false;
|
|
246
|
+
if (caretNode) wordStart = range.startOffset;
|
|
244
247
|
|
|
245
248
|
var nodes = selectedTextNodes(doc, range, editable);
|
|
246
249
|
if (!nodes.length) return false;
|
|
@@ -264,6 +267,28 @@ function RTE_Plugin_InlineCode() {
|
|
|
264
267
|
mergeAdjacent(editable);
|
|
265
268
|
}
|
|
266
269
|
|
|
270
|
+
// 2026-10-04 The text stays selected (CKEditor Code). Wrapping/unwrapping moved the text nodes and
|
|
271
|
+
// dropped the selection - all of it in one paragraph, the first half across two - so a second
|
|
272
|
+
// press did nothing or un-coded only half. tools/formatting/inline-code-selection.mjs
|
|
273
|
+
try {
|
|
274
|
+
var first = nodes[0], last = nodes[nodes.length - 1];
|
|
275
|
+
if (editable.contains(first) && editable.contains(last)) {
|
|
276
|
+
var nr = doc.createRange();
|
|
277
|
+
if (caretNode) {
|
|
278
|
+
// the word was split at its start, so the caret's offset is relative to it
|
|
279
|
+
var at = caretNode === first ? caretOff : caretOff - wordStart;
|
|
280
|
+
nr.setStart(first, Math.max(0, Math.min(at, first.data.length)));
|
|
281
|
+
nr.collapse(true);
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
nr.setStart(first, 0);
|
|
285
|
+
nr.setEnd(last, last.data.length);
|
|
286
|
+
}
|
|
287
|
+
var sel = doc.getSelection();
|
|
288
|
+
sel.removeAllRanges();
|
|
289
|
+
sel.addRange(nr);
|
|
290
|
+
}
|
|
291
|
+
} catch (e) { }
|
|
267
292
|
try { editor.updateToolbarStatus && editor.updateToolbarStatus(); } catch (e) { }
|
|
268
293
|
return true;
|
|
269
294
|
};
|