jodit-pro
Version:
PRO Version of Jodit Editor
2 lines (1 loc) • 1.13 kB
JavaScript
var $=Object.defineProperty;var a=(y,n)=>$(y,"name",{value:n,configurable:!0});import{transformWordToHtml as h}from"./transform-word-to-html.js";import{Dom as b}from"jodit/esm/core/dom/dom.js";import{attr as e}from"jodit/esm/core/helpers/utils/attr.js";import{$$ as m}from"jodit/esm/core/helpers/utils/selector.js";import{JElement as v}from"../element/index.js";function w(y,n,u,p=""){var d,f;const s=document.createElement("iframe");s.style.display="none",document.body.appendChild(s);try{const t=(d=s.contentDocument)!==null&&d!==void 0?d:(f=s.contentWindow)===null||f===void 0?void 0:f.document;if(!t)return n;t.open(),t.write(n),t.close();const i="jd-style";for(let o=0;o<t.styleSheets.length;o+=1)try{const l=t.styleSheets[o].cssRules;for(let c=0;c<l.length;c+=1)l[c].selectorText&&m(l[c].selectorText,t.body).forEach(r=>{e(r,i)||(e(r,i,e(r,"style")||""),e(r,"style","")),e(r,"style",`${e(r,"style")};${l[c].style.cssText}`)})}catch{}return m(`[${i}]`,t.body).forEach(o=>{e(o,"style",`${e(o,"style")};${e(o,i)}`)}),h(y,v.make(t.body),u,p)}finally{b.safeRemove(s)}return n}a(w,"applyStylesPro");export{w as applyStylesPro};