@editora/plugins 1.0.10 → 1.0.11
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/_commonjsHelpers-BH3jXuIh.js +1 -0
- package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +80 -98
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +115 -128
- package/dist/anchoredPopover-BzqGPOAE.js +1 -0
- package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
- package/dist/approval-workflow.cjs.js +40 -40
- package/dist/approval-workflow.esm.js +208 -249
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +55 -68
- package/dist/blockquote.esm.js +1 -2
- package/dist/blocks-library.cjs.js +45 -45
- package/dist/blocks-library.esm.js +178 -245
- package/dist/capitalization.esm.js +1 -2
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +58 -82
- package/dist/citations.cjs.js +37 -37
- package/dist/citations.esm.js +439 -512
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +27 -33
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +82 -93
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +501 -506
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +116 -158
- package/dist/conditional-content.cjs.js +90 -90
- package/dist/conditional-content.esm.js +371 -432
- package/dist/content-rules.cjs.js +7 -7
- package/dist/content-rules.esm.js +105 -159
- package/dist/data-binding.cjs.js +46 -46
- package/dist/data-binding.esm.js +328 -368
- package/dist/direction.esm.js +9 -18
- package/dist/doc-schema.cjs.js +29 -29
- package/dist/doc-schema.esm.js +240 -308
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +4 -5
- package/dist/documentManager-CTqRftU8.mjs +8369 -0
- package/dist/documentManager-Jf0RbSks.js +17 -0
- package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +1 -2
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +73 -81
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +65 -77
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +54 -56
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +39 -47
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +37 -53
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +76 -117
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +70 -92
- package/dist/html2canvas.esm-B5qzocYs.js +5 -0
- package/dist/{html2canvas.esm-1a1724a1.mjs → html2canvas.esm-BWVIUcAF.mjs} +141 -225
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +12 -24
- package/dist/{index-f04538f2.mjs → index-BFsKNTTj.mjs} +70 -71
- package/dist/index-CvJk4DKa.js +221 -0
- package/dist/index-D3CycEFU.mjs +16543 -0
- package/dist/index-tqLTHcO6.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-CE_A4QSm.js +5 -0
- package/dist/index.es-DQ78mYYo.mjs +6665 -0
- package/dist/index.esm.js +125 -128
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +8 -9
- package/dist/jspdf.es.min-BoS80556.js +77 -0
- package/dist/{jspdf.es.min-c36a4fd8.mjs → jspdf.es.min-DQCoX5yh.mjs} +3658 -4682
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +11 -24
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +24 -30
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +20 -25
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +59 -61
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +139 -146
- package/dist/media-manager.cjs.js +31 -31
- package/dist/media-manager.esm.js +285 -300
- package/dist/mentions.cjs.js +9 -9
- package/dist/mentions.esm.js +238 -286
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +177 -216
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +33 -49
- package/dist/pii-redaction.cjs.js +19 -19
- package/dist/pii-redaction.esm.js +393 -463
- package/dist/plugins.css +1 -0
- package/dist/preview.esm.js +5 -10
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +17 -20
- package/dist/{purify.es-35a15df8.mjs → purify.es-DHhaBdbu.mjs} +9 -19
- package/dist/{purify.es-a8d731c6.js → purify.es-T2a3nLiC.js} +1 -1
- package/dist/slash-commands.cjs.js +2 -2
- package/dist/slash-commands.esm.js +39 -75
- package/dist/smart-paste.cjs.js +27 -27
- package/dist/smart-paste.esm.js +280 -336
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +61 -69
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +97 -123
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +14 -19
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +191 -225
- package/dist/template.cjs.js +21 -20
- package/dist/template.esm.js +715 -196
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +21 -27
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +70 -87
- package/dist/track-changes.cjs.js +2 -2
- package/dist/track-changes.esm.js +100 -162
- package/dist/translation-workflow.cjs.js +74 -74
- package/dist/translation-workflow.esm.js +602 -678
- package/dist/version-diff.cjs.js +14 -14
- package/dist/version-diff.esm.js +128 -157
- package/package.json +1 -1
- package/dist/_commonjsHelpers-6763f629.js +0 -1
- package/dist/_commonjsHelpers-c5d32002.mjs +0 -30
- package/dist/anchoredPopover-33f1358d.mjs +0 -109
- package/dist/anchoredPopover-8151d535.js +0 -1
- package/dist/documentManager-25b6203c.mjs +0 -9122
- package/dist/documentManager-b69e7054.js +0 -17
- package/dist/html2canvas.esm-09133e29.js +0 -22
- package/dist/index-656d224b.js +0 -231
- package/dist/index-6a8c48bb.js +0 -1
- package/dist/index-d027b7e2.mjs +0 -16859
- package/dist/index.es-730f2d98.mjs +0 -5775
- package/dist/index.es-dd40173b.js +0 -18
- package/dist/jspdf.es.min-90db2c97.js +0 -243
- package/dist/style.css +0 -1
- /package/dist/{editorContainerHelpers-36b8ddf3.js → editorContainerHelpers-CFbfiOJI.js} +0 -0
package/dist/template.cjs.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const V=require("./purify.es-a8d731c6.js");let n=null,c=null,f=null,o=null,h="",v="",w="insert",E=null,d=null,b=null;function P(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 z(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>
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const{entries:Bt,setPrototypeOf:Mt,isFrozen:Tn,getPrototypeOf:bn,getOwnPropertyDescriptor:En}=Object;let{freeze:R,seal:O,create:De}=Object,{apply:et,construct:tt}=typeof Reflect<"u"&&Reflect;R||(R=function(t){return t});O||(O=function(t){return t});et||(et=function(t,o){for(var l=arguments.length,c=new Array(l>2?l-2:0),f=2;f<l;f++)c[f-2]=arguments[f];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),An=L(Array.prototype.lastIndexOf),Nt=L(Array.prototype.pop),se=L(Array.prototype.push),_n=L(Array.prototype.splice),we=L(String.prototype.toLowerCase),$e=L(String.prototype.toString),qe=L(String.prototype.match),ce=L(String.prototype.replace),yn=L(String.prototype.indexOf),vn=L(String.prototype.trim),C=L(Object.prototype.hasOwnProperty),x=L(RegExp.prototype.test),ue=Sn(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 Sn(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]:we;Mt&&Mt(n,null);let l=t.length;for(;l--;){let c=t[l];if(typeof c=="string"){const f=o(c);f!==c&&(Tn(t)||(t[l]=f),c=f)}n[c]=!0}return n}function xn(n){for(let t=0;t<n.length;t++)C(n,t)||(n[t]=null);return n}function I(n){const t=De(null);for(const[o,l]of Bt(n))C(n,o)&&(Array.isArray(l)?t[o]=xn(l):l&&typeof l=="object"&&l.constructor===Object?t[o]=I(l):t[o]=l);return t}function pe(n,t){for(;n!==null;){const l=En(n,t);if(l){if(l.get)return L(l.get);if(typeof l.value=="function")return L(l.value)}n=bn(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"]),Ze=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"]),Rn=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"]),Ke=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"]),Ln=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"]),Ft=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"]),Dn=O(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wn=O(/<%[\w\W]*|[\w\W]*%>/gm),Cn=O(/\$\{[\w\W]*/gm),On=O(/^data-[\-\w.\u00B7-\uFFFF]+$/),Mn=O(/^aria-[\-\w]+$/),Gt=O(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Nn=O(/^(?:\w+script|data):/i),In=O(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Wt=O(/^html$/i),kn=O(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ht=Object.freeze({__proto__:null,ARIA_ATTR:Mn,ATTR_WHITESPACE:In,CUSTOM_ELEMENT:kn,DATA_ATTR:On,DOCTYPE_NAME:Wt,ERB_EXPR:wn,IS_ALLOWED_URI:Gt,IS_SCRIPT_OR_DATA:Nn,MUSTACHE_EXPR:Dn,TMPLIT_EXPR:Cn});const de={element:1,text:3,progressingInstruction:7,comment:8,document:9},Pn=function(){return typeof window>"u"?null:window},Fn=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 f="dompurify"+(l?"#"+l:"");try{return t.createPolicy(f,{createHTML(w){return w},createScriptURL(w){return w}})}catch{return console.warn("TrustedTypes policy "+f+" could not be created."),null}},Ut=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function jt(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Pn();const t=i=>jt(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:f,HTMLTemplateElement:w,Node:z,Element:b,NodeFilter:E,NamedNodeMap:W=n.NamedNodeMap||n.MozNamedAttrMap,HTMLFormElement:j,DOMParser:Oe,trustedTypes:he}=n,re=b.prototype,Zt=pe(re,"cloneNode"),Kt=pe(re,"remove"),Qt=pe(re,"nextSibling"),Jt=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:Me,createNodeIterator:en,createDocumentFragment:tn,getElementsByTagName:nn}=o,{importNode:rn}=l;let S=Ut();t.isSupported=typeof Bt=="function"&&typeof Te=="function"&&Me&&Me.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Ne,ERB_EXPR:Ie,TMPLIT_EXPR:ke,DATA_ATTR:on,ARIA_ATTR:an,IS_SCRIPT_OR_DATA:ln,ATTR_WHITESPACE:st,CUSTOM_ELEMENT:sn}=Ht;let{IS_ALLOWED_URI:ct}=Ht,h=null;const ut=s({},[...It,...Xe,...Ze,...Ke,...kt]);let A=null;const pt=s({},[...Pt,...Qe,...Ft,...Le]);let p=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 B=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,Fe=!1,He=!1,q=!1,Ae=!1,_e=!1,gt=!0,ht=!1;const cn="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 Z=F,Ge=!1,We=null;const un=s({},[ye,ve,F],$e);let Se=s({},["mi","mo","mn","ms","mtext"]),xe=s({},["annotation-xml"]);const pn=s({},["title","style","font","a","script"]);let le=null;const dn=["application/xhtml+xml","text/html"],mn="text/html";let g=null,K=null;const fn=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(!(K&&K===e)){if((!e||typeof e!="object")&&(e={}),e=I(e),le=dn.indexOf(e.PARSER_MEDIA_TYPE)===-1?mn:e.PARSER_MEDIA_TYPE,g=le==="application/xhtml+xml"?$e:we,h=C(e,"ALLOWED_TAGS")?s({},e.ALLOWED_TAGS,g):ut,A=C(e,"ALLOWED_ATTR")?s({},e.ALLOWED_ATTR,g):pt,We=C(e,"ALLOWED_NAMESPACES")?s({},e.ALLOWED_NAMESPACES,$e):un,Be=C(e,"ADD_URI_SAFE_ATTR")?s(I(Et),e.ADD_URI_SAFE_ATTR,g):Et,Tt=C(e,"ADD_DATA_URI_TAGS")?s(I(bt),e.ADD_DATA_URI_TAGS,g):bt,M=C(e,"FORBID_CONTENTS")?s({},e.FORBID_CONTENTS,g):ze,ae=C(e,"FORBID_TAGS")?s({},e.FORBID_TAGS,g):I({}),be=C(e,"FORBID_ATTR")?s({},e.FORBID_ATTR,g):I({}),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,He=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||Gt,Z=e.NAMESPACE||F,Se=e.MATHML_TEXT_INTEGRATION_POINTS||Se,xe=e.HTML_INTEGRATION_POINTS||xe,p=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&At(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(p.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&At(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(p.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(p.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),$&&(Pe=!1),Ae&&(q=!0),X&&(h=s({},kt),A=De(null),X.html===!0&&(s(h,It),s(A,Pt)),X.svg===!0&&(s(h,Xe),s(A,Qe),s(A,Le)),X.svgFilters===!0&&(s(h,Ze),s(A,Qe),s(A,Le)),X.mathMl===!0&&(s(h,Ke),s(A,Ft),s(A,Le))),C(e,"ADD_TAGS")||(B.tagCheck=null),C(e,"ADD_ATTR")||(B.attributeCheck=null),e.ADD_TAGS&&(typeof e.ADD_TAGS=="function"?B.tagCheck=e.ADD_TAGS:(h===ut&&(h=I(h)),s(h,e.ADD_TAGS,g))),e.ADD_ATTR&&(typeof e.ADD_ATTR=="function"?B.attributeCheck=e.ADD_ATTR:(A===pt&&(A=I(A)),s(A,e.ADD_ATTR,g))),e.ADD_URI_SAFE_ATTR&&s(Be,e.ADD_URI_SAFE_ATTR,g),e.FORBID_CONTENTS&&(M===ze&&(M=I(M)),s(M,e.FORBID_CONTENTS,g)),e.ADD_FORBID_CONTENTS&&(M===ze&&(M=I(M)),s(M,e.ADD_FORBID_CONTENTS,g)),Ue&&(h["#text"]=!0),V&&s(h,["html","head","body"]),h.table&&(s(h,["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=Fn(he,c)),v!==null&&typeof oe=="string"&&(oe=v.createHTML(""));R&&R(e),K=e}},_t=s({},[...Xe,...Ze,...Rn]),yt=s({},[...Ke,...Ln]),gn=function(e){let r=Te(e);(!r||!r.tagName)&&(r={namespaceURI:Z,tagName:"template"});const a=we(e.tagName),u=we(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]&&(pn[a]||!_t[a]):!!(le==="application/xhtml+xml"&&We[e.namespaceURI]):!1},N=function(e){se(t.removed,{element:e});try{Te(e).removeChild(e)}catch{Kt(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{N(r)}catch{}else try{r.setAttribute(e,"")}catch{}},vt=function(e){let r=null,a=null;if(He)e="<remove></remove>"+e;else{const d=qe(e,/^[\r\n\t ]+/);a=d&&d[0]}le==="application/xhtml+xml"&&Z===F&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const u=v?v.createHTML(e):e;if(Z===F)try{r=new Oe().parseFromString(u,le)}catch{}if(!r||!r.documentElement){r=Me.createDocument(Z,"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),Z===F?nn.call(r,V?"html":"body")[0]:V?r.documentElement:y},St=function(e){return en.call(e.ownerDocument||e,e,E.SHOW_ELEMENT|E.SHOW_COMMENT|E.SHOW_TEXT|E.SHOW_PROCESSING_INSTRUCTION|E.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 z=="function"&&e instanceof z};function H(i,e,r){Re(i,a=>{a.call(t,e,r,K)})}const Rt=function(e){let r=null;if(H(S.beforeSanitizeElements,e,null),Ve(e))return N(e),!0;const a=g(e.nodeName);if(H(S.uponSanitizeElement,e,{tagName:a,allowedTags:h}),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 N(e),!0;if(!(B.tagCheck instanceof Function&&B.tagCheck(a))&&(!h[a]||ae[a])){if(!ae[a]&&Dt(a)&&(p.tagNameCheck instanceof RegExp&&x(p.tagNameCheck,a)||p.tagNameCheck instanceof Function&&p.tagNameCheck(a)))return!1;if(Ue&&!M[a]){const u=Te(e)||e.parentNode,y=Jt(e)||e.childNodes;if(y&&u){const d=y.length;for(let D=d-1;D>=0;--D){const U=Zt(y[D],!0);U.__removalCount=(e.__removalCount||0)+1,u.insertBefore(U,Qt(e))}}}return N(e),!0}return e instanceof b&&!gn(e)||(a==="noscript"||a==="noembed"||a==="noframes")&&x(/<\/no(script|embed|frames)/i,e.innerHTML)?(N(e),!0):($&&e.nodeType===de.text&&(r=e.textContent,Re([Ne,Ie,ke],u=>{r=ce(r,u," ")}),e.textContent!==r&&(se(t.removed,{element:e.cloneNode()}),e.textContent=r)),H(S.afterSanitizeElements,e,null),!1)},Lt=function(e,r,a){if(be[r]||gt&&(r==="id"||r==="name")&&(a in o||a in fn))return!1;if(!(Pe&&!be[r]&&x(on,r))){if(!(dt&&x(an,r))){if(!(B.attributeCheck instanceof Function&&B.attributeCheck(r,e))){if(!A[r]||be[r]){if(!(Dt(e)&&(p.tagNameCheck instanceof RegExp&&x(p.tagNameCheck,e)||p.tagNameCheck instanceof Function&&p.tagNameCheck(e))&&(p.attributeNameCheck instanceof RegExp&&x(p.attributeNameCheck,r)||p.attributeNameCheck instanceof Function&&p.attributeNameCheck(r,e))||r==="is"&&p.allowCustomizedBuiltInElements&&(p.tagNameCheck instanceof RegExp&&x(p.tagNameCheck,a)||p.tagNameCheck instanceof Function&&p.tagNameCheck(a))))return!1}else if(!Be[r]){if(!x(ct,ce(a,st,""))){if(!((r==="src"||r==="xlink:href"||r==="href")&&e!=="script"&&yn(a,"data:")===0&&Tt[e])){if(!(mt&&!x(ln,ce(a,st,"")))){if(a)return!1}}}}}}}return!0},Dt=function(e){return e!=="annotation-xml"&&qe(e,sn)},wt=function(e){H(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:d,namespaceURI:D,value:U}=y,Q=g(d),Ye=U;let _=d==="value"?Ye:vn(Ye);if(a.attrName=Q,a.attrValue=_,a.keepAttr=!0,a.forceKeepAttr=void 0,H(S.uponSanitizeAttribute,e,a),_=a.attrValue,ht&&(Q==="id"||Q==="name")&&(Y(d,e),_=cn+_),Ee&&x(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,_)){Y(d,e);continue}if(Q==="attributename"&&qe(_,"href")){Y(d,e);continue}if(a.forceKeepAttr)continue;if(!a.keepAttr){Y(d,e);continue}if(!ft&&x(/\/>/i,_)){Y(d,e);continue}$&&Re([Ne,Ie,ke],Ot=>{_=ce(_,Ot," ")});const Ct=g(e.nodeName);if(!Lt(Ct,Q,_)){Y(d,e);continue}if(v&&typeof he=="object"&&typeof he.getAttributeType=="function"&&!D)switch(he.getAttributeType(Ct,Q)){case"TrustedHTML":{_=v.createHTML(_);break}case"TrustedScriptURL":{_=v.createScriptURL(_);break}}if(_!==Ye)try{D?e.setAttributeNS(D,d,_):e.setAttribute(d,_),Ve(e)?N(e):Nt(t.removed)}catch{Y(d,e)}}H(S.afterSanitizeAttributes,e,null)},hn=function i(e){let r=null;const a=St(e);for(H(S.beforeSanitizeShadowDOM,e,null);r=a.nextNode();)H(S.uponSanitizeShadowNode,r,null),Rt(r),wt(r),r.content instanceof f&&i(r.content);H(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(Fe||je(e),t.removed=[],typeof i=="string"&&(ie=!1),ie){if(i.nodeName){const U=g(i.nodeName);if(!h[U]||ae[U])throw ue("root node is forbidden and cannot be sanitized in-place")}}else if(i instanceof z)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&&He&&N(r.firstChild);const d=St(ie?i:r);for(;u=d.nextNode();)Rt(u),wt(u),u.content instanceof f&&hn(u.content);if(ie)return i;if(q){if(Ae)for(y=tn.call(r.ownerDocument);r.firstChild;)y.appendChild(r.firstChild);else y=r;return(A.shadowroot||A.shadowrootmode)&&(y=rn.call(l,y,!0)),y}let D=V?r.outerHTML:r.innerHTML;return V&&h["!doctype"]&&r.ownerDocument&&r.ownerDocument.doctype&&r.ownerDocument.doctype.name&&x(Wt,r.ownerDocument.doctype.name)&&(D="<!DOCTYPE "+r.ownerDocument.doctype.name+`>
|
|
2
|
+
`+D),$&&Re([Ne,Ie,ke],U=>{D=ce(D,U," ")}),v&&_e?v.createHTML(D):D},t.setConfig=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};je(i),Fe=!0},t.clearConfig=function(){K=null,Fe=!1},t.isValidAttribute=function(i,e,r){K||je({});const a=g(i),u=g(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=An(S[i],e);return r===-1?void 0:_n(S[i],r,1)[0]}return Nt(S[i])},t.removeHooks=function(i){S[i]=[]},t.removeAllHooks=function(){S=Ut()},t}var Hn=jt();let m=null,P=null,J=null,T=null,ee="",te="",me="insert",fe=null,k=null,Ce=null;function Vt(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 Un(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 Yt=[{id:"formal-letter",name:"Formal Letter",category:"Letters",description:"Professional business letter template",html:`<p><strong>{{ Company Name }}</strong></p>
|
|
2
3
|
<p>{{ Today }}</p>
|
|
3
4
|
<p>Dear {{ first_name }} {{ last_name }},</p>
|
|
4
5
|
<p>I hope this letter finds you well. [Your letter content here]</p>
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
<h3>Q: How do I get started?</h3>
|
|
41
42
|
<p>A: [Answer here]</p>
|
|
42
43
|
<h3>Q: What are the requirements?</h3>
|
|
43
|
-
<p>A: [Answer here]</p>`}];let
|
|
44
|
+
<p>A: [Answer here]</p>`}];let ne=[...Yt];const nt=()=>ne,zn=n=>ne.filter(t=>t.category===n),rt=()=>{const n=new Set(ne.map(t=>t.category));return Array.from(n)},$t=n=>{const t=n.toLowerCase();return ne.filter(o=>o.name.toLowerCase().includes(t)||o.description?.toLowerCase().includes(t)||o.tags?.some(l=>l.toLowerCase().includes(t)))},ot=n=>Hn.sanitize(n,{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"]}),Bn=n=>ne.some(t=>t.id===n.id)?(console.warn(`Template with ID ${n.id} already exists`),!1):(ne.push(n),!0),Gn=n=>!!(n.id&&n.name&&n.category&&n.html&&n.html.trim().length>0);function Wn(n){P=document.createElement("div"),P.className="rte-dialog-overlay",Yn(n)&&P.classList.add("rte-ui-theme-dark"),P.addEventListener("click",()=>G()),m=document.createElement("div"),m.className="rte-dialog rte-template-dialog",m.addEventListener("click",o=>o.stopPropagation());const t=rt();t.length>0&&!ee&&(ee=t[0]),ge(),P.appendChild(m),document.body.appendChild(P),jn(),Qn()}function jn(){qt(),fe=n=>{n.key==="Escape"&&(!P||!m||(n.preventDefault(),n.stopPropagation(),G()))},document.addEventListener("keydown",fe,!0)}function qt(){fe&&(document.removeEventListener("keydown",fe,!0),fe=null)}const Vn='[data-theme="dark"], .dark, .editora-theme-dark',at=()=>{const n=window.getSelection();if(!n||n.rangeCount===0)return null;const t=n.anchorNode;return(t instanceof HTMLElement?t:t?.parentElement)?.closest(".rte-content, .editora-content")||null},Yn=n=>{const t=n||at();return t?!!t.closest(Vn):!1};function it(){const n=Un(J);if(n)return n;if(Ce?.isConnected)return Ce;const t=at();return t||document.querySelector(".rte-content, .editora-content")}function ge(){if(!m)return;const n=rt(),t=lt();m.innerHTML=`
|
|
44
45
|
<div class="rte-dialog-header">
|
|
45
46
|
<h2>Insert Template</h2>
|
|
46
47
|
<button class="rte-dialog-close" aria-label="Close">✕</button>
|
|
@@ -51,49 +52,49 @@
|
|
|
51
52
|
<input
|
|
52
53
|
type="text"
|
|
53
54
|
placeholder="Search templates..."
|
|
54
|
-
value="${
|
|
55
|
+
value="${te}"
|
|
55
56
|
class="rte-input rte-template-search"
|
|
56
57
|
aria-label="Search templates"
|
|
57
58
|
/>
|
|
58
59
|
|
|
59
60
|
<!-- Category Tabs -->
|
|
60
61
|
<div class="rte-tabs">
|
|
61
|
-
${
|
|
62
|
-
<button class="rte-tab ${
|
|
63
|
-
${
|
|
62
|
+
${n.map(o=>`
|
|
63
|
+
<button class="rte-tab ${ee===o?"active":""}" data-category="${o}">
|
|
64
|
+
${o}
|
|
64
65
|
</button>
|
|
65
66
|
`).join("")}
|
|
66
67
|
</div>
|
|
67
68
|
|
|
68
69
|
<!-- Template List -->
|
|
69
70
|
<div class="rte-template-list">
|
|
70
|
-
${
|
|
71
|
+
${t.length>0?t.map(o=>`
|
|
71
72
|
<div
|
|
72
|
-
class="rte-template-item ${
|
|
73
|
-
data-template-id="${
|
|
73
|
+
class="rte-template-item ${T?.id===o.id?"selected":""}"
|
|
74
|
+
data-template-id="${o.id}"
|
|
74
75
|
>
|
|
75
|
-
<div class="template-name">${
|
|
76
|
-
${
|
|
76
|
+
<div class="template-name">${o.name}</div>
|
|
77
|
+
${o.description?`<div class="template-description">${o.description}</div>`:""}
|
|
77
78
|
</div>
|
|
78
79
|
`).join(""):'<div class="rte-empty-state">No templates found</div>'}
|
|
79
80
|
</div>
|
|
80
81
|
|
|
81
82
|
<!-- Preview -->
|
|
82
|
-
${
|
|
83
|
+
${T?`
|
|
83
84
|
<div class="rte-template-preview">
|
|
84
85
|
<strong>Preview:</strong>
|
|
85
|
-
<div class="template-preview-content">${
|
|
86
|
+
<div class="template-preview-content">${T.html}</div>
|
|
86
87
|
</div>
|
|
87
88
|
`:""}
|
|
88
89
|
|
|
89
90
|
<!-- Insert Mode Toggle -->
|
|
90
91
|
<div class="rte-insert-mode">
|
|
91
92
|
<label>
|
|
92
|
-
<input type="radio" name="insertMode" value="insert" ${
|
|
93
|
+
<input type="radio" name="insertMode" value="insert" ${me==="insert"?"checked":""} />
|
|
93
94
|
Insert at cursor
|
|
94
95
|
</label>
|
|
95
96
|
<label>
|
|
96
|
-
<input type="radio" name="insertMode" value="replace" ${
|
|
97
|
+
<input type="radio" name="insertMode" value="replace" ${me==="replace"?"checked":""} />
|
|
97
98
|
Replace document
|
|
98
99
|
</label>
|
|
99
100
|
</div>
|
|
@@ -101,11 +102,11 @@
|
|
|
101
102
|
|
|
102
103
|
<div class="rte-dialog-footer">
|
|
103
104
|
<button class="rte-button-secondary rte-cancel-btn">Cancel</button>
|
|
104
|
-
<button class="rte-button-primary rte-insert-btn" ${
|
|
105
|
-
${
|
|
105
|
+
<button class="rte-button-primary rte-insert-btn" ${T?"":"disabled"}>
|
|
106
|
+
${me==="insert"?"Insert":"Replace"}
|
|
106
107
|
</button>
|
|
107
108
|
</div>
|
|
108
|
-
`,
|
|
109
|
+
`,qn()}function $n(){if(!m)return;m.innerHTML=`
|
|
109
110
|
<div class="rte-dialog-header">
|
|
110
111
|
<h2>Replace Document?</h2>
|
|
111
112
|
</div>
|
|
@@ -116,7 +117,7 @@
|
|
|
116
117
|
<button class="rte-button-secondary rte-cancel-warning-btn">Cancel</button>
|
|
117
118
|
<button class="rte-button-primary rte-confirm-replace-btn">Replace</button>
|
|
118
119
|
</div>
|
|
119
|
-
`;const
|
|
120
|
+
`;const n=m.querySelector(".rte-cancel-warning-btn"),t=m.querySelector(".rte-confirm-replace-btn");n?.addEventListener("click",()=>ge()),t?.addEventListener("click",()=>Xn())}function lt(){const n=nt();return te.trim()?$t(te):ee?n.filter(t=>t.category===ee):n}function qn(){if(!m)return;m.querySelector(".rte-dialog-close")?.addEventListener("click",()=>G()),m.querySelector(".rte-cancel-btn")?.addEventListener("click",()=>G()),m.querySelector(".rte-insert-btn")?.addEventListener("click",()=>Je());const l=m.querySelector(".rte-template-search");l?.addEventListener("input",b=>{k!==null&&cancelAnimationFrame(k),te=b.target.value,k=requestAnimationFrame(()=>{k=null,zt()})}),l?.addEventListener("keydown",b=>{b.key==="Enter"&&T?Je():b.key==="Escape"&&G()}),m.querySelector(".rte-tabs")?.addEventListener("click",b=>{const W=b.target.closest(".rte-tab");if(!W)return;const j=W.getAttribute("data-category");j&&(ee=j,te="",k!==null&&(cancelAnimationFrame(k),k=null),zt())});const f=m.querySelector(".rte-template-list"),w=b=>{const W=b.target.closest(".rte-template-item");if(!W)return null;const j=W.getAttribute("data-template-id");return j&&nt().find(Oe=>Oe.id===j)||null};f?.addEventListener("click",b=>{const E=w(b);E&&(T=E,ge())}),f?.addEventListener("dblclick",b=>{const E=w(b);E&&(T=E,Je())}),m.querySelector(".rte-insert-mode")?.addEventListener("change",b=>{const E=b.target;!E||E.name!=="insertMode"||(me=E.value,ge())})}function zt(){const n=lt();n.length>0?(!T||!n.find(t=>t.id===T.id))&&(T=n[0]):T=null,ge()}function Je(){if(T)if(me==="replace"){if(it()?.innerHTML?.trim()){$n();return}Xt(T),G()}else Zn(T),G()}function Xn(){T&&(Xt(T),G())}function Zn(n){const t=window.getSelection();if(!t)return;const o=it();if(!o)return;if(J)t.removeAllRanges(),t.addRange(J);else{const z=document.createRange();z.selectNodeContents(o),z.collapse(!1),t.removeAllRanges(),t.addRange(z)}if(t.rangeCount===0)return;const l=t.getRangeAt(0),c=o?.innerHTML??"",f=document.createRange().createContextualFragment(ot(n.html));l.deleteContents(),l.insertNode(f);const w=document.createRange();w.setStartAfter(l.endContainer),w.collapse(!0),t.removeAllRanges(),t.addRange(w),o&&(Vt(o,c),o.dispatchEvent(new Event("input",{bubbles:!0})))}function Xt(n){const t=it();if(t){const o=t.innerHTML;t.innerHTML=ot(n.html),Vt(t,o),t.dispatchEvent(new Event("input",{bubbles:!0}))}}function G(){qt(),k!==null&&(cancelAnimationFrame(k),k=null),P&&(P.remove(),P=null),m=null,J=null,te="",Ce=null}function Kn(n){const t=window.getSelection();t&&t.rangeCount>0?J=t.getRangeAt(0).cloneRange():J=null;const o=lt();o.length>0&&!T&&(T=o[0]);const l=n?.contentElement instanceof HTMLElement?n.contentElement:at();Ce=l||null,Wn(l)}function Qn(){if(typeof document>"u")return;const n="template-plugin-dialog-styles";if(document.getElementById(n))return;const t=document.createElement("style");t.id=n,t.textContent=`
|
|
120
121
|
.rte-dialog-overlay {
|
|
121
122
|
--rte-tmpl-overlay-bg: rgba(15, 23, 36, 0.56);
|
|
122
123
|
--rte-tmpl-dialog-bg: #fff;
|
|
@@ -353,4 +354,4 @@
|
|
|
353
354
|
.rte-button-secondary:hover {
|
|
354
355
|
background-color: var(--rte-tmpl-subtle-hover);
|
|
355
356
|
}
|
|
356
|
-
`,document.head.appendChild(
|
|
357
|
+
`,document.head.appendChild(t)}const Jn=()=>({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:(n,t)=>(Kn(t),!0)},keymap:{}});exports.PREDEFINED_TEMPLATES=Yt;exports.TemplatePlugin=Jn;exports.addCustomTemplate=Bn;exports.getAllTemplates=nt;exports.getTemplateCategories=rt;exports.getTemplatesByCategory=zn;exports.sanitizeTemplate=ot;exports.searchTemplates=$t;exports.validateTemplate=Gn;
|