@richscripts/richtexteditor 2.14.0 → 2.14.1

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.
@@ -224,36 +224,47 @@ function RTE_Plugin_DocumentOutline() {
224
224
  // valid and the pasted copy becomes "slug-2". Ids on non-heading elements are
225
225
  // reserved too, so a heading never takes one. Every heading is checked, including
226
226
  // levels the outline does not display, since they share one id namespace.
227
- var used = {};
228
- var withId = editable.querySelectorAll("[id]");
229
- for (i = 0; i < withId.length; i++) {
230
- if (!/^H[1-6]$/.test(withId[i].nodeName)) used[withId[i].id] = true;
231
- }
232
- // Headings with text claim ids first. An EMPTY heading is usually the shell a cut
233
- // leaves behind, still carrying the moved heading's id; letting it claim first would
234
- // hand the moved heading "-2" and break every link to it. So empty headings go last
235
- // and simply drop an id that a real heading already holds.
236
- var textOf = function (el) {
237
- return (el.innerText || el.textContent || "").replace(/\s+/g, " ").replace(/^\s+|\s+$/g, "");
238
- };
239
- var empties = [];
240
- for (i = 0; i < headings.length; i++) {
241
- var h = headings[i];
242
- var t = textOf(h);
243
- if (!t) { empties.push(h); continue; }
244
- var base = h.id;
245
- if (!base) base = slugifyHeading(t);
246
- else if (!used[base]) { used[base] = true; continue; }
247
- var unique = base;
248
- var n = 2;
249
- while (used[unique]) { unique = base + "-" + n; n++; }
250
- used[unique] = true;
251
- if (h.id !== unique) h.id = unique;
252
- }
253
- for (i = 0; i < empties.length; i++) {
254
- if (!empties[i].id) continue;
255
- if (used[empties[i].id]) empties[i].removeAttribute("id");
256
- else used[empties[i].id] = true;
227
+ //
228
+ // 2026-09-25 ...but only when the core does not own heading ids. With
229
+ // autoHeadingAnchors on (the default) the core pass gives every heading a unique id
230
+ // after each change, with the same first-keeps rule, and marks the ids it generated so
231
+ // they can follow the text. This block ran 80 ms after each change instead: a heading
232
+ // a person was typing got the slug of its FIRST letter ("Typed heading" -> id="t"),
233
+ // unmarked, so the core took it for the author's own id and kept it for good. The
234
+ // outline needs no id to work (it navigates by element), so it now leaves ids to the
235
+ // core and keeps this pass for integrations that switched core anchors off.
236
+ if (config.autoHeadingAnchors === false) {
237
+ var used = {};
238
+ var withId = editable.querySelectorAll("[id]");
239
+ for (i = 0; i < withId.length; i++) {
240
+ if (!/^H[1-6]$/.test(withId[i].nodeName)) used[withId[i].id] = true;
241
+ }
242
+ // Headings with text claim ids first. An EMPTY heading is usually the shell a cut
243
+ // leaves behind, still carrying the moved heading's id; letting it claim first would
244
+ // hand the moved heading "-2" and break every link to it. So empty headings go last
245
+ // and simply drop an id that a real heading already holds.
246
+ var textOf = function (el) {
247
+ return (el.innerText || el.textContent || "").replace(/\s+/g, " ").replace(/^\s+|\s+$/g, "");
248
+ };
249
+ var empties = [];
250
+ for (i = 0; i < headings.length; i++) {
251
+ var h = headings[i];
252
+ var t = textOf(h);
253
+ if (!t) { empties.push(h); continue; }
254
+ var base = h.id;
255
+ if (!base) base = slugifyHeading(t);
256
+ else if (!used[base]) { used[base] = true; continue; }
257
+ var unique = base;
258
+ var n = 2;
259
+ while (used[unique]) { unique = base + "-" + n; n++; }
260
+ used[unique] = true;
261
+ if (h.id !== unique) h.id = unique;
262
+ }
263
+ for (i = 0; i < empties.length; i++) {
264
+ if (!empties[i].id) continue;
265
+ if (used[empties[i].id]) empties[i].removeAttribute("id");
266
+ else used[empties[i].id] = true;
267
+ }
257
268
  }
258
269
  for (i = 0; i < headings.length; i++) {
259
270
  var heading = headings[i];
@@ -1 +1 @@
1
- window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_documentoutline=RTE_Plugin_DocumentOutline;function RTE_Plugin_DocumentOutline(){var E=this,o,i,c=null,d=null,p=null,b=null,D=0,g="";E.PluginName="DocumentOutline",E.InitConfig=function(t){o=t,o.documentOutlineEnabled!==!1&&(o.documentOutlineTitle=o.documentOutlineTitle||"Outline",o.documentOutlineHint=o.documentOutlineHint||"Browse headings and jump through long documents without leaving the editor.",o.documentOutlineEmptyText=o.documentOutlineEmptyText||"Add headings to build the document outline.",typeof o.documentOutlineAutoOpen!="boolean"&&(o.documentOutlineAutoOpen=!1),typeof o.documentOutlineMinLevel!="number"&&(o.documentOutlineMinLevel=1),typeof o.documentOutlineMaxLevel!="number"&&(o.documentOutlineMaxLevel=6),L("toolbar_default","#{documentoutline}"),L("toolbar_full","#{documentoutline}"))},E.InitEditor=function(t){i=t,o.documentOutlineEnabled!==!1&&(i.documentOutline={close:function(){A()},list:function(){return N()},open:function(){T()},refresh:function(){y()},toggle:function(){H()}},I(),i.toolbarFactoryMap=i.toolbarFactoryMap||{},i.toolbarFactoryMap.documentoutline=function(e){return i.createToolbarButton(e)},i.attachEvent("exec_command_documentoutline",function(e){e.returnValue=!0,e.stopBubble=!0,H()}),i.attachEvent("change",function(){z()}),i.attachEvent("selectionchange",function(){$()}),O(),y(),o.documentOutlineAutoOpen&&T())};function L(t,e){o[t]&&o[t].indexOf(e)===-1&&(o[t]=o[t]+e)}function I(){var t=o.container.ownerDocument;if(!t.getElementById("rte-document-outline-style")){var e=[".rte-document-outline-shell{display:flex;align-items:stretch;gap:10px;}",".rte-document-outline-shell>.rte-document-outline-host{flex:1 1 auto;min-width:0;}","/* 2026-07-12 navigation panel precision */",".rte-document-outline-panel{display:none;flex:0 0 286px;min-width:248px;max-width:min(330px,30vw);border:1px solid rgba(148,163,184,.22);border-radius:8px;background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,251,255,.96));box-shadow:0 14px 32px rgba(29,78,216,.1),0 2px 8px rgba(15,23,42,.06);overflow:hidden;color:#172033;font-family:Aptos,'Segoe UI',sans-serif;}",".rte-document-outline-shell.is-open>.rte-document-outline-panel{display:flex;flex-direction:column;}",".rte-document-outline-header{padding:12px 12px 9px 14px;border-bottom:1px solid rgba(148,163,184,.16);background:rgba(255,255,255,.72);}",".rte-document-outline-kicker{font-size:10px;line-height:1.3;letter-spacing:.08em;text-transform:uppercase;color:#52657e;font-weight:850;}",".rte-document-outline-title{margin-top:3px;font-size:15px;line-height:1.2;font-weight:850;color:#172033;}",".rte-document-outline-copy{margin-top:5px;font-size:12px;line-height:1.42;color:#52657e;}",".rte-document-outline-toolbar{display:flex;align-items:center;justify-content:space-between;padding:8px 10px 8px 14px;border-bottom:1px solid rgba(148,163,184,.16);gap:10px;background:rgba(255,255,255,.52);}",".rte-document-outline-count{min-width:0;font-size:12px;font-weight:750;color:#52657e;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}",".rte-document-outline-close{appearance:none;border:1px solid rgba(100,116,139,.18);background:#fff;color:#315277;cursor:pointer;font-size:12px;font-weight:750;padding:6px 9px;border-radius:7px;line-height:1;}",".rte-document-outline-close:hover,.rte-document-outline-close:focus-visible{background:#eef4ff;color:#0f3f9f;border-color:rgba(37,99,235,.28);}",".rte-document-outline-body{padding:6px;overflow:auto;min-height:140px;max-height:520px;scrollbar-width:thin;}",".rte-document-outline-list{display:flex;flex-direction:column;gap:5px;}",".rte-document-outline-item{appearance:none;width:100%;text-align:left;border:1px solid transparent;background:transparent;color:#172033;cursor:pointer;border-radius:7px;padding:8px 10px 8px calc(10px + (var(--rte-outline-level,1) - 1) * 12px);font-size:13px;line-height:1.35;font-weight:650;}",".rte-document-outline-item:hover,.rte-document-outline-item:focus-visible{background:#f8fbff;border-color:rgba(37,99,235,.18);}",".rte-document-outline-item.is-active{background:#eef4ff;border-color:rgba(37,99,235,.26);color:#0f3f9f;box-shadow:0 8px 18px rgba(37,99,235,.1);}",".rte-document-outline-item-level{display:inline-flex;margin:0 0 3px;padding:2px 6px;border-radius:999px;background:#fff;color:#64748b;font-size:10px;line-height:1.1;letter-spacing:.08em;text-transform:uppercase;font-weight:850;box-shadow:inset 0 0 0 1px rgba(148,163,184,.18);}",".rte-document-outline-empty{margin:6px;padding:14px;color:#52657e;font-size:13px;font-weight:700;line-height:1.55;background:#fff;border:1px dashed rgba(148,163,184,.34);border-radius:8px;}","@media (max-width: 1100px){.rte-document-outline-shell{display:block;}.rte-document-outline-panel{margin-top:12px;max-width:none;width:100%;}.rte-document-outline-body{max-height:320px;}}"].join(""),r=t.createElement("style");r.id="rte-document-outline-style",r.appendChild(t.createTextNode(e)),t.head.appendChild(r),i&&typeof i.ensureStyleSheetLive=="function"&&i.ensureStyleSheetLive(t,r,"rte-document-outline-style",e)}}function O(){if(c)return c;var t=o.container,e=t.ownerDocument;c=e.createElement("div"),c.className="rte-document-outline-shell";var r=e.createElement("div");r.className="rte-document-outline-host";var u=t.parentNode;u.insertBefore(c,t),c.appendChild(r),r.appendChild(t),d=e.createElement("aside"),d.className="rte-document-outline-panel",d.setAttribute("aria-label",o.documentOutlineTitle),d.setAttribute("role","complementary");var l=e.createElement("div");l.className="rte-document-outline-header";var n=e.createElement("div");n.className="rte-document-outline-kicker",n.innerText="Document";var a=e.createElement("div");a.className="rte-document-outline-title",a.innerText=o.documentOutlineTitle;var m=e.createElement("div");m.className="rte-document-outline-copy",m.innerText=o.documentOutlineHint,l.appendChild(n),l.appendChild(a),l.appendChild(m);var v=e.createElement("div");v.className="rte-document-outline-toolbar";var f=e.createElement("div");f.className="rte-document-outline-count",f.setAttribute("data-rte-outline-count","1");var s=e.createElement("button");s.type="button",s.className="rte-document-outline-close",s.innerText="Hide",s.setAttribute("aria-label","Hide document outline"),s.onclick=function(){A()},v.appendChild(f),v.appendChild(s);var h=e.createElement("div");return h.className="rte-document-outline-body",p=e.createElement("div"),p.className="rte-document-outline-list",b=e.createElement("div"),b.className="rte-document-outline-empty",b.innerText=o.documentOutlineEmptyText,h.appendChild(p),h.appendChild(b),d.appendChild(l),d.appendChild(v),d.appendChild(h),c.appendChild(d),c}function H(){c&&c.classList.contains("is-open")?A():T()}function T(){O(),c.classList.add("is-open"),y()}function A(){c&&c.classList.remove("is-open")}function z(){clearTimeout(D),D=setTimeout(function(){y()},80)}function B(t){var e=String(t||"").toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");return e||"section"}function N(){var t=i.getEditable();if(!t)return[];var e=Math.max(1,Math.min(6,o.documentOutlineMinLevel||1)),r=Math.max(e,Math.min(6,o.documentOutlineMaxLevel||6)),u=t.querySelectorAll("h1,h2,h3,h4,h5,h6"),l=[],n,a={},m=t.querySelectorAll("[id]");for(n=0;n<m.length;n++)/^H[1-6]$/.test(m[n].nodeName)||(a[m[n].id]=!0);var v=function(M){return(M.innerText||M.textContent||"").replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")},f=[];for(n=0;n<u.length;n++){var s=u[n],h=v(s);if(!h){f.push(s);continue}var x=s.id;if(!x)x=B(h);else if(!a[x]){a[x]=!0;continue}for(var w=x,_=2;a[w];)w=x+"-"+_,_++;a[w]=!0,s.id!==w&&(s.id=w)}for(n=0;n<f.length;n++)f[n].id&&(a[f[n].id]?f[n].removeAttribute("id"):a[f[n].id]=!0);for(n=0;n<u.length;n++){var C=u[n],S=parseInt(C.nodeName.substring(1),10);if(!(S<e||S>r)){var F=(C.innerText||C.textContent||"").replace(/\s+/g," ").replace(/^\s+|\s+$/g,"");l.push({id:C.id||"__rte-outline-"+l.length,level:S,text:F||"Heading "+(l.length+1),element:C})}}return l}function P(){var t=i.getSelection?i.getSelection():null;if(!t||t.rangeCount===0)return null;try{var e=t.getRangeAt(0).cloneRange();return e.collapse(!0),e}catch{return null}}function R(t){var e=P();if(!e||!t.length)return"";var r=e.startContainer.ownerDocument||i.getEditable().ownerDocument,u=r.createRange(),l="";try{u.setStart(e.startContainer,e.startOffset),u.collapse(!0);for(var n=0;n<t.length;n++){var a=r.createRange();a.selectNodeContents(t[n].element),a.collapse(!0),a.compareBoundaryPoints(Range.START_TO_START,u)<=0&&(l=t[n].id)}}catch{return g}return l}function j(t){if(!(!t||!t.element)){t.element.scrollIntoView({behavior:"smooth",block:"center"});try{var e=i.getSelection?i.getSelection():null,r=t.element.ownerDocument.createRange();r.selectNodeContents(t.element),r.collapse(!0),e&&(e.removeAllRanges(),e.addRange(r))}catch{}i.focus(),g=t.id,k()}}function k(){if(p)for(var t=p.querySelectorAll(".rte-document-outline-item"),e=0;e<t.length;e++){var r=t[e],u=r.getAttribute("data-rte-outline-id")===g;r.classList.toggle("is-active",u),r.setAttribute("aria-current",u?"true":"false")}}function $(){var t=N(),e=R(t);if(e===g&&p&&p.childNodes.length){k();return}g=e,y(t)}function y(t){O();var e=t||N();for(g=R(e)||g;p.firstChild;)p.removeChild(p.firstChild);var r=d.querySelector("[data-rte-outline-count]");r&&(r.innerText=e.length+" heading"+(e.length===1?"":"s")),b.style.display=e.length?"none":"block";for(var u=0;u<e.length;u++)(function(l){var n=d.ownerDocument.createElement("button");n.type="button",n.className="rte-document-outline-item",n.style.setProperty("--rte-outline-level",String(l.level)),n.setAttribute("data-rte-outline-id",l.id),n.setAttribute("aria-current","false");var a=d.ownerDocument.createElement("span");a.className="rte-document-outline-item-level",a.innerText="H"+l.level;var m=d.ownerDocument.createElement("span");m.innerText=l.text,n.appendChild(a),n.appendChild(m),n.onclick=function(){j(l)},p.appendChild(n)})(e[u]);k()}}
1
+ window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_documentoutline=RTE_Plugin_DocumentOutline;function RTE_Plugin_DocumentOutline(){var E=this,o,i,c=null,d=null,p=null,b=null,D=0,g="";E.PluginName="DocumentOutline",E.InitConfig=function(t){o=t,o.documentOutlineEnabled!==!1&&(o.documentOutlineTitle=o.documentOutlineTitle||"Outline",o.documentOutlineHint=o.documentOutlineHint||"Browse headings and jump through long documents without leaving the editor.",o.documentOutlineEmptyText=o.documentOutlineEmptyText||"Add headings to build the document outline.",typeof o.documentOutlineAutoOpen!="boolean"&&(o.documentOutlineAutoOpen=!1),typeof o.documentOutlineMinLevel!="number"&&(o.documentOutlineMinLevel=1),typeof o.documentOutlineMaxLevel!="number"&&(o.documentOutlineMaxLevel=6),H("toolbar_default","#{documentoutline}"),H("toolbar_full","#{documentoutline}"))},E.InitEditor=function(t){i=t,o.documentOutlineEnabled!==!1&&(i.documentOutline={close:function(){A()},list:function(){return N()},open:function(){T()},refresh:function(){y()},toggle:function(){L()}},z(),i.toolbarFactoryMap=i.toolbarFactoryMap||{},i.toolbarFactoryMap.documentoutline=function(e){return i.createToolbarButton(e)},i.attachEvent("exec_command_documentoutline",function(e){e.returnValue=!0,e.stopBubble=!0,L()}),i.attachEvent("change",function(){B()}),i.attachEvent("selectionchange",function(){$()}),O(),y(),o.documentOutlineAutoOpen&&T())};function H(t,e){o[t]&&o[t].indexOf(e)===-1&&(o[t]=o[t]+e)}function z(){var t=o.container.ownerDocument;if(!t.getElementById("rte-document-outline-style")){var e=[".rte-document-outline-shell{display:flex;align-items:stretch;gap:10px;}",".rte-document-outline-shell>.rte-document-outline-host{flex:1 1 auto;min-width:0;}","/* 2026-07-12 navigation panel precision */",".rte-document-outline-panel{display:none;flex:0 0 286px;min-width:248px;max-width:min(330px,30vw);border:1px solid rgba(148,163,184,.22);border-radius:8px;background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(248,251,255,.96));box-shadow:0 14px 32px rgba(29,78,216,.1),0 2px 8px rgba(15,23,42,.06);overflow:hidden;color:#172033;font-family:Aptos,'Segoe UI',sans-serif;}",".rte-document-outline-shell.is-open>.rte-document-outline-panel{display:flex;flex-direction:column;}",".rte-document-outline-header{padding:12px 12px 9px 14px;border-bottom:1px solid rgba(148,163,184,.16);background:rgba(255,255,255,.72);}",".rte-document-outline-kicker{font-size:10px;line-height:1.3;letter-spacing:.08em;text-transform:uppercase;color:#52657e;font-weight:850;}",".rte-document-outline-title{margin-top:3px;font-size:15px;line-height:1.2;font-weight:850;color:#172033;}",".rte-document-outline-copy{margin-top:5px;font-size:12px;line-height:1.42;color:#52657e;}",".rte-document-outline-toolbar{display:flex;align-items:center;justify-content:space-between;padding:8px 10px 8px 14px;border-bottom:1px solid rgba(148,163,184,.16);gap:10px;background:rgba(255,255,255,.52);}",".rte-document-outline-count{min-width:0;font-size:12px;font-weight:750;color:#52657e;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}",".rte-document-outline-close{appearance:none;border:1px solid rgba(100,116,139,.18);background:#fff;color:#315277;cursor:pointer;font-size:12px;font-weight:750;padding:6px 9px;border-radius:7px;line-height:1;}",".rte-document-outline-close:hover,.rte-document-outline-close:focus-visible{background:#eef4ff;color:#0f3f9f;border-color:rgba(37,99,235,.28);}",".rte-document-outline-body{padding:6px;overflow:auto;min-height:140px;max-height:520px;scrollbar-width:thin;}",".rte-document-outline-list{display:flex;flex-direction:column;gap:5px;}",".rte-document-outline-item{appearance:none;width:100%;text-align:left;border:1px solid transparent;background:transparent;color:#172033;cursor:pointer;border-radius:7px;padding:8px 10px 8px calc(10px + (var(--rte-outline-level,1) - 1) * 12px);font-size:13px;line-height:1.35;font-weight:650;}",".rte-document-outline-item:hover,.rte-document-outline-item:focus-visible{background:#f8fbff;border-color:rgba(37,99,235,.18);}",".rte-document-outline-item.is-active{background:#eef4ff;border-color:rgba(37,99,235,.26);color:#0f3f9f;box-shadow:0 8px 18px rgba(37,99,235,.1);}",".rte-document-outline-item-level{display:inline-flex;margin:0 0 3px;padding:2px 6px;border-radius:999px;background:#fff;color:#64748b;font-size:10px;line-height:1.1;letter-spacing:.08em;text-transform:uppercase;font-weight:850;box-shadow:inset 0 0 0 1px rgba(148,163,184,.18);}",".rte-document-outline-empty{margin:6px;padding:14px;color:#52657e;font-size:13px;font-weight:700;line-height:1.55;background:#fff;border:1px dashed rgba(148,163,184,.34);border-radius:8px;}","@media (max-width: 1100px){.rte-document-outline-shell{display:block;}.rte-document-outline-panel{margin-top:12px;max-width:none;width:100%;}.rte-document-outline-body{max-height:320px;}}"].join(""),r=t.createElement("style");r.id="rte-document-outline-style",r.appendChild(t.createTextNode(e)),t.head.appendChild(r),i&&typeof i.ensureStyleSheetLive=="function"&&i.ensureStyleSheetLive(t,r,"rte-document-outline-style",e)}}function O(){if(c)return c;var t=o.container,e=t.ownerDocument;c=e.createElement("div"),c.className="rte-document-outline-shell";var r=e.createElement("div");r.className="rte-document-outline-host";var u=t.parentNode;u.insertBefore(c,t),c.appendChild(r),r.appendChild(t),d=e.createElement("aside"),d.className="rte-document-outline-panel",d.setAttribute("aria-label",o.documentOutlineTitle),d.setAttribute("role","complementary");var l=e.createElement("div");l.className="rte-document-outline-header";var n=e.createElement("div");n.className="rte-document-outline-kicker",n.innerText="Document";var a=e.createElement("div");a.className="rte-document-outline-title",a.innerText=o.documentOutlineTitle;var m=e.createElement("div");m.className="rte-document-outline-copy",m.innerText=o.documentOutlineHint,l.appendChild(n),l.appendChild(a),l.appendChild(m);var v=e.createElement("div");v.className="rte-document-outline-toolbar";var f=e.createElement("div");f.className="rte-document-outline-count",f.setAttribute("data-rte-outline-count","1");var s=e.createElement("button");s.type="button",s.className="rte-document-outline-close",s.innerText="Hide",s.setAttribute("aria-label","Hide document outline"),s.onclick=function(){A()},v.appendChild(f),v.appendChild(s);var h=e.createElement("div");return h.className="rte-document-outline-body",p=e.createElement("div"),p.className="rte-document-outline-list",b=e.createElement("div"),b.className="rte-document-outline-empty",b.innerText=o.documentOutlineEmptyText,h.appendChild(p),h.appendChild(b),d.appendChild(l),d.appendChild(v),d.appendChild(h),c.appendChild(d),c}function L(){c&&c.classList.contains("is-open")?A():T()}function T(){O(),c.classList.add("is-open"),y()}function A(){c&&c.classList.remove("is-open")}function B(){clearTimeout(D),D=setTimeout(function(){y()},80)}function I(t){var e=String(t||"").toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"");return e||"section"}function N(){var t=i.getEditable();if(!t)return[];var e=Math.max(1,Math.min(6,o.documentOutlineMinLevel||1)),r=Math.max(e,Math.min(6,o.documentOutlineMaxLevel||6)),u=t.querySelectorAll("h1,h2,h3,h4,h5,h6"),l=[],n;if(o.autoHeadingAnchors===!1){var a={},m=t.querySelectorAll("[id]");for(n=0;n<m.length;n++)/^H[1-6]$/.test(m[n].nodeName)||(a[m[n].id]=!0);var v=function(M){return(M.innerText||M.textContent||"").replace(/\s+/g," ").replace(/^\s+|\s+$/g,"")},f=[];for(n=0;n<u.length;n++){var s=u[n],h=v(s);if(!h){f.push(s);continue}var x=s.id;if(!x)x=I(h);else if(!a[x]){a[x]=!0;continue}for(var w=x,_=2;a[w];)w=x+"-"+_,_++;a[w]=!0,s.id!==w&&(s.id=w)}for(n=0;n<f.length;n++)f[n].id&&(a[f[n].id]?f[n].removeAttribute("id"):a[f[n].id]=!0)}for(n=0;n<u.length;n++){var C=u[n],S=parseInt(C.nodeName.substring(1),10);if(!(S<e||S>r)){var F=(C.innerText||C.textContent||"").replace(/\s+/g," ").replace(/^\s+|\s+$/g,"");l.push({id:C.id||"__rte-outline-"+l.length,level:S,text:F||"Heading "+(l.length+1),element:C})}}return l}function P(){var t=i.getSelection?i.getSelection():null;if(!t||t.rangeCount===0)return null;try{var e=t.getRangeAt(0).cloneRange();return e.collapse(!0),e}catch{return null}}function R(t){var e=P();if(!e||!t.length)return"";var r=e.startContainer.ownerDocument||i.getEditable().ownerDocument,u=r.createRange(),l="";try{u.setStart(e.startContainer,e.startOffset),u.collapse(!0);for(var n=0;n<t.length;n++){var a=r.createRange();a.selectNodeContents(t[n].element),a.collapse(!0),a.compareBoundaryPoints(Range.START_TO_START,u)<=0&&(l=t[n].id)}}catch{return g}return l}function j(t){if(!(!t||!t.element)){t.element.scrollIntoView({behavior:"smooth",block:"center"});try{var e=i.getSelection?i.getSelection():null,r=t.element.ownerDocument.createRange();r.selectNodeContents(t.element),r.collapse(!0),e&&(e.removeAllRanges(),e.addRange(r))}catch{}i.focus(),g=t.id,k()}}function k(){if(p)for(var t=p.querySelectorAll(".rte-document-outline-item"),e=0;e<t.length;e++){var r=t[e],u=r.getAttribute("data-rte-outline-id")===g;r.classList.toggle("is-active",u),r.setAttribute("aria-current",u?"true":"false")}}function $(){var t=N(),e=R(t);if(e===g&&p&&p.childNodes.length){k();return}g=e,y(t)}function y(t){O();var e=t||N();for(g=R(e)||g;p.firstChild;)p.removeChild(p.firstChild);var r=d.querySelector("[data-rte-outline-count]");r&&(r.innerText=e.length+" heading"+(e.length===1?"":"s")),b.style.display=e.length?"none":"block";for(var u=0;u<e.length;u++)(function(l){var n=d.ownerDocument.createElement("button");n.type="button",n.className="rte-document-outline-item",n.style.setProperty("--rte-outline-level",String(l.level)),n.setAttribute("data-rte-outline-id",l.id),n.setAttribute("aria-current","false");var a=d.ownerDocument.createElement("span");a.className="rte-document-outline-item-level",a.innerText="H"+l.level;var m=d.ownerDocument.createElement("span");m.innerText=l.text,n.appendChild(a),n.appendChild(m),n.onclick=function(){j(l)},p.appendChild(n)})(e[u]);k()}}
@@ -148,22 +148,67 @@ function RTE_Plugin_FormattingMarks() {
148
148
  // may be deliberate.
149
149
  if (parent.nodeName === "CODE" || parent.nodeName === "PRE") return;
150
150
 
151
+ // Replacing the text node moves a caret inside it to the node's old place in its
152
+ // parent - usually the paragraph start. This runs on every keyup, and the first
153
+ // space typed at a line end is always a non-breaking one, so with marks on every
154
+ // later character landed at the start, reversed: " edited" became "detide".
155
+ // Remember where the selection was inside this node and put it back.
156
+ var sel = doc.getSelection ? doc.getSelection() : null;
157
+ var range = sel && sel.rangeCount ? sel.getRangeAt(0) : null;
158
+ var keepStart = range && range.startContainer === node ? range.startOffset : -1;
159
+ var keepEnd = range && range.endContainer === node ? range.endOffset : -1;
160
+
151
161
  var frag = doc.createDocumentFragment();
162
+ var pieces = []; // in order: { node, marker } - every marker stands for ONE character
152
163
  var buf = "";
153
164
  for (var i = 0; i < text.length; i++) {
154
165
  var def = chars[text[i]];
166
+ // A space typed at a line end is inserted as a non-breaking placeholder that the
167
+ // browser turns back into a space when the next character arrives. Wrapped in a
168
+ // non-editable marker it never could, and saved as a hard &nbsp;. Leave the one
169
+ // right before the caret alone; it is marked once the caret moves on.
170
+ if (def && text[i] === " " && i === keepStart - 1 && keepStart === keepEnd) def = null;
155
171
  if (!def) { buf += text[i]; continue; }
156
- if (buf) { frag.appendChild(doc.createTextNode(buf)); buf = ""; }
172
+ if (buf) { pieces.push({ node: frag.appendChild(doc.createTextNode(buf)), marker: false }); buf = ""; }
157
173
  var span = doc.createElement("span");
158
174
  span.setAttribute("data-rte-fm", "1");
159
175
  span.setAttribute("data-rte-fm-char", text[i]);
160
176
  span.className = def.cls;
161
177
  span.setAttribute("contenteditable", "false");
162
178
  span.textContent = def.label;
163
- frag.appendChild(span);
179
+ pieces.push({ node: frag.appendChild(span), marker: true });
164
180
  }
165
- if (buf) frag.appendChild(doc.createTextNode(buf));
181
+ if (buf) pieces.push({ node: frag.appendChild(doc.createTextNode(buf)), marker: false });
166
182
  parent.replaceChild(frag, node);
183
+
184
+ if (keepStart < 0 && keepEnd < 0) return;
185
+ // Offset k in the old text -> a point in the pieces. Inside text where possible;
186
+ // never inside a marker (it is not editable): just before or after it.
187
+ function pointAt(k) {
188
+ var pos = 0;
189
+ for (var p = 0; p < pieces.length; p++) {
190
+ var piece = pieces[p];
191
+ if (piece.marker) {
192
+ if (k <= pos) return { node: parent, offset: Array.prototype.indexOf.call(parent.childNodes, piece.node) };
193
+ pos += 1;
194
+ } else {
195
+ var len = piece.node.nodeValue.length;
196
+ if (k <= pos + len) return { node: piece.node, offset: k - pos };
197
+ pos += len;
198
+ }
199
+ }
200
+ var last = pieces[pieces.length - 1].node;
201
+ return { node: parent, offset: Array.prototype.indexOf.call(parent.childNodes, last) + 1 };
202
+ }
203
+ try {
204
+ var r = doc.createRange();
205
+ var a = pointAt(keepStart >= 0 ? keepStart : 0);
206
+ var b = keepEnd >= 0 ? pointAt(keepEnd) : a;
207
+ if (keepStart < 0) { r.setStart(range.startContainer, range.startOffset); } else r.setStart(a.node, a.offset);
208
+ if (keepEnd < 0) { r.setEnd(range.endContainer, range.endOffset); } else r.setEnd(b.node, b.offset);
209
+ sel.removeAllRanges();
210
+ sel.addRange(r);
211
+ } catch (e) { /* a selection we cannot restore is no reason to lose the marks */ }
167
212
  }
168
213
 
169
214
  // ---- serialization safety -------------------------------------------
@@ -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 s=this,p,i,k=null,l=!1,y=!1,h=!1,d=[{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:"-"}];s.PluginName="FormattingMarks",s.InitConfig=function(e){p=e},s.InitEditor=function(e){i=e,i.attachEvent("exec_command_formattingmarks",function(t){t.returnValue=!0,s.Toggle()}),v();try{i.attachEvent("ready",v)}catch{}try{i.attachEvent("aftersethtml",function(){v(),l&&b()})}catch{}setTimeout(v,0),i.setFormattingMarks=function(t){return l=!!t,C(),l},i.toggleFormattingMarks=function(){return s.Toggle()},i.isFormattingMarks=function(){return l},i.getFormattingMarksCss=function(){return N()}},s.Toggle=function(){return l=!l,C(),l};function v(){var e=w();if(e&&(D(e),M(),e!==k)){k=e;var t=g();t&&(t.addEventListener("keyup",function(){l&&b()}),t.addEventListener("paste",function(){l&&b()}))}}function w(){try{return i.getDocument()}catch{return null}}function g(){try{return i.getEditable()}catch{return null}}function b(){h||(h=!0,setTimeout(function(){h=!1,T()},0))}function C(){var e=g();e&&(e.classList&&(e.classList.toggle("rte-fm-on",l),e.classList.toggle("rte-fm-pilcrow",l&&p.formattingMarkPilcrow!==!1),e.classList.toggle("rte-fm-blocks",l&&p.formattingMarkBlocks!==!1)),l&&p.formattingMarkInvisibles!==!1?T():E())}function E(){var e=g();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 T(){var e=g(),t=w();if(!(!e||!t)){E();for(var n={},r=0;r<d.length;r++)n[d[r].ch]=d[r];for(var a=t.createTreeWalker(e,4,null,!1),f=[],o;o=a.nextNode();)if(o.nodeValue){for(var u=0;u<d.length;u++)if(o.nodeValue.indexOf(d[u].ch)>=0){f.push(o);break}}for(var c=0;c<f.length;c++)x(t,f[c],n)}}function x(e,t,n){var r=t.nodeValue,a=t.parentNode;if(a&&!(a.nodeName==="CODE"||a.nodeName==="PRE")){for(var f=e.createDocumentFragment(),o="",u=0;u<r.length;u++){var c=n[r[u]];if(!c){o+=r[u];continue}o&&(f.appendChild(e.createTextNode(o)),o="");var m=e.createElement("span");m.setAttribute("data-rte-fm","1"),m.setAttribute("data-rte-fm-char",r[u]),m.className=c.cls,m.setAttribute("contenteditable","false"),m.textContent=c.label,f.appendChild(m)}o&&f.appendChild(e.createTextNode(o)),a.replaceChild(f,t)}}function _(){var e=g();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],f=a.ownerDocument.createTextNode(a.getAttribute("data-rte-fm-char")||"");n.push({span:a,parent:a.parentNode,text:f}),a.parentNode&&a.parentNode.replaceChild(f,a)}return function(){for(var u=0;u<n.length;u++){var c=n[u];c.text.parentNode&&c.text.parentNode.replaceChild(c.span,c.text)}}}function M(){if(!y){for(var e=["getHTMLCode","getJSON","getHTMLContent","getText"],t=!1,n=0;n<e.length;n++)(function(r){var a=i[r];if(!(typeof a!="function"||a.__rteFmWrapped)){var f=function(){var o=_();try{return a.apply(i,arguments)}finally{o()}};f.__rteFmWrapped=!0,i[r]=f,t=!0}})(e[n]);t&&(y=!0)}}function N(){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 D(e){if(e){var t=e.getElementById("rte-formatting-marks-styles"),n=N();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),i&&typeof i.ensureStyleSheetLive=="function"&&i.ensureStyleSheetLive(e,r,"rte-formatting-marks-styles",r.textContent)}}}
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,x=!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 _(){x||(x=!0,setTimeout(function(){x=!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(T){for(var y=0,D=0;D<c.length;D++){var N=c[D];if(N.marker){if(T<=y)return{node:a,offset:Array.prototype.indexOf.call(a.childNodes,N.node)};y+=1}else{var P=N.node.nodeValue.length;if(T<=y+P)return{node:N.node,offset:T-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)}}}
@@ -380,6 +380,7 @@ function RTE_Plugin_Sanitizer() {
380
380
  }
381
381
 
382
382
  var attrs = [];
383
+ var strippedSrc = false;
383
384
  for (var a = 0; a < el.attributes.length; a++) attrs.push(el.attributes[a]);
384
385
  for (var k = 0; k < attrs.length; k++) {
385
386
  var name = attrs[k].name.toLowerCase();
@@ -397,7 +398,11 @@ function RTE_Plugin_Sanitizer() {
397
398
  if (name.indexOf("data-") === 0 || name.indexOf("aria-") === 0) continue;
398
399
 
399
400
  if (URL_ATTRS[name]) {
400
- if (!isSafeUrl(value, tag, name)) { note(report.removedAttributes, tag + "[" + name + "]"); el.removeAttribute(attrs[k].name); }
401
+ if (!isSafeUrl(value, tag, name)) {
402
+ note(report.removedAttributes, tag + "[" + name + "]");
403
+ el.removeAttribute(attrs[k].name);
404
+ if (name === "src") strippedSrc = true;
405
+ }
401
406
  continue;
402
407
  }
403
408
  if (!ALLOWED_ATTRS[name] && !attrExtra(name)) {
@@ -406,6 +411,18 @@ function RTE_Plugin_Sanitizer() {
406
411
  }
407
412
  }
408
413
 
414
+ // An <img> whose only source was just stripped is an empty box that
415
+ // saves as <img> with no src -- dragging a page image into the editor
416
+ // from a page opened on disk did exactly that (its file: src is not a
417
+ // safe scheme). Drop the element when nothing is left to show. Keep it
418
+ // when srcset or a lazy-load data-*src still carries an image, and never
419
+ // touch an <img> that arrived without a src (an app placeholder).
420
+ if (tag === "img" && strippedSrc && !el.hasAttribute("srcset") && !hasDataSource(el)) {
421
+ note(report.removedTags, "img");
422
+ el.parentNode.removeChild(el);
423
+ continue;
424
+ }
425
+
409
426
  // A link that opens a new tab without rel="noopener" hands the
410
427
  // opener window to the destination.
411
428
  if (tag === "a" && (el.getAttribute("target") || "").toLowerCase() === "_blank") {
@@ -422,6 +439,12 @@ function RTE_Plugin_Sanitizer() {
422
439
  parent.removeChild(el);
423
440
  }
424
441
  function note(list, what) { if (list.indexOf(what) < 0) list.push(what); }
442
+ function hasDataSource(el) {
443
+ for (var i = 0; i < el.attributes.length; i++) {
444
+ if (/^data-(.*-)?(src|srcset|original)$/i.test(el.attributes[i].name)) return true;
445
+ }
446
+ return false;
447
+ }
425
448
 
426
449
  function sanitizeHtml(html) {
427
450
  var out = html;
@@ -1 +1 @@
1
- window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_sanitizer=RTE_Plugin_Sanitizer,typeof RTE_DefaultConfig.contentSanitizer>"u"&&(RTE_DefaultConfig.contentSanitizer=!0);function RTE_Plugin_Sanitizer(){var y=this,g,l,E=!1,b={removedTags:[],removedAttributes:[],calls:0,lastPasses:0},k=[];y.PluginName="Sanitizer",y.InitConfig=function(e){g=e},y.InitEditor=function(e){if(l=e,g.contentSanitizer===!1)return;l.sanitizeHtml=function(r){return m(String(r??""))},l.getSanitizerReport=function(){return JSON.parse(JSON.stringify(b))};function t(){try{B(),W()}catch{}try{X()}catch{}try{$()}catch{}}t();try{l.attachEvent("ready",t)}catch{}setTimeout(t,0),setTimeout(t,400)};var L={};"p,div,span,br,hr,h1,h2,h3,h4,h5,h6,b,strong,i,em,u,s,strike,del,ins,mark,small,sub,sup,abbr,cite,q,dfn,kbd,samp,var,time,data,bdi,bdo,wbr,ruby,rt,rp,ul,ol,li,dl,dt,dd,table,thead,tbody,tfoot,tr,td,th,caption,colgroup,col,blockquote,pre,code,figure,figcaption,section,article,header,footer,main,aside,nav,address,details,summary,a,img,picture,source,video,audio,track,map,area,input,label,button,svg,g,path,circle,ellipse,rect,line,polyline,polygon,text,tspan,defs,marker,linearGradient,radialGradient,stop,clipPath,mask,pattern,use,symbol,title,desc".split(",").forEach(function(e){L[e]=!0});var R={script:1,noscript:1,template:1,object:1,embed:1,applet:1,base:1,meta:1,link:1,frame:1,frameset:1,foreignobject:1,xml:1,"script:":1},z={};"id,class,style,title,lang,dir,translate,hidden,tabindex,role,contenteditable,spellcheck,autocomplete,draggable,sandbox,allowfullscreen,allow,frameborder,scrolling,href,src,srcset,sizes,alt,width,height,loading,decoding,referrerpolicy,target,rel,download,type,value,name,placeholder,checked,disabled,readonly,colspan,rowspan,headers,scope,span,align,valign,bgcolor,border,cellpadding,cellspacing,start,reversed,datetime,cite,open,controls,autoplay,loop,muted,playsinline,poster,preload,kind,srclang,label,usemap,ismap,coords,shape,viewbox,xmlns,fill,stroke,stroke-width,stroke-linecap,stroke-linejoin,stroke-dasharray,d,cx,cy,r,rx,ry,x,y,x1,y1,x2,y2,points,transform,opacity,fill-rule,clip-rule,gradientunits,offset,stop-color,stop-opacity,text-anchor,font-size,font-family,font-weight,preserveaspectratio,version".split(",").forEach(function(e){z[e]=!0});var M={href:1,src:1,action:1,formaction:1,poster:1,cite:1,data:1,longdesc:1,background:1,ping:1,srcset:1},I=/^(https?|mailto|tel|ftp|sms|callto|webcal|geo|bitcoin):/i,H=/^data:image\/(png|jpe?g|gif|webp|bmp|x-icon|avif);base64,[a-z0-9+/=\s]+$/i;function w(e,t,r){var n=String(e??"").replace(/[\u0000-\u0020\u007F-\u00A0]+/g,"").trim();if(!n)return!1;if(t==="use")return n.charAt(0)==="#";if(/^[#?/]/.test(n))return!0;var o=/^([a-z][a-z0-9+.\-]*):/i.exec(n);return o?H.test(n)?t==="img"||t==="source"||r==="poster"||r==="srcset":/^blob:/i.test(n)?t==="img"||t==="video"||t==="audio"||t==="source":I.test(n):!0}function P(e){for(var t=[],r=String(e??"").split(";"),n=0;n<r.length;n++){var o=r[n];if(o.trim()&&!/expression\s*\(|(javascript|vbscript|livescript)\s*:|-moz-binding|behaviou?r\s*:|@import|-o-link/i.test(o)){var i=/url\s*\(\s*(['"]?)([^'")]*)\1\s*\)/i.exec(o);i&&!w(i[2],"img","src")||t.push(o.trim())}}return t.join("; ")}var j="allow-scripts allow-same-origin allow-presentation";function G(e,t){var r=j.split(" "),n=!1;try{n=new URL(t,location.href).origin===location.origin}catch{}if(n&&(r=r.filter(function(i){return i!=="allow-same-origin"})),e.hasAttribute("sandbox")){var o=(e.getAttribute("sandbox")||"").toLowerCase().split(/\s+/);r=r.filter(function(i){return o.indexOf(i)>=0})}e.setAttribute("sandbox",r.join(" "))}function U(e){if(g.sanitizerAllowIframes===!1)return!1;var t=e.getAttribute("src")||"";if(!/^https?:/i.test(t))return!1;var r=g.sanitizerAllowedIframeHosts;if(!r||!r.length)return G(e,t),!0;try{for(var n=new URL(t).hostname.toLowerCase(),o=0;o<r.length;o++){var i=String(r[o]).toLowerCase();if(n===i||n.slice(-(i.length+1))==="."+i)return!0}}catch{}return!1}function C(e){var t={},r=[],n=[];(e||[]).forEach(function(i){if(i instanceof RegExp){n.push(i);return}var s=String(i).toLowerCase();if(s.indexOf("*")===-1){t[s]=!0;return}r.push(s.split("*"))});function o(i,s){var a=i[0];if(s.lastIndexOf(a,0)!==0)return!1;var u=i[i.length-1];if(u&&(s.length<u.length||s.indexOf(u,s.length-u.length)===-1))return!1;for(var c=a.length,p=1;p<i.length;p++)if(i[p]){var v=s.indexOf(i[p],c);if(v===-1)return!1;c=v+i[p].length}return!0}return function(i){if(t[i])return!0;for(var s=0;s<r.length;s++)if(o(r[s],i))return!0;for(var a=0;a<n.length;a++)if(n[a].test(i))return!0;return!1}}function x(e,t){var r=C(g.sanitizerAllowTags),n=C(g.sanitizerAllowAttributes),o=g.sanitizerAllowStyleTags===!0,i=[];(function K(D){for(var _=0;_<D.childNodes.length;_++){var h=D.childNodes[_];h.nodeType===1?(i.push(h),K(h)):h.nodeType===8&&i.push(h)}})(e);for(var s=0;s<i.length;s++){var a=i[s];if(a.parentNode){if(a.nodeType===8){O(a.data)&&(d(t.removedTags,"#comment"),a.parentNode.removeChild(a));continue}var u=(a.localName||a.nodeName||"").toLowerCase();if(u==="style"){if(!o){d(t.removedTags,"style"),a.parentNode.removeChild(a);continue}}else if(u==="iframe"){if(a.hasAttribute("srcdoc")&&(d(t.removedAttributes,"iframe[srcdoc]"),a.removeAttribute("srcdoc")),!U(a)){d(t.removedTags,"iframe"),a.parentNode.removeChild(a);continue}}else if(u==="title"||u==="desc"){if(!a.closest||!a.closest("svg")){d(t.removedTags,u),a.parentNode.removeChild(a);continue}}else if(R[u]){d(t.removedTags,u),a.parentNode.removeChild(a);continue}else if(!L[u]&&!r(u)){d(t.removedTags,u),F(a);continue}for(var c=[],p=0;p<a.attributes.length;p++)c.push(a.attributes[p]);for(var v=0;v<c.length;v++){var f=c[v].name.toLowerCase(),T=c[v].value;if(f.indexOf("on")===0){d(t.removedAttributes,f),a.removeAttribute(c[v].name);continue}if(f==="xlink:href"||f==="xmlns:xlink"){w(T,u,f)||(d(t.removedAttributes,f),a.removeAttribute(c[v].name));continue}if(f==="srcdoc"){d(t.removedAttributes,"srcdoc"),a.removeAttribute(c[v].name);continue}if(f==="style"){a.setAttribute("style",P(T));continue}if(!(f.indexOf("data-")===0||f.indexOf("aria-")===0)){if(M[f]){w(T,u,f)||(d(t.removedAttributes,u+"["+f+"]"),a.removeAttribute(c[v].name));continue}!z[f]&&!n(f)&&(d(t.removedAttributes,f),a.removeAttribute(c[v].name))}}if(u==="a"&&(a.getAttribute("target")||"").toLowerCase()==="_blank"){var S=(a.getAttribute("rel")||"").toLowerCase();S.indexOf("noopener")<0&&a.setAttribute("rel",(S?S+" ":"")+"noopener noreferrer")}}}return e}function F(e){for(var t=e.parentNode;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}function d(e,t){e.indexOf(t)<0&&e.push(t)}function m(e){var t=e;b.calls++;for(var r=0;r<3;r++){var n=new DOMParser().parseFromString("<body>"+t+"</body>","text/html");x(n.body,b);var o=n.body.innerHTML;if(b.lastPasses=r+1,o===t)break;t=o}return t}function B(){if(!E){for(var e=["getHTMLCode","getHTMLContent"],t=!1,r=0;r<e.length;r++)(function(n){var o=l[n];if(!(typeof o!="function"||o.__rteSanitized)){var i=function(){var s=o.apply(l,arguments);return typeof s!="string"?s:m(s)};i.__rteSanitized=!0,l[n]=i,t=!0}})(e[r]);t&&(E=!0)}}function W(){for(var e=["setHTMLCode","setHTMLContent"],t=0;t<e.length;t++)(function(r){var n=l[r];if(!(typeof n!="function"||n.__rteSanitizedIn)){var o=function(i){var s=[].slice.call(arguments);return typeof i=="string"&&(s[0]=m(i)),n.apply(l,s)};o.__rteSanitizedIn=!0,l[r]=o}})(e[t])}function q(e){return/\son[a-z]+\s*=/i.test(e)||/<\s*(script|iframe|object|embed|base)\b/i.test(e)||/srcdoc\s*=/i.test(e)||/(javascript|vbscript)\s*:/i.test(e)||/data:\s*text\/html/i.test(e)}function O(e){var t=String(e??"");return t.indexOf("-->")!==-1||t.indexOf("--!>")!==-1||t.charAt(0)===">"||t.charAt(0)==="-"&&t.charAt(1)===">"}var N=/^(script|iframe|object|embed|base|meta|link|form)$/;function A(e){if(!e.attributes)return!1;for(var t=0;t<e.attributes.length;t++){var r=e.attributes[t].name.toLowerCase();if(r.indexOf("on")===0||r==="srcdoc"||(r==="href"||r==="src"||r==="data"||r==="action"||r==="xlink:href")&&/(javascript|vbscript)\s*:|data:\s*text\/html/i.test(e.attributes[t].value||""))return!0}return!1}function J(e){if(N.test(e.localName||"")||A(e))return!0;for(var t=e.getElementsByTagName?e.getElementsByTagName("*"):[],r=0;r<t.length;r++)if(N.test(t[r].localName||"")||A(t[r]))return!0;return!1}function $(){if(g.sanitizerGuardLiveDom!==!1){var e=null;try{e=l.getEditable()}catch{return}if(!(!e||e.__rteLiveGuard)){e.__rteLiveGuard=!0;var t=new MutationObserver(function(r){for(var n=!1,o=0;o<r.length&&!n;o++){var i=r[o];if(i.type==="attributes"){var s=(i.attributeName||"").toLowerCase();(s.indexOf("on")===0||s==="srcdoc"||A(i.target))&&(n=!0);continue}for(var a=0;a<i.addedNodes.length;a++){var u=i.addedNodes[a];if(u.nodeType===8){if(O(u.data)){n=!0;break}continue}if(u.nodeType===1&&J(u)){n=!0;break}}}if(n)try{x(e,b)}catch{}});t.observe(e,{childList:!0,subtree:!0,attributes:!0}),k.push(t)}}}function X(){var e=null;try{e=l.getEditable()}catch{return}if(!e||e.__rteSanitizePaste)return;e.__rteSanitizePaste=!0,e.addEventListener("paste",function(r){var n=r.clipboardData||window.clipboardData;if(n){var o="";try{o=n.getData("text/html")||""}catch{return}if(!(!o||!q(o))){r.preventDefault(),r.stopImmediatePropagation();var i=m(o);try{l.insertHTML(i)}catch{try{l.insertText(n.getData("text/plain")||"")}catch{}}}}},!0);function t(){var r=function(){try{x(e,b)}catch{}};setTimeout(r,0),setTimeout(r,250)}e.addEventListener("paste",t,!1),e.addEventListener("drop",t,!0)}}
1
+ window.RTE_DefaultConfig||(window.RTE_DefaultConfig={}),RTE_DefaultConfig.plugin_sanitizer=RTE_Plugin_Sanitizer,typeof RTE_DefaultConfig.contentSanitizer>"u"&&(RTE_DefaultConfig.contentSanitizer=!0);function RTE_Plugin_Sanitizer(){var w=this,p,l,L=!1,b={removedTags:[],removedAttributes:[],calls:0,lastPasses:0},R=[];w.PluginName="Sanitizer",w.InitConfig=function(t){p=t},w.InitEditor=function(t){if(l=t,p.contentSanitizer===!1)return;l.sanitizeHtml=function(r){return y(String(r??""))},l.getSanitizerReport=function(){return JSON.parse(JSON.stringify(b))};function e(){try{$(),q()}catch{}try{Q()}catch{}try{K()}catch{}}e();try{l.attachEvent("ready",e)}catch{}setTimeout(e,0),setTimeout(e,400)};var z={};"p,div,span,br,hr,h1,h2,h3,h4,h5,h6,b,strong,i,em,u,s,strike,del,ins,mark,small,sub,sup,abbr,cite,q,dfn,kbd,samp,var,time,data,bdi,bdo,wbr,ruby,rt,rp,ul,ol,li,dl,dt,dd,table,thead,tbody,tfoot,tr,td,th,caption,colgroup,col,blockquote,pre,code,figure,figcaption,section,article,header,footer,main,aside,nav,address,details,summary,a,img,picture,source,video,audio,track,map,area,input,label,button,svg,g,path,circle,ellipse,rect,line,polyline,polygon,text,tspan,defs,marker,linearGradient,radialGradient,stop,clipPath,mask,pattern,use,symbol,title,desc".split(",").forEach(function(t){z[t]=!0});var M={script:1,noscript:1,template:1,object:1,embed:1,applet:1,base:1,meta:1,link:1,frame:1,frameset:1,foreignobject:1,xml:1,"script:":1},C={};"id,class,style,title,lang,dir,translate,hidden,tabindex,role,contenteditable,spellcheck,autocomplete,draggable,sandbox,allowfullscreen,allow,frameborder,scrolling,href,src,srcset,sizes,alt,width,height,loading,decoding,referrerpolicy,target,rel,download,type,value,name,placeholder,checked,disabled,readonly,colspan,rowspan,headers,scope,span,align,valign,bgcolor,border,cellpadding,cellspacing,start,reversed,datetime,cite,open,controls,autoplay,loop,muted,playsinline,poster,preload,kind,srclang,label,usemap,ismap,coords,shape,viewbox,xmlns,fill,stroke,stroke-width,stroke-linecap,stroke-linejoin,stroke-dasharray,d,cx,cy,r,rx,ry,x,y,x1,y1,x2,y2,points,transform,opacity,fill-rule,clip-rule,gradientunits,offset,stop-color,stop-opacity,text-anchor,font-size,font-family,font-weight,preserveaspectratio,version".split(",").forEach(function(t){C[t]=!0});var I={href:1,src:1,action:1,formaction:1,poster:1,cite:1,data:1,longdesc:1,background:1,ping:1,srcset:1},H=/^(https?|mailto|tel|ftp|sms|callto|webcal|geo|bitcoin):/i,P=/^data:image\/(png|jpe?g|gif|webp|bmp|x-icon|avif);base64,[a-z0-9+/=\s]+$/i;function x(t,e,r){var a=String(t??"").replace(/[\u0000-\u0020\u007F-\u00A0]+/g,"").trim();if(!a)return!1;if(e==="use")return a.charAt(0)==="#";if(/^[#?/]/.test(a))return!0;var o=/^([a-z][a-z0-9+.\-]*):/i.exec(a);return o?P.test(a)?e==="img"||e==="source"||r==="poster"||r==="srcset":/^blob:/i.test(a)?e==="img"||e==="video"||e==="audio"||e==="source":H.test(a):!0}function j(t){for(var e=[],r=String(t??"").split(";"),a=0;a<r.length;a++){var o=r[a];if(o.trim()&&!/expression\s*\(|(javascript|vbscript|livescript)\s*:|-moz-binding|behaviou?r\s*:|@import|-o-link/i.test(o)){var n=/url\s*\(\s*(['"]?)([^'")]*)\1\s*\)/i.exec(o);n&&!x(n[2],"img","src")||e.push(o.trim())}}return e.join("; ")}var G="allow-scripts allow-same-origin allow-presentation";function U(t,e){var r=G.split(" "),a=!1;try{a=new URL(e,location.href).origin===location.origin}catch{}if(a&&(r=r.filter(function(n){return n!=="allow-same-origin"})),t.hasAttribute("sandbox")){var o=(t.getAttribute("sandbox")||"").toLowerCase().split(/\s+/);r=r.filter(function(n){return o.indexOf(n)>=0})}t.setAttribute("sandbox",r.join(" "))}function F(t){if(p.sanitizerAllowIframes===!1)return!1;var e=t.getAttribute("src")||"";if(!/^https?:/i.test(e))return!1;var r=p.sanitizerAllowedIframeHosts;if(!r||!r.length)return U(t,e),!0;try{for(var a=new URL(e).hostname.toLowerCase(),o=0;o<r.length;o++){var n=String(r[o]).toLowerCase();if(a===n||a.slice(-(n.length+1))==="."+n)return!0}}catch{}return!1}function N(t){var e={},r=[],a=[];(t||[]).forEach(function(n){if(n instanceof RegExp){a.push(n);return}var s=String(n).toLowerCase();if(s.indexOf("*")===-1){e[s]=!0;return}r.push(s.split("*"))});function o(n,s){var i=n[0];if(s.lastIndexOf(i,0)!==0)return!1;var u=n[n.length-1];if(u&&(s.length<u.length||s.indexOf(u,s.length-u.length)===-1))return!1;for(var d=i.length,g=1;g<n.length;g++)if(n[g]){var h=s.indexOf(n[g],d);if(h===-1)return!1;d=h+n[g].length}return!0}return function(n){if(e[n])return!0;for(var s=0;s<r.length;s++)if(o(r[s],n))return!0;for(var i=0;i<a.length;i++)if(a[i].test(n))return!0;return!1}}function A(t,e){var r=N(p.sanitizerAllowTags),a=N(p.sanitizerAllowAttributes),o=p.sanitizerAllowStyleTags===!0,n=[];(function V(k){for(var E=0;E<k.childNodes.length;E++){var m=k.childNodes[E];m.nodeType===1?(n.push(m),V(m)):m.nodeType===8&&n.push(m)}})(t);for(var s=0;s<n.length;s++){var i=n[s];if(i.parentNode){if(i.nodeType===8){O(i.data)&&(c(e.removedTags,"#comment"),i.parentNode.removeChild(i));continue}var u=(i.localName||i.nodeName||"").toLowerCase();if(u==="style"){if(!o){c(e.removedTags,"style"),i.parentNode.removeChild(i);continue}}else if(u==="iframe"){if(i.hasAttribute("srcdoc")&&(c(e.removedAttributes,"iframe[srcdoc]"),i.removeAttribute("srcdoc")),!F(i)){c(e.removedTags,"iframe"),i.parentNode.removeChild(i);continue}}else if(u==="title"||u==="desc"){if(!i.closest||!i.closest("svg")){c(e.removedTags,u),i.parentNode.removeChild(i);continue}}else if(M[u]){c(e.removedTags,u),i.parentNode.removeChild(i);continue}else if(!z[u]&&!r(u)){c(e.removedTags,u),B(i);continue}for(var d=[],g=!1,h=0;h<i.attributes.length;h++)d.push(i.attributes[h]);for(var v=0;v<d.length;v++){var f=d[v].name.toLowerCase(),S=d[v].value;if(f.indexOf("on")===0){c(e.removedAttributes,f),i.removeAttribute(d[v].name);continue}if(f==="xlink:href"||f==="xmlns:xlink"){x(S,u,f)||(c(e.removedAttributes,f),i.removeAttribute(d[v].name));continue}if(f==="srcdoc"){c(e.removedAttributes,"srcdoc"),i.removeAttribute(d[v].name);continue}if(f==="style"){i.setAttribute("style",j(S));continue}if(!(f.indexOf("data-")===0||f.indexOf("aria-")===0)){if(I[f]){x(S,u,f)||(c(e.removedAttributes,u+"["+f+"]"),i.removeAttribute(d[v].name),f==="src"&&(g=!0));continue}!C[f]&&!a(f)&&(c(e.removedAttributes,f),i.removeAttribute(d[v].name))}}if(u==="img"&&g&&!i.hasAttribute("srcset")&&!W(i)){c(e.removedTags,"img"),i.parentNode.removeChild(i);continue}if(u==="a"&&(i.getAttribute("target")||"").toLowerCase()==="_blank"){var _=(i.getAttribute("rel")||"").toLowerCase();_.indexOf("noopener")<0&&i.setAttribute("rel",(_?_+" ":"")+"noopener noreferrer")}}}return t}function B(t){for(var e=t.parentNode;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}function c(t,e){t.indexOf(e)<0&&t.push(e)}function W(t){for(var e=0;e<t.attributes.length;e++)if(/^data-(.*-)?(src|srcset|original)$/i.test(t.attributes[e].name))return!0;return!1}function y(t){var e=t;b.calls++;for(var r=0;r<3;r++){var a=new DOMParser().parseFromString("<body>"+e+"</body>","text/html");A(a.body,b);var o=a.body.innerHTML;if(b.lastPasses=r+1,o===e)break;e=o}return e}function $(){if(!L){for(var t=["getHTMLCode","getHTMLContent"],e=!1,r=0;r<t.length;r++)(function(a){var o=l[a];if(!(typeof o!="function"||o.__rteSanitized)){var n=function(){var s=o.apply(l,arguments);return typeof s!="string"?s:y(s)};n.__rteSanitized=!0,l[a]=n,e=!0}})(t[r]);e&&(L=!0)}}function q(){for(var t=["setHTMLCode","setHTMLContent"],e=0;e<t.length;e++)(function(r){var a=l[r];if(!(typeof a!="function"||a.__rteSanitizedIn)){var o=function(n){var s=[].slice.call(arguments);return typeof n=="string"&&(s[0]=y(n)),a.apply(l,s)};o.__rteSanitizedIn=!0,l[r]=o}})(t[e])}function J(t){return/\son[a-z]+\s*=/i.test(t)||/<\s*(script|iframe|object|embed|base)\b/i.test(t)||/srcdoc\s*=/i.test(t)||/(javascript|vbscript)\s*:/i.test(t)||/data:\s*text\/html/i.test(t)}function O(t){var e=String(t??"");return e.indexOf("-->")!==-1||e.indexOf("--!>")!==-1||e.charAt(0)===">"||e.charAt(0)==="-"&&e.charAt(1)===">"}var D=/^(script|iframe|object|embed|base|meta|link|form)$/;function T(t){if(!t.attributes)return!1;for(var e=0;e<t.attributes.length;e++){var r=t.attributes[e].name.toLowerCase();if(r.indexOf("on")===0||r==="srcdoc"||(r==="href"||r==="src"||r==="data"||r==="action"||r==="xlink:href")&&/(javascript|vbscript)\s*:|data:\s*text\/html/i.test(t.attributes[e].value||""))return!0}return!1}function X(t){if(D.test(t.localName||"")||T(t))return!0;for(var e=t.getElementsByTagName?t.getElementsByTagName("*"):[],r=0;r<e.length;r++)if(D.test(e[r].localName||"")||T(e[r]))return!0;return!1}function K(){if(p.sanitizerGuardLiveDom!==!1){var t=null;try{t=l.getEditable()}catch{return}if(!(!t||t.__rteLiveGuard)){t.__rteLiveGuard=!0;var e=new MutationObserver(function(r){for(var a=!1,o=0;o<r.length&&!a;o++){var n=r[o];if(n.type==="attributes"){var s=(n.attributeName||"").toLowerCase();(s.indexOf("on")===0||s==="srcdoc"||T(n.target))&&(a=!0);continue}for(var i=0;i<n.addedNodes.length;i++){var u=n.addedNodes[i];if(u.nodeType===8){if(O(u.data)){a=!0;break}continue}if(u.nodeType===1&&X(u)){a=!0;break}}}if(a)try{A(t,b)}catch{}});e.observe(t,{childList:!0,subtree:!0,attributes:!0}),R.push(e)}}}function Q(){var t=null;try{t=l.getEditable()}catch{return}if(!t||t.__rteSanitizePaste)return;t.__rteSanitizePaste=!0,t.addEventListener("paste",function(r){var a=r.clipboardData||window.clipboardData;if(a){var o="";try{o=a.getData("text/html")||""}catch{return}if(!(!o||!J(o))){r.preventDefault(),r.stopImmediatePropagation();var n=y(o);try{l.insertHTML(n)}catch{try{l.insertText(a.getData("text/plain")||"")}catch{}}}}},!0);function e(){var r=function(){try{A(t,b)}catch{}};setTimeout(r,0),setTimeout(r,250)}t.addEventListener("paste",e,!1),t.addEventListener("drop",e,!0)}}
@@ -918,6 +918,7 @@ RTE_DefaultConfig.text_tablecolumn = "Table Column";
918
918
  RTE_DefaultConfig.text_colorauto = "Automatic";
919
919
 
920
920
  RTE_DefaultConfig.text_colormore = "More Colors...";
921
+ RTE_DefaultConfig.text_colorrecent = "Recent colors";
921
922
  RTE_DefaultConfig.text_colorpicker = "Color Picker";
922
923
 
923
924
  RTE_DefaultConfig.text_colorwebpalette = "Web Palette";