jodit-pro
Version:
PRO Version of Jodit Editor
2 lines (1 loc) • 663 B
JavaScript
var m=Object.defineProperty;var r=(n,i)=>m(n,"name",{value:i,configurable:!0});import{realPixelIndent as a}from"./helpers.js";import{LEVEL_KEY as f}from"../constants.js";import{isPseudoLeaf as p}from"../element/index.js";function E(n){if(n.attributes[f]!==void 0)return;const i=[a(n)],l=[n];let e=n.next;for(;e;){if(e.isElement&&!e.attributes[f]&&p(e)){const t=a(e);t&&(i.push(t),l.push(e))}e=e.next}const d=Math.min(...i.filter(t=>t>0));let s=i.map(t=>Math.ceil(t/10));s.indexOf(0)!==-1&&(s=s.map(t=>t+1)),l.forEach((t,o)=>{t.attributes[f]=s[o],t.style.add("margin-left",`${Math.max(a(t)-s[o]*10/d*40,0)}px`)})}r(E,"calcListLevels");export{E as calcListLevels};