UNPKG

jodit-pro

Version:

PRO Version of Jodit Editor

2 lines (1 loc) 1.32 kB
var j=Object.defineProperty;var e=(d,t)=>j(d,"name",{value:t,configurable:!0});import{Dom as a}from"jodit/esm/core/dom/dom.js";import{css as u}from"jodit/esm/core/helpers/utils/css.js";const n=class n{static remove(t){a.safeRemove(t.container.querySelector(".jodit-ui-select-items")),t.j.e.off(t.container,"mousedown.uiselectitems touchstart.uiselectitems")}static install(t){const c=t.j.c.div("jodit-ui-select-items");t.j.e.on(t.container,"mousedown.uiselectitems touchstart.uiselectitems",this.onStartSelect.bind(this,t,c))}static onStartSelect(t,c,o){if(o.target!==t.container)return;u(c,{width:0,height:0}),t.container.appendChild(c);const i={x:o.clientX,y:o.clientY,w:t.container.offsetWidth,h:t.container.offsetHeight},s=t.j.async.throttle(this.onSelect.bind(this,t,c,i),t.j.defaultTimeout/10);t.j.lock(),t.j.e.on(t.j.ow,"mousemove touchmove",s).one(t.j.ow,"mouseup touchend",this.onEndSelect.bind(this,t,c,s)),t.onSelectItems({left:i.x,top:i.y,width:0,height:0})}static onSelect(t,c,o,i){const s=o.x>i.clientX?i.clientX:o.x,f=o.y>i.clientY?i.clientY:o.y,h={left:s,top:f,width:Math.abs(o.x-i.clientX),height:Math.abs(o.y-i.clientY)};u(c,h),t.onSelectItems(h)}static onEndSelect(t,c,o,i){a.safeRemove(c),t.j.e.off(t.j.ow,"mousemove touchmove",o),t.j.unlock()}};e(n,"UISelectItems");let r=n;export{r as UISelectItems};