neiki-page-editor 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +511 -0
- package/README.md +997 -0
- package/dist/neiki-page-editor.css +1580 -0
- package/dist/neiki-page-editor.esm.js +10545 -0
- package/dist/neiki-page-editor.js +10564 -0
- package/dist/neiki-page-editor.min.js +1637 -0
- package/package.json +48 -0
- package/php/NeikiPageEditorSanitizer.php +24 -0
|
@@ -0,0 +1,1637 @@
|
|
|
1
|
+
/* neiki-page-editor | Source Available License */
|
|
2
|
+
var NeikiPageEditor=(()=>{var G=Object.defineProperty,Xe=Object.defineProperties,Ye=Object.getOwnPropertyDescriptor,Je=Object.getOwnPropertyDescriptors,Qe=Object.getOwnPropertyNames,He=Object.getOwnPropertySymbols;var Re=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable;var Be=(r,e,t)=>e in r?G(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,L=(r,e)=>{for(var t in e||(e={}))Re.call(e,t)&&Be(r,t,e[t]);if(He)for(var t of He(e))et.call(e,t)&&Be(r,t,e[t]);return r},z=(r,e)=>Xe(r,Je(e));var tt=(r,e)=>{for(var t in e)G(r,t,{get:e[t],enumerable:!0})},nt=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Qe(e))!Re.call(r,i)&&i!==t&&G(r,i,{get:()=>e[i],enumerable:!(n=Ye(e,i))||n.enumerable});return r};var it=r=>nt(G({},"__esModule",{value:!0}),r);var $t={};tt($t,{NeikiPageEditor:()=>Se,default:()=>Wt});var Z=class{constructor(){this._listeners=new Map,this._destroyed=!1}on(e,t){return this._destroyed?()=>{}:(this._listeners.has(e)||this._listeners.set(e,new Set),this._listeners.get(e).add(t),()=>this.off(e,t))}off(e,t){let n=this._listeners.get(e);n&&(n.delete(t),n.size===0&&this._listeners.delete(e))}emit(e,...t){if(this._destroyed)return;let n=this._listeners.get(e);if(n)for(let i of Array.from(n))try{i(...t)}catch(o){}}destroy(){this._listeners.clear(),this._destroyed=!0}};var ot=["viewCode","undo","redo","findReplace","|","bold","italic","underline","strikethrough","superscript","subscript","code","removeFormat","|","heading","fontFamily","fontSize","|","foreColor","backColor","|","alignLeft","alignCenter","alignRight","alignJustify","|","indent","outdent","|","bulletList","numberedList","blockquote","horizontalRule","|","insertDropdown","|","moreMenu"],T=["light","dark","blue","dark-blue","midnight"],st=["body","regions"],at={initialContent:"",pageStyles:"",cssUrls:[],assetsBaseUrl:"",minHeight:300,maxHeight:null,autofocus:!1,spellcheck:!0,readonly:!1,editMode:"body",editableSelector:"[data-npe-editable]",theme:"light",persistTheme:!1,language:"en",translations:{},customClass:null,toolbar:ot,showHelp:!0,loadHandler:null,saveHandler:null,stylesheetUrlValidator:null,imageUploadHandler:null,videoUploadHandler:null,allowDataUris:!1,autosaveKey:null,onReady:null,onChange:null,onSave:null,onFocus:null,onBlur:null};function X(r={}){let e=Object.assign({},at);typeof r.initialContent=="string"&&(e.initialContent=r.initialContent),typeof r.pageStyles=="string"&&(e.pageStyles=r.pageStyles),typeof r.assetsBaseUrl=="string"&&(e.assetsBaseUrl=r.assetsBaseUrl),Array.isArray(r.cssUrls)&&(e.cssUrls=r.cssUrls.filter(t=>typeof t=="string")),typeof r.minHeight=="number"&&r.minHeight>=0&&(e.minHeight=r.minHeight),(r.maxHeight===null||typeof r.maxHeight=="number"&&r.maxHeight>0)&&(e.maxHeight=r.maxHeight);for(let t of["autofocus","spellcheck","readonly","persistTheme","allowDataUris","showHelp"])typeof r[t]=="boolean"&&(e[t]=r[t]);st.includes(r.editMode)&&(e.editMode=r.editMode),typeof r.editableSelector=="string"&&r.editableSelector.trim()&&(e.editableSelector=r.editableSelector.trim()),T.includes(r.theme)&&(e.theme=r.theme),typeof r.language=="string"&&r.language.trim()&&(e.language=r.language.trim()),r.translations&&typeof r.translations=="object"&&!Array.isArray(r.translations)&&(e.translations=Object.assign({},r.translations)),(typeof r.customClass=="string"||r.customClass===null)&&(e.customClass=r.customClass),Array.isArray(r.toolbar)&&r.toolbar.length>0&&(e.toolbar=r.toolbar.filter(t=>typeof t=="string")),(typeof r.autosaveKey=="string"||r.autosaveKey===null)&&(e.autosaveKey=r.autosaveKey);for(let t of["loadHandler","saveHandler","stylesheetUrlValidator","imageUploadHandler","videoUploadHandler","onReady","onChange","onSave","onFocus","onBlur"])typeof r[t]=="function"?e[t]=r[t]:r[t]!=null&&typeof r[t]!="function"&&(e[t]=null);return e}var Pe={"toolbar.viewCode":"View Source","toolbar.undo":"Undo","toolbar.redo":"Redo","toolbar.findReplace":"Find & Replace","toolbar.bold":"Bold","toolbar.italic":"Italic","toolbar.underline":"Underline","toolbar.strikethrough":"Strikethrough","toolbar.superscript":"Superscript","toolbar.subscript":"Subscript","toolbar.code":"Inline Code","toolbar.removeFormat":"Remove Formatting","toolbar.heading":"Heading","toolbar.fontFamily":"Font Family","toolbar.fontSize":"Font Size","toolbar.foreColor":"Text Color","toolbar.backColor":"Background Color","toolbar.alignLeft":"Align Left","toolbar.alignCenter":"Align Center","toolbar.alignRight":"Align Right","toolbar.alignJustify":"Justify","toolbar.indent":"Indent","toolbar.outdent":"Outdent","toolbar.bulletList":"Bullet List","toolbar.numberedList":"Numbered List","toolbar.blockquote":"Blockquote","toolbar.horizontalRule":"Horizontal Rule","toolbar.insertDropdown":"Insert","toolbar.moreMenu":"More","heading.paragraph":"Paragraph","heading.h1":"Heading 1","heading.h2":"Heading 2","heading.h3":"Heading 3","heading.h4":"Heading 4","heading.h5":"Heading 5","heading.h6":"Heading 6","fontFamily.sansSerif":"Sans Serif","fontFamily.serif":"Serif","fontFamily.monospace":"Monospace","fontFamily.cursive":"Cursive","insert.link":"Link","insert.image":"Image","insert.video":"Video","insert.table":"Table","insert.emoji":"Emoji","insert.specialChars":"Special Characters","menu.more.save":"Save","menu.more.preview":"Preview","menu.more.download":"Download","menu.more.print":"Print","menu.more.autosave":"Autosave","menu.more.clearAll":"Clear All","menu.more.changeTheme":"Change Theme","menu.more.fullscreen":"Fullscreen","menu.more.help":"Help","modal.common.insert":"Insert","modal.common.cancel":"Cancel","modal.common.apply":"Apply","modal.common.close":"Close","modal.link.title":"Insert Link","modal.link.url":"URL","modal.link.text":"Display Text","modal.link.newTab":"Open in new tab","modal.link.insert":"Insert","modal.link.cancel":"Cancel","modal.image.title":"Insert Image","modal.image.urlTab":"URL","modal.image.uploadTab":"Upload","modal.image.tabUrl":"URL","modal.image.tabUpload":"Upload","modal.image.url":"Image URL","modal.image.uploadLabel":"Upload Image","modal.image.uploadHintHandler":"Will be uploaded via handler","modal.image.uploadHintBase64":"Will be converted to base64","modal.image.alt":"Alt Text","modal.image.altPlaceholder":"Describe the image","modal.image.width":"Width (optional)","modal.image.widthPlaceholder":"e.g. 300px or 50%","modal.image.or":"OR","modal.image.invalidFile":"Only image files (PNG, JPEG, GIF, WebP, AVIF) are accepted.","modal.image.uploading":"Uploading\u2026","modal.image.upload":"Choose files or drag & drop","modal.image.dropzone":"Drop images here or click to browse","modal.image.insert":"Insert","modal.image.cancel":"Cancel","modal.video.title":"Insert Video","modal.video.urlTab":"URL","modal.video.uploadTab":"Upload","modal.video.tabUrl":"URL","modal.video.tabUpload":"Upload","modal.video.url":"Video URL","modal.video.upload":"Choose file","modal.video.insert":"Insert","modal.video.cancel":"Cancel","modal.table.title":"Insert Table","modal.table.rows":"Rows","modal.table.cols":"Columns","modal.table.columns":"Columns","modal.table.headerRow":"Include header row","modal.table.insert":"Insert","modal.table.cancel":"Cancel","modal.emoji.title":"Insert Emoji","modal.specialChars.title":"Special Characters","contextMenu.table.insertRowAbove":"Insert row above","contextMenu.table.insertRowBelow":"Insert row below","contextMenu.table.insertColLeft":"Insert column left","contextMenu.table.insertColRight":"Insert column right","contextMenu.table.deleteRow":"Delete row","contextMenu.table.deleteCol":"Delete column","contextMenu.table.deleteTable":"Delete table","contextMenu.table.mergeCells":"Merge cells","contextMenu.table.splitCell":"Split cell","modal.source.title":"Source View","modal.source.html":"HTML","modal.source.css":"CSS","modal.source.apply":"Apply","modal.source.cancel":"Cancel","modal.findReplace.title":"Find & Replace","modal.findReplace.find":"Find","modal.findReplace.replace":"Replace with","modal.findReplace.caseSensitive":"Case sensitive","modal.findReplace.useRegex":"Regular expression","modal.findReplace.findNext":"Find Next","modal.findReplace.replaceOne":"Replace","modal.findReplace.replaceAll":"Replace All","modal.findReplace.close":"Close","color.apply":"Apply","color.reset":"Reset","color.hex":"Hex","statusbar.words":"Words","statusbar.characters":"Characters","statusbar.block":"Block","statusbar.autosave":"Autosave","statusbar.autosave.saved":"Saved","statusbar.autosave.saving":"Saving\u2026","statusbar.autosave.off":"Off","statusbar.autosave.ago":"ago","table.insertRowAbove":"Insert row above","table.insertRowBelow":"Insert row below","table.insertColLeft":"Insert column left","table.insertColRight":"Insert column right","table.deleteRow":"Delete row","table.deleteColumn":"Delete column","table.deleteTable":"Delete table","table.mergeCells":"Merge cells","table.splitCell":"Split cell","confirm.clearAll":"Are you sure you want to clear all content?","error.saveFailed":"Save failed. Your changes are preserved.","error.loadFailed":"Failed to load content.","error.invalidUrl":"Invalid URL.","error.uploadFailed":"Upload failed: {file}","error.dataUrisDisabled":"File embedding is disabled. Please provide a URL or configure an upload handler.","error.invalidStylesheetUrl":"Stylesheet URL rejected: {url}","theme.light":"Light","theme.dark":"Dark","theme.blue":"Blue","theme.darkBlue":"Dark Blue","theme.midnight":"Midnight","help.title":"Keyboard Shortcuts","help.close":"Close","overlay.media.toolbar":"Media toolbar","overlay.media.drag":"Drag to reposition","overlay.media.replace":"Replace","overlay.media.delete":"Delete","floatingToolbar.label":"Selection toolbar","floatingToolbar.link":"Insert link","floatingToolbar.moveBlockUp":"Move block up","floatingToolbar.moveBlockDown":"Move block down"};var Ue={"toolbar.viewCode":"Zobrazit zdrojov\xFD k\xF3d","toolbar.undo":"Zp\u011Bt","toolbar.redo":"Znovu","toolbar.findReplace":"Naj\xEDt a nahradit","toolbar.bold":"Tu\u010Dn\xE9","toolbar.italic":"Kurz\xEDva","toolbar.underline":"Podtr\u017Een\xED","toolbar.strikethrough":"P\u0159e\u0161krtnut\xED","toolbar.superscript":"Horn\xED index","toolbar.subscript":"Doln\xED index","toolbar.code":"Vlo\u017Een\xFD k\xF3d","toolbar.removeFormat":"Odstranit form\xE1tov\xE1n\xED","toolbar.heading":"Nadpis","toolbar.fontFamily":"Typ p\xEDsma","toolbar.fontSize":"Velikost p\xEDsma","toolbar.foreColor":"Barva textu","toolbar.backColor":"Barva pozad\xED","toolbar.alignLeft":"Zarovnat vlevo","toolbar.alignCenter":"Zarovnat na st\u0159ed","toolbar.alignRight":"Zarovnat vpravo","toolbar.alignJustify":"Zarovnat do bloku","toolbar.indent":"Odsazen\xED","toolbar.outdent":"Zmen\u0161it odsazen\xED","toolbar.bulletList":"Odr\xE1\u017Ekov\xFD seznam","toolbar.numberedList":"\u010C\xEDslovan\xFD seznam","toolbar.blockquote":"Cit\xE1t","toolbar.horizontalRule":"Vodorovn\xE1 \u010D\xE1ra","toolbar.insertDropdown":"Vlo\u017Eit","toolbar.moreMenu":"V\xEDce","heading.paragraph":"Odstavec","heading.h1":"Nadpis 1","heading.h2":"Nadpis 2","heading.h3":"Nadpis 3","heading.h4":"Nadpis 4","heading.h5":"Nadpis 5","heading.h6":"Nadpis 6","fontFamily.sansSerif":"Bezpatkov\xE9","fontFamily.serif":"Patkov\xE9","fontFamily.monospace":"Pevn\xE1 \u0161\xED\u0159ka","fontFamily.cursive":"Kurz\xEDvn\xED","insert.link":"Odkaz","insert.image":"Obr\xE1zek","insert.video":"Video","insert.table":"Tabulka","insert.emoji":"Emoji","insert.specialChars":"Speci\xE1ln\xED znaky","menu.more.save":"Ulo\u017Eit","menu.more.preview":"N\xE1hled","menu.more.download":"St\xE1hnout","menu.more.print":"Tisk","menu.more.autosave":"Automatick\xE9 ukl\xE1d\xE1n\xED","menu.more.clearAll":"Vymazat v\u0161e","menu.more.changeTheme":"Zm\u011Bnit t\xE9ma","menu.more.fullscreen":"Cel\xE1 obrazovka","menu.more.help":"N\xE1pov\u011Bda","modal.common.insert":"Vlo\u017Eit","modal.common.cancel":"Zru\u0161it","modal.common.apply":"Pou\u017E\xEDt","modal.common.close":"Zav\u0159\xEDt","modal.link.title":"Vlo\u017Eit odkaz","modal.link.url":"URL","modal.link.text":"Zobrazovan\xFD text","modal.link.newTab":"Otev\u0159\xEDt v nov\xE9m okn\u011B","modal.link.insert":"Vlo\u017Eit","modal.link.cancel":"Zru\u0161it","modal.image.title":"Vlo\u017Eit obr\xE1zek","modal.image.urlTab":"URL","modal.image.uploadTab":"Nahr\xE1t","modal.image.tabUrl":"URL","modal.image.tabUpload":"Nahr\xE1t","modal.image.url":"URL obr\xE1zku","modal.image.uploadLabel":"Nahr\xE1t obr\xE1zek","modal.image.uploadHintHandler":"Bude nahr\xE1no p\u0159es handler","modal.image.uploadHintBase64":"Bude p\u0159evedeno na base64","modal.image.alt":"Popisek (alt)","modal.image.altPlaceholder":"Popis obr\xE1zku","modal.image.width":"\u0160\xED\u0159ka (voliteln\xE9)","modal.image.widthPlaceholder":"nap\u0159. 300px nebo 50%","modal.image.or":"NEBO","modal.image.invalidFile":"Jsou povoleny pouze obr\xE1zky (PNG, JPEG, GIF, WebP, AVIF).","modal.image.uploading":"Nahr\xE1v\xE1m\u2026","modal.image.upload":"Vyberte soubory nebo p\u0159et\xE1hn\u011Bte","modal.image.dropzone":"P\u0159et\xE1hn\u011Bte obr\xE1zky sem nebo klikn\u011Bte pro v\xFDb\u011Br","modal.image.insert":"Vlo\u017Eit","modal.image.cancel":"Zru\u0161it","modal.video.title":"Vlo\u017Eit video","modal.video.urlTab":"URL","modal.video.uploadTab":"Nahr\xE1t","modal.video.tabUrl":"URL","modal.video.tabUpload":"Nahr\xE1t","modal.video.url":"URL videa","modal.video.upload":"Vyberte soubor","modal.video.insert":"Vlo\u017Eit","modal.video.cancel":"Zru\u0161it","modal.table.title":"Vlo\u017Eit tabulku","modal.table.rows":"\u0158\xE1dky","modal.table.cols":"Sloupce","modal.table.columns":"Sloupce","modal.table.headerRow":"Zahrnout z\xE1hlav\xED","modal.table.insert":"Vlo\u017Eit","modal.table.cancel":"Zru\u0161it","modal.emoji.title":"Vlo\u017Eit emoji","modal.specialChars.title":"Speci\xE1ln\xED znaky","contextMenu.table.insertRowAbove":"Vlo\u017Eit \u0159\xE1dek nad","contextMenu.table.insertRowBelow":"Vlo\u017Eit \u0159\xE1dek pod","contextMenu.table.insertColLeft":"Vlo\u017Eit sloupec vlevo","contextMenu.table.insertColRight":"Vlo\u017Eit sloupec vpravo","contextMenu.table.deleteRow":"Smazat \u0159\xE1dek","contextMenu.table.deleteCol":"Smazat sloupec","contextMenu.table.deleteTable":"Smazat tabulku","contextMenu.table.mergeCells":"Slou\u010Dit bu\u0148ky","contextMenu.table.splitCell":"Rozd\u011Blit bu\u0148ku","modal.source.title":"Zdrojov\xFD k\xF3d","modal.source.html":"HTML","modal.source.css":"CSS","modal.source.apply":"Pou\u017E\xEDt","modal.source.cancel":"Zru\u0161it","modal.findReplace.title":"Naj\xEDt a nahradit","modal.findReplace.find":"Naj\xEDt","modal.findReplace.replace":"Nahradit za","modal.findReplace.caseSensitive":"Rozli\u0161ovat velikost p\xEDsmen","modal.findReplace.useRegex":"Regul\xE1rn\xED v\xFDraz","modal.findReplace.findNext":"Naj\xEDt dal\u0161\xED","modal.findReplace.replaceOne":"Nahradit","modal.findReplace.replaceAll":"Nahradit v\u0161e","modal.findReplace.close":"Zav\u0159\xEDt","color.apply":"Pou\u017E\xEDt","color.reset":"Resetovat","color.hex":"Hex","statusbar.words":"Slova","statusbar.characters":"Znaky","statusbar.block":"Blok","statusbar.autosave":"Aut. ukl\xE1d\xE1n\xED","statusbar.autosave.saved":"Ulo\u017Eeno","statusbar.autosave.saving":"Ukl\xE1d\xE1m\u2026","statusbar.autosave.off":"Vypnuto","statusbar.autosave.ago":"p\u0159ed","table.insertRowAbove":"Vlo\u017Eit \u0159\xE1dek nad","table.insertRowBelow":"Vlo\u017Eit \u0159\xE1dek pod","table.insertColLeft":"Vlo\u017Eit sloupec vlevo","table.insertColRight":"Vlo\u017Eit sloupec vpravo","table.deleteRow":"Smazat \u0159\xE1dek","table.deleteColumn":"Smazat sloupec","table.deleteTable":"Smazat tabulku","table.mergeCells":"Slou\u010Dit bu\u0148ky","table.splitCell":"Rozd\u011Blit bu\u0148ku","confirm.clearAll":"Opravdu chcete smazat ve\u0161ker\xFD obsah?","error.saveFailed":"Ulo\u017Een\xED selhalo. Va\u0161e zm\u011Bny jsou zachov\xE1ny.","error.loadFailed":"Nepoda\u0159ilo se na\u010D\xEDst obsah.","error.invalidUrl":"Neplatn\xE1 URL adresa.","error.uploadFailed":"Nahr\xE1v\xE1n\xED selhalo: {file}","error.dataUrisDisabled":"Vkl\xE1d\xE1n\xED soubor\u016F je zak\xE1z\xE1no. Zadejte URL nebo nastavte obslu\u017En\xFD program nahr\xE1v\xE1n\xED.","error.invalidStylesheetUrl":"URL stylopisu byla zam\xEDtnuta: {url}","theme.light":"Sv\u011Btl\xE9","theme.dark":"Tmav\xE9","theme.blue":"Modr\xE9","theme.darkBlue":"Tmav\u011B modr\xE9","theme.midnight":"P\u016Flno\u010Dn\xED","help.title":"Kl\xE1vesov\xE9 zkratky","help.close":"Zav\u0159\xEDt","overlay.media.toolbar":"Panel m\xE9di\xED","overlay.media.drag":"P\u0159et\xE1hnout pro p\u0159em\xEDst\u011Bn\xED","overlay.media.replace":"Nahradit","overlay.media.delete":"Smazat","floatingToolbar.label":"Panel v\xFDb\u011Bru","floatingToolbar.link":"Vlo\u017Eit odkaz","floatingToolbar.moveBlockUp":"P\u0159esunout blok v\xFD\u0161e","floatingToolbar.moveBlockDown":"P\u0159esunout blok n\xED\u017Ee"};var Fe=new Map([["en",Pe],["cs",Ue]]),Y=new Map;function Ve(r,e){if(!r||typeof r!="string")return;let t=Y.get(r)||{};Y.set(r,Object.assign({},t,e))}function Oe(r="en",e={}){function t(n,i){var s,a,l,c,d,p,u,m,_;let o=(_=(m=(p=(c=(a=e[n])!=null?a:(s=Y.get(r))==null?void 0:s[n])!=null?c:(l=Fe.get(r))==null?void 0:l[n])!=null?p:(d=Y.get("en"))==null?void 0:d[n])!=null?m:(u=Fe.get("en"))==null?void 0:u[n])!=null?_:n;return i&&typeof o=="string"&&(o=o.replace(/\{(\w+)\}/g,(g,h)=>i[h]!==void 0?i[h]:`{${h}}`)),o}return{t}}var A=class{constructor(e={}){this._id=e.id||"",this._label=e.label||"",this._icon=e.icon||"",this._toggle=e.toggle!==!1,this._active=!1,this._disabled=e.disabled||!1,this._onClick=e.onClick||null,this._el=null,this._render(),this._bindEvents()}_render(){let e=document.createElement("button");e.type="button",e.className="npe-btn",e.setAttribute("data-npe-cmd",this._id),e.setAttribute("title",this._label),e.setAttribute("aria-label",this._label),this._toggle&&e.setAttribute("aria-pressed","false"),this._icon?this._icon.trim().startsWith("<")?e.innerHTML=this._icon:e.textContent=this._icon:e.textContent=this._getDefaultText(),this._disabled&&this._applyDisabled(e,!0),this._el=e}_getDefaultText(){return{bold:"B",italic:"I",underline:"U",strikethrough:"S",superscript:"x\xB2",subscript:"x\u2082",code:"<>",removeFormat:"\u2715",undo:"\u21A9",redo:"\u21AA",viewCode:"</>",findReplace:"\u{1F50D}",alignLeft:"\u2261",alignCenter:"\u2630",alignRight:"\u2261",alignJustify:"\u2261",indent:"\u2192",outdent:"\u2190",bulletList:"\u2022",numberedList:"1.",blockquote:'"',horizontalRule:"\u2014"}[this._id]||this._id}_bindEvents(){this._el&&this._el.addEventListener("click",e=>{this._disabled||this._onClick&&this._onClick(e,this)})}render(){return this._el}setActive(e){this._active=!!e,this._el&&(this._toggle&&this._el.setAttribute("aria-pressed",this._active?"true":"false"),this._el.classList.toggle("npe-active",this._active))}setDisabled(e){this._disabled=!!e,this._el&&this._applyDisabled(this._el,this._disabled)}_applyDisabled(e,t){t?(e.setAttribute("aria-disabled","true"),e.setAttribute("tabindex","-1"),e.classList.add("npe-disabled")):(e.removeAttribute("aria-disabled"),e.removeAttribute("tabindex"),e.classList.remove("npe-disabled"))}setLabel(e){this._label=e,this._el&&(this._el.setAttribute("title",e),this._el.setAttribute("aria-label",e))}destroy(){this._el&&this._el.parentNode&&this._el.parentNode.removeChild(this._el),this._el=null}};var B=class extends A{constructor(e={}){if(super(z(L({},e),{toggle:!0,onClick:t=>this._toggleDropdown(t)})),this._items=e.items||[],this._onItemClick=e.onItemClick||null,this._hideArrow=e.hideArrow||!1,this._alignRight=e.alignRight||!1,this._hideArrow&&this._el){let t=this._el.querySelector(".npe-dropdown-arrow");t&&t.remove()}this._dropdown=null,this._open=!1,this._buildDropdown(),this._bindDocumentClose()}_render(){if(super._render(),this._el){let e=document.createElement("span");e.className="npe-dropdown-arrow",e.setAttribute("aria-hidden","true"),e.innerHTML='<svg viewBox="0 0 24 24"><path d="M7 10l5 5 5-5z"/></svg>',this._el.appendChild(e),this._el.setAttribute("aria-haspopup","true"),this._el.setAttribute("aria-expanded","false")}}_buildDropdown(){let e=document.createElement("ul");e.className="npe-dropdown",e.setAttribute("role","menu"),e.style.display="none";for(let t of this._items){let n=document.createElement("li");if(n.className="npe-dropdown-item",n.setAttribute("role","menuitem"),n.setAttribute("tabindex","0"),t.icon){let o=document.createElement("span");o.className="npe-dropdown-item-icon",o.setAttribute("aria-hidden","true"),t.icon.trim().startsWith("<")?o.innerHTML=t.icon:o.textContent=t.icon,n.appendChild(o)}let i=document.createElement("span");i.textContent=t.label,n.appendChild(i),n.addEventListener("click",o=>{o.stopPropagation(),this._closeDropdown(),t.action&&t.action(o,t),this._onItemClick&&this._onItemClick(t,o)}),n.addEventListener("keydown",o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),n.click())}),e.appendChild(n)}this._dropdown=e}_bindDocumentClose(){this._docCloseHandler=e=>{this._open&&this._el&&!this._el.contains(e.target)&&this._dropdown&&!this._dropdown.contains(e.target)&&this._closeDropdown()},this._keyCloseHandler=e=>{e.key==="Escape"&&this._open&&(this._closeDropdown(),this._el&&this._el.focus())},document.addEventListener("mousedown",this._docCloseHandler,!0),document.addEventListener("keydown",this._keyCloseHandler,!0)}_toggleDropdown(e){e&&e.stopPropagation(),this._open?this._closeDropdown():this._openDropdown()}_openDropdown(){if(!(!this._dropdown||!this._el)){if(this._open=!0,!this._dropdown.parentNode){let e=this._el.parentNode||document.body;e.style.position="relative",e.appendChild(this._dropdown)}this._alignRight?(this._dropdown.style.left="auto",this._dropdown.style.right="0"):(this._dropdown.style.left="0",this._dropdown.style.right="auto"),this._dropdown.style.display="block",this._el.setAttribute("aria-expanded","true"),this.setActive(!0)}}_closeDropdown(){this._dropdown&&(this._open=!1,this._dropdown.style.display="none",this._el&&this._el.setAttribute("aria-expanded","false"),this.setActive(!1))}setItems(e){if(this._items=e,this._dropdown){this._dropdown.innerHTML="";for(let t of e){let n=document.createElement("li");n.className="npe-dropdown-item",n.setAttribute("role","menuitem"),n.setAttribute("tabindex","0"),n.textContent=t.label,n.addEventListener("click",i=>{i.stopPropagation(),this._closeDropdown(),t.action&&t.action(i,t),this._onItemClick&&this._onItemClick(t,i)}),this._dropdown.appendChild(n)}}}render(){return this._el}destroy(){this._closeDropdown(),document.removeEventListener("mousedown",this._docCloseHandler,!0),document.removeEventListener("keydown",this._keyCloseHandler,!0),this._dropdown&&this._dropdown.parentNode&&this._dropdown.parentNode.removeChild(this._dropdown),this._dropdown=null,super.destroy()}};var J=class{constructor(e={}){this._i18n=e.i18n||{t:t=>t},this._onChange=e.onChange||null,this._disabled=e.disabled||!1,this._el=null,this._render()}_render(){let e=document.createElement("select");e.className="npe-select npe-heading-select",e.setAttribute("aria-label",this._i18n.t("toolbar.heading")),e.setAttribute("title",this._i18n.t("toolbar.heading"));let t=[{value:"p",key:"heading.paragraph"},{value:"h1",key:"heading.h1"},{value:"h2",key:"heading.h2"},{value:"h3",key:"heading.h3"},{value:"h4",key:"heading.h4"},{value:"h5",key:"heading.h5"},{value:"h6",key:"heading.h6"}];for(let n of t){let i=document.createElement("option");i.value=n.value,i.textContent=this._i18n.t(n.key),e.appendChild(i)}this._disabled&&(e.disabled=!0,e.setAttribute("aria-disabled","true")),e.addEventListener("change",()=>{this._onChange&&this._onChange(e.value)}),this._el=e}render(){return this._el}setValue(e){this._el&&(this._el.value=e||"p")}setDisabled(e){this._disabled=!!e,this._el&&(this._el.disabled=this._disabled,this._disabled?this._el.setAttribute("aria-disabled","true"):this._el.removeAttribute("aria-disabled"))}destroy(){this._el&&this._el.parentNode&&this._el.parentNode.removeChild(this._el),this._el=null}};var Q=class{constructor(e={}){this._i18n=e.i18n||{t:t=>t},this._onChange=e.onChange||null,this._disabled=e.disabled||!1,this._el=null,this._render()}_render(){let e=document.createElement("select");e.className="npe-select npe-font-family-select",e.setAttribute("aria-label",this._i18n.t("toolbar.fontFamily")),e.setAttribute("title",this._i18n.t("toolbar.fontFamily"));let t=[{value:"",key:"toolbar.fontFamily"},{value:"Arial, Helvetica, sans-serif",key:"fontFamily.sansSerif"},{value:'Georgia, "Times New Roman", serif',key:"fontFamily.serif"},{value:'"Courier New", Courier, monospace',key:"fontFamily.monospace"},{value:'"Comic Sans MS", cursive',key:"fontFamily.cursive"}];for(let n=0;n<t.length;n++){let i=t[n],o=document.createElement("option");o.value=i.value,o.textContent=this._i18n.t(i.key),n===0&&(o.disabled=!0,o.selected=!0),e.appendChild(o)}this._disabled&&(e.disabled=!0,e.setAttribute("aria-disabled","true")),e.addEventListener("change",()=>{this._onChange&&this._onChange(e.value)}),this._el=e}render(){return this._el}setValue(e){this._el&&(this._el.value=e||"")}setDisabled(e){this._disabled=!!e,this._el&&(this._el.disabled=this._disabled,this._disabled?this._el.setAttribute("aria-disabled","true"):this._el.removeAttribute("aria-disabled"))}destroy(){this._el&&this._el.parentNode&&this._el.parentNode.removeChild(this._el),this._el=null}};var rt=[8,9,10,11,12,14,16,18,20,22,24,28,32,36,40,48,56,64,72,80,96],lt=16,je=1,Ke=400,ee=class{constructor(e={}){this._i18n=e.i18n||{t:t=>t},this._onChange=e.onChange||null,this._disabled=e.disabled||!1,this._value=lt,this._el=null,this._decBtn=null,this._input=null,this._dropBtn=null,this._incBtn=null,this._popup=null,this._popupOpen=!1,this._docCloseHandler=null,this._render()}_render(){let e=document.createElement("div");e.className="npe-font-size-widget",e.setAttribute("role","group"),e.setAttribute("aria-label",this._i18n.t("toolbar.fontSize")),e.style.position="relative";let t=document.createElement("button");t.type="button",t.className="npe-btn npe-font-size-dec",t.innerHTML='<svg viewBox="0 0 24 24" width="14" height="14"><path d="M19 13H5v-2h14v2z"/></svg>',t.setAttribute("aria-label","Decrease font size"),t.setAttribute("title","Decrease font size"),t.addEventListener("click",()=>{this._closePopup(),this._adjustSize(-1)});let n=document.createElement("input");n.type="number",n.className="npe-font-size-input",n.min=String(je),n.max=String(Ke),n.value=String(this._value),n.setAttribute("aria-label",this._i18n.t("toolbar.fontSize")),n.setAttribute("aria-haspopup","listbox"),n.setAttribute("aria-expanded","false"),n.addEventListener("change",()=>{let o=parseInt(n.value,10);isNaN(o)||this._setValue(o,!0)}),n.addEventListener("keydown",o=>{o.key==="ArrowUp"&&(o.preventDefault(),this._adjustSize(1)),o.key==="ArrowDown"&&(o.preventDefault(),this._adjustSize(-1)),o.key==="Escape"&&this._closePopup(),o.key==="Enter"&&this._closePopup()}),n.addEventListener("click",o=>{o.stopPropagation(),this._togglePopup()});let i=document.createElement("button");i.type="button",i.className="npe-btn npe-font-size-inc",i.innerHTML='<svg viewBox="0 0 24 24" width="14" height="14"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>',i.setAttribute("aria-label","Increase font size"),i.setAttribute("title","Increase font size"),i.addEventListener("click",()=>{this._closePopup(),this._adjustSize(1)}),e.appendChild(t),e.appendChild(n),e.appendChild(i),this._el=e,this._decBtn=t,this._input=n,this._dropBtn=null,this._incBtn=i,this._buildPopup(),this._docCloseHandler=o=>{this._popupOpen&&this._el&&!this._el.contains(o.target)&&this._closePopup()},document.addEventListener("mousedown",this._docCloseHandler,!0),this._disabled&&this._applyDisabled(!0)}_buildPopup(){let e=document.createElement("div");e.className="npe-font-size-popup",e.setAttribute("role","listbox"),e.style.display="none";for(let t of rt){let n=document.createElement("button");n.type="button",n.className="npe-font-size-popup-item",n.setAttribute("role","option"),n.textContent=String(t),n.addEventListener("mousedown",i=>{i.preventDefault()}),n.addEventListener("click",i=>{i.stopPropagation(),this._setValue(t,!0),this._closePopup(),this._input&&this._input.focus()}),e.appendChild(n)}this._popup=e}_togglePopup(){this._popupOpen?this._closePopup():this._openPopup()}_openPopup(){if(!this._popup||!this._el)return;this._popupOpen=!0,this._popup.parentNode||this._el.appendChild(this._popup),this._popup.querySelectorAll(".npe-font-size-popup-item").forEach(n=>{n.classList.toggle("npe-active",parseInt(n.textContent,10)===this._value)}),this._popup.style.display="block",this._input&&this._input.setAttribute("aria-expanded","true");let t=this._popup.querySelector(".npe-font-size-popup-item.npe-active");t&&t.scrollIntoView({block:"nearest"})}_closePopup(){this._popup&&(this._popupOpen=!1,this._popup.style.display="none",this._input&&this._input.setAttribute("aria-expanded","false"))}_adjustSize(e){this._setValue(this._value+e,!0)}_setValue(e,t=!1){e=Math.max(je,Math.min(Ke,e)),this._value=e,this._input&&(this._input.value=String(e)),t&&this._onChange&&this._onChange(e)}_applyDisabled(e){for(let t of[this._decBtn,this._incBtn,this._input])t&&(e?(t.disabled=!0,t.setAttribute("aria-disabled","true")):(t.disabled=!1,t.removeAttribute("aria-disabled")))}render(){return this._el}setValue(e){let t=parseInt(e,10);isNaN(t)||this._setValue(t,!1)}getValue(){return this._value}setDisabled(e){this._disabled=!!e,this._applyDisabled(this._disabled)}destroy(){this._closePopup(),this._docCloseHandler&&(document.removeEventListener("mousedown",this._docCloseHandler,!0),this._docCloseHandler=null),this._el&&this._el.parentNode&&this._el.parentNode.removeChild(this._el),this._el=null}};var ct=["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#ffffff","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#0000ff","#9900ff","#ff00ff","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc","#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0","#cc0000","#e69138","#f1c232","#6aa84f","#45818e","#3d85c8","#674ea7","#a61c00","#990000","#b45f06","#bf9000","#38761d","#134f5c","#1155cc","#351c75","#741b47"],U=class extends A{constructor(e={}){super(z(L({},e),{toggle:!0,onClick:t=>this._togglePanel(t)})),this._i18n=e.i18n||{t:t=>t},this._onApply=e.onApply||null,this._onPreview=e.onPreview||null,this._currentColor="",this._pendingColor="",this._panel=null,this._swatchIndicator=null,this._panelOpen=!1,this._buildSwatch(),this._buildPanel(),this._bindDocumentClose()}_buildSwatch(){if(!this._el)return;let e=document.createElement("span");e.className="npe-color-swatch",e.setAttribute("aria-hidden","true"),this._el.appendChild(e),this._swatchIndicator=e}_buildPanel(){let e=document.createElement("div");e.className="npe-color-panel",e.setAttribute("role","dialog"),e.setAttribute("aria-label",this._label),e.style.display="none";let t=document.createElement("div");t.className="npe-color-swatches";for(let c of ct){let d=document.createElement("button");d.type="button",d.className="npe-color-swatch-btn",d.style.backgroundColor=c,d.setAttribute("title",c),d.setAttribute("aria-label",c),d.addEventListener("mouseenter",()=>{this._pendingColor=c,this._onPreview&&this._onPreview(c)}),d.addEventListener("click",p=>{p.stopPropagation(),this._pendingColor=c,this._commitColor(c)}),t.appendChild(d)}e.appendChild(t);let n=document.createElement("div");n.className="npe-color-picker-row",n.style.cssText="display:flex;align-items:center;gap:6px;margin-bottom:6px;";let i=document.createElement("input");i.type="color",i.className="npe-color-native",i.value=this._currentColor||"#000000",i.style.cssText="width:32px;height:28px;border:none;padding:0;cursor:pointer;",i.setAttribute("aria-label","Color picker"),i.addEventListener("input",()=>{this._pendingColor=i.value,this._hexInput&&(this._hexInput.value=i.value),this._onPreview&&this._onPreview(i.value)});let o=document.createElement("input");o.type="text",o.className="npe-color-hex-input",o.placeholder="#000000",o.maxLength=7,o.style.cssText="flex:1;height:28px;padding:0 6px;border:1px solid var(--npe-chrome-border);border-radius:3px;font-family:monospace;font-size:12px;background:var(--npe-toolbar-bg);color:var(--npe-chrome-text);",o.setAttribute("aria-label",this._i18n.t("color.hex")),o.addEventListener("input",()=>{let c=o.value.trim();/^#[0-9A-Fa-f]{6}$/.test(c)&&(this._pendingColor=c,i.value=c,this._onPreview&&this._onPreview(c))}),n.appendChild(i),n.appendChild(o),e.appendChild(n),this._hexInput=o,this._nativePicker=i;let s=document.createElement("div");s.style.cssText="display:flex;gap:4px;justify-content:flex-end;";let a=document.createElement("button");a.type="button",a.className="npe-btn",a.textContent=this._i18n.t("color.reset"),a.addEventListener("click",c=>{c.stopPropagation(),this._commitColor("")});let l=document.createElement("button");l.type="button",l.className="npe-btn npe-btn-primary",l.style.cssText="background:var(--npe-toolbar-btn-active-bg);color:var(--npe-toolbar-btn-active-text);",l.textContent=this._i18n.t("color.apply"),l.addEventListener("click",c=>{c.stopPropagation(),this._commitColor(this._pendingColor)}),s.appendChild(a),s.appendChild(l),e.appendChild(s),this._panel=e}_commitColor(e){this._currentColor=e,this._pendingColor=e,this._updateSwatchDisplay(),this._nativePicker&&(this._nativePicker.value=e||"#000000"),this._hexInput&&(this._hexInput.value=e||""),this._closePanel(),this._onApply&&this._onApply(e)}_updateSwatchDisplay(){this._swatchIndicator&&(this._currentColor?(this._swatchIndicator.style.backgroundColor=this._currentColor,this._swatchIndicator.style.border="none"):(this._swatchIndicator.style.backgroundColor="transparent",this._swatchIndicator.style.border="1px solid #000"))}_bindDocumentClose(){this._docCloseHandler=e=>{this._panelOpen&&this._el&&!this._el.contains(e.target)&&this._panel&&!this._panel.contains(e.target)&&this._closePanel()},this._keyCloseHandler=e=>{e.key==="Escape"&&this._panelOpen&&(this._closePanel(),this._el&&this._el.focus())},document.addEventListener("mousedown",this._docCloseHandler,!0),document.addEventListener("keydown",this._keyCloseHandler,!0)}_togglePanel(e){e&&e.stopPropagation(),this._panelOpen?this._closePanel():this._openPanel()}_openPanel(){if(!(!this._panel||!this._el)){if(this._panelOpen=!0,!this._panel.parentNode){let e=this._el.parentNode||document.body;e.style.position="relative",e.appendChild(this._panel)}this._panel.style.display="block",this.setActive(!0),this._hexInput&&(this._hexInput.value=this._currentColor||""),this._nativePicker&&(this._nativePicker.value=this._currentColor||"#000000"),this._pendingColor=this._currentColor}}_closePanel(){this._panel&&(this._panelOpen=!1,this._panel.style.display="none",this.setActive(!1))}setColor(e){this._currentColor=e||"",this._pendingColor=this._currentColor,this._updateSwatchDisplay(),this._nativePicker&&(this._nativePicker.value=e||"#000000"),this._hexInput&&(this._hexInput.value=e||"")}render(){return this._el}destroy(){this._closePanel(),document.removeEventListener("mousedown",this._docCloseHandler,!0),document.removeEventListener("keydown",this._keyCloseHandler,!0),this._panel&&this._panel.parentNode&&this._panel.parentNode.removeChild(this._panel),this._panel=null,super.destroy()}};var R={link:'<svg viewBox="0 0 24 24"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>',image:'<svg viewBox="0 0 24 24"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V6c0-1.1-.9-2-2-2H4C2.9 4 2 4.9 2 6v12c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2v-4.5l5 5v-13l-5 5zM9 16V8l5 4-5 4z"/></svg>',table:'<svg viewBox="0 0 24 24"><path d="M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"/></svg>',emoji:'<svg viewBox="0 0 24 24"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z"/></svg>',specialChars:'<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-width="2"/><text x="12" y="16" text-anchor="middle" font-size="11" font-weight="bold" fill="currentColor">\xA9</text></svg>'},te=class extends B{constructor(e={}){let t=e.i18n||{t:o=>o},n=[{id:"link",label:t.t("insert.link"),icon:R.link},{id:"image",label:t.t("insert.image"),icon:R.image},{id:"video",label:t.t("insert.video"),icon:R.video},{id:"table",label:t.t("insert.table"),icon:R.table},{id:"emoji",label:t.t("insert.emoji"),icon:R.emoji},{id:"specialChars",label:t.t("insert.specialChars"),icon:R.specialChars}],i=e.onItemClick||null;super({id:"insertDropdown",label:t.t("toolbar.insertDropdown"),icon:`<svg viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg><span class="npe-btn-label">${t.t("toolbar.insertDropdown")}</span>`,disabled:e.disabled||!1,items:n.map(o=>z(L({},o),{action:()=>{i&&i(o.id)}}))}),this._i18n=t}};var M={save:'<svg viewBox="0 0 24 24"><path d="M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z"/></svg>',preview:'<svg viewBox="0 0 24 24"><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>',download:'<svg viewBox="0 0 24 24"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg>',print:'<svg viewBox="0 0 24 24"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/></svg>',autosave:'<svg viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 14.5v-9l6 4.5-6 4.5z"/></svg>',clearAll:'<svg viewBox="0 0 24 24"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>',changeTheme:'<svg viewBox="0 0 24 24"><path d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z"/></svg>',fullscreen:'<svg viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>',help:'<svg viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"/></svg>'},ne=class extends B{constructor(e={}){let t=e.i18n||{t:o=>o},n=[{id:"save",label:t.t("menu.more.save"),icon:M.save},{id:"preview",label:t.t("menu.more.preview"),icon:M.preview},{id:"download",label:t.t("menu.more.download"),icon:M.download},{id:"print",label:t.t("menu.more.print"),icon:M.print},{id:"autosave",label:t.t("menu.more.autosave"),icon:M.autosave},{id:"clearAll",label:t.t("menu.more.clearAll"),icon:M.clearAll},{id:"changeTheme",label:t.t("menu.more.changeTheme"),icon:M.changeTheme},{id:"fullscreen",label:t.t("menu.more.fullscreen"),icon:M.fullscreen},{id:"help",label:t.t("menu.more.help"),icon:M.help}],i=e.onItemClick||null;super({id:"moreMenu",label:t.t("toolbar.moreMenu"),icon:'<svg viewBox="0 0 24 24"><circle cx="6" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="18" cy="12" r="2"/></svg>',disabled:e.disabled||!1,hideArrow:!0,alignRight:!0,items:n.map(o=>z(L({},o),{action:()=>{i&&i(o.id)}}))}),this._i18n=t,this._el&&this._el.classList.add("npe-more-menu-btn")}};var Ae={undo:'<svg viewBox="0 0 24 24"><path d="M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"/></svg>',redo:'<svg viewBox="0 0 24 24"><path d="M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"/></svg>',bold:'<svg viewBox="0 0 24 24"><path d="M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"/></svg>',italic:'<svg viewBox="0 0 24 24"><path d="M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"/></svg>',underline:'<svg viewBox="0 0 24 24"><path d="M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"/></svg>',strikethrough:'<svg viewBox="0 0 24 24"><path d="M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z"/></svg>',superscript:'<svg viewBox="0 0 24 24"><path d="M22 7h-2v1h3v1h-4V6.5c0-.83.67-1.5 1.5-1.5h1.5V4h-3V3h2.5c.83 0 1.5.67 1.5 1.5v1c0 .83-.67 1.5-1.5 1.5zM5.88 20h2.66l3.4-5.42h.12l3.4 5.42h2.66l-4.65-7.27L17.81 6h-2.68l-3.07 4.99h-.12L8.87 6H6.19l4.32 6.73L5.88 20z"/></svg>',subscript:'<svg viewBox="0 0 24 24"><path d="M22 18h-2v1h3v1h-4v-2.5c0-.83.67-1.5 1.5-1.5h1.5v-1h-3v-1h2.5c.83 0 1.5.67 1.5 1.5v1c0 .83-.67 1.5-1.5 1.5zM5.88 18h2.66l3.4-5.42h.12l3.4 5.42h2.66l-4.65-7.27L17.81 4h-2.68l-3.07 4.99h-.12L8.87 4H6.19l4.32 6.73L5.88 18z"/></svg>',code:'<svg viewBox="0 0 256 256"><path d="M0 0h256v256H0z" fill="none"/><path fill="currentColor" d="M71.68 97.22L34.74 128l36.94 30.78a12 12 0 1 1-15.36 18.44l-48-40a12 12 0 0 1 0-18.44l48-40a12 12 0 0 1 15.36 18.44m176 21.56l-48-40a12 12 0 1 0-15.36 18.44L221.26 128l-36.94 30.78a12 12 0 1 0 15.36 18.44l48-40a12 12 0 0 0 0-18.44M164.1 28.72a12 12 0 0 0-15.38 7.18l-64 176a12 12 0 0 0 7.18 15.37a11.8 11.8 0 0 0 4.1.73a12 12 0 0 0 11.28-7.9l64-176a12 12 0 0 0-7.18-15.38"/></svg>',removeFormat:'<svg viewBox="0 0 24 24"><path d="M16.24 3.56l4.95 4.94c.78.79.78 2.05 0 2.84L12 20.53a4.008 4.008 0 01-5.66 0L2.81 17c-.78-.79-.78-2.05 0-2.84l10.6-10.6c.79-.78 2.05-.78 2.83 0zm-1.41 1.42L6.93 12.9l4.24 4.24 7.9-7.9-4.24-4.26z"/></svg>',viewCode:'<svg viewBox="0 0 24 24"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/></svg>',findReplace:'<svg viewBox="0 0 24 24"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/></svg>',alignLeft:'<svg viewBox="0 0 24 24"><path d="M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z"/></svg>',alignCenter:'<svg viewBox="0 0 24 24"><path d="M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z"/></svg>',alignRight:'<svg viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z"/></svg>',alignJustify:'<svg viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18v-2H3v2zm0-4h18V7H3v2zm0-6v2h18V3H3z"/></svg>',indent:'<svg viewBox="0 0 24 24"><path d="M3 21h18v-2H3v2zM3 8v8l4-4-4-4zm8 9h10v-2H11v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"/></svg>',outdent:'<svg viewBox="0 0 24 24"><path d="M11 17h10v-2H11v2zm-8-5l4 4V8l-4 4zm0 9h18v-2H3v2zM3 3v2h18V3H3zm8 6h10V7H11v2zm0 4h10v-2H11v2z"/></svg>',bulletList:'<svg viewBox="0 0 24 24"><path d="M4 10.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-6c-.83 0-1.5.67-1.5 1.5S3.17 7.5 4 7.5 5.5 6.83 5.5 6 4.83 4.5 4 4.5zm0 12c-.83 0-1.5.68-1.5 1.5s.68 1.5 1.5 1.5 1.5-.68 1.5-1.5-.67-1.5-1.5-1.5zM7 19h14v-2H7v2zm0-6h14v-2H7v2zm0-8v2h14V5H7z"/></svg>',numberedList:'<svg viewBox="0 0 24 24"><path d="M2 17h2v.5H3v1h1v.5H2v1h3v-4H2v1zm1-9h1V4H2v1h1v3zm-1 3h1.8L2 13.1v.9h3v-1H3.2L5 10.9V10H2v1zm5-6v2h14V5H7zm0 14h14v-2H7v2zm0-6h14v-2H7v2z"/></svg>',blockquote:'<svg viewBox="0 0 24 24"><path d="M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z"/></svg>',horizontalRule:'<svg viewBox="0 0 24 24"><path d="M19 13H5v-2h14v2z"/></svg>',foreColor:'<svg viewBox="0 0 24 24"><path d="M11 3L5.5 17h2.25l1.12-3h6.25l1.12 3h2.25L13 3h-2zm-1.38 9L12 5.67 14.38 12H9.62z"/><rect x="3" y="19" width="18" height="3" fill="currentColor"/></svg>',backColor:'<svg viewBox="0 0 24 24"><path d="M16.56 8.94L7.62 0 6.21 1.41l2.38 2.38-5.15 5.15c-.59.59-.59 1.54 0 2.12l5.5 5.5c.29.29.68.44 1.06.44s.77-.15 1.06-.44l5.5-5.5c.59-.58.59-1.53 0-2.12zM5.21 10L10 5.21 14.79 10H5.21zM19 11.5s-2 2.17-2 3.5c0 1.1.9 2 2 2s2-.9 2-2c0-1.33-2-3.5-2-3.5z"/><rect x="0" y="20" width="24" height="4"/></svg>',link:'<svg viewBox="0 0 24 24"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>',image:'<svg viewBox="0 0 24 24"><path d="M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2zM8.5 13.5l2.5 3.01L14.5 12l4.5 6H5l3.5-4.5z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V6c0-1.1-.9-2-2-2H4C2.9 4 2 4.9 2 6v12c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2v-4.5l5 5v-13l-5 5zM9 16V8l5 4-5 4z"/></svg>',table:'<svg viewBox="0 0 24 24"><path d="M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"/></svg>',emoji:'<svg viewBox="0 0 24 24"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm3.5-9c.83 0 1.5-.67 1.5-1.5S16.33 8 15.5 8 14 8.67 14 9.5s.67 1.5 1.5 1.5zm-7 0c.83 0 1.5-.67 1.5-1.5S9.33 8 8.5 8 7 8.67 7 9.5 7.67 11 8.5 11zm3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.89c.8 2.04 2.78 3.5 5.11 3.5z"/></svg>',specialChars:'<svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" fill="none" stroke="currentColor" stroke-width="2"/><text x="12" y="16" text-anchor="middle" font-size="11" font-weight="bold" fill="currentColor">\xA9</text></svg>',save:'<svg viewBox="0 0 24 24"><path d="M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z"/></svg>',preview:'<svg viewBox="0 0 24 24"><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>',download:'<svg viewBox="0 0 24 24"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/></svg>',print:'<svg viewBox="0 0 24 24"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"/></svg>',autosave:'<svg viewBox="0 0 24 24"><path d="M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z"/></svg>',clearAll:'<svg viewBox="0 0 24 24"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/></svg>',changeTheme:'<svg viewBox="0 0 24 24"><path d="M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z"/></svg>',fullscreen:'<svg viewBox="0 0 24 24"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"/></svg>',help:'<svg viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"/></svg>',plus:'<svg viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>',more:'<svg viewBox="0 0 24 24"><circle cx="6" cy="12" r="2"/><circle cx="12" cy="12" r="2"/><circle cx="18" cy="12" r="2"/></svg>'},We={viewCode:{iconKey:"viewCode",toggle:!0},undo:{iconKey:"undo",toggle:!1},redo:{iconKey:"redo",toggle:!1},findReplace:{iconKey:"findReplace",toggle:!1},bold:{iconKey:"bold",toggle:!0},italic:{iconKey:"italic",toggle:!0},underline:{iconKey:"underline",toggle:!0},strikethrough:{iconKey:"strikethrough",toggle:!0},superscript:{iconKey:"superscript",toggle:!0},subscript:{iconKey:"subscript",toggle:!0},code:{iconKey:"code",toggle:!0},removeFormat:{iconKey:"removeFormat",toggle:!1},alignLeft:{iconKey:"alignLeft",toggle:!0},alignCenter:{iconKey:"alignCenter",toggle:!0},alignRight:{iconKey:"alignRight",toggle:!0},alignJustify:{iconKey:"alignJustify",toggle:!0},indent:{iconKey:"indent",toggle:!1},outdent:{iconKey:"outdent",toggle:!1},bulletList:{iconKey:"bulletList",toggle:!0},numberedList:{iconKey:"numberedList",toggle:!0},blockquote:{iconKey:"blockquote",toggle:!0},horizontalRule:{iconKey:"horizontalRule",toggle:!1}},Me=new Map,ie=class{constructor(e,t,n,i){this._container=e,this._opts=t,this._bus=n,this._i18n=i,this._controls=[],this._groups=[],this.build()}build(){let e=this._opts.toolbar||[],t=this._groupItems(e);for(let i of t){let o=document.createElement("div");o.className="npe-toolbar-group";for(let s of i){let a=this._buildControl(s);a&&(o.appendChild(a.el),this._controls.push(a),a.isMoreMenu&&o.classList.add("npe-more-menu-group"))}this._container.appendChild(o),this._groups.push(o)}let n=Array.from(this._container.children);for(let i=0;i<n.length-1;i++){let o=document.createElement("span");o.className="npe-toolbar-sep",o.setAttribute("aria-hidden","true"),this._container.insertBefore(o,n[i+1])}}_groupItems(e){let t=[],n=[];for(let i of e)i==="|"?n.length>0&&(t.push(n),n=[]):n.push(i);return n.length>0&&t.push(n),t}_buildControl(e){let t=this._i18n.t.bind(this._i18n),n=this._bus;if(e in We){let i=We[e],o=Ae[i.iconKey]||"",s=new A({id:e,label:t(`toolbar.${e}`),icon:o,toggle:i.toggle,onClick:()=>n.emit("toolbar:command",e)});return{id:e,el:s.render(),instance:s}}if(e==="heading"){let i=new J({i18n:this._i18n,onChange:o=>n.emit("toolbar:command","heading",o)});return{id:e,el:i.render(),instance:i}}if(e==="fontFamily"){let i=new Q({i18n:this._i18n,onChange:o=>n.emit("toolbar:command","fontFamily",o)});return{id:e,el:i.render(),instance:i}}if(e==="fontSize"){let i=new ee({i18n:this._i18n,onChange:o=>n.emit("toolbar:command","fontSize",o)});return{id:e,el:i.render(),instance:i}}if(e==="foreColor"){let i=new U({id:e,label:t("toolbar.foreColor"),icon:Ae.foreColor,i18n:this._i18n,onApply:o=>n.emit("toolbar:command","foreColor",o),onPreview:o=>n.emit("toolbar:colorPreview","foreColor",o)});return{id:e,el:i.render(),instance:i}}if(e==="backColor"){let i=new U({id:e,label:t("toolbar.backColor"),icon:Ae.backColor,i18n:this._i18n,onApply:o=>n.emit("toolbar:command","backColor",o),onPreview:o=>n.emit("toolbar:colorPreview","backColor",o)});return{id:e,el:i.render(),instance:i}}if(e==="insertDropdown"){let i=new te({i18n:this._i18n,onItemClick:o=>n.emit("toolbar:insert",o)});return{id:e,el:i.render(),instance:i}}if(e==="moreMenu"){let i=new ne({i18n:this._i18n,onItemClick:o=>n.emit("toolbar:more",o)});return{id:e,el:i.render(),instance:i,isMoreMenu:!0}}if(Me.has(e)){let i=Me.get(e),o=new A({id:e,label:i.label||e,icon:i.icon||"",toggle:i.toggle||!1,onClick:()=>{i.action&&i.action(),n.emit("toolbar:command",e)}});return{id:e,el:o.render(),instance:o}}return null}static registerPluginButton(e){e&&typeof e.id=="string"&&Me.set(e.id,e)}getControl(e){return this._controls.find(t=>t.id===e)}getControls(){return this._controls}destroy(){for(let e of this._controls)e.instance&&typeof e.instance.destroy=="function"&&e.instance.destroy();for(this._controls=[];this._container.firstChild;)this._container.removeChild(this._container.firstChild);this._groups=[]}};var dt={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strikeThrough",superscript:"superscript",subscript:"subscript",bulletList:"insertUnorderedList",numberedList:"insertOrderedList",blockquote:null},ht={alignLeft:"justifyLeft",alignCenter:"justifyCenter",alignRight:"justifyRight",alignJustify:"justifyFull"},F=class{constructor(e,t,n){this._toolbar=e,this._canvas=t,this._bus=n,this._destroyed=!1,this._bindEvents()}_bindEvents(){this._offSelectionChange=this._bus.on("selection:change",()=>this.update()),this._offContentChange=this._bus.on("content:change",()=>this.update()),this._offCanvasFocus=this._bus.on("canvas:focus",()=>this.update()),this._offCommand=this._bus.on("toolbar:command",()=>setTimeout(()=>this.update(),20))}update(){if(this._destroyed||!this._toolbar)return;let e=this._getIframeDocument();for(let[t,n]of Object.entries(dt)){if(!n)continue;let i=this._toolbar.getControl(t);if(!(i!=null&&i.instance))continue;let o=!1;try{e&&(o=e.queryCommandState(n))}catch(s){}typeof i.instance.setActive=="function"&&i.instance.setActive(o)}this._updateBlockquoteState(e),this._updateHeadingState(e),this._updateAlignmentState(e),this._updateUndoRedoState(e),this._bus.emit("toolbar:stateUpdated")}_getIframeDocument(){if(!this._canvas)return null;try{let e=this._canvas.getIframe?this._canvas.getIframe():null;return e&&e.contentDocument||null}catch(e){return null}}_getAncestorElement(e){if(!e)return null;try{let t=e.getSelection();if(!t||t.rangeCount===0)return null;let n=t.getRangeAt(0).commonAncestorContainer;for(;n&&n.nodeType===Node.TEXT_NODE;)n=n.parentNode;return n}catch(t){return null}}_updateBlockquoteState(e){let t=this._toolbar.getControl("blockquote");if(!(t!=null&&t.instance))return;let n=this._getAncestorElement(e),i=n?!!n.closest("blockquote"):!1;typeof t.instance.setActive=="function"&&t.instance.setActive(i)}_updateHeadingState(e){let t=this._toolbar.getControl("heading");if(!(t!=null&&t.instance))return;let n="p",i=this._getAncestorElement(e);if(i){let o=i.closest("h1,h2,h3,h4,h5,h6,p,div");if(o){let s=o.tagName.toLowerCase();/^h[1-6]$/.test(s)&&(n=s)}}typeof t.instance.setValue=="function"&&t.instance.setValue(n)}_updateAlignmentState(e){for(let[t,n]of Object.entries(ht)){let i=this._toolbar.getControl(t);if(!(i!=null&&i.instance))continue;let o=!1;try{e&&(o=e.queryCommandState(n))}catch(s){let a=this._getAncestorElement(e);if(a){let l=a.closest("p,h1,h2,h3,h4,h5,h6,div,li,td,th");if(l){let c={alignLeft:"left",alignCenter:"center",alignRight:"right",alignJustify:"justify"};o=(l.style.textAlign||l.getAttribute("align")||"").toLowerCase()===(c[t]||"")}}}typeof i.instance.setActive=="function"&&i.instance.setActive(o)}}_updateUndoRedoState(e){for(let t of["undo","redo"]){let n=this._toolbar.getControl(t);if(!(n!=null&&n.instance))continue;let i=!1;try{e&&(i=e.queryCommandEnabled(t==="undo"?"undo":"redo"))}catch(o){}typeof n.instance.setDisabled=="function"&&n.instance.setDisabled(!i)}}destroy(){this._destroyed=!0,this._offSelectionChange&&this._offSelectionChange(),this._offContentChange&&this._offContentChange(),this._offCanvasFocus&&this._offCanvasFocus(),this._offCommand&&this._offCommand()}};var pt=new Set(["bold","italic","underline","strikethrough","superscript","subscript","code","foreColor","backColor"]),ut={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strikeThrough",superscript:"superscript",subscript:"subscript",removeFormat:"removeFormat",alignLeft:"justifyLeft",alignCenter:"justifyCenter",alignRight:"justifyRight",alignJustify:"justifyFull",indent:"indent",outdent:"outdent",bulletList:"insertUnorderedList",numberedList:"insertOrderedList",horizontalRule:"insertHorizontalRule",undo:"undo",redo:"redo"},V=class{constructor(e,t,n,i){this._canvas=e||null,this._bus=t||null,this._styleManager=n||null,this._sanitizer=i||null,this._commands=new Map,this._destroyed=!1,this._registerBuiltins()}register(e,t){this._commands.set(e,t)}execute(e,...t){if(this._destroyed)return;let n=this._commands.get(e);n&&n(...t)}_registerBuiltins(){for(let[e,t]of Object.entries(ut))this._commands.set(e,()=>{pt.has(e)&&this._expandWordAtCursor(),this._exec(t)});this._commands.set("code",()=>{this._expandWordAtCursor(),this._wrapOrUnwrapInline("code")}),this._commands.set("heading",e=>{let t=this._getDoc();if(!t)return;let n=e==="p"?"p":e;try{t.execCommand("formatBlock",!1,`<${n}>`)}catch(i){}}),this._commands.set("fontFamily",e=>{this._expandWordAtCursor();let n={sansSerif:"Arial, sans-serif",serif:"Georgia, serif",monospace:"Courier New, monospace",cursive:"Comic Sans MS, cursive"}[e]||e;this._exec("fontName",n)}),this._commands.set("fontSize",e=>{this._expandWordAtCursor();let t=this._getDoc();if(!t)return;let n=parseInt(e,10);!n||n<=0||this._applyStyleToSelection(t,"font-size",`${n}px`)}),this._commands.set("foreColor",e=>{this._expandWordAtCursor(),e?this._exec("foreColor",e):this._exec("removeFormat")}),this._commands.set("backColor",e=>{this._expandWordAtCursor(),e?this._exec("hiliteColor",e):this._exec("removeFormat")}),this._commands.set("blockquote",()=>{let e=this._getDoc();if(e)try{let t=e.getSelection();if(!t||t.rangeCount===0)return;let n=t.anchorNode,i=n?!!(n.nodeType===3?n.parentElement&&n.parentElement.closest("blockquote"):n.closest&&n.closest("blockquote")):!1;e.execCommand("formatBlock",!1,i?"p":"blockquote")}catch(t){}}),this._commands.set("horizontalRule",()=>{this._exec("insertHorizontalRule")}),this._commands.set("undo",()=>this._exec("undo")),this._commands.set("redo",()=>this._exec("redo"))}_expandWordAtCursor(){let e=this._getDoc();if(e)try{let t=e.getSelection();if(!t||t.rangeCount===0||!t.isCollapsed)return;let n=t.getRangeAt(0),i=n.startContainer;if(!i||i.nodeType!==3)return;let o=i.textContent||"",s=n.startOffset,a=o.slice(0,s),l=o.slice(s),c=a.match(/\S+$/)||[""],d=l.match(/^\S+/)||[""],p=s-c[0].length,u=s+d[0].length;if(p===u)return;let m=e.createRange();m.setStart(i,p),m.setEnd(i,u),t.removeAllRanges(),t.addRange(m)}catch(t){}}_applyStyleToSelection(e,t,n){try{let i=e.getSelection();if(!i||i.rangeCount===0)return;let o=i.getRangeAt(0);if(o.collapsed)return;let s=e.createElement("span");s.style[t.replace(/-([a-z])/g,(l,c)=>c.toUpperCase())]=n,o.surroundContents(s);let a=e.createRange();a.selectNodeContents(s),i.removeAllRanges(),i.addRange(a)}catch(i){try{e.execCommand("fontSize",!1,"7");let o=e.querySelectorAll('font[size="7"]');for(let s of Array.from(o))s.removeAttribute("size"),s.style[t.replace(/-([a-z])/g,(a,l)=>l.toUpperCase())]=n}catch(o){}}}_wrapOrUnwrapInline(e){let t=this._getDoc();if(t)try{let n=t.getSelection();if(!n||n.rangeCount===0)return;let i=n.getRangeAt(0),o=i.commonAncestorContainer;if((o.nodeType===3?o.parentElement&&o.parentElement.tagName.toLowerCase():o.tagName&&o.tagName.toLowerCase())===e){let a=o.nodeType===3?o.parentElement:o;if(a&&a.tagName.toLowerCase()===e){let l=t.createDocumentFragment();for(;a.firstChild;)l.appendChild(a.firstChild);a.parentNode.replaceChild(l,a)}}else if(!i.collapsed){let a=t.createElement(e);i.surroundContents(a);let l=t.createRange();l.selectNodeContents(a),n.removeAllRanges(),n.addRange(l)}}catch(n){}}_exec(e,t){let n=this._getDoc();if(n)try{n.execCommand(e,!1,t||null)}catch(i){}}_getDoc(){if(!this._canvas)return null;try{return this._canvas.getDocument?this._canvas.getDocument():null}catch(e){return null}}destroy(){this._destroyed=!0,this._commands.clear()}};var oe=class{constructor(e={}){this._i18n=e.i18n||{t:t=>t},this._hostEl=e.hostEl||document.body,this._onClose=e.onClose||(()=>{}),this._onInsert=e.onInsert||(()=>{}),this._backdrop=null,this._modal=null,this._onKeyDown=null,this._destroyed=!1}open(e={}){this._modal||(this._build(e),this._show())}close(){this._teardown()}destroy(){this._destroyed=!0,this._teardown()}_build(e={}){let t=this._i18n.t.bind(this._i18n),n=document.createElement("div");n.className="npe-modal-backdrop",n.setAttribute("aria-hidden","true"),n.addEventListener("click",b=>{b.target===n&&this._onClose()});let i=document.createElement("div");i.className="npe-modal npe-link-modal",i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-labelledby","npe-link-title"),i.addEventListener("click",b=>b.stopPropagation());let o=document.createElement("div");o.className="npe-modal-header";let s=document.createElement("h2");s.id="npe-link-title",s.className="npe-modal-title",s.textContent=t("modal.link.title");let a=document.createElement("button");a.type="button",a.className="npe-modal-close",a.setAttribute("aria-label",t("modal.common.close")),a.textContent="\xD7",a.addEventListener("click",()=>this._onClose()),o.appendChild(s),o.appendChild(a);let l=document.createElement("div");l.className="npe-modal-body";let c=document.createElement("label");c.className="npe-form-label",c.setAttribute("for","npe-link-url"),c.textContent=t("modal.link.url");let d=document.createElement("input");d.type="url",d.id="npe-link-url",d.className="npe-form-input",d.value=e.href||"",d.setAttribute("placeholder","https://"),d.setAttribute("autocomplete","off");let p=document.createElement("label");p.className="npe-form-label",p.setAttribute("for","npe-link-text"),p.textContent=t("modal.link.text");let u=document.createElement("input");u.type="text",u.id="npe-link-text",u.className="npe-form-input",u.value=e.text||"",u.setAttribute("autocomplete","off");let{check:m,label:_}=De("npe-link-newtab",t("modal.link.newTab"));m.checked=e.newTab===!0,l.appendChild(c),l.appendChild(d),l.appendChild(p),l.appendChild(u),l.appendChild(_);let g=document.createElement("div");g.className="npe-modal-footer";let h=document.createElement("button");h.type="button",h.className="npe-btn",h.textContent=t("modal.common.cancel"),h.addEventListener("click",()=>this._onClose());let f=document.createElement("button");f.type="button",f.className="npe-btn npe-btn-primary",f.textContent=t("modal.common.insert"),f.addEventListener("click",()=>{let b=d.value.trim();if(!b){d.focus();return}let x=u.value.trim()||b,v=m.checked?' target="_blank" rel="noopener noreferrer"':"",y=`<a href="${E(b)}"${v}>${mt(x)}</a>`;this._onInsert(y),this._onClose()}),g.appendChild(h),g.appendChild(f),i.appendChild(o),i.appendChild(l),i.appendChild(g),this._urlInput=d,this._backdrop=n,this._modal=i}_show(){this._backdrop.appendChild(this._modal),this._hostEl.appendChild(this._backdrop),this._urlInput&&this._urlInput.focus(),this._onKeyDown=e=>S(e,this._modal,()=>this._onClose()),document.addEventListener("keydown",this._onKeyDown)}_teardown(){this._onKeyDown&&(document.removeEventListener("keydown",this._onKeyDown),this._onKeyDown=null),this._backdrop&&this._backdrop.parentNode&&this._backdrop.parentNode.removeChild(this._backdrop),this._backdrop=null,this._modal=null,this._urlInput=null}};function S(r,e,t){if(r.key==="Escape"){t();return}if(r.key==="Tab"&&e){let n=Array.from(e.querySelectorAll('button, input, textarea, select, [tabindex]:not([tabindex="-1"])')).filter(s=>!s.disabled&&s.getAttribute("tabindex")!=="-1");if(n.length===0)return;let i=n[0],o=n[n.length-1];r.shiftKey?document.activeElement===i&&(r.preventDefault(),o.focus()):document.activeElement===o&&(r.preventDefault(),i.focus())}}function De(r,e){let t=document.createElement("input");t.type="checkbox",t.id=r,t.className="npe-form-checkbox";let n=document.createElement("label");return n.setAttribute("for",r),n.className="npe-form-check-label",n.appendChild(t),n.appendChild(document.createTextNode(" "+e)),{check:t,label:n}}function E(r){return String(r).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function mt(r){return String(r).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}var Ie=new Set(["image/png","image/jpeg","image/gif","image/webp","image/avif"]),_t=`<svg viewBox="0 0 24 24" fill="currentColor">
|
|
3
|
+
<rect x="2" y="4" width="20" height="16" rx="2" fill="#1a73e8"/>
|
|
4
|
+
<path d="M2 16l5-5 3.5 3.5 4-5 7.5 9.5H2v-3z" fill="white" opacity="0.9"/>
|
|
5
|
+
<circle cx="8" cy="9" r="2" fill="white" opacity="0.9"/>
|
|
6
|
+
</svg>`,se=class{constructor(e={}){this._i18n=e.i18n||{t:t=>t},this._hostEl=e.hostEl||document.body,this._onClose=e.onClose||(()=>{}),this._onInsert=e.onInsert||(()=>{}),this._uploadHandler=e.imageUploadHandler||null,this._allowDataUris=e.allowDataUris===!0,this._backdrop=null,this._modal=null,this._onKeyDown=null,this._destroyed=!1,this._pendingFiles=[],this._uploadDragCount=0,this._urlInput=null,this._altInput=null,this._widthInput=null,this._fileInput=null,this._uploadZone=null,this._uploadFiles=null,this._insertBtn=null,this._errorEl=null}open(e={}){this._modal||(this._pendingFiles=[],this._uploadDragCount=0,this._build(e),this._show())}close(){this._teardown()}destroy(){this._destroyed=!0,this._teardown()}_build(e={}){let t=this._i18n.t.bind(this._i18n),n=typeof this._uploadHandler=="function",i=t(n?"modal.image.uploadHintHandler":"modal.image.uploadHintBase64"),o=document.createElement("div");o.className="npe-modal-backdrop",o.setAttribute("aria-hidden","true"),o.addEventListener("click",C=>{C.target===o&&this._onClose()});let s=document.createElement("div");s.className="npe-modal npe-image-modal",s.setAttribute("role","dialog"),s.setAttribute("aria-modal","true"),s.setAttribute("aria-labelledby","npe-image-title"),s.addEventListener("click",C=>C.stopPropagation());let a=document.createElement("div");a.className="npe-modal-header";let l=document.createElement("h2");l.id="npe-image-title",l.className="npe-modal-title",l.textContent=t("modal.image.title");let c=document.createElement("button");c.type="button",c.className="npe-modal-close",c.setAttribute("aria-label",t("modal.common.close")),c.innerHTML="×",c.addEventListener("click",()=>this._onClose()),a.appendChild(l),a.appendChild(c);let d=document.createElement("div");d.className="npe-modal-body";let p=document.createElement("div");p.className="npe-form-group";let u=document.createElement("label");u.className="npe-form-label",u.textContent=t("modal.image.uploadLabel");let m=document.createElement("input");m.type="file",m.className="npe-file-input",m.accept=Array.from(Ie).join(","),m.multiple=!0,m.setAttribute("aria-label",t("modal.image.uploadLabel")),m.addEventListener("change",()=>this._handleSelectedFiles(m.files)),this._fileInput=m;let _=document.createElement("div");_.className="npe-image-upload-zone",_.setAttribute("role","button"),_.setAttribute("tabindex","0"),this._uploadZone=_;let g=document.createElement("div");g.className="npe-image-upload-icon",g.setAttribute("aria-hidden","true"),g.innerHTML=_t;let h=document.createElement("div");h.className="npe-image-upload-title",h.textContent=t("modal.image.uploadLabel");let f=document.createElement("div");f.className="npe-image-upload-hint",f.textContent=i;let b=document.createElement("div");b.className="npe-image-upload-files",b.setAttribute("aria-live","polite"),this._uploadFiles=b,_.appendChild(g),_.appendChild(h),_.appendChild(f),_.appendChild(b),_.addEventListener("click",C=>{C.target!==m&&m.click()}),_.addEventListener("keydown",C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),m.click())}),_.addEventListener("dragenter",C=>{C.preventDefault(),this._uploadDragCount++,_.classList.add("drag-over")}),_.addEventListener("dragover",C=>{C.preventDefault()}),_.addEventListener("dragleave",C=>{C.preventDefault(),this._uploadDragCount--,this._uploadDragCount<=0&&(this._uploadDragCount=0,_.classList.remove("drag-over"))}),_.addEventListener("drop",C=>{C.preventDefault(),this._uploadDragCount=0,_.classList.remove("drag-over"),C.dataTransfer&&C.dataTransfer.files.length>0&&this._handleSelectedFiles(C.dataTransfer.files)}),p.appendChild(u),p.appendChild(m),p.appendChild(_);let x=document.createElement("div");x.className="npe-form-divider";let v=document.createElement("span");v.textContent=t("modal.image.or"),x.appendChild(v);let y=document.createElement("div");y.className="npe-form-group";let w=document.createElement("label");w.className="npe-form-label",w.setAttribute("for","npe-image-url"),w.textContent=t("modal.image.url");let k=document.createElement("input");k.type="url",k.id="npe-image-url",k.className="npe-form-input",k.value=e.src||"",k.setAttribute("placeholder","https://example.com/image.jpg"),k.setAttribute("autocomplete","off"),k.addEventListener("input",()=>{k.value||(this._pendingFiles=[],this._updateUploadFeedback([]),k.disabled=!1,m&&(m.value=""))}),this._urlInput=k,y.appendChild(w),y.appendChild(k);let N=document.createElement("div");N.className="npe-form-group";let j=document.createElement("label");j.className="npe-form-label",j.setAttribute("for","npe-image-alt"),j.textContent=t("modal.image.alt");let D=document.createElement("input");D.type="text",D.id="npe-image-alt",D.className="npe-form-input",D.value=e.alt||"",D.setAttribute("placeholder",t("modal.image.altPlaceholder")),D.setAttribute("autocomplete","off"),this._altInput=D,N.appendChild(j),N.appendChild(D);let K=document.createElement("div");K.className="npe-form-group";let W=document.createElement("label");W.className="npe-form-label",W.setAttribute("for","npe-image-width"),W.textContent=t("modal.image.width");let I=document.createElement("input");I.type="text",I.id="npe-image-width",I.className="npe-form-input",I.value=e.width||"",I.setAttribute("placeholder",t("modal.image.widthPlaceholder")),I.setAttribute("autocomplete","off"),this._widthInput=I,K.appendChild(W),K.appendChild(I);let $=document.createElement("div");$.className="npe-upload-error",$.setAttribute("hidden",""),this._errorEl=$,d.appendChild(p),d.appendChild(x),d.appendChild(y),d.appendChild(N),d.appendChild(K),d.appendChild($);let q=document.createElement("div");q.className="npe-modal-footer";let P=document.createElement("button");P.type="button",P.className="npe-btn",P.textContent=t("modal.common.cancel"),P.addEventListener("click",()=>this._onClose());let H=document.createElement("button");H.type="button",H.className="npe-btn npe-btn-primary",H.textContent=t("modal.common.insert"),H.addEventListener("click",()=>this._handleInsert()),this._insertBtn=H,q.appendChild(P),q.appendChild(H),s.appendChild(a),s.appendChild(d),s.appendChild(q),this._backdrop=o,this._modal=s}_handleSelectedFiles(e){let t=Array.from(e||[]),n=t.filter(s=>Ie.has(s.type));if(t.filter(s=>!Ie.has(s.type)).length>0?this._showError(this._i18n.t("modal.image.invalidFile")):this._showError(""),n.length===0){this._pendingFiles=[],this._updateUploadFeedback([]),this._urlInput&&(this._urlInput.disabled=!1);return}this._pendingFiles=n,this._updateUploadFeedback(n);let o=typeof this._uploadHandler=="function";if(n.length===1&&!o){let s=new FileReader;s.onload=a=>{this._urlInput&&(this._urlInput.value=a.target.result,this._urlInput.disabled=!0)},s.readAsDataURL(n[0])}else this._urlInput&&(this._urlInput.value="",this._urlInput.disabled=!0)}_updateUploadFeedback(e){let t=this._uploadZone,n=this._uploadFiles;t&&t.classList.toggle("has-files",e.length>0),n&&(n.textContent=e.map(i=>i.name).join(", "))}async _handleInsert(){let e=this._i18n.t.bind(this._i18n),t=this._altInput?this._altInput.value.trim():"",n=this._widthInput?this._widthInput.value.trim():"",i=n?` style="width:${E(n)}"`:"",o=typeof this._uploadHandler=="function";if(this._pendingFiles.length>0&&o){this._insertBtn&&(this._insertBtn.disabled=!0,this._insertBtn.textContent=e("modal.image.uploading"));try{let a=[];for(let l of this._pendingFiles){let c=await this._uploadHandler(l);c&&a.push(`<img src="${E(c)}" alt="${E(t||l.name)}"${i}>`)}a.length>0&&this._onInsert(a.join(""))}catch(a){this._showError(e("error.uploadFailed")),this._insertBtn&&(this._insertBtn.disabled=!1,this._insertBtn.textContent=e("modal.common.insert"));return}this._onClose();return}if(this._pendingFiles.length>1){this._insertBtn&&(this._insertBtn.disabled=!0,this._insertBtn.textContent=e("modal.image.uploading"));let a=[];for(let l of this._pendingFiles)try{let c=await ft(l);a.push(`<img src="${E(c)}" alt="${E(t||l.name)}"${i}>`)}catch(c){this._showError(e("error.uploadFailed"))}a.length>0&&this._onInsert(a.join("")),this._onClose();return}let s=this._urlInput?this._urlInput.value.trim():"";if(!s){this._urlInput&&this._urlInput.focus();return}this._onInsert(`<img src="${E(s)}" alt="${E(t)}"${i}>`),this._onClose()}_showError(e){this._errorEl&&(e?(this._errorEl.textContent=e,this._errorEl.removeAttribute("hidden")):(this._errorEl.textContent="",this._errorEl.setAttribute("hidden","")))}_show(){this._backdrop.appendChild(this._modal),this._hostEl.appendChild(this._backdrop),this._urlInput&&this._urlInput.focus(),this._onKeyDown=e=>S(e,this._modal,()=>this._onClose()),document.addEventListener("keydown",this._onKeyDown)}_teardown(){this._onKeyDown&&(document.removeEventListener("keydown",this._onKeyDown),this._onKeyDown=null),this._backdrop&&this._backdrop.parentNode&&this._backdrop.parentNode.removeChild(this._backdrop),this._backdrop=null,this._modal=null,this._urlInput=null,this._altInput=null,this._widthInput=null,this._fileInput=null,this._uploadZone=null,this._uploadFiles=null,this._insertBtn=null,this._errorEl=null,this._pendingFiles=[],this._uploadDragCount=0}};function ft(r){return new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=()=>t(new Error("FileReader error")),n.readAsDataURL(r)})}var $e=new Set(["video/mp4","video/webm"]),ae=class{constructor(e={}){this._i18n=e.i18n||{t:t=>t},this._hostEl=e.hostEl||document.body,this._onClose=e.onClose||(()=>{}),this._onInsert=e.onInsert||(()=>{}),this._uploadHandler=e.videoUploadHandler||null,this._allowDataUris=e.allowDataUris===!0,this._backdrop=null,this._modal=null,this._onKeyDown=null,this._destroyed=!1,this._activeTab="url"}open(e={}){this._modal||(this._build(e),this._show())}close(){this._teardown()}destroy(){this._destroyed=!0,this._teardown()}_build(e={}){let t=this._i18n.t.bind(this._i18n),n=document.createElement("div");n.className="npe-modal-backdrop",n.setAttribute("aria-hidden","true"),n.addEventListener("click",w=>{w.target===n&&this._onClose()});let i=document.createElement("div");i.className="npe-modal npe-video-modal",i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-labelledby","npe-video-title"),i.addEventListener("click",w=>w.stopPropagation());let o=document.createElement("div");o.className="npe-modal-header";let s=document.createElement("h2");s.id="npe-video-title",s.className="npe-modal-title",s.textContent=t("modal.video.title");let a=document.createElement("button");a.type="button",a.className="npe-modal-close",a.setAttribute("aria-label",t("modal.common.close")),a.textContent="\xD7",a.addEventListener("click",()=>this._onClose()),o.appendChild(s),o.appendChild(a);let l=document.createElement("div");l.className="npe-modal-tabs",l.setAttribute("role","tablist");let c=this._makeTabBtn(t("modal.video.urlTab"),"url",!0),d=this._makeTabBtn(t("modal.video.uploadTab"),"upload",!1);l.appendChild(c),l.appendChild(d);let p=document.createElement("div");p.className="npe-modal-panel",p.id="npe-video-panel-url",p.setAttribute("role","tabpanel");let u=document.createElement("label");u.className="npe-form-label",u.setAttribute("for","npe-video-url"),u.textContent=t("modal.video.url");let m=document.createElement("input");m.type="url",m.id="npe-video-url",m.className="npe-form-input",m.value=e.src||"",m.setAttribute("placeholder","https://"),m.setAttribute("autocomplete","off"),this._urlInput=m,p.appendChild(u),p.appendChild(m);let _=document.createElement("div");_.className="npe-modal-panel",_.id="npe-video-panel-upload",_.setAttribute("role","tabpanel"),_.setAttribute("hidden","");let g=document.createElement("div");g.className="npe-dropzone",g.textContent=t("modal.video.upload"),this._setupDropzone(g);let h=document.createElement("input");h.type="file",h.id="npe-video-file",h.className="npe-file-input",h.accept=Array.from($e).join(","),h.setAttribute("aria-label",t("modal.video.upload")),h.addEventListener("change",()=>this._handleFiles(h.files)),this._fileInput=h;let f=document.createElement("div");f.className="npe-upload-progress",f.setAttribute("hidden",""),this._progressEl=f;let b=document.createElement("div");b.className="npe-upload-error",b.setAttribute("hidden",""),this._errorEl=b,_.appendChild(g),_.appendChild(h),_.appendChild(f),_.appendChild(b),c.addEventListener("click",()=>this._switchTab("url",c,d,p,_)),d.addEventListener("click",()=>this._switchTab("upload",d,c,_,p));let x=document.createElement("div");x.className="npe-modal-footer";let v=document.createElement("button");v.type="button",v.className="npe-btn",v.textContent=t("modal.common.cancel"),v.addEventListener("click",()=>this._onClose());let y=document.createElement("button");y.type="button",y.className="npe-btn npe-btn-primary",y.textContent=t("modal.common.insert"),y.addEventListener("click",()=>this._handleInsert()),x.appendChild(v),x.appendChild(y),i.appendChild(o),i.appendChild(l),i.appendChild(p),i.appendChild(_),i.appendChild(x),this._backdrop=n,this._modal=i}_makeTabBtn(e,t,n){let i=document.createElement("button");return i.type="button",i.className="npe-tab"+(n?" npe-tab-active":""),i.dataset.tab=t,i.setAttribute("role","tab"),i.setAttribute("aria-selected",n?"true":"false"),i.textContent=e,i}_switchTab(e,t,n,i,o){this._activeTab=e,t.classList.add("npe-tab-active"),t.setAttribute("aria-selected","true"),n.classList.remove("npe-tab-active"),n.setAttribute("aria-selected","false"),i.removeAttribute("hidden"),o.setAttribute("hidden","")}_setupDropzone(e){e.addEventListener("click",()=>{this._fileInput&&this._fileInput.click()}),e.addEventListener("dragover",t=>{t.preventDefault(),e.classList.add("npe-dropzone-active")}),e.addEventListener("dragleave",()=>{e.classList.remove("npe-dropzone-active")}),e.addEventListener("drop",t=>{t.preventDefault(),e.classList.remove("npe-dropzone-active"),t.dataTransfer&&t.dataTransfer.files.length>0&&this._handleFiles(t.dataTransfer.files)})}_show(){this._backdrop.appendChild(this._modal),this._hostEl.appendChild(this._backdrop),this._urlInput&&this._urlInput.focus(),this._onKeyDown=e=>S(e,this._modal,()=>this._onClose()),document.addEventListener("keydown",this._onKeyDown)}_handleInsert(){if(this._activeTab==="url"){let e=this._urlInput?this._urlInput.value.trim():"";if(!e){this._urlInput&&this._urlInput.focus();return}this._onInsert(`<video src="${E(e)}" controls></video>`),this._onClose()}}async _handleFiles(e){if(!e||e.length===0)return;let t=e[0];if(!$e.has(t.type))return;let n=this._i18n.t.bind(this._i18n);if(this._showProgress(!0),this._showError(""),this._uploadHandler)try{let i=await this._uploadHandler(t);i&&(this._onInsert(`<video src="${E(i)}" controls></video>`),this._onClose())}catch(i){this._showError(n("error.uploadFailed",{file:t.name}))}else if(this._allowDataUris)try{let i=await bt(t);this._onInsert(`<video src="${E(i)}" controls></video>`),this._onClose()}catch(i){this._showError(n("error.uploadFailed",{file:t.name}))}else this._showError(n("error.dataUrisDisabled"));this._showProgress(!1)}_showProgress(e){this._progressEl&&(e?this._progressEl.removeAttribute("hidden"):this._progressEl.setAttribute("hidden",""))}_showError(e){this._errorEl&&(e?(this._errorEl.textContent=e,this._errorEl.removeAttribute("hidden")):(this._errorEl.textContent="",this._errorEl.setAttribute("hidden","")))}_teardown(){this._onKeyDown&&(document.removeEventListener("keydown",this._onKeyDown),this._onKeyDown=null),this._backdrop&&this._backdrop.parentNode&&this._backdrop.parentNode.removeChild(this._backdrop),this._backdrop=null,this._modal=null,this._urlInput=null,this._fileInput=null,this._progressEl=null,this._errorEl=null}};function bt(r){return new Promise((e,t)=>{let n=new FileReader;n.onload=()=>e(n.result),n.onerror=()=>t(new Error("FileReader error")),n.readAsDataURL(r)})}var re=class{constructor(e={}){this._i18n=e.i18n||{t:t=>t},this._hostEl=e.hostEl||document.body,this._onClose=e.onClose||(()=>{}),this._onInsert=e.onInsert||(()=>{}),this._backdrop=null,this._modal=null,this._onKeyDown=null,this._destroyed=!1}open(e={}){this._modal||(this._build(e),this._show())}close(){this._teardown()}destroy(){this._destroyed=!0,this._teardown()}_build(e={}){let t=this._i18n.t.bind(this._i18n),n=document.createElement("div");n.className="npe-modal-backdrop",n.setAttribute("aria-hidden","true"),n.addEventListener("click",b=>{b.target===n&&this._onClose()});let i=document.createElement("div");i.className="npe-modal npe-table-modal",i.setAttribute("role","dialog"),i.setAttribute("aria-modal","true"),i.setAttribute("aria-labelledby","npe-table-title"),i.addEventListener("click",b=>b.stopPropagation());let o=document.createElement("div");o.className="npe-modal-header";let s=document.createElement("h2");s.id="npe-table-title",s.className="npe-modal-title",s.textContent=t("modal.table.title");let a=document.createElement("button");a.type="button",a.className="npe-modal-close",a.setAttribute("aria-label",t("modal.common.close")),a.textContent="\xD7",a.addEventListener("click",()=>this._onClose()),o.appendChild(s),o.appendChild(a);let l=document.createElement("div");l.className="npe-modal-body";let c=document.createElement("label");c.className="npe-form-label",c.setAttribute("for","npe-table-rows"),c.textContent=t("modal.table.rows");let d=document.createElement("input");d.type="number",d.id="npe-table-rows",d.className="npe-form-input npe-table-number-input",d.value=String(e.rows||3),d.min="1",d.max="100",this._rowsInput=d;let p=document.createElement("label");p.className="npe-form-label",p.setAttribute("for","npe-table-cols"),p.textContent=t("modal.table.columns");let u=document.createElement("input");u.type="number",u.id="npe-table-cols",u.className="npe-form-input npe-table-number-input",u.value=String(e.cols||3),u.min="1",u.max="100",this._colsInput=u;let{check:m,label:_}=De("npe-table-header",t("modal.table.headerRow"));m.checked=e.headerRow!==!1,this._headerCheck=m,l.appendChild(c),l.appendChild(d),l.appendChild(p),l.appendChild(u),l.appendChild(_);let g=document.createElement("div");g.className="npe-modal-footer";let h=document.createElement("button");h.type="button",h.className="npe-btn",h.textContent=t("modal.common.cancel"),h.addEventListener("click",()=>this._onClose());let f=document.createElement("button");f.type="button",f.className="npe-btn npe-btn-primary",f.textContent=t("modal.common.insert"),f.addEventListener("click",()=>this._handleInsert()),g.appendChild(h),g.appendChild(f),i.appendChild(o),i.appendChild(l),i.appendChild(g),this._backdrop=n,this._modal=i}_show(){this._backdrop.appendChild(this._modal),this._hostEl.appendChild(this._backdrop),this._rowsInput&&this._rowsInput.focus(),this._onKeyDown=e=>S(e,this._modal,()=>this._onClose()),document.addEventListener("keydown",this._onKeyDown)}_handleInsert(){let e=Math.max(1,Math.min(100,parseInt(this._rowsInput?this._rowsInput.value:"3",10)||3)),t=Math.max(1,Math.min(100,parseInt(this._colsInput?this._colsInput.value:"3",10)||3)),n=this._headerCheck?this._headerCheck.checked:!0;this._onInsert(gt(e,t,n)),this._onClose()}_teardown(){this._onKeyDown&&(document.removeEventListener("keydown",this._onKeyDown),this._onKeyDown=null),this._backdrop&&this._backdrop.parentNode&&this._backdrop.parentNode.removeChild(this._backdrop),this._backdrop=null,this._modal=null,this._rowsInput=null,this._colsInput=null,this._headerCheck=null}};function gt(r,e,t){let n="border:1px solid #ccc;padding:6px 10px;",i=s=>`<${s} style="${n}"><br></${s}>`,o='<table style="border-collapse:collapse;width:100%;border:1px solid #ccc">';if(t){o+="<thead><tr>";for(let s=0;s<e;s++)o+=i("th");o+="</tr></thead>"}o+="<tbody>";for(let s=0;s<r;s++){o+="<tr>";for(let a=0;a<e;a++)o+=i("td");o+="</tr>"}return o+="</tbody></table>",o}var vt=[{label:"Smileys",emojis:["\u{1F600}","\u{1F601}","\u{1F602}","\u{1F923}","\u{1F603}","\u{1F604}","\u{1F605}","\u{1F606}","\u{1F607}","\u{1F608}","\u{1F609}","\u{1F60A}","\u{1F60B}","\u{1F60C}","\u{1F60D}","\u{1F970}","\u{1F60E}","\u{1F60F}","\u{1F610}","\u{1F611}","\u{1F612}","\u{1F613}","\u{1F614}","\u{1F615}","\u{1F616}","\u{1F617}","\u{1F618}","\u{1F619}","\u{1F61A}","\u{1F61B}","\u{1F61C}","\u{1F61D}","\u{1F61E}","\u{1F61F}","\u{1F620}","\u{1F621}","\u{1F622}","\u{1F624}","\u{1F625}","\u{1F626}","\u{1F627}","\u{1F628}","\u{1F629}","\u{1F97A}","\u{1F62A}","\u{1F62B}","\u{1F62C}","\u{1F62D}","\u{1F62E}","\u{1F62F}","\u{1F630}","\u{1F631}","\u{1F632}","\u{1F633}","\u{1F974}","\u{1F634}","\u{1F635}","\u{1F92F}","\u{1F637}","\u{1F912}","\u{1F915}","\u{1F922}","\u{1F92E}","\u{1F927}","\u{1F975}","\u{1F976}","\u{1F973}","\u{1F920}","\u{1F60E}","\u{1F913}","\u{1F9D0}"]},{label:"People",emojis:["\u{1F44B}","\u{1F91A}","\u{1F590}","\u270B","\u{1F596}","\u{1F44C}","\u{1F90C}","\u{1F90F}","\u270C","\u{1F91E}","\u{1F91F}","\u{1F918}","\u{1F919}","\u{1F448}","\u{1F449}","\u{1F446}","\u{1F595}","\u{1F447}","\u261D","\u{1F44D}","\u{1F44E}","\u270A","\u{1F44A}","\u{1F91B}","\u{1F91C}","\u{1F44F}","\u{1F64C}","\u{1F450}","\u{1F932}","\u{1F91D}","\u{1F64F}","\u{1F4AA}","\u{1F9BE}","\u{1F9B5}","\u{1F9B6}","\u{1F442}","\u{1F9BB}","\u{1F443}","\u{1FAC0}","\u{1FAC1}","\u{1F9E0}","\u{1F9B7}","\u{1F9B4}","\u{1F441}","\u{1F440}","\u{1F445}","\u{1F444}"]},{label:"Animals",emojis:["\u{1F436}","\u{1F431}","\u{1F42D}","\u{1F439}","\u{1F430}","\u{1F98A}","\u{1F43B}","\u{1F43C}","\u{1F43B}\u200D\u2744\uFE0F","\u{1F428}","\u{1F42F}","\u{1F981}","\u{1F42E}","\u{1F437}","\u{1F438}","\u{1F435}","\u{1F648}","\u{1F649}","\u{1F64A}","\u{1F412}","\u{1F414}","\u{1F427}","\u{1F426}","\u{1F424}","\u{1F986}","\u{1F985}","\u{1F989}","\u{1F987}","\u{1F43A}","\u{1F417}","\u{1F434}","\u{1F984}","\u{1F41D}","\u{1F41B}","\u{1F98B}","\u{1F40C}","\u{1F41E}","\u{1F41C}","\u{1F99F}","\u{1F997}","\u{1F577}","\u{1F982}","\u{1F422}","\u{1F40D}","\u{1F98E}","\u{1F996}","\u{1F995}","\u{1F419}","\u{1F991}","\u{1F990}","\u{1F99E}","\u{1F980}","\u{1F421}","\u{1F420}","\u{1F41F}","\u{1F42C}","\u{1F433}","\u{1F40B}","\u{1F988}","\u{1F40A}","\u{1F405}","\u{1F406}","\u{1F993}","\u{1F98D}","\u{1F9A7}","\u{1F9A3}","\u{1F418}","\u{1F99B}","\u{1F98F}","\u{1F42A}","\u{1F42B}","\u{1F992}","\u{1F998}","\u{1F9AC}","\u{1F403}","\u{1F402}","\u{1F404}","\u{1F40E}","\u{1F416}","\u{1F40F}","\u{1F411}","\u{1F999}","\u{1F410}","\u{1F98C}","\u{1F415}","\u{1F429}","\u{1F9AE}","\u{1F415}\u200D\u{1F9BA}","\u{1F408}","\u{1F408}\u200D\u2B1B","\u{1F413}","\u{1F983}","\u{1F9A4}","\u{1F99A}","\u{1F99C}","\u{1F9A2}","\u{1F9A9}","\u{1F54A}","\u{1F407}","\u{1F99D}","\u{1F9A8}","\u{1F9A1}","\u{1F9AB}","\u{1F9A6}","\u{1F9A5}","\u{1F401}","\u{1F400}","\u{1F43F}","\u{1F994}"]},{label:"Food",emojis:["\u{1F34E}","\u{1F350}","\u{1F34A}","\u{1F34B}","\u{1F34C}","\u{1F349}","\u{1F347}","\u{1F353}","\u{1FAD0}","\u{1F348}","\u{1F352}","\u{1F351}","\u{1F96D}","\u{1F34D}","\u{1F965}","\u{1F95D}","\u{1F345}","\u{1F346}","\u{1F951}","\u{1F966}","\u{1F96C}","\u{1F952}","\u{1F336}","\u{1FAD1}","\u{1F955}","\u{1F9C4}","\u{1F9C5}","\u{1F954}","\u{1F360}","\u{1FAD8}","\u{1F950}","\u{1F96F}","\u{1F35E}","\u{1F956}","\u{1F968}","\u{1F9C0}","\u{1F95A}","\u{1F373}","\u{1F9C8}","\u{1F95E}","\u{1F9C7}","\u{1F953}","\u{1F969}","\u{1F357}","\u{1F356}","\u{1F9B4}","\u{1F32D}","\u{1F354}","\u{1F35F}","\u{1F355}","\u{1FAD3}","\u{1F96A}","\u{1F959}","\u{1F9C6}","\u{1F32E}","\u{1F32F}","\u{1FAD4}","\u{1F957}","\u{1F958}","\u{1FAD5}","\u{1F96B}","\u{1F35D}","\u{1F35C}","\u{1F372}","\u{1F35B}","\u{1F363}","\u{1F371}","\u{1F95F}","\u{1F9AA}","\u{1F364}","\u{1F359}","\u{1F35A}","\u{1F358}","\u{1F365}","\u{1F96E}","\u{1F362}","\u{1F9C1}","\u{1F370}","\u{1F382}","\u{1F36E}","\u{1F36D}","\u{1F36C}","\u{1F36B}","\u{1F37F}","\u{1F369}","\u{1F36A}","\u{1F330}","\u{1F95C}","\u{1F36F}","\u{1F9C3}","\u{1F964}","\u{1F9CB}","\u2615","\u{1F375}","\u{1FAD6}","\u{1F37A}","\u{1F37B}","\u{1F942}","\u{1F377}","\u{1F943}","\u{1F378}","\u{1F379}","\u{1F9C9}","\u{1F37E}","\u{1F9CA}","\u{1F944}","\u{1F374}","\u{1F37D}","\u{1F962}","\u{1F9C2}"]},{label:"Travel",emojis:["\u{1F697}","\u{1F695}","\u{1F699}","\u{1F68C}","\u{1F68E}","\u{1F3CE}","\u{1F693}","\u{1F691}","\u{1F692}","\u{1F690}","\u{1F6FB}","\u{1F69A}","\u{1F69B}","\u{1F69C}","\u{1F6F5}","\u{1F3CD}","\u{1F6B2}","\u{1F6F4}","\u{1F6F9}","\u{1F6FC}","\u{1F681}","\u{1F6F8}","\u{1F680}","\u{1F6F6}","\u26F5","\u{1F6A4}","\u{1F6E5}","\u{1F6F3}","\u26F4","\u{1F6A2}","\u2708","\u{1F6E9}","\u{1F6EB}","\u{1F6EC}","\u{1F6F0}","\u{1F4BA}","\u{1F682}","\u{1F683}","\u{1F684}","\u{1F685}","\u{1F686}","\u{1F687}","\u{1F688}","\u{1F689}","\u{1F68A}","\u{1F69D}","\u{1F69E}","\u{1F68B}","\u{1F68C}","\u{1F68D}","\u{1F68E}","\u{1F690}","\u{1F691}","\u{1F692}","\u{1F693}","\u{1F694}","\u{1F696}","\u{1F697}","\u{1F698}","\u{1F699}","\u{1F6FB}","\u{1F3E0}","\u{1F3E1}","\u{1F3E2}","\u{1F3E3}","\u{1F3E4}","\u{1F3E5}","\u{1F3E6}","\u{1F3E7}","\u{1F3E8}","\u{1F3E9}","\u{1F3EA}","\u{1F3EB}","\u{1F3EC}","\u{1F3ED}","\u{1F3EF}","\u{1F3F0}","\u{1F492}","\u{1F5FC}","\u{1F5FD}","\u26EA","\u{1F54C}","\u{1F6D5}","\u{1F54D}","\u26E9","\u{1F54B}","\u26F2","\u26FA","\u{1F301}","\u{1F303}","\u{1F304}","\u{1F305}","\u{1F306}","\u{1F307}","\u{1F309}","\u{1F3D9}","\u{1F30C}","\u{1F320}","\u{1F387}","\u{1F386}"]},{label:"Symbols",emojis:["\u2764","\u{1F9E1}","\u{1F49B}","\u{1F49A}","\u{1F499}","\u{1F49C}","\u{1F5A4}","\u{1F90D}","\u{1F90E}","\u{1F494}","\u2763","\u{1F495}","\u{1F49E}","\u{1F493}","\u{1F497}","\u{1F496}","\u{1F498}","\u{1F49D}","\u{1F49F}","\u262E","\u271D","\u262A","\u{1F549}","\u2638","\u2721","\u{1F52F}","\u{1F54E}","\u262F","\u2626","\u{1F6D0}","\u26CE","\u2648","\u2649","\u264A","\u264B","\u264C","\u264D","\u264E","\u264F","\u2650","\u2651","\u2652","\u2653","\u{1F194}","\u269B","\u{1F251}","\u2622","\u2623","\u{1F4F4}","\u{1F4F3}","\u{1F236}","\u{1F21A}","\u{1F238}","\u{1F23A}","\u{1F237}","\u2734","\u{1F19A}","\u{1F4AE}","\u{1F250}","\u3299","\u3297","\u{1F234}","\u{1F235}","\u{1F239}","\u{1F232}","\u{1F170}","\u{1F171}","\u{1F18E}","\u{1F191}","\u{1F17E}","\u{1F198}","\u274C","\u2B55","\u{1F6D1}","\u26D4","\u{1F4DB}","\u{1F6AB}","\u{1F4AF}","\u{1F4A2}","\u2668","\u{1F6B7}","\u{1F6AF}","\u{1F6B3}","\u{1F6B1}","\u{1F51E}","\u{1F4F5}","\u{1F6AD}","\u2757","\u2755","\u2753","\u2754","\u203C","\u2049","\u{1F505}","\u{1F506}","\u303D","\u26A0","\u{1F6B8}","\u{1F531}","\u269C","\u{1F530}","\u267B","\u2705","\u{1F22F}","\u{1F4B9}","\u274E","\u{1F310}","\u{1F4A0}","\u24C2","\u{1F300}","\u{1F4A4}","\u{1F3E7}","\u{1F6BE}","\u267F","\u{1F17F}","\u{1F6D7}","\u{1F233}","\u{1F239}","\u{1F6BA}","\u{1F6B9}","\u{1F6BB}","\u{1F6BC}","\u{1F6AE}","\u{1F3A6}","\u{1F4F6}","\u{1F201}","\u{1F523}","\u2139","\u{1F524}","\u{1F521}","\u{1F520}","\u{1F196}","\u{1F197}","\u{1F199}","\u{1F192}","\u{1F195}","\u{1F193}","0\uFE0F\u20E3","1\uFE0F\u20E3","2\uFE0F\u20E3","3\uFE0F\u20E3","4\uFE0F\u20E3","5\uFE0F\u20E3","6\uFE0F\u20E3","7\uFE0F\u20E3","8\uFE0F\u20E3","9\uFE0F\u20E3","\u{1F51F}","\u{1F522}","#\uFE0F\u20E3","*\uFE0F\u20E3","\u23CF","\u25B6","\u23F8","\u23F9","\u23FA","\u23ED","\u23EE","\u23E9","\u23EA","\u23EB","\u23EC","\u25C0","\u{1F53C}","\u{1F53D}","\u27A1","\u2B05","\u2B06","\u2B07","\u2197","\u2198","\u2199","\u2196","\u2195","\u2194","\u21A9","\u21AA","\u2934","\u2935","\u{1F500}","\u{1F501}","\u{1F502}","\u{1F504}","\u{1F503}","\u{1F3B5}","\u{1F3B6}","\u2795","\u2796","\u2797","\u2716","\u267E","\u{1F4B2}","\u{1F4B1}","\u2122","\xA9","\xAE","\u3030","\u27B0","\u27BF","\u{1F51A}","\u{1F519}","\u{1F51B}","\u{1F51D}","\u{1F51C}","\u2714","\u2611","\u{1F518}","\u{1F532}","\u{1F533}","\u26AB","\u26AA","\u{1F7E4}","\u{1F534}","\u{1F7E0}","\u{1F7E1}","\u{1F7E2}","\u{1F535}","\u{1F7E3}","\u{1F7E5}","\u{1F7E7}","\u{1F7E8}","\u{1F7E9}","\u{1F7E6}","\u{1F7EA}","\u2B1B","\u2B1C","\u25FC","\u25FB","\u25FE","\u25FD","\u25AA","\u25AB"]}],le=class{constructor(e={}){this._i18n=e.i18n||{t:t=>t},this._hostEl=e.hostEl||document.body,this._onClose=e.onClose||(()=>{}),this._onInsert=e.onInsert||(()=>{}),this._backdrop=null,this._modal=null,this._onKeyDown=null,this._destroyed=!1}open(e={}){this._modal||(this._build(),this._show())}close(){this._teardown()}destroy(){this._destroyed=!0,this._teardown()}_build(){let e=this._i18n.t.bind(this._i18n),t=document.createElement("div");t.className="npe-modal-backdrop",t.setAttribute("aria-hidden","true"),t.addEventListener("click",c=>{c.target===t&&this._onClose()});let n=document.createElement("div");n.className="npe-modal npe-emoji-picker",n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby","npe-emoji-title"),n.addEventListener("click",c=>c.stopPropagation());let i=document.createElement("div");i.className="npe-modal-header";let o=document.createElement("h2");o.id="npe-emoji-title",o.className="npe-modal-title",o.textContent=e("modal.emoji.title");let s=document.createElement("button");s.type="button",s.className="npe-modal-close",s.setAttribute("aria-label",e("modal.common.close")),s.textContent="\xD7",s.addEventListener("click",()=>this._onClose()),i.appendChild(o),i.appendChild(s);let a=document.createElement("input");a.type="search",a.className="npe-form-input npe-emoji-search",a.setAttribute("placeholder","\u{1F50D}"),a.setAttribute("aria-label","Search emoji"),a.addEventListener("input",()=>this._filterEmoji(a.value,l)),this._searchInput=a;let l=document.createElement("div");l.className="npe-emoji-grid",this._renderEmoji(l,null),n.appendChild(i),n.appendChild(a),n.appendChild(l),this._backdrop=t,this._modal=n,this._grid=l}_renderEmoji(e,t){e.innerHTML="";let n=t?t.toLowerCase():null;for(let i of vt){let o=n?i.emojis.filter(l=>l.toLowerCase().includes(n)):i.emojis;if(o.length===0)continue;let s=document.createElement("div");s.className="npe-emoji-category-label",s.textContent=i.label,e.appendChild(s);let a=document.createElement("div");a.className="npe-emoji-row";for(let l of o){let c=document.createElement("button");c.type="button",c.className="npe-emoji-btn",c.textContent=l,c.setAttribute("title",l),c.setAttribute("aria-label",l),c.addEventListener("click",()=>{this._onInsert(l),this._onClose()}),a.appendChild(c)}e.appendChild(a)}if(e.children.length===0){let i=document.createElement("p");i.className="npe-emoji-empty",i.textContent="\u2014",e.appendChild(i)}}_filterEmoji(e,t){this._renderEmoji(t,e||null)}_show(){this._backdrop.appendChild(this._modal),this._hostEl.appendChild(this._backdrop),this._searchInput&&this._searchInput.focus(),this._onKeyDown=e=>S(e,this._modal,()=>this._onClose()),document.addEventListener("keydown",this._onKeyDown)}_teardown(){this._onKeyDown&&(document.removeEventListener("keydown",this._onKeyDown),this._onKeyDown=null),this._backdrop&&this._backdrop.parentNode&&this._backdrop.parentNode.removeChild(this._backdrop),this._backdrop=null,this._modal=null,this._searchInput=null,this._grid=null}};var yt=[{label:"Currency",chars:["\u20AC","\xA3","\xA5","\xA2","\u20B9","\u20BD","\u20A9","\u20AA","\u20BA","\u20AB","\u0E3F","\u20B4","\u20A6","\u20A1","\u20B2","\u20B5","\u20B1"]},{label:"Math",chars:["\xB1","\xD7","\xF7","\u2260","\u2264","\u2265","\u2248","\u221E","\u2211","\u220F","\u221A","\u221B","\u222B","\u2202","\u2206","\u2207","\u2208","\u2209","\u220B","\u2229","\u222A","\u2282","\u2283","\u2284","\u2285","\u2286","\u2287","\u2200","\u2203","\u2204","\xAC","\u2227","\u2228","\u2295","\u2297","\u22A5","\u2225","\u221F","\u2220","\xB0","\u2032","\u2033","\u2030","\u2031","%"]},{label:"Arrows",chars:["\u2190","\u2192","\u2191","\u2193","\u2194","\u2195","\u2196","\u2197","\u2198","\u2199","\u21D0","\u21D2","\u21D1","\u21D3","\u21D4","\u21D5","\u27F5","\u27F6","\u27F7","\u27F8","\u27F9","\u27FA","\u2794","\u279C","\u27A1","\u2B05","\u2B06","\u2B07","\u21A9","\u21AA","\u21BA","\u21BB"]},{label:"Punctuation",chars:["\xA9","\xAE","\u2122","\xA7","\xB6","\u2020","\u2021","\u2022","\u2023","\xB7","\u2026","\u2025","\u2014","\u2013","\u2011","\xAB","\xBB","\u2039","\u203A","\u201C","\u201D","\u201E","\u2018","\u2019","\u201A","|","\xA6","\xA1","\xBF"]},{label:"Letters",chars:["\xC0","\xC1","\xC2","\xC3","\xC4","\xC5","\xC6","\xC7","\xC8","\xC9","\xCA","\xCB","\xCC","\xCD","\xCE","\xCF","\xD0","\xD1","\xD2","\xD3","\xD4","\xD5","\xD6","\xD8","\xD9","\xDA","\xDB","\xDC","\xDD","\xDE","\xDF","\xE0","\xE1","\xE2","\xE3","\xE4","\xE5","\xE6","\xE7","\xE8","\xE9","\xEA","\xEB","\xEC","\xED","\xEE","\xEF","\xF0","\xF1","\xF2","\xF3","\xF4","\xF5","\xF6","\xF8","\xF9","\xFA","\xFB","\xFC","\xFD","\xFE","\xFF"]},{label:"Greek",chars:["\u0391","\u0392","\u0393","\u0394","\u0395","\u0396","\u0397","\u0398","\u0399","\u039A","\u039B","\u039C","\u039D","\u039E","\u039F","\u03A0","\u03A1","\u03A3","\u03A4","\u03A5","\u03A6","\u03A7","\u03A8","\u03A9","\u03B1","\u03B2","\u03B3","\u03B4","\u03B5","\u03B6","\u03B7","\u03B8","\u03B9","\u03BA","\u03BB","\u03BC","\u03BD","\u03BE","\u03BF","\u03C0","\u03C1","\u03C2","\u03C3","\u03C4","\u03C5","\u03C6","\u03C7","\u03C8","\u03C9"]},{label:"Fractions",chars:["\xBD","\xBC","\xBE","\u2153","\u2154","\u215B","\u215C","\u215D","\u215E","\u2150","\u2151","\u2152"]},{label:"Subscript",chars:["\u2080","\u2081","\u2082","\u2083","\u2084","\u2085","\u2086","\u2087","\u2088","\u2089","\u208A","\u208B","\u208C","\u208D","\u208E"]},{label:"Superscript",chars:["\u2070","\xB9","\xB2","\xB3","\u2074","\u2075","\u2076","\u2077","\u2078","\u2079","\u207A","\u207B","\u207C","\u207D","\u207E"]}],ce=class{constructor(e={}){this._i18n=e.i18n||{t:t=>t},this._hostEl=e.hostEl||document.body,this._onClose=e.onClose||(()=>{}),this._onInsert=e.onInsert||(()=>{}),this._backdrop=null,this._modal=null,this._onKeyDown=null,this._destroyed=!1}open(e={}){this._modal||(this._build(),this._show())}close(){this._teardown()}destroy(){this._destroyed=!0,this._teardown()}_build(){let e=this._i18n.t.bind(this._i18n),t=document.createElement("div");t.className="npe-modal-backdrop",t.setAttribute("aria-hidden","true"),t.addEventListener("click",c=>{c.target===t&&this._onClose()});let n=document.createElement("div");n.className="npe-modal npe-special-chars-picker",n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby","npe-special-chars-title"),n.addEventListener("click",c=>c.stopPropagation());let i=document.createElement("div");i.className="npe-modal-header";let o=document.createElement("h2");o.id="npe-special-chars-title",o.className="npe-modal-title",o.textContent=e("modal.specialChars.title");let s=document.createElement("button");s.type="button",s.className="npe-modal-close",s.setAttribute("aria-label",e("modal.common.close")),s.textContent="\xD7",s.addEventListener("click",()=>this._onClose()),i.appendChild(o),i.appendChild(s);let a=document.createElement("input");a.type="search",a.className="npe-form-input npe-emoji-search",a.setAttribute("placeholder","\u{1F50D}"),a.setAttribute("aria-label","Search characters"),a.addEventListener("input",()=>this._filterChars(a.value,l)),this._searchInput=a;let l=document.createElement("div");l.className="npe-emoji-grid npe-special-chars-grid",this._renderChars(l,null),n.appendChild(i),n.appendChild(a),n.appendChild(l),this._backdrop=t,this._modal=n,this._grid=l}_renderChars(e,t){e.innerHTML="";let n=t?t.toLowerCase():null;for(let i of yt){let o=n?i.chars.filter(l=>l.toLowerCase().includes(n)||i.label.toLowerCase().includes(n)):i.chars;if(o.length===0)continue;let s=document.createElement("div");s.className="npe-emoji-category-label",s.textContent=i.label,e.appendChild(s);let a=document.createElement("div");a.className="npe-emoji-row";for(let l of o){let c=document.createElement("button");c.type="button",c.className="npe-special-char-btn",c.textContent=l,c.setAttribute("title",l),c.setAttribute("aria-label",l),c.addEventListener("click",()=>{this._onInsert(l),this._onClose()}),a.appendChild(c)}e.appendChild(a)}if(e.children.length===0){let i=document.createElement("p");i.className="npe-emoji-empty",i.textContent="\u2014",e.appendChild(i)}}_filterChars(e,t){this._renderChars(t,e||null)}_show(){this._backdrop.appendChild(this._modal),this._hostEl.appendChild(this._backdrop),this._searchInput&&this._searchInput.focus(),this._onKeyDown=e=>S(e,this._modal,()=>this._onClose()),document.addEventListener("keydown",this._onKeyDown)}_teardown(){this._onKeyDown&&(document.removeEventListener("keydown",this._onKeyDown),this._onKeyDown=null),this._backdrop&&this._backdrop.parentNode&&this._backdrop.parentNode.removeChild(this._backdrop),this._backdrop=null,this._modal=null,this._searchInput=null,this._grid=null}};var de=class{constructor(e={}){this._opts=e.options||{},this._bus=e.bus||null,this._i18n=e.i18n||{t:t=>t},this._hostEl=e.hostEl||document.body,this._canvas=e.canvasManager||null,this._openId=null,this._savedRange=null,this._current=null,this._destroyed=!1,this._linkModal=null,this._imageModal=null,this._videoModal=null,this._tableModal=null,this._emojiPicker=null,this._specialCharsPicker=null}open(e,t={}){if(this._destroyed)return;this._openId&&this.close(),this._saveSelection(),this._openId=e;let n=this._getOrCreateModal(e);if(!n){this._openId=null;return}this._current=n,n.open(t)}close(){this._current&&(this._current.close(),this._current=null),this._openId=null,this._restoreSelection()}attachCanvas(e){this._canvas=e}destroy(){if(!this._destroyed){this._destroyed=!0,this.close();for(let e of["_linkModal","_imageModal","_videoModal","_tableModal","_emojiPicker","_specialCharsPicker"])this[e]&&typeof this[e].destroy=="function"&&this[e].destroy(),this[e]=null}}_saveSelection(){this._savedRange=null;let e=this._getIframeDoc();if(e)try{let t=e.getSelection();t&&t.rangeCount>0&&(this._savedRange=t.getRangeAt(0).cloneRange())}catch(t){}}_restoreSelection(){if(!this._savedRange)return;let e=this._getIframeDoc();if(e)try{let t=e.getSelection();t&&(t.removeAllRanges(),t.addRange(this._savedRange))}catch(t){}finally{this._savedRange=null}}_getOrCreateModal(e){let t={i18n:this._i18n,hostEl:this._hostEl,bus:this._bus,onClose:()=>this.close(),onInsert:n=>this._insert(n),options:this._opts,canvasManager:this._canvas};switch(e){case"link":return this._linkModal||(this._linkModal=new oe(t)),this._linkModal;case"image":return this._imageModal||(this._imageModal=new se(z(L({},t),{imageUploadHandler:this._opts.imageUploadHandler||null,allowDataUris:this._opts.allowDataUris===!0}))),this._imageModal;case"video":return this._videoModal||(this._videoModal=new ae(z(L({},t),{videoUploadHandler:this._opts.videoUploadHandler||null,allowDataUris:this._opts.allowDataUris===!0}))),this._videoModal;case"table":return this._tableModal||(this._tableModal=new re(t)),this._tableModal;case"emoji":return this._emojiPicker||(this._emojiPicker=new le(t)),this._emojiPicker;case"specialChars":return this._specialCharsPicker||(this._specialCharsPicker=new ce(t)),this._specialCharsPicker;default:return null}}_insert(e){if(!e)return;let t=this._getIframeDoc();if(!t){this._bus&&this._bus.emit("modal:insert",{html:e});return}this._restoreSelection();try{let n=t.getSelection();if(!n||n.rangeCount===0){let a=this._canvas?this._canvas.getBody():t.body;a&&a.insertAdjacentHTML("beforeend",e);return}let i=n.getRangeAt(0);i.deleteContents();let o=t.createElement("div");o.innerHTML=e;let s=t.createDocumentFragment();for(;o.firstChild;)s.appendChild(o.firstChild);i.insertNode(s),i.collapse(!1),n.removeAllRanges(),n.addRange(i)}catch(n){this._bus&&this._bus.emit("modal:insert",{html:e})}if(this._bus){let n=this._canvas?this._canvas.getBody():null;this._bus.emit("content:change",{html:n?n.innerHTML:""})}}_getIframeDoc(){if(!this._canvas)return null;try{return this._canvas.getDocument?this._canvas.getDocument():null}catch(e){return null}}};var he=class{constructor(e={}){this._serializer=e.contentSerializer||null,this._styleManager=e.styleManager||null,this._sanitizer=e.sanitizer||null,this._i18n=e.i18n||{t:t=>t},this._hostEl=e.hostEl||document.body,this._backdrop=null,this._modal=null,this._htmlArea=null,this._cssArea=null,this._onKeyDown=null,this._destroyed=!1}open(){this._modal||(this._build(),this._populate(),this._show())}close(){this._teardown()}destroy(){this._destroyed=!0,this._teardown()}_build(){let e=this._i18n.t.bind(this._i18n),t=document.createElement("div");t.className="npe-modal-backdrop",t.setAttribute("aria-hidden","true"),t.addEventListener("click",f=>{f.target===t&&this.close()});let n=document.createElement("div");n.className="npe-modal npe-source-modal",n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby","npe-source-title"),n.addEventListener("click",f=>f.stopPropagation());let i=document.createElement("div");i.className="npe-modal-header";let o=document.createElement("h2");o.id="npe-source-title",o.className="npe-modal-title",o.textContent=e("modal.source.title");let s=document.createElement("button");s.type="button",s.className="npe-modal-close",s.setAttribute("aria-label",e("modal.source.cancel")),s.textContent="\xD7",s.addEventListener("click",()=>this.close()),i.appendChild(o),i.appendChild(s);let a=document.createElement("div");a.className="npe-modal-tabs";let l=this._makeTab(e("modal.source.html"),"html",!0),c=this._makeTab(e("modal.source.css"),"css",!1);a.appendChild(l.btn),a.appendChild(c.btn);let d=document.createElement("div");d.className="npe-modal-panel npe-source-panel",d.id="npe-source-panel-html";let p=document.createElement("textarea");p.className="npe-source-textarea",p.setAttribute("aria-label",e("modal.source.html")),p.setAttribute("spellcheck","false"),p.setAttribute("autocomplete","off"),d.appendChild(p),this._htmlArea=p;let u=document.createElement("div");u.className="npe-modal-panel npe-source-panel",u.id="npe-source-panel-css",u.setAttribute("hidden","");let m=document.createElement("textarea");m.className="npe-source-textarea",m.setAttribute("aria-label",e("modal.source.css")),m.setAttribute("spellcheck","false"),m.setAttribute("autocomplete","off"),u.appendChild(m),this._cssArea=m,l.btn.addEventListener("click",()=>{l.btn.classList.add("npe-tab-active"),c.btn.classList.remove("npe-tab-active"),d.removeAttribute("hidden"),u.setAttribute("hidden","")}),c.btn.addEventListener("click",()=>{c.btn.classList.add("npe-tab-active"),l.btn.classList.remove("npe-tab-active"),u.removeAttribute("hidden"),d.setAttribute("hidden","")});let _=document.createElement("div");_.className="npe-modal-footer";let g=document.createElement("button");g.type="button",g.className="npe-btn npe-btn-primary",g.textContent=e("modal.source.apply"),g.addEventListener("click",()=>this._apply());let h=document.createElement("button");h.type="button",h.className="npe-btn",h.textContent=e("modal.source.cancel"),h.addEventListener("click",()=>this.close()),_.appendChild(h),_.appendChild(g),n.appendChild(i),n.appendChild(a),n.appendChild(d),n.appendChild(u),n.appendChild(_),this._backdrop=t,this._modal=n}_makeTab(e,t,n){let i=document.createElement("button");return i.type="button",i.className="npe-tab"+(n?" npe-tab-active":""),i.textContent=e,i.dataset.tab=t,{btn:i}}_populate(){this._htmlArea&&this._serializer&&(this._htmlArea.value=this._serializer.getContent()),this._cssArea&&this._styleManager&&(this._cssArea.value=this._styleManager.getStyles())}_show(){this._backdrop.appendChild(this._modal),this._hostEl.appendChild(this._backdrop),this._htmlArea&&this._htmlArea.focus(),this._onKeyDown=e=>this._handleKey(e),document.addEventListener("keydown",this._onKeyDown)}_handleKey(e){if(e.key==="Escape"){this.close();return}if(e.key==="Tab"&&this._modal){let t=Array.from(this._modal.querySelectorAll('button, textarea, [tabindex]:not([tabindex="-1"])')).filter(o=>!o.hasAttribute("disabled"));if(t.length===0)return;let n=t[0],i=t[t.length-1];e.shiftKey?document.activeElement===n&&(e.preventDefault(),i.focus()):document.activeElement===i&&(e.preventDefault(),n.focus())}}_apply(){if(this._cssArea&&this._styleManager&&this._styleManager.setStyles(this._cssArea.value),this._htmlArea&&this._serializer){let e=this._htmlArea.value,t=this._sanitizer?this._sanitizer.sanitize(e):e;this._serializer.setContent(t)}this.close()}_teardown(){this._onKeyDown&&(document.removeEventListener("keydown",this._onKeyDown),this._onKeyDown=null),this._backdrop&&this._backdrop.parentNode&&this._backdrop.parentNode.removeChild(this._backdrop),this._backdrop=null,this._modal=null,this._htmlArea=null,this._cssArea=null}};var pe=class{constructor(e={}){this._canvas=e.canvasManager||null,this._i18n=e.i18n||{t:t=>t},this._hostEl=e.hostEl||document.body,this._backdrop=null,this._modal=null,this._findInput=null,this._replaceInput=null,this._caseSensitiveCheck=null,this._regexCheck=null,this._matches=[],this._currentMatch=-1,this._MARK_CLASS="npe-fr-highlight",this._onKeyDown=null,this._destroyed=!1}open(){this._modal||(this._build(),this._show())}close(){this._clearHighlights(),this._teardown()}destroy(){this._destroyed=!0,this.close()}_build(){let e=this._i18n.t.bind(this._i18n),t=document.createElement("div");t.className="npe-modal-backdrop",t.setAttribute("aria-hidden","true"),t.addEventListener("click",w=>{w.target===t&&this.close()});let n=document.createElement("div");n.className="npe-modal npe-find-replace-modal",n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby","npe-fr-title"),n.addEventListener("click",w=>w.stopPropagation());let i=document.createElement("div");i.className="npe-modal-header";let o=document.createElement("h2");o.id="npe-fr-title",o.className="npe-modal-title",o.textContent=e("modal.findReplace.title");let s=document.createElement("button");s.type="button",s.className="npe-modal-close",s.setAttribute("aria-label",e("modal.findReplace.close")),s.textContent="\xD7",s.addEventListener("click",()=>this.close()),i.appendChild(o),i.appendChild(s);let a=document.createElement("div");a.className="npe-modal-body";let l=document.createElement("label");l.className="npe-form-label",l.setAttribute("for","npe-fr-find"),l.textContent=e("modal.findReplace.find");let c=document.createElement("input");c.type="text",c.id="npe-fr-find",c.className="npe-form-input",c.setAttribute("autocomplete","off"),c.setAttribute("spellcheck","false"),c.addEventListener("input",()=>this._runSearch()),this._findInput=c;let d=document.createElement("label");d.className="npe-form-label",d.setAttribute("for","npe-fr-replace"),d.textContent=e("modal.findReplace.replace");let p=document.createElement("input");p.type="text",p.id="npe-fr-replace",p.className="npe-form-input",p.setAttribute("autocomplete","off"),this._replaceInput=p;let u=document.createElement("div");u.className="npe-fr-options";let{check:m,label:_}=this._makeCheckbox("npe-fr-case",e("modal.findReplace.caseSensitive"));m.addEventListener("change",()=>this._runSearch()),this._caseSensitiveCheck=m;let{check:g,label:h}=this._makeCheckbox("npe-fr-regex",e("modal.findReplace.useRegex"));g.addEventListener("change",()=>this._runSearch()),this._regexCheck=g,u.appendChild(_),u.appendChild(h),a.appendChild(l),a.appendChild(c),a.appendChild(d),a.appendChild(p),a.appendChild(u);let f=document.createElement("div");f.className="npe-modal-footer";let b=document.createElement("button");b.type="button",b.className="npe-btn",b.textContent=e("modal.findReplace.findNext"),b.addEventListener("click",()=>this._findNext());let x=document.createElement("button");x.type="button",x.className="npe-btn",x.textContent=e("modal.findReplace.replaceOne"),x.addEventListener("click",()=>this._replaceCurrent());let v=document.createElement("button");v.type="button",v.className="npe-btn npe-btn-primary",v.textContent=e("modal.findReplace.replaceAll"),v.addEventListener("click",()=>this._replaceAll());let y=document.createElement("button");y.type="button",y.className="npe-btn",y.textContent=e("modal.findReplace.close"),y.addEventListener("click",()=>this.close()),f.appendChild(b),f.appendChild(x),f.appendChild(v),f.appendChild(y),n.appendChild(i),n.appendChild(a),n.appendChild(f),this._backdrop=t,this._modal=n}_makeCheckbox(e,t){let n=document.createElement("input");n.type="checkbox",n.id=e,n.className="npe-form-checkbox";let i=document.createElement("label");return i.setAttribute("for",e),i.className="npe-form-check-label",i.appendChild(n),i.appendChild(document.createTextNode(" "+t)),{check:n,label:i}}_show(){this._backdrop.appendChild(this._modal),this._hostEl.appendChild(this._backdrop),this._findInput&&this._findInput.focus(),this._onKeyDown=e=>this._handleKey(e),document.addEventListener("keydown",this._onKeyDown)}_handleKey(e){if(e.key==="Escape"){this.close();return}if(e.key==="Enter"&&document.activeElement===this._findInput){e.preventDefault(),this._findNext();return}if(e.key==="Tab"&&this._modal){let t=Array.from(this._modal.querySelectorAll('button, input, [tabindex]:not([tabindex="-1"])')).filter(o=>!o.hasAttribute("disabled"));if(t.length===0)return;let n=t[0],i=t[t.length-1];e.shiftKey?document.activeElement===n&&(e.preventDefault(),i.focus()):document.activeElement===i&&(e.preventDefault(),n.focus())}}_buildPattern(){let e=this._findInput?this._findInput.value:"";if(!e)return null;let t=this._caseSensitiveCheck&&this._caseSensitiveCheck.checked?"g":"gi",n=this._regexCheck&&this._regexCheck.checked;try{let i=n?e:e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(i,t)}catch(i){return null}}_runSearch(){this._clearHighlights(),this._matches=[],this._currentMatch=-1;let e=this._buildPattern();if(!e)return;let t=this._getBody();if(!t)return;let n=document.createTreeWalker?this._createWalker(t):null;if(!n)return;let i;for(;i=n.nextNode();){let o=i.textContent||"";e.lastIndex=0;let s;for(;(s=e.exec(o))!==null;)this._matches.push({node:i,index:s.index,length:s[0].length})}}_createWalker(e){try{let t=this._getIframeDoc();return t?t.createTreeWalker(e,4,null):null}catch(t){return null}}_findNext(){this._runSearch(),this._matches.length!==0&&(this._currentMatch=(this._currentMatch+1)%this._matches.length,this._highlightMatch(this._currentMatch))}_replaceCurrent(){if(this._runSearch(),this._matches.length===0)return;this._currentMatch<0&&(this._currentMatch=0);let e=this._replaceInput?this._replaceInput.value:"",t=this._matches[this._currentMatch];t&&(this._replaceMatchInNode(t,e),this._runSearch(),this._matches.length>0&&(this._currentMatch=Math.min(this._currentMatch,this._matches.length-1),this._highlightMatch(this._currentMatch)))}_replaceAll(){if(this._runSearch(),this._matches.length===0)return;let e=this._replaceInput?this._replaceInput.value:"",t=this._buildPattern();if(!t||!this._getBody())return;let i=Array.from(new Set(this._matches.map(o=>o.node)));for(let o of i){let s=o.textContent||"";t.lastIndex=0,o.textContent=s.replace(t,e)}this._matches=[],this._currentMatch=-1}_highlightMatch(e){this._clearHighlights();let t=this._matches[e];if(!t)return;let n=this._getIframeDoc();if(n)try{let i=t.node,o=i.textContent.slice(0,t.index),s=i.textContent.slice(t.index,t.index+t.length),a=i.textContent.slice(t.index+t.length),l=n.createElement("mark");l.className=this._MARK_CLASS,l.textContent=s;let c=i.parentNode;if(!c)return;let d=n.createDocumentFragment();o&&d.appendChild(n.createTextNode(o)),d.appendChild(l),a&&d.appendChild(n.createTextNode(a)),c.replaceChild(d,i),l.scrollIntoView&&l.scrollIntoView({block:"center",behavior:"smooth"})}catch(i){}}_clearHighlights(){let e=this._getBody();if(e)try{let t=Array.from(e.querySelectorAll("."+this._MARK_CLASS));for(let n of t){let i=n.parentNode;if(!i)continue;let o=n.textContent||"";i.replaceChild(document.createTextNode(o),n);try{i.normalize()}catch(s){}}}catch(t){}}_replaceMatchInNode(e,t){try{let n=e.node.textContent||"",i=n.slice(0,e.index)+t+n.slice(e.index+e.length);e.node.textContent=i}catch(n){}}_getIframeDoc(){if(!this._canvas)return null;try{return this._canvas.getDocument?this._canvas.getDocument():null}catch(e){return null}}_getBody(){if(!this._canvas)return null;try{return this._canvas.getBody?this._canvas.getBody():null}catch(e){return null}}_teardown(){this._onKeyDown&&(document.removeEventListener("keydown",this._onKeyDown),this._onKeyDown=null),this._backdrop&&this._backdrop.parentNode&&this._backdrop.parentNode.removeChild(this._backdrop),this._backdrop=null,this._modal=null,this._findInput=null,this._replaceInput=null,this._caseSensitiveCheck=null,this._regexCheck=null}};var ue=class{constructor(e={}){this._hostEl=e.hostEl||document.body,this._i18n=e.i18n||{t:t=>t},this._canvas=e.canvasManager||null,this._bus=e.bus||null,this._menu=null,this._targetCell=null,this._onDocClick=null,this._onKeyDown=null,this._destroyed=!1,this._attachIframeListener()}show(e,t){this.hide(),this._targetCell=t,this._build(e,t)}hide(){this._removeMenu(),this._targetCell=null}attachCanvas(e){this._canvas=e,this._attachIframeListener()}destroy(){this._destroyed||(this._destroyed=!0,this.hide(),this._detachIframeListener())}_build(e,t){let n=this._i18n.t.bind(this._i18n),i=document.createElement("div");i.className="npe-context-menu",i.setAttribute("role","menu");let o=[{key:"table.insertRowAbove",action:()=>this._insertRowAbove()},{key:"table.insertRowBelow",action:()=>this._insertRowBelow()},{separator:!0},{key:"table.insertColLeft",action:()=>this._insertColLeft()},{key:"table.insertColRight",action:()=>this._insertColRight()},{separator:!0},{key:"table.deleteRow",action:()=>this._deleteRow()},{key:"table.deleteColumn",action:()=>this._deleteColumn()},{key:"table.deleteTable",action:()=>this._deleteTable()},{separator:!0},{key:"table.mergeCells",action:()=>this._mergeCells()},{key:"table.splitCell",action:()=>this._splitCell()}];for(let a of o){if(a.separator){let c=document.createElement("div");c.className="npe-context-menu-sep",i.appendChild(c);continue}let l=document.createElement("button");l.type="button",l.className="npe-context-menu-item",l.setAttribute("role","menuitem"),l.textContent=n(a.key),l.addEventListener("click",()=>{a.action(),this.hide()}),i.appendChild(l)}i.style.position="fixed",i.style.zIndex="10000",i.style.left=e.x+"px",i.style.top=e.y+"px",this._hostEl.appendChild(i),this._menu=i,requestAnimationFrame(()=>{if(!i.isConnected)return;let a=i.getBoundingClientRect();a.right>window.innerWidth&&(i.style.left=Math.max(0,window.innerWidth-a.width-4)+"px"),a.bottom>window.innerHeight&&(i.style.top=Math.max(0,window.innerHeight-a.height-4)+"px")}),this._onDocClick=a=>{i&&!i.contains(a.target)&&this.hide()},this._onKeyDown=a=>{a.key==="Escape"&&this.hide()},setTimeout(()=>{document.addEventListener("click",this._onDocClick,{capture:!0}),document.addEventListener("keydown",this._onKeyDown)},0);let s=i.querySelector(".npe-context-menu-item");s&&s.focus()}_removeMenu(){this._onDocClick&&(document.removeEventListener("click",this._onDocClick,{capture:!0}),this._onDocClick=null),this._onKeyDown&&(document.removeEventListener("keydown",this._onKeyDown),this._onKeyDown=null),this._menu&&this._menu.parentNode&&this._menu.parentNode.removeChild(this._menu),this._menu=null}_attachIframeListener(){let e=this._getIframeDoc();if(e)try{this._iframeContextHandler=t=>{let n=t.target&&t.target.closest?t.target.closest("td,th"):null;if(!n)return;t.preventDefault();let i=this._canvas?this._canvas.iframe:null,o=t.clientX,s=t.clientY;if(i){let a=i.getBoundingClientRect();o=a.left+t.clientX,s=a.top+t.clientY}this.show({x:o,y:s},n)},e.addEventListener("contextmenu",this._iframeContextHandler)}catch(t){}}_detachIframeListener(){let e=this._getIframeDoc();if(!(!e||!this._iframeContextHandler)){try{e.removeEventListener("contextmenu",this._iframeContextHandler)}catch(t){}this._iframeContextHandler=null}}_insertRowAbove(){let e=this._targetCell;if(!e)return;let t=e.closest("tr");if(!t)return;let n=this._cloneEmptyRow(t);t.parentNode.insertBefore(n,t),this._notifyChange()}_insertRowBelow(){let e=this._targetCell;if(!e)return;let t=e.closest("tr");if(!t)return;let n=this._cloneEmptyRow(t);t.nextSibling?t.parentNode.insertBefore(n,t.nextSibling):t.parentNode.appendChild(n),this._notifyChange()}_insertColLeft(){let e=this._targetCell;if(!e)return;let t=e.closest("table");if(!t)return;let n=this._getCellColumnIndex(e);this._insertColumnAt(t,n),this._notifyChange()}_insertColRight(){let e=this._targetCell;if(!e)return;let t=e.closest("table");if(!t)return;let n=this._getCellColumnIndex(e);this._insertColumnAt(t,n+1),this._notifyChange()}_deleteRow(){let e=this._targetCell;if(!e)return;let t=e.closest("tr");if(!t)return;let n=t.parentNode;n.rows.length<=1||(n.removeChild(t),this._notifyChange())}_deleteColumn(){let e=this._targetCell;if(!e)return;let t=e.closest("table");if(!t)return;let n=this._getCellColumnIndex(e),i=Array.from(t.querySelectorAll("tr"));for(let o of i){if(o.cells.length<=1)continue;let s=o.cells[n];s&&o.removeChild(s)}this._notifyChange()}_deleteTable(){let e=this._targetCell;if(!e)return;let t=e.closest("table");!t||!t.parentNode||(t.parentNode.removeChild(t),this._notifyChange())}_mergeCells(){let e=this._targetCell;if(!e)return;let t=e.closest("tr");if(!t)return;let n=this._getCellColumnIndex(e),i=t.cells[n+1];if(!i)return;let o=parseInt(e.getAttribute("colspan")||"1",10),s=parseInt(i.getAttribute("colspan")||"1",10);for(e.setAttribute("colspan",String(o+s));i.firstChild;)e.appendChild(i.firstChild);t.removeChild(i),this._notifyChange()}_splitCell(){let e=this._targetCell;if(!e)return;let t=parseInt(e.getAttribute("colspan")||"1",10);if(t<=1)return;let n=e.closest("tr"),i=e.tagName.toLowerCase(),o=this._getIframeDoc();if(!n||!o)return;let s=e.nextSibling;for(let a=1;a<t;a++){let l=o.createElement(i);l.innerHTML="<br>",n.insertBefore(l,s)}e.removeAttribute("colspan"),this._notifyChange()}_getCellColumnIndex(e){let t=e.closest("tr");return t?Array.prototype.indexOf.call(t.cells,e):0}_cloneEmptyRow(e){let t=this._getIframeDoc()||document,n=t.createElement("tr");for(let i of Array.from(e.cells)){let o=i.tagName.toLowerCase()==="th"?"th":"td",s=t.createElement(o);s.innerHTML="<br>",n.appendChild(s)}return n}_insertColumnAt(e,t){let n=this._getIframeDoc()||document,i=Array.from(e.querySelectorAll("tr"));for(let o of i){let s=o.closest("thead")?"th":"td",a=n.createElement(s);a.innerHTML="<br>";let l=o.cells[t]||null;o.insertBefore(a,l)}}_notifyChange(){if(!this._bus)return;let e=this._canvas?this._canvas.getBody():null;e&&this._bus.emit("content:change",{html:e.innerHTML})}_getIframeDoc(){if(!this._canvas)return null;try{return this._canvas.getDocument?this._canvas.getDocument():null}catch(e){return null}}};var me=class{constructor(e={}){this._hostEl=e.hostEl||document.body,this._canvas=e.canvasManager||null,this._bus=e.bus||null,this._handle=null,this._dragging=!1,this._startX=0,this._startWidth=0,this._resizeCell=null,this._destroyed=!1,this._onMouseMove=null,this._onMouseUp=null,this._iframeMouseMove=null,this._iframeMouseLeave=null,this._createHandle(),this._attachIframeListeners()}attachCanvas(e){this._detachIframeListeners(),this._canvas=e,this._attachIframeListeners()}destroy(){this._destroyed||(this._destroyed=!0,this._detachIframeListeners(),this._removeHandle())}_createHandle(){let e=document.createElement("div");e.className="npe-col-resize-handle",e.style.position="fixed",e.style.width="6px",e.style.cursor="col-resize",e.style.zIndex="10001",e.style.display="none",e.style.top="0",e.style.height="0",this._hostEl.appendChild(e),this._handle=e,e.addEventListener("mousedown",t=>this._startDrag(t))}_removeHandle(){this._handle&&this._handle.parentNode&&this._handle.parentNode.removeChild(this._handle),this._handle=null}_attachIframeListeners(){let e=this._getIframeDoc();if(e){this._iframeMouseMove=t=>this._onIframeMouseMove(t),this._iframeMouseLeave=()=>this._hideHandle();try{e.addEventListener("mousemove",this._iframeMouseMove),e.addEventListener("mouseleave",this._iframeMouseLeave)}catch(t){}}}_detachIframeListeners(){let e=this._getIframeDoc();if(e){try{this._iframeMouseMove&&e.removeEventListener("mousemove",this._iframeMouseMove),this._iframeMouseLeave&&e.removeEventListener("mouseleave",this._iframeMouseLeave)}catch(t){}this._iframeMouseMove=null,this._iframeMouseLeave=null}}_onIframeMouseMove(e){if(this._dragging)return;let t=e.target;if(!t||!t.closest){this._hideHandle();return}let n=t.closest("td, th");if(!n){this._hideHandle();return}let i=this._getIframeRect();if(!i){this._hideHandle();return}let o=n.getBoundingClientRect(),s=i.left+o.left,a=i.top+o.top,l=s+o.width,c=a+o.height,d=i.left+e.clientX,p=6;d>=l-p&&d<=l+p?this._showHandle(l-3,a,o.height,n):this._hideHandle()}_showHandle(e,t,n,i){this._handle&&(this._handle.style.display="block",this._handle.style.left=e+"px",this._handle.style.top=t+"px",this._handle.style.height=n+"px",this._resizeCell=i)}_hideHandle(){this._handle&&(this._handle.style.display="none"),this._dragging||(this._resizeCell=null)}_startDrag(e){this._resizeCell&&(e.preventDefault(),this._dragging=!0,this._startX=e.clientX,this._startWidth=this._resizeCell.offsetWidth,this._onMouseMove=t=>this._doDrag(t),this._onMouseUp=t=>this._endDrag(t),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp))}_doDrag(e){if(!this._dragging||!this._resizeCell)return;let t=e.clientX-this._startX,n=Math.max(40,this._startWidth+t);if(this._resizeCell.style.width=n+"px",this._handle&&this._resizeCell){let i=this._getIframeRect();if(i){let o=this._resizeCell.getBoundingClientRect(),s=i.left+o.left+o.width;this._handle.style.left=s-3+"px"}}}_endDrag(e){this._dragging=!1,document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._onMouseMove=null,this._onMouseUp=null,this._notifyChange()}_notifyChange(){if(!this._bus)return;let e=this._canvas?this._canvas.getBody():null;e&&this._bus.emit("content:change",{html:e.innerHTML})}_getIframeRect(){if(!this._canvas||!this._canvas.iframe)return null;try{return this._canvas.iframe.getBoundingClientRect()}catch(e){return null}}_getIframeDoc(){if(!this._canvas)return null;try{return this._canvas.getDocument?this._canvas.getDocument():null}catch(e){return null}}};var xt=["nw","n","ne","e","se","s","sw","w"];var _e=class{constructor(e={}){this._hostEl=e.hostEl||document.body,this._canvas=e.canvasManager||null,this._bus=e.bus||null,this._i18n=e.i18n||{t:t=>t},this._selectedEl=null,this._border=null,this._handles=[],this._sizeLabel=null,this._toolbar=null,this._dragging=!1,this._dragHandle="",this._dragStartX=0,this._dragStartY=0,this._startW=0,this._startH=0,this._startLeft=0,this._startTop=0,this._aspectRatio=1,this._dragCover=null,this._onMouseMove=null,this._onMouseUp=null,this._onIframeClick=null,this._onIframeScroll=null,this._onDocClick=null,this._onWindowResize=null,this._destroyed=!1,this._createOverlayElements(),this._attachIframeListeners(),this._onWindowResize=()=>this._updatePosition(),window.addEventListener("resize",this._onWindowResize)}attachCanvas(e){this._detachIframeListeners(),this._canvas=e,this._attachIframeListeners()}select(e){this._selectElement(e)}deselect(){this._deselectElement()}destroy(){this._destroyed||(this._destroyed=!0,this._dragCover&&this._dragCover.parentNode&&(this._dragCover.parentNode.removeChild(this._dragCover),this._dragCover=null),this._onMouseMove&&(document.removeEventListener("mousemove",this._onMouseMove),this._onMouseMove=null),this._onMouseUp&&(document.removeEventListener("mouseup",this._onMouseUp),this._onMouseUp=null),this._deselectElement(),this._detachIframeListeners(),this._onWindowResize&&(window.removeEventListener("resize",this._onWindowResize),this._onWindowResize=null),this._removeAllOverlayElements())}_createOverlayElements(){let e=document.createElement("div");e.className="npe-img-select-border",e.style.display="none",this._hostEl.appendChild(e),this._border=e;for(let a of xt){let l=document.createElement("div");l.className=`npe-img-resize-handle npe-img-handle-${a}`,l.setAttribute("data-pos",a),l.style.display="none",this._hostEl.appendChild(l),this._handles.push(l),l.addEventListener("mousedown",c=>{c.preventDefault(),c.stopPropagation(),this._startResize(c,a)})}let t=document.createElement("div");t.className="npe-img-size-label",t.style.display="none",this._hostEl.appendChild(t),this._sizeLabel=t;let n=document.createElement("div");n.className="npe-img-toolbar",n.style.display="none",n.setAttribute("aria-label",this._i18n.t("overlay.media.toolbar"));let i=document.createElement("div");i.className="npe-img-toolbar-btn npe-img-drag-handle",i.title=this._i18n.t("overlay.media.drag"),i.setAttribute("aria-label",this._i18n.t("overlay.media.drag")),i.innerHTML="\u283F",i.addEventListener("mousedown",a=>this._startDragMove(a));let o=document.createElement("button");o.type="button",o.className="npe-img-toolbar-btn",o.title=this._i18n.t("overlay.media.replace"),o.setAttribute("aria-label",this._i18n.t("overlay.media.replace")),o.innerHTML="\u21BA",o.addEventListener("click",()=>this._replaceMedia());let s=document.createElement("button");s.type="button",s.className="npe-img-toolbar-btn npe-img-delete-btn",s.title=this._i18n.t("overlay.media.delete"),s.setAttribute("aria-label",this._i18n.t("overlay.media.delete")),s.innerHTML="\u2715",s.addEventListener("click",()=>this._deleteMedia()),n.appendChild(i),n.appendChild(o),n.appendChild(s),this._hostEl.appendChild(n),this._toolbar=n}_removeAllOverlayElements(){let e=[this._border,this._sizeLabel,this._toolbar,...this._handles];for(let t of e)t&&t.parentNode&&t.parentNode.removeChild(t);this._border=null,this._sizeLabel=null,this._toolbar=null,this._handles=[]}_attachIframeListeners(){let e=this._getIframeDoc();if(e){this._onIframeClick=t=>{let n=t.target;n&&(n.tagName==="IMG"||n.tagName==="VIDEO"?(t.preventDefault(),this._selectElement(n)):this._deselectElement())},this._onIframeScroll=()=>this._updatePosition();try{e.addEventListener("click",this._onIframeClick),e.addEventListener("scroll",this._onIframeScroll,{capture:!0})}catch(t){}this._onDocScroll=()=>this._updatePosition(),document.addEventListener("scroll",this._onDocScroll,{capture:!0,passive:!0})}}_detachIframeListeners(){let e=this._getIframeDoc();if(e)try{this._onIframeClick&&e.removeEventListener("click",this._onIframeClick),this._onIframeScroll&&e.removeEventListener("scroll",this._onIframeScroll,{capture:!0})}catch(t){}this._onDocScroll&&document.removeEventListener("scroll",this._onDocScroll,{capture:!0}),this._onIframeClick=null,this._onIframeScroll=null,this._onDocScroll=null}_selectElement(e){this._selectedEl=e,this._showOverlays(),this._updatePosition(),this._onDocClick||(this._onDocClick=t=>{[this._border,this._toolbar,...this._handles].some(i=>i&&i.contains(t.target))||this._deselectElement()},setTimeout(()=>{document.addEventListener("click",this._onDocClick,{capture:!0})},0))}_deselectElement(){this._selectedEl=null,this._hideOverlays(),this._onDocClick&&(document.removeEventListener("click",this._onDocClick,{capture:!0}),this._onDocClick=null)}_showOverlays(){this._border&&(this._border.style.display="block"),this._toolbar&&(this._toolbar.style.display="flex");for(let e of this._handles)e.style.display="block"}_hideOverlays(){this._border&&(this._border.style.display="none"),this._toolbar&&(this._toolbar.style.display="none"),this._sizeLabel&&(this._sizeLabel.style.display="none");for(let e of this._handles)e.style.display="none"}_updatePosition(){if(!this._selectedEl||!this._border)return;let e=this._getIframeRect();if(!e)return;let t=this._getIframeDoc(),n=t&&(t.documentElement.scrollTop||t.body.scrollTop)||0,i=t&&(t.documentElement.scrollLeft||t.body.scrollLeft)||0,o;try{o=this._selectedEl.getBoundingClientRect()}catch(d){return}let s=e.top+o.top-n,a=e.left+o.left-i,l=o.width,c=o.height;if(Ct(this._border,a,s,l,c),this._positionHandles(a,s,l,c),this._toolbar){let d=this._toolbar.getBoundingClientRect(),p=a+l/2-d.width/2;this._toolbar.style.left=Math.max(4,p)+"px",this._toolbar.style.top=s-d.height-6+"px"}}_positionHandles(e,t,n,i){let a={nw:{x:e-4,y:t-4},n:{x:e+n/2-4,y:t-4},ne:{x:e+n-4,y:t-4},e:{x:e+n-4,y:t+i/2-4},se:{x:e+n-4,y:t+i-4},s:{x:e+n/2-4,y:t+i-4},sw:{x:e-4,y:t+i-4},w:{x:e-4,y:t+i/2-4}};for(let l of this._handles){let c=l.getAttribute("data-pos"),d=a[c];d&&(l.style.left=d.x+"px",l.style.top=d.y+"px")}}_startResize(e,t){if(!this._selectedEl)return;let n=this._selectedEl;this._dragging=!0,this._dragHandle=t,this._dragStartX=e.clientX,this._dragStartY=e.clientY,this._startW=n.offsetWidth||n.naturalWidth||100,this._startH=n.offsetHeight||n.naturalHeight||100,this._aspectRatio=this._startH>0?this._startW/this._startH:1,this._showSizeLabel(this._startW,this._startH),this._dragCover=document.createElement("div"),this._dragCover.style.cssText=["position:fixed","inset:0","z-index:99999","cursor:"+wt(t)].join(";"),document.body.appendChild(this._dragCover),this._onMouseMove=i=>this._doResize(i),this._onMouseUp=i=>this._endResize(i),document.addEventListener("mousemove",this._onMouseMove),document.addEventListener("mouseup",this._onMouseUp)}_doResize(e){if(!this._dragging||!this._selectedEl)return;let t=e.clientX-this._dragStartX,n=e.clientY-this._dragStartY,i=this._dragHandle,o=this._startW,s=this._startH;i.includes("e")&&(o=this._startW+t),i.includes("w")&&(o=this._startW-t),i.includes("s")&&(s=this._startH+n),i.includes("n")&&(s=this._startH-n),o=Math.max(20,o),s=Math.max(20,s),!e.shiftKey&&this._aspectRatio>0&&(i==="n"||i==="s"?o=s*this._aspectRatio:i==="e"||i==="w"?s=o/this._aspectRatio:Math.abs(t)>=Math.abs(n)?s=o/this._aspectRatio:o=s*this._aspectRatio),o=Math.round(Math.max(20,o)),s=Math.round(Math.max(20,s));try{this._selectedEl.style.width=o+"px",this._selectedEl.style.height=s+"px"}catch(l){}this._updatePosition(),this._showSizeLabel(o,s)}_endResize(e){this._dragging=!1,document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._onMouseMove=null,this._onMouseUp=null,this._dragCover&&(this._dragCover.parentNode&&this._dragCover.parentNode.removeChild(this._dragCover),this._dragCover=null),this._sizeLabel&&(this._sizeLabel.style.display="none"),this._updatePosition(),this._notifyChange()}_startDragMove(e){if(!this._selectedEl)return;e.preventDefault(),e.stopPropagation();let t=this._selectedEl,n=e.clientX,i=e.clientY,o=parseInt(t.style.marginLeft||"0",10),s=parseInt(t.style.marginTop||"0",10),a=document.createElement("div");a.style.cssText="position:fixed;inset:0;z-index:99999;cursor:grab;",document.body.appendChild(a);let l=d=>{let p=d.clientX-n,u=d.clientY-i;try{t.style.marginLeft=o+p+"px",t.style.marginTop=s+u+"px"}catch(m){}this._updatePosition()},c=()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c),a.parentNode&&a.parentNode.removeChild(a),this._notifyChange()};document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)}_replaceMedia(){if(!this._selectedEl||!this._bus)return;let e=this._selectedEl.tagName.toLowerCase();this._bus.emit("overlay:replaceMedia",{element:this._selectedEl,type:e})}_deleteMedia(){if(!this._selectedEl)return;let e=this._selectedEl;this._deselectElement();try{e.parentNode&&e.parentNode.removeChild(e)}catch(t){}this._notifyChange()}_showSizeLabel(e,t){if(!this._sizeLabel||!this._border)return;this._sizeLabel.textContent=`${e} \xD7 ${t}`,this._sizeLabel.style.display="block";let n=this._border.getBoundingClientRect();this._sizeLabel.style.left=n.left+"px",this._sizeLabel.style.top=n.bottom+4+"px"}_notifyChange(){if(!this._bus)return;let e=this._canvas?this._canvas.getBody():null;e&&this._bus.emit("content:change",{html:e.innerHTML})}_getIframeRect(){if(!this._canvas||!this._canvas.iframe)return null;try{return this._canvas.iframe.getBoundingClientRect()}catch(e){return null}}_getIframeDoc(){if(!this._canvas)return null;try{return this._canvas.getDocument?this._canvas.getDocument():null}catch(e){return null}}};function Ct(r,e,t,n,i){r.style.position="fixed",r.style.left=e+"px",r.style.top=t+"px",r.style.width=n+"px",r.style.height=i+"px"}function wt(r){return{nw:"nw-resize",n:"n-resize",ne:"ne-resize",e:"e-resize",se:"se-resize",s:"s-resize",sw:"sw-resize",w:"w-resize"}[r]||"default"}var fe=class{constructor(e={}){this._hostEl=e.hostEl||document.body,this._canvas=e.canvasManager||null,this._bus=e.bus||null,this._i18n=e.i18n||{t:t=>t},this._el=null,this._showTimer=null,this._visible=!1,this._destroyed=!1,this._onSelectionChange=null,this._onMouseDown=null,this._onDocClick=null,this._onKeyDown=null,this._buildEl(),this._attachIframeListeners()}attachCanvas(e){this._detachIframeListeners(),this._canvas=e,this._attachIframeListeners()}show(e){!this._el||this._destroyed||(this._visible=!0,this._el.style.display="flex",this._positionAboveRect(e))}hide(){this._cancelShowTimer(),this._el&&(this._visible=!1,this._el.style.display="none")}destroy(){this._destroyed||(this._destroyed=!0,this._cancelShowTimer(),this._detachIframeListeners(),this._onDocClick&&(document.removeEventListener("click",this._onDocClick,{capture:!0}),this._onDocClick=null),this._onKeyDown&&(document.removeEventListener("keydown",this._onKeyDown),this._onKeyDown=null),this._el&&this._el.parentNode&&this._el.parentNode.removeChild(this._el),this._el=null)}_buildEl(){let e=i=>this._i18n.t(i),t=document.createElement("div");t.className="npe-floating-toolbar",t.setAttribute("role","toolbar"),t.setAttribute("aria-label",e("floatingToolbar.label")),t.style.display="none";let n=[{id:"moveUp",icon:'<svg viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"/></svg>',title:e("floatingToolbar.moveBlockUp"),action:()=>this._moveBlockUp()},{id:"moveDown",icon:'<svg viewBox="0 0 24 24"><path d="M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6z"/></svg>',title:e("floatingToolbar.moveBlockDown"),action:()=>this._moveBlockDown()},{separator:!0},{id:"bold",icon:'<svg viewBox="0 0 24 24"><path d="M15.6 10.79c.97-.67 1.65-1.77 1.65-2.79 0-2.26-1.75-4-4-4H7v14h7.04c2.09 0 3.71-1.7 3.71-3.79 0-1.52-.86-2.82-2.15-3.42zM10 6.5h3c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5h-3v-3zm3.5 9H10v-3h3.5c.83 0 1.5.67 1.5 1.5s-.67 1.5-1.5 1.5z"/></svg>',title:e("toolbar.bold"),action:()=>this._execCommand("bold")},{id:"italic",icon:'<svg viewBox="0 0 24 24"><path d="M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4z"/></svg>',title:e("toolbar.italic"),action:()=>this._execCommand("italic")},{id:"underline",icon:'<svg viewBox="0 0 24 24"><path d="M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z"/></svg>',title:e("toolbar.underline"),action:()=>this._execCommand("underline")},{id:"link",icon:'<svg viewBox="0 0 24 24"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></svg>',title:e("floatingToolbar.link"),action:()=>this._insertLink()}];for(let i of n){if(i.separator){let s=document.createElement("span");s.className="npe-floating-toolbar-sep",t.appendChild(s);continue}let o=document.createElement("button");o.type="button",o.className="npe-floating-toolbar-btn",o.title=i.title,o.setAttribute("aria-label",i.title),o.innerHTML=i.icon,o.addEventListener("mousedown",s=>{s.preventDefault()}),o.addEventListener("click",s=>{s.preventDefault(),s.stopPropagation(),i.action()}),t.appendChild(o)}this._hostEl.appendChild(t),this._el=t,this._onDocClick=i=>{this._el&&this._el.contains(i.target)||this.hide()},document.addEventListener("click",this._onDocClick,{capture:!0}),this._onKeyDown=i=>{i.key==="Escape"&&this.hide()},document.addEventListener("keydown",this._onKeyDown)}_positionAboveRect(e){if(!this._el)return;this._el.style.visibility="hidden",this._el.style.display="flex";let t=this._el.getBoundingClientRect();this._el.style.visibility="";let n=6,i=e.top-t.height-n,o=e.left+e.width/2-t.width/2;i<4&&(i=e.bottom+n),o<4&&(o=4),o+t.width>window.innerWidth-4&&(o=window.innerWidth-t.width-4),this._el.style.left=o+"px",this._el.style.top=i+"px"}_attachIframeListeners(){let e=this._getIframeDoc();if(e){this._onSelectionChange=()=>this._handleSelectionChange(),this._onMouseDown=()=>{this._cancelShowTimer(),this.hide()};try{e.addEventListener("selectionchange",this._onSelectionChange),e.addEventListener("mousedown",this._onMouseDown)}catch(t){}}}_detachIframeListeners(){let e=this._getIframeDoc();if(e){try{this._onSelectionChange&&e.removeEventListener("selectionchange",this._onSelectionChange),this._onMouseDown&&e.removeEventListener("mousedown",this._onMouseDown)}catch(t){}this._onSelectionChange=null,this._onMouseDown=null}}_handleSelectionChange(){this._cancelShowTimer();let e=this._getIframeSelection();if(!e||e.isCollapsed||e.rangeCount===0){this.hide();return}this._showTimer=setTimeout(()=>{this._showTimer=null;let t=this._getIframeSelection();if(!t||t.isCollapsed){this.hide();return}let n=this._getSelectionHostRect(t);n&&this.show(n)},400)}_getSelectionHostRect(e){try{let n=e.getRangeAt(0).getBoundingClientRect(),i=this._getIframeRect();if(!i)return null;let o=this._getIframeDoc(),s=o&&(o.documentElement.scrollTop||o.body.scrollTop)||0,a=o&&(o.documentElement.scrollLeft||o.body.scrollLeft)||0;return new DOMRect(i.left+n.left-a,i.top+n.top-s,n.width,n.height)}catch(t){return null}}_cancelShowTimer(){this._showTimer!==null&&(clearTimeout(this._showTimer),this._showTimer=null)}_execCommand(e){let t=this._getIframeDoc();if(t){try{t.execCommand(e,!1,null)}catch(n){}this._notifyChange()}}_insertLink(){this._bus&&this._bus.emit("toolbar:insert","link"),this.hide()}_moveBlockUp(){let e=this._getAnchorBlock();if(!e)return;let t=e.previousElementSibling;if(t){try{e.parentNode.insertBefore(e,t)}catch(n){}this._notifyChange(),this.hide()}}_moveBlockDown(){let e=this._getAnchorBlock();if(!e)return;let t=e.nextElementSibling;if(t){try{e.parentNode.insertBefore(t,e)}catch(n){}this._notifyChange(),this.hide()}}_getAnchorBlock(){let e=this._getIframeDoc(),t=this._canvas?this._canvas.getBody():null;if(!e||!t)return null;let n=this._getIframeSelection();if(!n||n.rangeCount===0)return null;let i=n.anchorNode;if(!i)return null;for(;i&&i.parentNode!==t;)i=i.parentNode;return i&&i!==t?i:null}_notifyChange(){if(!this._bus)return;let e=this._canvas?this._canvas.getBody():null;e&&this._bus.emit("content:change",{html:e.innerHTML})}_getIframeSelection(){let e=this._getIframeDoc();if(!e)return null;try{return e.getSelection?e.getSelection():null}catch(t){return null}}_getIframeRect(){if(!this._canvas||!this._canvas.iframe)return null;try{return this._canvas.iframe.getBoundingClientRect()}catch(e){return null}}_getIframeDoc(){if(!this._canvas)return null;try{return this._canvas.getDocument?this._canvas.getDocument():null}catch(e){return null}}};var be=class{constructor(e={}){this._hostEl=e.hostEl||document.body,this._canvas=e.canvasManager||null,this._bus=e.bus||null,this._opts=e.options||{},this._dragSrc=null,this._ghost=null,this._placeholder=null,this._dropTarget=null,this._dropBefore=!0,this._fileDragCount=0,this._onIframeDragStart=null,this._onIframeDragOver=null,this._onIframeDragEnd=null,this._onIframeElDragEnter=null,this._onIframeElDragOver=null,this._onIframeElDragLeave=null,this._onIframeElDrop=null,this._destroyed=!1,this._attachListeners()}attachCanvas(e){this._detachListeners(),this._canvas=e,this._attachListeners()}attachOptions(e){this._opts=e||{}}destroy(){this._destroyed||(this._destroyed=!0,this._cleanupBlockDrag(),this._detachListeners(),this._removeDraggableFromBlocks())}_attachListeners(){let e=this._canvas?this._canvas.iframe:null,t=this._getIframeDoc();if(t){this._onIframeDragStart=n=>this._handleBlockDragStart(n),this._onIframeDragOver=n=>this._handleBlockDragOver(n),this._onIframeDragEnd=n=>this._handleBlockDragEnd(n);try{t.addEventListener("dragstart",this._onIframeDragStart),t.addEventListener("dragover",this._onIframeDragOver),t.addEventListener("dragend",this._onIframeDragEnd)}catch(n){}this._addDraggableToBlocks()}e&&typeof e.addEventListener=="function"&&(this._onIframeElDragEnter=n=>this._handleFileDragEnter(n),this._onIframeElDragOver=n=>this._handleFileDragOver(n),this._onIframeElDragLeave=n=>this._handleFileDragLeave(n),this._onIframeElDrop=n=>this._handleFileDrop(n),e.addEventListener("dragenter",this._onIframeElDragEnter),e.addEventListener("dragover",this._onIframeElDragOver),e.addEventListener("dragleave",this._onIframeElDragLeave),e.addEventListener("drop",this._onIframeElDrop))}_detachListeners(){let e=this._canvas?this._canvas.iframe:null,t=this._getIframeDoc();if(t){try{this._onIframeDragStart&&t.removeEventListener("dragstart",this._onIframeDragStart),this._onIframeDragOver&&t.removeEventListener("dragover",this._onIframeDragOver),this._onIframeDragEnd&&t.removeEventListener("dragend",this._onIframeDragEnd)}catch(n){}this._onIframeDragStart=null,this._onIframeDragOver=null,this._onIframeDragEnd=null}e&&typeof e.removeEventListener=="function"&&(e.removeEventListener("dragenter",this._onIframeElDragEnter),e.removeEventListener("dragover",this._onIframeElDragOver),e.removeEventListener("dragleave",this._onIframeElDragLeave),e.removeEventListener("drop",this._onIframeElDrop),this._onIframeElDragEnter=null,this._onIframeElDragOver=null,this._onIframeElDragLeave=null,this._onIframeElDrop=null)}_addDraggableToBlocks(){let e=this._canvas?this._canvas.getBody():null;if(e)try{for(let t of Array.from(e.children))t.setAttribute("draggable","true")}catch(t){}}_removeDraggableFromBlocks(){let e=this._canvas?this._canvas.getBody():null;if(e)try{for(let t of Array.from(e.children))t.removeAttribute("draggable")}catch(t){}}_handleBlockDragStart(e){let t=this._canvas?this._canvas.getBody():null;if(!t)return;let n=this._getDirectBodyChild(e.target,t);if(n){this._dragSrc=n;try{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain","")}catch(i){}this._createGhost(n);try{let i=document.createElement("div");i.style.cssText="position:fixed;top:-9999px",document.body.appendChild(i),e.dataTransfer.setDragImage(i,0,0),setTimeout(()=>{i.parentNode&&i.parentNode.removeChild(i)},0)}catch(i){}try{n.style.opacity="0.4"}catch(i){}}}_handleBlockDragOver(e){if(!this._dragSrc)return;e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="move");let t=this._canvas?this._canvas.getBody():null;if(!t)return;let n=this._getDirectBodyChild(e.target,t);if(!n||n===this._dragSrc){this._hidePlaceholder(),this._dropTarget=null;return}let i=!0;try{let o=n.getBoundingClientRect();i=e.clientY-o.top<o.height/2}catch(o){}(n!==this._dropTarget||i!==this._dropBefore)&&(this._dropTarget=n,this._dropBefore=i,this._showPlaceholder(n,i)),this._moveGhost(e)}_handleBlockDragEnd(e){if(this._dragSrc&&this._dropTarget){let t=this._dropTarget.parentNode;if(t){try{if(this._dropBefore)t.insertBefore(this._dragSrc,this._dropTarget);else{let n=this._dropTarget.nextSibling;n?t.insertBefore(this._dragSrc,n):t.appendChild(this._dragSrc)}}catch(n){}this._notifyChange()}}this._cleanupBlockDrag()}_handleFileDragEnter(e){this._hasFiles(e)&&(e.preventDefault(),this._fileDragCount++,this._showFileDragStyle())}_handleFileDragOver(e){this._hasFiles(e)&&(e.preventDefault(),e.dataTransfer.dropEffect="copy")}_handleFileDragLeave(e){this._hasFiles(e)&&(e.relatedTarget&&e.currentTarget.contains(e.relatedTarget)||(this._fileDragCount=0,this._hideFileDragStyle()))}_handleFileDrop(e){e.preventDefault(),this._fileDragCount=0,this._hideFileDragStyle();let t=e.dataTransfer?Array.from(e.dataTransfer.files):[];if(t.length===0)return;let n=t.filter(h=>h.type.startsWith("image/")),i=t.filter(h=>h.type.startsWith("video/"));if(n.length===0&&i.length===0)return;let o=this._canvas?this._canvas.iframe:null,s=this._getIframeDoc();if(!o||!s)return;let a=o.getBoundingClientRect(),l=s.documentElement.scrollTop||s.body.scrollTop||0,c=s.documentElement.scrollLeft||s.body.scrollLeft||0,d=e.clientX-a.left+c,p=e.clientY-a.top+l,u=()=>{if(s)try{let h=null;if(s.caretRangeFromPoint){let f=e.clientX-a.left,b=e.clientY-a.top;h=s.caretRangeFromPoint(f,b)}else if(s.caretPositionFromPoint){let f=e.clientX-a.left,b=e.clientY-a.top,x=s.caretPositionFromPoint(f,b);x&&(h=s.createRange(),h.setStart(x.offsetNode,x.offset),h.collapse(!0))}if(h){let f=s.getSelection();f&&(f.removeAllRanges(),f.addRange(h))}}catch(h){}},m=h=>String(h).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">"),_=h=>{u();try{s.execCommand("insertHTML",!1,h)}catch(f){this._bus&&this._bus.emit("canvas:insert",{html:h});return}this._notifyChange()},g=async(h,f)=>{let b=f==="image",x=b?this._opts&&this._opts.imageUploadHandler:this._opts&&this._opts.videoUploadHandler;if(typeof x=="function"){try{let v=await x(h);if(v){let y=b?`<img src="${m(v)}" alt="${m(h.name)}">`:`<video src="${m(v)}" controls style="max-width:100%"></video>`;_(y)}}catch(v){}return}await new Promise(v=>{let y=new FileReader;y.onload=w=>{let k=w.target.result,N=b?`<img src="${m(k)}" alt="${m(h.name)}">`:`<video src="${m(k)}" controls style="max-width:100%"></video>`;_(N),v()},y.onerror=()=>v(),y.readAsDataURL(h)})};(async()=>{for(let h of n)await g(h,"image");for(let h of i)await g(h,"video")})()}_hasFiles(e){if(!e.dataTransfer)return!1;let t=e.dataTransfer.types;return t?typeof t.includes=="function"?t.includes("Files"):typeof t.contains=="function"&&t.contains("Files"):!1}_showFileDragStyle(){let e=this._canvas?this._canvas.iframe:null;e&&(e.style.outline="3px dashed #0057cc")}_hideFileDragStyle(){let e=this._canvas?this._canvas.iframe:null;e&&(e.style.outline="")}_createGhost(e){let t=this._getIframeRect();if(!t)return;let n;try{n=e.getBoundingClientRect()}catch(o){return}let i=document.createElement("div");i.className="npe-block-drag-ghost",i.style.cssText=["position:fixed",`left:${t.left+n.left}px`,`top:${t.top+n.top}px`,`width:${n.width}px`,`height:${n.height}px`,"pointer-events:none","z-index:20000","background:rgba(0,87,204,0.08)","border:2px dashed #0057cc","border-radius:3px"].join(";"),document.body.appendChild(i),this._ghost=i}_moveGhost(e){this._ghost&&(this._ghost.style.left=e.clientX+12+"px",this._ghost.style.top=e.clientY+12+"px")}_removeGhost(){this._ghost&&this._ghost.parentNode&&this._ghost.parentNode.removeChild(this._ghost),this._ghost=null}_showPlaceholder(e,t){let n=this._getIframeDoc();if(!n)return;this._removePlaceholder();let i=n.createElement("div");i.style.cssText=["height:3px","margin:2px 0","background:#0057cc","border-radius:2px","pointer-events:none","opacity:0.85"].join(";");try{if(t)e.parentNode.insertBefore(i,e);else{let o=e.nextSibling;o?e.parentNode.insertBefore(i,o):e.parentNode.appendChild(i)}}catch(o){}this._placeholder=i}_hidePlaceholder(){this._removePlaceholder()}_removePlaceholder(){this._placeholder&&this._placeholder.parentNode&&this._placeholder.parentNode.removeChild(this._placeholder),this._placeholder=null}_cleanupBlockDrag(){if(this._dragSrc)try{this._dragSrc.style.opacity=""}catch(e){}this._removeGhost(),this._removePlaceholder(),this._dragSrc=null,this._dropTarget=null,this._dropBefore=!0}_getDirectBodyChild(e,t){if(!e)return null;let n=e.nodeType===3?e.parentElement:e;for(;n&&n.parentNode!==t;)n=n.parentElement;return n&&n!==t?n:null}_notifyChange(){if(!this._bus)return;let e=this._canvas?this._canvas.getBody():null;e&&this._bus.emit("content:change",{html:e.innerHTML})}_getIframeRect(){if(!this._canvas||!this._canvas.iframe)return null;try{return this._canvas.iframe.getBoundingClientRect()}catch(e){return null}}_getIframeDoc(){if(!this._canvas)return null;try{return this._canvas.getDocument?this._canvas.getDocument():null}catch(e){return null}}};var ge=class{constructor(e={}){this._hostEl=e.hostEl||document.body,this._canvas=e.canvasManager||null,this._bus=e.bus||null,this._i18n=e.i18n||{t:t=>t},this._opts=e.options||{},this._destroyed=!1,this._tableContextMenu=new ue({hostEl:this._hostEl,i18n:this._i18n,canvasManager:this._canvas,bus:this._bus}),this._tableResize=new me({hostEl:this._hostEl,canvasManager:this._canvas,bus:this._bus}),this._imageResize=new _e({hostEl:this._hostEl,canvasManager:this._canvas,bus:this._bus,i18n:this._i18n}),this._floatingToolbar=new fe({hostEl:this._hostEl,canvasManager:this._canvas,bus:this._bus,i18n:this._i18n}),this._blockDragDrop=new be({hostEl:this._hostEl,canvasManager:this._canvas,bus:this._bus,options:this._opts}),this._onResize=()=>this.update(),window.addEventListener("resize",this._onResize)}attachCanvas(e){this._canvas=e,this._tableContextMenu.attachCanvas(e),this._tableResize.attachCanvas(e),this._imageResize.attachCanvas(e),this._floatingToolbar.attachCanvas(e),this._blockDragDrop.attachCanvas(e)}update(){this._imageResize&&this._imageResize._updatePosition()}getImageResize(){return this._imageResize}getFloatingToolbar(){return this._floatingToolbar}destroy(){this._destroyed||(this._destroyed=!0,this._tableContextMenu.destroy(),this._tableResize.destroy(),this._imageResize.destroy(),this._floatingToolbar.destroy(),this._blockDragDrop.destroy(),window.removeEventListener("resize",this._onResize))}};var ve=class{constructor(e,t,n){this._wrapper=e,this._opts=t,this._bus=n,this._iframe=null,this._destroyed=!1,this._onInput=null,this._onSelectionChange=null,this._onFocus=null,this._onBlur=null,this._onWrapperClick=null,this._create()}_create(){let e=document.createElement("iframe");e.setAttribute("sandbox","allow-same-origin"),e.className="npe-canvas",e.setAttribute("title","Page editor canvas"),e.setAttribute("aria-label","Page editor canvas"),e.setAttribute("referrerpolicy","no-referrer"),this._wrapper.appendChild(e),this._iframe=e;let t=this._wrapper.style.minHeight;t&&(e.style.minHeight=t),this._writeDocument(),this._attachListeners()}_writeDocument(){let e=this._getDoc();if(!e)return;let t=this._opts.assetsBaseUrl?`<base href="${kt(this._opts.assetsBaseUrl)}">`:"",n=this._opts.spellcheck!==!1?"true":"false",i=`<!DOCTYPE html>
|
|
7
|
+
<html style="height:100%">
|
|
8
|
+
<head>
|
|
9
|
+
<meta charset="UTF-8">
|
|
10
|
+
${t}
|
|
11
|
+
<style id="npe-base">
|
|
12
|
+
html { height: 100%; }
|
|
13
|
+
body {
|
|
14
|
+
min-height: 100%;
|
|
15
|
+
margin: 0;
|
|
16
|
+
padding: 16px 20px;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
outline: none;
|
|
19
|
+
word-wrap: break-word;
|
|
20
|
+
overflow-wrap: break-word;
|
|
21
|
+
}
|
|
22
|
+
body:focus { outline: none; }
|
|
23
|
+
/* Prevent table layout from jumping during editing */
|
|
24
|
+
table {
|
|
25
|
+
border-collapse: collapse;
|
|
26
|
+
table-layout: fixed;
|
|
27
|
+
}
|
|
28
|
+
td, th {
|
|
29
|
+
min-width: 40px;
|
|
30
|
+
vertical-align: top;
|
|
31
|
+
}
|
|
32
|
+
</style>
|
|
33
|
+
<style id="npe-page"></style>
|
|
34
|
+
<style id="npe-helper"></style>
|
|
35
|
+
</head>
|
|
36
|
+
<body contenteditable="true" spellcheck="${n}">
|
|
37
|
+
</body>
|
|
38
|
+
</html>`;e.open(),e.write(i),e.close()}_attachListeners(){let e=this._getDoc();if(!e)return;this._onInput=()=>{if(this._destroyed)return;let n=this.getBody();this._bus.emit("content:change",{html:n?n.innerHTML:""})},this._onSelectionChange=()=>{this._destroyed||this._bus.emit("selection:change",{selection:e.getSelection?e.getSelection():null})},this._onFocus=()=>{this._destroyed||this._bus.emit("canvas:focus")},this._onBlur=()=>{this._destroyed||this._bus.emit("canvas:blur")},e.addEventListener("input",this._onInput),e.addEventListener("selectionchange",this._onSelectionChange);let t=this.getBody();t&&(t.addEventListener("focus",this._onFocus),t.addEventListener("blur",this._onBlur)),this._onWrapperClick=n=>{if(this._destroyed)return;let i=this.getBody();if(i&&document.activeElement!==this._iframe){this._iframe.focus();try{let o=this._getDoc();if(o){let s=o.getSelection();if(!s||s.rangeCount===0){let a=o.createRange();a.selectNodeContents(i),a.collapse(!1),s.removeAllRanges(),s.addRange(a)}}}catch(o){}}},this._wrapper.addEventListener("click",this._onWrapperClick)}_removeListeners(){let e=this._getDoc();e&&this._onInput&&(e.removeEventListener("input",this._onInput),e.removeEventListener("selectionchange",this._onSelectionChange));let t=this.getBody();t&&(this._onFocus&&t.removeEventListener("focus",this._onFocus),this._onBlur&&t.removeEventListener("blur",this._onBlur)),this._onInput=null,this._onSelectionChange=null,this._onFocus=null,this._onBlur=null,this._wrapper&&this._onWrapperClick&&(this._wrapper.removeEventListener("click",this._onWrapperClick),this._onWrapperClick=null)}_getDoc(){try{return this._iframe?this._iframe.contentDocument:null}catch(e){return null}}get iframe(){return this._iframe}getIframe(){return this._iframe}getDocument(){return this._getDoc()}getBody(){let e=this._getDoc();return e?e.body:null}destroy(){this._destroyed||(this._destroyed=!0,this._removeListeners(),this._iframe&&this._iframe.parentNode&&this._iframe.parentNode.removeChild(this._iframe),this._iframe=null)}};function kt(r){return r.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var ye=class{constructor(e,t){this._canvas=e||null,this._sanitizer=t||null}getContent(){let e=this._getBody();if(!e)return"";let t=e.cloneNode(!0),n=t.querySelectorAll('[class*="npe-"]');for(let i of Array.from(n))i.parentNode&&i.parentNode.removeChild(i);return t.innerHTML}setContent(e){let t=this._getBody();if(!t)return;let n=this._sanitizer?this._sanitizer.sanitize(e):e;t.innerHTML=n}getText(){let e=this._getBody();return e&&e.textContent||""}isEmpty(){if(this.getText().trim()!=="")return!1;let t=this._getBody();return t?t.querySelector("img, video, hr, br, table")===null:!0}_getBody(){return this._canvas&&this._canvas.getBody?this._canvas.getBody():null}};var Et=`
|
|
39
|
+
/* npe-base: minimal editing reset \u2014 must not override page layout */
|
|
40
|
+
[contenteditable]:focus { outline: none; }
|
|
41
|
+
`.trim(),Lt=`
|
|
42
|
+
/* npe-helper: non-invasive editing helpers */
|
|
43
|
+
`.trim(),xe=class{constructor(e,t){this._canvas=e||null,this._opts=t||{},this._doc=null,this._initialized=!1,this._extractedStyleEls=[]}init(e,t){this._doc=e,t&&(this._opts=t),this._initialized=!0,this._applyBaseStyles(),this._applyExternalLinks(),this._applyPageStyles(),this._applyHelperStyles()}_getHead(){return this._doc?this._doc.head:null}_getStyleEl(e){return this._doc?this._doc.getElementById(e):null}_applyBaseStyles(){let e=this._getStyleEl("npe-base");e&&(e.textContent=Et)}_applyExternalLinks(){let e=Array.isArray(this._opts.cssUrls)?this._opts.cssUrls:[];this.setExternalLinks(e)}_applyPageStyles(){let e=typeof this._opts.pageStyles=="string"?this._opts.pageStyles:"";this.setStyles(e)}_applyHelperStyles(){let e=this._getStyleEl("npe-helper");e&&(e.textContent=Lt)}_repositionExtractedStyles(){let e=this._getHead(),t=this._getStyleEl("npe-helper");if(!(!e||!t))for(let n of this._extractedStyleEls)e.insertBefore(n,t)}getStyles(){let e=this._getStyleEl("npe-page");return e&&e.textContent||""}setStyles(e){let t=this._getStyleEl("npe-page");t&&(t.textContent=typeof e=="string"?e:"")}addExtractedStyleBlocks(e){let t=this._getHead();if(!t)return;for(let i of this._extractedStyleEls)i.parentNode&&i.parentNode.removeChild(i);if(this._extractedStyleEls=[],!Array.isArray(e)||e.length===0)return;let n=this._getStyleEl("npe-helper");for(let i of e){if(typeof i!="string"||!i.trim())continue;let o=this._doc.createElement("style");o.setAttribute("data-npe-extracted",""),o.textContent=i,this._extractedStyleEls.push(o),n?t.insertBefore(o,n):t.appendChild(o)}}setExternalLinks(e){let t=this._getHead();if(!t)return;let n=Array.from(t.querySelectorAll("link[data-npe-external]"));for(let s of n)s.parentNode&&s.parentNode.removeChild(s);if(!Array.isArray(e)||e.length===0)return;let i=typeof this._opts.stylesheetUrlValidator=="function"?this._opts.stylesheetUrlValidator:zt,o=this._getStyleEl("npe-page");for(let s of e){if(typeof s!="string"||!i(s))continue;let a=this._doc.createElement("link");a.setAttribute("rel","stylesheet"),a.setAttribute("href",s),a.setAttribute("data-npe-external",""),o?t.insertBefore(a,o):t.appendChild(a)}}destroy(){this._doc=null,this._extractedStyleEls=[],this._initialized=!1}};function zt(r){if(!r||typeof r!="string")return!1;let e=r.trim();if(/^data:/i.test(e))return!1;let t=e.match(/^([a-z][a-z0-9+\-.]*):\/\//i);if(t){let s=t[1].toLowerCase();if(s!=="http"&&s!=="https")return!1}let n=e,i=n.indexOf("#");i!==-1&&(n=n.slice(0,i));let o=n.indexOf("?");return o!==-1&&(n=n.slice(0,o)),n.endsWith(".css")}var St=new Set(["script","iframe","object","embed","form","input","button","select","textarea","meta","base","link","style","head","noscript","template","slot","canvas","applet","frame","frameset"]),At=new Set(["div","section","article","main","header","footer","nav","aside","figure","figcaption","p","h1","h2","h3","h4","h5","h6","blockquote","pre","hr","br","span","strong","em","u","s","sub","sup","code","a","img","video","ul","ol","li","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","details","summary","mark","small","abbr","cite","q","del","ins","kbd","samp","var","time","address","bdi","bdo","ruby","rt","rp","wbr","data"]),Mt=new Set(["class","id","style","title","lang","dir","tabindex"]),Dt={a:new Set(["href","target","rel","download"]),img:new Set(["src","alt","width","height","loading","decoding","srcset","sizes"]),video:new Set(["src","poster","controls","width","height","autoplay","muted","loop","preload"]),td:new Set(["colspan","rowspan","headers"]),th:new Set(["colspan","rowspan","scope","headers","abbr"]),col:new Set(["span"]),colgroup:new Set(["span"]),time:new Set(["datetime"]),ins:new Set(["cite","datetime"]),del:new Set(["cite","datetime"]),ol:new Set(["start","reversed","type"]),li:new Set(["value"]),details:new Set(["open"]),table:new Set(["cellpadding","cellspacing","border","summary","width"])},It={href:null,src:null,poster:null,action:null,data:null},Tt=new Set(["image/png","image/jpeg","image/gif","image/webp","image/avif","video/mp4","video/webm"]),Nt=new Set(["img","video"]),Ht="src";var Bt=/^\s*data:([^;,]+)[;,]/i;function Rt(r,e,t,n){let i=r.trim();if(/^\s*data:/i.test(i)){if(!n||!Nt.has(e)||t!==Ht)return!1;let s=i.match(Bt);if(!s)return!1;let a=s[1].trim().toLowerCase();return Tt.has(a)}let o=i.replace(/&#x([0-9a-f]+);?/gi,(s,a)=>String.fromCharCode(parseInt(a,16))).replace(/&#([0-9]+);?/gi,(s,a)=>String.fromCharCode(parseInt(a,10))).replace(/[\x00-\x20]/g,"");return!/^(javascript|vbscript):/i.test(o)}function Pt(r,e){if(/^on/i.test(r))return!1;if(Mt.has(r)||/^data-[a-z]/i.test(r)||/^aria-[a-z]/i.test(r))return!0;let t=Dt[e];return!!(t&&t.has(r))}function qe(r,e,t){if(r.nodeType===Node.TEXT_NODE)return[e.createTextNode(r.textContent)];if(r.nodeType!==Node.ELEMENT_NODE)return[];let n=r.tagName.toLowerCase();if(St.has(n))return[];let i=At.has(n),o=[];for(let a of Array.from(r.childNodes))o.push(...qe(a,e,t));if(!i)return o;let s=e.createElement(n);for(let a of Array.from(r.attributes)){let l=a.name.toLowerCase(),c=a.value;if(Pt(l,n)&&!((l in It||l==="src"||l==="href"||l==="poster")&&!Rt(c,n,l,t))){if(l==="style"){let d=Ut(c);d&&s.setAttribute("style",d);continue}s.setAttribute(l,c)}}for(let a of o)s.appendChild(a);return[s]}function Ut(r){if(!r)return"";let e=r.replace(/expression\s*\(/gi,"BLOCKED(");return e=e.replace(/url\s*\(\s*(['"]?)(javascript|vbscript|data):[^)]*\1\s*\)/gi,"url(about:blank)"),e}var Ce=class{constructor(e={}){this._allowDataUris=e.allowDataUris===!0}sanitize(e){if(typeof e!="string"||e==="")return"";let t;try{t=new DOMParser().parseFromString(e,"text/html")}catch(a){return""}let n=document.implementation.createHTMLDocument(""),i=n.createDocumentFragment(),o=t.body;if(!o)return"";for(let a of Array.from(o.childNodes)){let l=qe(a,n,this._allowDataUris);for(let c of l)i.appendChild(c)}let s=n.createElement("div");return s.appendChild(i),s.innerHTML.trim()}};var we=class{parse(e,t={}){if(!e||typeof e!="string")return{bodyHtml:"",styleBlocks:[],cssUrls:[]};let n=t&&typeof t.stylesheetUrlValidator=="function"?t.stylesheetUrlValidator:Ft,i;try{i=new DOMParser().parseFromString(e,"text/html")}catch(p){return{bodyHtml:"",styleBlocks:[],cssUrls:[]}}let o=i.body?i.body.innerHTML:"",s=[],a=i.head?Array.from(i.head.querySelectorAll("style")):[];for(let p of a){let u=p.textContent;u&&u.trim()&&s.push(u)}let l=i.body?Array.from(i.body.querySelectorAll("style")):[];for(let p of l){let u=p.textContent;u&&u.trim()&&s.push(u)}let c=[],d=Array.from(i.querySelectorAll('link[rel="stylesheet"]'));for(let p of d){let u=p.getAttribute("href");u&&n(u)&&c.push(u)}return{bodyHtml:o,styleBlocks:s,cssUrls:c}}};function Ft(r){if(!r||typeof r!="string")return!1;let e=r.trim();if(/^data:/i.test(e))return!1;let t=e.match(/^([a-z][a-z0-9+\-.]*):\/\//i);if(t){let s=t[1].toLowerCase();if(s!=="http"&&s!=="https")return!1}let n=e,i=n.indexOf("#");i!==-1&&(n=n.slice(0,i));let o=n.indexOf("?");return o!==-1&&(n=n.slice(0,o)),n.endsWith(".css")}var Te={light:null,dark:"npe-dark",blue:"npe-theme-blue","dark-blue":"npe-theme-dark-blue",midnight:"npe-theme-midnight"},Ge="npe-theme",ke=class{constructor(e,t="light",n=!1){if(this._shell=e,this._persist=n,this._current=T.includes(t)?t:"light",this._persist){let i=this._readStorage();i&&(this._current=i)}this._apply(this._current)}setTheme(e){T.includes(e)&&(this._current=e,this._apply(e),this._persist&&this._writeStorage(e))}toggleTheme(){let e=T.indexOf(this._current),t=T[(e+1)%T.length];this.setTheme(t)}getTheme(){return this._current}destroy(){for(let e of Object.values(Te))e&&this._shell.classList.remove(e)}_apply(e){for(let n of Object.values(Te))n&&this._shell.classList.remove(n);let t=Te[e];t&&this._shell.classList.add(t)}_readStorage(){try{return localStorage.getItem(Ge)||null}catch(e){return null}}_writeStorage(e){try{localStorage.setItem(Ge,e)}catch(t){}}};var Ee=class{constructor(e,t,n){this._container=e,this._bus=t,this._i18n=n,this._words=0,this._chars=0,this._block="",this._autosaveStatus="off",this._lastSaveTime=null,this._agoTimer=null,this._wordEl=null,this._charEl=null,this._blockEl=null,this._autosaveEl=null,this._render(),this._bindBusEvents()}update(e={}){typeof e.words=="number"&&(this._words=e.words),typeof e.chars=="number"&&(this._chars=e.chars),typeof e.block=="string"&&(this._block=e.block),typeof e.autosaveStatus=="string"&&(this._autosaveStatus=e.autosaveStatus),e.lastSaveTime!==void 0&&(this._lastSaveTime=e.lastSaveTime),this._updateDOM()}destroy(){this._clearAgoTimer(),this._container&&(this._container.innerHTML=""),this._offHandlers()}_render(){this._container&&(this._container.innerHTML="",this._wordEl=this._makeItem("statusbar.words","0"),this._charEl=this._makeItem("statusbar.characters","0"),this._blockEl=this._makeItem("statusbar.block",""),this._autosaveEl=this._makeItem("statusbar.autosave",this._i18n.t("statusbar.autosave.off")),this._container.appendChild(this._wordEl.wrapper),this._container.appendChild(this._charEl.wrapper),this._container.appendChild(this._blockEl.wrapper),this._container.appendChild(this._autosaveEl.wrapper))}_makeItem(e,t){let n=document.createElement("span");n.className="npe-statusbar-item";let i=document.createElement("span");i.className="npe-statusbar-label",i.textContent=this._i18n.t(e)+":";let o=document.createElement("span");return o.className="npe-statusbar-value",o.textContent=t,n.appendChild(i),n.appendChild(o),{wrapper:n,value:o}}_updateDOM(){this._wordEl&&(this._wordEl.value.textContent=String(this._words)),this._charEl&&(this._charEl.value.textContent=String(this._chars)),this._blockEl&&(this._blockEl.value.textContent=this._block),this._autosaveEl&&(this._autosaveEl.value.textContent=this._formatAutosave()),this._autosaveStatus==="saved"&&this._lastSaveTime?this._startAgoTimer():this._clearAgoTimer()}_formatAutosave(){let e=this._i18n.t.bind(this._i18n);if(this._autosaveStatus==="off")return e("statusbar.autosave.off");if(this._autosaveStatus==="saving")return e("statusbar.autosave.saving");if(this._autosaveStatus==="saved"&&this._lastSaveTime){let t=Date.now()-this._lastSaveTime.getTime(),n=Math.floor(t/1e3);if(n<60)return e("statusbar.autosave.saved");let i=Math.floor(n/60);return`${e("statusbar.autosave.saved")} ${i} min ${e("statusbar.autosave.ago")}`}return e("statusbar.autosave.saved")}_startAgoTimer(){this._clearAgoTimer(),this._agoTimer=setInterval(()=>{this._autosaveEl&&(this._autosaveEl.value.textContent=this._formatAutosave())},6e4)}_clearAgoTimer(){this._agoTimer!==null&&(clearInterval(this._agoTimer),this._agoTimer=null)}_bindBusEvents(){this._bus&&(this._onContentChange=({words:e,chars:t}={})=>{typeof e=="number"&&(this._words=e),typeof t=="number"&&(this._chars=t),this._updateDOM()},this._onSelectionChange=({block:e}={})=>{typeof e=="string"&&(this._block=e),this._updateDOM()},this._onAutosaveStatus=({status:e,lastSaveTime:t}={})=>{typeof e=="string"&&(this._autosaveStatus=e),t!==void 0&&(this._lastSaveTime=t),this._updateDOM()},this._bus.on("content:change",this._onContentChange),this._bus.on("selection:change",this._onSelectionChange),this._bus.on("autosave:status",this._onAutosaveStatus))}_offHandlers(){this._bus&&(this._onContentChange&&this._bus.off("content:change",this._onContentChange),this._onSelectionChange&&this._bus.off("selection:change",this._onSelectionChange),this._onAutosaveStatus&&this._bus.off("autosave:status",this._onAutosaveStatus))}};var Le=class{constructor({storageKey:e,bus:t,getContent:n,enabled:i=!1}){this._key=e,this._bus=t,this._getContent=n,this._enabled=i,this._timer=null,this._lastSaveTime=null,this._enabled&&this._start(),this._emitStatus()}isEnabled(){return this._enabled}enable(){this._enabled||(this._enabled=!0,this._start(),this._emitStatus())}disable(){this._enabled&&(this._enabled=!1,this._stop(),this._emitStatus())}toggle(){return this._enabled?this.disable():this.enable(),this._enabled}saveNow(){this._enabled&&this._save()}restore(){try{return localStorage.getItem(this._key)||null}catch(e){return null}}clear(){try{localStorage.removeItem(this._key)}catch(e){}}destroy(){this._stop()}_start(){this._stop(),this._timer=setInterval(()=>this._save(),3e4)}_stop(){this._timer!==null&&(clearInterval(this._timer),this._timer=null)}_save(){if(this._enabled){this._emitSaving();try{let e=this._getContent();localStorage.setItem(this._key,e),this._lastSaveTime=new Date,this._emitSaved()}catch(e){this._emitStatus()}}}_emitSaving(){this._bus.emit("autosave:status",{status:"saving",lastSaveTime:this._lastSaveTime})}_emitSaved(){this._bus.emit("autosave:status",{status:"saved",lastSaveTime:this._lastSaveTime})}_emitStatus(){let e=this._enabled?this._lastSaveTime?"saved":"saving":"off",t=this._enabled&&!this._lastSaveTime?"off":e;this._bus.emit("autosave:status",{status:t==="off"&&this._enabled?"saving":t,lastSaveTime:this._lastSaveTime}),this._enabled||this._bus.emit("autosave:status",{status:"off",lastSaveTime:null})}};var Vt=300,Ot=4e3,ze=class{constructor(e,t){this._target=e,this._opts=X(t),this._bus=new Z,this._destroyed=!1,this._shell=null,this._toolbarEl=null,this._i18n=Oe(this._opts.language,this._opts.translations),this._toolbarBuilder=null,this._toolbarState=null,this._commands=null,this._modalManager=null,this._sourceViewModal=null,this._findReplaceModal=null,this._canvas=null,this._styleManager=null,this._serializer=null,this._sanitizer=null,this._fullHtmlParser=null,this._themeManager=null,this._statusBar=null,this._autosave=null,this._overlayManager=null,this._metadata={},this._cssUrls=Array.isArray(this._opts.cssUrls)?this._opts.cssUrls.slice():[],this._assetsBaseUrl=this._opts.assetsBaseUrl||"",this._onChangeTimer=null,this._fullscreen=!1,this._init()}_init(){this._buildShell(),this._buildCanvas(),this._buildToolbar(),this._buildCommands(),this._buildModals(),this._buildStatusBar(),this._buildAutosave(),this._bindToolbarCommands(),this._bindKeyboardShortcuts(),this._bindLifecycleCallbacks(),this._loadContent()}_buildShell(){let e=document.createElement("div");e.className="npe-editor",this._opts.customClass&&e.classList.add(this._opts.customClass);let t=document.createElement("div");t.className="npe-toolbar",t.setAttribute("role","toolbar"),t.setAttribute("aria-label","Editor toolbar");let n=document.createElement("div");n.className="npe-canvas-wrapper",n.style.minHeight=this._opts.minHeight+"px",this._opts.maxHeight&&(n.style.maxHeight=this._opts.maxHeight+"px",n.style.overflowY="auto");let i=document.createElement("div");i.className="npe-overlay-layer",i.setAttribute("aria-hidden","true");let o=document.createElement("div");o.className="npe-statusbar",o.setAttribute("role","status"),o.setAttribute("aria-live","polite"),n.appendChild(i),e.appendChild(t),e.appendChild(n),e.appendChild(o),this._target.appendChild(e),this._shell=e,this._toolbarEl=t,this._canvasWrapper=n,this._themeManager=new ke(e,this._opts.theme,this._opts.persistTheme),this._overlayManager=new ge({hostEl:e,canvasManager:null,bus:this._bus,i18n:this._i18n,options:this._opts})}_buildCanvas(){if(!this._canvasWrapper)return;this._sanitizer=new Ce({allowDataUris:this._opts.allowDataUris}),this._fullHtmlParser=new we,this._canvas=new ve(this._canvasWrapper,this._opts,this._bus),this._styleManager=new xe(this._canvas,this._opts);let e=this._canvas.getDocument();e&&this._styleManager.init(e,this._opts),this._serializer=new ye(this._canvas,this._sanitizer),this._overlayManager&&this._overlayManager.attachCanvas(this._canvas),this._bus.on("content:change",()=>{this._overlayManager&&this._overlayManager.update()}),this._bus.on("selection:change",()=>{this._overlayManager&&this._overlayManager.update()}),this._bindCanvasTabShortcuts()}_buildToolbar(){this._toolbarEl&&(this._toolbarBuilder=new ie(this._toolbarEl,this._opts,this._bus,this._i18n),this._toolbarState=new F(this._toolbarBuilder,this._canvas,this._bus))}_buildCommands(){this._commands=new V(this._canvas,this._bus,this._styleManager,this._sanitizer)}_buildModals(){this._modalManager=new de({options:this._opts,bus:this._bus,i18n:this._i18n,hostEl:this._shell||document.body,canvasManager:this._canvas})}_buildStatusBar(){let e=this._shell?this._shell.querySelector(".npe-statusbar"):null;e&&(this._statusBar=new Ee(e,this._bus,this._i18n))}_getAutosaveKey(){if(this._opts.autosaveKey)return`npe-autosave-${this._opts.autosaveKey}`;let e=this._target&&this._target.id?this._target.id:null;return e?`npe-autosave-${e}`:"npe-autosave-default"}_buildAutosave(){this._autosave=new Le({storageKey:this._getAutosaveKey(),bus:this._bus,getContent:()=>this.getContent(),enabled:!1})}_bindToolbarCommands(){this._bus.on("toolbar:command",(e,t)=>{this._commands&&this._commands.execute(e,t)}),this._bus.on("toolbar:colorPreview",()=>{}),this._bus.on("toolbar:more",e=>{this._handleMoreMenuItem(e)}),this._bus.on("toolbar:insert",e=>{this._modalManager&&this._modalManager.open(e)}),this._bus.on("canvas:insert",({html:e})=>{e&&this._modalManager&&this._modalManager._insert(e)}),this._bus.on("toolbar:command",e=>{e==="viewCode"&&this._openSourceView(),e==="findReplace"&&this._openFindReplace()})}_handleMoreMenuItem(e){switch(e){case"save":this.triggerSave();break;case"preview":this._openPreview();break;case"download":this._downloadHtml();break;case"print":this._printCanvas();break;case"autosave":this._toggleAutosave();break;case"clearAll":this._clearAll();break;case"changeTheme":this.toggleTheme();break;case"fullscreen":this.toggleFullscreen();break;case"help":this._openHelp();break;default:break}}_openPreview(){let e=this._buildFullPageHtml(),t=new Blob([e],{type:"text/html;charset=utf-8"}),n=URL.createObjectURL(t),i=window.open(n,"_blank");i?i.addEventListener("load",()=>URL.revokeObjectURL(n),{once:!0}):setTimeout(()=>URL.revokeObjectURL(n),3e4)}_downloadHtml(){let e=this._buildFullPageHtml(),t=new Blob([e],{type:"text/html;charset=utf-8"}),n=URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download="page.html",document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(n),5e3)}_buildFullPageHtml(){let e=this.getContent(),t=this.getStyles(),n=this._cssUrls||[],i=this._assetsBaseUrl||"",o="";for(let l of n)o+=` <link rel="stylesheet" href="${this._escapeAttr(l)}">
|
|
44
|
+
`;let s="";t&&(s=` <style>
|
|
45
|
+
${t}
|
|
46
|
+
</style>
|
|
47
|
+
`);let a="";return i&&(a=` <base href="${this._escapeAttr(i)}">
|
|
48
|
+
`),`<!DOCTYPE html>
|
|
49
|
+
<html>
|
|
50
|
+
<head>
|
|
51
|
+
<meta charset="UTF-8">
|
|
52
|
+
${a}${o}${s}</head>
|
|
53
|
+
<body>
|
|
54
|
+
${e}
|
|
55
|
+
</body>
|
|
56
|
+
</html>`}_printCanvas(){let e=this._getIframeDoc();if(e)try{let t=e.defaultView;t&&t.print()}catch(t){}}_toggleAutosave(){this._autosave&&this._autosave.toggle()}_clearAll(){window.confirm(this._i18n.t("confirm.clearAll"))&&(this.setContent(""),this._bus.emit("content:change",{html:"",words:0,chars:0}))}_openHelp(){if(this._helpPanel){this._closeHelp();return}this._renderHelpPanel()}_renderHelpPanel(){if(!this._shell)return;let e=l=>this._i18n.t(l),t=document.createElement("div");t.className="npe-modal-backdrop",t.setAttribute("role","dialog"),t.setAttribute("aria-modal","true"),t.setAttribute("aria-label",e("help.title"));let n=document.createElement("div");n.className="npe-modal npe-help-panel";let i=document.createElement("div");i.className="npe-modal-header";let o=document.createElement("h2");o.className="npe-modal-title",o.textContent=e("help.title");let s=document.createElement("button");s.className="npe-modal-close",s.type="button",s.setAttribute("aria-label",e("help.close")),s.textContent="\xD7",s.addEventListener("click",()=>this._closeHelp()),i.appendChild(o),i.appendChild(s);let a=document.createElement("div");a.className="npe-modal-body npe-help-body",a.innerHTML=this._buildHelpContent(),n.appendChild(i),n.appendChild(a),t.appendChild(n),t.addEventListener("click",l=>{l.target===t&&this._closeHelp()}),this._helpEscHandler=l=>{l.key==="Escape"&&this._closeHelp()},document.addEventListener("keydown",this._helpEscHandler),this._shell.appendChild(t),this._helpPanel=t,s.focus()}_buildHelpContent(){return`<table class="npe-help-table"><tbody>${[{keys:"Ctrl+B",action:this._i18n.t("toolbar.bold")},{keys:"Ctrl+I",action:this._i18n.t("toolbar.italic")},{keys:"Ctrl+U",action:this._i18n.t("toolbar.underline")},{keys:"Ctrl+K",action:this._i18n.t("insert.link")},{keys:"Ctrl+S",action:this._i18n.t("menu.more.save")},{keys:"Ctrl+Z",action:this._i18n.t("toolbar.undo")},{keys:"Ctrl+Y / Ctrl+Shift+Z",action:this._i18n.t("toolbar.redo")},{keys:"Tab",action:this._i18n.t("toolbar.indent")},{keys:"Shift+Tab",action:this._i18n.t("toolbar.outdent")}].map(n=>`<tr><td class="npe-help-key"><kbd>${this._escapeHtml(n.keys)}</kbd></td><td class="npe-help-action">${this._escapeHtml(n.action)}</td></tr>`).join("")}</tbody></table>`}_closeHelp(){this._helpPanel&&this._helpPanel.parentNode&&this._helpPanel.parentNode.removeChild(this._helpPanel),this._helpPanel=null,this._helpEscHandler&&(document.removeEventListener("keydown",this._helpEscHandler),this._helpEscHandler=null)}_escapeAttr(e){return String(e).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}_escapeHtml(e){return String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}_bindKeyboardShortcuts(){this._shell&&(this._onKeyDown=e=>{if(!(e.ctrlKey||e.metaKey))return;switch(e.key?e.key.toLowerCase():""){case"b":e.preventDefault(),this._commands&&this._commands.execute("bold");break;case"i":e.preventDefault(),this._commands&&this._commands.execute("italic");break;case"u":e.preventDefault(),this._commands&&this._commands.execute("underline");break;case"k":e.preventDefault(),this._bus.emit("toolbar:insert","link");break;case"s":e.preventDefault(),this.triggerSave();break;case"z":e.preventDefault(),e.shiftKey?this._commands&&this._commands.execute("redo"):this._commands&&this._commands.execute("undo");break;case"y":e.preventDefault(),this._commands&&this._commands.execute("redo");break;default:break}},document.addEventListener("keydown",this._onKeyDown))}_bindLifecycleCallbacks(){this._bus.on("content:change",({html:e}={})=>{this._destroyed||(this._emitContentStats(),typeof this._opts.onChange=="function"&&(this._onChangeTimer!==null&&clearTimeout(this._onChangeTimer),this._onChangeTimer=setTimeout(()=>{this._onChangeTimer=null,!this._destroyed&&typeof this._opts.onChange=="function"&&this._opts.onChange(e!=null?e:this.getContent())},Vt)))}),this._bus.on("selection:change",()=>{this._destroyed||this._emitBlockType()}),this._bus.on("canvas:focus",()=>{this._destroyed||typeof this._opts.onFocus=="function"&&this._opts.onFocus()}),this._bus.on("canvas:blur",()=>{this._destroyed||typeof this._opts.onBlur=="function"&&this._opts.onBlur()})}_emitContentStats(){let e=this.getText?this.getText():"",t=e.trim()?e.trim().split(/\s+/).length:0,n=e.length;this._statusBar&&this._statusBar.update({words:t,chars:n})}_emitBlockType(){let e=this._getIframeDoc();if(!e)return;let t="";try{let n=e.getSelection();if(n&&n.rangeCount>0){let i=n.getRangeAt(0).commonAncestorContainer;i.nodeType===Node.TEXT_NODE&&(i=i.parentElement);let o=["P","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE","LI","DIV","SECTION","ARTICLE","HEADER","FOOTER","MAIN"];for(;i&&i!==e.body;){if(o.includes(i.nodeName)){t=this._blockTagToLabel(i.nodeName);break}i=i.parentElement}!t&&e.body&&(t=this._i18n.t("heading.paragraph"))}}catch(n){}this._statusBar&&this._statusBar.update({block:t})}_blockTagToLabel(e){let t=this._i18n.t.bind(this._i18n);return{P:t("heading.paragraph"),H1:t("heading.h1"),H2:t("heading.h2"),H3:t("heading.h3"),H4:t("heading.h4"),H5:t("heading.h5"),H6:t("heading.h6"),BLOCKQUOTE:t("toolbar.blockquote"),PRE:t("toolbar.code"),LI:"List Item",DIV:t("heading.paragraph")}[e]||e.toLowerCase()}async _loadContent(){let e=null;if(typeof this._opts.loadHandler=="function")try{e=await this._opts.loadHandler()}catch(t){e=null}if(e)this._applyLoadPayload(e);else{let t=this._opts.initialContent||this._target&&this._target.innerHTML||"";t&&this._serializer&&this._serializer.setContent(t)}if(this._autosave){let t=this._autosave.restore();t&&!e&&!this._opts.initialContent&&this._serializer&&this._serializer.setContent(t)}this._emitContentStats(),this._opts.autofocus&&this.focus(),this._bus.emit("editor:ready")}_applyLoadPayload(e){if(!e||typeof e!="object")return;let t="",n=typeof e.css=="string"?e.css:"",i=Array.isArray(e.cssUrls)?e.cssUrls:[],o=typeof e.assetsBaseUrl=="string"?e.assetsBaseUrl:this._opts.assetsBaseUrl||"";if(typeof e.fullHtml=="string"&&e.fullHtml.trim()){let a=this._fullHtmlParser?this._fullHtmlParser.parse(e.fullHtml,{stylesheetUrlValidator:this._opts.stylesheetUrlValidator}):{bodyHtml:"",styleBlocks:[],cssUrls:[]};t=a.bodyHtml||"",this._styleManager&&a.styleBlocks&&a.styleBlocks.length&&this._styleManager.addExtractedStyleBlocks(a.styleBlocks),a.cssUrls&&a.cssUrls.length&&(i=[...i,...a.cssUrls])}else typeof e.html=="string"&&(t=e.html);this._sanitizer&&t&&(t=this._sanitizer.sanitize(t));let s=this._canvas?this._canvas.getBody():null;s&&(s.innerHTML=t),o&&(this._assetsBaseUrl=o),e.metadata&&typeof e.metadata=="object"&&(this._metadata=Object.assign({},e.metadata)),this._cssUrls=i.slice(),this._styleManager&&(n&&this._styleManager.setStyles(n),i.length&&this._styleManager.setExternalLinks(i))}_openSourceView(){this._sourceViewModal||(this._sourceViewModal=new he({contentSerializer:this._serializer,styleManager:this._styleManager,sanitizer:this._sanitizer,i18n:this._i18n,hostEl:this._shell||document.body})),this._sourceViewModal.open()}_openFindReplace(){this._findReplaceModal||(this._findReplaceModal=new pe({canvasManager:this._canvas,i18n:this._i18n,hostEl:this._shell||document.body})),this._findReplaceModal.open()}_bindCanvasTabShortcuts(){let e=this._getIframeDoc();if(!e)return;let t=n=>{n.key==="Tab"&&(n.preventDefault(),this._commands&&this._commands.execute(n.shiftKey?"outdent":"indent"))};try{e.addEventListener("keydown",t),this._iframeTabHandler=t}catch(n){}}_getIframeDoc(){if(!this._canvas)return null;try{return this._canvas.getDocument?this._canvas.getDocument():null}catch(e){return null}}attachCanvas(e){this._canvas=e.canvas||this._canvas,this._styleManager=e.styleManager||this._styleManager,this._serializer=e.serializer||this._serializer,this._sanitizer=e.sanitizer||this._sanitizer,this._commands&&this._commands.destroy(),this._commands=new V(this._canvas,this._bus,this._styleManager,this._sanitizer),this._toolbarState&&this._toolbarState.destroy(),this._toolbarState=new F(this._toolbarBuilder,this._canvas,this._bus),this._overlayManager&&this._overlayManager.attachCanvas(this._canvas),this._bindCanvasTabShortcuts()}getI18n(){return this._i18n}getToolbarBuilder(){return this._toolbarBuilder}getBus(){return this._bus}getCommandRegistry(){return this._commands}getContent(){return this._serializer?this._serializer.getContent():""}setContent(e){this._serializer&&this._serializer.setContent(e)}getPage(){let e={html:this.getContent()},t=this.getStyles();return t&&(e.css=t),this._cssUrls&&this._cssUrls.length&&(e.cssUrls=this._cssUrls.slice()),this._assetsBaseUrl&&(e.assetsBaseUrl=this._assetsBaseUrl),this._metadata&&Object.keys(this._metadata).length&&(e.metadata=Object.assign({},this._metadata)),e}setPage(e){!e||typeof e!="object"||this._applyLoadPayload(e)}getStyles(){return this._styleManager?this._styleManager.getStyles():""}setStyles(e){this._styleManager&&this._styleManager.setStyles(e)}getText(){return this._serializer?this._serializer.getText():""}isEmpty(){return this._serializer?this._serializer.isEmpty():!0}focus(){let e=this._canvas?this._canvas.getBody():null;if(e)try{e.focus()}catch(t){}}blur(){let e=this._canvas?this._canvas.getBody():null;if(e)try{e.blur()}catch(t){}}enable(){let e=this._canvas?this._canvas.getBody():null;e&&(e.contentEditable="true",e.setAttribute("aria-disabled","false")),this._shell&&this._shell.classList.remove("npe-disabled")}disable(){let e=this._canvas?this._canvas.getBody():null;e&&(e.contentEditable="false",e.setAttribute("aria-disabled","true")),this._shell&&this._shell.classList.add("npe-disabled")}async triggerSave(){let e=this.getPage();if(typeof this._opts.saveHandler=="function")try{await this._opts.saveHandler(e),this._autosave&&this._autosave.clear(),typeof this._opts.onSave=="function"&&this._opts.onSave(e),this._bus.emit("editor:saved",e)}catch(t){throw this._showSaveErrorToast(),this._bus.emit("editor:saveFailed",t),t}else this._autosave&&this._autosave.clear(),typeof this._opts.onSave=="function"&&this._opts.onSave(e),this._bus.emit("editor:saved",e)}_showSaveErrorToast(){if(!this._shell)return;let e=this._shell.querySelector(".npe-toast");e&&e.parentNode&&e.parentNode.removeChild(e);let t=document.createElement("div");t.className="npe-toast npe-toast--error",t.setAttribute("role","alert"),t.setAttribute("aria-live","assertive"),t.textContent=this._i18n.t("error.saveFailed"),this._shell.appendChild(t);let n=setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t)},Ot);this._toastTimers||(this._toastTimers=[]),this._toastTimers.push(n)}toggleFullscreen(){this._shell&&(this._fullscreen=!this._fullscreen,this._fullscreen?this._shell.classList.add("npe-fullscreen"):this._shell.classList.remove("npe-fullscreen"),this._bus.emit("editor:fullscreenChange",this._fullscreen))}setTheme(e){this._themeManager&&this._themeManager.setTheme(e)}toggleTheme(){this._themeManager&&this._themeManager.toggleTheme()}getTheme(){return this._themeManager?this._themeManager.getTheme():this._opts.theme}destroy(){if(this._destroyed)return;if(this._destroyed=!0,this._onChangeTimer!==null&&(clearTimeout(this._onChangeTimer),this._onChangeTimer=null),this._toastTimers){for(let t of this._toastTimers)clearTimeout(t);this._toastTimers=[]}this._onKeyDown&&(document.removeEventListener("keydown",this._onKeyDown),this._onKeyDown=null);let e=this._getIframeDoc();if(e&&this._iframeTabHandler){try{e.removeEventListener("keydown",this._iframeTabHandler)}catch(t){}this._iframeTabHandler=null}if(this._modalManager&&(this._modalManager.destroy(),this._modalManager=null),this._sourceViewModal&&(this._sourceViewModal.destroy(),this._sourceViewModal=null),this._findReplaceModal&&(this._findReplaceModal.destroy(),this._findReplaceModal=null),this._commands&&(this._commands.destroy(),this._commands=null),this._overlayManager&&(this._overlayManager.destroy(),this._overlayManager=null),this._toolbarState&&(this._toolbarState.destroy(),this._toolbarState=null),this._toolbarBuilder&&(this._toolbarBuilder.destroy(),this._toolbarBuilder=null),this._canvas&&(this._canvas.destroy(),this._canvas=null),this._styleManager&&(this._styleManager.destroy(),this._styleManager=null),this._themeManager&&(this._themeManager.destroy(),this._themeManager=null),this._statusBar&&(this._statusBar.destroy(),this._statusBar=null),this._autosave&&(this._autosave.destroy(),this._autosave=null),this._closeHelp(),this._bus.destroy(),this._shell){let t=this._shell.querySelectorAll('[class*="npe-"]');for(let n of Array.from(t))n.parentNode&&n.parentNode.removeChild(n);this._shell.parentNode&&this._shell.parentNode.removeChild(this._shell)}this._shell=null,this._toolbarEl=null,this._canvasWrapper=null}};var Ne=`/**
|
|
57
|
+
* Neiki's Page Editor \u2014 editor chrome CSS
|
|
58
|
+
* All classes use the npe- prefix to avoid conflicts with page content.
|
|
59
|
+
* Theme CSS (dark, blue, etc.) comes at the end of this file.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/* \u2500\u2500\u2500 CSS Custom Properties (light theme defaults) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
63
|
+
:root,
|
|
64
|
+
.npe-editor {
|
|
65
|
+
--npe-font: system-ui, -apple-system, sans-serif;
|
|
66
|
+
--npe-font-size: 13px;
|
|
67
|
+
|
|
68
|
+
/* Chrome colors */
|
|
69
|
+
--npe-chrome-bg: #f5f5f5;
|
|
70
|
+
--npe-chrome-border: #d0d0d0;
|
|
71
|
+
--npe-chrome-text: #222;
|
|
72
|
+
--npe-chrome-text-muted: #666;
|
|
73
|
+
|
|
74
|
+
/* Toolbar */
|
|
75
|
+
--npe-toolbar-bg: #ffffff;
|
|
76
|
+
--npe-toolbar-border: #d0d0d0;
|
|
77
|
+
--npe-toolbar-btn-hover-bg: #e8e8e8;
|
|
78
|
+
--npe-toolbar-btn-active-bg: #d0e4ff;
|
|
79
|
+
--npe-toolbar-btn-active-text: #0057cc;
|
|
80
|
+
--npe-toolbar-separator: #d0d0d0;
|
|
81
|
+
|
|
82
|
+
/* Canvas */
|
|
83
|
+
--npe-canvas-bg: #fff;
|
|
84
|
+
--npe-canvas-border: #d0d0d0;
|
|
85
|
+
|
|
86
|
+
/* Status bar */
|
|
87
|
+
--npe-statusbar-bg: #f0f0f0;
|
|
88
|
+
--npe-statusbar-border: #d0d0d0;
|
|
89
|
+
--npe-statusbar-text: #555;
|
|
90
|
+
|
|
91
|
+
/* Focus ring */
|
|
92
|
+
--npe-focus-ring: 0 0 0 2px #0057cc66;
|
|
93
|
+
|
|
94
|
+
/* Z-index layers */
|
|
95
|
+
--npe-z-overlay: 10;
|
|
96
|
+
--npe-z-toolbar: 20;
|
|
97
|
+
--npe-z-modal: 1000;
|
|
98
|
+
--npe-z-toast: 1100;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* \u2500\u2500\u2500 Editor Shell \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
102
|
+
.npe-editor {
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
font-family: var(--npe-font);
|
|
106
|
+
font-size: var(--npe-font-size);
|
|
107
|
+
color: var(--npe-chrome-text);
|
|
108
|
+
background: var(--npe-chrome-bg);
|
|
109
|
+
border: 1px solid var(--npe-chrome-border);
|
|
110
|
+
border-radius: 4px;
|
|
111
|
+
box-sizing: border-box;
|
|
112
|
+
position: relative;
|
|
113
|
+
width: 100%;
|
|
114
|
+
height: 100%;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.npe-editor *,
|
|
118
|
+
.npe-editor *::before,
|
|
119
|
+
.npe-editor *::after {
|
|
120
|
+
box-sizing: border-box;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* \u2500\u2500\u2500 Toolbar \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
124
|
+
.npe-toolbar {
|
|
125
|
+
display: flex;
|
|
126
|
+
flex-wrap: wrap;
|
|
127
|
+
align-items: center;
|
|
128
|
+
gap: 2px;
|
|
129
|
+
padding: 3px 6px;
|
|
130
|
+
background: var(--npe-toolbar-bg);
|
|
131
|
+
border-bottom: 1px solid var(--npe-toolbar-border);
|
|
132
|
+
position: relative;
|
|
133
|
+
z-index: var(--npe-z-toolbar);
|
|
134
|
+
min-height: 40px;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.npe-toolbar-group {
|
|
138
|
+
display: flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
flex-wrap: nowrap;
|
|
141
|
+
gap: 1px;
|
|
142
|
+
padding: 0 2px;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* Toolbar separator */
|
|
146
|
+
.npe-toolbar-sep {
|
|
147
|
+
display: inline-block;
|
|
148
|
+
width: 1px;
|
|
149
|
+
height: 20px;
|
|
150
|
+
background: var(--npe-toolbar-separator);
|
|
151
|
+
margin: 0 4px;
|
|
152
|
+
flex-shrink: 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* Toolbar buttons */
|
|
156
|
+
.npe-btn {
|
|
157
|
+
display: inline-flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
justify-content: center;
|
|
160
|
+
min-width: 26px;
|
|
161
|
+
height: 26px;
|
|
162
|
+
padding: 0 4px;
|
|
163
|
+
background: transparent;
|
|
164
|
+
border: 1px solid transparent;
|
|
165
|
+
border-radius: 3px;
|
|
166
|
+
color: var(--npe-chrome-text);
|
|
167
|
+
cursor: pointer;
|
|
168
|
+
font-family: var(--npe-font);
|
|
169
|
+
font-size: var(--npe-font-size);
|
|
170
|
+
line-height: 1;
|
|
171
|
+
transition: background 0.1s, border-color 0.1s;
|
|
172
|
+
white-space: nowrap;
|
|
173
|
+
user-select: none;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.npe-btn:hover {
|
|
177
|
+
background: var(--npe-toolbar-btn-hover-bg);
|
|
178
|
+
border-color: var(--npe-chrome-border);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.npe-btn:focus-visible {
|
|
182
|
+
outline: none;
|
|
183
|
+
box-shadow: var(--npe-focus-ring);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.npe-btn[aria-pressed="true"],
|
|
187
|
+
.npe-btn.npe-active {
|
|
188
|
+
background: var(--npe-toolbar-btn-active-bg);
|
|
189
|
+
color: var(--npe-toolbar-btn-active-text);
|
|
190
|
+
border-color: var(--npe-toolbar-btn-active-bg);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.npe-btn[aria-disabled="true"],
|
|
194
|
+
.npe-btn:disabled {
|
|
195
|
+
opacity: 0.4;
|
|
196
|
+
cursor: default;
|
|
197
|
+
pointer-events: none;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* SVG icons inside toolbar buttons */
|
|
201
|
+
.npe-btn svg {
|
|
202
|
+
width: 16px;
|
|
203
|
+
height: 16px;
|
|
204
|
+
fill: currentColor;
|
|
205
|
+
display: block;
|
|
206
|
+
pointer-events: none;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* Visible text label inside a button (used by Insert dropdown) */
|
|
210
|
+
.npe-btn-label {
|
|
211
|
+
font-family: var(--npe-font);
|
|
212
|
+
font-size: var(--npe-font-size);
|
|
213
|
+
line-height: 1;
|
|
214
|
+
pointer-events: none;
|
|
215
|
+
white-space: nowrap;
|
|
216
|
+
margin-left: 2px;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* \u2500\u2500\u2500 Canvas Wrapper \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
220
|
+
.npe-canvas-wrapper {
|
|
221
|
+
position: relative;
|
|
222
|
+
background: var(--npe-canvas-bg);
|
|
223
|
+
flex: 1 1 auto;
|
|
224
|
+
overflow: hidden;
|
|
225
|
+
/* Ensure the wrapper has an intrinsic height so the iframe fills it */
|
|
226
|
+
display: flex;
|
|
227
|
+
flex-direction: column;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.npe-canvas-wrapper iframe {
|
|
231
|
+
display: block;
|
|
232
|
+
width: 100%;
|
|
233
|
+
flex: 1 1 auto;
|
|
234
|
+
/* iframe height falls back to min-height when no explicit height is set */
|
|
235
|
+
min-height: inherit;
|
|
236
|
+
border: 0;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* \u2500\u2500\u2500 Overlay Layer \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
240
|
+
.npe-overlay-layer {
|
|
241
|
+
position: absolute;
|
|
242
|
+
top: 0;
|
|
243
|
+
left: 0;
|
|
244
|
+
width: 100%;
|
|
245
|
+
height: 100%;
|
|
246
|
+
pointer-events: none;
|
|
247
|
+
z-index: var(--npe-z-overlay);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/* \u2500\u2500\u2500 Status Bar \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
251
|
+
.npe-statusbar {
|
|
252
|
+
display: flex;
|
|
253
|
+
align-items: center;
|
|
254
|
+
gap: 16px;
|
|
255
|
+
padding: 3px 10px;
|
|
256
|
+
background: var(--npe-statusbar-bg);
|
|
257
|
+
border-top: 1px solid var(--npe-statusbar-border);
|
|
258
|
+
color: var(--npe-statusbar-text);
|
|
259
|
+
font-size: 11px;
|
|
260
|
+
min-height: 24px;
|
|
261
|
+
flex-shrink: 0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.npe-statusbar-item {
|
|
265
|
+
display: flex;
|
|
266
|
+
align-items: center;
|
|
267
|
+
gap: 4px;
|
|
268
|
+
white-space: nowrap;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/* \u2500\u2500\u2500 Dropdowns \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
272
|
+
.npe-dropdown {
|
|
273
|
+
position: absolute;
|
|
274
|
+
top: 100%;
|
|
275
|
+
left: 0;
|
|
276
|
+
min-width: 160px;
|
|
277
|
+
background: var(--npe-toolbar-bg);
|
|
278
|
+
border: 1px solid var(--npe-chrome-border);
|
|
279
|
+
border-radius: 4px;
|
|
280
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
|
|
281
|
+
z-index: var(--npe-z-modal);
|
|
282
|
+
padding: 4px 0;
|
|
283
|
+
list-style: none;
|
|
284
|
+
margin: 2px 0 0;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.npe-dropdown-item {
|
|
288
|
+
display: flex;
|
|
289
|
+
align-items: center;
|
|
290
|
+
gap: 8px;
|
|
291
|
+
padding: 6px 12px;
|
|
292
|
+
cursor: pointer;
|
|
293
|
+
color: var(--npe-chrome-text);
|
|
294
|
+
font-size: var(--npe-font-size);
|
|
295
|
+
white-space: nowrap;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.npe-dropdown-item:hover {
|
|
299
|
+
background: var(--npe-toolbar-btn-hover-bg);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.npe-dropdown-item-icon {
|
|
303
|
+
display: inline-flex;
|
|
304
|
+
align-items: center;
|
|
305
|
+
justify-content: center;
|
|
306
|
+
width: 16px;
|
|
307
|
+
height: 16px;
|
|
308
|
+
flex-shrink: 0;
|
|
309
|
+
color: var(--npe-chrome-text);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.npe-dropdown-item-icon svg {
|
|
313
|
+
width: 16px;
|
|
314
|
+
height: 16px;
|
|
315
|
+
fill: currentColor;
|
|
316
|
+
display: block;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/* \u2500\u2500\u2500 Modals \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
320
|
+
.npe-modal-backdrop {
|
|
321
|
+
position: fixed;
|
|
322
|
+
inset: 0;
|
|
323
|
+
background: rgba(0, 0, 0, 0.4);
|
|
324
|
+
z-index: calc(var(--npe-z-modal) - 1);
|
|
325
|
+
display: flex;
|
|
326
|
+
align-items: center;
|
|
327
|
+
justify-content: center;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.npe-modal {
|
|
331
|
+
background: var(--npe-toolbar-bg);
|
|
332
|
+
border: 1px solid var(--npe-chrome-border);
|
|
333
|
+
border-radius: 6px;
|
|
334
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
|
|
335
|
+
min-width: 320px;
|
|
336
|
+
max-width: min(600px, calc(100vw - 32px));
|
|
337
|
+
max-height: calc(100vh - 48px);
|
|
338
|
+
overflow: auto;
|
|
339
|
+
padding: 20px 24px;
|
|
340
|
+
position: relative;
|
|
341
|
+
z-index: var(--npe-z-modal);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.npe-modal-header {
|
|
345
|
+
display: flex;
|
|
346
|
+
align-items: center;
|
|
347
|
+
justify-content: space-between;
|
|
348
|
+
margin-bottom: 16px;
|
|
349
|
+
flex-shrink: 0;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
.npe-modal-title {
|
|
353
|
+
font-size: 16px;
|
|
354
|
+
font-weight: 600;
|
|
355
|
+
margin: 0;
|
|
356
|
+
color: var(--npe-chrome-text);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.npe-modal-close {
|
|
360
|
+
background: none;
|
|
361
|
+
border: none;
|
|
362
|
+
font-size: 20px;
|
|
363
|
+
line-height: 1;
|
|
364
|
+
cursor: pointer;
|
|
365
|
+
color: var(--npe-chrome-text-muted);
|
|
366
|
+
padding: 0 4px;
|
|
367
|
+
border-radius: 3px;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.npe-modal-close:hover {
|
|
371
|
+
background: var(--npe-toolbar-btn-hover-bg);
|
|
372
|
+
color: var(--npe-chrome-text);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.npe-modal-tabs {
|
|
376
|
+
display: flex;
|
|
377
|
+
gap: 2px;
|
|
378
|
+
border-bottom: 1px solid var(--npe-chrome-border);
|
|
379
|
+
margin-bottom: 12px;
|
|
380
|
+
flex-shrink: 0;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.npe-tab {
|
|
384
|
+
background: none;
|
|
385
|
+
border: none;
|
|
386
|
+
border-bottom: 2px solid transparent;
|
|
387
|
+
padding: 6px 12px;
|
|
388
|
+
font-family: var(--npe-font);
|
|
389
|
+
font-size: var(--npe-font-size);
|
|
390
|
+
color: var(--npe-chrome-text-muted);
|
|
391
|
+
cursor: pointer;
|
|
392
|
+
margin-bottom: -1px;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.npe-tab:hover {
|
|
396
|
+
color: var(--npe-chrome-text);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.npe-tab.npe-tab-active {
|
|
400
|
+
color: var(--npe-chrome-text);
|
|
401
|
+
border-bottom-color: var(--npe-toolbar-btn-active-text, #0057cc);
|
|
402
|
+
font-weight: 600;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.npe-modal-panel {
|
|
406
|
+
flex: 1;
|
|
407
|
+
display: flex;
|
|
408
|
+
flex-direction: column;
|
|
409
|
+
min-height: 0;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.npe-modal-footer {
|
|
413
|
+
display: flex;
|
|
414
|
+
justify-content: flex-end;
|
|
415
|
+
gap: 8px;
|
|
416
|
+
margin-top: 16px;
|
|
417
|
+
padding-top: 12px;
|
|
418
|
+
border-top: 1px solid var(--npe-chrome-border);
|
|
419
|
+
flex-shrink: 0;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
.npe-modal-actions {
|
|
423
|
+
display: flex;
|
|
424
|
+
justify-content: flex-end;
|
|
425
|
+
gap: 8px;
|
|
426
|
+
margin-top: 16px;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/* \u2500\u2500\u2500 Source View Modal \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
430
|
+
.npe-source-modal {
|
|
431
|
+
width: min(1100px, calc(100vw - 32px));
|
|
432
|
+
max-width: min(1100px, calc(100vw - 32px));
|
|
433
|
+
max-height: calc(100vh - 48px);
|
|
434
|
+
display: flex;
|
|
435
|
+
flex-direction: column;
|
|
436
|
+
overflow: hidden;
|
|
437
|
+
padding: 20px 24px 0;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/* Ensure [hidden] attribute hides panels even when display:flex is set */
|
|
441
|
+
.npe-source-panel[hidden] {
|
|
442
|
+
display: none !important;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.npe-source-panel {
|
|
446
|
+
flex: 1;
|
|
447
|
+
display: flex;
|
|
448
|
+
flex-direction: column;
|
|
449
|
+
min-height: 0;
|
|
450
|
+
overflow: hidden;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.npe-source-textarea {
|
|
454
|
+
flex: 1;
|
|
455
|
+
width: 100%;
|
|
456
|
+
min-height: 300px;
|
|
457
|
+
max-height: calc(100vh - 280px);
|
|
458
|
+
padding: 10px 12px;
|
|
459
|
+
font-family: 'Consolas', 'Menlo', 'Monaco', 'Courier New', monospace;
|
|
460
|
+
font-size: 12px;
|
|
461
|
+
line-height: 1.5;
|
|
462
|
+
background: var(--npe-canvas-bg);
|
|
463
|
+
color: var(--npe-chrome-text);
|
|
464
|
+
border: 1px solid var(--npe-chrome-border);
|
|
465
|
+
border-radius: 4px;
|
|
466
|
+
resize: vertical;
|
|
467
|
+
box-sizing: border-box;
|
|
468
|
+
outline: none;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.npe-source-textarea:focus {
|
|
472
|
+
box-shadow: var(--npe-focus-ring);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.npe-source-modal .npe-modal-footer {
|
|
476
|
+
padding-bottom: 16px;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/* \u2500\u2500\u2500 Select controls \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
480
|
+
.npe-select {
|
|
481
|
+
height: 26px;
|
|
482
|
+
padding: 0 4px;
|
|
483
|
+
background: var(--npe-toolbar-bg);
|
|
484
|
+
border: 1px solid var(--npe-chrome-border);
|
|
485
|
+
border-radius: 3px;
|
|
486
|
+
color: var(--npe-chrome-text);
|
|
487
|
+
font-family: var(--npe-font);
|
|
488
|
+
font-size: var(--npe-font-size);
|
|
489
|
+
cursor: pointer;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
.npe-select:focus-visible {
|
|
493
|
+
outline: none;
|
|
494
|
+
box-shadow: var(--npe-focus-ring);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/* \u2500\u2500\u2500 Font Size Widget \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
498
|
+
.npe-font-size-widget {
|
|
499
|
+
display: inline-flex;
|
|
500
|
+
align-items: center;
|
|
501
|
+
gap: 0;
|
|
502
|
+
border: 1px solid var(--npe-chrome-border);
|
|
503
|
+
border-radius: 3px;
|
|
504
|
+
overflow: visible;
|
|
505
|
+
background: var(--npe-toolbar-bg);
|
|
506
|
+
height: 26px;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.npe-font-size-widget input[type="number"] {
|
|
510
|
+
width: 36px;
|
|
511
|
+
height: 24px;
|
|
512
|
+
text-align: center;
|
|
513
|
+
border: none;
|
|
514
|
+
border-left: 1px solid var(--npe-chrome-border);
|
|
515
|
+
border-right: 1px solid var(--npe-chrome-border);
|
|
516
|
+
background: var(--npe-toolbar-bg);
|
|
517
|
+
color: var(--npe-chrome-text);
|
|
518
|
+
font-family: var(--npe-font);
|
|
519
|
+
font-size: var(--npe-font-size);
|
|
520
|
+
padding: 0 2px;
|
|
521
|
+
/* Hide spin buttons */
|
|
522
|
+
-moz-appearance: textfield;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
.npe-font-size-widget input[type="number"]::-webkit-inner-spin-button,
|
|
526
|
+
.npe-font-size-widget input[type="number"]::-webkit-outer-spin-button {
|
|
527
|
+
-webkit-appearance: none;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/* \u2500\u2500\u2500 Color Picker \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
531
|
+
.npe-color-swatch {
|
|
532
|
+
display: inline-block;
|
|
533
|
+
width: 12px;
|
|
534
|
+
height: 12px;
|
|
535
|
+
border-radius: 2px;
|
|
536
|
+
margin-top: 1px;
|
|
537
|
+
margin-left: 2px;
|
|
538
|
+
flex-shrink: 0;
|
|
539
|
+
/* Default: no color selected \u2014 show border outline */
|
|
540
|
+
border: 1px solid var(--npe-chrome-border);
|
|
541
|
+
background-color: transparent;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.npe-color-panel {
|
|
545
|
+
position: absolute;
|
|
546
|
+
top: 100%;
|
|
547
|
+
left: 0;
|
|
548
|
+
background: var(--npe-toolbar-bg);
|
|
549
|
+
border: 1px solid var(--npe-chrome-border);
|
|
550
|
+
border-radius: 4px;
|
|
551
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
552
|
+
padding: 10px;
|
|
553
|
+
z-index: var(--npe-z-modal);
|
|
554
|
+
min-width: 220px;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.npe-color-swatches {
|
|
558
|
+
display: grid;
|
|
559
|
+
grid-template-columns: repeat(10, 20px);
|
|
560
|
+
gap: 3px;
|
|
561
|
+
margin-bottom: 8px;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.npe-color-swatch-btn {
|
|
565
|
+
width: 20px;
|
|
566
|
+
height: 20px;
|
|
567
|
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
|
568
|
+
border-radius: 2px;
|
|
569
|
+
cursor: pointer;
|
|
570
|
+
padding: 0;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
.npe-color-swatch-btn:hover {
|
|
574
|
+
transform: scale(1.2);
|
|
575
|
+
z-index: 1;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/* \u2500\u2500\u2500 Toast / Non-blocking notifications \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
579
|
+
.npe-toast-container {
|
|
580
|
+
position: absolute;
|
|
581
|
+
bottom: 40px;
|
|
582
|
+
left: 50%;
|
|
583
|
+
transform: translateX(-50%);
|
|
584
|
+
z-index: var(--npe-z-toast);
|
|
585
|
+
display: flex;
|
|
586
|
+
flex-direction: column;
|
|
587
|
+
align-items: center;
|
|
588
|
+
gap: 6px;
|
|
589
|
+
pointer-events: none;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.npe-toast {
|
|
593
|
+
background: #333;
|
|
594
|
+
color: #fff;
|
|
595
|
+
padding: 8px 14px;
|
|
596
|
+
border-radius: 4px;
|
|
597
|
+
font-size: 12px;
|
|
598
|
+
opacity: 1;
|
|
599
|
+
transition: opacity 0.3s;
|
|
600
|
+
pointer-events: auto;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
.npe-toast.npe-toast-error {
|
|
604
|
+
background: #cc3333;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/* \u2500\u2500\u2500 Fullscreen mode \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
608
|
+
.npe-editor.npe-fullscreen {
|
|
609
|
+
position: fixed;
|
|
610
|
+
inset: 0;
|
|
611
|
+
z-index: calc(var(--npe-z-modal) + 100);
|
|
612
|
+
border-radius: 0;
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/* \u2500\u2500\u2500 Dark Theme \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
616
|
+
.npe-editor.npe-dark {
|
|
617
|
+
--npe-chrome-bg: #1e1e1e;
|
|
618
|
+
--npe-chrome-border: #3a3a3a;
|
|
619
|
+
--npe-chrome-text: #d4d4d4;
|
|
620
|
+
--npe-chrome-text-muted: #888;
|
|
621
|
+
--npe-toolbar-bg: #252526;
|
|
622
|
+
--npe-toolbar-border: #3a3a3a;
|
|
623
|
+
--npe-toolbar-btn-hover-bg: #3a3a3a;
|
|
624
|
+
--npe-toolbar-btn-active-bg: #094771;
|
|
625
|
+
--npe-toolbar-btn-active-text: #4fc3f7;
|
|
626
|
+
--npe-toolbar-separator: #3a3a3a;
|
|
627
|
+
--npe-canvas-bg: #1e1e1e;
|
|
628
|
+
--npe-canvas-border: #3a3a3a;
|
|
629
|
+
--npe-statusbar-bg: #1b1b1b;
|
|
630
|
+
--npe-statusbar-border: #3a3a3a;
|
|
631
|
+
--npe-statusbar-text: #888;
|
|
632
|
+
--npe-focus-ring: 0 0 0 2px #4fc3f766;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/* \u2500\u2500\u2500 Blue Theme \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
636
|
+
.npe-editor.npe-theme-blue {
|
|
637
|
+
--npe-chrome-bg: #e8f0fe;
|
|
638
|
+
--npe-chrome-border: #aac4f6;
|
|
639
|
+
--npe-chrome-text: #0d2663;
|
|
640
|
+
--npe-chrome-text-muted: #3a5aa8;
|
|
641
|
+
--npe-toolbar-bg: #f0f6ff;
|
|
642
|
+
--npe-toolbar-border: #aac4f6;
|
|
643
|
+
--npe-toolbar-btn-hover-bg: #d0e4ff;
|
|
644
|
+
--npe-toolbar-btn-active-bg: #0057cc;
|
|
645
|
+
--npe-toolbar-btn-active-text: #fff;
|
|
646
|
+
--npe-toolbar-separator: #aac4f6;
|
|
647
|
+
--npe-canvas-bg: #fff;
|
|
648
|
+
--npe-canvas-border: #aac4f6;
|
|
649
|
+
--npe-statusbar-bg: #dce9ff;
|
|
650
|
+
--npe-statusbar-border: #aac4f6;
|
|
651
|
+
--npe-statusbar-text: #3a5aa8;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/* \u2500\u2500\u2500 Dark Blue Theme \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
655
|
+
.npe-editor.npe-theme-dark-blue {
|
|
656
|
+
--npe-chrome-bg: #0a1628;
|
|
657
|
+
--npe-chrome-border: #1e3a5f;
|
|
658
|
+
--npe-chrome-text: #c8d8f0;
|
|
659
|
+
--npe-chrome-text-muted: #6a8cba;
|
|
660
|
+
--npe-toolbar-bg: #0d1f3c;
|
|
661
|
+
--npe-toolbar-border: #1e3a5f;
|
|
662
|
+
--npe-toolbar-btn-hover-bg: #1e3a5f;
|
|
663
|
+
--npe-toolbar-btn-active-bg: #1a5cc7;
|
|
664
|
+
--npe-toolbar-btn-active-text: #fff;
|
|
665
|
+
--npe-toolbar-separator: #1e3a5f;
|
|
666
|
+
--npe-canvas-bg: #0d1f3c;
|
|
667
|
+
--npe-canvas-border: #1e3a5f;
|
|
668
|
+
--npe-statusbar-bg: #091526;
|
|
669
|
+
--npe-statusbar-border: #1e3a5f;
|
|
670
|
+
--npe-statusbar-text: #6a8cba;
|
|
671
|
+
--npe-focus-ring: 0 0 0 2px #4d9fff66;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
/* \u2500\u2500\u2500 Midnight Theme \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
675
|
+
.npe-editor.npe-theme-midnight {
|
|
676
|
+
--npe-chrome-bg: #0c0c18;
|
|
677
|
+
--npe-chrome-border: #2a2a40;
|
|
678
|
+
--npe-chrome-text: #c0c0e0;
|
|
679
|
+
--npe-chrome-text-muted: #6060a0;
|
|
680
|
+
--npe-toolbar-bg: #111128;
|
|
681
|
+
--npe-toolbar-border: #2a2a40;
|
|
682
|
+
--npe-toolbar-btn-hover-bg: #2a2a40;
|
|
683
|
+
--npe-toolbar-btn-active-bg: #3a3a7a;
|
|
684
|
+
--npe-toolbar-btn-active-text: #c0c0ff;
|
|
685
|
+
--npe-toolbar-separator: #2a2a40;
|
|
686
|
+
--npe-canvas-bg: #111128;
|
|
687
|
+
--npe-canvas-border: #2a2a40;
|
|
688
|
+
--npe-statusbar-bg: #090914;
|
|
689
|
+
--npe-statusbar-border: #2a2a40;
|
|
690
|
+
--npe-statusbar-text: #6060a0;
|
|
691
|
+
--npe-focus-ring: 0 0 0 2px #7070ff66;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/* \u2500\u2500\u2500 Toolbar Group Responsive Wrapping \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
695
|
+
.npe-toolbar-group {
|
|
696
|
+
display: inline-flex;
|
|
697
|
+
align-items: center;
|
|
698
|
+
flex-wrap: nowrap;
|
|
699
|
+
gap: 1px;
|
|
700
|
+
padding: 0 2px;
|
|
701
|
+
/* Groups never split across lines \u2014 they wrap as units */
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/* \u2500\u2500\u2500 Dropdown Arrow \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
705
|
+
.npe-dropdown-arrow {
|
|
706
|
+
display: inline-flex;
|
|
707
|
+
align-items: center;
|
|
708
|
+
opacity: 0.7;
|
|
709
|
+
pointer-events: none;
|
|
710
|
+
flex-shrink: 0;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
.npe-dropdown-arrow svg {
|
|
714
|
+
width: 16px;
|
|
715
|
+
height: 16px;
|
|
716
|
+
fill: currentColor;
|
|
717
|
+
display: block;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/* \u2500\u2500\u2500 More Menu \u2014 pushed to far right of toolbar \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
721
|
+
.npe-toolbar-group:has(.npe-more-menu-btn),
|
|
722
|
+
.npe-more-menu-group {
|
|
723
|
+
margin-left: auto;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/* \u2500\u2500\u2500 Heading Select \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
727
|
+
.npe-heading-select {
|
|
728
|
+
max-width: 110px;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/* \u2500\u2500\u2500 Font Family Select \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
732
|
+
.npe-font-family-select {
|
|
733
|
+
max-width: 120px;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/* \u2500\u2500\u2500 Font Size Widget \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
737
|
+
|
|
738
|
+
/* Replace the <select> with a custom dropdown trigger button */
|
|
739
|
+
.npe-font-size-dropdown-btn {
|
|
740
|
+
width: 22px;
|
|
741
|
+
height: 24px;
|
|
742
|
+
padding: 0;
|
|
743
|
+
border: none;
|
|
744
|
+
border-left: 1px solid var(--npe-chrome-border);
|
|
745
|
+
border-radius: 0 2px 2px 0;
|
|
746
|
+
background: var(--npe-toolbar-bg);
|
|
747
|
+
cursor: pointer;
|
|
748
|
+
display: inline-flex;
|
|
749
|
+
align-items: center;
|
|
750
|
+
justify-content: center;
|
|
751
|
+
color: var(--npe-chrome-text);
|
|
752
|
+
opacity: 0.7;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
.npe-font-size-dropdown-btn:hover {
|
|
756
|
+
background: var(--npe-toolbar-btn-hover-bg);
|
|
757
|
+
opacity: 1;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
.npe-font-size-dropdown-btn svg {
|
|
761
|
+
width: 16px;
|
|
762
|
+
height: 16px;
|
|
763
|
+
fill: currentColor;
|
|
764
|
+
pointer-events: none;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/* The popup list */
|
|
768
|
+
.npe-font-size-popup {
|
|
769
|
+
position: absolute;
|
|
770
|
+
top: 100%;
|
|
771
|
+
left: 0;
|
|
772
|
+
background: var(--npe-toolbar-bg);
|
|
773
|
+
border: 1px solid var(--npe-chrome-border);
|
|
774
|
+
border-radius: 4px;
|
|
775
|
+
box-shadow: 0 4px 12px rgba(0,0,0,0.12);
|
|
776
|
+
z-index: var(--npe-z-modal);
|
|
777
|
+
padding: 4px 0;
|
|
778
|
+
min-width: 64px;
|
|
779
|
+
max-height: 220px;
|
|
780
|
+
overflow-y: auto;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
.npe-font-size-popup-item {
|
|
784
|
+
display: block;
|
|
785
|
+
width: 100%;
|
|
786
|
+
padding: 4px 12px;
|
|
787
|
+
background: none;
|
|
788
|
+
border: none;
|
|
789
|
+
text-align: left;
|
|
790
|
+
font-family: var(--npe-font);
|
|
791
|
+
font-size: var(--npe-font-size);
|
|
792
|
+
color: var(--npe-chrome-text);
|
|
793
|
+
cursor: pointer;
|
|
794
|
+
white-space: nowrap;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
.npe-font-size-popup-item:hover,
|
|
798
|
+
.npe-font-size-popup-item.npe-active {
|
|
799
|
+
background: var(--npe-toolbar-btn-hover-bg);
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
.npe-font-size-dec,
|
|
803
|
+
.npe-font-size-inc {
|
|
804
|
+
min-width: 22px;
|
|
805
|
+
height: 24px;
|
|
806
|
+
padding: 0 3px;
|
|
807
|
+
border: none;
|
|
808
|
+
border-radius: 0;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
.npe-font-size-dec {
|
|
812
|
+
border-radius: 2px 0 0 2px;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
.npe-font-size-inc {
|
|
816
|
+
border-radius: 0;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/* Hide the old <select>-based preset */
|
|
820
|
+
.npe-font-size-preset {
|
|
821
|
+
display: none;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/* \u2500\u2500\u2500 Color Picker Panel Layout \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
825
|
+
.npe-color-picker-row {
|
|
826
|
+
display: flex;
|
|
827
|
+
align-items: center;
|
|
828
|
+
gap: 6px;
|
|
829
|
+
margin-bottom: 6px;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
.npe-color-hex-input {
|
|
833
|
+
flex: 1;
|
|
834
|
+
height: 28px;
|
|
835
|
+
padding: 0 6px;
|
|
836
|
+
border: 1px solid var(--npe-chrome-border);
|
|
837
|
+
border-radius: 3px;
|
|
838
|
+
font-family: monospace;
|
|
839
|
+
font-size: 12px;
|
|
840
|
+
background: var(--npe-toolbar-bg);
|
|
841
|
+
color: var(--npe-chrome-text);
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
.npe-color-hex-input:focus-visible {
|
|
845
|
+
outline: none;
|
|
846
|
+
box-shadow: var(--npe-focus-ring);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
.npe-color-native {
|
|
850
|
+
width: 32px;
|
|
851
|
+
height: 28px;
|
|
852
|
+
border: none;
|
|
853
|
+
padding: 0;
|
|
854
|
+
cursor: pointer;
|
|
855
|
+
border-radius: 3px;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
/* \u2500\u2500\u2500 Toolbar Button Primary Variant \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
859
|
+
.npe-btn.npe-btn-primary {
|
|
860
|
+
background: var(--npe-toolbar-btn-active-bg);
|
|
861
|
+
color: var(--npe-toolbar-btn-active-text);
|
|
862
|
+
border-color: transparent;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
.npe-btn.npe-btn-primary:hover {
|
|
866
|
+
opacity: 0.9;
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
/* \u2500\u2500\u2500 Disabled toolbar controls \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
870
|
+
.npe-btn.npe-disabled {
|
|
871
|
+
opacity: 0.4;
|
|
872
|
+
cursor: default;
|
|
873
|
+
pointer-events: none;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
.npe-select:disabled {
|
|
877
|
+
opacity: 0.4;
|
|
878
|
+
cursor: default;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/* \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
882
|
+
TASK 6 \u2014 Insert Features: Modals, Table Context Menu, Table Resize,
|
|
883
|
+
Emoji / Special Characters Pickers
|
|
884
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
|
|
885
|
+
|
|
886
|
+
/* \u2500\u2500\u2500 Modal Header / Footer / Body \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
887
|
+
.npe-modal-header {
|
|
888
|
+
display: flex;
|
|
889
|
+
align-items: center;
|
|
890
|
+
justify-content: space-between;
|
|
891
|
+
margin-bottom: 16px;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
.npe-modal-body {
|
|
895
|
+
display: flex;
|
|
896
|
+
flex-direction: column;
|
|
897
|
+
gap: 10px;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
.npe-modal-footer {
|
|
901
|
+
display: flex;
|
|
902
|
+
justify-content: flex-end;
|
|
903
|
+
gap: 8px;
|
|
904
|
+
margin-top: 16px;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
.npe-modal-close {
|
|
908
|
+
background: none;
|
|
909
|
+
border: none;
|
|
910
|
+
font-size: 20px;
|
|
911
|
+
line-height: 1;
|
|
912
|
+
cursor: pointer;
|
|
913
|
+
color: var(--npe-chrome-text-muted);
|
|
914
|
+
padding: 2px 6px;
|
|
915
|
+
border-radius: 3px;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
.npe-modal-close:hover {
|
|
919
|
+
color: var(--npe-chrome-text);
|
|
920
|
+
background: var(--npe-toolbar-btn-hover-bg);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
.npe-modal-close:focus-visible {
|
|
924
|
+
outline: none;
|
|
925
|
+
box-shadow: var(--npe-focus-ring);
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
/* \u2500\u2500\u2500 Modal Tabs \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
929
|
+
.npe-modal-tabs {
|
|
930
|
+
display: flex;
|
|
931
|
+
gap: 0;
|
|
932
|
+
border-bottom: 2px solid var(--npe-chrome-border);
|
|
933
|
+
margin-bottom: 16px;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
.npe-tab {
|
|
937
|
+
background: none;
|
|
938
|
+
border: none;
|
|
939
|
+
border-bottom: 2px solid transparent;
|
|
940
|
+
margin-bottom: -2px;
|
|
941
|
+
padding: 6px 14px;
|
|
942
|
+
cursor: pointer;
|
|
943
|
+
color: var(--npe-chrome-text-muted);
|
|
944
|
+
font-family: var(--npe-font);
|
|
945
|
+
font-size: var(--npe-font-size);
|
|
946
|
+
font-weight: 500;
|
|
947
|
+
transition: color 0.15s, border-color 0.15s;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
.npe-tab:hover {
|
|
951
|
+
color: var(--npe-chrome-text);
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
.npe-tab.npe-tab-active {
|
|
955
|
+
color: var(--npe-toolbar-btn-active-text);
|
|
956
|
+
border-bottom-color: var(--npe-toolbar-btn-active-text);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
.npe-tab:focus-visible {
|
|
960
|
+
outline: none;
|
|
961
|
+
box-shadow: var(--npe-focus-ring);
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/* \u2500\u2500\u2500 Modal Panel \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
965
|
+
.npe-modal-panel {
|
|
966
|
+
display: flex;
|
|
967
|
+
flex-direction: column;
|
|
968
|
+
gap: 10px;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
/* \u2500\u2500\u2500 Form controls inside modals \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
972
|
+
.npe-form-label {
|
|
973
|
+
font-size: var(--npe-font-size);
|
|
974
|
+
color: var(--npe-chrome-text);
|
|
975
|
+
font-weight: 500;
|
|
976
|
+
margin-bottom: 2px;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
.npe-form-input {
|
|
980
|
+
width: 100%;
|
|
981
|
+
height: 32px;
|
|
982
|
+
padding: 0 8px;
|
|
983
|
+
border: 1px solid var(--npe-chrome-border);
|
|
984
|
+
border-radius: 4px;
|
|
985
|
+
background: var(--npe-toolbar-bg);
|
|
986
|
+
color: var(--npe-chrome-text);
|
|
987
|
+
font-family: var(--npe-font);
|
|
988
|
+
font-size: var(--npe-font-size);
|
|
989
|
+
box-sizing: border-box;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
.npe-form-input:focus-visible {
|
|
993
|
+
outline: none;
|
|
994
|
+
box-shadow: var(--npe-focus-ring);
|
|
995
|
+
border-color: var(--npe-toolbar-btn-active-text);
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
.npe-form-check-label {
|
|
999
|
+
display: flex;
|
|
1000
|
+
align-items: center;
|
|
1001
|
+
gap: 6px;
|
|
1002
|
+
cursor: pointer;
|
|
1003
|
+
color: var(--npe-chrome-text);
|
|
1004
|
+
font-size: var(--npe-font-size);
|
|
1005
|
+
user-select: none;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
.npe-form-checkbox {
|
|
1009
|
+
width: 14px;
|
|
1010
|
+
height: 14px;
|
|
1011
|
+
cursor: pointer;
|
|
1012
|
+
flex-shrink: 0;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/* Number inputs in table modal */
|
|
1016
|
+
.npe-table-number-input {
|
|
1017
|
+
width: 80px;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/* \u2500\u2500\u2500 Link Modal \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1021
|
+
.npe-link-modal {
|
|
1022
|
+
min-width: 340px;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
/* \u2500\u2500\u2500 Image / Video Modals \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1026
|
+
.npe-image-modal,
|
|
1027
|
+
.npe-video-modal {
|
|
1028
|
+
min-width: 380px;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
/* \u2500\u2500\u2500 Form group spacing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1032
|
+
.npe-form-group {
|
|
1033
|
+
display: flex;
|
|
1034
|
+
flex-direction: column;
|
|
1035
|
+
gap: 4px;
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
/* \u2500\u2500\u2500 Upload zone (image modal) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1039
|
+
.npe-image-upload-zone {
|
|
1040
|
+
position: relative;
|
|
1041
|
+
display: grid;
|
|
1042
|
+
justify-items: center;
|
|
1043
|
+
gap: 6px;
|
|
1044
|
+
padding: 24px 18px;
|
|
1045
|
+
border: 2px dashed var(--npe-chrome-border);
|
|
1046
|
+
border-radius: 8px;
|
|
1047
|
+
background: var(--npe-chrome-bg);
|
|
1048
|
+
color: var(--npe-chrome-text-muted);
|
|
1049
|
+
text-align: center;
|
|
1050
|
+
cursor: pointer;
|
|
1051
|
+
transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
|
|
1052
|
+
user-select: none;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
.npe-image-upload-zone:hover,
|
|
1056
|
+
.npe-image-upload-zone:focus-visible {
|
|
1057
|
+
border-color: var(--npe-toolbar-btn-active-text, #0057cc);
|
|
1058
|
+
background: var(--npe-toolbar-btn-active-bg);
|
|
1059
|
+
box-shadow: 0 0 0 3px rgba(0, 87, 204, 0.1);
|
|
1060
|
+
outline: none;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
.npe-image-upload-zone.drag-over {
|
|
1064
|
+
border-color: var(--npe-toolbar-btn-active-text, #0057cc);
|
|
1065
|
+
background: var(--npe-toolbar-btn-active-bg);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
.npe-image-upload-zone.has-files {
|
|
1069
|
+
border-style: solid;
|
|
1070
|
+
border-color: var(--npe-toolbar-btn-active-text, #0057cc);
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
.npe-image-upload-icon {
|
|
1074
|
+
width: 38px;
|
|
1075
|
+
height: 38px;
|
|
1076
|
+
display: flex;
|
|
1077
|
+
align-items: center;
|
|
1078
|
+
justify-content: center;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
.npe-image-upload-icon svg {
|
|
1082
|
+
width: 38px;
|
|
1083
|
+
height: 38px;
|
|
1084
|
+
display: block;
|
|
1085
|
+
border-radius: 6px;
|
|
1086
|
+
overflow: hidden;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
.npe-image-upload-title {
|
|
1090
|
+
font-size: 14px;
|
|
1091
|
+
font-weight: 600;
|
|
1092
|
+
color: var(--npe-chrome-text);
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
.npe-image-upload-hint {
|
|
1096
|
+
font-size: 12px;
|
|
1097
|
+
color: var(--npe-chrome-text-muted);
|
|
1098
|
+
line-height: 1.4;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
.npe-image-upload-files {
|
|
1102
|
+
font-size: 12px;
|
|
1103
|
+
color: var(--npe-chrome-text-muted);
|
|
1104
|
+
max-width: 100%;
|
|
1105
|
+
overflow: hidden;
|
|
1106
|
+
text-overflow: ellipsis;
|
|
1107
|
+
white-space: nowrap;
|
|
1108
|
+
line-height: 1.4;
|
|
1109
|
+
min-height: 1em;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
.npe-image-upload-zone.has-files .npe-image-upload-files {
|
|
1113
|
+
color: var(--npe-toolbar-btn-active-text, #0057cc);
|
|
1114
|
+
font-weight: 500;
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
/* \u2500\u2500\u2500 OR divider \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1118
|
+
.npe-form-divider {
|
|
1119
|
+
display: flex;
|
|
1120
|
+
align-items: center;
|
|
1121
|
+
margin: 4px 0;
|
|
1122
|
+
text-align: center;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
.npe-form-divider::before,
|
|
1126
|
+
.npe-form-divider::after {
|
|
1127
|
+
content: '';
|
|
1128
|
+
flex: 1;
|
|
1129
|
+
height: 1px;
|
|
1130
|
+
background: var(--npe-chrome-border);
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
.npe-form-divider::before { margin-right: 12px; }
|
|
1134
|
+
.npe-form-divider::after { margin-left: 12px; }
|
|
1135
|
+
|
|
1136
|
+
.npe-form-divider span {
|
|
1137
|
+
color: var(--npe-chrome-text-muted);
|
|
1138
|
+
font-size: 12px;
|
|
1139
|
+
font-weight: 500;
|
|
1140
|
+
white-space: nowrap;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
/* Dropzone */
|
|
1144
|
+
.npe-dropzone {
|
|
1145
|
+
border: 2px dashed var(--npe-chrome-border);
|
|
1146
|
+
border-radius: 6px;
|
|
1147
|
+
padding: 24px 16px;
|
|
1148
|
+
text-align: center;
|
|
1149
|
+
cursor: pointer;
|
|
1150
|
+
color: var(--npe-chrome-text-muted);
|
|
1151
|
+
font-size: var(--npe-font-size);
|
|
1152
|
+
transition: border-color 0.15s, background 0.15s;
|
|
1153
|
+
user-select: none;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
.npe-dropzone:hover,
|
|
1157
|
+
.npe-dropzone-active {
|
|
1158
|
+
border-color: var(--npe-toolbar-btn-active-text);
|
|
1159
|
+
background: var(--npe-toolbar-btn-active-bg);
|
|
1160
|
+
color: var(--npe-toolbar-btn-active-text);
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
/* Hidden file input */
|
|
1164
|
+
.npe-file-input {
|
|
1165
|
+
position: absolute;
|
|
1166
|
+
left: -9999px;
|
|
1167
|
+
opacity: 0;
|
|
1168
|
+
pointer-events: none;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
/* Upload progress */
|
|
1172
|
+
.npe-upload-progress {
|
|
1173
|
+
font-size: 12px;
|
|
1174
|
+
color: var(--npe-chrome-text-muted);
|
|
1175
|
+
padding: 4px 0;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
.npe-upload-progress::before {
|
|
1179
|
+
content: '\u27F3 ';
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/* Upload error */
|
|
1183
|
+
.npe-upload-error {
|
|
1184
|
+
font-size: 12px;
|
|
1185
|
+
color: #cc3333;
|
|
1186
|
+
padding: 4px 0;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/* \u2500\u2500\u2500 Table Modal \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1190
|
+
.npe-table-modal {
|
|
1191
|
+
min-width: 300px;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
/* \u2500\u2500\u2500 Emoji Picker / Special Characters Picker \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1195
|
+
.npe-emoji-picker,
|
|
1196
|
+
.npe-special-chars-picker {
|
|
1197
|
+
min-width: 360px;
|
|
1198
|
+
max-width: 520px;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
.npe-emoji-search {
|
|
1202
|
+
margin-bottom: 10px;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
.npe-emoji-grid,
|
|
1206
|
+
.npe-special-chars-grid {
|
|
1207
|
+
max-height: 320px;
|
|
1208
|
+
overflow-y: auto;
|
|
1209
|
+
padding-right: 4px;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
.npe-emoji-category-label {
|
|
1213
|
+
font-size: 11px;
|
|
1214
|
+
font-weight: 600;
|
|
1215
|
+
color: var(--npe-chrome-text-muted);
|
|
1216
|
+
text-transform: uppercase;
|
|
1217
|
+
letter-spacing: 0.05em;
|
|
1218
|
+
padding: 8px 2px 4px;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
.npe-emoji-row {
|
|
1222
|
+
display: flex;
|
|
1223
|
+
flex-wrap: wrap;
|
|
1224
|
+
gap: 2px;
|
|
1225
|
+
margin-bottom: 4px;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
.npe-emoji-btn {
|
|
1229
|
+
background: none;
|
|
1230
|
+
border: 1px solid transparent;
|
|
1231
|
+
border-radius: 4px;
|
|
1232
|
+
width: 32px;
|
|
1233
|
+
height: 32px;
|
|
1234
|
+
font-size: 18px;
|
|
1235
|
+
line-height: 1;
|
|
1236
|
+
cursor: pointer;
|
|
1237
|
+
display: flex;
|
|
1238
|
+
align-items: center;
|
|
1239
|
+
justify-content: center;
|
|
1240
|
+
padding: 0;
|
|
1241
|
+
transition: background 0.1s;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
.npe-emoji-btn:hover {
|
|
1245
|
+
background: var(--npe-toolbar-btn-hover-bg);
|
|
1246
|
+
border-color: var(--npe-chrome-border);
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
.npe-emoji-btn:focus-visible {
|
|
1250
|
+
outline: none;
|
|
1251
|
+
box-shadow: var(--npe-focus-ring);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
.npe-special-char-btn {
|
|
1255
|
+
background: none;
|
|
1256
|
+
border: 1px solid var(--npe-chrome-border);
|
|
1257
|
+
border-radius: 3px;
|
|
1258
|
+
width: 34px;
|
|
1259
|
+
height: 30px;
|
|
1260
|
+
font-size: 14px;
|
|
1261
|
+
line-height: 1;
|
|
1262
|
+
cursor: pointer;
|
|
1263
|
+
display: flex;
|
|
1264
|
+
align-items: center;
|
|
1265
|
+
justify-content: center;
|
|
1266
|
+
padding: 0;
|
|
1267
|
+
color: var(--npe-chrome-text);
|
|
1268
|
+
font-family: serif;
|
|
1269
|
+
transition: background 0.1s, border-color 0.1s;
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
.npe-special-char-btn:hover {
|
|
1273
|
+
background: var(--npe-toolbar-btn-hover-bg);
|
|
1274
|
+
border-color: var(--npe-toolbar-btn-active-text);
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
.npe-special-char-btn:focus-visible {
|
|
1278
|
+
outline: none;
|
|
1279
|
+
box-shadow: var(--npe-focus-ring);
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
.npe-emoji-empty {
|
|
1283
|
+
color: var(--npe-chrome-text-muted);
|
|
1284
|
+
text-align: center;
|
|
1285
|
+
padding: 12px 0;
|
|
1286
|
+
font-size: var(--npe-font-size);
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
/* \u2500\u2500\u2500 Table Context Menu \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1290
|
+
.npe-context-menu {
|
|
1291
|
+
background: var(--npe-toolbar-bg);
|
|
1292
|
+
border: 1px solid var(--npe-chrome-border);
|
|
1293
|
+
border-radius: 4px;
|
|
1294
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
|
|
1295
|
+
min-width: 180px;
|
|
1296
|
+
padding: 4px 0;
|
|
1297
|
+
font-family: var(--npe-font);
|
|
1298
|
+
font-size: var(--npe-font-size);
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
.npe-context-menu-item {
|
|
1302
|
+
display: block;
|
|
1303
|
+
width: 100%;
|
|
1304
|
+
padding: 7px 14px;
|
|
1305
|
+
text-align: left;
|
|
1306
|
+
background: none;
|
|
1307
|
+
border: none;
|
|
1308
|
+
color: var(--npe-chrome-text);
|
|
1309
|
+
cursor: pointer;
|
|
1310
|
+
font-family: var(--npe-font);
|
|
1311
|
+
font-size: var(--npe-font-size);
|
|
1312
|
+
white-space: nowrap;
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
.npe-context-menu-item:hover,
|
|
1316
|
+
.npe-context-menu-item:focus {
|
|
1317
|
+
background: var(--npe-toolbar-btn-hover-bg);
|
|
1318
|
+
outline: none;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
.npe-context-menu-item:focus-visible {
|
|
1322
|
+
box-shadow: inset var(--npe-focus-ring);
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
.npe-context-menu-sep {
|
|
1326
|
+
height: 1px;
|
|
1327
|
+
background: var(--npe-chrome-border);
|
|
1328
|
+
margin: 4px 0;
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
/* \u2500\u2500\u2500 Table Column Resize Handle \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1332
|
+
.npe-col-resize-handle {
|
|
1333
|
+
background: var(--npe-toolbar-btn-active-text);
|
|
1334
|
+
opacity: 0.5;
|
|
1335
|
+
pointer-events: all;
|
|
1336
|
+
transition: opacity 0.15s;
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
.npe-col-resize-handle:hover {
|
|
1340
|
+
opacity: 0.9;
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1343
|
+
/* \u2500\u2500\u2500 Find & Replace Modal (additional layout) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1344
|
+
.npe-find-replace-modal {
|
|
1345
|
+
min-width: 380px;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
.npe-fr-options {
|
|
1349
|
+
display: flex;
|
|
1350
|
+
gap: 16px;
|
|
1351
|
+
flex-wrap: wrap;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
/* \u2500\u2500\u2500 Source Modal (additional layout) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1355
|
+
.npe-source-modal {
|
|
1356
|
+
min-width: 520px;
|
|
1357
|
+
max-width: 80vw;
|
|
1358
|
+
width: 600px;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
.npe-source-panel {
|
|
1362
|
+
display: flex;
|
|
1363
|
+
flex-direction: column;
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
.npe-source-textarea {
|
|
1367
|
+
width: 100%;
|
|
1368
|
+
min-height: 280px;
|
|
1369
|
+
resize: vertical;
|
|
1370
|
+
padding: 10px 12px;
|
|
1371
|
+
border: 1px solid var(--npe-chrome-border);
|
|
1372
|
+
border-radius: 4px;
|
|
1373
|
+
background: var(--npe-canvas-bg);
|
|
1374
|
+
color: var(--npe-chrome-text);
|
|
1375
|
+
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
|
|
1376
|
+
font-size: 12px;
|
|
1377
|
+
line-height: 1.5;
|
|
1378
|
+
tab-size: 2;
|
|
1379
|
+
box-sizing: border-box;
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
.npe-source-textarea:focus-visible {
|
|
1383
|
+
outline: none;
|
|
1384
|
+
box-shadow: var(--npe-focus-ring);
|
|
1385
|
+
border-color: var(--npe-toolbar-btn-active-text);
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
|
|
1389
|
+
/* \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
1390
|
+
TASK 7 \u2014 Overlays: Image/Video Resize, Floating Toolbar, Block Drag-Drop
|
|
1391
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
|
|
1392
|
+
|
|
1393
|
+
/* \u2500\u2500\u2500 Image / Video Selection Border \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1394
|
+
.npe-img-select-border {
|
|
1395
|
+
position: fixed;
|
|
1396
|
+
box-sizing: border-box;
|
|
1397
|
+
border: 2px solid var(--npe-toolbar-btn-active-text, #0057cc);
|
|
1398
|
+
border-radius: 2px;
|
|
1399
|
+
pointer-events: none;
|
|
1400
|
+
z-index: 10100;
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
/* \u2500\u2500\u2500 Image / Video Resize Handles \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1404
|
+
.npe-img-resize-handle {
|
|
1405
|
+
position: fixed;
|
|
1406
|
+
width: 8px;
|
|
1407
|
+
height: 8px;
|
|
1408
|
+
background: var(--npe-toolbar-bg, #fff);
|
|
1409
|
+
border: 2px solid var(--npe-toolbar-btn-active-text, #0057cc);
|
|
1410
|
+
border-radius: 2px;
|
|
1411
|
+
box-sizing: border-box;
|
|
1412
|
+
z-index: 10101;
|
|
1413
|
+
pointer-events: all;
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
/* Cursor per handle position */
|
|
1417
|
+
.npe-img-handle-nw { cursor: nw-resize; }
|
|
1418
|
+
.npe-img-handle-n { cursor: n-resize; }
|
|
1419
|
+
.npe-img-handle-ne { cursor: ne-resize; }
|
|
1420
|
+
.npe-img-handle-e { cursor: e-resize; }
|
|
1421
|
+
.npe-img-handle-se { cursor: se-resize; }
|
|
1422
|
+
.npe-img-handle-s { cursor: s-resize; }
|
|
1423
|
+
.npe-img-handle-sw { cursor: sw-resize; }
|
|
1424
|
+
.npe-img-handle-w { cursor: w-resize; }
|
|
1425
|
+
|
|
1426
|
+
/* \u2500\u2500\u2500 Image / Video Live Size Label \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1427
|
+
.npe-img-size-label {
|
|
1428
|
+
position: fixed;
|
|
1429
|
+
background: rgba(0, 0, 0, 0.72);
|
|
1430
|
+
color: #fff;
|
|
1431
|
+
font-size: 11px;
|
|
1432
|
+
font-family: var(--npe-font, system-ui, sans-serif);
|
|
1433
|
+
padding: 2px 7px;
|
|
1434
|
+
border-radius: 3px;
|
|
1435
|
+
pointer-events: none;
|
|
1436
|
+
z-index: 10102;
|
|
1437
|
+
white-space: nowrap;
|
|
1438
|
+
user-select: none;
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
/* \u2500\u2500\u2500 Image / Video Contextual Mini-Toolbar \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1442
|
+
.npe-img-toolbar {
|
|
1443
|
+
position: fixed;
|
|
1444
|
+
display: flex;
|
|
1445
|
+
align-items: center;
|
|
1446
|
+
gap: 2px;
|
|
1447
|
+
background: var(--npe-toolbar-bg, #fff);
|
|
1448
|
+
border: 1px solid var(--npe-chrome-border, #d0d0d0);
|
|
1449
|
+
border-radius: 4px;
|
|
1450
|
+
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
|
|
1451
|
+
padding: 3px 5px;
|
|
1452
|
+
z-index: 10103;
|
|
1453
|
+
pointer-events: all;
|
|
1454
|
+
user-select: none;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
.npe-img-toolbar-btn {
|
|
1458
|
+
display: inline-flex;
|
|
1459
|
+
align-items: center;
|
|
1460
|
+
justify-content: center;
|
|
1461
|
+
width: 26px;
|
|
1462
|
+
height: 26px;
|
|
1463
|
+
background: transparent;
|
|
1464
|
+
border: 1px solid transparent;
|
|
1465
|
+
border-radius: 3px;
|
|
1466
|
+
cursor: pointer;
|
|
1467
|
+
font-size: 14px;
|
|
1468
|
+
line-height: 1;
|
|
1469
|
+
color: var(--npe-chrome-text, #222);
|
|
1470
|
+
padding: 0;
|
|
1471
|
+
font-family: var(--npe-font, system-ui, sans-serif);
|
|
1472
|
+
transition: background 0.1s;
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
.npe-img-toolbar-btn:hover {
|
|
1476
|
+
background: var(--npe-toolbar-btn-hover-bg, #e8e8e8);
|
|
1477
|
+
border-color: var(--npe-chrome-border, #d0d0d0);
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
.npe-img-toolbar-btn:focus-visible {
|
|
1481
|
+
outline: none;
|
|
1482
|
+
box-shadow: var(--npe-focus-ring, 0 0 0 2px #0057cc66);
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
.npe-img-drag-handle {
|
|
1486
|
+
cursor: grab;
|
|
1487
|
+
font-size: 16px;
|
|
1488
|
+
letter-spacing: -1px;
|
|
1489
|
+
color: var(--npe-chrome-text-muted, #666);
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
.npe-img-drag-handle:active {
|
|
1493
|
+
cursor: grabbing;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
.npe-img-delete-btn:hover {
|
|
1497
|
+
background: #fde0e0;
|
|
1498
|
+
border-color: #cc3333;
|
|
1499
|
+
color: #cc3333;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
/* \u2500\u2500\u2500 Floating Selection Toolbar \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1503
|
+
.npe-floating-toolbar {
|
|
1504
|
+
position: fixed;
|
|
1505
|
+
display: flex;
|
|
1506
|
+
align-items: center;
|
|
1507
|
+
gap: 2px;
|
|
1508
|
+
background: var(--npe-toolbar-bg, #fff);
|
|
1509
|
+
border: 1px solid var(--npe-chrome-border, #d0d0d0);
|
|
1510
|
+
border-radius: 5px;
|
|
1511
|
+
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
|
|
1512
|
+
padding: 3px 5px;
|
|
1513
|
+
z-index: 10200;
|
|
1514
|
+
pointer-events: all;
|
|
1515
|
+
user-select: none;
|
|
1516
|
+
/* Subtle entrance animation */
|
|
1517
|
+
animation: npe-ftb-appear 0.12s ease-out both;
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
@keyframes npe-ftb-appear {
|
|
1521
|
+
from { opacity: 0; transform: translateY(4px); }
|
|
1522
|
+
to { opacity: 1; transform: translateY(0); }
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
.npe-floating-toolbar-btn {
|
|
1526
|
+
display: inline-flex;
|
|
1527
|
+
align-items: center;
|
|
1528
|
+
justify-content: center;
|
|
1529
|
+
min-width: 26px;
|
|
1530
|
+
height: 26px;
|
|
1531
|
+
background: transparent;
|
|
1532
|
+
border: 1px solid transparent;
|
|
1533
|
+
border-radius: 3px;
|
|
1534
|
+
cursor: pointer;
|
|
1535
|
+
font-size: 13px;
|
|
1536
|
+
line-height: 1;
|
|
1537
|
+
color: var(--npe-chrome-text, #222);
|
|
1538
|
+
padding: 0 4px;
|
|
1539
|
+
font-family: var(--npe-font, system-ui, sans-serif);
|
|
1540
|
+
transition: background 0.1s;
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
.npe-floating-toolbar-btn:hover {
|
|
1544
|
+
background: var(--npe-toolbar-btn-hover-bg, #e8e8e8);
|
|
1545
|
+
border-color: var(--npe-chrome-border, #d0d0d0);
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
.npe-floating-toolbar-btn:focus-visible {
|
|
1549
|
+
outline: none;
|
|
1550
|
+
box-shadow: var(--npe-focus-ring, 0 0 0 2px #0057cc66);
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
.npe-floating-toolbar-sep {
|
|
1554
|
+
display: inline-block;
|
|
1555
|
+
width: 1px;
|
|
1556
|
+
height: 18px;
|
|
1557
|
+
background: var(--npe-toolbar-separator, #d0d0d0);
|
|
1558
|
+
margin: 0 3px;
|
|
1559
|
+
flex-shrink: 0;
|
|
1560
|
+
}
|
|
1561
|
+
|
|
1562
|
+
/* \u2500\u2500\u2500 Block Drag Ghost \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1563
|
+
.npe-block-drag-ghost {
|
|
1564
|
+
background: var(--npe-toolbar-btn-active-bg, #d0e4ff);
|
|
1565
|
+
border: 2px dashed var(--npe-toolbar-btn-active-text, #0057cc);
|
|
1566
|
+
border-radius: 3px;
|
|
1567
|
+
opacity: 0.7;
|
|
1568
|
+
pointer-events: none;
|
|
1569
|
+
z-index: 20000;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
/* \u2500\u2500\u2500 Drop Placeholder (rendered inside iframe via injected style) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
1573
|
+
The placeholder itself is a <div> injected into the iframe document.
|
|
1574
|
+
Its styles must be applied inline (since we can't inject host CSS into iframe).
|
|
1575
|
+
The .npe-drop-placeholder class is kept here for documentation purposes only \u2014
|
|
1576
|
+
styles are set inline in BlockDragDrop._showPlaceholder().
|
|
1577
|
+
\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
/* \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
1581
|
+
TASK 9 \u2014 Help Panel / Keyboard Shortcuts
|
|
1582
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550 */
|
|
1583
|
+
|
|
1584
|
+
.npe-help-panel {
|
|
1585
|
+
min-width: 360px;
|
|
1586
|
+
max-width: 520px;
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
.npe-help-body {
|
|
1590
|
+
padding: 0;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
.npe-help-table {
|
|
1594
|
+
width: 100%;
|
|
1595
|
+
border-collapse: collapse;
|
|
1596
|
+
font-size: var(--npe-font-size);
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
.npe-help-table tr:not(:last-child) td {
|
|
1600
|
+
border-bottom: 1px solid var(--npe-chrome-border);
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
.npe-help-key,
|
|
1604
|
+
.npe-help-action {
|
|
1605
|
+
padding: 7px 8px;
|
|
1606
|
+
color: var(--npe-chrome-text);
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
.npe-help-key {
|
|
1610
|
+
white-space: nowrap;
|
|
1611
|
+
width: 1%;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
.npe-help-key kbd {
|
|
1615
|
+
display: inline-block;
|
|
1616
|
+
background: var(--npe-chrome-bg);
|
|
1617
|
+
border: 1px solid var(--npe-chrome-border);
|
|
1618
|
+
border-radius: 3px;
|
|
1619
|
+
padding: 1px 6px;
|
|
1620
|
+
font-family: var(--npe-font);
|
|
1621
|
+
font-size: 12px;
|
|
1622
|
+
color: var(--npe-chrome-text);
|
|
1623
|
+
box-shadow: 0 1px 0 var(--npe-chrome-border);
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
/* \u2500\u2500\u2500 Statusbar label/value spacing \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
|
|
1627
|
+
.npe-statusbar-label {
|
|
1628
|
+
color: var(--npe-statusbar-text);
|
|
1629
|
+
margin-right: 4px;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
.npe-statusbar-value {
|
|
1633
|
+
color: var(--npe-chrome-text);
|
|
1634
|
+
font-weight: 500;
|
|
1635
|
+
}
|
|
1636
|
+
`;var O=[],Ze=!1;function jt(){if(Ze||typeof document=="undefined"||!Ne)return;Ze=!0;let r=document.createElement("style");r.id="npe-editor-css",r.textContent=Ne,document.head.appendChild(r)}function Kt(r){if(typeof r=="string"){let e=document.querySelector(r);if(!e)throw new Error(`NeikiPageEditor: target element not found for selector "${r}"`);return e}if(r instanceof Element)return r;throw new Error("NeikiPageEditor: target must be a CSS selector string or an Element")}var Se=class{constructor(e,t={}){jt();let n=Kt(e),i=X(t);this._editor=new ze(n,i);for(let o of O)try{o.init(this)}catch(s){}if(typeof i.onReady=="function"){let o=this,s=this._editor.getBus().on("editor:ready",()=>{s(),typeof i.onReady=="function"&&i.onReady(o)})}}getContent(){return this._editor.getContent()}setContent(e){this._editor.setContent(e)}getPage(){return this._editor.getPage()}setPage(e){this._editor.setPage(e)}getStyles(){return this._editor.getStyles()}setStyles(e){this._editor.setStyles(e)}getText(){return this._editor.getText()}isEmpty(){return this._editor.isEmpty()}focus(){this._editor.focus()}blur(){this._editor.blur()}enable(){this._editor.enable()}disable(){this._editor.disable()}triggerSave(){return this._editor.triggerSave()}toggleFullscreen(){this._editor.toggleFullscreen()}setTheme(e){this._editor.setTheme(e)}toggleTheme(){this._editor.toggleTheme()}getTheme(){return this._editor.getTheme()}destroy(){for(let e of O)if(typeof e.destroy=="function")try{e.destroy()}catch(t){}this._editor.destroy()}static registerPlugin(e){if(!e||typeof e.id!="string"||typeof e.init!="function")throw new Error("NeikiPageEditor.registerPlugin: plugin must have an id string and init function");O.find(t=>t.id===e.id)||O.push(e)}static getPlugins(){return O.slice()}static addTranslation(e,t){Ve(e,t)}},Wt=Se;return it($t);})();
|
|
1637
|
+
if(typeof window!=="undefined"&&typeof NeikiPageEditor!=="undefined"){window.NeikiPageEditor=NeikiPageEditor.default||NeikiPageEditor;}
|