@editora/plugins 1.0.19 → 1.0.20
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/dist/{CodePlugin.native-Bwf25lLX.js → CodePlugin.native-CKJo7IFG.js} +8 -8
- package/dist/{CodePlugin.native-Cpp4u3Jl.mjs → CodePlugin.native-D8gGxB8i.mjs} +59 -60
- package/dist/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-yjRBab4v.mjs → documentManager-BL98a7YZ.mjs} +402 -404
- package/dist/{documentManager-BDz6tovy.js → documentManager-r8t7yZEd.js} +9 -9
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +1 -1
- package/dist/{index-Bm1eqYHh.mjs → index-B-VitI3v.mjs} +23 -22
- package/dist/{index-CoflqYuK.js → index-D5xugkYA.js} +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +47 -50
- package/dist/purify.es-B6PsRpEV.js +3 -0
- package/dist/purify.es-DmCsrgBd.mjs +1480 -0
- package/dist/sanitizeHtml-CDoBlNTk.js +1 -0
- package/dist/sanitizeHtml-CtLy8um-.mjs +16 -0
- package/dist/table.cjs.js +14 -14
- package/dist/table.esm.js +158 -150
- package/dist/template.cjs.js +20 -21
- package/dist/template.esm.js +175 -723
- package/package.json +4 -3
package/dist/template.cjs.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const bn=require("./escapeHtml-D2Zh82pD.js"),En=require("./dialogHelpers-zU6zpMIA.js");const{entries:Gt,setPrototypeOf:Nt,isFrozen:An,getPrototypeOf:_n,getOwnPropertyDescriptor:yn}=Object;let{freeze:R,seal:N,create:De}=Object,{apply:et,construct:tt}=typeof Reflect<"u"&&Reflect;R||(R=function(t){return t});N||(N=function(t){return t});et||(et=function(t,o){for(var l=arguments.length,c=new Array(l>2?l-2:0),d=2;d<l;d++)c[d-2]=arguments[d];return t.apply(o,c)});tt||(tt=function(t){for(var o=arguments.length,l=new Array(o>1?o-1:0),c=1;c<o;c++)l[c-1]=arguments[c];return new t(...l)});const Re=L(Array.prototype.forEach),vn=L(Array.prototype.lastIndexOf),Mt=L(Array.prototype.pop),se=L(Array.prototype.push),Sn=L(Array.prototype.splice),Ce=L(String.prototype.toLowerCase),$e=L(String.prototype.toString),qe=L(String.prototype.match),ce=L(String.prototype.replace),xn=L(String.prototype.indexOf),Rn=L(String.prototype.trim),C=L(Object.prototype.hasOwnProperty),x=L(RegExp.prototype.test),ue=Ln(TypeError);function L(n){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var o=arguments.length,l=new Array(o>1?o-1:0),c=1;c<o;c++)l[c-1]=arguments[c];return et(n,t,l)}}function Ln(n){return function(){for(var t=arguments.length,o=new Array(t),l=0;l<t;l++)o[l]=arguments[l];return tt(n,o)}}function s(n,t){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ce;Nt&&Nt(n,null);let l=t.length;for(;l--;){let c=t[l];if(typeof c=="string"){const d=o(c);d!==c&&(An(t)||(t[l]=d),c=d)}n[c]=!0}return n}function Dn(n){for(let t=0;t<n.length;t++)C(n,t)||(n[t]=null);return n}function k(n){const t=De(null);for(const[o,l]of Gt(n))C(n,o)&&(Array.isArray(l)?t[o]=Dn(l):l&&typeof l=="object"&&l.constructor===Object?t[o]=k(l):t[o]=l);return t}function pe(n,t){for(;n!==null;){const l=yn(n,t);if(l){if(l.get)return L(l.get);if(typeof l.value=="function")return L(l.value)}n=_n(n)}function o(){return null}return o}const It=R(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Xe=R(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ke=R(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Cn=R(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Ze=R(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),wn=R(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),kt=R(["#text"]),Pt=R(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Qe=R(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Ht=R(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Le=R(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),On=N(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Nn=N(/<%[\w\W]*|[\w\W]*%>/gm),Mn=N(/\$\{[\w\W]*/gm),In=N(/^data-[\-\w.\u00B7-\uFFFF]+$/),kn=N(/^aria-[\-\w]+$/),Wt=N(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pn=N(/^(?:\w+script|data):/i),Hn=N(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),jt=N(/^html$/i),Fn=N(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ft=Object.freeze({__proto__:null,ARIA_ATTR:kn,ATTR_WHITESPACE:Hn,CUSTOM_ELEMENT:Fn,DATA_ATTR:In,DOCTYPE_NAME:jt,ERB_EXPR:Nn,IS_ALLOWED_URI:Wt,IS_SCRIPT_OR_DATA:Pn,MUSTACHE_EXPR:On,TMPLIT_EXPR:Mn});const de={element:1,text:3,progressingInstruction:7,comment:8,document:9},Un=function(){return typeof window>"u"?null:window},zn=function(t,o){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let l=null;const c="data-tt-policy-suffix";o&&o.hasAttribute(c)&&(l=o.getAttribute(c));const d="dompurify"+(l?"#"+l:"");try{return t.createPolicy(d,{createHTML(w){return w},createScriptURL(w){return w}})}catch{return console.warn("TrustedTypes policy "+d+" could not be created."),null}},Ut=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Vt(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Un();const t=i=>Vt(i);if(t.version="3.3.2",t.removed=[],!n||!n.document||n.document.nodeType!==de.document||!n.Element)return t.isSupported=!1,t;let{document:o}=n;const l=o,c=l.currentScript,{DocumentFragment:d,HTMLTemplateElement:w,Node:H,Element:p,NodeFilter:m,NamedNodeMap:W=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:j,DOMParser:Oe,trustedTypes:he}=n,re=p.prototype,Zt=pe(re,"cloneNode"),Qt=pe(re,"remove"),Jt=pe(re,"nextSibling"),en=pe(re,"childNodes"),Te=pe(re,"parentNode");if(typeof w=="function"){const i=o.createElement("template");i.content&&i.content.ownerDocument&&(o=i.content.ownerDocument)}let v,oe="";const{implementation:Ne,createNodeIterator:tn,createDocumentFragment:nn,getElementsByTagName:rn}=o,{importNode:on}=l;let S=Ut();t.isSupported=typeof Gt=="function"&&typeof Te=="function"&&Ne&&Ne.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Me,ERB_EXPR:Ie,TMPLIT_EXPR:ke,DATA_ATTR:an,ARIA_ATTR:ln,IS_SCRIPT_OR_DATA:sn,ATTR_WHITESPACE:st,CUSTOM_ELEMENT:cn}=Ft;let{IS_ALLOWED_URI:ct}=Ft,b=null;const ut=s({},[...It,...Xe,...Ke,...Ze,...kt]);let A=null;const pt=s({},[...Pt,...Qe,...Ht,...Le]);let f=Object.seal(De(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ae=null,be=null;const G=Object.seal(De(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let dt=!0,Pe=!0,mt=!1,ft=!0,$=!1,Ee=!0,V=!1,He=!1,Fe=!1,q=!1,Ae=!1,_e=!1,gt=!0,ht=!1;const un="user-content-";let Ue=!0,ie=!1,X={},M=null;const ze=s({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Tt=null;const bt=s({},["audio","video","img","source","image","track"]);let Be=null;const Et=s({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ye="http://www.w3.org/1998/Math/MathML",ve="http://www.w3.org/2000/svg",F="http://www.w3.org/1999/xhtml";let K=F,Ge=!1,We=null;const pn=s({},[ye,ve,F],$e);let Se=s({},["mi","mo","mn","ms","mtext"]),xe=s({},["annotation-xml"]);const dn=s({},["title","style","font","a","script"]);let le=null;const mn=["application/xhtml+xml","text/html"],fn="text/html";let T=null,Z=null;const gn=o.createElement("form"),At=function(e){return e instanceof RegExp||e instanceof Function},je=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Z&&Z===e)){if((!e||typeof e!="object")&&(e={}),e=k(e),le=mn.indexOf(e.PARSER_MEDIA_TYPE)===-1?fn:e.PARSER_MEDIA_TYPE,T=le==="application/xhtml+xml"?$e:Ce,b=C(e,"ALLOWED_TAGS")?s({},e.ALLOWED_TAGS,T):ut,A=C(e,"ALLOWED_ATTR")?s({},e.ALLOWED_ATTR,T):pt,We=C(e,"ALLOWED_NAMESPACES")?s({},e.ALLOWED_NAMESPACES,$e):pn,Be=C(e,"ADD_URI_SAFE_ATTR")?s(k(Et),e.ADD_URI_SAFE_ATTR,T):Et,Tt=C(e,"ADD_DATA_URI_TAGS")?s(k(bt),e.ADD_DATA_URI_TAGS,T):bt,M=C(e,"FORBID_CONTENTS")?s({},e.FORBID_CONTENTS,T):ze,ae=C(e,"FORBID_TAGS")?s({},e.FORBID_TAGS,T):k({}),be=C(e,"FORBID_ATTR")?s({},e.FORBID_ATTR,T):k({}),X=C(e,"USE_PROFILES")?e.USE_PROFILES:!1,dt=e.ALLOW_ARIA_ATTR!==!1,Pe=e.ALLOW_DATA_ATTR!==!1,mt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ft=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,$=e.SAFE_FOR_TEMPLATES||!1,Ee=e.SAFE_FOR_XML!==!1,V=e.WHOLE_DOCUMENT||!1,q=e.RETURN_DOM||!1,Ae=e.RETURN_DOM_FRAGMENT||!1,_e=e.RETURN_TRUSTED_TYPE||!1,Fe=e.FORCE_BODY||!1,gt=e.SANITIZE_DOM!==!1,ht=e.SANITIZE_NAMED_PROPS||!1,Ue=e.KEEP_CONTENT!==!1,ie=e.IN_PLACE||!1,ct=e.ALLOWED_URI_REGEXP||Wt,K=e.NAMESPACE||F,Se=e.MATHML_TEXT_INTEGRATION_POINTS||Se,xe=e.HTML_INTEGRATION_POINTS||xe,f=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&At(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(f.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&At(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(f.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(f.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),$&&(Pe=!1),Ae&&(q=!0),X&&(b=s({},kt),A=De(null),X.html===!0&&(s(b,It),s(A,Pt)),X.svg===!0&&(s(b,Xe),s(A,Qe),s(A,Le)),X.svgFilters===!0&&(s(b,Ke),s(A,Qe),s(A,Le)),X.mathMl===!0&&(s(b,Ze),s(A,Ht),s(A,Le))),C(e,"ADD_TAGS")||(G.tagCheck=null),C(e,"ADD_ATTR")||(G.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS=="function"?G.tagCheck=e.ADD_TAGS:(b===ut&&(b=k(b)),s(b,e.ADD_TAGS,T))),e.ADD_ATTR&&(typeof e.ADD_ATTR=="function"?G.attributeCheck=e.ADD_ATTR:(A===pt&&(A=k(A)),s(A,e.ADD_ATTR,T))),e.ADD_URI_SAFE_ATTR&&s(Be,e.ADD_URI_SAFE_ATTR,T),e.FORBID_CONTENTS&&(M===ze&&(M=k(M)),s(M,e.FORBID_CONTENTS,T)),e.ADD_FORBID_CONTENTS&&(M===ze&&(M=k(M)),s(M,e.ADD_FORBID_CONTENTS,T)),Ue&&(b["#text"]=!0),V&&s(b,["html","head","body"]),b.table&&(s(b,["tbody"]),delete ae.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!="function")throw ue('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ue('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=e.TRUSTED_TYPES_POLICY,oe=v.createHTML("")}else v===void 0&&(v=zn(he,c)),v!==null&&typeof oe=="string"&&(oe=v.createHTML(""));R&&R(e),Z=e}},_t=s({},[...Xe,...Ke,...Cn]),yt=s({},[...Ze,...wn]),hn=function(e){let r=Te(e);(!r||!r.tagName)&&(r={namespaceURI:K,tagName:"template"});const a=Ce(e.tagName),u=Ce(r.tagName);return We[e.namespaceURI]?e.namespaceURI===ve?r.namespaceURI===F?a==="svg":r.namespaceURI===ye?a==="svg"&&(u==="annotation-xml"||Se[u]):!!_t[a]:e.namespaceURI===ye?r.namespaceURI===F?a==="math":r.namespaceURI===ve?a==="math"&&xe[u]:!!yt[a]:e.namespaceURI===F?r.namespaceURI===ve&&!xe[u]||r.namespaceURI===ye&&!Se[u]?!1:!yt[a]&&(dn[a]||!_t[a]):!!(le==="application/xhtml+xml"&&We[e.namespaceURI]):!1},I=function(e){se(t.removed,{element:e});try{Te(e).removeChild(e)}catch{Qt(e)}},Y=function(e,r){try{se(t.removed,{attribute:r.getAttributeNode(e),from:r})}catch{se(t.removed,{attribute:null,from:r})}if(r.removeAttribute(e),e==="is")if(q||Ae)try{I(r)}catch{}else try{r.setAttribute(e,"")}catch{}},vt=function(e){let r=null,a=null;if(Fe)e="<remove></remove>"+e;else{const g=qe(e,/^[\r\n\t ]+/);a=g&&g[0]}le==="application/xhtml+xml"&&K===F&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const u=v?v.createHTML(e):e;if(K===F)try{r=new Oe().parseFromString(u,le)}catch{}if(!r||!r.documentElement){r=Ne.createDocument(K,"template",null);try{r.documentElement.innerHTML=Ge?oe:u}catch{}}const y=r.body||r.documentElement;return e&&a&&y.insertBefore(o.createTextNode(a),y.childNodes[0]||null),K===F?rn.call(r,V?"html":"body")[0]:V?r.documentElement:y},St=function(e){return tn.call(e.ownerDocument||e,e,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT|m.SHOW_PROCESSING_INSTRUCTION|m.SHOW_CDATA_SECTION,null)},Ve=function(e){return e instanceof j&&(typeof e.nodeName!="string"||typeof e.textContent!="string"||typeof e.removeChild!="function"||!(e.attributes instanceof W)||typeof e.removeAttribute!="function"||typeof e.setAttribute!="function"||typeof e.namespaceURI!="string"||typeof e.insertBefore!="function"||typeof e.hasChildNodes!="function")},xt=function(e){return typeof H=="function"&&e instanceof H};function U(i,e,r){Re(i,a=>{a.call(t,e,r,Z)})}const Rt=function(e){let r=null;if(U(S.beforeSanitizeElements,e,null),Ve(e))return I(e),!0;const a=T(e.nodeName);if(U(S.uponSanitizeElement,e,{tagName:a,allowedTags:b}),Ee&&e.hasChildNodes()&&!xt(e.firstElementChild)&&x(/<[/\w!]/g,e.innerHTML)&&x(/<[/\w!]/g,e.textContent)||e.nodeType===de.progressingInstruction||Ee&&e.nodeType===de.comment&&x(/<[/\w]/g,e.data))return I(e),!0;if(!(G.tagCheck instanceof Function&&G.tagCheck(a))&&(!b[a]||ae[a])){if(!ae[a]&&Dt(a)&&(f.tagNameCheck instanceof RegExp&&x(f.tagNameCheck,a)||f.tagNameCheck instanceof Function&&f.tagNameCheck(a)))return!1;if(Ue&&!M[a]){const u=Te(e)||e.parentNode,y=en(e)||e.childNodes;if(y&&u){const g=y.length;for(let D=g-1;D>=0;--D){const z=Zt(y[D],!0);z.__removalCount=(e.__removalCount||0)+1,u.insertBefore(z,Jt(e))}}}return I(e),!0}return e instanceof p&&!hn(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&x(/<\/no(script|embed|frames)/i,e.innerHTML)?(I(e),!0):($&&e.nodeType===de.text&&(r=e.textContent,Re([Me,Ie,ke],u=>{r=ce(r,u," ")}),e.textContent!==r&&(se(t.removed,{element:e.cloneNode()}),e.textContent=r)),U(S.afterSanitizeElements,e,null),!1)},Lt=function(e,r,a){if(be[r]||gt&&(r==="id"||r==="name")&&(a in o||a in gn))return!1;if(!(Pe&&!be[r]&&x(an,r))){if(!(dt&&x(ln,r))){if(!(G.attributeCheck instanceof Function&&G.attributeCheck(r,e))){if(!A[r]||be[r]){if(!(Dt(e)&&(f.tagNameCheck instanceof RegExp&&x(f.tagNameCheck,e)||f.tagNameCheck instanceof Function&&f.tagNameCheck(e))&&(f.attributeNameCheck instanceof RegExp&&x(f.attributeNameCheck,r)||f.attributeNameCheck instanceof Function&&f.attributeNameCheck(r,e))||r==="is"&&f.allowCustomizedBuiltInElements&&(f.tagNameCheck instanceof RegExp&&x(f.tagNameCheck,a)||f.tagNameCheck instanceof Function&&f.tagNameCheck(a))))return!1}else if(!Be[r]){if(!x(ct,ce(a,st,""))){if(!((r==="src"||r==="xlink:href"||r==="href")&&e!=="script"&&xn(a,"data:")===0&&Tt[e])){if(!(mt&&!x(sn,ce(a,st,"")))){if(a)return!1}}}}}}}return!0},Dt=function(e){return e!=="annotation-xml"&&qe(e,cn)},Ct=function(e){U(S.beforeSanitizeAttributes,e,null);const{attributes:r}=e;if(!r||Ve(e))return;const a={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:A,forceKeepAttr:void 0};let u=r.length;for(;u--;){const y=r[u],{name:g,namespaceURI:D,value:z}=y,Q=T(g),Ye=z;let _=g==="value"?Ye:Rn(Ye);if(a.attrName=Q,a.attrValue=_,a.keepAttr=!0,a.forceKeepAttr=void 0,U(S.uponSanitizeAttribute,e,a),_=a.attrValue,ht&&(Q==="id"||Q==="name")&&(Y(g,e),_=un+_),Ee&&x(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,_)){Y(g,e);continue}if(Q==="attributename"&&qe(_,"href")){Y(g,e);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr){Y(g,e);continue}if(!ft&&x(/\/>/i,_)){Y(g,e);continue}$&&Re([Me,Ie,ke],Ot=>{_=ce(_,Ot," ")});const wt=T(e.nodeName);if(!Lt(wt,Q,_)){Y(g,e);continue}if(v&&typeof he=="object"&&typeof he.getAttributeType=="function"&&!D)switch(he.getAttributeType(wt,Q)){case"TrustedHTML":{_=v.createHTML(_);break}case"TrustedScriptURL":{_=v.createScriptURL(_);break}}if(_!==Ye)try{D?e.setAttributeNS(D,g,_):e.setAttribute(g,_),Ve(e)?I(e):Mt(t.removed)}catch{Y(g,e)}}U(S.afterSanitizeAttributes,e,null)},Tn=function i(e){let r=null;const a=St(e);for(U(S.beforeSanitizeShadowDOM,e,null);r=a.nextNode();)U(S.uponSanitizeShadowNode,r,null),Rt(r),Ct(r),r.content instanceof d&&i(r.content);U(S.afterSanitizeShadowDOM,e,null)};return t.sanitize=function(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=null,a=null,u=null,y=null;if(Ge=!i,Ge&&(i="<!-->"),typeof i!="string"&&!xt(i))if(typeof i.toString=="function"){if(i=i.toString(),typeof i!="string")throw ue("dirty is not a string, aborting")}else throw ue("toString is not a function");if(!t.isSupported)return i;if(He||je(e),t.removed=[],typeof i=="string"&&(ie=!1),ie){if(i.nodeName){const z=T(i.nodeName);if(!b[z]||ae[z])throw ue("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof H)r=vt("<!---->"),a=r.ownerDocument.importNode(i,!0),a.nodeType===de.element&&a.nodeName==="BODY"||a.nodeName==="HTML"?r=a:r.appendChild(a);else{if(!q&&!$&&!V&&i.indexOf("<")===-1)return v&&_e?v.createHTML(i):i;if(r=vt(i),!r)return q?null:_e?oe:""}r&&Fe&&I(r.firstChild);const g=St(ie?i:r);for(;u=g.nextNode();)Rt(u),Ct(u),u.content instanceof d&&Tn(u.content);if(ie)return i;if(q){if(Ae)for(y=nn.call(r.ownerDocument);r.firstChild;)y.appendChild(r.firstChild);else y=r;return(A.shadowroot||A.shadowrootmode)&&(y=on.call(l,y,!0)),y}let D=V?r.outerHTML:r.innerHTML;return V&&b["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&x(jt,r.ownerDocument.doctype.name)&&(D="<!DOCTYPE "+r.ownerDocument.doctype.name+`>
|
|
2
|
-
`+D),$&&Re([Me,Ie,ke],z=>{D=ce(D,z," ")}),v&&_e?v.createHTML(D):D},t.setConfig=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};je(i),He=!0},t.clearConfig=function(){Z=null,He=!1},t.isValidAttribute=function(i,e,r){Z||je({});const a=T(i),u=T(e);return Lt(a,u,r)},t.addHook=function(i,e){typeof e=="function"&&se(S[i],e)},t.removeHook=function(i,e){if(e!==void 0){const r=vn(S[i],e);return r===-1?void 0:Sn(S[i],r,1)[0]}return Mt(S[i])},t.removeHooks=function(i){S[i]=[]},t.removeAllHooks=function(){S=Ut()},t}var Bn=Vt();let h=null,O=null,J=null,E=null,ee="",te="",me="insert",fe=null,P=null,we=null;function Yt(n,t){if(t===n.innerHTML)return;const o=window.execEditorCommand||window.executeEditorCommand;if(typeof o=="function")try{o("recordDomTransaction",n,t,n.innerHTML)}catch{}}function Gn(n){if(!n)return null;let t=n.startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE){const o=t;if(o.getAttribute("contenteditable")==="true")return o}t=t.parentNode}return null}const $t=[{id:"formal-letter",name:"Formal Letter",category:"Letters",description:"Professional business letter template",html:`<p><strong>{{ Company Name }}</strong></p>
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $=require("./escapeHtml-D2Zh82pD.js"),j=require("./dialogHelpers-zU6zpMIA.js"),z=require("./purify.es-B6PsRpEV.js");let n=null,s=null,u=null,a=null,m="",g="",y="insert",T=null,d=null,w=null;function B(t,e){if(e===t.innerHTML)return;const r=window.execEditorCommand||window.executeEditorCommand;if(typeof r=="function")try{r("recordDomTransaction",t,e,t.innerHTML)}catch{}}function F(t){if(!t)return null;let e=t.startContainer;for(;e&&e!==document.body;){if(e.nodeType===Node.ELEMENT_NODE){const r=e;if(r.getAttribute("contenteditable")==="true")return r}e=e.parentNode}return null}const _=[{id:"formal-letter",name:"Formal Letter",category:"Letters",description:"Professional business letter template",html:`<p><strong>{{ Company Name }}</strong></p>
|
|
3
2
|
<p>{{ Today }}</p>
|
|
4
3
|
<p>Dear {{ first_name }} {{ last_name }},</p>
|
|
5
4
|
<p>I hope this letter finds you well. [Your letter content here]</p>
|
|
@@ -41,7 +40,7 @@
|
|
|
41
40
|
<h3>Q: How do I get started?</h3>
|
|
42
41
|
<p>A: [Answer here]</p>
|
|
43
42
|
<h3>Q: What are the requirements?</h3>
|
|
44
|
-
<p>A: [Answer here]</p>`}],
|
|
43
|
+
<p>A: [Answer here]</p>`}],b=[..._],L=()=>b,O=t=>b.filter(e=>e.category===t),C=()=>{const t=new Set(b.map(e=>e.category));return Array.from(t)},I=t=>{const e=t.toLowerCase();return b.filter(r=>r.name.toLowerCase().includes(e)||r.description?.toLowerCase().includes(e)||r.tags?.some(i=>i.toLowerCase().includes(e)))},A=t=>z.purify_default.sanitize(t,{ALLOWED_TAGS:["p","br","strong","em","u","h1","h2","h3","h4","ul","ol","li","blockquote","table","thead","tbody","tr","th","td","a","span"],ALLOWED_ATTR:["href","target","class","data-key","data-category"]}),Q=t=>b.some(e=>e.id===t.id)?(console.warn(`Template with ID ${t.id} already exists`),!1):(b.push(t),!0),W=t=>!!(t.id&&t.name&&t.category&&t.html&&t.html.trim().length>0);function Z(t){s&&c(),s=document.createElement("div"),j.initDialogOverlay(s),s.className="rte-dialog-overlay",Y(t)&&s.classList.add("rte-ui-theme-dark"),s.addEventListener("click",()=>c()),n=document.createElement("div"),n.className="rte-dialog rte-template-dialog",n.addEventListener("click",r=>r.stopPropagation());const e=C();e.length>0&&!m&&(m=e[0]),E(),s.appendChild(n),document.body.appendChild(s),G(),ne()}function G(){P(),T=t=>{t.key==="Escape"&&(!s||!n||(t.preventDefault(),t.stopPropagation(),c()))},document.addEventListener("keydown",T,!0)}function P(){T&&(document.removeEventListener("keydown",T,!0),T=null)}const K='[data-theme="dark"], .dark, .editora-theme-dark',S=()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return null;const e=t.anchorNode;return(e instanceof HTMLElement?e:e?.parentElement)?.closest(".rte-content, .editora-content")||null},Y=t=>{const e=t||S();return e?!!e.closest(K):!1};function H(){const t=F(u);if(t)return t;if(w?.isConnected)return w;const e=S();return e||document.querySelector(".rte-content, .editora-content")}function E(){if(!n)return;const t=C(),e=R();n.innerHTML=`
|
|
45
44
|
<div class="rte-dialog-header">
|
|
46
45
|
<h2>Insert Template</h2>
|
|
47
46
|
<button class="rte-dialog-close" aria-label="Close">✕</button>
|
|
@@ -52,49 +51,49 @@
|
|
|
52
51
|
<input
|
|
53
52
|
type="text"
|
|
54
53
|
placeholder="Search templates..."
|
|
55
|
-
value="${
|
|
54
|
+
value="${$.escapeHtml(g)}"
|
|
56
55
|
class="rte-input rte-template-search"
|
|
57
56
|
aria-label="Search templates"
|
|
58
57
|
/>
|
|
59
58
|
|
|
60
59
|
<!-- Category Tabs -->
|
|
61
60
|
<div class="rte-tabs">
|
|
62
|
-
${
|
|
63
|
-
<button class="rte-tab ${
|
|
64
|
-
${
|
|
61
|
+
${t.map(r=>`
|
|
62
|
+
<button class="rte-tab ${m===r?"active":""}" data-category="${r}">
|
|
63
|
+
${r}
|
|
65
64
|
</button>
|
|
66
65
|
`).join("")}
|
|
67
66
|
</div>
|
|
68
67
|
|
|
69
68
|
<!-- Template List -->
|
|
70
69
|
<div class="rte-template-list">
|
|
71
|
-
${
|
|
70
|
+
${e.length>0?e.map(r=>`
|
|
72
71
|
<div
|
|
73
|
-
class="rte-template-item ${
|
|
74
|
-
data-template-id="${
|
|
72
|
+
class="rte-template-item ${a?.id===r.id?"selected":""}"
|
|
73
|
+
data-template-id="${r.id}"
|
|
75
74
|
>
|
|
76
|
-
<div class="template-name">${
|
|
77
|
-
${
|
|
75
|
+
<div class="template-name">${r.name}</div>
|
|
76
|
+
${r.description?`<div class="template-description">${r.description}</div>`:""}
|
|
78
77
|
</div>
|
|
79
78
|
`).join(""):'<div class="rte-empty-state">No templates found</div>'}
|
|
80
79
|
</div>
|
|
81
80
|
|
|
82
81
|
<!-- Preview -->
|
|
83
|
-
${
|
|
82
|
+
${a?`
|
|
84
83
|
<div class="rte-template-preview">
|
|
85
84
|
<strong>Preview:</strong>
|
|
86
|
-
<div class="template-preview-content">${
|
|
85
|
+
<div class="template-preview-content">${a.html}</div>
|
|
87
86
|
</div>
|
|
88
87
|
`:""}
|
|
89
88
|
|
|
90
89
|
<!-- Insert Mode Toggle -->
|
|
91
90
|
<div class="rte-insert-mode">
|
|
92
91
|
<label>
|
|
93
|
-
<input type="radio" name="insertMode" value="insert" ${
|
|
92
|
+
<input type="radio" name="insertMode" value="insert" ${y==="insert"?"checked":""} />
|
|
94
93
|
Insert at cursor
|
|
95
94
|
</label>
|
|
96
95
|
<label>
|
|
97
|
-
<input type="radio" name="insertMode" value="replace" ${
|
|
96
|
+
<input type="radio" name="insertMode" value="replace" ${y==="replace"?"checked":""} />
|
|
98
97
|
Replace document
|
|
99
98
|
</label>
|
|
100
99
|
</div>
|
|
@@ -102,11 +101,11 @@
|
|
|
102
101
|
|
|
103
102
|
<div class="rte-dialog-footer">
|
|
104
103
|
<button class="rte-button-secondary rte-cancel-btn">Cancel</button>
|
|
105
|
-
<button class="rte-button-primary rte-insert-btn" ${
|
|
106
|
-
${
|
|
104
|
+
<button class="rte-button-primary rte-insert-btn" ${a?"":"disabled"}>
|
|
105
|
+
${y==="insert"?"Insert":"Replace"}
|
|
107
106
|
</button>
|
|
108
107
|
</div>
|
|
109
|
-
`,
|
|
108
|
+
`,J()}function U(){if(!n)return;n.innerHTML=`
|
|
110
109
|
<div class="rte-dialog-header">
|
|
111
110
|
<h2>Replace Document?</h2>
|
|
112
111
|
</div>
|
|
@@ -117,7 +116,7 @@
|
|
|
117
116
|
<button class="rte-button-secondary rte-cancel-warning-btn">Cancel</button>
|
|
118
117
|
<button class="rte-button-primary rte-confirm-replace-btn">Replace</button>
|
|
119
118
|
</div>
|
|
120
|
-
`;const n
|
|
119
|
+
`;const t=n.querySelector(".rte-cancel-warning-btn"),e=n.querySelector(".rte-confirm-replace-btn");t?.addEventListener("click",()=>E()),e?.addEventListener("click",()=>X())}function R(){const t=L();return g.trim()?I(g):m?t.filter(e=>e.category===m):t}function J(){if(!n)return;n.querySelector(".rte-dialog-close")?.addEventListener("click",()=>c()),n.querySelector(".rte-cancel-btn")?.addEventListener("click",()=>c()),n.querySelector(".rte-insert-btn")?.addEventListener("click",()=>k());const i=n.querySelector(".rte-template-search");i?.addEventListener("input",o=>{d!==null&&cancelAnimationFrame(d),g=o.target.value,d=requestAnimationFrame(()=>{d=null,M()})}),i?.addEventListener("keydown",o=>{o.key==="Enter"&&a?k():o.key==="Escape"&&c()}),n.querySelector(".rte-tabs")?.addEventListener("click",o=>{const v=o.target.closest(".rte-tab");if(!v)return;const x=v.getAttribute("data-category");x&&(m=x,g="",d!==null&&(cancelAnimationFrame(d),d=null),M())});const p=n.querySelector(".rte-template-list"),f=o=>{const v=o.target.closest(".rte-template-item");if(!v)return null;const x=v.getAttribute("data-template-id");return x&&L().find(V=>V.id===x)||null};p?.addEventListener("click",o=>{const l=f(o);l&&(a=l,E())}),p?.addEventListener("dblclick",o=>{const l=f(o);l&&(a=l,k())}),n.querySelector(".rte-insert-mode")?.addEventListener("change",o=>{const l=o.target;!l||l.name!=="insertMode"||(y=l.value,E())})}function M(){const t=R();t.length>0?(!a||!t.find(e=>e.id===a.id))&&(a=t[0]):a=null,E()}function k(){if(a)if(y==="replace"){if(H()?.innerHTML?.trim()){U();return}q(a),c()}else te(a),c()}function X(){a&&(q(a),c())}const ee=new Set(["DIV","P","BLOCKQUOTE","PRE","H1","H2","H3","H4","H5","H6","LI","TD","TH"]);function N(t,e){let r=t;for(;r&&r!==e;){if(r.nodeType===Node.ELEMENT_NODE&&ee.has(r.tagName))return r;r=r.parentNode}return null}function te(t){const e=window.getSelection();if(!e)return;const r=H();if(!r)return;if(u)e.removeAllRanges(),e.addRange(u);else{const l=document.createRange();l.selectNodeContents(r),l.collapse(!1),e.removeAllRanges(),e.addRange(l)}if(e.rangeCount===0)return;const i=e.getRangeAt(0),D=r?.innerHTML??"",p=document.createRange().createContextualFragment(A(t.html));i.deleteContents();const f=p.lastChild,h=N(i.endContainer,r)||N(i.startContainer,r);h&&h.parentNode?h.parentNode.insertBefore(p,h.nextSibling):i.insertNode(p);const o=document.createRange();f?o.setStartAfter(f):o.setStartAfter(i.endContainer),o.collapse(!0),e.removeAllRanges(),e.addRange(o),r&&(B(r,D),r.dispatchEvent(new Event("input",{bubbles:!0})))}function q(t){const e=H();if(e){const r=e.innerHTML;e.innerHTML=A(t.html),B(e,r),e.dispatchEvent(new Event("input",{bubbles:!0}))}}function c(){P(),d!==null&&(cancelAnimationFrame(d),d=null),s&&(s.remove(),s=null),n=null,u=null,g="",w=null}function re(t){const e=window.getSelection();e&&e.rangeCount>0?u=e.getRangeAt(0).cloneRange():u=null;const r=R();r.length>0&&!a&&(a=r[0]);const i=t?.contentElement instanceof HTMLElement?t.contentElement:S();w=i||null,Z(i)}function ne(){if(typeof document>"u")return;const t="template-plugin-dialog-styles";if(document.getElementById(t))return;const e=document.createElement("style");e.id=t,e.textContent=`
|
|
121
120
|
.rte-dialog-overlay {
|
|
122
121
|
--rte-tmpl-overlay-bg: rgba(15, 23, 36, 0.56);
|
|
123
122
|
--rte-tmpl-dialog-bg: #fff;
|
|
@@ -354,4 +353,4 @@
|
|
|
354
353
|
.rte-button-secondary:hover {
|
|
355
354
|
background-color: var(--rte-tmpl-subtle-hover);
|
|
356
355
|
}
|
|
357
|
-
`,document.head.appendChild(
|
|
356
|
+
`,document.head.appendChild(e)}const oe=()=>({name:"template",toolbar:[{label:"Template",command:"insertTemplate",icon:'<svg width="24px" height="24px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 3V9H21V3H3ZM19 5H5V7H19V5Z" fill="#000000"></path> <path fill-rule="evenodd" clip-rule="evenodd" d="M3 11V21H11V11H3ZM9 13H5V19H9V13Z" fill="#000000"></path> <path d="M21 11H13V13H21V11Z" fill="#000000"></path> <path d="M13 15H21V17H13V15Z" fill="#000000"></path> <path d="M21 19H13V21H21V19Z" fill="#000000"></path> </g></svg>'}],commands:{insertTemplate:(t,e)=>(re(e),!0)},keymap:{}});exports.PREDEFINED_TEMPLATES=_;exports.TemplatePlugin=oe;exports.addCustomTemplate=Q;exports.getAllTemplates=L;exports.getTemplateCategories=C;exports.getTemplatesByCategory=O;exports.sanitizeTemplate=A;exports.searchTemplates=I;exports.validateTemplate=W;
|