jodit-pro
Version:
PRO Version of Jodit Editor
2 lines (1 loc) • 677 B
JavaScript
var u=Object.defineProperty;var m=(t,o)=>u(t,"name",{value:o,configurable:!0});import{throwIfAborted as d}from"../../core/abort-utils.js";import{Dom as g}from"jodit/esm/core/dom/index.js";async function w(t,o,c){const{start:i,end:l,aroundSelection:f}=o;d(c);let n=t.value;const r=n.length,h=typeof i=="number"?i:0;if(f&&!t.s.isCollapsed()){let e=t.s.range.commonAncestorContainer;for(;e&&e!==t.editor;){if(g.isElement(e)&&e.parentNode===t.editor){n=e.outerHTML;break}e=e.parentNode}return{html:n,length:r}}const a=l!==void 0?Math.min(l,r):r,s=Math.max(0,Math.min(h,r));return(s>0||a<r)&&(n=n.substring(s,a)),{html:n,length:r,start:s,end:a}}m(w,"execute");export{w as execute};