ados-rcm 1.1.1007 → 1.1.1008

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.
Files changed (32) hide show
  1. package/dist/AModule/AComponents/AEditor/modules/TableUp.d.ts +6 -0
  2. package/dist/{Copy-DcHpOgCF.cjs → Copy-AvYjjWe4.cjs} +1 -1
  3. package/dist/{Copy-BvZ-0__X.js → Copy-BNyYGBmv.js} +1 -1
  4. package/dist/{Divider-BVEQj-EX.cjs → Divider-BjuI0EJd.cjs} +1 -1
  5. package/dist/{Divider-ZH1cEhE7.js → Divider-DqKdYmV8.js} +1 -1
  6. package/dist/{FullScreen-BcvJGyDD.js → FullScreen-CjRdan6A.js} +1 -1
  7. package/dist/{FullScreen-DiAluvff.cjs → FullScreen-CyWTU7Ft.cjs} +1 -1
  8. package/dist/{ImageResizer-Dqs9RGH8.cjs → ImageResizer-niAb9Fxa.cjs} +1 -1
  9. package/dist/{ImageResizer-C_vqKWRL.js → ImageResizer-y3AopFN9.js} +1 -1
  10. package/dist/TableClipboard-D7yudMRi.cjs +6 -0
  11. package/dist/{TableClipboard-Cv4O5dsJ.js → TableClipboard-DgYnliQF.js} +130 -128
  12. package/dist/{TableSelection-C7dNejQZ.js → TableSelection-C64qGZoS.js} +3 -3
  13. package/dist/{TableSelection-DlqwQtwn.cjs → TableSelection-CtJ7N-FM.cjs} +1 -1
  14. package/dist/TableUp-CKlASJtR.js +298 -0
  15. package/dist/TableUp-szL2A6PJ.cjs +4 -0
  16. package/dist/{TableUpLogical-C5o_itQt.cjs → TableUpLogical-BFtHFpFr.cjs} +1 -1
  17. package/dist/{TableUpLogical-Cv5dDkYL.js → TableUpLogical-Dg7yztVA.js} +1 -1
  18. package/dist/{Video-Df3l-Q5Y.cjs → Video-DOjUHFhE.cjs} +1 -1
  19. package/dist/{Video-DGTP8c5d.js → Video-DfLGy7KY.js} +1 -1
  20. package/dist/{index-Q2cPTI_j.cjs → index-BGhDovuv.cjs} +1 -1
  21. package/dist/{index-DVR0BtEG.js → index-BeyP5m5z.js} +1 -1
  22. package/dist/{index-BU5UfEjR.js → index-CFWOoORH.js} +4365 -4389
  23. package/dist/{index-BRQ8EtDS.js → index-COSq3-qH.js} +1 -1
  24. package/dist/{index-2aSOnLaI.cjs → index-DWkviCYe.cjs} +1 -1
  25. package/dist/index-Yp8TH9Pd.cjs +344 -0
  26. package/dist/index.cjs.js +1 -1
  27. package/dist/index.es.js +1 -1
  28. package/package.json +1 -1
  29. package/dist/TableClipboard-Df3wJU8m.cjs +0 -6
  30. package/dist/TableUp-B2rjSNVN.cjs +0 -1
  31. package/dist/TableUp-CmKkYX4l.js +0 -202
  32. package/dist/index-DmqfsPy3.cjs +0 -344
@@ -1,6 +1,11 @@
1
1
  import { default as TableUp, TableCellInnerFormat } from 'quill-table-up';
2
2
  declare class JaeKanTableUp extends TableUp {
3
3
  private getTableSelectionModule;
4
+ private getRootComputedStyle;
5
+ private isInsideTableCell;
6
+ private readBlotName;
7
+ private getRootScrollbarWidth;
8
+ private resolveDefaultCellHeight;
4
9
  private resolveSelectedCells;
5
10
  private moveSelectionToCell;
6
11
  private clearDisplayedSelection;
@@ -12,6 +17,7 @@ declare class JaeKanTableUp extends TableUp {
12
17
  private normalizeTableStructure;
13
18
  private normalizeTableForCell;
14
19
  private resolveStableMergeSelection;
20
+ insertTable(rows: number, columns: number, source?: "api"): void;
15
21
  private mergeStableSelection;
16
22
  private resolveSplitCellHeights;
17
23
  private syncSplitCellHeights;
@@ -1 +1 @@
1
- "use strict";var y=Object.defineProperty;var x=(i,t,r)=>t in i?y(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r;var d=(i,t,r)=>x(i,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-DmqfsPy3.cjs"),u={capture:!0},p=new Set(["P","DIV","LI","BLOCKQUOTE","PRE","TR","TD","TH","SECTION","ARTICLE","H1","H2","H3","H4","H5","H6"]),m=/<(?:br|p|div|li|blockquote|pre|tr|td|th|section|article|h[1-6])\b|[\r\n\t]/i,T=/[\r\n\t]+/g,h=/\s{2,}/g;function E(i){return typeof i.insert=="string"?i.insert.length:1}class b{constructor(t,r={}){d(this,"clipboard");d(this,"quill");d(this,"cleanupFunctions",[]);this.clipboard=t.getModule("clipboard"),this.quill=t,r.isTitleMode&&this.setupTitleModePaste()}setupTitleModePaste(){const t=this.quill.root,r=e=>{if(e.preventDefault(),!e.clipboardData)return;const l=e.clipboardData.getData("text/html"),n=e.clipboardData.getData("text/plain"),a=this.quill.getSelection(!0);if(!a)return;if(l){const f=this.normalizeTitlePasteHtml(l),o=this.clipboard.convert({html:f});this.applyPasteDelta(a.index,a.length,o),this.scheduleSelection(a.index+this.getDeltaLength(o));return}const s=this.normalizeTitlePasteText(n);this.applyPasteText(a.index,a.length,s),this.scheduleSelection(a.index+s.length)};t.addEventListener("paste",r,u),this.cleanupFunctions.push(()=>{t.removeEventListener("paste",r,u)})}normalizeTitlePasteText(t){return t.replaceAll(T," ").replaceAll(h," ").trim()}normalizeTitlePasteHtml(t){var a,s;if(!m.test(t))return t;const r=document.createElement("div");r.innerHTML=t,this.flattenTitlePasteNode(r);const e=document.createTreeWalker(r,NodeFilter.SHOW_TEXT);let l=e.nextNode();for(;l;)l.textContent=((a=l.textContent)==null?void 0:a.replaceAll(h," "))??"",l=e.nextNode();const n=this.findLastTextNode(r);return n&&(n.textContent=((s=n.textContent)==null?void 0:s.replaceAll(/\s+$/g,""))??""),r.innerHTML}flattenTitlePasteNode(t){var e;const r=Array.from(t.childNodes);for(const l of r){if(l.nodeType===Node.TEXT_NODE){l.textContent=((e=l.textContent)==null?void 0:e.replaceAll(T," "))??"";continue}if(l instanceof HTMLElement){if(l.tagName==="BR"){l.replaceWith(document.createTextNode(" "));continue}this.flattenTitlePasteNode(l),p.has(l.tagName)&&l.nextSibling&&!this.endsWithWhitespace(l)&&l.appendChild(document.createTextNode(" "))}}}endsWithWhitespace(t){var r;return/\s$/.test(((r=this.findLastTextNode(t))==null?void 0:r.textContent)??"")}findLastTextNode(t){const r=Array.from(t.childNodes).reverse();for(const e of r){if(e.nodeType===Node.TEXT_NODE)return e;const l=this.findLastTextNode(e);if(l)return l}return null}getDeltaLength(t){var r;return((r=t.ops)==null?void 0:r.reduce((e,l)=>e+E(l),0))??0}applyPasteDelta(t,r,e){const l=new c.Delta().retain(t).delete(r).concat(e);this.quill.updateContents(l,c.Quill.sources.USER)}applyPasteText(t,r,e){const l=new c.Delta().retain(t).delete(r);e&&l.insert(e),this.quill.updateContents(l,c.Quill.sources.USER)}scheduleSelection(t){c.deferMicrotask(()=>this.quill.setSelection(t,0,c.Quill.sources.SILENT))}destroy(){this.cleanupFunctions.forEach(t=>t()),this.cleanupFunctions=[]}async copyContent(t){var r;try{const e=this.quill.getText(),l=this.quill.root.innerHTML;return this.copyToClipboard(e,l,t)}catch(e){return console.error("Error in copyContent:",e),(r=t==null?void 0:t.onError)==null||r.call(t),!1}}async copyToClipboard(t,r,e){var l,n;try{return await this.tryModernClipboardWithHtml(t,r,e)||await this.tryModernClipboardText(t,e)||r&&this.tryLegacyClipboardWithHtml(r,e)||this.tryLegacyClipboardText(t,e)?!0:((l=e==null?void 0:e.onError)==null||l.call(e),!1)}catch(a){return console.error("복사 중 오류 발생:",a),(n=e==null?void 0:e.onError)==null||n.call(e),!1}}async tryModernClipboardWithHtml(t,r,e){var l;if(!navigator.clipboard||!r||!globalThis.ClipboardItem||!globalThis.isSecureContext)return!1;try{return await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:"text/html"}),"text/plain":new Blob([t],{type:"text/plain"})})]),(l=e==null?void 0:e.onSuccess)==null||l.call(e),!0}catch{return!1}}async tryModernClipboardText(t,r){var e;if(!navigator.clipboard||!globalThis.isSecureContext)return!1;try{return await navigator.clipboard.writeText(t),(e=r==null?void 0:r.onSuccess)==null||e.call(r),!0}catch{return!1}}tryLegacyClipboardWithHtml(t,r){const e=document.createElement("div");e.innerHTML=t,e.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;",document.body.appendChild(e);try{const l=document.createRange();l.selectNodeContents(e);const n=globalThis.getSelection();return n?(n.removeAllRanges(),n.addRange(l),this.tryClipboardEventCopy({html:t,text:e.textContent??""},r)):!1}finally{e.remove()}}tryLegacyClipboardText(t,r){const e=document.createElement("textarea");e.value=t,e.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;",document.body.appendChild(e);try{return e.focus(),e.select(),this.tryClipboardEventCopy({text:t},r)}finally{e.remove()}}tryClipboardEventCopy(t,r){var n;let e=!1;const l=a=>{a.preventDefault(),a.clipboardData&&(a.clipboardData.setData("text/plain",t.text),t.html&&a.clipboardData.setData("text/html",t.html),e=!0)};document.addEventListener("copy",l);try{const a=new ClipboardEvent("copy",{clipboardData:new DataTransfer});if(document.dispatchEvent(a),e)return(n=r==null?void 0:r.onSuccess)==null||n.call(r),!0}catch{return!1}finally{document.removeEventListener("copy",l)}return!1}}exports.default=b;
1
+ "use strict";var y=Object.defineProperty;var x=(i,t,r)=>t in i?y(i,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[t]=r;var d=(i,t,r)=>x(i,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-Yp8TH9Pd.cjs"),u={capture:!0},p=new Set(["P","DIV","LI","BLOCKQUOTE","PRE","TR","TD","TH","SECTION","ARTICLE","H1","H2","H3","H4","H5","H6"]),m=/<(?:br|p|div|li|blockquote|pre|tr|td|th|section|article|h[1-6])\b|[\r\n\t]/i,T=/[\r\n\t]+/g,h=/\s{2,}/g;function E(i){return typeof i.insert=="string"?i.insert.length:1}class b{constructor(t,r={}){d(this,"clipboard");d(this,"quill");d(this,"cleanupFunctions",[]);this.clipboard=t.getModule("clipboard"),this.quill=t,r.isTitleMode&&this.setupTitleModePaste()}setupTitleModePaste(){const t=this.quill.root,r=e=>{if(e.preventDefault(),!e.clipboardData)return;const l=e.clipboardData.getData("text/html"),n=e.clipboardData.getData("text/plain"),a=this.quill.getSelection(!0);if(!a)return;if(l){const f=this.normalizeTitlePasteHtml(l),o=this.clipboard.convert({html:f});this.applyPasteDelta(a.index,a.length,o),this.scheduleSelection(a.index+this.getDeltaLength(o));return}const s=this.normalizeTitlePasteText(n);this.applyPasteText(a.index,a.length,s),this.scheduleSelection(a.index+s.length)};t.addEventListener("paste",r,u),this.cleanupFunctions.push(()=>{t.removeEventListener("paste",r,u)})}normalizeTitlePasteText(t){return t.replaceAll(T," ").replaceAll(h," ").trim()}normalizeTitlePasteHtml(t){var a,s;if(!m.test(t))return t;const r=document.createElement("div");r.innerHTML=t,this.flattenTitlePasteNode(r);const e=document.createTreeWalker(r,NodeFilter.SHOW_TEXT);let l=e.nextNode();for(;l;)l.textContent=((a=l.textContent)==null?void 0:a.replaceAll(h," "))??"",l=e.nextNode();const n=this.findLastTextNode(r);return n&&(n.textContent=((s=n.textContent)==null?void 0:s.replaceAll(/\s+$/g,""))??""),r.innerHTML}flattenTitlePasteNode(t){var e;const r=Array.from(t.childNodes);for(const l of r){if(l.nodeType===Node.TEXT_NODE){l.textContent=((e=l.textContent)==null?void 0:e.replaceAll(T," "))??"";continue}if(l instanceof HTMLElement){if(l.tagName==="BR"){l.replaceWith(document.createTextNode(" "));continue}this.flattenTitlePasteNode(l),p.has(l.tagName)&&l.nextSibling&&!this.endsWithWhitespace(l)&&l.appendChild(document.createTextNode(" "))}}}endsWithWhitespace(t){var r;return/\s$/.test(((r=this.findLastTextNode(t))==null?void 0:r.textContent)??"")}findLastTextNode(t){const r=Array.from(t.childNodes).reverse();for(const e of r){if(e.nodeType===Node.TEXT_NODE)return e;const l=this.findLastTextNode(e);if(l)return l}return null}getDeltaLength(t){var r;return((r=t.ops)==null?void 0:r.reduce((e,l)=>e+E(l),0))??0}applyPasteDelta(t,r,e){const l=new c.Delta().retain(t).delete(r).concat(e);this.quill.updateContents(l,c.Quill.sources.USER)}applyPasteText(t,r,e){const l=new c.Delta().retain(t).delete(r);e&&l.insert(e),this.quill.updateContents(l,c.Quill.sources.USER)}scheduleSelection(t){c.deferMicrotask(()=>this.quill.setSelection(t,0,c.Quill.sources.SILENT))}destroy(){this.cleanupFunctions.forEach(t=>t()),this.cleanupFunctions=[]}async copyContent(t){var r;try{const e=this.quill.getText(),l=this.quill.root.innerHTML;return this.copyToClipboard(e,l,t)}catch(e){return console.error("Error in copyContent:",e),(r=t==null?void 0:t.onError)==null||r.call(t),!1}}async copyToClipboard(t,r,e){var l,n;try{return await this.tryModernClipboardWithHtml(t,r,e)||await this.tryModernClipboardText(t,e)||r&&this.tryLegacyClipboardWithHtml(r,e)||this.tryLegacyClipboardText(t,e)?!0:((l=e==null?void 0:e.onError)==null||l.call(e),!1)}catch(a){return console.error("복사 중 오류 발생:",a),(n=e==null?void 0:e.onError)==null||n.call(e),!1}}async tryModernClipboardWithHtml(t,r,e){var l;if(!navigator.clipboard||!r||!globalThis.ClipboardItem||!globalThis.isSecureContext)return!1;try{return await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([r],{type:"text/html"}),"text/plain":new Blob([t],{type:"text/plain"})})]),(l=e==null?void 0:e.onSuccess)==null||l.call(e),!0}catch{return!1}}async tryModernClipboardText(t,r){var e;if(!navigator.clipboard||!globalThis.isSecureContext)return!1;try{return await navigator.clipboard.writeText(t),(e=r==null?void 0:r.onSuccess)==null||e.call(r),!0}catch{return!1}}tryLegacyClipboardWithHtml(t,r){const e=document.createElement("div");e.innerHTML=t,e.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;",document.body.appendChild(e);try{const l=document.createRange();l.selectNodeContents(e);const n=globalThis.getSelection();return n?(n.removeAllRanges(),n.addRange(l),this.tryClipboardEventCopy({html:t,text:e.textContent??""},r)):!1}finally{e.remove()}}tryLegacyClipboardText(t,r){const e=document.createElement("textarea");e.value=t,e.style.cssText="position:fixed;left:-9999px;top:-9999px;opacity:0;",document.body.appendChild(e);try{return e.focus(),e.select(),this.tryClipboardEventCopy({text:t},r)}finally{e.remove()}}tryClipboardEventCopy(t,r){var n;let e=!1;const l=a=>{a.preventDefault(),a.clipboardData&&(a.clipboardData.setData("text/plain",t.text),t.html&&a.clipboardData.setData("text/html",t.html),e=!0)};document.addEventListener("copy",l);try{const a=new ClipboardEvent("copy",{clipboardData:new DataTransfer});if(document.dispatchEvent(a),e)return(n=r==null?void 0:r.onSuccess)==null||n.call(r),!0}catch{return!1}finally{document.removeEventListener("copy",l)}return!1}}exports.default=b;
@@ -1,7 +1,7 @@
1
1
  var x = Object.defineProperty;
2
2
  var p = (i, t, r) => t in i ? x(i, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[t] = r;
3
3
  var s = (i, t, r) => p(i, typeof t != "symbol" ? t + "" : t, r);
4
- import { D as u, Q as d, d as m } from "./index-BU5UfEjR.js";
4
+ import { D as u, Q as d, d as m } from "./index-CFWOoORH.js";
5
5
  const h = {
6
6
  capture: !0
7
7
  }, E = /* @__PURE__ */ new Set(["P", "DIV", "LI", "BLOCKQUOTE", "PRE", "TR", "TD", "TH", "SECTION", "ARTICLE", "H1", "H2", "H3", "H4", "H5", "H6"]), C = /<(?:br|p|div|li|blockquote|pre|tr|td|th|section|article|h[1-6])\b|[\r\n\t]/i, T = /[\r\n\t]+/g, f = /\s{2,}/g;
@@ -1 +1 @@
1
- "use strict";var n=Object.defineProperty;var c=(e,t,o)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var i=(e,t,o)=>c(e,typeof t!="symbol"?t+"":t,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-DmqfsPy3.cjs"),d=r.Quill.import("blots/block/embed"),a=r.Quill.import("ui/icons"),l="border: var(--AEditor_Addon_Primary_border); border-bottom: none; transition: border var(--Transition);";a.divider=r.ReactDOMServer.renderToString(r.jsxRuntimeExports.jsx(r.AIcon,{icon:"Minus",strokeWidth:2.5,width:"100%"}));class s extends d{static create(){const t=super.create(!0);return t.style.cssText=l,t}}i(s,"blotName","divider"),i(s,"tagName","hr");exports.default=s;
1
+ "use strict";var n=Object.defineProperty;var c=(e,t,o)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var i=(e,t,o)=>c(e,typeof t!="symbol"?t+"":t,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index-Yp8TH9Pd.cjs"),d=r.Quill.import("blots/block/embed"),a=r.Quill.import("ui/icons"),l="border: var(--AEditor_Addon_Primary_border); border-bottom: none; transition: border var(--Transition);";a.divider=r.ReactDOMServer.renderToString(r.jsxRuntimeExports.jsx(r.AIcon,{icon:"Minus",strokeWidth:2.5,width:"100%"}));class s extends d{static create(){const t=super.create(!0);return t.style.cssText=l,t}}i(s,"blotName","divider"),i(s,"tagName","hr");exports.default=s;
@@ -1,7 +1,7 @@
1
1
  var n = Object.defineProperty;
2
2
  var a = (r, t, e) => t in r ? n(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
3
  var o = (r, t, e) => a(r, typeof t != "symbol" ? t + "" : t, e);
4
- import { Q as i, R as c, j as d, A as m } from "./index-BU5UfEjR.js";
4
+ import { Q as i, R as c, j as d, A as m } from "./index-CFWOoORH.js";
5
5
  const b = i.import("blots/block/embed"), l = i.import("ui/icons"), u = "border: var(--AEditor_Addon_Primary_border); border-bottom: none; transition: border var(--Transition);";
6
6
  l.divider = c.renderToString(/* @__PURE__ */ d.jsx(m, { icon: "Minus", strokeWidth: 2.5, width: "100%" }));
7
7
  class s extends b {
@@ -1,7 +1,7 @@
1
1
  var l = Object.defineProperty;
2
2
  var r = (e, t, o) => t in e ? l(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
3
  var i = (e, t, o) => r(e, typeof t != "symbol" ? t + "" : t, o);
4
- import { a as u, b as c } from "./index-BU5UfEjR.js";
4
+ import { a as u, b as c } from "./index-CFWOoORH.js";
5
5
  class h {
6
6
  constructor(t, o = {}) {
7
7
  i(this, "quill");
@@ -1 +1 @@
1
- "use strict";var r=Object.defineProperty;var u=(i,t,o)=>t in i?r(i,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[t]=o;var e=(i,t,o)=>u(i,typeof t!="symbol"?t+"":t,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-DmqfsPy3.cjs");class c{constructor(t,o={}){e(this,"quill");e(this,"options");e(this,"toolbarEl");e(this,"ownerDocument");e(this,"controller");e(this,"button",null);e(this,"buttonIcon",null);e(this,"unsubscribeController",null);e(this,"buttonClickHandler",t=>this.controller.toggleFullscreen(t));if(this.quill=t,this.options=o,this.ownerDocument=t.root instanceof HTMLElement?t.root.ownerDocument:document,this.controller=s.getOrCreateQuillFullscreenController(t),this.options.type==="Raw"){this.toolbarEl=null;return}const n=t.getModule("toolbar"),l=(n==null?void 0:n.container)??null;this.toolbarEl=l,this.createButton()}destroy(){var t,o;(t=this.unsubscribeController)==null||t.call(this),this.unsubscribeController=null,this.button&&(this.button.removeEventListener("click",this.buttonClickHandler),this.button.remove(),this.button=null),(o=this.toolbarEl)==null||o.classList.remove("ql-toolbar-has-right-action"),s.destroyQuillFullscreenController(this.quill)}createButton(){if(!this.options.maximize||!this.options.minimize)return;const t=this.ownerDocument.createElement("button"),o=this.ownerDocument.createElement("span");t.type="button",t.classList.add("ql-fullscreen"),o.classList.add("ql-fullscreen-icon"),t.append(o),t.addEventListener("click",this.buttonClickHandler),this.button=t,this.buttonIcon=o,this.unsubscribeController=this.controller.subscribe(n=>this.syncButtonState(n)),this.toolbarEl&&(t.classList.add("ql-right-action"),this.toolbarEl.classList.add("ql-toolbar-has-right-action"),this.toolbarEl.append(t))}syncButtonState(t){if(!this.button||!this.buttonIcon)return;this.button.classList.toggle("ql-active",t);const o=t?this.options.minimize??"":this.options.maximize??"",n=t?this.options.minimizeLabel??"":this.options.maximizeLabel??"";this.buttonIcon.innerHTML!==o&&(this.buttonIcon.innerHTML=o),this.button.title!==n&&(this.button.title=n),this.button.getAttribute("aria-label")!==n&&this.button.setAttribute("aria-label",n)}}exports.default=c;
1
+ "use strict";var r=Object.defineProperty;var u=(i,t,o)=>t in i?r(i,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[t]=o;var e=(i,t,o)=>u(i,typeof t!="symbol"?t+"":t,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-Yp8TH9Pd.cjs");class c{constructor(t,o={}){e(this,"quill");e(this,"options");e(this,"toolbarEl");e(this,"ownerDocument");e(this,"controller");e(this,"button",null);e(this,"buttonIcon",null);e(this,"unsubscribeController",null);e(this,"buttonClickHandler",t=>this.controller.toggleFullscreen(t));if(this.quill=t,this.options=o,this.ownerDocument=t.root instanceof HTMLElement?t.root.ownerDocument:document,this.controller=s.getOrCreateQuillFullscreenController(t),this.options.type==="Raw"){this.toolbarEl=null;return}const n=t.getModule("toolbar"),l=(n==null?void 0:n.container)??null;this.toolbarEl=l,this.createButton()}destroy(){var t,o;(t=this.unsubscribeController)==null||t.call(this),this.unsubscribeController=null,this.button&&(this.button.removeEventListener("click",this.buttonClickHandler),this.button.remove(),this.button=null),(o=this.toolbarEl)==null||o.classList.remove("ql-toolbar-has-right-action"),s.destroyQuillFullscreenController(this.quill)}createButton(){if(!this.options.maximize||!this.options.minimize)return;const t=this.ownerDocument.createElement("button"),o=this.ownerDocument.createElement("span");t.type="button",t.classList.add("ql-fullscreen"),o.classList.add("ql-fullscreen-icon"),t.append(o),t.addEventListener("click",this.buttonClickHandler),this.button=t,this.buttonIcon=o,this.unsubscribeController=this.controller.subscribe(n=>this.syncButtonState(n)),this.toolbarEl&&(t.classList.add("ql-right-action"),this.toolbarEl.classList.add("ql-toolbar-has-right-action"),this.toolbarEl.append(t))}syncButtonState(t){if(!this.button||!this.buttonIcon)return;this.button.classList.toggle("ql-active",t);const o=t?this.options.minimize??"":this.options.maximize??"",n=t?this.options.minimizeLabel??"":this.options.maximizeLabel??"";this.buttonIcon.innerHTML!==o&&(this.buttonIcon.innerHTML=o),this.button.title!==n&&(this.button.title=n),this.button.getAttribute("aria-label")!==n&&this.button.setAttribute("aria-label",n)}}exports.default=c;
@@ -1 +1 @@
1
- "use strict";var P=Object.defineProperty;var w=(h,i,t)=>i in h?P(h,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[i]=t;var n=(h,i,t)=>w(h,typeof i!="symbol"?i+"":i,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-DmqfsPy3.cjs"),g={OVERLAY:"ql-image-resizer-overlay",HANDLE:"ql-image-resizer-handle",DISPLAY:"ql-image-resizer-display",TOOLBAR:"ql-image-resizer-toolbar",TOOLBAR_BUTTON:"ql-image-resizer-toolbar-button"},d={BACKSPACE:8,DELETE:46,LEFT:37,UP:38,RIGHT:39,DOWN:40};function M(h){switch(h.key){case"Backspace":return d.BACKSPACE;case"Delete":return d.DELETE;case"ArrowLeft":return d.LEFT;case"ArrowUp":return d.UP;case"ArrowRight":return d.RIGHT;case"ArrowDown":return d.DOWN;default:return 0}}const q=["tl","tr","br","bl"],F=8;function N(h){var t;const i=new Uint32Array(h);if(typeof((t=globalThis.crypto)==null?void 0:t.getRandomValues)=="function")globalThis.crypto.getRandomValues(i);else{let e=Date.now();for(let s=0;s<h;s++)e=e*1103515245+12345&2147483647,i[s]=e}return Array.from(i,e=>e%62).join("")}const v=(h,i)=>{const t=h?"top":"bottom",e=i?"left":"right",s=h===i?"nwse-resize":"nesw-resize";return{[t]:"-5px",[e]:"-5px",cursor:s}},R={tl:v(!0,!0),tr:v(!0,!1),bl:v(!1,!0),br:v(!1,!1)},O=new Map,L=globalThis;function B(h){const i=O.get(h);if(i)return i;const t=u.ReactDOMServer.renderToString(u.jsxRuntimeExports.jsx(u.AIcon,{icon:h,size:"xs"}));return O.set(h,t),t}const k={modules:["DisplaySize","Toolbar","Resize","Keyboard"],embedTags:["VIDEO","IFRAME"],tools:["left","center","right","justify"],contentOptions:[{attribute:["width"],limit:{minWidth:100},blotName:"image"},{attribute:["width","height"],limit:{minWidth:200,ratio:.5625},blotName:"video"}]},z=u.Quill.import("formats/image");class E extends z{static get ATTRIBUTES(){return["alt","height","width","class","style","data-align"]}static formats(i){return this.ATTRIBUTES.reduce((t,e)=>(i.hasAttribute(e)&&(t[e]=i.getAttribute(e)??""),t),{})}format(i,t){this.constructor.ATTRIBUTES.includes(i)?t?this.domNode.setAttribute(i,t):this.domNode.removeAttribute(i):super.format(i,t)}}n(E,"blotName","image"),n(E,"tagName","img"),n(E,"scope",u.Scope.INLINE);function I(){L.__AEDITOR_IMAGE_BLOT_REGISTERED__||(u.Quill.register("formats/image",E,!0),L.__AEDITOR_IMAGE_BLOT_REGISTERED__=!0)}class y{constructor(i){n(this,"resizer");n(this,"quill");n(this,"overlay");n(this,"activeEle");n(this,"blot");n(this,"options");n(this,"requestUpdate");this.resizer=i,this.quill=i.quill,this.overlay=i.overlay,this.activeEle=i.activeEle,this.blot=i.blot,this.options=i.options,this.requestUpdate=()=>i.scheduleUpdate(!0)}onCreate(){}onDestroy(){}onUpdate(){}}class U extends y{constructor(){super(...arguments);n(this,"display")}onCreate(){var t;this.display=document.createElement("div"),this.display.className=u.S[g.DISPLAY],(t=this.overlay)==null||t.appendChild(this.display)}onUpdate(){if(!this.display||!this.activeEle)return;const[t,e]=[this.activeEle.offsetWidth,this.activeEle.offsetHeight];this.display.textContent=`${t} × ${e}`,this.positionDisplay(t,e)}positionDisplay(t,e){var p;if(!this.display)return;const s=this.display.getBoundingClientRect(),o=t>120&&e>30,l=((p=this.activeEle)==null?void 0:p.style.float)==="right";let r,a,c;o?(r="4px",a="4px",c="auto"):(a=`-${s.height+4}px`,l?(r="auto",c=`-${s.width+4}px`):(r=`-${s.width+4}px`,c="auto")),Object.assign(this.display.style,{right:r,bottom:a,left:c})}}class j extends y{constructor(){super(...arguments);n(this,"boxes",[]);n(this,"dragBox",null);n(this,"dragStartX",0);n(this,"dragStartY",0);n(this,"contentOption");n(this,"preDragSize",{width:0,height:0});n(this,"naturalSize",[0,0]);n(this,"handleDragProxy",null);n(this,"handleMouseupProxy",null);n(this,"dragAnimationFrame",null);n(this,"pendingDragEvent",null);n(this,"handleMousedown",t=>{t.button!==0||!this.blot||!this.activeEle||(t.preventDefault(),t.stopPropagation(),this.cancelDragFrame(),this.removeEventListeners(),this.dragBox=t.target,this.dragStartX=t.clientX,this.dragStartY=t.clientY,this.preDragSize={width:this.activeEle.offsetWidth,height:this.activeEle.offsetHeight},this.naturalSize=this.getNaturalSize(),this.setCursor(globalThis.getComputedStyle(this.dragBox).cursor),this.handleDragProxy=this.handleDrag,this.handleMouseupProxy=this.handleMouseup,document.addEventListener("mousemove",this.handleDragProxy,!0),document.addEventListener("mouseup",this.handleMouseupProxy,!0))});n(this,"handleMouseup",t=>{if(!this.activeEle||!this.blot||!this.contentOption)return;this.cancelDragFrame();const e=this.calcSize(t,this.contentOption.limit);Object.assign(this.activeEle,e),Object.assign(this.activeEle.style,{width:null,height:null}),this.setCursor(""),this.removeEventListeners()});n(this,"handleDrag",t=>{!this.activeEle||!this.blot||!this.contentOption||(t.preventDefault(),this.pendingDragEvent=t,this.dragAnimationFrame===null&&(this.dragAnimationFrame=requestAnimationFrame(()=>{this.dragAnimationFrame=null;const e=this.pendingDragEvent;this.pendingDragEvent=null,!(!e||!this.activeEle||!this.contentOption)&&(Object.assign(this.activeEle.style,this.calcSize(e,{...this.contentOption.limit,unit:!0})),this.requestUpdate())})))});n(this,"handleDoubleClick",t=>{if(!this.blot||!this.activeEle||!this.contentOption)return;t.stopPropagation();const[e,s]=this.naturalSize,o={};this.contentOption.attribute.includes("width")&&(o.width=e),this.contentOption.attribute.includes("height")&&(o.height=s);const l=this.applyConstraints(o,this.contentOption.limit);Object.assign(this.activeEle,l),this.requestUpdate()})}onCreate(){!this.blot||!this.options.contentOptions||(this.contentOption=this.options.contentOptions.find(t=>t.blotName===this.blot.statics.blotName),this.boxes=[],q.forEach(t=>this.addBox(t)))}onDestroy(){this.setCursor(""),this.cancelDragFrame(),this.removeEventListeners(),this.boxes.forEach(t=>{t.removeEventListener("mousedown",this.handleMousedown,!1),t.removeEventListener("dblclick",this.handleDoubleClick,!1)}),this.boxes=[]}addBox(t){var s;const e=document.createElement("div");e.className=`${u.S[g.HANDLE]} ${t}`,e.addEventListener("mousedown",this.handleMousedown,!1),e.addEventListener("dblclick",this.handleDoubleClick,!1),Object.assign(e.style,R[t]),(s=this.overlay)==null||s.appendChild(e),this.boxes.push(e)}removeEventListeners(){this.handleDragProxy&&(document.removeEventListener("mousemove",this.handleDragProxy,!0),this.handleDragProxy=null),this.handleMouseupProxy&&(document.removeEventListener("mouseup",this.handleMouseupProxy,!0),this.handleMouseupProxy=null)}calcSize(t,e={}){var a;if(!this.dragBox||!this.activeEle)return{};const s=t.clientX-this.dragStartX,o=t.clientY-this.dragStartY,l=this.dragBox===this.boxes[0]||this.dragBox===this.boxes[3]?-1:1,r={};return(a=this.contentOption)!=null&&a.attribute?this.contentOption.attribute.forEach(c=>r[c]=this.preDragSize[c]):r.width=this.preDragSize.width,r.width&&(r.width=Math.round(this.preDragSize.width+s*l)),r.height&&(r.height=Math.round(this.preDragSize.height+o*l)),this.applyConstraints(r,e)}constrainDimensionsWithRatio(t,e){const s=e.ratio;let o=this.applyLimit(t,e.minWidth,e.maxWidth),l=o*s;const r=this.applyLimit(l,e.minHeight,e.maxHeight);return r!==l&&(l=r,o=l/s),{rw:o,rh:l}}applyConstraints(t,e={}){const s=typeof t.width=="string"?Number.parseInt(t.width,10):t.width||0,o=typeof t.height=="string"?Number.parseInt(t.height,10):t.height||0;let l=s,r=o;e.ratio?{rw:l,rh:r}=this.constrainDimensionsWithRatio(l,e):(s&&(l=this.applyLimit(l,e.minWidth,e.maxWidth)),o&&(r=this.applyLimit(r,e.minHeight,e.maxHeight)));const a={};return t.width!==void 0&&(a.width=e.unit?`${l}px`:l),t.height!==void 0&&(a.height=e.unit?`${r}px`:r),a}applyLimit(t,e,s){let o=t;return e!==void 0&&(o=Math.max(e,o)),s!==void 0&&(o=Math.min(s,o)),o}getNaturalSize(){if(!this.activeEle)return[0,0];const t=this.activeEle.dataset.size;if(!t){const e=this.activeEle,s=[e.offsetWidth,e.offsetHeight];return e.dataset.size=s.join(","),s}return t.split(",").map(Number)}setCursor(t){[document.body,this.activeEle].forEach(e=>e&&(e.style.cursor=t))}cancelDragFrame(){this.dragAnimationFrame!==null&&(cancelAnimationFrame(this.dragAnimationFrame),this.dragAnimationFrame=null),this.pendingDragEvent=null}}const m=class m extends y{constructor(){super(...arguments);n(this,"keyboardProxy",t=>this.keyboardHandle(t))}static injectInit(t){var s;if(m.injectedQuills.has(t))return;const e=(s=t.keyboard)==null?void 0:s.bindings;e&&([m.keys.LEFT,m.keys.RIGHT].forEach(o=>(e[o]||[]).unshift(m.makeArrowHandler(o))),m.injectedQuills.add(t))}static makeArrowHandler(t){const e=t===m.keys.LEFT;return{key:t,shiftKey:!1,altKey:null,[e?"prefix":"suffix"]:/^$/,handler(s){const o=this.quill;if(!o.resizer)return!0;let l=s.index;const r=t===m.keys.RIGHT,[a]=o.getLine(l+(e?-1:0));if(!a)return!0;if(o.resizer.judgeShow(a))return!1;const c=o.getIndex(a);if(r&&c+a.length()-1===l)return!0;r&&(l+=s.length+1);const[p]=o.getLeaf(l);if(!p)return!0;const x=p.offset(p.parent),D=p.constructor&&"scope"in p.constructor&&p.constructor.scope===u.Scope.BLOCK_BLOT;if(e&&(D&&l===x||l===0||l===c))return!0;let S=p;if(e&&x===0){const[T]=o.getLeaf(l-1);T&&(S=T)}return!S||!o.resizer.judgeShow(S)}}}onCreate(){document.addEventListener("keydown",this.keyboardProxy,!0)}onDestroy(){document.removeEventListener("keydown",this.keyboardProxy,!0)}keyboardHandle(t){if(t.defaultPrevented||t.shiftKey||t.ctrlKey||t.altKey||!this.activeEle||!this.blot)return;const e=M(t);let s=this.blot.offset(this.quill.scroll),o=null,l=!1;e===d.BACKSPACE||e===d.DELETE?(this.handleDelete(),l=!0):e>=d.LEFT&&e<=d.DOWN&&([s,o]=this.handleArrowKeys(e,s),l=!0),l&&(t.stopPropagation(),t.preventDefault()),!(o&&this.resizer.judgeShow(o,o.domNode))&&(this.quill.setSelection(s),this.resizer.hide())}handleDelete(){if(!this.blot)return;const t=this.blot.length();this.blot.deleteAt(0,t),this.blot=void 0,this.activeEle=void 0,this.resizer.hide()}handleArrowKeys(t,e){let s=null;return t===d.RIGHT?e+=this.blot.length()||1:t===d.UP?(e=this.getOtherLineIndex(-1),s=this.quill.getLeaf(e)[0]):t===d.DOWN&&(e=this.getOtherLineIndex(1),s=this.quill.getLeaf(e)[0]),[e,s]}getOtherLineIndex(t){if(!this.blot)return 0;const e=this.blot.offset(this.quill.scroll),[s]=this.quill.getLine(e);if(!s)return e;const o=this.blot.offset(s)+1,l=t>0?s.next:s.prev;if(!l)return e;let r=l.length();return l.statics.blotName==="block"&&r--,l.offset(this.quill.scroll)+Math.min(r,o)}};n(m,"keys",d),n(m,"injectedQuills",new WeakSet);let b=m;const f=class f extends y{constructor(t){super(t);n(this,"toolbar");n(this,"blot");n(this,"tools",{});n(this,"toolbarClickProxy",t=>this.handleToolbarClick(t));this.blot=t.blot}createStyleTool(t,e){const s={left:{float:"left"},right:{float:"right"},center:{display:"block",margin:"0 auto",float:"none"},justify:{display:"block",float:"none",margin:"0",width:"100%"}};return{icon:t,apply:o=>{this.clearAlignmentStyles(o);const l=s[e];Object.assign(o.style,l),o.dataset.align=e},isApplied:o=>{const l=o.style;switch(e){case"center":return l.float==="none";case"justify":return l.display==="block"&&l.width==="100%";case"left":case"right":return l.float===e;default:return!1}}}}clearAlignmentStyles(t){const e=t.dataset.align;t.style.removeProperty("display"),t.style.removeProperty("float"),t.style.removeProperty("margin"),e==="justify"&&t.style.removeProperty("width"),delete t.dataset.align}onCreate(){var t;this.toolbar=document.createElement("div"),this.toolbar.className=u.S[g.TOOLBAR],this.toolbar.addEventListener("click",this.toolbarClickProxy),(t=this.overlay)==null||t.appendChild(this.toolbar),this.initializeTools(),this._addToolbarButtons()}onDestroy(){var t;(t=this.toolbar)==null||t.removeEventListener("click",this.toolbarClickProxy),this.toolbar=void 0}initializeTools(){Object.keys(f.Tools).forEach(t=>{const e=t;this.tools[e]=this.createStyleTool(f.Tools[e].icon,e)})}_addToolbarButtons(){!this.toolbar||!this.activeEle||this.options.tools.forEach(t=>{const e=this.tools[t];if(!e)return;const s=document.createElement("button");s.type="button",s.className=u.S[g.TOOLBAR_BUTTON],s.innerHTML=B(e.icon),s.dataset.tool=t,e.isApplied&&this.activeEle&&e.isApplied.call(this,this.activeEle)&&(s.style.backgroundColor="var(--AEditor_Addon_Secondary_color)"),this.toolbar.appendChild(s)})}handleToolbarClick(t){var r,a;if(!this.activeEle||!this.blot||!this.toolbar)return;const e=(r=t.target)==null?void 0:r.closest("button[data-tool]");if(!e||!this.toolbar.contains(e))return;const s=e.dataset.tool;if(!s)return;const o=this.tools[s];if(!o||(t.stopPropagation(),o.handler&&o.handler.call(this,t,e,this.activeEle)!==!0))return;const l=o.isApplied?o.isApplied.call(this,this.activeEle):!1;Array.from(this.toolbar.querySelectorAll("button")).forEach(c=>c.style.backgroundColor=""),l?this.clearAlignmentStyles(this.activeEle):(e.style.backgroundColor="var(--AEditor_Addon_Secondary_color)",(a=o.apply)==null||a.call(o,this.activeEle)),this.requestUpdate()}};n(f,"Tools",{left:{icon:"AlignLeft"},center:{icon:"AlignCenter"},right:{icon:"AlignRight"},justify:{icon:"AlignJustify"}});let A=f;class C{constructor(i,t={}){n(this,"isDestroyed",!1);n(this,"quill");n(this,"options");n(this,"moduleClasses");n(this,"modules",[]);n(this,"blot");n(this,"selectedBlots",[]);n(this,"embedClassName","");n(this,"activeEle");n(this,"overlay");n(this,"updateFromModule",!1);n(this,"hideProxy",null);n(this,"updateOverlayPositionProxy",null);n(this,"embedStyleElement",null);n(this,"updateAnimationFrame",null);n(this,"overlayScrollAnimationFrame",null);n(this,"pendingOverlayMarginTop",null);n(this,"scheduledFromModule",!1);n(this,"previousBodyUserSelect",null);n(this,"previousRootUserSelect",null);n(this,"handleClickProxy",i=>this.handleClick(i));n(this,"handleChangeProxy",(i,t,e)=>this.handleChange(i,t,e));n(this,"handleSelectionChangeProxy",i=>this.addBlotsSelectedClass(i));var s;I(),i.resizer=this,this.isDestroyed=!1,this.quill=i;const e=t.modules?[...t.modules]:null;this.options={...k,...t},e&&(this.options.modules=e),this.moduleClasses=this.options.modules,this.quill.root.addEventListener("mousedown",this.handleClickProxy,!1),this.quill.on("text-change",this.handleChangeProxy),this.quill.container.style.position=this.quill.container.style.position||"relative",this.quill.on("selection-change",this.handleSelectionChangeProxy),b.injectInit(this.quill),(s=this.options.embedTags)!=null&&s.length&&this.initializeEmbed()}destroy(){var i;this.isDestroyed||(this.isDestroyed=!0,this.updateAnimationFrame!==null&&(cancelAnimationFrame(this.updateAnimationFrame),this.updateAnimationFrame=null),this.overlayScrollAnimationFrame!==null&&(cancelAnimationFrame(this.overlayScrollAnimationFrame),this.overlayScrollAnimationFrame=null),this.pendingOverlayMarginTop=null,this.hide(),this.quill.root.removeEventListener("mousedown",this.handleClickProxy,!1),this.quill.off("text-change",this.handleChangeProxy),this.quill.off("selection-change",this.handleSelectionChangeProxy),(i=this.embedStyleElement)==null||i.remove(),this.embedStyleElement=null,this.embedClassName&&this.quill.root.classList.remove(this.embedClassName))}initializeModules(){this.modules.forEach(i=>i.onDestroy()),this.modules=[],this.modules=this.moduleClasses.map(i=>new(this.constructor.Modules[i]||i)(this)),this.modules.forEach(i=>i.onCreate()),this.repositionElements(),this.modules.forEach(i=>i.onUpdate())}initializeEmbed(){if(!this.options.embedTags.length)return;this.embedClassName=`ql-${N(F)}`;const i=[""].concat(this.options.embedTags).join(`, .${this.embedClassName} `).slice(2)+"{pointer-events: none;}",t=document.createElement("style");t.textContent=i,this.embedStyleElement=t,this.quill.container.appendChild(t),this.quill.root.classList.add(this.embedClassName)}scheduleUpdate(i){this.scheduledFromModule=this.scheduledFromModule||!!i,this.updateAnimationFrame===null&&(this.updateAnimationFrame=requestAnimationFrame(()=>{this.updateAnimationFrame=null;const t=this.scheduledFromModule;this.scheduledFromModule=!1,this.onUpdate(t)}))}onUpdate(i){this.updateFromModule=!!i,this.repositionElements(),this.modules.forEach(t=>t.onUpdate())}resolveMediaTarget(i){if(!(i instanceof HTMLElement))return null;const t=["img","iframe","video",".ql-video"].join(", ");if(i.matches(t))return i;const e=i.closest(t);return e||null}handleClick(i){if(this.overlay&&(i.target===this.overlay||this.overlay.contains(i.target)))return;let t=i.target;if(t=this.getEventTarget(i,t),t!=null&&t.tagName){const e=this.quill.scroll.find(t);if(e&&this.judgeShow(e,t)){i.preventDefault();return}}this.activeEle&&this.hide()}getEventTarget(i,t){var l;const e=(l=this.options.embedTags)==null?void 0:l.join(),s=this.resolveMediaTarget(t);if(s)return s;if(typeof document.elementsFromPoint=="function"){const r=document.elementsFromPoint(i.clientX,i.clientY).map(a=>this.resolveMediaTarget(a)).find(a=>!!a&&this.quill.root.contains(a));if(r)return r}if(!e)return t;const o=this.quill.root;if(t===o||t.querySelectorAll(e).length){o.classList.remove(this.embedClassName);const r=document.elementFromPoint(i.clientX,i.clientY);o.classList.add(this.embedClassName);const a=this.resolveMediaTarget(r);if(a&&o.contains(a))return a;r&&(t=r)}return t}judgeShow(i,t){if(!i||!this.options.contentOptions)return!1;!t&&i.domNode&&(t=i.domNode);const e=this.options.contentOptions.find(o=>o.blotName===i.statics.blotName);if(!e)return!1;if(this.activeEle===t)return!0;const s=e.limit||{};return!s.minWidth||s.minWidth&&t.offsetWidth>=s.minWidth?(this.activeEle&&this.hide(),this.activeEle=t,this.blot=i,this.showOverlay(),this.initializeModules(),!0):!1}handleChange(i,t,e){if(this.updateFromModule){this.updateFromModule=!1;return}e!=="user"||!this.overlay||!this.activeEle||this.onUpdate()}showOverlay(){this.overlay&&this.hideOverlay(),this.quill.setSelection(null),this.previousBodyUserSelect=document.body.style.userSelect,this.previousRootUserSelect=this.quill.root.style.userSelect,document.body.style.userSelect="none",this.quill.root.style.userSelect="none",this.overlay=document.createElement("div"),this.overlay.className=`${u.S[g.OVERLAY]}`,this.quill.container.appendChild(this.overlay),this.hideProxy=()=>this.activeEle&&this.hide(),this.updateOverlayPositionProxy=()=>this.scheduleOverlayMarginSync(),this.quill.root.addEventListener("input",this.hideProxy,!0),this.quill.root.addEventListener("scroll",this.updateOverlayPositionProxy,{passive:!0}),this.repositionElements()}hideOverlay(){this.overlay&&(this.overlayScrollAnimationFrame!==null&&(cancelAnimationFrame(this.overlayScrollAnimationFrame),this.overlayScrollAnimationFrame=null),this.pendingOverlayMarginTop=null,this.overlay.remove(),this.overlay=void 0,this.hideProxy&&this.quill.root.removeEventListener("input",this.hideProxy,!0),this.updateOverlayPositionProxy&&this.quill.root.removeEventListener("scroll",this.updateOverlayPositionProxy),this.hideProxy=null,this.updateOverlayPositionProxy=null,this.previousBodyUserSelect!==null&&(document.body.style.userSelect=this.previousBodyUserSelect,this.previousBodyUserSelect=null),this.previousRootUserSelect!==null&&(this.quill.root.style.userSelect=this.previousRootUserSelect,this.previousRootUserSelect=null))}repositionElements(){if(!this.overlay||!this.activeEle)return;const i=this.quill.container,t=this.activeEle.getBoundingClientRect(),e=i.getBoundingClientRect();Object.assign(this.overlay.style,{left:`${t.left-e.left-1+i.scrollLeft}px`,top:`${t.top-e.top+this.quill.root.scrollTop}px`,width:`${t.width}px`,height:`${t.height}px`,marginTop:-1*this.quill.root.scrollTop+"px"})}addBlotsSelectedClass(i){if(!i){this.selectedBlots=[];return}try{const t=s=>{var o;return["image","iframe","video"].includes((o=s.statics)==null?void 0:o.blotName)},e=this.quill.scroll.descendants(t,i.index,i.length);this.selectedBlots=e.filter(s=>!s.statics||!this.options.contentOptions?!1:this.options.contentOptions.some(o=>o.blotName===s.statics.blotName))}catch(t){console.warn("Error during blot selection:",t)}}hide(){this.hideOverlay(),this.modules.forEach(i=>i.onDestroy()),this.modules=[],this.activeEle=void 0,this.blot=void 0}scheduleOverlayMarginSync(){this.overlay&&(this.pendingOverlayMarginTop=-1*this.quill.root.scrollTop,this.overlayScrollAnimationFrame===null&&(this.overlayScrollAnimationFrame=requestAnimationFrame(()=>{this.overlayScrollAnimationFrame=null,!(!this.overlay||this.pendingOverlayMarginTop===null)&&(this.overlay.style.marginTop=`${this.pendingOverlayMarginTop}px`,this.pendingOverlayMarginTop=null)})))}}n(C,"Modules",{Base:y,DisplaySize:U,Toolbar:A,Resize:j,Keyboard:b});exports.default=C;
1
+ "use strict";var P=Object.defineProperty;var w=(h,i,t)=>i in h?P(h,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):h[i]=t;var n=(h,i,t)=>w(h,typeof i!="symbol"?i+"":i,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-Yp8TH9Pd.cjs"),g={OVERLAY:"ql-image-resizer-overlay",HANDLE:"ql-image-resizer-handle",DISPLAY:"ql-image-resizer-display",TOOLBAR:"ql-image-resizer-toolbar",TOOLBAR_BUTTON:"ql-image-resizer-toolbar-button"},d={BACKSPACE:8,DELETE:46,LEFT:37,UP:38,RIGHT:39,DOWN:40};function M(h){switch(h.key){case"Backspace":return d.BACKSPACE;case"Delete":return d.DELETE;case"ArrowLeft":return d.LEFT;case"ArrowUp":return d.UP;case"ArrowRight":return d.RIGHT;case"ArrowDown":return d.DOWN;default:return 0}}const q=["tl","tr","br","bl"],F=8;function N(h){var t;const i=new Uint32Array(h);if(typeof((t=globalThis.crypto)==null?void 0:t.getRandomValues)=="function")globalThis.crypto.getRandomValues(i);else{let e=Date.now();for(let s=0;s<h;s++)e=e*1103515245+12345&2147483647,i[s]=e}return Array.from(i,e=>e%62).join("")}const v=(h,i)=>{const t=h?"top":"bottom",e=i?"left":"right",s=h===i?"nwse-resize":"nesw-resize";return{[t]:"-5px",[e]:"-5px",cursor:s}},R={tl:v(!0,!0),tr:v(!0,!1),bl:v(!1,!0),br:v(!1,!1)},O=new Map,L=globalThis;function B(h){const i=O.get(h);if(i)return i;const t=u.ReactDOMServer.renderToString(u.jsxRuntimeExports.jsx(u.AIcon,{icon:h,size:"xs"}));return O.set(h,t),t}const k={modules:["DisplaySize","Toolbar","Resize","Keyboard"],embedTags:["VIDEO","IFRAME"],tools:["left","center","right","justify"],contentOptions:[{attribute:["width"],limit:{minWidth:100},blotName:"image"},{attribute:["width","height"],limit:{minWidth:200,ratio:.5625},blotName:"video"}]},z=u.Quill.import("formats/image");class E extends z{static get ATTRIBUTES(){return["alt","height","width","class","style","data-align"]}static formats(i){return this.ATTRIBUTES.reduce((t,e)=>(i.hasAttribute(e)&&(t[e]=i.getAttribute(e)??""),t),{})}format(i,t){this.constructor.ATTRIBUTES.includes(i)?t?this.domNode.setAttribute(i,t):this.domNode.removeAttribute(i):super.format(i,t)}}n(E,"blotName","image"),n(E,"tagName","img"),n(E,"scope",u.Scope.INLINE);function I(){L.__AEDITOR_IMAGE_BLOT_REGISTERED__||(u.Quill.register("formats/image",E,!0),L.__AEDITOR_IMAGE_BLOT_REGISTERED__=!0)}class y{constructor(i){n(this,"resizer");n(this,"quill");n(this,"overlay");n(this,"activeEle");n(this,"blot");n(this,"options");n(this,"requestUpdate");this.resizer=i,this.quill=i.quill,this.overlay=i.overlay,this.activeEle=i.activeEle,this.blot=i.blot,this.options=i.options,this.requestUpdate=()=>i.scheduleUpdate(!0)}onCreate(){}onDestroy(){}onUpdate(){}}class U extends y{constructor(){super(...arguments);n(this,"display")}onCreate(){var t;this.display=document.createElement("div"),this.display.className=u.S[g.DISPLAY],(t=this.overlay)==null||t.appendChild(this.display)}onUpdate(){if(!this.display||!this.activeEle)return;const[t,e]=[this.activeEle.offsetWidth,this.activeEle.offsetHeight];this.display.textContent=`${t} × ${e}`,this.positionDisplay(t,e)}positionDisplay(t,e){var p;if(!this.display)return;const s=this.display.getBoundingClientRect(),o=t>120&&e>30,l=((p=this.activeEle)==null?void 0:p.style.float)==="right";let r,a,c;o?(r="4px",a="4px",c="auto"):(a=`-${s.height+4}px`,l?(r="auto",c=`-${s.width+4}px`):(r=`-${s.width+4}px`,c="auto")),Object.assign(this.display.style,{right:r,bottom:a,left:c})}}class j extends y{constructor(){super(...arguments);n(this,"boxes",[]);n(this,"dragBox",null);n(this,"dragStartX",0);n(this,"dragStartY",0);n(this,"contentOption");n(this,"preDragSize",{width:0,height:0});n(this,"naturalSize",[0,0]);n(this,"handleDragProxy",null);n(this,"handleMouseupProxy",null);n(this,"dragAnimationFrame",null);n(this,"pendingDragEvent",null);n(this,"handleMousedown",t=>{t.button!==0||!this.blot||!this.activeEle||(t.preventDefault(),t.stopPropagation(),this.cancelDragFrame(),this.removeEventListeners(),this.dragBox=t.target,this.dragStartX=t.clientX,this.dragStartY=t.clientY,this.preDragSize={width:this.activeEle.offsetWidth,height:this.activeEle.offsetHeight},this.naturalSize=this.getNaturalSize(),this.setCursor(globalThis.getComputedStyle(this.dragBox).cursor),this.handleDragProxy=this.handleDrag,this.handleMouseupProxy=this.handleMouseup,document.addEventListener("mousemove",this.handleDragProxy,!0),document.addEventListener("mouseup",this.handleMouseupProxy,!0))});n(this,"handleMouseup",t=>{if(!this.activeEle||!this.blot||!this.contentOption)return;this.cancelDragFrame();const e=this.calcSize(t,this.contentOption.limit);Object.assign(this.activeEle,e),Object.assign(this.activeEle.style,{width:null,height:null}),this.setCursor(""),this.removeEventListeners()});n(this,"handleDrag",t=>{!this.activeEle||!this.blot||!this.contentOption||(t.preventDefault(),this.pendingDragEvent=t,this.dragAnimationFrame===null&&(this.dragAnimationFrame=requestAnimationFrame(()=>{this.dragAnimationFrame=null;const e=this.pendingDragEvent;this.pendingDragEvent=null,!(!e||!this.activeEle||!this.contentOption)&&(Object.assign(this.activeEle.style,this.calcSize(e,{...this.contentOption.limit,unit:!0})),this.requestUpdate())})))});n(this,"handleDoubleClick",t=>{if(!this.blot||!this.activeEle||!this.contentOption)return;t.stopPropagation();const[e,s]=this.naturalSize,o={};this.contentOption.attribute.includes("width")&&(o.width=e),this.contentOption.attribute.includes("height")&&(o.height=s);const l=this.applyConstraints(o,this.contentOption.limit);Object.assign(this.activeEle,l),this.requestUpdate()})}onCreate(){!this.blot||!this.options.contentOptions||(this.contentOption=this.options.contentOptions.find(t=>t.blotName===this.blot.statics.blotName),this.boxes=[],q.forEach(t=>this.addBox(t)))}onDestroy(){this.setCursor(""),this.cancelDragFrame(),this.removeEventListeners(),this.boxes.forEach(t=>{t.removeEventListener("mousedown",this.handleMousedown,!1),t.removeEventListener("dblclick",this.handleDoubleClick,!1)}),this.boxes=[]}addBox(t){var s;const e=document.createElement("div");e.className=`${u.S[g.HANDLE]} ${t}`,e.addEventListener("mousedown",this.handleMousedown,!1),e.addEventListener("dblclick",this.handleDoubleClick,!1),Object.assign(e.style,R[t]),(s=this.overlay)==null||s.appendChild(e),this.boxes.push(e)}removeEventListeners(){this.handleDragProxy&&(document.removeEventListener("mousemove",this.handleDragProxy,!0),this.handleDragProxy=null),this.handleMouseupProxy&&(document.removeEventListener("mouseup",this.handleMouseupProxy,!0),this.handleMouseupProxy=null)}calcSize(t,e={}){var a;if(!this.dragBox||!this.activeEle)return{};const s=t.clientX-this.dragStartX,o=t.clientY-this.dragStartY,l=this.dragBox===this.boxes[0]||this.dragBox===this.boxes[3]?-1:1,r={};return(a=this.contentOption)!=null&&a.attribute?this.contentOption.attribute.forEach(c=>r[c]=this.preDragSize[c]):r.width=this.preDragSize.width,r.width&&(r.width=Math.round(this.preDragSize.width+s*l)),r.height&&(r.height=Math.round(this.preDragSize.height+o*l)),this.applyConstraints(r,e)}constrainDimensionsWithRatio(t,e){const s=e.ratio;let o=this.applyLimit(t,e.minWidth,e.maxWidth),l=o*s;const r=this.applyLimit(l,e.minHeight,e.maxHeight);return r!==l&&(l=r,o=l/s),{rw:o,rh:l}}applyConstraints(t,e={}){const s=typeof t.width=="string"?Number.parseInt(t.width,10):t.width||0,o=typeof t.height=="string"?Number.parseInt(t.height,10):t.height||0;let l=s,r=o;e.ratio?{rw:l,rh:r}=this.constrainDimensionsWithRatio(l,e):(s&&(l=this.applyLimit(l,e.minWidth,e.maxWidth)),o&&(r=this.applyLimit(r,e.minHeight,e.maxHeight)));const a={};return t.width!==void 0&&(a.width=e.unit?`${l}px`:l),t.height!==void 0&&(a.height=e.unit?`${r}px`:r),a}applyLimit(t,e,s){let o=t;return e!==void 0&&(o=Math.max(e,o)),s!==void 0&&(o=Math.min(s,o)),o}getNaturalSize(){if(!this.activeEle)return[0,0];const t=this.activeEle.dataset.size;if(!t){const e=this.activeEle,s=[e.offsetWidth,e.offsetHeight];return e.dataset.size=s.join(","),s}return t.split(",").map(Number)}setCursor(t){[document.body,this.activeEle].forEach(e=>e&&(e.style.cursor=t))}cancelDragFrame(){this.dragAnimationFrame!==null&&(cancelAnimationFrame(this.dragAnimationFrame),this.dragAnimationFrame=null),this.pendingDragEvent=null}}const m=class m extends y{constructor(){super(...arguments);n(this,"keyboardProxy",t=>this.keyboardHandle(t))}static injectInit(t){var s;if(m.injectedQuills.has(t))return;const e=(s=t.keyboard)==null?void 0:s.bindings;e&&([m.keys.LEFT,m.keys.RIGHT].forEach(o=>(e[o]||[]).unshift(m.makeArrowHandler(o))),m.injectedQuills.add(t))}static makeArrowHandler(t){const e=t===m.keys.LEFT;return{key:t,shiftKey:!1,altKey:null,[e?"prefix":"suffix"]:/^$/,handler(s){const o=this.quill;if(!o.resizer)return!0;let l=s.index;const r=t===m.keys.RIGHT,[a]=o.getLine(l+(e?-1:0));if(!a)return!0;if(o.resizer.judgeShow(a))return!1;const c=o.getIndex(a);if(r&&c+a.length()-1===l)return!0;r&&(l+=s.length+1);const[p]=o.getLeaf(l);if(!p)return!0;const x=p.offset(p.parent),D=p.constructor&&"scope"in p.constructor&&p.constructor.scope===u.Scope.BLOCK_BLOT;if(e&&(D&&l===x||l===0||l===c))return!0;let S=p;if(e&&x===0){const[T]=o.getLeaf(l-1);T&&(S=T)}return!S||!o.resizer.judgeShow(S)}}}onCreate(){document.addEventListener("keydown",this.keyboardProxy,!0)}onDestroy(){document.removeEventListener("keydown",this.keyboardProxy,!0)}keyboardHandle(t){if(t.defaultPrevented||t.shiftKey||t.ctrlKey||t.altKey||!this.activeEle||!this.blot)return;const e=M(t);let s=this.blot.offset(this.quill.scroll),o=null,l=!1;e===d.BACKSPACE||e===d.DELETE?(this.handleDelete(),l=!0):e>=d.LEFT&&e<=d.DOWN&&([s,o]=this.handleArrowKeys(e,s),l=!0),l&&(t.stopPropagation(),t.preventDefault()),!(o&&this.resizer.judgeShow(o,o.domNode))&&(this.quill.setSelection(s),this.resizer.hide())}handleDelete(){if(!this.blot)return;const t=this.blot.length();this.blot.deleteAt(0,t),this.blot=void 0,this.activeEle=void 0,this.resizer.hide()}handleArrowKeys(t,e){let s=null;return t===d.RIGHT?e+=this.blot.length()||1:t===d.UP?(e=this.getOtherLineIndex(-1),s=this.quill.getLeaf(e)[0]):t===d.DOWN&&(e=this.getOtherLineIndex(1),s=this.quill.getLeaf(e)[0]),[e,s]}getOtherLineIndex(t){if(!this.blot)return 0;const e=this.blot.offset(this.quill.scroll),[s]=this.quill.getLine(e);if(!s)return e;const o=this.blot.offset(s)+1,l=t>0?s.next:s.prev;if(!l)return e;let r=l.length();return l.statics.blotName==="block"&&r--,l.offset(this.quill.scroll)+Math.min(r,o)}};n(m,"keys",d),n(m,"injectedQuills",new WeakSet);let b=m;const f=class f extends y{constructor(t){super(t);n(this,"toolbar");n(this,"blot");n(this,"tools",{});n(this,"toolbarClickProxy",t=>this.handleToolbarClick(t));this.blot=t.blot}createStyleTool(t,e){const s={left:{float:"left"},right:{float:"right"},center:{display:"block",margin:"0 auto",float:"none"},justify:{display:"block",float:"none",margin:"0",width:"100%"}};return{icon:t,apply:o=>{this.clearAlignmentStyles(o);const l=s[e];Object.assign(o.style,l),o.dataset.align=e},isApplied:o=>{const l=o.style;switch(e){case"center":return l.float==="none";case"justify":return l.display==="block"&&l.width==="100%";case"left":case"right":return l.float===e;default:return!1}}}}clearAlignmentStyles(t){const e=t.dataset.align;t.style.removeProperty("display"),t.style.removeProperty("float"),t.style.removeProperty("margin"),e==="justify"&&t.style.removeProperty("width"),delete t.dataset.align}onCreate(){var t;this.toolbar=document.createElement("div"),this.toolbar.className=u.S[g.TOOLBAR],this.toolbar.addEventListener("click",this.toolbarClickProxy),(t=this.overlay)==null||t.appendChild(this.toolbar),this.initializeTools(),this._addToolbarButtons()}onDestroy(){var t;(t=this.toolbar)==null||t.removeEventListener("click",this.toolbarClickProxy),this.toolbar=void 0}initializeTools(){Object.keys(f.Tools).forEach(t=>{const e=t;this.tools[e]=this.createStyleTool(f.Tools[e].icon,e)})}_addToolbarButtons(){!this.toolbar||!this.activeEle||this.options.tools.forEach(t=>{const e=this.tools[t];if(!e)return;const s=document.createElement("button");s.type="button",s.className=u.S[g.TOOLBAR_BUTTON],s.innerHTML=B(e.icon),s.dataset.tool=t,e.isApplied&&this.activeEle&&e.isApplied.call(this,this.activeEle)&&(s.style.backgroundColor="var(--AEditor_Addon_Secondary_color)"),this.toolbar.appendChild(s)})}handleToolbarClick(t){var r,a;if(!this.activeEle||!this.blot||!this.toolbar)return;const e=(r=t.target)==null?void 0:r.closest("button[data-tool]");if(!e||!this.toolbar.contains(e))return;const s=e.dataset.tool;if(!s)return;const o=this.tools[s];if(!o||(t.stopPropagation(),o.handler&&o.handler.call(this,t,e,this.activeEle)!==!0))return;const l=o.isApplied?o.isApplied.call(this,this.activeEle):!1;Array.from(this.toolbar.querySelectorAll("button")).forEach(c=>c.style.backgroundColor=""),l?this.clearAlignmentStyles(this.activeEle):(e.style.backgroundColor="var(--AEditor_Addon_Secondary_color)",(a=o.apply)==null||a.call(o,this.activeEle)),this.requestUpdate()}};n(f,"Tools",{left:{icon:"AlignLeft"},center:{icon:"AlignCenter"},right:{icon:"AlignRight"},justify:{icon:"AlignJustify"}});let A=f;class C{constructor(i,t={}){n(this,"isDestroyed",!1);n(this,"quill");n(this,"options");n(this,"moduleClasses");n(this,"modules",[]);n(this,"blot");n(this,"selectedBlots",[]);n(this,"embedClassName","");n(this,"activeEle");n(this,"overlay");n(this,"updateFromModule",!1);n(this,"hideProxy",null);n(this,"updateOverlayPositionProxy",null);n(this,"embedStyleElement",null);n(this,"updateAnimationFrame",null);n(this,"overlayScrollAnimationFrame",null);n(this,"pendingOverlayMarginTop",null);n(this,"scheduledFromModule",!1);n(this,"previousBodyUserSelect",null);n(this,"previousRootUserSelect",null);n(this,"handleClickProxy",i=>this.handleClick(i));n(this,"handleChangeProxy",(i,t,e)=>this.handleChange(i,t,e));n(this,"handleSelectionChangeProxy",i=>this.addBlotsSelectedClass(i));var s;I(),i.resizer=this,this.isDestroyed=!1,this.quill=i;const e=t.modules?[...t.modules]:null;this.options={...k,...t},e&&(this.options.modules=e),this.moduleClasses=this.options.modules,this.quill.root.addEventListener("mousedown",this.handleClickProxy,!1),this.quill.on("text-change",this.handleChangeProxy),this.quill.container.style.position=this.quill.container.style.position||"relative",this.quill.on("selection-change",this.handleSelectionChangeProxy),b.injectInit(this.quill),(s=this.options.embedTags)!=null&&s.length&&this.initializeEmbed()}destroy(){var i;this.isDestroyed||(this.isDestroyed=!0,this.updateAnimationFrame!==null&&(cancelAnimationFrame(this.updateAnimationFrame),this.updateAnimationFrame=null),this.overlayScrollAnimationFrame!==null&&(cancelAnimationFrame(this.overlayScrollAnimationFrame),this.overlayScrollAnimationFrame=null),this.pendingOverlayMarginTop=null,this.hide(),this.quill.root.removeEventListener("mousedown",this.handleClickProxy,!1),this.quill.off("text-change",this.handleChangeProxy),this.quill.off("selection-change",this.handleSelectionChangeProxy),(i=this.embedStyleElement)==null||i.remove(),this.embedStyleElement=null,this.embedClassName&&this.quill.root.classList.remove(this.embedClassName))}initializeModules(){this.modules.forEach(i=>i.onDestroy()),this.modules=[],this.modules=this.moduleClasses.map(i=>new(this.constructor.Modules[i]||i)(this)),this.modules.forEach(i=>i.onCreate()),this.repositionElements(),this.modules.forEach(i=>i.onUpdate())}initializeEmbed(){if(!this.options.embedTags.length)return;this.embedClassName=`ql-${N(F)}`;const i=[""].concat(this.options.embedTags).join(`, .${this.embedClassName} `).slice(2)+"{pointer-events: none;}",t=document.createElement("style");t.textContent=i,this.embedStyleElement=t,this.quill.container.appendChild(t),this.quill.root.classList.add(this.embedClassName)}scheduleUpdate(i){this.scheduledFromModule=this.scheduledFromModule||!!i,this.updateAnimationFrame===null&&(this.updateAnimationFrame=requestAnimationFrame(()=>{this.updateAnimationFrame=null;const t=this.scheduledFromModule;this.scheduledFromModule=!1,this.onUpdate(t)}))}onUpdate(i){this.updateFromModule=!!i,this.repositionElements(),this.modules.forEach(t=>t.onUpdate())}resolveMediaTarget(i){if(!(i instanceof HTMLElement))return null;const t=["img","iframe","video",".ql-video"].join(", ");if(i.matches(t))return i;const e=i.closest(t);return e||null}handleClick(i){if(this.overlay&&(i.target===this.overlay||this.overlay.contains(i.target)))return;let t=i.target;if(t=this.getEventTarget(i,t),t!=null&&t.tagName){const e=this.quill.scroll.find(t);if(e&&this.judgeShow(e,t)){i.preventDefault();return}}this.activeEle&&this.hide()}getEventTarget(i,t){var l;const e=(l=this.options.embedTags)==null?void 0:l.join(),s=this.resolveMediaTarget(t);if(s)return s;if(typeof document.elementsFromPoint=="function"){const r=document.elementsFromPoint(i.clientX,i.clientY).map(a=>this.resolveMediaTarget(a)).find(a=>!!a&&this.quill.root.contains(a));if(r)return r}if(!e)return t;const o=this.quill.root;if(t===o||t.querySelectorAll(e).length){o.classList.remove(this.embedClassName);const r=document.elementFromPoint(i.clientX,i.clientY);o.classList.add(this.embedClassName);const a=this.resolveMediaTarget(r);if(a&&o.contains(a))return a;r&&(t=r)}return t}judgeShow(i,t){if(!i||!this.options.contentOptions)return!1;!t&&i.domNode&&(t=i.domNode);const e=this.options.contentOptions.find(o=>o.blotName===i.statics.blotName);if(!e)return!1;if(this.activeEle===t)return!0;const s=e.limit||{};return!s.minWidth||s.minWidth&&t.offsetWidth>=s.minWidth?(this.activeEle&&this.hide(),this.activeEle=t,this.blot=i,this.showOverlay(),this.initializeModules(),!0):!1}handleChange(i,t,e){if(this.updateFromModule){this.updateFromModule=!1;return}e!=="user"||!this.overlay||!this.activeEle||this.onUpdate()}showOverlay(){this.overlay&&this.hideOverlay(),this.quill.setSelection(null),this.previousBodyUserSelect=document.body.style.userSelect,this.previousRootUserSelect=this.quill.root.style.userSelect,document.body.style.userSelect="none",this.quill.root.style.userSelect="none",this.overlay=document.createElement("div"),this.overlay.className=`${u.S[g.OVERLAY]}`,this.quill.container.appendChild(this.overlay),this.hideProxy=()=>this.activeEle&&this.hide(),this.updateOverlayPositionProxy=()=>this.scheduleOverlayMarginSync(),this.quill.root.addEventListener("input",this.hideProxy,!0),this.quill.root.addEventListener("scroll",this.updateOverlayPositionProxy,{passive:!0}),this.repositionElements()}hideOverlay(){this.overlay&&(this.overlayScrollAnimationFrame!==null&&(cancelAnimationFrame(this.overlayScrollAnimationFrame),this.overlayScrollAnimationFrame=null),this.pendingOverlayMarginTop=null,this.overlay.remove(),this.overlay=void 0,this.hideProxy&&this.quill.root.removeEventListener("input",this.hideProxy,!0),this.updateOverlayPositionProxy&&this.quill.root.removeEventListener("scroll",this.updateOverlayPositionProxy),this.hideProxy=null,this.updateOverlayPositionProxy=null,this.previousBodyUserSelect!==null&&(document.body.style.userSelect=this.previousBodyUserSelect,this.previousBodyUserSelect=null),this.previousRootUserSelect!==null&&(this.quill.root.style.userSelect=this.previousRootUserSelect,this.previousRootUserSelect=null))}repositionElements(){if(!this.overlay||!this.activeEle)return;const i=this.quill.container,t=this.activeEle.getBoundingClientRect(),e=i.getBoundingClientRect();Object.assign(this.overlay.style,{left:`${t.left-e.left-1+i.scrollLeft}px`,top:`${t.top-e.top+this.quill.root.scrollTop}px`,width:`${t.width}px`,height:`${t.height}px`,marginTop:-1*this.quill.root.scrollTop+"px"})}addBlotsSelectedClass(i){if(!i){this.selectedBlots=[];return}try{const t=s=>{var o;return["image","iframe","video"].includes((o=s.statics)==null?void 0:o.blotName)},e=this.quill.scroll.descendants(t,i.index,i.length);this.selectedBlots=e.filter(s=>!s.statics||!this.options.contentOptions?!1:this.options.contentOptions.some(o=>o.blotName===s.statics.blotName))}catch(t){console.warn("Error during blot selection:",t)}}hide(){this.hideOverlay(),this.modules.forEach(i=>i.onDestroy()),this.modules=[],this.activeEle=void 0,this.blot=void 0}scheduleOverlayMarginSync(){this.overlay&&(this.pendingOverlayMarginTop=-1*this.quill.root.scrollTop,this.overlayScrollAnimationFrame===null&&(this.overlayScrollAnimationFrame=requestAnimationFrame(()=>{this.overlayScrollAnimationFrame=null,!(!this.overlay||this.pendingOverlayMarginTop===null)&&(this.overlay.style.marginTop=`${this.pendingOverlayMarginTop}px`,this.pendingOverlayMarginTop=null)})))}}n(C,"Modules",{Base:y,DisplaySize:U,Toolbar:A,Resize:j,Keyboard:b});exports.default=C;
@@ -1,7 +1,7 @@
1
1
  var w = Object.defineProperty;
2
2
  var M = (h, i, t) => i in h ? w(h, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[i] = t;
3
3
  var n = (h, i, t) => M(h, typeof i != "symbol" ? i + "" : i, t);
4
- import { S as f, c as C, Q as D, R as q, j as F, A as N } from "./index-BU5UfEjR.js";
4
+ import { S as f, c as C, Q as D, R as q, j as F, A as N } from "./index-CFWOoORH.js";
5
5
  const g = {
6
6
  OVERLAY: "ql-image-resizer-overlay",
7
7
  HANDLE: "ql-image-resizer-handle",
@@ -0,0 +1,6 @@
1
+ "use strict";var v=Object.defineProperty;var W=(n,l,e)=>l in n?v(n,l,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[l]=e;var m=(n,l,e)=>W(n,typeof l!="symbol"?l+"":l,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index-Yp8TH9Pd.cjs"),a=require("./index-DWkviCYe.cjs"),D=require("./TableUpLogical-BFtHFpFr.cjs"),w=require("./Video-DOjUHFhE.cjs"),T=u.Quill.import("delta"),F=u.Quill.import("modules/clipboard"),O=/<table[\s>]/i,A=new Set(["","transparent","rgba(0,0,0,0)","rgba(0, 0, 0, 0)"]),N="data-aeditor-empty-row";function _(n){if(typeof n=="number"&&Number.isFinite(n)){const l=Math.floor(n);return l>0?l:1}if(typeof n=="string"){const l=Number.parseInt(n.trim(),10);if(Number.isFinite(l)&&l>0)return l}return 1}function x(n){return w.isVideoUrl(n)?new T().insert({video:w.normalizeVideoUrl(n)}).insert(`
2
+ `):null}const L=globalThis;function P(){if(L.__AEDITOR_TABLE_CLIPBOARD_STYLES_PATCHED__)return;const n=new Set([...a.TableCellFormat.allowStyle,...u.TABLE_CELL_ALLOWED_STYLE_PREFIXES]);a.TableCellFormat.allowStyle=n,a.TableCellInnerFormat.allowStyle=new Set([...a.TableCellInnerFormat.allowStyle,...u.TABLE_CELL_ALLOWED_STYLE_PREFIXES]),L.__AEDITOR_TABLE_CLIPBOARD_STYLES_PATCHED__=!0}function H(n){let l=Number.parseFloat(n.getAttribute("width")||"");if(Number.isNaN(l)){const e=n.style.width;l=e?Number.parseFloat(e):n.offsetWidth}return l||a.tableUpSize.colDefaultWidth}function B(n,l){const e=Number.parseFloat(l.getComputedStyle(n).width);return Number.isFinite(e)&&e>0?e:H(n)}function R(n,l,e=H){const t=new Array(l).fill(a.tableUpSize.colDefaultWidth),o=Array.from(n.querySelectorAll("tr")),r=[];for(const i of o){const d=Array.from(i.querySelectorAll("td, th"));let s=E(0,M(r));for(const c of d){const h=Math.max(c.colSpan||1,1);if(s=E(s,r),s>=l)break;k(r,s,h,c.rowSpan||1);const f=e(c)/h;for(let b=0;b<h&&s+b<l;b+=1)t[s+b]=f||t[s+b];s+=h}}return t}function S(n){const l=Math.round(n*100)/100;return Number.isFinite(l)&&l>0?l:a.tableUpSize.colDefaultWidth}function q(n,l){const e=n==null?void 0:n.width;let t;if(typeof e=="number")t=e;else if(typeof e=="string")t=Number.parseFloat(e);else return S(l);return Number.isFinite(t)&&t>0?S(t):S(l)}function U(n,l){return typeof(n==null?void 0:n.full)=="boolean"?n.full:Object.hasOwn(l.dataset,"full")||l.querySelector("col[data-full], colgroup[data-full]")!==null}function j(n){if(!n)return;const l=u.parseInlineStyleText(n)["background-color"];if(!(!l||A.has(l)))return l}function Y(n,l,e){let t=n;for(;t;){const o=t===n?e.getComputedStyle(t).getPropertyValue("background-color").trim():e.getComputedStyle(t).backgroundColor.trim();if(o&&!A.has(o))return o;if(t===l)break;t=t.parentElement}}function M(n){for(let l=0;l<n.length;l+=1)n[l]>0&&(n[l]-=1);return n}function E(n,l){let e=n;for(;l[e]>0;)e+=1;return e}function k(n,l,e,t){if(!(t<=1))for(let o=0;o<e;o+=1)n[l+o]=Math.max(n[l+o]||0,t)}class z extends F{constructor(e,t){P();super(e,t);m(this,"matchCaptionHandler",(e,t)=>this.matchCaption(e,t));m(this,"matchColHandler",(e,t)=>this.matchCol(e,t));m(this,"matchColgroupHandler",(e,t)=>this.matchColgroup(e,t));m(this,"matchTableHandler",(e,t)=>this.matchTable(e,t));m(this,"matchTbodyHandler",(e,t)=>this.matchTbody(e,t));m(this,"matchTdAttributorHandler",(e,t)=>this.matchTdAttributor(e,t));m(this,"matchTdHandler",(e,t)=>this.matchTd(e,t));m(this,"matchTheadHandler",(e,t)=>this.matchThead(e,t));m(this,"matchTrHandler",(e,t)=>this.matchTr(e,t));m(this,"matchTfootHandler",(e,t)=>this.matchTfoot(e,t));m(this,"matchYouTubeLinkHandler",(e,t)=>this.matchYouTubeLink(e,t));m(this,"tableId",a.randomId());m(this,"rowId",a.randomId());m(this,"colIds",[]);m(this,"rowspanCount",[]);m(this,"cellCount",0);m(this,"colCount",0);this.quill=e,this.addMatcher("a",this.matchYouTubeLinkHandler),this.addMatcher("table",this.matchTableHandler),this.addMatcher("thead",this.matchTheadHandler),this.addMatcher("tbody",this.matchTbodyHandler),this.addMatcher("tfoot",this.matchTfootHandler),this.addMatcher("colgroup",this.matchColgroupHandler),this.addMatcher("col",this.matchColHandler),this.addMatcher("tr",this.matchTrHandler),this.addMatcher("td",this.matchTdHandler),this.addMatcher("th",this.matchTdHandler),this.addMatcher("caption",this.matchCaptionHandler),this.addMatcher(Node.ELEMENT_NODE,this.matchTdAttributorHandler)}resetTableState(){this.tableId=a.randomId(),this.rowId=a.randomId(),this.colIds=[],this.rowspanCount=[],this.cellCount=0,this.colCount=0}getStyleBackgroundColor(e,t){var r;const o=e.style.backgroundColor;if(o)for(const i of t.ops){if(!((r=i.attributes)!=null&&r[a.blotName.tableCellInner]))continue;const{style:d,...s}=i.attributes[a.blotName.tableCellInner];if(j(d))continue;const c=u.mergeInlineStyles(d,`background-color:${o}`);i.attributes[a.blotName.tableCellInner]={...s,style:c}}}matchYouTubeLink(e,t){const r=e.getAttribute("href")||"";return x(r)??t}readPreprocessedColumnWidths(e){const t=e.getAttribute(u.TABLE_COLUMN_WIDTHS_DATA_ATTRIBUTE);if(!t)return null;const o=t.split(",").map(r=>Number.parseFloat(r)).filter(r=>Number.isFinite(r)&&r>0).map(r=>S(r));return o.length?o:null}matchTable(e,t){if(t.ops.length===0)return t;const o=[],r=[];let i=-1,d=!1;for(const f of t.ops){const{attributes:b,insert:C}=f;if(!u.lodashExports.isObject(C)&&(!b||!b[a.blotName.tableCellInner]&&!b[a.blotName.tableCaption]))continue;const{table:g,[a.blotName.tableCell]:I,...p}=b||{};if(u.lodashExports.isObject(C)&&C[a.blotName.tableCol]){r.push({insert:C});continue}o.push({attributes:p,insert:C}),(p!=null&&p[a.blotName.tableCellInner]||p!=null&&p[a.blotName.tableCaption])&&(d=!0),!(p!=null&&p[a.blotName.tableCellInner])&&!(p!=null&&p[a.blotName.tableCaption])&&u.lodashExports.isString(C)&&C.trim().length>0&&(i=o.length-1)}if(!d)return this.resetTableState(),new T;const s=e,h=(this.readPreprocessedColumnWidths(s)??R(s,this.colIds.length)).map((f,b)=>{var p;const C=(p=r[b])==null?void 0:p.insert,g=u.lodashExports.isObject(C)?C[a.blotName.tableCol]:void 0,I=u.lodashExports.isObject(g)?g:void 0;return{insert:{[a.blotName.tableCol]:{...I,tableId:this.tableId,colId:this.colIds[b],width:q(I,f),full:U(I,s)}}}});o.splice(i+1,0,...h);const y=new T(o);return this.getStyleBackgroundColor(e,y),this.resetTableState(),y}createEmptyRowIdsForPlainInsert(e){let t=0;e&&(t=u.lodashExports.isString(e)?e.split(`
3
+ `).length-1:1);const o=[];for(let r=0;r<t;r+=1)o.push(a.randomId());return o}mergeEmptyRowsIntoCellValue(e,t){const o=_(e.rowspan),r=Math.max(o-1,0);if(t.length===0||r===0)return;const i=t.slice(0,r);e.emptyRow??(e.emptyRow=[]),i.length>e.emptyRow.length&&e.emptyRow.push(...i.slice(e.emptyRow.length))}matchTbody(e,t){var r,i;this.getStyleBackgroundColor(e,t);let o=[];for(let d=t.ops.length-1;d>=0;d-=1){const s=t.ops[d];if(!((r=s.attributes)!=null&&r[a.blotName.tableCellInner])){o=(i=s.attributes)!=null&&i[N]?this.createEmptyRowIdsForPlainInsert(s.insert):[];continue}const c=s.attributes[a.blotName.tableCellInner];if(_(c.rowspan)<=1){o=[];continue}this.mergeEmptyRowsIntoCellValue(c,o)}return this.rowspanCount=[],t}matchThead(e,t){const o=this.matchTbody(e,t);return this.applySectionWrapTag(o,"thead"),o}matchTfoot(e,t){const o=this.matchTbody(e,t);return this.applySectionWrapTag(o,"tfoot"),o}applySectionWrapTag(e,t){var o;for(const r of e.ops)(o=r.attributes)!=null&&o[a.blotName.tableCellInner]&&(r.attributes[a.blotName.tableCellInner].wrapTag=t)}matchColgroup(e,t){const o=t.ops.filter(r=>u.lodashExports.isObject(r.insert)&&r.insert[a.blotName.tableCol]);return new T(o)}matchCol(e,t){let o=Number.parseInt(e.getAttribute("span")||"1",10);(Number.isNaN(o)||o<1)&&(o=1);const r=new T;for(let i=0;i<o;i+=1)this.colIds[this.colCount]=a.randomId(),r.insert({[a.blotName.tableCol]:Object.assign(a.TableColFormat.value(e),{tableId:this.tableId,colId:this.colIds[this.colCount]})}),this.colCount+=1;return r}matchTr(e,t){return this.rowId=a.randomId(),this.cellCount=E(0,M(this.rowspanCount)),this.getStyleBackgroundColor(e,t),t.ops.length===0?new T([{attributes:{[N]:!0},insert:`
4
+ `}]):t}matchTd(e,t){const o=e,r=a.TableCellFormat.formats(o),i=Math.max(r.colspan||1,1);this.cellCount=E(this.cellCount,this.rowspanCount),this.ensureColumnSlots(this.cellCount+i),k(this.rowspanCount,this.cellCount,i,r.rowspan||1);const d=this.colIds[this.cellCount];this.cellCount+=i;const s=Object.assign(r,{tableId:this.tableId,rowId:this.rowId,colId:d});this.handleBorderNoneStyles(o,s);const c=t.ops.map(y=>{const{attributes:f={},...b}=y,{[a.blotName.tableCell]:C,...g}=f;return{...b,attributes:{...g,[a.blotName.tableCellInner]:s}}}),h=c.at(-1);return(!c.length||!u.lodashExports.isString(h==null?void 0:h.insert)||!h.insert.endsWith(`
5
+ `))&&c.push({insert:`
6
+ `,attributes:{[a.blotName.tableCellInner]:s}}),new T(c)}ensureColumnSlots(e){for(let t=0;t<e;t+=1)this.colIds[t]||(this.colIds[t]=a.randomId()),typeof this.rowspanCount[t]!="number"&&(this.rowspanCount[t]=0)}handleBorderNoneStyles(e,t){if(!t.style)return;const o=["border","border-top-style","border-right-style","border-bottom-style","border-left-style"];let r=t.style;o.filter(i=>e.style.getPropertyValue(i)==="none").forEach(i=>{r=r.replaceAll(new RegExp(String.raw`${i}\s*:\s*none;?`,"gi"),"")}),t.style=u.mergeInlineStyles(r)}matchTdAttributor(e,t){const o=e;if(o.tagName.toLowerCase()!=="td"&&o.tagName.toLowerCase()!=="th")return t;const r=[];for(const i of t.ops){const{attributes:d,...s}=i,c=d==null?void 0:d[a.blotName.tableCellInner];if(d&&(c!=null&&c.style)){const{background:h,...y}=d,f=document.createElement("div");f.style.background=h;const b=document.createElement("div");if(b.style.cssText=c.style,f.style.background===b.style.backgroundColor){r.push({...s,attributes:{...y}});continue}}r.push(i)}return new T(r)}convert({html:e,text:t},o={}){const r=(t==null?void 0:t.trim())??"",i=!e&&r?x(r):null;if(i)return i;if(e&&O.test(e)){const s=e;try{const c=new DOMParser().parseFromString(s,"text/html");this.preprocessTableHtml(c),e=c.body.innerHTML}catch(c){console.warn("Failed to preprocess pasted table HTML.",c),e=s}}const d=super.convert({html:e,text:t},o);if(o[a.blotName.tableCellInner])for(const s of d.ops){if(u.lodashExports.isObject(s.insert)&&s.insert[a.blotName.tableCol]){s.insert="";continue}s.attributes??(s.attributes={}),s.attributes[a.blotName.tableCellInner]=o[a.blotName.tableCellInner]}return d}matchCaption(e,t){for(const o of t.ops){const r=o.attributes;r!=null&&r[a.blotName.tableCaption]&&(r[a.blotName.tableCaption].tableId=this.tableId,o.attributes=r)}return t}preprocessTableHtml(e){const t=Array.from(e.querySelectorAll("table"));t.length&&(this.inlineComputedTableStyles(e,t),this.normalizeTableMarkup(e))}inlineComputedTableStyles(e,t){const o=this.quill.root.ownerDocument,r=o.defaultView;if(!r)return;const i=o.createElement("div");i.style.cssText="position:fixed;left:-9999px;top:0;opacity:0;pointer-events:none;";const d=o.createElement("div");d.innerHTML="<table><tbody><tr><td></td></tr></tbody></table>";const s=o.createElement("div");Array.from(e.head.querySelectorAll("style")).forEach(c=>{s.appendChild(o.importNode(c,!0))}),Array.from(e.body.childNodes).forEach(c=>s.appendChild(o.importNode(c,!0))),i.appendChild(d),i.appendChild(s),o.body.appendChild(i);try{const c=d.querySelector("td");if(!c)return;const h={cell:r.getComputedStyle(c)},y=Array.from(s.querySelectorAll("table"));t.forEach((f,b)=>{const C=y[b];C&&this.inlineComputedTableStylesFromRendered(f,C,h,r)})}finally{i.remove()}}inlineComputedTableStylesFromRendered(e,t,o,r){const i=D.resolveColumnCount(t);if(i>0){const c=R(t,i,h=>B(h,r)).map(S);e.setAttribute(u.TABLE_COLUMN_WIDTHS_DATA_ATTRIBUTE,c.join(","))}const d=Array.from(e.querySelectorAll("td, th")),s=Array.from(t.querySelectorAll("td, th"));d.forEach((c,h)=>{const y=s[h];if(!y)return;const f=this.buildComputedCellStyle(c,y,o,r);f?c.setAttribute("style",f):c.removeAttribute("style"),c.removeAttribute("width"),c.removeAttribute("class")})}buildComputedCellStyle(e,t,o,r){const i=e.parentElement,d=t.closest("table"),s=u.readComputedStyleMap(r.getComputedStyle(t),u.TABLE_CELL_COMPUTED_STYLE_PROPERTIES,o.cell,(h,y)=>!(h==="background-color"&&y==="transparent"));if(!s["background-color"]&&d){const h=Y(t,d,r);h&&!A.has(h)&&(s["background-color"]=h)}const c=this.resolveExplicitHeightStyle(e,i);return u.mergeInlineStyles(u.styleMapToText(s),c)}resolveExplicitHeightStyle(...e){const t=e.filter(o=>!!o).flatMap(o=>{const r=[],i=o.getAttribute("height");i&&r.push(`height:${i}`);const d=o.getAttribute("style")||"",s=new RegExp(/height\s*:[^;]+/i).exec(d);return s&&r.push(s[0]),r});if(t.length)return u.mergeInlineStyles(...t)}normalizeTableMarkup(e){e.querySelectorAll("style").forEach(t=>t.remove()),e.querySelectorAll("table, caption, colgroup, col, thead, tbody, tfoot, tr, td, th").forEach(t=>{const o=u.mergeInlineStyles(t.getAttribute("style"));o?t.setAttribute("style",o):t.removeAttribute("style"),t.removeAttribute("class")})}}exports.TableClipboard=z;