Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@editora/plugins

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@editora/plugins - npm Package Compare versions

Comparing version
1.0.14
to
1.0.15
+1
dist/format-painter.cjs.js
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E='.rte-content, .editora-content, [contenteditable="true"]',st="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",N="p,div,li,h1,h2,h3,h4,h5,h6,blockquote,pre,td,th",_="ul,ol",y="b,strong,i,em,u,s,strike,font,span",w="td,th",d="data-editora-format-painter-bookmark",O=["link","address","comments","citations","track-changes"],L=["fontFamily","fontSize","color","backgroundColor","textTransform"],at=["textAlign","lineHeight","marginLeft","marginRight"],lt=["listStyleType"],ct=["borderCollapse","borderSpacing","width"],ut=["backgroundColor","textAlign","verticalAlign","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","paddingTop","paddingRight","paddingBottom","paddingLeft"],X={background:"backgroundcolor",bgcolor:"backgroundcolor",blockquote:"block",blocks:"block",font:"fontfamily",fontname:"fontfamily",fontsize:"fontsize",foreground:"color",forecolor:"color",heading:"block",headings:"block",liststyle:"list",lists:"list",strike:"strikethrough",tablecell:"table",tablecells:"table",textcolor:"color",texttransform:"texttransform"},ft='<svg width="24" height="24" focusable="false" viewBox="0 0 24 24"><path d="M17.8 3.2a2.8 2.8 0 0 1 4 4L14 15l-4-4 7.8-7.8Zm-1.4 4.2L19 10l1.4-1.4-2.6-2.6-1.4 1.4Zm-7.8 5 3 3-1.4 1.4c-.5.5-1.2.8-1.9.8H7.2l-1.6 1.6a2.7 2.7 0 0 1-3.8 0 1 1 0 0 1 0-1.4l6.8-5.4Zm-.2 3.2H9l-4.6 3.7c.2 0 .5-.2.7-.4l1.9-1.9c.2-.2.4-.3.7-.3h1.1c.2 0 .5-.1.6-.3l.2-.2-1.2-1.3ZM5.5 3l.7 1.8L8 5.5l-1.8.7L5.5 8l-.7-1.8L3 5.5l1.8-.7L5.5 3Zm3.8 4.4.5 1.2 1.2.5-1.2.5-.5 1.2-.5-1.2-1.2-.5 1.2-.5.5-1.2Z" fill-rule="evenodd"></path></svg>',v=new WeakMap;let I=null,P=!1,p={ignoredFormats:O,keepActiveAfterMouseApply:!1};const dt=(t={})=>{const e={ignoredFormats:t.ignoredFormats??O,keepActiveAfterMouseApply:t.keepActiveAfterMouseApply??!1};return p=e,{name:"formatPainter",toolbar:[{label:"Format Painter",command:"toggleFormatPainter",icon:ft,shortcut:"Ctrl+Alt+C / Ctrl+Alt+V"}],commands:{retrieveFormats:(n,r)=>Y(r,e),paintFormats:(n,r)=>J(r,e),toggleFormatPainter:(n,r)=>mt(r,e),cancelFormatPainter:(n,r)=>j(r)},initialize:()=>{gt()}}};function Y(t,e=p){const n=C(t);if(!n)return!1;const r=U(n,e);if(!r)return!1;const o=g(n);return o.options=e,o.snapshot=r,I=r,M(n,!1),!0}function J(t,e=p){const n=C(t);if(!n)return!1;const r=g(n);r.options=e;const o=r.snapshot||I;return o?Q(n,o):!1}function mt(t,e=p){const n=C(t);if(!n)return!1;const r=g(n);if(r.options=e,r.active)return h(n,!1),!0;const o=U(n,e);return o?(r.snapshot=o,I=o,h(n,!0),!0):!1}function j(t){const e=C(t);return e?(h(e,!1),!0):(document.querySelectorAll(`${E}.rte-format-painter-active`).forEach(n=>{h(n,!1)}),!0)}function gt(){P||typeof document>"u"||(P=!0,document.addEventListener("keydown",Et,!0),document.addEventListener("mouseup",ht,!0))}function Et(t){const e=t.key.toLowerCase(),n=t.ctrlKey||t.metaKey;if(t.key==="Escape"){j();return}if(!n||!t.altKey||t.shiftKey)return;const r=G()||C();if(r){if(e==="c"){Y({contentElement:r},g(r).options)&&t.preventDefault();return}e==="v"&&J({contentElement:r},g(r).options)&&t.preventDefault()}}function ht(t){const e=t.target;if(e?.closest(".rte-toolbar-wrapper, .editora-toolbar-container"))return;const n=e?.closest(E);if(!(n instanceof HTMLElement))return;const r=g(n);if(!r.active||!r.snapshot)return;const o=window.getSelection();if(!o||o.rangeCount===0||o.getRangeAt(0).collapsed)return;Q(n,r.snapshot)&&!r.options.keepActiveAfterMouseApply&&h(n,!1)}function g(t){let e=v.get(t);return e||(e={snapshot:null,active:!1,options:p},v.set(t,e)),e}function C(t){if(t?.contentElement instanceof HTMLElement)return t.contentElement;const e=D(t?.editorElement??null);if(e)return e;const n=typeof window<"u"?window.__editoraCommandEditorRoot:null,r=D(n);return r||G()||pt()}function D(t){return t?t.matches(E)?t:t.querySelector(E):null}function G(){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const e=t.getRangeAt(0),r=f(e.commonAncestorContainer)?.closest(E);return r instanceof HTMLElement?r:null}function pt(){const t=document.activeElement;if(!(t instanceof HTMLElement))return null;const e=t.closest(E);return e instanceof HTMLElement?e:null}function f(t){return t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null}function U(t,e){const n=window.getSelection(),r=n&&n.rangeCount>0?n.getRangeAt(0):null,o=r?r.collapsed?r.startContainer:r.commonAncestorContainer:null,i=f(o)||t;if(!t.contains(i))return null;const s=ne(e.ignoredFormats),a=nt(i,t),l=i.closest("li"),u=l?.closest(_),m=i.closest(w),it=m?.closest("table");return{inline:Ct(r,i,t,s),block:!c(s,"block")&&a?Nt(a,s):null,list:!c(s,"list")&&u?St(u,l):null,table:c(s,"table")?null:kt(it,m,s),ignoredFormats:s}}function Ct(t,e,n,r){if(!t||t.collapsed)return H(e,r);const i=Tt(t,e,n).map(s=>H(s,r));return bt(i)}function Tt(t,e,n){const r=[],o=document.createTreeWalker(t.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode:s=>!n.contains(s)||!t.intersectsNode(s)?NodeFilter.FILTER_REJECT:(s.textContent||"").trim()?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});let i=o.nextNode();for(;i&&r.length<64;){const s=f(i);s&&!r.includes(s)&&r.push(s),i=o.nextNode()}return r.length>0?r:[e]}function H(t,e){const n=window.getComputedStyle(t),r={};c(e,"bold")||(r.bold=At(t,n)),c(e,"italic")||(r.italic=yt(t,n)),c(e,"underline")||(r.underline=$(t,n,"underline")),c(e,"strikethrough")||(r.strikethrough=$(t,n,"line-through"));const o={};return L.forEach(i=>{if(c(e,i))return;const s=n[i];Lt(i,s)&&(o[i]=s)}),{marks:r,styles:o}}function bt(t){const e={};["bold","italic","underline","strikethrough"].forEach(o=>{const i=t.map(s=>s.marks[o]).filter(s=>s!=null);i.length!==0&&(e[o]=i.every(Boolean))});const r={};return L.forEach(o=>{const i=t.map(s=>s.styles[o]).filter(s=>!!s);i.length===t.length&&i.every(s=>s===i[0])&&(r[o]=i[0])}),{marks:e,styles:r}}function Nt(t,e){const n=window.getComputedStyle(t),r={};at.forEach(s=>{if(c(e,s))return;const l=t.style[s]||n[s];Rt(s,l)&&(r[s]=l)});const o={},i=t.getAttribute("dir")||t.style.direction;return(i==="ltr"||i==="rtl"||i==="auto")&&(o.dir=i),{tagName:rt(t),styles:r,attrs:o}}function St(t,e){const n={};lt.forEach(i=>{const s=t.style[i]||window.getComputedStyle(t)[i];s&&s!=="disc"&&s!=="decimal"&&(n[i]=s)});const r={};b(t,r,"data-type"),b(t,r,"type");const o={};return e&&(b(e,o,"data-type"),b(e,o,"data-checked")),{tagName:t.tagName.toLowerCase()==="ol"?"ol":"ul",styles:n,attrs:r,itemAttrs:o}}function kt(t,e,n){return!t&&!e?null:{table:t?W(t,ct,n):null,cell:e?W(e,ut,n):null}}function W(t,e,n){const r=window.getComputedStyle(t),o={};return e.forEach(i=>{if(c(n,i))return;const a=t.style[i]||r[i];wt(i,a)&&(o[i]=a)}),{styles:o,attrs:{}}}function At(t,e){if(t.closest("b,strong"))return!0;const n=e.fontWeight;return/^(bold|bolder|[5-9]\d{2,})$/.test(n)}function yt(t,e){return!!t.closest("i,em")||e.fontStyle==="italic"}function $(t,e,n){const r=n==="underline"?"u":"s,strike";return!!t.closest(r)||e.textDecorationLine.includes(n)}function Lt(t,e){return!(!e||t==="backgroundColor"&&(e==="rgba(0, 0, 0, 0)"||e==="transparent")||t==="textTransform"&&e==="none")}function Rt(t,e){return!(!e||t==="textAlign"&&e==="start"||t==="lineHeight"&&e==="normal"||(t==="marginLeft"||t==="marginRight")&&e==="0px")}function wt(t,e){return!(!e||(t==="backgroundColor"||t.endsWith("Color"))&&(e==="rgba(0, 0, 0, 0)"||e==="transparent")||t==="textAlign"&&e==="start"||t==="verticalAlign"&&e==="middle"||t.endsWith("Width")&&e==="0px"||t.endsWith("Style")&&e==="none"||t.startsWith("padding")&&e==="0px"||t==="borderSpacing"&&e==="0px"||t==="width"&&e==="auto")}function Q(t,e){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const r=n.getRangeAt(0);if(!t.contains(r.startContainer)||!t.contains(r.endContainer))return!1;const o=t.innerHTML,i=!r.collapsed,s=jt(t);Mt(t,r,e.table),Ft(t,r,e),s?.();const a=window.getSelection(),l=a&&a.rangeCount>0?a.getRangeAt(0):null;i&&a&&l&&t.contains(l.startContainer)&&t.contains(l.endContainer)&&_t(l,a,e),Qt(t),te(t);const u=t.innerHTML;return o===u?!1:(ee(t,o,u),t.dispatchEvent(new Event("input",{bubbles:!0})),!0)}function Ft(t,e,n){const r=Yt(t,e);n.list&&Kt(r,n.list),n.block&&r.forEach(o=>{const i=o.isConnected?o:null;if(!i)return;const s=Zt(i,n.block.tagName);S(s,n.block.styles),n.block.attrs.dir?s.setAttribute("dir",n.block.attrs.dir):s.removeAttribute("dir")})}function Mt(t,e,n){if(!n)return;const r=Vt(t,e);if(n.cell&&r.forEach(i=>{S(i,n.cell.styles)}),!n.table)return;const o=new Set;if(r.forEach(i=>{const s=i.closest("table");s instanceof HTMLElement&&o.add(s)}),o.size===0){const i=f(e.startContainer)?.closest("table");i instanceof HTMLElement&&t.contains(i)&&o.add(i)}o.forEach(i=>{S(i,n.table.styles)})}function _t(t,e,n){Pt(t);const r=n.inline,o=t.cloneContents();if(Jt(o)){Ot(t,e,n);return}const i=t.extractContents();zt(i,n);const s=document.createDocumentFragment(),a=K("start"),l=K("end");s.appendChild(a),s.appendChild(et(i,r)),s.appendChild(l),t.insertNode(s),Ht(a,l,n);const u=document.createRange();u.setStartAfter(a),u.setEndBefore(l),e.removeAllRanges(),e.addRange(u)}function Ot(t,e,n){const r=It(t),o=[];if(r.forEach(s=>{let a=xt(s,t);if(!a||!a.data.trim()||qt(a))return;a=Bt(a,n);const l=et(document.createTextNode(a.data),n.inline);a.parentNode?.replaceChild(l,a),o.push(l)}),o.length===0)return;const i=document.createRange();i.setStartBefore(o[0]),i.setEndAfter(o[o.length-1]),e.removeAllRanges(),e.addRange(i)}function It(t){if(t.startContainer===t.endContainer&&t.startContainer.nodeType===Node.TEXT_NODE)return[t.startContainer];const e=[],n=document.createTreeWalker(t.commonAncestorContainer,NodeFilter.SHOW_TEXT,{acceptNode:o=>!o.textContent||!o.textContent.trim()||!t.intersectsNode(o)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});let r=n.nextNode();for(;r;)e.push(r),r=n.nextNode();return e}function xt(t,e){const n=t.data.length;let r=0,o=n;if(t===e.startContainer&&(r=Math.max(0,Math.min(e.startOffset,n))),t===e.endContainer&&(o=Math.max(0,Math.min(e.endOffset,n))),r>=o)return null;let i=t;return o<i.data.length&&i.splitText(o),r>0&&(i=i.splitText(r)),i}function Bt(t,e){let n=t,r=n.parentElement;for(;r&&r.matches(y)&&!x(r,e)&&tt(r,e);)vt(r,n),r=n.parentElement;return n}function vt(t,e){const n=t.parentNode;if(!n||e.parentNode!==t)return;const r=t.cloneNode(!1),o=t.cloneNode(!1);for(;t.firstChild&&t.firstChild!==e;)r.appendChild(t.firstChild);for(;e.nextSibling;)o.appendChild(e.nextSibling);q(r)&&n.insertBefore(r,t),n.insertBefore(e,t),q(o)&&n.insertBefore(o,t),n.removeChild(t)}function q(t){return Array.from(t.childNodes).some(e=>e.nodeType!==Node.TEXT_NODE?!0:!!(e.textContent||"").trim())}function Pt(t){let e=f(t.startContainer),n=f(t.endContainer);for(;e&&e===n&&e.matches(y);){if(!Dt(t,e))return;t.selectNode(e),e=e.parentElement,n=f(t.endContainer)}}function Dt(t,e){const n=document.createRange();return n.selectNodeContents(e),t.compareBoundaryPoints(Range.START_TO_START,n)===0&&t.compareBoundaryPoints(Range.END_TO_END,n)===0}function Ht(t,e,n){let r=f(t.parentNode);for(;r&&r.contains(e);){const o=r.parentElement;r.matches(y)&&!x(r,n)&&Wt(r,t,e)&&tt(r,n)&&k(r),r=o}}function Wt(t,e,n){let r="before";for(const o of Array.from(t.childNodes)){if(o===e){r="inside";continue}if(o===n){r="after";continue}if(r!=="inside"&&!$t(o))return!1}return r==="after"}function $t(t){return t.nodeType===Node.TEXT_NODE?!(t.textContent||"").replace(/\uFEFF/g,"").trim():t.nodeType===Node.COMMENT_NODE?ot(t):t.nodeType!==Node.ELEMENT_NODE?!0:t.hasAttribute(d)}function tt(t,e){return t.matches("span")?L.some(n=>!c(e.ignoredFormats,n)):t.matches("b,strong")?!c(e.ignoredFormats,"bold"):t.matches("i,em")?!c(e.ignoredFormats,"italic"):t.matches("u")?!c(e.ignoredFormats,"underline"):t.matches("s,strike")?!c(e.ignoredFormats,"strikethrough"):!0}function qt(t){return t.nodeType!==Node.TEXT_NODE||(t.textContent||"").trim()?!1:!!t.parentElement?.matches(_)}function et(t,e){let n=t;const r=Object.entries(e.styles);if(r.length>0){const o=document.createElement("span");o.classList.add("rte-format-painted"),r.forEach(([i,s])=>{o.style.setProperty(B(i),s)}),o.appendChild(n),n=o}return e.marks.strikethrough&&(n=T("s",n)),e.marks.underline&&(n=T("u",n)),e.marks.italic&&(n=T("i",n)),e.marks.bold&&(n=T("b",n)),n}function T(t,e){const n=document.createElement(t);return n.appendChild(e),n}function zt(t,e){Array.from(t.querySelectorAll(y)).forEach(n=>{if(n instanceof HTMLElement&&!x(n,e)){if(n.matches("span")){if(L.forEach(r=>{c(e.ignoredFormats,r)||n.style.removeProperty(B(r))}),n.getAttribute("style")||n.attributes.length>0)return;k(n);return}n.matches("b,strong")&&c(e.ignoredFormats,"bold")||n.matches("i,em")&&c(e.ignoredFormats,"italic")||n.matches("u")&&c(e.ignoredFormats,"underline")||n.matches("s,strike")&&c(e.ignoredFormats,"strikethrough")||k(n)}})}function x(t,e){return!!(t.matches("a")&&c(e.ignoredFormats,"link")||R(t,"comment")&&c(e.ignoredFormats,"comments")||R(t,"citation")&&c(e.ignoredFormats,"citations")||R(t,"track")&&c(e.ignoredFormats,"trackchanges"))}function R(t,e){const n=e.toLowerCase();return t.className.toString().toLowerCase().includes(n)?!0:Array.from(t.attributes).some(o=>{const i=A(o.name),s=o.value.toLowerCase();return i.includes(n)||s.includes(n)})}function Kt(t,e){t.filter(r=>r.tagName.toLowerCase()==="li").forEach(r=>{const o=r.closest(_);if(!o)return;const i=Xt(o,e.tagName);S(i,e.styles),Z(i,e.attrs),Z(r,e.itemAttrs)})}function Vt(t,e){const n=Array.from(t.querySelectorAll(w)).filter(o=>o instanceof HTMLElement&&e.intersectsNode(o));if(n.length>0)return n;const r=f(e.startContainer)?.closest(w);return r instanceof HTMLElement&&t.contains(r)?[r]:[]}function S(t,e){Object.entries(e).forEach(([n,r])=>{t.style.setProperty(B(n),r)})}function Zt(t,e){const n=rt(t);if(n===e||n==="li"||n==="td"||n==="th")return t;if(e==="blockquote"){const o=document.createElement("blockquote");for(;t.firstChild;)o.appendChild(t.firstChild);return F(t,o),t.parentNode?.replaceChild(o,t),o}if(!/^(p|div|h[1-6]|pre)$/.test(e))return t;const r=document.createElement(e);for(;t.firstChild;)r.appendChild(t.firstChild);return F(t,r),t.parentNode?.replaceChild(r,t),r}function Xt(t,e){if(t.tagName.toLowerCase()===e)return t;const n=document.createElement(e);for(;t.firstChild;)n.appendChild(t.firstChild);return F(t,n),t.parentNode?.replaceChild(n,t),n}function Yt(t,e){const n=Array.from(t.querySelectorAll(N)).filter(o=>o instanceof HTMLElement&&e.intersectsNode(o));if(n.length>0)return n.filter(o=>!n.some(i=>i!==o&&i.contains(o)));const r=nt(f(e.startContainer),t);return r?[r]:[]}function nt(t,e){const n=t?.closest(N);return n instanceof HTMLElement&&e.contains(n)?n:null}function rt(t){const e=t.tagName.toLowerCase();return e==="blockquote"||/^h[1-6]$/.test(e)||e==="pre"||e==="li"||e==="td"||e==="th"?e:"p"}function Jt(t){return Array.from(t.childNodes).some(e=>{if(e.nodeType!==Node.ELEMENT_NODE)return!1;const n=e;return n.matches(N)||!!n.querySelector(N)})}function jt(t){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const n=e.getRangeAt(0);if(!t.contains(n.startContainer)||!t.contains(n.endContainer))return null;const r=n.collapsed,o=z("start"),i=z("end"),s=n.cloneRange();if(!r){const l=s.cloneRange();l.collapse(!1),l.insertNode(i)}const a=s.cloneRange();return a.collapse(!0),a.insertNode(o),()=>{const l=V(t,"start"),u=V(t,"end");if(!l)return;const m=document.createRange();r||!u?(m.setStartAfter(l),m.collapse(!0)):(m.setStartAfter(l),m.setEndBefore(u)),e.removeAllRanges(),e.addRange(m)}}function z(t){return document.createComment(`${d}:selection:${t}`)}function K(t){return document.createComment(`${d}:inline:${t}`)}function ot(t){return Gt(t)||Ut(t)}function Gt(t){return t.nodeType===Node.COMMENT_NODE&&(t.nodeValue===`${d}:selection:start`||t.nodeValue===`${d}:selection:end`)}function Ut(t){return t.nodeType===Node.COMMENT_NODE&&(t.nodeValue===`${d}:inline:start`||t.nodeValue===`${d}:inline:end`)}function V(t,e){const n=`${d}:selection:${e}`,r=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT);let o=r.nextNode();for(;o;){if(o.nodeValue===n)return o;o=r.nextNode()}return null}function Qt(t){t.querySelectorAll(`[${d}]`).forEach(o=>o.remove());const e=document.createTreeWalker(t,NodeFilter.SHOW_COMMENT),n=[];let r=e.nextNode();for(;r;)ot(r)&&n.push(r),r=e.nextNode();n.forEach(o=>o.remove())}function te(t){t.querySelectorAll("span").forEach(e=>{e instanceof HTMLElement&&(e.attributes.length>0||k(e))})}function k(t){const e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}function b(t,e,n){const r=t.getAttribute(n);r!=null&&(e[n]=r)}function Z(t,e){["data-type","data-checked","type"].forEach(n=>{e[n]!=null&&t.setAttribute(n,e[n])})}function F(t,e){Array.from(t.attributes).forEach(n=>{n.name!=="style"&&e.setAttribute(n.name,n.value)})}function h(t,e){const n=g(t);if(n.active===e&&t.classList.contains("rte-format-painter-active")===e){M(t,e);return}n.active=e,t.classList.toggle("rte-format-painter-active",e),M(t,e)}function M(t,e){const n=t.closest(st)||document;n.querySelectorAll('[data-command="toggleFormatPainter"], [data-command="formatPainter"]').forEach(o=>{o instanceof HTMLElement&&(o.classList.toggle("active",e),o.setAttribute("data-active",e?"true":"false"),o.setAttribute("aria-pressed",e?"true":"false"))}),n.dispatchEvent(new CustomEvent("editora:format-painter-toggle",{bubbles:!0,detail:{active:e}}))}function ee(t,e,n){if(e===n)return;const r=window.execEditorCommand||window.executeEditorCommand;if(typeof r=="function")try{r("recordDomTransaction",{editor:t,beforeHTML:e,afterHTML:n})}catch{try{r("recordDomTransaction",t,e,n)}catch{}}}function ne(t){return(t??O).map(A).map(e=>X[e]||e).filter(Boolean)}function c(t,e){const n=X[A(e)]||A(e);return t.includes(n)}function A(t){return t.toLowerCase().replace(/[^a-z0-9]/g,"")}function B(t){return t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}exports.FormatPainterPlugin=dt;
const E = '.rte-content, .editora-content, [contenteditable="true"]', st = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", N = "p,div,li,h1,h2,h3,h4,h5,h6,blockquote,pre,td,th", _ = "ul,ol", y = "b,strong,i,em,u,s,strike,font,span", w = "td,th", d = "data-editora-format-painter-bookmark", O = ["link", "address", "comments", "citations", "track-changes"], L = [
"fontFamily",
"fontSize",
"color",
"backgroundColor",
"textTransform"
], at = [
"textAlign",
"lineHeight",
"marginLeft",
"marginRight"
], lt = ["listStyleType"], ct = [
"borderCollapse",
"borderSpacing",
"width"
], ut = [
"backgroundColor",
"textAlign",
"verticalAlign",
"borderTopColor",
"borderRightColor",
"borderBottomColor",
"borderLeftColor",
"borderTopStyle",
"borderRightStyle",
"borderBottomStyle",
"borderLeftStyle",
"borderTopWidth",
"borderRightWidth",
"borderBottomWidth",
"borderLeftWidth",
"paddingTop",
"paddingRight",
"paddingBottom",
"paddingLeft"
], X = {
background: "backgroundcolor",
bgcolor: "backgroundcolor",
blockquote: "block",
blocks: "block",
font: "fontfamily",
fontname: "fontfamily",
fontsize: "fontsize",
foreground: "color",
forecolor: "color",
heading: "block",
headings: "block",
liststyle: "list",
lists: "list",
strike: "strikethrough",
tablecell: "table",
tablecells: "table",
textcolor: "color",
texttransform: "texttransform"
}, ft = '<svg width="24" height="24" focusable="false" viewBox="0 0 24 24"><path d="M17.8 3.2a2.8 2.8 0 0 1 4 4L14 15l-4-4 7.8-7.8Zm-1.4 4.2L19 10l1.4-1.4-2.6-2.6-1.4 1.4Zm-7.8 5 3 3-1.4 1.4c-.5.5-1.2.8-1.9.8H7.2l-1.6 1.6a2.7 2.7 0 0 1-3.8 0 1 1 0 0 1 0-1.4l6.8-5.4Zm-.2 3.2H9l-4.6 3.7c.2 0 .5-.2.7-.4l1.9-1.9c.2-.2.4-.3.7-.3h1.1c.2 0 .5-.1.6-.3l.2-.2-1.2-1.3ZM5.5 3l.7 1.8L8 5.5l-1.8.7L5.5 8l-.7-1.8L3 5.5l1.8-.7L5.5 3Zm3.8 4.4.5 1.2 1.2.5-1.2.5-.5 1.2-.5-1.2-1.2-.5 1.2-.5.5-1.2Z" fill-rule="evenodd"></path></svg>', v = /* @__PURE__ */ new WeakMap();
let I = null, P = !1, p = {
ignoredFormats: O,
keepActiveAfterMouseApply: !1
};
const ne = (t = {}) => {
const e = {
ignoredFormats: t.ignoredFormats ?? O,
keepActiveAfterMouseApply: t.keepActiveAfterMouseApply ?? !1
};
return p = e, {
name: "formatPainter",
toolbar: [
{
label: "Format Painter",
command: "toggleFormatPainter",
icon: ft,
shortcut: "Ctrl+Alt+C / Ctrl+Alt+V"
}
],
commands: {
retrieveFormats: (n, r) => Y(r, e),
paintFormats: (n, r) => J(r, e),
toggleFormatPainter: (n, r) => dt(r, e),
cancelFormatPainter: (n, r) => G(r)
},
initialize: () => {
mt();
}
};
};
function Y(t, e = p) {
const n = C(t);
if (!n) return !1;
const r = U(n, e);
if (!r) return !1;
const o = g(n);
return o.options = e, o.snapshot = r, I = r, M(n, !1), !0;
}
function J(t, e = p) {
const n = C(t);
if (!n) return !1;
const r = g(n);
r.options = e;
const o = r.snapshot || I;
return o ? Q(n, o) : !1;
}
function dt(t, e = p) {
const n = C(t);
if (!n) return !1;
const r = g(n);
if (r.options = e, r.active)
return h(n, !1), !0;
const o = U(n, e);
return o ? (r.snapshot = o, I = o, h(n, !0), !0) : !1;
}
function G(t) {
const e = C(t);
return e ? (h(e, !1), !0) : (document.querySelectorAll(`${E}.rte-format-painter-active`).forEach((n) => {
h(n, !1);
}), !0);
}
function mt() {
P || typeof document > "u" || (P = !0, document.addEventListener("keydown", gt, !0), document.addEventListener("mouseup", Et, !0));
}
function gt(t) {
const e = t.key.toLowerCase(), n = t.ctrlKey || t.metaKey;
if (t.key === "Escape") {
G();
return;
}
if (!n || !t.altKey || t.shiftKey) return;
const r = j() || C();
if (r) {
if (e === "c") {
Y({ contentElement: r }, g(r).options) && t.preventDefault();
return;
}
e === "v" && J({ contentElement: r }, g(r).options) && t.preventDefault();
}
}
function Et(t) {
const e = t.target;
if (e?.closest(".rte-toolbar-wrapper, .editora-toolbar-container")) return;
const n = e?.closest(E);
if (!(n instanceof HTMLElement)) return;
const r = g(n);
if (!r.active || !r.snapshot) return;
const o = window.getSelection();
if (!o || o.rangeCount === 0 || o.getRangeAt(0).collapsed) return;
Q(n, r.snapshot) && !r.options.keepActiveAfterMouseApply && h(n, !1);
}
function g(t) {
let e = v.get(t);
return e || (e = { snapshot: null, active: !1, options: p }, v.set(t, e)), e;
}
function C(t) {
if (t?.contentElement instanceof HTMLElement) return t.contentElement;
const e = D(t?.editorElement ?? null);
if (e) return e;
const n = typeof window < "u" ? window.__editoraCommandEditorRoot : null, r = D(n);
return r || j() || ht();
}
function D(t) {
return t ? t.matches(E) ? t : t.querySelector(E) : null;
}
function j() {
const t = window.getSelection();
if (!t || t.rangeCount === 0) return null;
const e = t.getRangeAt(0), r = f(e.commonAncestorContainer)?.closest(E);
return r instanceof HTMLElement ? r : null;
}
function ht() {
const t = document.activeElement;
if (!(t instanceof HTMLElement)) return null;
const e = t.closest(E);
return e instanceof HTMLElement ? e : null;
}
function f(t) {
return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
}
function U(t, e) {
const n = window.getSelection(), r = n && n.rangeCount > 0 ? n.getRangeAt(0) : null, o = r ? r.collapsed ? r.startContainer : r.commonAncestorContainer : null, i = f(o) || t;
if (!t.contains(i)) return null;
const s = ee(e.ignoredFormats), a = nt(i, t), l = i.closest("li"), u = l?.closest(_), m = i.closest(w), it = m?.closest("table");
return {
inline: pt(r, i, t, s),
block: !c(s, "block") && a ? bt(a, s) : null,
list: !c(s, "list") && u ? Nt(u, l) : null,
table: c(s, "table") ? null : St(it, m, s),
ignoredFormats: s
};
}
function pt(t, e, n, r) {
if (!t || t.collapsed)
return H(e, r);
const i = Ct(t, e, n).map((s) => H(s, r));
return Tt(i);
}
function Ct(t, e, n) {
const r = [], o = document.createTreeWalker(
t.commonAncestorContainer,
NodeFilter.SHOW_TEXT,
{
acceptNode: (s) => !n.contains(s) || !t.intersectsNode(s) ? NodeFilter.FILTER_REJECT : (s.textContent || "").trim() ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP
}
);
let i = o.nextNode();
for (; i && r.length < 64; ) {
const s = f(i);
s && !r.includes(s) && r.push(s), i = o.nextNode();
}
return r.length > 0 ? r : [e];
}
function H(t, e) {
const n = window.getComputedStyle(t), r = {};
c(e, "bold") || (r.bold = kt(t, n)), c(e, "italic") || (r.italic = At(t, n)), c(e, "underline") || (r.underline = $(t, n, "underline")), c(e, "strikethrough") || (r.strikethrough = $(t, n, "line-through"));
const o = {};
return L.forEach((i) => {
if (c(e, i)) return;
const s = n[i];
yt(i, s) && (o[i] = s);
}), { marks: r, styles: o };
}
function Tt(t) {
const e = {};
["bold", "italic", "underline", "strikethrough"].forEach((o) => {
const i = t.map((s) => s.marks[o]).filter((s) => s != null);
i.length !== 0 && (e[o] = i.every(Boolean));
});
const r = {};
return L.forEach((o) => {
const i = t.map((s) => s.styles[o]).filter((s) => !!s);
i.length === t.length && i.every((s) => s === i[0]) && (r[o] = i[0]);
}), { marks: e, styles: r };
}
function bt(t, e) {
const n = window.getComputedStyle(t), r = {};
at.forEach((s) => {
if (c(e, s)) return;
const l = t.style[s] || n[s];
Lt(s, l) && (r[s] = l);
});
const o = {}, i = t.getAttribute("dir") || t.style.direction;
return (i === "ltr" || i === "rtl" || i === "auto") && (o.dir = i), {
tagName: rt(t),
styles: r,
attrs: o
};
}
function Nt(t, e) {
const n = {};
lt.forEach((i) => {
const s = t.style[i] || window.getComputedStyle(t)[i];
s && s !== "disc" && s !== "decimal" && (n[i] = s);
});
const r = {};
b(t, r, "data-type"), b(t, r, "type");
const o = {};
return e && (b(e, o, "data-type"), b(e, o, "data-checked")), {
tagName: t.tagName.toLowerCase() === "ol" ? "ol" : "ul",
styles: n,
attrs: r,
itemAttrs: o
};
}
function St(t, e, n) {
return !t && !e ? null : {
table: t ? W(t, ct, n) : null,
cell: e ? W(e, ut, n) : null
};
}
function W(t, e, n) {
const r = window.getComputedStyle(t), o = {};
return e.forEach((i) => {
if (c(n, i)) return;
const a = t.style[i] || r[i];
Rt(i, a) && (o[i] = a);
}), { styles: o, attrs: {} };
}
function kt(t, e) {
if (t.closest("b,strong")) return !0;
const n = e.fontWeight;
return /^(bold|bolder|[5-9]\d{2,})$/.test(n);
}
function At(t, e) {
return !!t.closest("i,em") || e.fontStyle === "italic";
}
function $(t, e, n) {
const r = n === "underline" ? "u" : "s,strike";
return !!t.closest(r) || e.textDecorationLine.includes(n);
}
function yt(t, e) {
return !(!e || t === "backgroundColor" && (e === "rgba(0, 0, 0, 0)" || e === "transparent") || t === "textTransform" && e === "none");
}
function Lt(t, e) {
return !(!e || t === "textAlign" && e === "start" || t === "lineHeight" && e === "normal" || (t === "marginLeft" || t === "marginRight") && e === "0px");
}
function Rt(t, e) {
return !(!e || (t === "backgroundColor" || t.endsWith("Color")) && (e === "rgba(0, 0, 0, 0)" || e === "transparent") || t === "textAlign" && e === "start" || t === "verticalAlign" && e === "middle" || t.endsWith("Width") && e === "0px" || t.endsWith("Style") && e === "none" || t.startsWith("padding") && e === "0px" || t === "borderSpacing" && e === "0px" || t === "width" && e === "auto");
}
function Q(t, e) {
const n = window.getSelection();
if (!n || n.rangeCount === 0) return !1;
const r = n.getRangeAt(0);
if (!t.contains(r.startContainer) || !t.contains(r.endContainer)) return !1;
const o = t.innerHTML, i = !r.collapsed, s = Jt(t);
Ft(t, r, e.table), wt(t, r, e), s?.();
const a = window.getSelection(), l = a && a.rangeCount > 0 ? a.getRangeAt(0) : null;
i && a && l && t.contains(l.startContainer) && t.contains(l.endContainer) && Mt(l, a, e), Ut(t), Qt(t);
const u = t.innerHTML;
return o === u ? !1 : (te(t, o, u), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0);
}
function wt(t, e, n) {
const r = Xt(t, e);
n.list && zt(r, n.list), n.block && r.forEach((o) => {
const i = o.isConnected ? o : null;
if (!i) return;
const s = Vt(i, n.block.tagName);
S(s, n.block.styles), n.block.attrs.dir ? s.setAttribute("dir", n.block.attrs.dir) : s.removeAttribute("dir");
});
}
function Ft(t, e, n) {
if (!n) return;
const r = Kt(t, e);
if (n.cell && r.forEach((i) => {
S(i, n.cell.styles);
}), !n.table) return;
const o = /* @__PURE__ */ new Set();
if (r.forEach((i) => {
const s = i.closest("table");
s instanceof HTMLElement && o.add(s);
}), o.size === 0) {
const i = f(e.startContainer)?.closest("table");
i instanceof HTMLElement && t.contains(i) && o.add(i);
}
o.forEach((i) => {
S(i, n.table.styles);
});
}
function Mt(t, e, n) {
vt(t);
const r = n.inline, o = t.cloneContents();
if (Yt(o)) {
_t(t, e, n);
return;
}
const i = t.extractContents();
qt(i, n);
const s = document.createDocumentFragment(), a = K("start"), l = K("end");
s.appendChild(a), s.appendChild(et(i, r)), s.appendChild(l), t.insertNode(s), Dt(a, l, n);
const u = document.createRange();
u.setStartAfter(a), u.setEndBefore(l), e.removeAllRanges(), e.addRange(u);
}
function _t(t, e, n) {
const r = Ot(t), o = [];
if (r.forEach((s) => {
let a = It(s, t);
if (!a || !a.data.trim() || $t(a)) return;
a = xt(a, n);
const l = et(document.createTextNode(a.data), n.inline);
a.parentNode?.replaceChild(l, a), o.push(l);
}), o.length === 0) return;
const i = document.createRange();
i.setStartBefore(o[0]), i.setEndAfter(o[o.length - 1]), e.removeAllRanges(), e.addRange(i);
}
function Ot(t) {
if (t.startContainer === t.endContainer && t.startContainer.nodeType === Node.TEXT_NODE)
return [t.startContainer];
const e = [], n = document.createTreeWalker(t.commonAncestorContainer, NodeFilter.SHOW_TEXT, {
acceptNode: (o) => !o.textContent || !o.textContent.trim() || !t.intersectsNode(o) ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT
});
let r = n.nextNode();
for (; r; )
e.push(r), r = n.nextNode();
return e;
}
function It(t, e) {
const n = t.data.length;
let r = 0, o = n;
if (t === e.startContainer && (r = Math.max(0, Math.min(e.startOffset, n))), t === e.endContainer && (o = Math.max(0, Math.min(e.endOffset, n))), r >= o) return null;
let i = t;
return o < i.data.length && i.splitText(o), r > 0 && (i = i.splitText(r)), i;
}
function xt(t, e) {
let n = t, r = n.parentElement;
for (; r && r.matches(y) && !x(r, e) && tt(r, e); )
Bt(r, n), r = n.parentElement;
return n;
}
function Bt(t, e) {
const n = t.parentNode;
if (!n || e.parentNode !== t) return;
const r = t.cloneNode(!1), o = t.cloneNode(!1);
for (; t.firstChild && t.firstChild !== e; )
r.appendChild(t.firstChild);
for (; e.nextSibling; )
o.appendChild(e.nextSibling);
q(r) && n.insertBefore(r, t), n.insertBefore(e, t), q(o) && n.insertBefore(o, t), n.removeChild(t);
}
function q(t) {
return Array.from(t.childNodes).some((e) => e.nodeType !== Node.TEXT_NODE ? !0 : !!(e.textContent || "").trim());
}
function vt(t) {
let e = f(t.startContainer), n = f(t.endContainer);
for (; e && e === n && e.matches(y); ) {
if (!Pt(t, e)) return;
t.selectNode(e), e = e.parentElement, n = f(t.endContainer);
}
}
function Pt(t, e) {
const n = document.createRange();
return n.selectNodeContents(e), t.compareBoundaryPoints(Range.START_TO_START, n) === 0 && t.compareBoundaryPoints(Range.END_TO_END, n) === 0;
}
function Dt(t, e, n) {
let r = f(t.parentNode);
for (; r && r.contains(e); ) {
const o = r.parentElement;
r.matches(y) && !x(r, n) && Ht(r, t, e) && tt(r, n) && k(r), r = o;
}
}
function Ht(t, e, n) {
let r = "before";
for (const o of Array.from(t.childNodes)) {
if (o === e) {
r = "inside";
continue;
}
if (o === n) {
r = "after";
continue;
}
if (r !== "inside" && !Wt(o))
return !1;
}
return r === "after";
}
function Wt(t) {
return t.nodeType === Node.TEXT_NODE ? !(t.textContent || "").replace(/\uFEFF/g, "").trim() : t.nodeType === Node.COMMENT_NODE ? ot(t) : t.nodeType !== Node.ELEMENT_NODE ? !0 : t.hasAttribute(d);
}
function tt(t, e) {
return t.matches("span") ? L.some((n) => !c(e.ignoredFormats, n)) : t.matches("b,strong") ? !c(e.ignoredFormats, "bold") : t.matches("i,em") ? !c(e.ignoredFormats, "italic") : t.matches("u") ? !c(e.ignoredFormats, "underline") : t.matches("s,strike") ? !c(e.ignoredFormats, "strikethrough") : !0;
}
function $t(t) {
return t.nodeType !== Node.TEXT_NODE || (t.textContent || "").trim() ? !1 : !!t.parentElement?.matches(_);
}
function et(t, e) {
let n = t;
const r = Object.entries(e.styles);
if (r.length > 0) {
const o = document.createElement("span");
o.classList.add("rte-format-painted"), r.forEach(([i, s]) => {
o.style.setProperty(B(i), s);
}), o.appendChild(n), n = o;
}
return e.marks.strikethrough && (n = T("s", n)), e.marks.underline && (n = T("u", n)), e.marks.italic && (n = T("i", n)), e.marks.bold && (n = T("b", n)), n;
}
function T(t, e) {
const n = document.createElement(t);
return n.appendChild(e), n;
}
function qt(t, e) {
Array.from(t.querySelectorAll(y)).forEach((n) => {
if (n instanceof HTMLElement && !x(n, e)) {
if (n.matches("span")) {
if (L.forEach((r) => {
c(e.ignoredFormats, r) || n.style.removeProperty(B(r));
}), n.getAttribute("style") || n.attributes.length > 0) return;
k(n);
return;
}
n.matches("b,strong") && c(e.ignoredFormats, "bold") || n.matches("i,em") && c(e.ignoredFormats, "italic") || n.matches("u") && c(e.ignoredFormats, "underline") || n.matches("s,strike") && c(e.ignoredFormats, "strikethrough") || k(n);
}
});
}
function x(t, e) {
return !!(t.matches("a") && c(e.ignoredFormats, "link") || R(t, "comment") && c(e.ignoredFormats, "comments") || R(t, "citation") && c(e.ignoredFormats, "citations") || R(t, "track") && c(e.ignoredFormats, "trackchanges"));
}
function R(t, e) {
const n = e.toLowerCase();
return t.className.toString().toLowerCase().includes(n) ? !0 : Array.from(t.attributes).some((o) => {
const i = A(o.name), s = o.value.toLowerCase();
return i.includes(n) || s.includes(n);
});
}
function zt(t, e) {
t.filter((r) => r.tagName.toLowerCase() === "li").forEach((r) => {
const o = r.closest(_);
if (!o) return;
const i = Zt(o, e.tagName);
S(i, e.styles), Z(i, e.attrs), Z(r, e.itemAttrs);
});
}
function Kt(t, e) {
const n = Array.from(t.querySelectorAll(w)).filter((o) => o instanceof HTMLElement && e.intersectsNode(o));
if (n.length > 0) return n;
const r = f(e.startContainer)?.closest(w);
return r instanceof HTMLElement && t.contains(r) ? [r] : [];
}
function S(t, e) {
Object.entries(e).forEach(([n, r]) => {
t.style.setProperty(B(n), r);
});
}
function Vt(t, e) {
const n = rt(t);
if (n === e || n === "li" || n === "td" || n === "th") return t;
if (e === "blockquote") {
const o = document.createElement("blockquote");
for (; t.firstChild; ) o.appendChild(t.firstChild);
return F(t, o), t.parentNode?.replaceChild(o, t), o;
}
if (!/^(p|div|h[1-6]|pre)$/.test(e)) return t;
const r = document.createElement(e);
for (; t.firstChild; ) r.appendChild(t.firstChild);
return F(t, r), t.parentNode?.replaceChild(r, t), r;
}
function Zt(t, e) {
if (t.tagName.toLowerCase() === e) return t;
const n = document.createElement(e);
for (; t.firstChild; ) n.appendChild(t.firstChild);
return F(t, n), t.parentNode?.replaceChild(n, t), n;
}
function Xt(t, e) {
const n = Array.from(t.querySelectorAll(N)).filter((o) => o instanceof HTMLElement && e.intersectsNode(o));
if (n.length > 0)
return n.filter((o) => !n.some((i) => i !== o && i.contains(o)));
const r = nt(f(e.startContainer), t);
return r ? [r] : [];
}
function nt(t, e) {
const n = t?.closest(N);
return n instanceof HTMLElement && e.contains(n) ? n : null;
}
function rt(t) {
const e = t.tagName.toLowerCase();
return e === "blockquote" || /^h[1-6]$/.test(e) || e === "pre" || e === "li" || e === "td" || e === "th" ? e : "p";
}
function Yt(t) {
return Array.from(t.childNodes).some((e) => {
if (e.nodeType !== Node.ELEMENT_NODE) return !1;
const n = e;
return n.matches(N) || !!n.querySelector(N);
});
}
function Jt(t) {
const e = window.getSelection();
if (!e || e.rangeCount === 0) return null;
const n = e.getRangeAt(0);
if (!t.contains(n.startContainer) || !t.contains(n.endContainer)) return null;
const r = n.collapsed, o = z("start"), i = z("end"), s = n.cloneRange();
if (!r) {
const l = s.cloneRange();
l.collapse(!1), l.insertNode(i);
}
const a = s.cloneRange();
return a.collapse(!0), a.insertNode(o), () => {
const l = V(t, "start"), u = V(t, "end");
if (!l) return;
const m = document.createRange();
r || !u ? (m.setStartAfter(l), m.collapse(!0)) : (m.setStartAfter(l), m.setEndBefore(u)), e.removeAllRanges(), e.addRange(m);
};
}
function z(t) {
return document.createComment(`${d}:selection:${t}`);
}
function K(t) {
return document.createComment(`${d}:inline:${t}`);
}
function ot(t) {
return Gt(t) || jt(t);
}
function Gt(t) {
return t.nodeType === Node.COMMENT_NODE && (t.nodeValue === `${d}:selection:start` || t.nodeValue === `${d}:selection:end`);
}
function jt(t) {
return t.nodeType === Node.COMMENT_NODE && (t.nodeValue === `${d}:inline:start` || t.nodeValue === `${d}:inline:end`);
}
function V(t, e) {
const n = `${d}:selection:${e}`, r = document.createTreeWalker(t, NodeFilter.SHOW_COMMENT);
let o = r.nextNode();
for (; o; ) {
if (o.nodeValue === n) return o;
o = r.nextNode();
}
return null;
}
function Ut(t) {
t.querySelectorAll(`[${d}]`).forEach((o) => o.remove());
const e = document.createTreeWalker(t, NodeFilter.SHOW_COMMENT), n = [];
let r = e.nextNode();
for (; r; )
ot(r) && n.push(r), r = e.nextNode();
n.forEach((o) => o.remove());
}
function Qt(t) {
t.querySelectorAll("span").forEach((e) => {
e instanceof HTMLElement && (e.attributes.length > 0 || k(e));
});
}
function k(t) {
const e = t.parentNode;
if (e) {
for (; t.firstChild; )
e.insertBefore(t.firstChild, t);
e.removeChild(t);
}
}
function b(t, e, n) {
const r = t.getAttribute(n);
r != null && (e[n] = r);
}
function Z(t, e) {
["data-type", "data-checked", "type"].forEach((n) => {
e[n] != null && t.setAttribute(n, e[n]);
});
}
function F(t, e) {
Array.from(t.attributes).forEach((n) => {
n.name !== "style" && e.setAttribute(n.name, n.value);
});
}
function h(t, e) {
const n = g(t);
if (n.active === e && t.classList.contains("rte-format-painter-active") === e) {
M(t, e);
return;
}
n.active = e, t.classList.toggle("rte-format-painter-active", e), M(t, e);
}
function M(t, e) {
const n = t.closest(st) || document;
n.querySelectorAll(
'[data-command="toggleFormatPainter"], [data-command="formatPainter"]'
).forEach((o) => {
o instanceof HTMLElement && (o.classList.toggle("active", e), o.setAttribute("data-active", e ? "true" : "false"), o.setAttribute("aria-pressed", e ? "true" : "false"));
}), n.dispatchEvent(
new CustomEvent("editora:format-painter-toggle", {
bubbles: !0,
detail: { active: e }
})
);
}
function te(t, e, n) {
if (e === n) return;
const r = window.execEditorCommand || window.executeEditorCommand;
if (typeof r == "function")
try {
r("recordDomTransaction", { editor: t, beforeHTML: e, afterHTML: n });
} catch {
try {
r("recordDomTransaction", t, e, n);
} catch {
}
}
}
function ee(t) {
return (t ?? O).map(A).map((e) => X[e] || e).filter(Boolean);
}
function c(t, e) {
const n = X[A(e)] || A(e);
return t.includes(n);
}
function A(t) {
return t.toLowerCase().replace(/[^a-z0-9]/g, "");
}
function B(t) {
return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
}
export {
ne as FormatPainterPlugin
};
+1
-1

@@ -1,1 +0,1 @@

"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=()=>({name:"clearFormatting",toolbar:[{label:"Clear Formatting",command:"clearFormatting",icon:'<svg width="24" height="24" focusable="false"><path d="M13.2 6a1 1 0 0 1 0 .2l-2.6 10a1 1 0 0 1-1 .8h-.2a.8.8 0 0 1-.8-1l2.6-10H8a1 1 0 1 1 0-2h9a1 1 0 0 1 0 2h-3.8ZM5 18h7a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Zm13 1.5L16.5 18 15 19.5a.7.7 0 0 1-1-1l1.5-1.5-1.5-1.5a.7.7 0 0 1 1-1l1.5 1.5 1.5-1.5a.7.7 0 0 1 1 1L17.5 17l1.5 1.5a.7.7 0 0 1-1 1Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-\\"}],commands:{clearFormatting:()=>{const t=m();if(!t)return!1;const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const n=e.getRangeAt(0);if(!t.contains(n.commonAncestorContainer))return!1;const r=n.cloneRange();return t.focus({preventScroll:!0}),A(t,r),C(t,r),t.dispatchEvent(new Event("input",{bubbles:!0})),!0}},keymap:{"Mod-\\":"clearFormatting"}}),d=new Set(["A","B","STRONG","I","EM","U","S","STRIKE","DEL","FONT","MARK","CODE","SUB","SUP"]),g=new Set(["H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE"]),h=["color","background-color","font-size","font-family","font-weight","font-style","text-decoration","text-transform","line-height","letter-spacing","word-spacing","vertical-align","text-align","padding-left"];function m(){const t=window.getSelection();if(t&&t.rangeCount>0){const n=t.getRangeAt(0).startContainer,o=(n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');if(o)return o}const e=document.activeElement;return e?e.getAttribute("contenteditable")==="true"?e:e.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function c(t,e){try{if(typeof t.intersectsNode=="function")return t.intersectsNode(e)}catch{}const n=document.createRange();return e.nodeType===Node.ELEMENT_NODE?n.selectNodeContents(e):n.selectNode(e),t.compareBoundaryPoints(Range.END_TO_START,n)>0&&t.compareBoundaryPoints(Range.START_TO_END,n)<0}function i(t){let e=0,n=t;for(;n&&n.parentNode;)e+=1,n=n.parentNode;return e}function p(t){h.forEach(e=>{t.style.removeProperty(e)}),(!t.getAttribute("style")||t.style.length===0)&&t.removeAttribute("style"),t.classList.contains("rte-text-color")&&t.classList.remove("rte-text-color"),t.classList.contains("rte-bg-color")&&t.classList.remove("rte-bg-color"),t.classList.length===0&&t.removeAttribute("class")}function a(t){const e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}function E(t){return t.tagName!=="P"||t.attributes.length>0||(t.textContent||"").trim()!==""?!1:!t.querySelector("img, video, table, iframe, hr, pre, ul, ol")}function l(t){Array.from(t.children).forEach(e=>{E(e)&&e.remove()})}function s(t){l(t),a(t)}function f(t){const e=document.createElement("p");for(Array.from(t.attributes).forEach(n=>{e.setAttribute(n.name,n.value)});t.firstChild;)e.appendChild(t.firstChild);e.innerHTML.trim()||(e.innerHTML="<br>"),t.parentNode?.replaceChild(e,t)}function N(t){if(l(t),t.parentElement instanceof HTMLLIElement){s(t);return}if(Array.from(t.childNodes).filter(o=>o.nodeType!==Node.TEXT_NODE||(o.textContent||"").trim()!=="").some(o=>o instanceof HTMLElement&&/^(P|DIV|H[1-6]|UL|OL|PRE|TABLE|BLOCKQUOTE)$/.test(o.tagName))){s(t);return}f(t)}function C(t,e){Array.from(t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")).forEach(r=>{if(c(e,r)&&g.has(r.tagName)){if(r.tagName==="BLOCKQUOTE"){N(r);return}f(r)}})}function A(t,e){const n=Array.from(t.querySelectorAll("a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"));n.sort((r,o)=>i(o)-i(r)),n.forEach(r=>{if(r.isConnected&&c(e,r)&&!(r.getAttribute("contenteditable")==="false"||r.closest('[contenteditable="false"]'))){if(p(r),d.has(r.tagName)){a(r);return}r.tagName==="SPAN"&&r.attributes.length===0&&a(r)}})}exports.ClearFormattingPlugin=u;
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=()=>({name:"clearFormatting",toolbar:[{label:"Clear Formatting",command:"clearFormatting",icon:'<svg width="24" height="24" focusable="false"><path d="M13.2 6a1 1 0 0 1 0 .2l-2.6 10a1 1 0 0 1-1 .8h-.2a.8.8 0 0 1-.8-1l2.6-10H8a1 1 0 1 1 0-2h9a1 1 0 0 1 0 2h-3.8ZM5 18h7a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Zm13 1.5L16.5 18 15 19.5a.7.7 0 0 1-1-1l1.5-1.5-1.5-1.5a.7.7 0 0 1 1-1l1.5 1.5 1.5-1.5a.7.7 0 0 1 1 1L17.5 17l1.5 1.5a.7.7 0 0 1-1 1Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-\\"}],commands:{clearFormatting:()=>{const t=m();if(!t)return!1;const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const r=e.getRangeAt(0);if(!t.contains(r.commonAncestorContainer))return!1;const n=r.cloneRange();return t.focus({preventScroll:!0}),T(t,n),C(t,n),t.dispatchEvent(new Event("input",{bubbles:!0})),!0}},keymap:{"Mod-\\":"clearFormatting"}}),d=new Set(["A","B","STRONG","I","EM","U","S","STRIKE","DEL","FONT","MARK","CODE","SUB","SUP"]),g=new Set(["H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE"]),h=["color","background-color","font-size","font-family","font-weight","font-style","text-decoration","text-transform","line-height","letter-spacing","word-spacing","vertical-align","text-align","padding-left"];function m(){const t=window.getSelection();if(t&&t.rangeCount>0){const r=t.getRangeAt(0).startContainer,o=(r.nodeType===Node.ELEMENT_NODE?r:r.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');if(o)return o}const e=document.activeElement;return e?e.getAttribute("contenteditable")==="true"?e:e.closest('[contenteditable="true"], .rte-content, .editora-content'):null}function c(t,e){try{if(typeof t.intersectsNode=="function")return t.intersectsNode(e)}catch{}const r=document.createRange();return e.nodeType===Node.ELEMENT_NODE?r.selectNodeContents(e):r.selectNode(e),t.compareBoundaryPoints(Range.END_TO_START,r)>0&&t.compareBoundaryPoints(Range.START_TO_END,r)<0}function a(t){let e=0,r=t;for(;r&&r.parentNode;)e+=1,r=r.parentNode;return e}function E(t){h.forEach(e=>{t.style.removeProperty(e)}),(!t.getAttribute("style")||t.style.length===0)&&t.removeAttribute("style"),t.classList.contains("rte-text-color")&&t.classList.remove("rte-text-color"),t.classList.contains("rte-bg-color")&&t.classList.remove("rte-bg-color"),t.classList.contains("rte-format-painted")&&t.classList.remove("rte-format-painted"),t.classList.length===0&&t.removeAttribute("class")}function i(t){const e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}}function p(t){return t.tagName!=="P"||t.attributes.length>0||(t.textContent||"").trim()!==""?!1:!t.querySelector("img, video, table, iframe, hr, pre, ul, ol")}function l(t){Array.from(t.children).forEach(e=>{p(e)&&e.remove()})}function s(t){l(t),i(t)}function f(t){const e=document.createElement("p");for(Array.from(t.attributes).forEach(r=>{e.setAttribute(r.name,r.value)});t.firstChild;)e.appendChild(t.firstChild);e.innerHTML.trim()||(e.innerHTML="<br>"),t.parentNode?.replaceChild(e,t)}function N(t){return!/^(A|B|STRONG|I|EM|U|S|STRIKE|DEL|FONT|MARK|CODE|SUB|SUP|SPAN)$/.test(t.tagName)||(t.textContent||"").trim()!==""?!1:!t.querySelector("img, video, table, iframe, hr, svg, math")}function A(t){Array.from(t.querySelectorAll("a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span")).sort((r,n)=>a(n)-a(r)).forEach(r=>{r.isConnected&&N(r)&&r.remove()})}function y(t){if(l(t),t.parentElement instanceof HTMLLIElement){s(t);return}if(Array.from(t.childNodes).filter(o=>o.nodeType!==Node.TEXT_NODE||(o.textContent||"").trim()!=="").some(o=>o instanceof HTMLElement&&/^(P|DIV|H[1-6]|UL|OL|PRE|TABLE|BLOCKQUOTE)$/.test(o.tagName))){s(t);return}f(t)}function C(t,e){Array.from(t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")).forEach(n=>{if(c(e,n)&&g.has(n.tagName)){if(n.tagName==="BLOCKQUOTE"){y(n);return}f(n)}})}function T(t,e){const r=Array.from(t.querySelectorAll("a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"));r.sort((n,o)=>a(o)-a(n)),r.forEach(n=>{if(n.isConnected&&c(e,n)&&!(n.getAttribute("contenteditable")==="false"||n.closest('[contenteditable="false"]'))){if(E(n),d.has(n.tagName)){i(n);return}n.tagName==="SPAN"&&n.attributes.length===0&&i(n)}}),A(t)}exports.ClearFormattingPlugin=u;

@@ -1,2 +0,2 @@

const C = () => ({
const T = () => ({
name: "clearFormatting",

@@ -22,6 +22,6 @@ // Toolbar button configuration

if (!e || e.rangeCount === 0) return !1;
const n = e.getRangeAt(0);
if (!t.contains(n.commonAncestorContainer)) return !1;
const r = n.cloneRange();
return t.focus({ preventScroll: !0 }), A(t, r), N(t, r), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
const r = e.getRangeAt(0);
if (!t.contains(r.commonAncestorContainer)) return !1;
const n = r.cloneRange();
return t.focus({ preventScroll: !0 }), C(t, n), y(t, n), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
}

@@ -76,3 +76,3 @@ },

if (t && t.rangeCount > 0) {
const n = t.getRangeAt(0).startContainer, o = (n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');
const r = t.getRangeAt(0).startContainer, o = (r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement)?.closest('[contenteditable="true"], .rte-content, .editora-content');
if (o) return o;

@@ -89,9 +89,9 @@ }

}
const n = document.createRange();
return e.nodeType === Node.ELEMENT_NODE ? n.selectNodeContents(e) : n.selectNode(e), t.compareBoundaryPoints(Range.END_TO_START, n) > 0 && t.compareBoundaryPoints(Range.START_TO_END, n) < 0;
const r = document.createRange();
return e.nodeType === Node.ELEMENT_NODE ? r.selectNodeContents(e) : r.selectNode(e), t.compareBoundaryPoints(Range.END_TO_START, r) > 0 && t.compareBoundaryPoints(Range.START_TO_END, r) < 0;
}
function i(t) {
let e = 0, n = t;
for (; n && n.parentNode; )
e += 1, n = n.parentNode;
function a(t) {
let e = 0, r = t;
for (; r && r.parentNode; )
e += 1, r = r.parentNode;
return e;

@@ -102,5 +102,5 @@ }

t.style.removeProperty(e);
}), (!t.getAttribute("style") || t.style.length === 0) && t.removeAttribute("style"), t.classList.contains("rte-text-color") && t.classList.remove("rte-text-color"), t.classList.contains("rte-bg-color") && t.classList.remove("rte-bg-color"), t.classList.length === 0 && t.removeAttribute("class");
}), (!t.getAttribute("style") || t.style.length === 0) && t.removeAttribute("style"), t.classList.contains("rte-text-color") && t.classList.remove("rte-text-color"), t.classList.contains("rte-bg-color") && t.classList.remove("rte-bg-color"), t.classList.contains("rte-format-painted") && t.classList.remove("rte-format-painted"), t.classList.length === 0 && t.removeAttribute("class");
}
function a(t) {
function i(t) {
const e = t.parentNode;

@@ -113,3 +113,3 @@ if (e) {

}
function p(t) {
function E(t) {
return t.tagName !== "P" || t.attributes.length > 0 || (t.textContent || "").trim() !== "" ? !1 : !t.querySelector("img, video, table, iframe, hr, pre, ul, ol");

@@ -119,12 +119,12 @@ }

Array.from(t.children).forEach((e) => {
p(e) && e.remove();
E(e) && e.remove();
});
}
function s(t) {
l(t), a(t);
l(t), i(t);
}
function f(t) {
const e = document.createElement("p");
for (Array.from(t.attributes).forEach((n) => {
e.setAttribute(n.name, n.value);
for (Array.from(t.attributes).forEach((r) => {
e.setAttribute(r.name, r.value);
}); t.firstChild; )

@@ -134,3 +134,13 @@ e.appendChild(t.firstChild);

}
function E(t) {
function p(t) {
return !/^(A|B|STRONG|I|EM|U|S|STRIKE|DEL|FONT|MARK|CODE|SUB|SUP|SPAN)$/.test(t.tagName) || (t.textContent || "").trim() !== "" ? !1 : !t.querySelector("img, video, table, iframe, hr, svg, math");
}
function N(t) {
Array.from(
t.querySelectorAll("a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span")
).sort((r, n) => a(n) - a(r)).forEach((r) => {
r.isConnected && p(r) && r.remove();
});
}
function A(t) {
if (l(t), t.parentElement instanceof HTMLLIElement) {

@@ -146,17 +156,17 @@ s(t);

}
function N(t, e) {
function y(t, e) {
Array.from(
t.querySelectorAll("h1,h2,h3,h4,h5,h6,blockquote,pre")
).forEach((r) => {
if (c(e, r) && d.has(r.tagName)) {
if (r.tagName === "BLOCKQUOTE") {
E(r);
).forEach((n) => {
if (c(e, n) && d.has(n.tagName)) {
if (n.tagName === "BLOCKQUOTE") {
A(n);
return;
}
f(r);
f(n);
}
});
}
function A(t, e) {
const n = Array.from(
function C(t, e) {
const r = Array.from(
t.querySelectorAll(

@@ -166,14 +176,14 @@ "a,b,strong,i,em,u,s,strike,del,font,mark,code,sub,sup,span,[style],[class]"

);
n.sort((r, o) => i(o) - i(r)), n.forEach((r) => {
if (r.isConnected && c(e, r) && !(r.getAttribute("contenteditable") === "false" || r.closest('[contenteditable="false"]'))) {
if (m(r), u.has(r.tagName)) {
a(r);
r.sort((n, o) => a(o) - a(n)), r.forEach((n) => {
if (n.isConnected && c(e, n) && !(n.getAttribute("contenteditable") === "false" || n.closest('[contenteditable="false"]'))) {
if (m(n), u.has(n.tagName)) {
i(n);
return;
}
r.tagName === "SPAN" && r.attributes.length === 0 && a(r);
n.tagName === "SPAN" && n.attributes.length === 0 && i(n);
}
});
}), N(t);
}
export {
C as ClearFormattingPlugin
T as ClearFormattingPlugin
};

@@ -1,1 +0,1 @@

"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("./heading.cjs.js"),r=require("./bold.cjs.js"),o=require("./italic.cjs.js"),u=require("./underline.cjs.js"),g=require("./strikethrough.cjs.js"),a=require("./list.cjs.js"),s=require("./checklist.cjs.js"),P=require("./history.cjs.js"),c=require("./link.cjs.js"),m=require("./blockquote.cjs.js"),d=require("./clear-formatting.cjs.js"),C=require("./code.cjs.js"),q=require("./table.cjs.js"),p=require("./font-size.cjs.js"),h=require("./font-family.cjs.js"),k=require("./text-alignment.cjs.js"),T=require("./text-color.cjs.js"),f=require("./background-color.cjs.js"),M=require("./line-height.cjs.js"),b=require("./indent.cjs.js"),S=require("./direction.cjs.js"),A=require("./capitalization.cjs.js"),D=require("./math.cjs.js"),y=require("./special-characters.cjs.js"),B=require("./emojis.cjs.js"),F=require("./embed-iframe.cjs.js"),E=require("./anchor.cjs.js"),I=require("./mentions.cjs.js"),v=require("./track-changes.cjs.js"),L=require("./version-diff.cjs.js"),w=require("./conditional-content.cjs.js"),H=require("./data-binding.cjs.js"),z=require("./content-rules.cjs.js"),R=require("./citations.cjs.js"),x=require("./approval-workflow.cjs.js"),G=require("./pii-redaction.cjs.js"),W=require("./smart-paste.cjs.js"),j=require("./blocks-library.cjs.js"),U=require("./doc-schema.cjs.js"),_=require("./translation-workflow.cjs.js"),N=require("./slash-commands.cjs.js"),n=require("./media-manager.cjs.js"),t=require("./index-tqLTHcO6.js"),V=require("./preview.cjs.js"),O=require("./fullscreen.cjs.js"),J=require("./print.cjs.js"),K=require("./page-break.cjs.js"),Q=require("./footnote.cjs.js"),X=require("./code-sample.cjs.js"),Y=require("./merge-tag.cjs.js"),e=require("./template.cjs.js"),Z=require("./comments.cjs.js"),$=require("./spell-check.cjs.js"),ee=require("./a11y-checker.cjs.js"),i=require("./shared-config.cjs.js");exports.HeadingPlugin=l.HeadingPlugin;exports.BoldPlugin=r.BoldPlugin;exports.ItalicPlugin=o.ItalicPlugin;exports.UnderlinePlugin=u.UnderlinePlugin;exports.StrikethroughPlugin=g.StrikethroughPlugin;exports.ListPlugin=a.ListPlugin;exports.ChecklistPlugin=s.ChecklistPlugin;exports.HistoryPlugin=P.HistoryPlugin;exports.LinkPlugin=c.LinkPlugin;exports.BlockquotePlugin=m.BlockquotePlugin;exports.ClearFormattingPlugin=d.ClearFormattingPlugin;exports.CodePlugin=C.CodePlugin;exports.TablePlugin=q.TablePlugin;exports.FontSizePlugin=p.FontSizePlugin;exports.FontFamilyPlugin=h.FontFamilyPlugin;exports.TextAlignmentPlugin=k.TextAlignmentPlugin;exports.TextColorPlugin=T.TextColorPlugin;exports.BackgroundColorPlugin=f.BackgroundColorPlugin;exports.LineHeightPlugin=M.LineHeightPlugin;exports.IndentPlugin=b.IndentPlugin;exports.DirectionPlugin=S.DirectionPlugin;exports.CapitalizationPlugin=A.CapitalizationPlugin;exports.MathPlugin=D.MathPlugin;exports.SpecialCharactersPlugin=y.SpecialCharactersPlugin;exports.EmojisPlugin=B.EmojisPlugin;exports.EmbedIframePlugin=F.EmbedIframePlugin;exports.AnchorPlugin=E.AnchorPlugin;exports.MentionPlugin=I.MentionPlugin;exports.TrackChangesPlugin=v.TrackChangesPlugin;exports.VersionDiffPlugin=L.VersionDiffPlugin;exports.ConditionalContentPlugin=w.ConditionalContentPlugin;exports.DataBindingPlugin=H.DataBindingPlugin;exports.ContentRulesPlugin=z.ContentRulesPlugin;exports.CitationsPlugin=R.CitationsPlugin;exports.ApprovalWorkflowPlugin=x.ApprovalWorkflowPlugin;exports.PIIRedactionPlugin=G.PIIRedactionPlugin;exports.SmartPastePlugin=W.SmartPastePlugin;exports.BlocksLibraryPlugin=j.BlocksLibraryPlugin;exports.DocSchemaPlugin=U.DocSchemaPlugin;exports.TranslationWorkflowPlugin=_.TranslationWorkflowPlugin;exports.SlashCommandsPlugin=N.SlashCommandsPlugin;exports.MediaManagerPlugin=n.MediaManagerPlugin;exports.getMediaManagerConfig=n.getMediaManagerConfig;exports.setMediaManagerConfig=n.setMediaManagerConfig;exports.DocumentManagerPlugin=t.DocumentManagerPlugin;exports.getDocumentManagerConfig=t.getDocumentManagerConfig;exports.setDocumentManagerConfig=t.setDocumentManagerConfig;exports.PreviewPlugin=V.PreviewPlugin;exports.FullscreenPlugin=O.FullscreenPlugin;exports.PrintPlugin=J.PrintPlugin;exports.PageBreakPlugin=K.PageBreakPlugin;exports.FootnotePlugin=Q.FootnotePlugin;exports.CodeSamplePlugin=X.CodeSamplePlugin;exports.MergeTagPlugin=Y.MergeTagPlugin;exports.PREDEFINED_TEMPLATES=e.PREDEFINED_TEMPLATES;exports.TemplatePlugin=e.TemplatePlugin;exports.addCustomTemplate=e.addCustomTemplate;exports.getAllTemplates=e.getAllTemplates;exports.getTemplateCategories=e.getTemplateCategories;exports.getTemplatesByCategory=e.getTemplatesByCategory;exports.sanitizeTemplate=e.sanitizeTemplate;exports.searchTemplates=e.searchTemplates;exports.validateTemplate=e.validateTemplate;exports.CommentsPlugin=Z.CommentsPlugin;exports.SpellCheckPlugin=$.SpellCheckPlugin;exports.A11yCheckerPlugin=ee.A11yCheckerPlugin;exports.buildApiUrl=i.buildApiUrl;exports.getGlobalApiConfig=i.getGlobalApiConfig;exports.getGlobalApiHeaders=i.getGlobalApiHeaders;exports.setGlobalApiConfig=i.setGlobalApiConfig;
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("./heading.cjs.js"),r=require("./bold.cjs.js"),o=require("./italic.cjs.js"),u=require("./underline.cjs.js"),a=require("./strikethrough.cjs.js"),g=require("./list.cjs.js"),s=require("./checklist.cjs.js"),P=require("./history.cjs.js"),c=require("./link.cjs.js"),m=require("./blockquote.cjs.js"),d=require("./clear-formatting.cjs.js"),C=require("./code.cjs.js"),q=require("./table.cjs.js"),p=require("./font-size.cjs.js"),h=require("./format-painter.cjs.js"),k=require("./font-family.cjs.js"),f=require("./text-alignment.cjs.js"),T=require("./text-color.cjs.js"),M=require("./background-color.cjs.js"),b=require("./line-height.cjs.js"),S=require("./indent.cjs.js"),A=require("./direction.cjs.js"),D=require("./capitalization.cjs.js"),F=require("./math.cjs.js"),y=require("./special-characters.cjs.js"),B=require("./emojis.cjs.js"),E=require("./embed-iframe.cjs.js"),I=require("./anchor.cjs.js"),v=require("./mentions.cjs.js"),L=require("./track-changes.cjs.js"),w=require("./version-diff.cjs.js"),H=require("./conditional-content.cjs.js"),z=require("./data-binding.cjs.js"),R=require("./content-rules.cjs.js"),x=require("./citations.cjs.js"),G=require("./approval-workflow.cjs.js"),W=require("./pii-redaction.cjs.js"),j=require("./smart-paste.cjs.js"),U=require("./blocks-library.cjs.js"),_=require("./doc-schema.cjs.js"),N=require("./translation-workflow.cjs.js"),V=require("./slash-commands.cjs.js"),n=require("./media-manager.cjs.js"),t=require("./index-tqLTHcO6.js"),O=require("./preview.cjs.js"),J=require("./fullscreen.cjs.js"),K=require("./print.cjs.js"),Q=require("./page-break.cjs.js"),X=require("./footnote.cjs.js"),Y=require("./code-sample.cjs.js"),Z=require("./merge-tag.cjs.js"),e=require("./template.cjs.js"),$=require("./comments.cjs.js"),ee=require("./spell-check.cjs.js"),ie=require("./a11y-checker.cjs.js"),i=require("./shared-config.cjs.js");exports.HeadingPlugin=l.HeadingPlugin;exports.BoldPlugin=r.BoldPlugin;exports.ItalicPlugin=o.ItalicPlugin;exports.UnderlinePlugin=u.UnderlinePlugin;exports.StrikethroughPlugin=a.StrikethroughPlugin;exports.ListPlugin=g.ListPlugin;exports.ChecklistPlugin=s.ChecklistPlugin;exports.HistoryPlugin=P.HistoryPlugin;exports.LinkPlugin=c.LinkPlugin;exports.BlockquotePlugin=m.BlockquotePlugin;exports.ClearFormattingPlugin=d.ClearFormattingPlugin;exports.CodePlugin=C.CodePlugin;exports.TablePlugin=q.TablePlugin;exports.FontSizePlugin=p.FontSizePlugin;exports.FormatPainterPlugin=h.FormatPainterPlugin;exports.FontFamilyPlugin=k.FontFamilyPlugin;exports.TextAlignmentPlugin=f.TextAlignmentPlugin;exports.TextColorPlugin=T.TextColorPlugin;exports.BackgroundColorPlugin=M.BackgroundColorPlugin;exports.LineHeightPlugin=b.LineHeightPlugin;exports.IndentPlugin=S.IndentPlugin;exports.DirectionPlugin=A.DirectionPlugin;exports.CapitalizationPlugin=D.CapitalizationPlugin;exports.MathPlugin=F.MathPlugin;exports.SpecialCharactersPlugin=y.SpecialCharactersPlugin;exports.EmojisPlugin=B.EmojisPlugin;exports.EmbedIframePlugin=E.EmbedIframePlugin;exports.AnchorPlugin=I.AnchorPlugin;exports.MentionPlugin=v.MentionPlugin;exports.TrackChangesPlugin=L.TrackChangesPlugin;exports.VersionDiffPlugin=w.VersionDiffPlugin;exports.ConditionalContentPlugin=H.ConditionalContentPlugin;exports.DataBindingPlugin=z.DataBindingPlugin;exports.ContentRulesPlugin=R.ContentRulesPlugin;exports.CitationsPlugin=x.CitationsPlugin;exports.ApprovalWorkflowPlugin=G.ApprovalWorkflowPlugin;exports.PIIRedactionPlugin=W.PIIRedactionPlugin;exports.SmartPastePlugin=j.SmartPastePlugin;exports.BlocksLibraryPlugin=U.BlocksLibraryPlugin;exports.DocSchemaPlugin=_.DocSchemaPlugin;exports.TranslationWorkflowPlugin=N.TranslationWorkflowPlugin;exports.SlashCommandsPlugin=V.SlashCommandsPlugin;exports.MediaManagerPlugin=n.MediaManagerPlugin;exports.getMediaManagerConfig=n.getMediaManagerConfig;exports.setMediaManagerConfig=n.setMediaManagerConfig;exports.DocumentManagerPlugin=t.DocumentManagerPlugin;exports.getDocumentManagerConfig=t.getDocumentManagerConfig;exports.setDocumentManagerConfig=t.setDocumentManagerConfig;exports.PreviewPlugin=O.PreviewPlugin;exports.FullscreenPlugin=J.FullscreenPlugin;exports.PrintPlugin=K.PrintPlugin;exports.PageBreakPlugin=Q.PageBreakPlugin;exports.FootnotePlugin=X.FootnotePlugin;exports.CodeSamplePlugin=Y.CodeSamplePlugin;exports.MergeTagPlugin=Z.MergeTagPlugin;exports.PREDEFINED_TEMPLATES=e.PREDEFINED_TEMPLATES;exports.TemplatePlugin=e.TemplatePlugin;exports.addCustomTemplate=e.addCustomTemplate;exports.getAllTemplates=e.getAllTemplates;exports.getTemplateCategories=e.getTemplateCategories;exports.getTemplatesByCategory=e.getTemplatesByCategory;exports.sanitizeTemplate=e.sanitizeTemplate;exports.searchTemplates=e.searchTemplates;exports.validateTemplate=e.validateTemplate;exports.CommentsPlugin=$.CommentsPlugin;exports.SpellCheckPlugin=ee.SpellCheckPlugin;exports.A11yCheckerPlugin=ie.A11yCheckerPlugin;exports.buildApiUrl=i.buildApiUrl;exports.getGlobalApiConfig=i.getGlobalApiConfig;exports.getGlobalApiHeaders=i.getGlobalApiHeaders;exports.setGlobalApiConfig=i.setGlobalApiConfig;

@@ -5,3 +5,3 @@ import { HeadingPlugin as e } from "./heading.esm.js";

import { UnderlinePlugin as m } from "./underline.esm.js";
import { StrikethroughPlugin as a } from "./strikethrough.esm.js";
import { StrikethroughPlugin as p } from "./strikethrough.esm.js";
import { ListPlugin as u } from "./list.esm.js";

@@ -14,116 +14,118 @@ import { ChecklistPlugin as x } from "./checklist.esm.js";

import { CodePlugin as D } from "./code.esm.js";
import { TablePlugin as b } from "./table.esm.js";
import { FontSizePlugin as E } from "./font-size.esm.js";
import { FontFamilyPlugin as y } from "./font-family.esm.js";
import { TextAlignmentPlugin as L } from "./text-alignment.esm.js";
import { TextColorPlugin as v } from "./text-color.esm.js";
import { BackgroundColorPlugin as z } from "./background-color.esm.js";
import { LineHeightPlugin as R } from "./line-height.esm.js";
import { IndentPlugin as W } from "./indent.esm.js";
import { DirectionPlugin as q } from "./direction.esm.js";
import { CapitalizationPlugin as V } from "./capitalization.esm.js";
import { MathPlugin as J } from "./math.esm.js";
import { SpecialCharactersPlugin as O } from "./special-characters.esm.js";
import { EmojisPlugin as X } from "./emojis.esm.js";
import { EmbedIframePlugin as Z } from "./embed-iframe.esm.js";
import { AnchorPlugin as oo } from "./anchor.esm.js";
import { MentionPlugin as eo } from "./mentions.esm.js";
import { TrackChangesPlugin as io } from "./track-changes.esm.js";
import { VersionDiffPlugin as lo } from "./version-diff.esm.js";
import { ConditionalContentPlugin as mo } from "./conditional-content.esm.js";
import { DataBindingPlugin as ao } from "./data-binding.esm.js";
import { ContentRulesPlugin as uo } from "./content-rules.esm.js";
import { CitationsPlugin as xo } from "./citations.esm.js";
import { ApprovalWorkflowPlugin as Co } from "./approval-workflow.esm.js";
import { PIIRedactionPlugin as To } from "./pii-redaction.esm.js";
import { SmartPastePlugin as Mo } from "./smart-paste.esm.js";
import { BlocksLibraryPlugin as Ao } from "./blocks-library.esm.js";
import { DocSchemaPlugin as So } from "./doc-schema.esm.js";
import { TranslationWorkflowPlugin as Bo } from "./translation-workflow.esm.js";
import { SlashCommandsPlugin as Fo } from "./slash-commands.esm.js";
import { MediaManagerPlugin as Io, getMediaManagerConfig as Lo, setMediaManagerConfig as Ho } from "./media-manager.esm.js";
import { D as wo, g as zo, s as Go } from "./index-BFsKNTTj.mjs";
import { PreviewPlugin as Uo } from "./preview.esm.js";
import { FullscreenPlugin as jo } from "./fullscreen.esm.js";
import { PrintPlugin as No } from "./print.esm.js";
import { PageBreakPlugin as _o } from "./page-break.esm.js";
import { FootnotePlugin as Ko } from "./footnote.esm.js";
import { CodeSamplePlugin as Qo } from "./code-sample.esm.js";
import { MergeTagPlugin as Yo } from "./merge-tag.esm.js";
import { PREDEFINED_TEMPLATES as $o, TemplatePlugin as or, addCustomTemplate as rr, getAllTemplates as er, getTemplateCategories as tr, getTemplatesByCategory as ir, sanitizeTemplate as nr, searchTemplates as lr, validateTemplate as gr } from "./template.esm.js";
import { CommentsPlugin as pr } from "./comments.esm.js";
import { SpellCheckPlugin as fr } from "./spell-check.esm.js";
import { A11yCheckerPlugin as Pr } from "./a11y-checker.esm.js";
import { buildApiUrl as sr, getGlobalApiConfig as Cr, getGlobalApiHeaders as cr, setGlobalApiConfig as dr } from "./shared-config.esm.js";
import { TablePlugin as F } from "./table.esm.js";
import { FontSizePlugin as B } from "./font-size.esm.js";
import { FormatPainterPlugin as y } from "./format-painter.esm.js";
import { FontFamilyPlugin as L } from "./font-family.esm.js";
import { TextAlignmentPlugin as v } from "./text-alignment.esm.js";
import { TextColorPlugin as z } from "./text-color.esm.js";
import { BackgroundColorPlugin as R } from "./background-color.esm.js";
import { LineHeightPlugin as W } from "./line-height.esm.js";
import { IndentPlugin as q } from "./indent.esm.js";
import { DirectionPlugin as V } from "./direction.esm.js";
import { CapitalizationPlugin as J } from "./capitalization.esm.js";
import { MathPlugin as O } from "./math.esm.js";
import { SpecialCharactersPlugin as X } from "./special-characters.esm.js";
import { EmojisPlugin as Z } from "./emojis.esm.js";
import { EmbedIframePlugin as oo } from "./embed-iframe.esm.js";
import { AnchorPlugin as eo } from "./anchor.esm.js";
import { MentionPlugin as io } from "./mentions.esm.js";
import { TrackChangesPlugin as lo } from "./track-changes.esm.js";
import { VersionDiffPlugin as mo } from "./version-diff.esm.js";
import { ConditionalContentPlugin as po } from "./conditional-content.esm.js";
import { DataBindingPlugin as uo } from "./data-binding.esm.js";
import { ContentRulesPlugin as xo } from "./content-rules.esm.js";
import { CitationsPlugin as Co } from "./citations.esm.js";
import { ApprovalWorkflowPlugin as To } from "./approval-workflow.esm.js";
import { PIIRedactionPlugin as Mo } from "./pii-redaction.esm.js";
import { SmartPastePlugin as Ao } from "./smart-paste.esm.js";
import { BlocksLibraryPlugin as So } from "./blocks-library.esm.js";
import { DocSchemaPlugin as bo } from "./doc-schema.esm.js";
import { TranslationWorkflowPlugin as Eo } from "./translation-workflow.esm.js";
import { SlashCommandsPlugin as Io } from "./slash-commands.esm.js";
import { MediaManagerPlugin as Ho, getMediaManagerConfig as vo, setMediaManagerConfig as wo } from "./media-manager.esm.js";
import { D as Go, g as Ro, s as Uo } from "./index-BFsKNTTj.mjs";
import { PreviewPlugin as jo } from "./preview.esm.js";
import { FullscreenPlugin as No } from "./fullscreen.esm.js";
import { PrintPlugin as _o } from "./print.esm.js";
import { PageBreakPlugin as Ko } from "./page-break.esm.js";
import { FootnotePlugin as Qo } from "./footnote.esm.js";
import { CodeSamplePlugin as Yo } from "./code-sample.esm.js";
import { MergeTagPlugin as $o } from "./merge-tag.esm.js";
import { PREDEFINED_TEMPLATES as rr, TemplatePlugin as er, addCustomTemplate as tr, getAllTemplates as ir, getTemplateCategories as nr, getTemplatesByCategory as lr, sanitizeTemplate as gr, searchTemplates as mr, validateTemplate as ar } from "./template.esm.js";
import { CommentsPlugin as fr } from "./comments.esm.js";
import { SpellCheckPlugin as Pr } from "./spell-check.esm.js";
import { A11yCheckerPlugin as sr } from "./a11y-checker.esm.js";
import { buildApiUrl as cr, getGlobalApiConfig as dr, getGlobalApiHeaders as Tr, setGlobalApiConfig as hr } from "./shared-config.esm.js";
export {
Pr as A11yCheckerPlugin,
oo as AnchorPlugin,
Co as ApprovalWorkflowPlugin,
z as BackgroundColorPlugin,
sr as A11yCheckerPlugin,
eo as AnchorPlugin,
To as ApprovalWorkflowPlugin,
R as BackgroundColorPlugin,
h as BlockquotePlugin,
Ao as BlocksLibraryPlugin,
So as BlocksLibraryPlugin,
i as BoldPlugin,
V as CapitalizationPlugin,
J as CapitalizationPlugin,
x as ChecklistPlugin,
xo as CitationsPlugin,
Co as CitationsPlugin,
k as ClearFormattingPlugin,
D as CodePlugin,
Qo as CodeSamplePlugin,
pr as CommentsPlugin,
mo as ConditionalContentPlugin,
uo as ContentRulesPlugin,
ao as DataBindingPlugin,
q as DirectionPlugin,
So as DocSchemaPlugin,
wo as DocumentManagerPlugin,
Z as EmbedIframePlugin,
X as EmojisPlugin,
y as FontFamilyPlugin,
E as FontSizePlugin,
Ko as FootnotePlugin,
jo as FullscreenPlugin,
Yo as CodeSamplePlugin,
fr as CommentsPlugin,
po as ConditionalContentPlugin,
xo as ContentRulesPlugin,
uo as DataBindingPlugin,
V as DirectionPlugin,
bo as DocSchemaPlugin,
Go as DocumentManagerPlugin,
oo as EmbedIframePlugin,
Z as EmojisPlugin,
L as FontFamilyPlugin,
B as FontSizePlugin,
Qo as FootnotePlugin,
y as FormatPainterPlugin,
No as FullscreenPlugin,
e as HeadingPlugin,
C as HistoryPlugin,
W as IndentPlugin,
q as IndentPlugin,
l as ItalicPlugin,
R as LineHeightPlugin,
W as LineHeightPlugin,
d as LinkPlugin,
u as ListPlugin,
J as MathPlugin,
Io as MediaManagerPlugin,
eo as MentionPlugin,
Yo as MergeTagPlugin,
To as PIIRedactionPlugin,
$o as PREDEFINED_TEMPLATES,
_o as PageBreakPlugin,
Uo as PreviewPlugin,
No as PrintPlugin,
Fo as SlashCommandsPlugin,
Mo as SmartPastePlugin,
O as SpecialCharactersPlugin,
fr as SpellCheckPlugin,
a as StrikethroughPlugin,
b as TablePlugin,
or as TemplatePlugin,
L as TextAlignmentPlugin,
v as TextColorPlugin,
io as TrackChangesPlugin,
Bo as TranslationWorkflowPlugin,
O as MathPlugin,
Ho as MediaManagerPlugin,
io as MentionPlugin,
$o as MergeTagPlugin,
Mo as PIIRedactionPlugin,
rr as PREDEFINED_TEMPLATES,
Ko as PageBreakPlugin,
jo as PreviewPlugin,
_o as PrintPlugin,
Io as SlashCommandsPlugin,
Ao as SmartPastePlugin,
X as SpecialCharactersPlugin,
Pr as SpellCheckPlugin,
p as StrikethroughPlugin,
F as TablePlugin,
er as TemplatePlugin,
v as TextAlignmentPlugin,
z as TextColorPlugin,
lo as TrackChangesPlugin,
Eo as TranslationWorkflowPlugin,
m as UnderlinePlugin,
lo as VersionDiffPlugin,
rr as addCustomTemplate,
sr as buildApiUrl,
er as getAllTemplates,
zo as getDocumentManagerConfig,
Cr as getGlobalApiConfig,
cr as getGlobalApiHeaders,
Lo as getMediaManagerConfig,
tr as getTemplateCategories,
ir as getTemplatesByCategory,
nr as sanitizeTemplate,
lr as searchTemplates,
Go as setDocumentManagerConfig,
dr as setGlobalApiConfig,
Ho as setMediaManagerConfig,
gr as validateTemplate
mo as VersionDiffPlugin,
tr as addCustomTemplate,
cr as buildApiUrl,
ir as getAllTemplates,
Ro as getDocumentManagerConfig,
dr as getGlobalApiConfig,
Tr as getGlobalApiHeaders,
vo as getMediaManagerConfig,
nr as getTemplateCategories,
lr as getTemplatesByCategory,
gr as sanitizeTemplate,
mr as searchTemplates,
Uo as setDocumentManagerConfig,
hr as setGlobalApiConfig,
wo as setMediaManagerConfig,
ar as validateTemplate
};

@@ -837,2 +837,36 @@ import type { Plugin } from "@editora/core";

export interface FormatPainterPluginOptions {
ignoredFormats?: string[];
keepActiveAfterMouseApply?: boolean;
}
export interface FormatPainterSnapshot {
inline: {
marks: Partial<Record<"bold" | "italic" | "underline" | "strikethrough", boolean>>;
styles: Record<string, string>;
};
block: {
tagName: string;
styles: Record<string, string>;
attrs: Record<string, string>;
} | null;
list: {
tagName: "ul" | "ol";
styles: Record<string, string>;
attrs: Record<string, string>;
itemAttrs: Record<string, string>;
} | null;
table: {
table: {
styles: Record<string, string>;
attrs: Record<string, string>;
} | null;
cell: {
styles: Record<string, string>;
attrs: Record<string, string>;
} | null;
} | null;
ignoredFormats: string[];
}
export function HeadingPlugin(): Plugin;

@@ -853,2 +887,3 @@ export function BoldPlugin(): Plugin;

export function FontFamilyPlugin(): Plugin;
export function FormatPainterPlugin(options?: FormatPainterPluginOptions): Plugin;
export function TextAlignmentPlugin(): Plugin;

@@ -855,0 +890,0 @@ export function TextColorPlugin(): Plugin;

{
"name": "@editora/plugins",
"version": "1.0.14",
"version": "1.0.15",
"description": "Enterprise plugin suite for Editora rich text editor in React and web apps, including tables, media, workflow, and compliance tooling.",

@@ -237,2 +237,8 @@ "author": "Ajay Kumar <ajaykr089@gmail.com>",

},
"./format-painter": {
"types": "./index.d.ts",
"import": "./dist/format-painter.esm.js",
"require": "./dist/format-painter.cjs.js",
"default": "./dist/format-painter.esm.js"
},
"./footnote": {

@@ -423,6 +429,7 @@ "types": "./index.d.ts",

"test:translation-workflow": "node ../../node_modules/jest/bin/jest.js -c ./jest.config.cjs --watchman=false --runTestsByPath ./translation-workflow/src/TranslationWorkflowPlugin.native.test.js",
"verify:citations": "npm run typecheck:build && npm run test:citations && npm run test:content-rules && npm run test:approval-workflow && npm run test:pii-redaction && npm run test:smart-paste && npm run test:blocks-library && npm run test:doc-schema && npm run test:translation-workflow && npm run build"
"test:format-painter": "node -r ../../node_modules/ts-node/register ./format-painter/src/FormatPainterPlugin.native.test.js",
"verify:citations": "npm run typecheck:build && npm run test:citations && npm run test:content-rules && npm run test:approval-workflow && npm run test:pii-redaction && npm run test:smart-paste && npm run test:blocks-library && npm run test:doc-schema && npm run test:translation-workflow && npm run test:format-painter && npm run build"
},
"peerDependencies": {
"@editora/core": "^1.0.11"
"@editora/core": "^1.0.12"
},

@@ -434,3 +441,3 @@ "dependencies": {

"devDependencies": {
"@editora/core": "^1.0.11",
"@editora/core": "^1.0.12",
"@types/katex": "^0.16.8",

@@ -437,0 +444,0 @@ "typescript": "^5.0.0",