ados-rcm 1.1.770 → 1.1.771
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +2 -11
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -477,7 +477,7 @@ received: ${n.quality}
|
|
|
477
477
|
received: ${n.imageType}
|
|
478
478
|
-> using default image/jpeg`),n.imageType="image/jpeg")}function Mz(n,e){n.keepImageTypes??(n.keepImageTypes=[]),n.keepImageTypes&&!Array.isArray(n.keepImageTypes)&&(e.warn(`quill.imageCompressor: [config error] 'keepImageTypes' is required to be a "array", received: ${n.keepImageTypes} -> using default []`),n.keepImageTypes=[]),n.ignoreImageTypes??(n.ignoreImageTypes=[]),n.ignoreImageTypes&&!Array.isArray(n.ignoreImageTypes)&&(e.warn(`quill.imageCompressor: [config error] 'ignoreImageTypes' is required to be a "array", received: ${n.ignoreImageTypes} -> using default []`),n.ignoreImageTypes=[])}function Lz(n,e){n.handleOnPaste&&typeof n.handleOnPaste!="boolean"&&typeof n.handleOnPaste!="function"&&(e.warn(`quill.imageCompressor: [config error] 'handlePaste' is required to be a "boolean" or a "function", received: ${n.ignoreImageTypes} -> using default true`),n.handleOnPaste=!0),n.insertIntoEditor&&typeof n.insertIntoEditor!="function"&&(e.warn(`quill.imageCompressor: [config error] 'insertIntoEditor' is required to be a "function", received: ${n.insertIntoEditor} -> using default undefined`),n.insertIntoEditor=void 0)}function Dw(n){return!!/^image\/(gif|jpe?g|a?png|svg|webp|bmp)/i.exec(n)}class Oz{constructor(e,t,r,i){Te(this,"localDrag",!1);this.quill=e,this.onNewDataUrl=t,this.logger=r,this.handleOnPaste=i,this.quill.root.addEventListener("dragstart",o=>this.handleDragStart(o),!1),this.quill.root.addEventListener("dragend",o=>this.handleDragEnd(o),!1),this.quill.root.addEventListener("drop",o=>this.handleDrop(o),!0),this.handleOnPaste!==!1&&this.quill.root.addEventListener("paste",o=>this.handlePaste(o),!0)}handleDragStart(e){this.localDrag=!0}handleDragEnd(e){this.localDrag=!1}async handleDrop(e){var l,a,u,h;if(this.localDrag)return;e.preventDefault();const t=document.getSelection();if(t&&document.caretPositionFromPoint){const b=document.caretPositionFromPoint(e.clientX,e.clientY);b&&t.setBaseAndExtent(b.offsetNode,b.offset,b.offsetNode,b.offset)}this.logger.log("handleDrop",{evt:e});const r=(l=e.dataTransfer)==null?void 0:l.files,i=Array.from(r||[]).filter(b=>Dw(b.type));if(i.length>0){e.stopPropagation(),this.logger.log("handleDrop","found files",{evt:e,files:r,imageFiles:i}),await this.pasteFilesIntoQuill(i);return}if((a=e.dataTransfer)!=null&&a.items){e.stopPropagation(),this.logger.log("handleDrop","found items",{evt:e,files:r,imageFiles:i}),await this.handleDataTransferList((u=e.dataTransfer)==null?void 0:u.items,e);return}const o=(h=e.dataTransfer)==null?void 0:h.getData("URL");if(this.logger.log("handleDrop","trying getData('URL')",{draggedUrl:o}),o){const b=await(await fetch(o)).blob();this.logger.log("handleDrop","blob from drag event",{evt:e,files:r,imageFiles:i}),await this.pasteFilesIntoQuill([b])}}async handlePaste(e){var t;typeof this.handleOnPaste=="function"&&!this.handleOnPaste(e)||await this.handleDataTransferList((t=e.clipboardData)==null?void 0:t.items,e)}async handleDataTransferList(e,t){const r=Array.from(e||[]),i=r.filter(a=>a.kind==="file"&&Dw(a.type)),o=r.map(a=>({type:a.type,kind:a.kind}));if(this.logger.log("handleDataTransferList",{fileTypes:o,imageCount:i.length}),!i.length)return;t.preventDefault(),t.stopPropagation();const l=i.map(a=>a.getAsFile());await this.pasteFilesIntoQuill(l)}async pasteFilesIntoQuill(e){this.logger.log(" pasteFilesIntoQuill",`pasting ${e.length} images...`),await Promise.all(e.map(async(t,r)=>{if(!t)return;const i=await I4(t);this.logger.log(" pasteFilesIntoQuill",`pasting image (${r})`),this.onNewDataUrl(i)})),this.logger.log(" pasteFilesIntoQuill","done")}}class Dp{constructor(e,t){Te(this,"quill");Te(this,"range");Te(this,"options");Te(this,"imageDrop");Te(this,"fileHolder");Te(this,"Logger");this.quill=e,this.options=t||{};const r=!!t.debug,i=!!t.suppressErrorLogging;this.Logger=new Sz(r,i),Tz(t,this.Logger);const o=async a=>{this.Logger.log("onImageDrop",{dataUrl:a});const u=await this.downscaleImageFromUrl(a);this.insertToEditor(u,Dp.b64toBlob(u))};this.imageDrop=new Oz(e,o,this.Logger,typeof this.options.handleOnPaste=="function"?this.options.handleOnPaste:this.options.handleOnPaste!==!1),this.Logger.log("fileChanged",{options:t,quill:e,debug:r});const l=this.quill.getModule("toolbar");l?l.addHandler("image",()=>this.selectLocalImage()):this.Logger.error("Quill toolbar module not found! need { toolbar: // options } in Quill.modules for image icon to sit in")}static b64toBlob(e){const t=atob(e.split(",")[1]),r=e.slice(5).split(";")[0],i=new ArrayBuffer(t.length);let o=new Uint8Array(i);for(let l=0;l<t.length;l++)o[l]=t.charCodeAt(l);return new Blob([i],{type:r})}destroy(){this.imageDrop&&console.warn("ImageDrop instance cleanup")}selectLocalImage(e){this.range=this.quill.getSelection(),this.fileHolder=document.createElement("input"),this.fileHolder.setAttribute("type","file"),this.fileHolder.setAttribute("accept","image/*"),this.fileHolder.setAttribute("style","visibility:hidden"),this.fileHolder.onchange=()=>this.fileChanged().then(()=>e&&e()),document.body.appendChild(this.fileHolder),this.fileHolder.click(),window.requestAnimationFrame(()=>{this.fileHolder&&document.body.removeChild(this.fileHolder)})}async fileChanged(e){var l;const t=e||((l=this.fileHolder)==null?void 0:l.files);if(!(t!=null&&t.length))return;const r=t[0];if(this.Logger.log("fileChanged",{file:r}),!r)return;const i=await I4(r),o=await this.downscaleImageFromUrl(i);this.insertToEditor(o,Dp.b64toBlob(o))}async downscaleImageFromUrl(e){const t=await Az(this.Logger,e,{maxWidth:this.options.maxWidth,maxHeight:this.options.maxHeight,imageType:this.options.imageType,keepImageTypes:this.options.keepImageTypes,ignoreImageTypes:this.options.ignoreImageTypes,imageQuality:this.options.quality});return this.Logger.log("downscaleImageFromUrl",{dataUrl:e,dataUrlCompressed:t}),t}insertToEditor(e,t){if(this.options.insertIntoEditor)this.options.insertIntoEditor(e,t,this.quill);else{this.Logger.log("insertToEditor",{url:e}),this.range=this.quill.getSelection();const r=this.range;if(!r)return;this.logFileSize(e),this.quill.insertEmbed(r.index,"image",`${e}`,"user"),r.index++,this.quill.setSelection(r,"api")}}logFileSize(e){const i=(Math.round((e.length-"data:image/png;base64,".length)*3/4)/1024).toFixed(0);this.Logger.log("estimated img size: "+i+" kb")}}window.imageCompressor=Dp;const Np={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"},Vh={BACKSPACE:8,DELETE:46,LEFT:37,UP:38,RIGHT:39,DOWN:40},O0=(n,e)=>{const t=n?"top":"bottom",r=e?"left":"right",i=n===e?"nwse-resize":"nesw-resize";return{[t]:"-5px",[r]:"-5px",cursor:i}},Pz={tl:O0(!0,!0),tr:O0(!0,!1),bl:O0(!1,!0),br:O0(!1,!1)},Dz={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"}]},Nz=Je.import("formats/image");class Q0 extends Nz{static get ATTRIBUTES(){return["alt","height","width","class","style","data-align"]}static formats(e){return this.ATTRIBUTES.reduce((t,r)=>(e.hasAttribute(r)&&(t[r]=e.getAttribute(r)??""),t),{})}format(e,t){this.constructor.ATTRIBUTES.includes(e)?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}}Te(Q0,"blotName","image"),Te(Q0,"tagName","img"),Te(Q0,"scope",Kn.INLINE);Je.register("formats/image",Q0,!0);class Vp{constructor(e){Te(this,"resizer");Te(this,"quill");Te(this,"overlay");Te(this,"activeEle");Te(this,"blot");Te(this,"options");Te(this,"requestUpdate");this.resizer=e,this.quill=e.quill,this.overlay=e.overlay,this.activeEle=e.activeEle,this.blot=e.blot,this.options=e.options,this.requestUpdate=()=>e.onUpdate(!0)}onCreate(){}onDestroy(){}onUpdate(){}}class Fz extends Vp{constructor(){super(...arguments);Te(this,"display")}onCreate(){var t;this.display=document.createElement("div"),this.display.className=vd[Np.DISPLAY],(t=this.overlay)==null||t.appendChild(this.display)}onUpdate(){if(!this.display||!this.activeEle)return;const[t,r]=[this.activeEle.offsetWidth,this.activeEle.offsetHeight];this.display.innerHTML=`${t} × ${r}`,this.positionDisplay(t,r)}positionDisplay(t,r){var b;if(!this.display)return;const i=this.display.getBoundingClientRect(),o=t>120&&r>30,l=((b=this.activeEle)==null?void 0:b.style.float)==="right";let a,u,h;o?(a="4px",u="4px",h="auto"):(u=`-${i.height+4}px`,l?(a="auto",h=`-${i.width+4}px`):(a=`-${i.width+4}px`,h="auto")),Object.assign(this.display.style,{right:a,bottom:u,left:h})}}class Bz extends Vp{constructor(){super(...arguments);Te(this,"boxes",[]);Te(this,"dragBox",null);Te(this,"dragStartX",0);Te(this,"dragStartY",0);Te(this,"contentOption");Te(this,"preDragSize",{width:0,height:0});Te(this,"naturalSize",[0,0]);Te(this,"handleDragProxy",null);Te(this,"handleMouseupProxy",null);Te(this,"handleMousedown",t=>{!this.blot||!this.activeEle||(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.bind(this),this.handleMouseupProxy=this.handleMouseup.bind(this),document.addEventListener("mousemove",this.handleDragProxy,!0),document.addEventListener("mouseup",this.handleMouseupProxy,!0))});Te(this,"handleMouseup",t=>{if(!this.activeEle||!this.blot||!this.contentOption)return;const r=this.calcSize(t,this.contentOption.limit);Object.assign(this.activeEle,r),Object.assign(this.activeEle.style,{width:null,height:null}),this.setCursor(""),this.removeEventListeners()});Te(this,"handleDrag",t=>{!this.activeEle||!this.blot||!this.contentOption||(Object.assign(this.activeEle.style,this.calcSize(t,{...this.contentOption.limit,unit:!0})),this.requestUpdate())});Te(this,"handleDoubleClick",t=>{if(!this.blot||!this.activeEle||!this.contentOption)return;t.stopPropagation();const[r,i]=this.naturalSize,o={};this.contentOption.attribute.includes("width")&&(o.width=r),this.contentOption.attribute.includes("height")&&(o.height=i);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=[],["tl","tr","br","bl"].forEach(this.addBox.bind(this)))}onDestroy(){this.setCursor("")}addBox(t){var i;const r=document.createElement("div");r.className=`${vd[Np.HANDLE]} ${t}`,r.addEventListener("mousedown",this.handleMousedown,!1),r.addEventListener("dblclick",this.handleDoubleClick,!1),Object.assign(r.style,Pz[t]),(i=this.overlay)==null||i.appendChild(r),this.boxes.push(r)}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,r={}){var u;if(!this.dragBox||!this.activeEle)return{};const i=t.clientX-this.dragStartX,o=t.clientY-this.dragStartY,l=this.dragBox===this.boxes[0]||this.dragBox===this.boxes[3]?-1:1,a={};return(u=this.contentOption)!=null&&u.attribute?this.contentOption.attribute.forEach(h=>a[h]=this.preDragSize[h]):a.width=this.preDragSize.width,a.width&&(a.width=Math.round(this.preDragSize.width+i*l)),a.height&&(a.height=Math.round(this.preDragSize.height+o*l)),this.applyConstraints(a,r)}applyConstraints(t,r={}){const i=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=i,a=o;if(r.ratio){l=this.applyLimit(l,r.minWidth,r.maxWidth),a=l*r.ratio;const h=this.applyLimit(a,r.minHeight,r.maxHeight);h!==a&&(a=h,l=a/r.ratio)}else i&&(l=this.applyLimit(l,r.minWidth,r.maxWidth)),o&&(a=this.applyLimit(a,r.minHeight,r.maxHeight));const u={};return t.width!==void 0&&(u.width=r.unit?`${l}px`:l),t.height!==void 0&&(u.height=r.unit?`${a}px`:a),u}applyLimit(t,r,i){let o=t;return r!==void 0&&(o=Math.max(r,o)),i!==void 0&&(o=Math.min(i,o)),o}getNaturalSize(){if(!this.activeEle)return[0,0];const t=this.activeEle.dataset.size;if(!t){const r=this.activeEle,i=[r.offsetWidth,r.offsetHeight];return r.dataset.size=i.join(","),i}return t.split(",").map(Number)}setCursor(t){[document.body,this.activeEle].forEach(r=>r&&(r.style.cursor=t))}}const qh=class qh extends Vp{constructor(){super(...arguments);Te(this,"keyboardProxy",null)}static injectInit(t){var i;const r=(i=t.keyboard)==null?void 0:i.bindings;r&&[qh.keys.LEFT,qh.keys.RIGHT].forEach(o=>(r[o]||[]).unshift(qh.makeArrowHandler(o)))}static makeArrowHandler(t){const r=t===qh.keys.LEFT;return{key:t,shiftKey:!1,altKey:null,[r?"prefix":"suffix"]:/^$/,handler(i){const o=this.quill;if(!o.resizer)return!0;let l=i.index;const a=t===qh.keys.RIGHT,[u]=o.getLine(l+(r?-1:0));if(!u)return!0;if(o.resizer.judgeShow(u))return!1;const h=o.getIndex(u);if(a&&h+u.length()-1===l)return!0;a&&(l+=i.length+1);const[b]=o.getLeaf(l);if(!b)return!0;const x=b.offset(b.parent),w=b.constructor&&"scope"in b.constructor&&b.constructor.scope===Kn.BLOCK_BLOT;if(r&&(w&&l===x||l===0||l===h))return!0;let _=b;if(r&&x===0){const[E]=o.getLeaf(l-1);E&&(_=E)}return!_||!o.resizer.judgeShow(_)}}}onCreate(){this.keyboardProxy=this.keyboardHandle.bind(this),document.addEventListener("keydown",this.keyboardProxy,!0)}onDestroy(){this.keyboardProxy&&document.removeEventListener("keydown",this.keyboardProxy,!0)}keyboardHandle(t){if(t.defaultPrevented||t.shiftKey||t.ctrlKey||t.altKey||!this.activeEle||!this.blot)return;const r=t.which||t.keyCode;let i=this.blot.offset(this.quill.scroll),o=null,l=!1;r===Vh.BACKSPACE||r===Vh.DELETE?(this.handleDelete(),l=!0):r>=Vh.LEFT&&r<=Vh.DOWN&&([i,o]=this.handleArrowKeys(r,i),l=!0),l&&(t.stopPropagation(),t.preventDefault()),!(o&&this.resizer.judgeShow(o,o.domNode))&&(this.quill.setSelection(i),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,r){let i=null;return t===Vh.RIGHT?r+=this.blot.length()||1:t===Vh.UP?(r=this.getOtherLineIndex(-1),i=this.quill.getLeaf(r)[0]):t===Vh.DOWN&&(r=this.getOtherLineIndex(1),i=this.quill.getLeaf(r)[0]),[r,i]}getOtherLineIndex(t){if(!this.blot)return 0;const r=this.blot.offset(this.quill.scroll),[i]=this.quill.getLine(r);if(!i)return r;const o=this.blot.offset(i)+1,l=t>0?i.next:i.prev;if(!l)return r;let a=l.length();return l.statics.blotName==="block"&&a--,l.offset(this.quill.scroll)+Math.min(a,o)}};Te(qh,"keys",Vh);let pv=qh;const c1=class c1 extends Vp{constructor(t){super(t);Te(this,"toolbar");Te(this,"blot");this.blot=t.blot}createStyleTool(t,r){const i={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=>{const l=i[r];Object.assign(o.style,l),o.dataset.align=r},isApplied:o=>{const l=o.style;switch(r){case"center":return l.float==="none";case"justify":return l.display==="block"&&l.width==="100%";case"left":case"right":return l.float===r;default:return!1}}}}onCreate(){var t;this.toolbar=document.createElement("div"),this.toolbar.className=vd[Np.TOOLBAR],(t=this.overlay)==null||t.appendChild(this.toolbar),Object.keys(c1.Tools).forEach(r=>{const i=r;c1.Tools[i]=this.createStyleTool(c1.Tools[i].icon,i)}),this._addToolbarButtons()}_addToolbarButtons(){if(!this.toolbar||!this.activeEle)return;const{Tools:t}=this.constructor;this.options.tools.forEach(r=>{const i=r,o=t[i];if(!o)return;const l=document.createElement("button");l.type="button",l.className=vd[Np.TOOLBAR_BUTTON],l.innerHTML=l1.renderToString(M.jsx(uo,{icon:o.icon,size:"xs"})),l.setAttribute("data-tool",i),o.isApplied&&this.activeEle&&o.isApplied.call(this,this.activeEle)&&(l.style.backgroundColor="var(--AEditor_Addon_Secondary_color)"),this.addButtonClickHandler(l,o),this.toolbar.appendChild(l)})}addButtonClickHandler(t,r){!this.activeEle||!this.blot||t.addEventListener("click",i=>{var l,a;if(i.stopPropagation(),((l=r.handler)==null?void 0:l.call(this,i,t,this.activeEle))!==!0)return;const o=r.isApplied&&this.activeEle?r.isApplied.call(this,this.activeEle):!1;return this.toolbar&&Array.from(this.toolbar.querySelectorAll("button")).forEach(u=>u.style.backgroundColor=""),o?(this.activeEle.style.cssText="",this.activeEle.dataset.align=""):(t.style.backgroundColor="var(--AEditor_Addon_Secondary_color)",(a=r.apply)==null||a.call(r,this.activeEle)),this.requestUpdate(),!1})}};Te(c1,"Tools",{left:{icon:"AlignLeft"},center:{icon:"AlignCenter"},right:{icon:"AlignRight"},justify:{icon:"AlignJustify"}});let am=c1;class k4{constructor(e,t={}){Te(this,"quill");Te(this,"options");Te(this,"moduleClasses");Te(this,"modules",[]);Te(this,"blot");Te(this,"selectedBlots",[]);Te(this,"embedClassName","");Te(this,"activeEle");Te(this,"overlay");Te(this,"updateFromModule",!1);Te(this,"hideProxy",null);Te(this,"updateOverlayPositionProxy",null);var i;e.resizer=this,this.quill=e;const r=t.modules?[...t.modules]:null;this.options={...Dz,...t},r&&(this.options.modules=r),document.execCommand("enableObjectResizing",!1,"false"),this.moduleClasses=this.options.modules,this.quill.root.addEventListener("mousedown",this.handleClick.bind(this),!1),this.quill.on("text-change",this.handleChange.bind(this)),this.quill.container.style.position=this.quill.container.style.position||"relative",this.quill.on("selection-change",this.addBlotsSelectedClass.bind(this)),pv.injectInit(this.quill),(i=this.options.embedTags)!=null&&i.length&&this.initializeEmbed()}initializeModules(){this.modules.forEach(e=>e.onDestroy()),this.modules=[],this.modules=this.moduleClasses.map(e=>new(this.constructor.Modules[e]||e)(this)),this.modules.forEach(e=>e.onCreate()),this.repositionElements(),this.modules.forEach(e=>e.onUpdate())}initializeEmbed(){if(!this.options.embedTags.length)return;this.embedClassName=`ql-${Array.from({length},()=>[Math.floor(Math.random()*62)]).join("")}`;const e=[""].concat(this.options.embedTags).join(`, .${this.embedClassName} `).slice(2)+"{pointer-events: none;}",t=document.createElement("style");t.textContent=e,this.quill.container.appendChild(t),this.quill.root.classList.add(this.embedClassName)}onUpdate(e){this.updateFromModule=!!e,this.repositionElements(),this.modules.forEach(t=>t.onUpdate())}handleClick(e){if(this.overlay&&(e.target===this.overlay||this.overlay.contains(e.target)))return;let t=e.target;if(t=this.getEventTarget(e,t),t!=null&&t.tagName){const r=this.quill.scroll.find(t);if(r&&this.judgeShow(r,t)){e.preventDefault();return}}this.activeEle&&this.hide()}getEventTarget(e,t){var o;const r=(o=this.options.embedTags)==null?void 0:o.join();if(!r)return t;const i=this.quill.root;return(t===i||t.querySelectorAll(r).length)&&(i.classList.remove(this.embedClassName),t=document.elementFromPoint(e.clientX,e.clientY),i.classList.add(this.embedClassName)),t}judgeShow(e,t){if(!e||!this.options.contentOptions)return!1;!t&&e.domNode&&(t=e.domNode);const r=this.options.contentOptions.find(o=>o.blotName===e.statics.blotName);if(!r)return!1;if(this.activeEle===t)return!0;const i=r.limit||{};return!i.minWidth||i.minWidth&&t.offsetWidth>=i.minWidth?(this.activeEle&&this.hide(),this.activeEle=t,this.blot=e,this.showOverlay(),this.initializeModules(),!0):!1}handleChange(e,t,r){if(this.updateFromModule){this.updateFromModule=!1;return}r!=="user"||!this.overlay||!this.activeEle||this.onUpdate()}showOverlay(){this.overlay&&this.hideOverlay(),this.quill.setSelection(null),[document.body,this.quill.root].forEach(e=>e.style.userSelect="none"),this.overlay=document.createElement("div"),this.overlay.className=`${vd[Np.OVERLAY]}`,this.overlay.addEventListener("wheel",e=>{e.preventDefault(),e.stopPropagation(),this.quill.root.scrollTop+=e.deltaY*.5},{passive:!1}),this.quill.container.appendChild(this.overlay),this.hideProxy=()=>this.activeEle&&this.hide(),this.updateOverlayPositionProxy=()=>this.overlay&&(this.overlay.style.marginTop=-1*this.quill.root.scrollTop+"px"),this.quill.root.addEventListener("input",this.hideProxy,!0),this.quill.root.addEventListener("scroll",this.updateOverlayPositionProxy),this.repositionElements()}hideOverlay(){this.overlay&&(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),[document.body,this.quill.root].forEach(e=>e.style.userSelect=""))}repositionElements(){if(!this.overlay||!this.activeEle)return;const e=this.quill.container,t=this.activeEle.getBoundingClientRect(),r=e.getBoundingClientRect();Object.assign(this.overlay.style,{left:`${t.left-r.left-1+e.scrollLeft}px`,top:`${t.top-r.top+this.quill.root.scrollTop}px`,width:`${t.width}px`,height:`${t.height}px`,marginTop:-1*this.quill.root.scrollTop+"px"})}addBlotsSelectedClass(e){if(!e){this.selectedBlots=[];return}try{const t=i=>{var o;return["image","iframe","video"].includes((o=i.statics)==null?void 0:o.blotName)},r=this.quill.scroll.descendants(t,e.index,e.length);this.selectedBlots=r.filter(i=>!i.statics||!this.options.contentOptions?!1:this.options.contentOptions.some(o=>o.blotName===i.statics.blotName))}catch(t){console.warn("Error during blot selection:",t)}}hide(){this.hideOverlay(),this.modules.forEach(e=>e.onDestroy()),this.modules=[],this.activeEle=void 0,this.blot=void 0}}Te(k4,"Modules",{Base:Vp,DisplaySize:Fz,Toolbar:am,Resize:Bz,Keyboard:pv});const P0=Je.import("delta"),zz=Je.import("modules/clipboard");function Hz(n){let e=Number.parseFloat(n.getAttribute("width")||String(_s.colDefaultWidth));if(Number.isNaN(e)){const t=n.style.width;e=t?Number.parseFloat(t):n.offsetWidth}return e}function Wz(n,e){const t=new Array(e).fill(_s.colDefaultWidth),r=Array.from(n.querySelectorAll("tr"));for(const i of r){const o=Array.from(i.querySelectorAll("td"));for(const[l,a]of o.entries())if(l<e){const u=Hz(a);t[l]=u||t[l]}else break}return t}class Uz extends zz{constructor(t,r){super(t,r);Te(this,"tableId",Ba());Te(this,"rowId",Ba());Te(this,"colIds",[]);Te(this,"rowspanCount",[]);Te(this,"cellCount",0);Te(this,"colCount",0);Te(this,"STYLE_PROPERTIES",["color","background","background-color","mso-pattern","border","border-color","border-top","border-right","border-bottom","border-left"]);this.quill=t,this.addMatcher("table",this.matchTable.bind(this)),this.addMatcher("colgroup",this.matchColgroup.bind(this)),this.addMatcher("col",this.matchCol.bind(this)),this.addMatcher("tr",this.matchTr.bind(this)),this.addMatcher("td",this.matchTd.bind(this)),this.addMatcher("th",this.matchTd.bind(this)),this.addMatcher("caption",this.matchCaption.bind(this))}matchTable(t,r){if(r.ops.length===0)return r;const i=[],o=[];let l=-1;for(let h=0;h<r.ops.length;h++){const{attributes:b,insert:x}=r.ops[h],{table:w,[je.tableCell]:_,...E}=b||{},R=tg.isObject(x)&&x[je.tableCol];R?o.push({insert:x}):i.push({attributes:E,insert:x}),!(E!=null&&E[je.tableCellInner])&&!R&&(l=h)}const u=Wz(t,this.colIds.length).reduce((h,b,x)=>(o[x]?h.push(o[x]):h.push({insert:{[je.tableCol]:{tableId:this.tableId,colId:this.colIds[x],width:b,full:!0}}}),h),[]);return i.splice(l+1,0,...u),this.tableId=Ba(),this.colIds=[],this.rowspanCount=[],this.cellCount=0,this.colCount=0,new P0(i)}matchColgroup(t,r){const i=[];for(let o=0;o<r.ops.length;o++){const l=r.ops[o];l&&tg.isObject(l.insert)&&l.insert[je.tableCol]&&i.push(l)}return new P0(i)}matchCol(t){this.colIds[this.colCount]=Ba();const r=new P0().insert({[je.tableCol]:Object.assign(Rg.value(t),{tableId:this.tableId,colId:this.colIds[this.colCount]})});return this.colCount+=1,r}matchTr(t,r){this.rowId=Ba(),this.cellCount=0;for(const[i,o]of this.rowspanCount.entries())o.rowspan>0&&(o.rowspan-=1),o.rowspan<=0&&(this.rowspanCount[i]={rowspan:0,colspan:0});return r}matchTd(t,r){const i=t,o=Df.formats(i);if(!this.colIds[this.cellCount]||!this.rowspanCount[this.cellCount])for(let b=this.cellCount;b>=0;b--)this.colIds[b]||(this.colIds[b]=Ba()),this.rowspanCount[b]||(this.rowspanCount[b]={rowspan:0,colspan:0});const{colspan:l}=this.rowspanCount[this.cellCount];this.cellCount+=l,o.rowspan>0&&(this.rowspanCount[this.cellCount]={rowspan:o.rowspan,colspan:o.colspan});const a=this.colIds[this.cellCount];this.cellCount+=o.colspan;const u=Object.assign(o,{tableId:this.tableId,rowId:this.rowId,colId:a});this.handleBorderNoneStyles(i,u);const h=[];for(const b of r.ops){const{attributes:x={},...w}=b,{[je.tableCell]:_,...E}=x;h.push({...w,attributes:{...E,[je.tableCellInner]:u}})}return(h.length<=0||!tg.isString(h[h.length-1].insert)||!h[h.length-1].insert.endsWith(`
|
|
479
479
|
`))&&h.push({insert:`
|
|
480
|
-
`,attributes:{[je.tableCellInner]:u}}),new P0(h)}handleBorderNoneStyles(t,r){if(!(r!=null&&r.style))return;["border",...["top","right","bottom","left"].flatMap(o=>[`border-${o}`,`border-${o}-style`])].filter(o=>t.style[o]==="none").forEach(o=>r.style=r.style.replaceAll(new RegExp(`${o}:none;?`,"g"),""))}convert({html:t,text:r},i={}){if(t){const a=new DOMParser().parseFromString(t,"text/html");this.preprocessTableHtml(a),this.mergeClassStylesToInline(a),t=a.body.innerHTML}const o=super.convert({html:t,text:r},i);if(i[je.tableCellInner])for(const l of o.ops){if(tg.isObject(l.insert)&&l.insert[je.tableCol]){l.insert="";continue}l.attributes||(l.attributes={}),l.attributes[je.tableCellInner]=i[je.tableCellInner]}return o}parseStyleWithFilter(t,r){if(!t)return{};const i={};let o="",l="",a=!0,u=0;for(let h=0;h<t.length;h++){const b=t[h];b===":"&&a?(o=t.substring(u,h).trim(),u=h+1,a=!1):b===";"&&(!a&&o&&(l=t.substring(u,h).trim(),(!r||r(o))&&(i[o]=l)),u=h+1,a=!0)}return!a&&o&&u<t.length&&(l=t.substring(u).trim(),(!r||r(o))&&(i[o]=l)),i}mergeClassStylesToInline(t){var r;try{const i=t.querySelectorAll("td[class], th[class]");if(i.length===0)return;const o=new Set;for(const b of i)(b.getAttribute("class")||"").split(/\s+/).filter(Boolean).forEach(w=>o.add(w));if(o.size===0)return;const l=t.querySelectorAll("style");if(l.length===0)return;const a=Array.from(l).map(b=>b.textContent||"").join("");if(!a)return;const u={},h=b=>this.STYLE_PROPERTIES.some(x=>b.startsWith(x));for(const b of o){const x=new RegExp(`\\.${b}[^{]*{([^}]*)}`,"g");let w;for(;(w=x.exec(a))!==null;){const _=w[1],E=this.parseStyleWithFilter(_),R={};let I=!1;for(const P in E)h(P)&&(R[P]=E[P],I=!0);I&&(u[b]=R)}}if(Object.keys(u).length===0)return;for(let b=0;b<i.length;b++){const x=i[b],w=((r=x.getAttribute("class"))==null?void 0:r.split(/\s+/).filter(Boolean))||[],_=x.getAttribute("style")||"",E=this.parseStyleWithFilter(_);let R=!1;for(const I of w){const P=u[I];if(P)for(const O in P)E[O]||(E[O]=P[O],R=!0)}if(R){let I="";for(const P in E)I+=P+":"+E[P]+";";I&&x.setAttribute("style",I)}x.removeAttribute("class")}}catch(i){console.error("스타일 처리 오류",i)}}matchCaption(t,r){for(let i=0;i<r.ops.length;i++){const o=r.ops[i],{attributes:l}=o;l&&l[je.tableCaption]&&(l[je.tableCaption].tableId=this.tableId,o.attributes=l)}return r}preprocessTableHtml(t){try{const r=t.querySelectorAll("table");for(const i of Array.from(r))i.querySelectorAll("tr").length!==0&&(this.cleanupTableStyles(i),this.applyRowspanHeights(i),this.fixRowspanCells(i));this.mergeClassStylesToInline(t)}catch(r){console.error("테이블 전처리 오류",r)}}cleanupTableStyles(t){const r=t.querySelectorAll("td, th, tr, colgroup");for(const i of r){const o=i;o.removeAttribute("height");const l=o.getAttribute("style");if(l){const a=l.replace(/height\s*:[^;]*;?/gi,"").trim();o.setAttribute("style",a||"")}}}applyRowspanHeights(t){const i=t.querySelectorAll("td, th");t.style.borderCollapse="collapse";for(const o of i){const l=o,u=parseInt(l.getAttribute("rowspan")||"1")*24,h=l.getAttribute("style")||"",b=h+(h?"; ":"")+`height: ${u}px`;l.setAttribute("style",b)}}fixRowspanCells(t){const r=t.querySelectorAll("tr");if(r.length<=1)return;const i=[],o=new Map;for(let l=0;l<r.length;l++){const u=r[l].querySelectorAll("td, th");if(u.length===0&&l<r.length-1){i.push(l);continue}for(const h of Array.from(u)){const b=parseInt(h.getAttribute("rowspan")||"1");if(b>1)for(let x=1;x<b;x++){const w=l+x;if(w>=r.length)break;o.has(w)||o.set(w,[]),o.get(w).push(h)}}}i.length>0&&this.processEmptyRows(i,r,o)}processEmptyRows(t,r,i){for(const o of t){const l=i.get(o);if(l)for(const a of l){const u=parseInt(a.getAttribute("rowspan")||"1");u>1&&a.setAttribute("rowspan",(u-1).toString())}}for(const o of t.reverse())r[o].remove()}}class Gz extends R4{fixUnusuaDeletelTable(){}mergeCells(e){if(!this.table||!this.tableSelection)return;const t=this.tableSelection.selectedTds||[];if(t.length>1&&(e=t),!e||e.length<=1)return;const r=Kl(e[0],je.tableMain),i=r.getRows(),o=e.map(w=>{if(!w||!w.parent||!w.parent.domNode)return null;const _=w.parent.domNode;if(!_)return null;const E=i.findIndex(P=>P.rowId===w.rowId);if(E===-1)return null;const R=w.getColumnIndex();if(R===-1)return null;const I=_.getBoundingClientRect();return!I||I.width===0||I.height===0?null:{td:w,rowIndex:E,colIndex:R,rowspan:w.rowspan,colspan:w.colspan,visualLeft:I.left,visualRight:I.right,visualTop:I.top,visualBottom:I.bottom}}).filter(Boolean);if(o.length<=1)return;o.sort((w,_)=>w.visualTop-_.visualTop||w.visualLeft-_.visualLeft);const l=o[0],a=l.td,u=Math.max(...o.map(w=>w.rowIndex+w.rowspan-1)),h=Math.max(...o.map(w=>w.colIndex+w.colspan-1)),b=u-l.rowIndex+1,x=h-l.colIndex+1;for(const w of o)w.td!==a&&(w.td.moveChildren(a),w.td.parent.remove());a.rowspan=b,a.colspan=x,this.fixTableByRemove(r)}}km.setConfig({ADD_TAGS:["iframe"]});km.addHook("uponSanitizeAttribute",(n,e)=>{n.tagName==="IFRAME"&&(e.attrName==="src"||e.attrName==="class"||e.attrName==="frameborder"||e.attrName==="allowfullscreen")&&(e.keepAttr=!0)});Je.register({"modules/imageCompress":Dp,"modules/resize":k4,"modules/tableUp":Gz,"modules/magicUrl":mF,"formats/divider":sm,"modules/clipboard":Uz,"modules/copy":wz,"modules/toggleFullscreen":l4},!0);const a1={KB:1024,QUALITY:.7,IMAGE_SIZES:new Map},Yz={getCharLength:n=>Array.from(n).length,calculateTextSize:n=>{if(!n.ops||n.ops.length===0)return 0;let e=0;for(const t of n.ops)if(typeof t.insert=="string")e+=new TextEncoder().encode(t.insert).length-1;else if(typeof t.insert=="object"&&t.insert.image){const r=t.insert.image;r&&(e+=a1.IMAGE_SIZES.get(r)||Math.ceil(r.length*a1.QUALITY))}return e}},Vz=n=>{const{type:e="Primary",editorRef:t,useValue:r,useError:i,placeholder:o,tabIndex:l,autoFocus:a,editorProps:u,style:h,minHeight:b,maxHeight:x,contentHeight:w,contentMaxHeight:_=1e3,toolbarSize:E="Med",toolbarType:R="Default",readOnly:I,limitPosition:P="Bottom",maxLength:O,size:G=100,editorClassName:z,editorStyle:V,noImageResize:F,...ee}=n,[{wrapId:U,wrapProps:Y,labelProps:de,...Z},te]=Fg(ee),ne=N.useMemo(()=>e==="ReadOnly"||I,[e,I]),ce=N.useMemo(()=>w?20:0,[w]),[ae,$]=N.useState(E==="Med"?40:50),ie=N.useMemo(()=>ne||e==="Raw"?0:ae,[e,ne,ae]),[he,be]=N.useState(w),[oe,Q]=N.useState(!1),pe=N.useRef(null),Ae=N.useRef(0),Pe=N.useRef(0),_e=N.useMemo(()=>R==="Title",[R]),Me=N.useMemo(()=>{let we;return b&&x||e==="Raw"?we=void 0:we=0,he?he+ie:we},[b,x,e,he,ie]),Ne=N.useMemo(()=>{const we=[b,w].filter(se=>se!=null);return we.length?Math.min(...we):void 0},[b,w]),Re=N.useMemo(()=>x??"100%",[x]),Oe=N.useMemo(()=>(Array.isArray(Z.errorMessage)?Z.errorMessage.some(Boolean):!!Z.errorMessage)?"Error":e,[Z.errorMessage,e]),Le=N.useCallback(we=>{const se=km.sanitize(we),ze=document.createElement("div");return ze.innerHTML=se,new Je(ze,{readOnly:!0}).getContents()},[]),[Xe,Ye]=Do(r,""),[We,ot]=N.useState(()=>Le(Xe));N.useEffect(()=>{Ye===void 0&&ot(Le(Xe))},[Le,Ye,Xe]);const nt=N.useRef(null),$e=N.useRef([]),[Ge,_t]=N.useState("NoTransition");N.useEffect(()=>{const we=setTimeout(()=>_t(""),0);return()=>{clearTimeout(we),$e.current.forEach(se=>se()),$e.current=[]}},[]);const ct=N.useCallback((we,se)=>{if(!w)return se;const et=Math.max(b??w,0);return Math.min(x??_,Math.max(et,se+we))},[w,b,x,_]),ft=N.useCallback(we=>{if(!oe||!w)return;const se=we.clientY-Pe.current,ze=ct(se,Ae.current);he!==ze&&be(ze),we.preventDefault(),we.stopPropagation()},[oe,w,ct,he]),St=N.useCallback(we=>{Q(!1),document.removeEventListener("mousemove",ft),document.removeEventListener("mouseup",St),we.preventDefault(),we.stopPropagation()},[ft]),dt=N.useCallback(we=>{if(!w)return;if(we.detail===2){be(w);return}he?Ae.current=he:(be(w),Ae.current=w),Q(!0),Pe.current=we.clientY;const se=et=>{if(!w)return;const Et=et.clientY-Pe.current,At=ct(Et,Ae.current);be(At),et.preventDefault(),et.stopPropagation()},ze=et=>{Q(!1),document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",ze),et.preventDefault(),et.stopPropagation()};document.addEventListener("mousemove",se),document.addEventListener("mouseup",ze),we.preventDefault(),we.stopPropagation()},[ct,he,w]),zt=N.useCallback((we,se,ze,et)=>{if(ze!=="user"&&ze!=="api")return;const Et=et.getContents(),At=et.getLength()-1,tn=O!==void 0&&At>O,qt=Rn=>Rn.replaceAll(/\s{2,}/g,yn=>" ".repeat(yn.length)),nn=we.replace(/^<p><br><\/p>$/,"").trim(),pn=qt(nn);if(!tn){ot(Et),Ye==null||Ye(pn);return}const on=ln(Et,O);ot(on);const On=new Je(document.createElement("div"));On.setContents(on);const Pn=qt(On.root.innerHTML.replace(/^<p><br><\/p>$/,"").trim());Ye==null||Ye(Pn)},[O,Ye]),ln=(we,se)=>{var Et,At,tn;if(!we.ops)return we;const ze=new Xn;let et=0;for(const qt of we.ops){if(et>=se)break;if(qt.insert&&typeof qt.insert=="string"){const nn=qt.insert,pn=se-et;if(nn.length<=pn)(Et=ze.ops)==null||Et.push(qt),et+=nn.length;else{const on={...qt,insert:nn.substring(0,pn)};(At=ze.ops)==null||At.push(on);break}}else et<se&&((tn=ze.ops)==null||tn.push(qt),et+=1)}return ze},Wt=N.useCallback(we=>{var Et,At;const se=we.getEditor().container;if(!se)return null;const ze=(Et=se.closest(".AEditorContainer"))==null?void 0:Et.querySelector(".ql-toolbar");return ze||((At=se.parentElement)==null?void 0:At.querySelector(".ql-toolbar"))||null},[]),dn=N.useCallback((we,se,ze,et)=>{if(!we)return;const Et=ze;we.addEventListener(se,Et,et),$e.current.push(()=>we.removeEventListener(se,Et,et))},[]),Gt=N.useCallback((we,se,ze)=>{const et=se.getFormat();we.forEach(Et=>{if(et[Et]){const At=et[Et],tn=`.ql-${Et}`,qt=ze.querySelector(`${tn} .ql-picker-label`),nn=ze.querySelectorAll(`${tn} .ql-picker-item`),pn=Array.from(nn).find(on=>on.dataset.value===At);pn&&(pn.classList.add("ql-selected"),qt==null||qt.classList.add("ql-active"))}})},[]),xn=N.useCallback(we=>{if(!we.length)return;const et=we[0].target.getBoundingClientRect(),Et=Math.ceil(et.height);$(At=>Math.abs(At-Et)<.1?At:Et)},[]),jt=N.useCallback((we,se)=>{if(we.key!=="Backspace")return;const ze=se.getSelection(!1);if(!ze||ze.length>0)return;const et=ze.index;if(et<=0)return;const[Et]=se.getLine(et);if(Et&&et===se.getIndex(Et)||se.getFormat(et,1).link)return;const At=se.getFormat(et-1,1);if(At.link){we.preventDefault();let tn=et-1;for(;tn>0&&se.getFormat(tn-1,1).link===At.link;)tn--;const[qt]=se.scroll.descendant(nn=>{var pn;return((pn=nn==null?void 0:nn.statics)==null?void 0:pn.blotName)==="link"},tn);if(qt!=null&&qt.domNode){const nn=(qt.domNode.textContent||"").length;se.removeFormat(tn,nn)}}},[]),rn=N.useCallback(()=>({clipboard:{matchers:[["img",()=>!1],["table",()=>!1],["iframe",()=>!1],["video",()=>!1],["h1, h2, h3, h4, h5, h6",()=>!1],["blockquote",()=>!1],["hr",()=>!1]]},copy:{isTitleMode:!0},keyboard:{bindings:{enter:{key:"Enter",handler:()=>!1},newline:{key:"Enter",shiftKey:!0,handler:()=>!1},tab:{key:"Tab",handler:()=>!0},"remove-newline":{key:"Backspace",collapsed:!0,format:["blockquote","list","code-block"],offset:0,handler:function(we){const{blockquote:se,list:ze,["code-block"]:et}=we.getFormat();return se||ze||et?(we.format("blockquote",!1),we.format("list",!1),we.format("code-block",!1),!1):!0}}}},magicUrl:!0,toolbar:{container:[["bold","italic","underline","strike",{color:[]},{background:[]},"clean"]]}}),[]),Bt=N.useCallback(()=>({clipboard:{},copy:{},keyboard:{bindings:{tab:{key:"Tab",handler:()=>!0}}},magicUrl:!0,toggleFullscreen:{type:Oe,maximize:l1.renderToString(M.jsx(uo,{icon:"Maximize",size:E==="Med"?"sm":"md"})),minimize:l1.renderToString(M.jsx(uo,{icon:"Minimize",size:E==="Med"?"sm":"md"}))},imageCompress:{quality:a1.QUALITY,imageType:"image/jpeg",maxWidth:1500,maxHeight:1500,debug:!1,handleOnPaste:we=>{var se,ze;try{const et=(se=we.clipboardData)==null?void 0:se.items;if(!et)return!0;const Et=Array.from(et).some(qt=>{const nn=qt.type.toLowerCase();return nn.includes("Excel")||nn.includes("text/html")}),At=(ze=we.clipboardData)==null?void 0:ze.getData("text/html"),tn=At&&(At.includes("<table")||At.includes("<tbody")||At.includes("<td"));return!(Et||tn)}catch(et){return console.warn("Error in handleOnPaste:",et),!0}},insertIntoEditor:(we,se,ze)=>{a1.IMAGE_SIZES.has(we)||a1.IMAGE_SIZES.set(we,se.size);const et=ze.getSelection();et&&ze.insertEmbed(et.index,"image",we,Je.sources.USER)}},...!ne&&{...!F&&{resize:{}},table:!1,tableUp:{fullSwitch:!1,icon:l1.renderToString(M.jsx(uo,{icon:"Table",size:E==="Med"?"sm":"md",strokeWidth:2.5})),resize:rz,resizeScale:iz,customSelect:fz,selection:lz,fixUnusuaDeletelTable:!1,selectionOptions:{tableMenu:tz,tableMenuOptions:{localstorageKey:"used-color",tipText:!0,tools:[io.InsertCaption,io.InsertTop,io.InsertRight,io.InsertBottom,io.InsertLeft,io.Break,io.MergeCell,io.SplitCell,io.Break,io.DeleteRow,io.DeleteColumn,io.DeleteTable,io.Break,io.BackgroundColor,io.BorderColor,io.Break,io.CopyCell,io.CutCell,io.Break,io.SwitchWidth]}},texts:{fullCheckboxText:Dr.AEditor["Insert Full Width Table"],customBtnText:Dr.AEditor.Custom,confirmText:Dr.AEditor.Confirm,cancelText:Dr.AEditor.Cancel,rowText:Dr.AEditor.Row,colText:Dr.AEditor.Column,CopyCell:Dr.AEditor["Copy Cell"],CutCell:Dr.AEditor["Cut Cell"],notPositiveNumberError:Dr.AEditor["Not Positive Number Error"],custom:Dr.AEditor.Custom,clear:Dr.AEditor.Clear,transparent:Dr.AEditor.Transparent,perWidthInsufficient:Dr.AEditor.perWidthInsufficient,InsertTop:Dr.AEditor["Insert Row Top"],InsertRight:Dr.AEditor["Insert Column Right"],InsertBottom:Dr.AEditor["Insert Row Bottom"],InsertLeft:Dr.AEditor["Insert Column Left"],MergeCell:Dr.AEditor["Merge Cell"],SplitCell:Dr.AEditor["Split Cell"],DeleteRow:Dr.AEditor["Delete Row"],DeleteColumn:Dr.AEditor["Delete Column"],DeleteTable:Dr.AEditor["Delete Table"],BackgroundColor:Dr.AEditor["Set Background Color"],BorderColor:Dr.AEditor["Set Border Color"],SwitchWidth:Dr.AEditor["Switch Table Width"],InsertCaption:Dr.AEditor["Insert Table Caption"]}},toolbar:{container:[[{header:[1,2,3,!1,4]}],["bold","italic","underline","strike","blockquote","divider",{[R4.toolName]:[]},{color:[]},{background:[]}],[{list:"ordered"},{list:"bullet"},{indent:"-1"},{indent:"+1"},{align:[]}],["link","image","video"],["clean"]],handlers:{divider:(we,se,ze,et)=>{const Et=et,At=Et.getSelection(!0);if(!At)return;const tn=Math.min(At.index+1,Et.getLength()-1);Et.insertEmbed(tn,"divider",!0,Je.sources.USER),setTimeout(()=>Et.setSelection(Math.min(tn+1,Et.getLength()-1),0,Je.sources.SILENT),0)}}}}}),[ne,F,E,Oe]),Kt=N.useMemo(()=>_e?rn():Bt(),[_e,rn,Bt]),vt=N.useCallback(we=>{if(!we)return;const se=we.getEditor();if(!se)return;const ze=se.root,et=Wt(we);ze&&z&&ze.classList.add(...z.split(" ")),ze&&V&&Object.entries(V).forEach(([At,tn])=>{const qt=At.replaceAll(/([A-Z])/g,nn=>`-${nn[0].toLowerCase()}`);ze.style.setProperty(qt,String(tn))}),dn(ze,"keydown",At=>jt(At,se));const Et=new ResizeObserver(xn);if(et){Et.observe(et),$e.current.push(()=>Et.disconnect());const At=["header","color","background"];At.forEach(tn=>{const qt=et.querySelector(`.ql-${tn} .ql-picker-label`);qt&&dn(qt,"click",()=>Gt(At,se,et))})}},[Wt,z,V,dn,xn,jt,Gt]),kt=N.useCallback(we=>{if($e.current.forEach(ze=>ze()),$e.current=[],nt.current=we,!we){tg.isFunction(t)?t(null):t!=null&&t.current&&(t.current=null);return}const se=we;se.copyContent=ze=>{we.getEditor().getModule("copy").copyContent(ze)},tg.isFunction(t)?t(se):t&&(t.current=se),vt(we)},[t,vt]),Ft=N.useCallback(()=>M.jsx(Xz,{htmlDelta:We,isReadonly:ne,limit:G*a1.KB,noTransition:Ge,useError:i}),[We,ne,Ge,G,i]);return M.jsx(lg,{wrapId:U,...Z,helperText:M.jsx(N.Activity,{mode:P==="Bottom"?"visible":"hidden",children:Ft()}),wrapProps:{...Y,style:{...Y==null?void 0:Y.style,height:w?"fit-content":"100%"}},label:M.jsxs(vl,{style:{gap:4},children:[Z.label,M.jsx(N.Activity,{mode:P==="Top"?"visible":"hidden",children:Ft()})]}),labelProps:{...de,style:{minHeight:Z.label?20:void 0,marginBottom:Z.label?4:0,...de==null?void 0:de.style}},children:M.jsxs(Wi,{...te,className:wt.clsx(te.className,vd.AEditorContainer,Ge),style:{...h,height:Me,minHeight:Ne,maxHeight:Re},children:[M.jsx(Ov,{...u,ref:kt,preserveWhitespace:!0,className:wt.clsx(u==null?void 0:u.className,vd.AEditor,vd[Oe],_e&&"Title",Ge),modules:Kt,placeholder:o,readOnly:ne,theme:"snow",value:We,style:{...u==null?void 0:u.style,"--editor-padding":_e?"8px 12px":"12px","--title-color-picker-row":_e?1:4,"--icon-size":`${E==="Med"?20:24}px`,"--toolbar-padding":`${E==="Med"?7.5:12.5}px`,"--title-header-font-size":`${E==="Med"?12:14}px`,"--edit-text":`'${Dr.AEditor.Edit}'`,"--save-text":`'${Dr.AEditor.Save}'`,"--remove-text":`'${Dr.AEditor.Remove}'`,"--default-text":`'${Dr.AEditor.Default}'`,"--visit-url-text":`'${Dr.AEditor["Visit URL:"]}'`,"--enter-link-text":`'${Dr.AEditor["Enter link:"]}'`,"--enter-video-text":`'${Dr.AEditor["Enter video:"]}'`,"--arrow-background":`url("data:image/svg+xml,${encodeURIComponent(l1.renderToString(M.jsx(uo,{icon:"EditorArrow"})))}`},onChange:zt}),M.jsx(Zz,{contentHeight:w,currentHeight:he,handleResizeStart:dt,isResizing:oe,noTransition:Ge,resizeRef:pe,resizerHeight:ce})]})})},Zz=n=>{const e=Bn.c(16),{contentHeight:t,resizeRef:r,noTransition:i,resizerHeight:o,handleResizeStart:l,currentHeight:a,isResizing:u}=n,h=t?"visible":"hidden";let b;e[0]!==u||e[1]!==i?(b=wt.clsx(vd.Resizer,u&&vd.Resizing,i,"Caption1"),e[0]=u,e[1]=i,e[2]=b):b=e[2];let x;e[3]!==a?(x=Math.round(a??0),e[3]=a,e[4]=x):x=e[4];const w=`${x}px`;let _;e[5]!==o?(_={height:o},e[5]=o,e[6]=_):_=e[6];let E;e[7]!==l||e[8]!==r||e[9]!==b||e[10]!==w||e[11]!==_?(E=M.jsx("button",{ref:r,className:b,"data-height":w,style:_,onMouseDown:l}),e[7]=l,e[8]=r,e[9]=b,e[10]=w,e[11]=_,e[12]=E):E=e[12];let R;return e[13]!==h||e[14]!==E?(R=M.jsx(N.Activity,{mode:h,children:E}),e[13]=h,e[14]=E,e[15]=R):R=e[15],R},Xz=n=>{const e=Bn.c(20),{htmlDelta:t,limit:r,useError:i,isReadonly:o,noTransition:l}=n,[a,u]=Do(i,!1),h=Yz.calculateTextSize(t);let b,x;if(e[0]!==h||e[1]!==r||e[2]!==u?(b=()=>u==null?void 0:u(h>r),x=[h,r,u],e[0]=h,e[1]=r,e[2]=u,e[3]=b,e[4]=x):(b=e[3],x=e[4]),N.useEffect(b,x),!i||o)return null;let w;e[5]!==l?(w=wt.clsx(vd.Limit,"NoSelect",l),e[5]=l,e[6]=w):w=e[6];let _;e[7]!==a?(_=wt.clsx(a&&vd.Error),e[7]=a,e[8]=_):_=e[8];let E;e[9]!==h?(E=kg(h),e[9]=h,e[10]=E):E=e[10];let R;e[11]!==_||e[12]!==E?(R=M.jsx("span",{className:_,children:E}),e[11]=_,e[12]=E,e[13]=R):R=e[13];let I;e[14]!==r?(I=kg(r),e[14]=r,e[15]=I):I=e[15];let P;return e[16]!==w||e[17]!==R||e[18]!==I?(P=M.jsxs(eh,{className:w,children:["(",R," / ",I,")"]}),e[16]=w,e[17]=R,e[18]=I,e[19]=P):P=e[19],P};function Kz(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return N.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const Bv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function P1(n){const e=Object.prototype.toString.call(n);return e==="[object Window]"||e==="[object global]"}function t2(n){return"nodeType"in n}function cf(n){var e,t;return n?P1(n)?n:t2(n)&&(e=(t=n.ownerDocument)==null?void 0:t.defaultView)!=null?e:window:window}function n2(n){const{Document:e}=cf(n);return n instanceof e}function Zp(n){return P1(n)?!1:n instanceof cf(n).HTMLElement}function M4(n){return n instanceof cf(n).SVGElement}function D1(n){return n?P1(n)?n.document:t2(n)?n2(n)?n:Zp(n)||M4(n)?n.ownerDocument:document:document:document}const ih=Bv?N.useLayoutEffect:N.useEffect;function r2(n){const e=N.useRef(n);return ih(()=>{e.current=n}),N.useCallback(function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function Jz(){const n=N.useRef(null),e=N.useCallback((r,i)=>{n.current=setInterval(r,i)},[]),t=N.useCallback(()=>{n.current!==null&&(clearInterval(n.current),n.current=null)},[]);return[e,t]}function Fp(n,e){e===void 0&&(e=[n]);const t=N.useRef(n);return ih(()=>{t.current!==n&&(t.current=n)},e),t}function Xp(n,e){const t=N.useRef();return N.useMemo(()=>{const r=n(t.current);return t.current=r,r},[...e])}function vv(n){const e=r2(n),t=N.useRef(null),r=N.useCallback(i=>{i!==t.current&&(e==null||e(i,t.current)),t.current=i},[]);return[t,r]}function cm(n){const e=N.useRef();return N.useEffect(()=>{e.current=n},[n]),e.current}let Ob={};function Kp(n,e){return N.useMemo(()=>{if(e)return e;const t=Ob[n]==null?0:Ob[n]+1;return Ob[n]=t,n+"-"+t},[n,e])}function L4(n){return function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return r.reduce((o,l)=>{const a=Object.entries(l);for(const[u,h]of a){const b=o[u];b!=null&&(o[u]=b+n*h)}return o},{...e})}}const b1=L4(1),bv=L4(-1);function Qz(n){return"clientX"in n&&"clientY"in n}function i2(n){if(!n)return!1;const{KeyboardEvent:e}=cf(n.target);return e&&n instanceof e}function qz(n){if(!n)return!1;const{TouchEvent:e}=cf(n.target);return e&&n instanceof e}function um(n){if(qz(n)){if(n.touches&&n.touches.length){const{clientX:e,clientY:t}=n.touches[0];return{x:e,y:t}}else if(n.changedTouches&&n.changedTouches.length){const{clientX:e,clientY:t}=n.changedTouches[0];return{x:e,y:t}}}return Qz(n)?{x:n.clientX,y:n.clientY}:null}const Bp=Object.freeze({Translate:{toString(n){if(!n)return;const{x:e,y:t}=n;return"translate3d("+(e?Math.round(e):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(n){if(!n)return;const{scaleX:e,scaleY:t}=n;return"scaleX("+e+") scaleY("+t+")"}},Transform:{toString(n){if(n)return[Bp.Translate.toString(n),Bp.Scale.toString(n)].join(" ")}},Transition:{toString(n){let{property:e,duration:t,easing:r}=n;return e+" "+t+"ms "+r}}}),Nw="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function jz(n){return n.matches(Nw)?n:n.querySelector(Nw)}const $z={display:"none"};function eH(n){let{id:e,value:t}=n;return N.createElement("div",{id:e,style:$z},t)}function tH(n){let{id:e,announcement:t,ariaLiveType:r="assertive"}=n;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return N.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},t)}function nH(){const[n,e]=N.useState("");return{announce:N.useCallback(r=>{r!=null&&e(r)},[]),announcement:n}}const O4=N.createContext(null);function rH(n){const e=N.useContext(O4);N.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(n)},[n,e])}function iH(){const[n]=N.useState(()=>new Set),e=N.useCallback(r=>(n.add(r),()=>n.delete(r)),[n]);return[N.useCallback(r=>{let{type:i,event:o}=r;n.forEach(l=>{var a;return(a=l[i])==null?void 0:a.call(l,o)})},[n]),e]}const oH={draggable:`
|
|
480
|
+
`,attributes:{[je.tableCellInner]:u}}),new P0(h)}handleBorderNoneStyles(t,r){if(!(r!=null&&r.style))return;["border",...["top","right","bottom","left"].flatMap(o=>[`border-${o}`,`border-${o}-style`])].filter(o=>t.style[o]==="none").forEach(o=>r.style=r.style.replaceAll(new RegExp(`${o}:none;?`,"g"),""))}convert({html:t,text:r},i={}){if(t){const a=new DOMParser().parseFromString(t,"text/html");this.preprocessTableHtml(a),this.mergeClassStylesToInline(a),t=a.body.innerHTML}const o=super.convert({html:t,text:r},i);if(i[je.tableCellInner])for(const l of o.ops){if(tg.isObject(l.insert)&&l.insert[je.tableCol]){l.insert="";continue}l.attributes||(l.attributes={}),l.attributes[je.tableCellInner]=i[je.tableCellInner]}return o}parseStyleWithFilter(t,r){if(!t)return{};const i={};let o="",l="",a=!0,u=0;for(let h=0;h<t.length;h++){const b=t[h];b===":"&&a?(o=t.substring(u,h).trim(),u=h+1,a=!1):b===";"&&(!a&&o&&(l=t.substring(u,h).trim(),(!r||r(o))&&(i[o]=l)),u=h+1,a=!0)}return!a&&o&&u<t.length&&(l=t.substring(u).trim(),(!r||r(o))&&(i[o]=l)),i}mergeClassStylesToInline(t){var r;try{const i=t.querySelectorAll("td[class], th[class]");if(i.length===0)return;const o=new Set;for(const b of i)(b.getAttribute("class")||"").split(/\s+/).filter(Boolean).forEach(w=>o.add(w));if(o.size===0)return;const l=t.querySelectorAll("style");if(l.length===0)return;const a=Array.from(l).map(b=>b.textContent||"").join("");if(!a)return;const u={},h=b=>this.STYLE_PROPERTIES.some(x=>b.startsWith(x));for(const b of o){const x=new RegExp(`\\.${b}[^{]*{([^}]*)}`,"g");let w;for(;(w=x.exec(a))!==null;){const _=w[1],E=this.parseStyleWithFilter(_),R={};let I=!1;for(const P in E)h(P)&&(R[P]=E[P],I=!0);I&&(u[b]=R)}}if(Object.keys(u).length===0)return;for(let b=0;b<i.length;b++){const x=i[b],w=((r=x.getAttribute("class"))==null?void 0:r.split(/\s+/).filter(Boolean))||[],_=x.getAttribute("style")||"",E=this.parseStyleWithFilter(_);let R=!1;for(const I of w){const P=u[I];if(P)for(const O in P)E[O]||(E[O]=P[O],R=!0)}if(R){let I="";for(const P in E)I+=P+":"+E[P]+";";I&&x.setAttribute("style",I)}x.removeAttribute("class")}}catch(i){console.error("스타일 처리 오류",i)}}matchCaption(t,r){for(let i=0;i<r.ops.length;i++){const o=r.ops[i],{attributes:l}=o;l&&l[je.tableCaption]&&(l[je.tableCaption].tableId=this.tableId,o.attributes=l)}return r}preprocessTableHtml(t){try{const r=t.querySelectorAll("table");for(const i of Array.from(r))i.querySelectorAll("tr").length!==0&&(this.cleanupTableStyles(i),this.applyRowspanHeights(i),this.fixRowspanCells(i));this.mergeClassStylesToInline(t)}catch(r){console.error("테이블 전처리 오류",r)}}cleanupTableStyles(t){const r=t.querySelectorAll("td, th, tr, colgroup");for(const i of r){const o=i;o.removeAttribute("height");const l=o.getAttribute("style");if(l){const a=l.replace(/height\s*:[^;]*;?/gi,"").trim();o.setAttribute("style",a||"")}}}applyRowspanHeights(t){const i=t.querySelectorAll("td, th");t.style.borderCollapse="collapse";for(const o of i){const l=o,u=parseInt(l.getAttribute("rowspan")||"1")*24,h=l.getAttribute("style")||"",b=h+(h?"; ":"")+`height: ${u}px`;l.setAttribute("style",b)}}fixRowspanCells(t){const r=t.querySelectorAll("tr");if(r.length<=1)return;const i=[],o=new Map;for(let l=0;l<r.length;l++){const u=r[l].querySelectorAll("td, th");if(u.length===0&&l<r.length-1){i.push(l);continue}for(const h of Array.from(u)){const b=parseInt(h.getAttribute("rowspan")||"1");if(b>1)for(let x=1;x<b;x++){const w=l+x;if(w>=r.length)break;o.has(w)||o.set(w,[]),o.get(w).push(h)}}}i.length>0&&this.processEmptyRows(i,r,o)}processEmptyRows(t,r,i){for(const o of t){const l=i.get(o);if(l)for(const a of l){const u=parseInt(a.getAttribute("rowspan")||"1");u>1&&a.setAttribute("rowspan",(u-1).toString())}}for(const o of t.reverse())r[o].remove()}}class Gz extends R4{fixUnusuaDeletelTable(){}mergeCells(e){if(!this.table||!this.tableSelection)return;const t=this.tableSelection.selectedTds||[];if(t.length>1&&(e=t),!e||e.length<=1)return;const r=Kl(e[0],je.tableMain),i=r.getRows(),o=e.map(w=>{if(!w||!w.parent||!w.parent.domNode)return null;const _=w.parent.domNode;if(!_)return null;const E=i.findIndex(P=>P.rowId===w.rowId);if(E===-1)return null;const R=w.getColumnIndex();if(R===-1)return null;const I=_.getBoundingClientRect();return!I||I.width===0||I.height===0?null:{td:w,rowIndex:E,colIndex:R,rowspan:w.rowspan,colspan:w.colspan,visualLeft:I.left,visualRight:I.right,visualTop:I.top,visualBottom:I.bottom}}).filter(Boolean);if(o.length<=1)return;o.sort((w,_)=>w.visualTop-_.visualTop||w.visualLeft-_.visualLeft);const l=o[0],a=l.td,u=Math.max(...o.map(w=>w.rowIndex+w.rowspan-1)),h=Math.max(...o.map(w=>w.colIndex+w.colspan-1)),b=u-l.rowIndex+1,x=h-l.colIndex+1;for(const w of o)w.td!==a&&(w.td.moveChildren(a),w.td.parent.remove());a.rowspan=b,a.colspan=x,this.fixTableByRemove(r)}}km.setConfig({ADD_TAGS:["iframe"]});km.addHook("uponSanitizeAttribute",(n,e)=>{n.tagName==="IFRAME"&&(e.attrName==="src"||e.attrName==="class"||e.attrName==="frameborder"||e.attrName==="allowfullscreen")&&(e.keepAttr=!0)});Je.register({"modules/imageCompress":Dp,"modules/resize":k4,"modules/tableUp":Gz,"modules/magicUrl":mF,"formats/divider":sm,"modules/clipboard":Uz,"modules/copy":wz,"modules/toggleFullscreen":l4},!0);const a1={KB:1024,QUALITY:.7,IMAGE_SIZES:new Map},Yz={getCharLength:n=>Array.from(n).length,calculateTextSize:n=>{if(!n.ops||n.ops.length===0)return 0;let e=0;for(const t of n.ops)if(typeof t.insert=="string")e+=new TextEncoder().encode(t.insert).length-1;else if(typeof t.insert=="object"&&t.insert.image){const r=t.insert.image;r&&(e+=a1.IMAGE_SIZES.get(r)||Math.ceil(r.length*a1.QUALITY))}return e}},Vz=n=>{const{type:e="Primary",editorRef:t,useValue:r,useError:i,placeholder:o,tabIndex:l,autoFocus:a,editorProps:u,style:h,minHeight:b,maxHeight:x,contentHeight:w,contentMaxHeight:_=1e3,toolbarSize:E="Med",toolbarType:R="Default",readOnly:I,limitPosition:P="Bottom",maxLength:O,size:G=100,editorClassName:z,editorStyle:V,noImageResize:F,...ee}=n,[{wrapId:U,wrapProps:Y,labelProps:de,...Z},te]=Fg(ee),ne=N.useMemo(()=>e==="ReadOnly"||I,[e,I]),ce=N.useMemo(()=>w?20:0,[w]),[ae,$]=N.useState(E==="Med"?40:50),ie=N.useMemo(()=>ne||e==="Raw"?0:ae,[e,ne,ae]),[he,be]=N.useState(w),[oe,Q]=N.useState(!1),pe=N.useRef(null),Ae=N.useRef(0),Pe=N.useRef(0),_e=N.useMemo(()=>R==="Title",[R]),Me=N.useMemo(()=>{let we;return b&&x||e==="Raw"?we=void 0:we=0,he?he+ie:we},[b,x,e,he,ie]),Ne=N.useMemo(()=>{const we=[b,w].filter(se=>se!=null);return we.length?Math.min(...we):void 0},[b,w]),Re=N.useMemo(()=>x??"100%",[x]),Oe=N.useMemo(()=>(Array.isArray(Z.errorMessage)?Z.errorMessage.some(Boolean):!!Z.errorMessage)?"Error":e,[Z.errorMessage,e]),Le=N.useCallback(we=>{const se=km.sanitize(we),ze=document.createElement("div");return ze.innerHTML=se,new Je(ze,{readOnly:!0}).getContents()},[]),[Xe,Ye]=Do(r,""),[We,ot]=N.useState(()=>Le(Xe));N.useEffect(()=>{Ye===void 0&&ot(Le(Xe))},[Le,Ye,Xe]);const nt=N.useRef(null),$e=N.useRef([]),[Ge,_t]=N.useState("NoTransition");N.useEffect(()=>{const we=setTimeout(()=>_t(""),0);return()=>{clearTimeout(we),$e.current.forEach(se=>se()),$e.current=[]}},[]);const ct=N.useCallback((we,se)=>{if(!w)return se;const et=Math.max(b??w,0);return Math.min(x??_,Math.max(et,se+we))},[w,b,x,_]),ft=N.useCallback(we=>{if(!oe||!w)return;const se=we.clientY-Pe.current,ze=ct(se,Ae.current);he!==ze&&be(ze),we.preventDefault(),we.stopPropagation()},[oe,w,ct,he]),St=N.useCallback(we=>{Q(!1),document.removeEventListener("mousemove",ft),document.removeEventListener("mouseup",St),we.preventDefault(),we.stopPropagation()},[ft]),dt=N.useCallback(we=>{if(!w)return;if(we.detail===2){be(w);return}he?Ae.current=he:(be(w),Ae.current=w),Q(!0),Pe.current=we.clientY;const se=et=>{if(!w)return;const Et=et.clientY-Pe.current,At=ct(Et,Ae.current);be(At),et.preventDefault(),et.stopPropagation()},ze=et=>{Q(!1),document.removeEventListener("mousemove",se),document.removeEventListener("mouseup",ze),et.preventDefault(),et.stopPropagation()};document.addEventListener("mousemove",se),document.addEventListener("mouseup",ze),we.preventDefault(),we.stopPropagation()},[ct,he,w]),zt=N.useCallback((we,se,ze,et)=>{if(ze!=="user"&&ze!=="api")return;const Et=et.getContents(),At=et.getLength()-1,tn=O!==void 0&&At>O,qt=Rn=>Rn.replaceAll(/\s{2,}/g,yn=>" ".repeat(yn.length)),nn=we.replace(/^<p><br><\/p>$/,"").trim(),pn=qt(nn);if(!tn){ot(Et),Ye==null||Ye(pn);return}const on=ln(Et,O);ot(on);const On=new Je(document.createElement("div"));On.setContents(on);const Pn=qt(On.root.innerHTML.replace(/^<p><br><\/p>$/,"").trim());Ye==null||Ye(Pn)},[O,Ye]),ln=(we,se)=>{var Et,At,tn;if(!we.ops)return we;const ze=new Xn;let et=0;for(const qt of we.ops){if(et>=se)break;if(qt.insert&&typeof qt.insert=="string"){const nn=qt.insert,pn=se-et;if(nn.length<=pn)(Et=ze.ops)==null||Et.push(qt),et+=nn.length;else{const on={...qt,insert:nn.substring(0,pn)};(At=ze.ops)==null||At.push(on);break}}else et<se&&((tn=ze.ops)==null||tn.push(qt),et+=1)}return ze},Wt=N.useCallback(we=>{var Et,At;const se=we.getEditor().container;if(!se)return null;const ze=(Et=se.closest(".AEditorContainer"))==null?void 0:Et.querySelector(".ql-toolbar");return ze||((At=se.parentElement)==null?void 0:At.querySelector(".ql-toolbar"))||null},[]),dn=N.useCallback((we,se,ze,et)=>{if(!we)return;const Et=ze;we.addEventListener(se,Et,et),$e.current.push(()=>we.removeEventListener(se,Et,et))},[]),Gt=N.useCallback((we,se,ze)=>{const et=se.getFormat();we.forEach(Et=>{if(et[Et]){const At=et[Et],tn=`.ql-${Et}`,qt=ze.querySelector(`${tn} .ql-picker-label`),nn=ze.querySelectorAll(`${tn} .ql-picker-item`),pn=Array.from(nn).find(on=>on.dataset.value===At);pn&&(pn.classList.add("ql-selected"),qt==null||qt.classList.add("ql-active"))}})},[]),xn=N.useCallback(we=>{if(!we.length)return;const et=we[0].target.getBoundingClientRect(),Et=Math.ceil(et.height);$(At=>Math.abs(At-Et)<.1?At:Et)},[]),jt=N.useCallback((we,se)=>{if(we.key!=="Backspace")return;const ze=se.getSelection(!1);if(!ze||ze.length>0)return;const et=ze.index;if(et<=0)return;const[Et]=se.getLine(et);if(Et&&et===se.getIndex(Et)||se.getFormat(et,1).link)return;const At=se.getFormat(et-1,1);if(At.link){we.preventDefault();let tn=et-1;for(;tn>0&&se.getFormat(tn-1,1).link===At.link;)tn--;const[qt]=se.scroll.descendant(nn=>{var pn;return((pn=nn==null?void 0:nn.statics)==null?void 0:pn.blotName)==="link"},tn);if(qt!=null&&qt.domNode){const nn=(qt.domNode.textContent||"").length;se.removeFormat(tn,nn)}}},[]),rn=N.useCallback(()=>({clipboard:{matchers:[["img",()=>!1],["table",()=>!1],["iframe",()=>!1],["video",()=>!1],["h1, h2, h3, h4, h5, h6",()=>!1],["blockquote",()=>!1],["hr",()=>!1]]},copy:{isTitleMode:!0},keyboard:{bindings:{enter:{key:"Enter",handler:()=>!1},newline:{key:"Enter",shiftKey:!0,handler:()=>!1},tab:{key:"Tab",handler:()=>!1},"remove-newline":{key:"Backspace",collapsed:!0,format:["blockquote","list","code-block"],offset:0,handler:function(we){const{blockquote:se,list:ze,["code-block"]:et}=we.getFormat();return se||ze||et?(we.format("blockquote",!1),we.format("list",!1),we.format("code-block",!1),!1):!0}}}},magicUrl:!0,toolbar:{container:[["bold","italic","underline","strike",{color:[]},{background:[]},"clean"]]}}),[]),Bt=N.useCallback(()=>({clipboard:{},copy:{},keyboard:{},magicUrl:!0,toggleFullscreen:{type:Oe,maximize:l1.renderToString(M.jsx(uo,{icon:"Maximize",size:E==="Med"?"sm":"md"})),minimize:l1.renderToString(M.jsx(uo,{icon:"Minimize",size:E==="Med"?"sm":"md"}))},imageCompress:{quality:a1.QUALITY,imageType:"image/jpeg",maxWidth:1500,maxHeight:1500,debug:!1,handleOnPaste:we=>{var se,ze;try{const et=(se=we.clipboardData)==null?void 0:se.items;if(!et)return!0;const Et=Array.from(et).some(qt=>{const nn=qt.type.toLowerCase();return nn.includes("Excel")||nn.includes("text/html")}),At=(ze=we.clipboardData)==null?void 0:ze.getData("text/html"),tn=At&&(At.includes("<table")||At.includes("<tbody")||At.includes("<td"));return!(Et||tn)}catch(et){return console.warn("Error in handleOnPaste:",et),!0}},insertIntoEditor:(we,se,ze)=>{a1.IMAGE_SIZES.has(we)||a1.IMAGE_SIZES.set(we,se.size);const et=ze.getSelection();et&&ze.insertEmbed(et.index,"image",we,Je.sources.USER)}},...!ne&&{...!F&&{resize:{}},table:!1,tableUp:{fullSwitch:!1,icon:l1.renderToString(M.jsx(uo,{icon:"Table",size:E==="Med"?"sm":"md",strokeWidth:2.5})),resize:rz,resizeScale:iz,customSelect:fz,selection:lz,fixUnusuaDeletelTable:!1,selectionOptions:{tableMenu:tz,tableMenuOptions:{localstorageKey:"used-color",tipText:!0,tools:[io.InsertCaption,io.InsertTop,io.InsertRight,io.InsertBottom,io.InsertLeft,io.Break,io.MergeCell,io.SplitCell,io.Break,io.DeleteRow,io.DeleteColumn,io.DeleteTable,io.Break,io.BackgroundColor,io.BorderColor,io.Break,io.CopyCell,io.CutCell,io.Break,io.SwitchWidth]}},texts:{fullCheckboxText:Dr.AEditor["Insert Full Width Table"],customBtnText:Dr.AEditor.Custom,confirmText:Dr.AEditor.Confirm,cancelText:Dr.AEditor.Cancel,rowText:Dr.AEditor.Row,colText:Dr.AEditor.Column,CopyCell:Dr.AEditor["Copy Cell"],CutCell:Dr.AEditor["Cut Cell"],notPositiveNumberError:Dr.AEditor["Not Positive Number Error"],custom:Dr.AEditor.Custom,clear:Dr.AEditor.Clear,transparent:Dr.AEditor.Transparent,perWidthInsufficient:Dr.AEditor.perWidthInsufficient,InsertTop:Dr.AEditor["Insert Row Top"],InsertRight:Dr.AEditor["Insert Column Right"],InsertBottom:Dr.AEditor["Insert Row Bottom"],InsertLeft:Dr.AEditor["Insert Column Left"],MergeCell:Dr.AEditor["Merge Cell"],SplitCell:Dr.AEditor["Split Cell"],DeleteRow:Dr.AEditor["Delete Row"],DeleteColumn:Dr.AEditor["Delete Column"],DeleteTable:Dr.AEditor["Delete Table"],BackgroundColor:Dr.AEditor["Set Background Color"],BorderColor:Dr.AEditor["Set Border Color"],SwitchWidth:Dr.AEditor["Switch Table Width"],InsertCaption:Dr.AEditor["Insert Table Caption"]}},toolbar:{container:[[{header:[1,2,3,!1,4]}],["bold","italic","underline","strike","blockquote","divider",{[R4.toolName]:[]},{color:[]},{background:[]}],[{list:"ordered"},{list:"bullet"},{indent:"-1"},{indent:"+1"},{align:[]}],["link","image","video"],["clean"]],handlers:{divider:(we,se,ze,et)=>{const Et=et,At=Et.getSelection(!0);if(!At)return;const tn=Math.min(At.index+1,Et.getLength()-1);Et.insertEmbed(tn,"divider",!0,Je.sources.USER),setTimeout(()=>Et.setSelection(Math.min(tn+1,Et.getLength()-1),0,Je.sources.SILENT),0)}}}}}),[ne,F,E,Oe]),Kt=N.useMemo(()=>_e?rn():Bt(),[_e,rn,Bt]),vt=N.useCallback(we=>{if(!we)return;const se=we.getEditor();if(!se)return;const ze=se.root,et=Wt(we);ze&&z&&ze.classList.add(...z.split(" ")),ze&&V&&Object.entries(V).forEach(([At,tn])=>{const qt=At.replaceAll(/([A-Z])/g,nn=>`-${nn[0].toLowerCase()}`);ze.style.setProperty(qt,String(tn))}),dn(ze,"keydown",At=>jt(At,se));const Et=new ResizeObserver(xn);if(et){Et.observe(et),$e.current.push(()=>Et.disconnect());const At=["header","color","background"];At.forEach(tn=>{const qt=et.querySelector(`.ql-${tn} .ql-picker-label`);qt&&dn(qt,"click",()=>Gt(At,se,et))})}},[Wt,z,V,dn,xn,jt,Gt]),kt=N.useCallback(we=>{if($e.current.forEach(ze=>ze()),$e.current=[],nt.current=we,!we){tg.isFunction(t)?t(null):t!=null&&t.current&&(t.current=null);return}const se=we;se.copyContent=ze=>{we.getEditor().getModule("copy").copyContent(ze)},tg.isFunction(t)?t(se):t&&(t.current=se),vt(we)},[t,vt]),Ft=N.useCallback(()=>M.jsx(Xz,{htmlDelta:We,isReadonly:ne,limit:G*a1.KB,noTransition:Ge,useError:i}),[We,ne,Ge,G,i]);return M.jsx(lg,{wrapId:U,...Z,helperText:M.jsx(N.Activity,{mode:P==="Bottom"?"visible":"hidden",children:Ft()}),wrapProps:{...Y,style:{...Y==null?void 0:Y.style,height:w?"fit-content":"100%"}},label:M.jsxs(vl,{style:{gap:4},children:[Z.label,M.jsx(N.Activity,{mode:P==="Top"?"visible":"hidden",children:Ft()})]}),labelProps:{...de,style:{minHeight:Z.label?20:void 0,marginBottom:Z.label?4:0,...de==null?void 0:de.style}},children:M.jsxs(Wi,{...te,className:wt.clsx(te.className,vd.AEditorContainer,Ge),style:{...h,height:Me,minHeight:Ne,maxHeight:Re},children:[M.jsx(Ov,{...u,ref:kt,preserveWhitespace:!0,className:wt.clsx(u==null?void 0:u.className,vd.AEditor,vd[Oe],_e&&"Title",Ge),modules:Kt,placeholder:o,readOnly:ne,theme:"snow",value:We,style:{...u==null?void 0:u.style,"--editor-padding":_e?"8px 12px":"12px","--title-color-picker-row":_e?1:4,"--icon-size":`${E==="Med"?20:24}px`,"--toolbar-padding":`${E==="Med"?7.5:12.5}px`,"--title-header-font-size":`${E==="Med"?12:14}px`,"--edit-text":`'${Dr.AEditor.Edit}'`,"--save-text":`'${Dr.AEditor.Save}'`,"--remove-text":`'${Dr.AEditor.Remove}'`,"--default-text":`'${Dr.AEditor.Default}'`,"--visit-url-text":`'${Dr.AEditor["Visit URL:"]}'`,"--enter-link-text":`'${Dr.AEditor["Enter link:"]}'`,"--enter-video-text":`'${Dr.AEditor["Enter video:"]}'`,"--arrow-background":`url("data:image/svg+xml,${encodeURIComponent(l1.renderToString(M.jsx(uo,{icon:"EditorArrow"})))}`},onChange:zt}),M.jsx(Zz,{contentHeight:w,currentHeight:he,handleResizeStart:dt,isResizing:oe,noTransition:Ge,resizeRef:pe,resizerHeight:ce})]})})},Zz=n=>{const e=Bn.c(16),{contentHeight:t,resizeRef:r,noTransition:i,resizerHeight:o,handleResizeStart:l,currentHeight:a,isResizing:u}=n,h=t?"visible":"hidden";let b;e[0]!==u||e[1]!==i?(b=wt.clsx(vd.Resizer,u&&vd.Resizing,i,"Caption1"),e[0]=u,e[1]=i,e[2]=b):b=e[2];let x;e[3]!==a?(x=Math.round(a??0),e[3]=a,e[4]=x):x=e[4];const w=`${x}px`;let _;e[5]!==o?(_={height:o},e[5]=o,e[6]=_):_=e[6];let E;e[7]!==l||e[8]!==r||e[9]!==b||e[10]!==w||e[11]!==_?(E=M.jsx("button",{ref:r,className:b,"data-height":w,style:_,onMouseDown:l}),e[7]=l,e[8]=r,e[9]=b,e[10]=w,e[11]=_,e[12]=E):E=e[12];let R;return e[13]!==h||e[14]!==E?(R=M.jsx(N.Activity,{mode:h,children:E}),e[13]=h,e[14]=E,e[15]=R):R=e[15],R},Xz=n=>{const e=Bn.c(20),{htmlDelta:t,limit:r,useError:i,isReadonly:o,noTransition:l}=n,[a,u]=Do(i,!1),h=Yz.calculateTextSize(t);let b,x;if(e[0]!==h||e[1]!==r||e[2]!==u?(b=()=>u==null?void 0:u(h>r),x=[h,r,u],e[0]=h,e[1]=r,e[2]=u,e[3]=b,e[4]=x):(b=e[3],x=e[4]),N.useEffect(b,x),!i||o)return null;let w;e[5]!==l?(w=wt.clsx(vd.Limit,"NoSelect",l),e[5]=l,e[6]=w):w=e[6];let _;e[7]!==a?(_=wt.clsx(a&&vd.Error),e[7]=a,e[8]=_):_=e[8];let E;e[9]!==h?(E=kg(h),e[9]=h,e[10]=E):E=e[10];let R;e[11]!==_||e[12]!==E?(R=M.jsx("span",{className:_,children:E}),e[11]=_,e[12]=E,e[13]=R):R=e[13];let I;e[14]!==r?(I=kg(r),e[14]=r,e[15]=I):I=e[15];let P;return e[16]!==w||e[17]!==R||e[18]!==I?(P=M.jsxs(eh,{className:w,children:["(",R," / ",I,")"]}),e[16]=w,e[17]=R,e[18]=I,e[19]=P):P=e[19],P};function Kz(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return N.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const Bv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function P1(n){const e=Object.prototype.toString.call(n);return e==="[object Window]"||e==="[object global]"}function t2(n){return"nodeType"in n}function cf(n){var e,t;return n?P1(n)?n:t2(n)&&(e=(t=n.ownerDocument)==null?void 0:t.defaultView)!=null?e:window:window}function n2(n){const{Document:e}=cf(n);return n instanceof e}function Zp(n){return P1(n)?!1:n instanceof cf(n).HTMLElement}function M4(n){return n instanceof cf(n).SVGElement}function D1(n){return n?P1(n)?n.document:t2(n)?n2(n)?n:Zp(n)||M4(n)?n.ownerDocument:document:document:document}const ih=Bv?N.useLayoutEffect:N.useEffect;function r2(n){const e=N.useRef(n);return ih(()=>{e.current=n}),N.useCallback(function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function Jz(){const n=N.useRef(null),e=N.useCallback((r,i)=>{n.current=setInterval(r,i)},[]),t=N.useCallback(()=>{n.current!==null&&(clearInterval(n.current),n.current=null)},[]);return[e,t]}function Fp(n,e){e===void 0&&(e=[n]);const t=N.useRef(n);return ih(()=>{t.current!==n&&(t.current=n)},e),t}function Xp(n,e){const t=N.useRef();return N.useMemo(()=>{const r=n(t.current);return t.current=r,r},[...e])}function vv(n){const e=r2(n),t=N.useRef(null),r=N.useCallback(i=>{i!==t.current&&(e==null||e(i,t.current)),t.current=i},[]);return[t,r]}function cm(n){const e=N.useRef();return N.useEffect(()=>{e.current=n},[n]),e.current}let Ob={};function Kp(n,e){return N.useMemo(()=>{if(e)return e;const t=Ob[n]==null?0:Ob[n]+1;return Ob[n]=t,n+"-"+t},[n,e])}function L4(n){return function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return r.reduce((o,l)=>{const a=Object.entries(l);for(const[u,h]of a){const b=o[u];b!=null&&(o[u]=b+n*h)}return o},{...e})}}const b1=L4(1),bv=L4(-1);function Qz(n){return"clientX"in n&&"clientY"in n}function i2(n){if(!n)return!1;const{KeyboardEvent:e}=cf(n.target);return e&&n instanceof e}function qz(n){if(!n)return!1;const{TouchEvent:e}=cf(n.target);return e&&n instanceof e}function um(n){if(qz(n)){if(n.touches&&n.touches.length){const{clientX:e,clientY:t}=n.touches[0];return{x:e,y:t}}else if(n.changedTouches&&n.changedTouches.length){const{clientX:e,clientY:t}=n.changedTouches[0];return{x:e,y:t}}}return Qz(n)?{x:n.clientX,y:n.clientY}:null}const Bp=Object.freeze({Translate:{toString(n){if(!n)return;const{x:e,y:t}=n;return"translate3d("+(e?Math.round(e):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(n){if(!n)return;const{scaleX:e,scaleY:t}=n;return"scaleX("+e+") scaleY("+t+")"}},Transform:{toString(n){if(n)return[Bp.Translate.toString(n),Bp.Scale.toString(n)].join(" ")}},Transition:{toString(n){let{property:e,duration:t,easing:r}=n;return e+" "+t+"ms "+r}}}),Nw="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function jz(n){return n.matches(Nw)?n:n.querySelector(Nw)}const $z={display:"none"};function eH(n){let{id:e,value:t}=n;return N.createElement("div",{id:e,style:$z},t)}function tH(n){let{id:e,announcement:t,ariaLiveType:r="assertive"}=n;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return N.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},t)}function nH(){const[n,e]=N.useState("");return{announce:N.useCallback(r=>{r!=null&&e(r)},[]),announcement:n}}const O4=N.createContext(null);function rH(n){const e=N.useContext(O4);N.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(n)},[n,e])}function iH(){const[n]=N.useState(()=>new Set),e=N.useCallback(r=>(n.add(r),()=>n.delete(r)),[n]);return[N.useCallback(r=>{let{type:i,event:o}=r;n.forEach(l=>{var a;return(a=l[i])==null?void 0:a.call(l,o)})},[n]),e]}const oH={draggable:`
|
|
481
481
|
To pick up a draggable item, press the space bar.
|
|
482
482
|
While dragging, use the arrow keys to move the item.
|
|
483
483
|
Press space again to drop the item in its new position, or press escape to cancel.
|
package/dist/index.es.js
CHANGED
|
@@ -49234,10 +49234,9 @@ const f1 = {
|
|
|
49234
49234
|
shiftKey: !0,
|
|
49235
49235
|
handler: () => !1
|
|
49236
49236
|
},
|
|
49237
|
-
// Title 모드에서도 Tab은 브라우저/모달 기본 동작(포커스 이동)에 맡김
|
|
49238
49237
|
tab: {
|
|
49239
49238
|
key: "Tab",
|
|
49240
|
-
handler: () => !
|
|
49239
|
+
handler: () => !1
|
|
49241
49240
|
},
|
|
49242
49241
|
"remove-newline": {
|
|
49243
49242
|
key: "Backspace",
|
|
@@ -49266,15 +49265,7 @@ const f1 = {
|
|
|
49266
49265
|
}), []), zt = ut(() => ({
|
|
49267
49266
|
clipboard: {},
|
|
49268
49267
|
copy: {},
|
|
49269
|
-
|
|
49270
|
-
keyboard: {
|
|
49271
|
-
bindings: {
|
|
49272
|
-
tab: {
|
|
49273
|
-
key: "Tab",
|
|
49274
|
-
handler: () => !0
|
|
49275
|
-
}
|
|
49276
|
-
}
|
|
49277
|
-
},
|
|
49268
|
+
keyboard: {},
|
|
49278
49269
|
magicUrl: !0,
|
|
49279
49270
|
toggleFullscreen: {
|
|
49280
49271
|
type: Me,
|