text-editor-studio-ts
Version:
A powerful mobile-responsive rich text editor built with Lexical and React
3 lines (2 loc) • 1.91 kB
JavaScript
;const e=require("./LexicalCollaborationContext.prod-BKKUeelU.cjs"),t=require("./index-BLOj1UA2.cjs"),n=require("react"),r=require("react/jsx-runtime");function s(e){const t=e.transform();return new Set(t?[t]:[])}exports.f=function({initialEditor:o,children:i,initialNodes:a,initialTheme:c,skipCollabChecks:l,skipEditableListener:f}){const p=n.useRef(!1),d=n.useContext(t.r);null==d&&function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const s of t)r.append("v",s);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(9);const[u,{getTheme:h}]=d,m=n.useMemo(()=>{const e=c||h()||void 0,n=t.t(d,e);void 0!==e&&(o._config.theme=e),o._parentEditor=o._parentEditor||u;const r=o._createEditorArgs,i=r&&r.namespace;if(a){i||(o._config.namespace=u._config.namespace);for(let e of a){let t=null,n=null;if("function"!=typeof e){const r=e;e=r.replace,t=r.with,n=r.withKlass||null}const r=o._nodes.get(e.getType());o._nodes.set(e.getType(),{exportDOM:r?r.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:n,transforms:s(e)})}}else if(r&&r.nodes)i||(o._config.namespace=u._config.namespace);else{const e=o._nodes=new Map(u._nodes);i||(o._config.namespace=u._config.namespace);for(const[t,n]of e)o._nodes.set(t,{exportDOM:n.exportDOM,klass:n.klass,replace:n.replace,replaceWithKlass:n.replaceWithKlass,transforms:s(n.klass)})}return[o,n]},[]),{isCollabActive:g,yjsDocMap:_}=e.l(),x=l||p.current||_.has(o.getKey());return n.useEffect(()=>{x&&(p.current=!0)},[x]),n.useEffect(()=>{if(!f){const e=e=>o.setEditable(e);return e(u.isEditable()),u.registerEditableListener(e)}},[o,u,f]),r.jsx(t.r.Provider,{value:m,children:!g||x?i:null})};
//# sourceMappingURL=LexicalNestedComposer.prod-BY66YBPy.cjs.map