Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lexical/react

Package Overview
Dependencies
Maintainers
1
Versions
208
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lexical/react - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

DEPRECATED_useLexical.js

14

LexicalAutoFormatterPlugin.js

@@ -1,1 +0,13 @@

'use strict';var a=require("@lexical/react/LexicalComposerContext"),b=require("@lexical/react/useLexicalAutoFormatter");module.exports=function(){const [c]=a.useLexicalComposerContext();b(c);return null};
'use strict';var l=require("@lexical/react/LexicalComposerContext"),m=require("lexical/CodeNode"),t=require("lexical/ListItemNode"),u=require("lexical"),w=require("react"),x=require("lexical/HeadingNode"),y=require("lexical/ListNode"),z=require("lexical/ParagraphNode"),A=require("lexical/QuoteNode");
const D={requiresParagraphStart:!1,nodeTransformationKind:null,regEx:/(?:)/,regExExpectedCaptureGroupCount:0},E={...D,requiresParagraphStart:!0},F=[{...D,nodeTransformationKind:"textBold",regEx:/(\*)(?:\s*\b)(?:[^\*]*)(?:\b\s*)(\*\s)$/,regExExpectedCaptureGroupCount:2}],G=[{...E,regEx:/(?:# )/,nodeTransformationKind:"paragraphH1"},{...E,regEx:/(?:## )/,nodeTransformationKind:"paragraphH2"},{...E,regEx:/(?:### )/,nodeTransformationKind:"paragraphH2"},{...E,regEx:/(?:> )/,nodeTransformationKind:"paragraphBlockQuote"},
{...E,regEx:/(?:- )/,nodeTransformationKind:"paragraphUnorderedList"},{...E,regEx:/(?:\* )/,nodeTransformationKind:"paragraphUnorderedList"},{...E,nodeTransformationKind:"paragraphOrderedList",regEx:/^(\d+)\.\s/,regExExpectedCaptureGroupCount:1},{...E,regEx:/(?:``` )/,nodeTransformationKind:"paragraphCodeBlock"},...F];
function H(f,h,b){const a={regExCaptureGroups:[],text:"",textIndex:-1,triggerState:null};f=f.match(h);if(null!==f&&0===f.index&&f.length===b+1){a.textIndex=f.index;a.text=f[0];for(b=1;b<f.length;++b)a.regExCaptureGroups.push(f[b]);return a}return null}
function I(f,h){f.update(()=>{var b=u.$getSelection();if(null==b)b=null;else{var a=b.anchor.getNode();b=u.$isTextNode(a)?{node:a,offset:b.anchor.offset}:null}if(null!==b){b={textNodeWithOffset:b,trimmedParagraphText:null};a:{a=!1===h.isParentAListItemNode?G:F;var c=a.length;for(var e=0;e<c;++e){var d=a[e];if(!1===h.isCodeBlock||"paragraphCodeBlock"===d.nodeTransformationKind){var g=d,k=b;if(null!==g.requiresParagraphStart&&!0===g.requiresParagraphStart)b:{var n=k;k=n.textNodeWithOffset;if(null===
k.node.getPreviousSibling()&&(n=n.textNodeWithOffset.node.getTextContent(),g=H(n,g.regEx,g.regExExpectedCaptureGroupCount),null!=g&&0===g.textIndex&&g.textIndex+g.text.length===k.offset))break b;g=null}else{if(null==k.trimmedParagraphText){var p=k.textNodeWithOffset.node.getParentOrThrow();if(u.$isElementNode(p)){if(null==k.trimmedParagraphText){n=k;var J=k.textNodeWithOffset.node,B=k.textNodeWithOffset.offset;let r="";p=p.getChildren();const K=p.length;for(let v=0;v<K;++v){const q=p[v];if(u.$isTextNode(q)){const C=
q.getTextContent();if(q.is(J)){if(B>C.length)throw Error(`Node ${q.__key} and selection point do not match.`);r+=q.getTextContent().substr(0,B);break}else r+=C}else r+="\u0004"}n.trimmedParagraphText=r}H(k.trimmedParagraphText,g.regEx,g.regExExpectedCaptureGroupCount)}else throw Error(`Expected node ${p.__key} to to be a ElementNode.`);}g=null}if(null!=g){g.triggerState=h;a={autoFormatCriteria:d,matchResultContext:g};break a}}}a={autoFormatCriteria:null,matchResultContext:null}}c=a;if(null!==c.autoFormatCriteria&&
null!==c.matchResultContext&&(a=c.autoFormatCriteria,c=c.matchResultContext,a.requiresParagraphStart)){e=b.textNodeWithOffset;b=e.node.getParentOrThrow();e=e.node.spliceText(0,c.text.length,"",!0);""===e.getTextContent()&&(e.selectPrevious(),e.remove());e=b.getChildren();d=null;if(null!=a.nodeTransformationKind)switch(a.nodeTransformationKind){case "paragraphH1":d=x.$createHeadingNode("h1");d.append(...e);break;case "paragraphH2":d=x.$createHeadingNode("h2");d.append(...e);break;case "paragraphH3":d=
x.$createHeadingNode("h3");d.append(...e);break;case "paragraphBlockQuote":d=A.$createQuoteNode();d.append(...e);break;case "paragraphUnorderedList":d=y.$createListNode("ul");a=t.$createListItemNode();a.append(...e);d.append(a);break;case "paragraphOrderedList":a=parseInt(1===c.regExCaptureGroups.length?c.regExCaptureGroups[0]:"1",10);d=y.$createListNode("ol",a);a=t.$createListItemNode();a.append(...e);d.append(a);break;case "paragraphCodeBlock":d=null!=c.triggerState&&c.triggerState.isCodeBlock?
z.$createParagraphNode():m.$createCodeNode(),d.append(...e)}a=d;null!==a&&b.replace(a)}}})}
function L(f){let h=null;f.read(()=>{const b=u.$getSelection();if(null!=b&&b.isCollapsed()){var a=b.anchor.getNode(),c=a.getParent(),e=null!==c&&t.$isListItemNode(c);c=null!==c&&u.$isElementNode(c);h={anchorOffset:b.anchor.offset,isCodeBlock:m.$isCodeNode(a),isSelectionCollapsed:b.isCollapsed(),isSimpleText:u.$isTextNode(a)&&a.isSimpleText(),isParentAnElementNode:c,isParentAListItemNode:e,nodeKey:a.getKey(),textContent:a.getTextContent()}}});return h}
function M(f){w.useEffect(()=>{let h=null;f.addListener("update",({tags:b})=>{if(!1===b.has("historic")){b=L(f.getEditorState());var a=b;var c=h;if(null==a||null==c)a=!1;else{var e=a.textContent.length,d=a.anchorOffset-1;a=!0===a.isParentAnElementNode&&a.isSimpleText&&a.isSelectionCollapsed&&a.nodeKey===c.nodeKey&&a.anchorOffset!==c.anchorOffset&&0<=d&&d+1<=e&&" "===a.textContent.substr(d,1)&&a.textContent!==c.textContent}a&&null!=b&&I(f,b);h=b}else h=null})},[f])}
module.exports=function(){const [f]=l.useLexicalComposerContext();M(f);return null};

13

LexicalCharacterLimitPlugin.js

@@ -1,3 +0,10 @@

'use strict';var c=require("@lexical/react/LexicalComposerContext"),d=require("@lexical/react/useLexicalCharacterLimit"),g=require("react");let h=null;
module.exports=function({charset:e="UTF-16"}){const [k]=c.useLexicalComposerContext(),[f,l]=g.useState(0),m=g.useMemo(()=>({remainingCharacters:l,strlen:a=>{if("UTF-8"===e){if(void 0===window.TextEncoder)var b=null;else null===h&&(h=new window.TextEncoder),b=h;null===b?(b=encodeURIComponent(a).match(/%[89ABab]/g),a=a.length+(b?b.length:0)):a=b.encode(a).length;return a}if("UTF-16"===e)return a.length;throw Error("Unrecognized charset");}}),[e]);d.useCharacterLimit(k,5,m);return g.createElement("span",
{className:`characters-limit ${0>f?"characters-limit-exceeded":""}`},f)};
'use strict';var l=require("@lexical/react/LexicalComposerContext"),p=require("lexical"),q=require("react"),r=require("@lexical/react/withSubscriptions");function t(a,e){for(e(a);null!==a;){if(p.$isElementNode(a)&&0<a.getChildrenSize())a=a.getFirstChild();else{let f=null;for(;null===f&&null!==a;)f=a.getNextSibling(),a=null===f?a.getParent():f}null!==a&&(a=e(a))}}function u(){return p.$getRoot().getTextContent()}
function w(a,e,f={}){const {strlen:h=c=>c.length,remainingCharacters:d=()=>{}}=f;q.useEffect(()=>a.registerNodes([x]),[a]);q.useEffect(()=>{let c=a.getEditorState().read(u),b=0;return r(a.addListener("textcontent",g=>{c=g}),a.addListener("update",({dirtyLeaves:g})=>{var k=a.isComposing();g=0<g.size;if(!k&&g){k=h(c);g=k>e||null!==b&&b>e;d(e-k);if(null===b||g){const n=y(c,e,h);a.update(()=>{p.$log("CharacterLimit");z(n)},{tag:"without-history"})}b=k}}))},[a,e,d,h])}
function y(a,e,f){var h=Intl.Segmenter;let d=0;var c=0;if("function"===typeof h){a=(new h).segment(a);for(var {segment:b}of a){c+=f(b);if(c>e)break;d+=b.length}}else for(b=Array.from(a),a=b.length,h=0;h<a;h++){const g=b[h];c+=f(g);if(c>e)break;d+=g.length}return d}
function z(a){const e=p.$getRoot();let f=0,h=e;t(e,d=>{if(d instanceof x){var c=f;if(f+d.getTextContentSize()<=a){var b=d.getParent();c=d.getPreviousSibling();var g=d.getNextSibling();A(d);d=p.$getSelection();null===d||d.anchor.getNode().isAttached()&&d.focus.getNode().isAttached()||(p.$isTextNode(c)?c.select():p.$isTextNode(g)?g.select():null!==b&&b.select());return h}if(c<a&&(b=d.getFirstDescendant(),g=null!==b?b.getTextContentSize():0,c+=g,b=p.$isTextNode(b)&&b.isSimpleText(),c=c<=a,b||c))return A(d),
h}else if(p.$isLeafNode(d)&&(c=f,f+=d.getTextContentSize(),f>a&&!(d.getParent()instanceof x)&&(b=p.$getSelection(),c<a&&p.$isTextNode(d)&&d.isSimpleText()?([,c]=d.splitText(a-c),c=B(c)):c=B(d),null!==b&&p.$setSelection(b),b=c,g=b.getPreviousSibling(),g instanceof x))){var k=b.getFirstChild(),n=g.getChildren();c=n.length;if(null===k)b.append(...n);else for(var m=0;m<c;m++)k.insertBefore(n[m]);m=p.$getSelection();if(null!==m){k=m.anchor;n=k.getNode();m=m.focus;const v=k.getNode();n.is(g)?k.set(b.getKey(),
k.offset,"element"):n.is(b)&&k.set(b.getKey(),c+k.offset,"element");v.is(g)?m.set(b.getKey(),m.offset,"element"):v.is(b)&&m.set(b.getKey(),c+m.offset,"element")}g.remove()}return h=d})}
class x extends p.ElementNode{static getType(){return"overflow"}static clone(a){return new x(a.__key)}constructor(a){super(a);this.__type="overflow"}createDOM(a){const e=document.createElement("div");a=a.theme.characterLimit;"string"===typeof a&&(e.className=a);return e}updateDOM(){return!1}insertNewAfter(a){return this.getParentOrThrow().insertNewAfter(a)}excludeFromCopy(){return!0}}function B(a){const e=new x;a.insertBefore(e);e.append(a);return e}
function A(a){const e=a.getChildren(),f=e.length;for(let h=0;h<f;h++)a.insertBefore(e[h]);a.remove();return 0<f?e[f-1]:null}let C=null;
module.exports=function({charset:a="UTF-16"}){const [e]=l.useLexicalComposerContext(),[f,h]=q.useState(0),d=q.useMemo(()=>({remainingCharacters:h,strlen:c=>{if("UTF-8"===a){if(void 0===window.TextEncoder)var b=null;else null===C&&(C=new window.TextEncoder),b=C;null===b?(b=encodeURIComponent(c).match(/%[89ABab]/g),c=c.length+(b?b.length:0)):c=b.encode(c).length;return c}if("UTF-16"===a)return c.length;throw Error("Unrecognized charset");}}),[a]);w(e,5,d);return q.createElement("span",{className:`characters-limit ${0>
f?"characters-limit-exceeded":""}`},f)};

@@ -1,9 +0,8 @@

'use strict';var d=require("react"),g=require("@lexical/react/LexicalComposerContext"),l=require("react-dom"),u=require("@lexical/yjs"),A=require("lexical"),B=require("lexical/ParagraphNode");const C="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,D=C&&"documentMode"in document?document.documentMode:null;C&&/Win/.test(navigator.platform);C&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;C&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);
C&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);C&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent);C&&/^(?=.*Chrome).*/i.test(navigator.userAgent);C&&"InputEvent"in window&&!D&&new window.InputEvent("input");function E(b){b.update(()=>{A.$log("initEditor");var c=A.$getRoot();if(null===c.getFirstChild()){const a=B.$createParagraphNode();c.append(a);c=document.activeElement;(null!==A.$getSelection()||null!==c&&c===b.getRootElement())&&a.select()}})}
function F(b,c,a,e,h,m,r){const f=d.useMemo(()=>u.createBinding(b,a,c,e),[b,a,c,e]),n=d.useCallback(()=>{a.connect()},[a]),p=d.useCallback(()=>{try{a.disconnect()}catch(k){}},[a]);d.useEffect(()=>{const {root:k}=f,{awareness:t}=a,w=({status:q})=>{b.execCommand("connected","connected"===q)},x=q=>{!r&&q&&k.isEmpty()&&0===k._xmlText._length&&E(b)},y=()=>{u.syncCursorPositions(f,a)},z=(q,v)=>{v.origin!==f&&u.syncYjsChangesToLexical(f,a,q)};u.initLocalState(a,h,m,document.activeElement===b.getRootElement());
a.on("status",w);a.on("sync",x);t.on("update",y);k.getSharedType().observeDeep(z);const O=b.addListener("update",({prevEditorState:q,editorState:v,dirtyLeaves:K,dirtyElements:L,normalizedNodes:M,tags:N})=>{u.syncLexicalUpdateToYjs(f,a,q,v,L,K,M,N)});n();return()=>{p();a.off("sync",x);a.off("status",w);t.off("update",y);k.getSharedType().unobserveDeep(z);O()}},[f,m,n,p,b,h,a,r]);const P=d.useMemo(()=>l.createPortal(d.createElement("div",{ref:k=>{f.cursorsContainer=k}}),document.body),[f]);d.useEffect(()=>
b.addListener("command",(k,t)=>{"toggleConnect"===k&&void 0!==n&&void 0!==p&&(t?(console.log("Collaboration connected!"),n()):(console.log("Collaboration disconnected!"),p()));return!1},0),[n,p,b]);return[P,f]}
function G(b,c){d.useEffect(()=>{const a=()=>{u.setLocalStateFocus(c,!1)},e=()=>{u.setLocalStateFocus(c,!0)};return b.addListener("root",(h,m)=>{null!==m&&(m.removeEventListener("blur",a),m.removeEventListener("focus",e));null!==h&&(document.activeElement===h&&u.setLocalStateFocus(c,!0),h.addEventListener("blur",a),h.addEventListener("focus",e))})},[b,c,c.awareness])}
function H(b,c){const a=d.useMemo(()=>u.createUndoManager(c,c.root.getSharedType()),[c]);d.useEffect(()=>b.addListener("command",e=>"undo"===e?(a.undo(),!0):"redo"===e?(a.redo(),!0):!1,0));return d.useCallback(()=>{a.clear()},[a])}
const I=[["Cat","255,165,0"],["Dog","0,200,55"],["Rabbit","160,0,200"],["Frog","0,172,200"],["Fox","197,200,0"],["Hedgehog","31,200,0"],["Pigeon","200,0,0"],["Squirrel","200,0,148"],["Bear","255,235,0"],["Tiger","86,255,0"],["Leopard","0,255,208"],["Zebra","0,243,255"],["Wolf","0,102,255"],["Owl","147,0,255"],["Gull","255,0,153"],["Squid","0,220,255"]],J=I[Math.floor(Math.random()*(I.length-1+1))],Q=d.createContext({yjsDocMap:new Map,name:J[0],color:J[1]});function R(){return d.useContext(Q)}
exports.CollaborationContext=Q;exports.CollaborationPlugin=function({id:b,providerFactory:c,skipInit:a}){const {yjsDocMap:e,name:h,color:m}=R(),[r]=g.useLexicalComposerContext(),f=d.useMemo(()=>c(b,e),[b,c,e]),[n,p]=F(r,b,f,e,h,m,a||!1);H(r,p);G(r,f);return n};exports.useCollaborationContext=R;
'use strict';var d=require("react"),g=require("@lexical/react/LexicalComposerContext"),t=require("react-dom"),z=require("@lexical/yjs"),A=require("lexical"),B=require("lexical/ParagraphNode");function C(b){b.update(()=>{A.$log("initEditor");var c=A.$getRoot();if(null===c.getFirstChild()){const a=B.$createParagraphNode();c.append(a);c=document.activeElement;(null!==A.$getSelection()||null!==c&&c===b.getRootElement())&&a.select()}})}
function D(b,c,a,e,h,l,q){const f=d.useMemo(()=>z.createBinding(b,a,c,e),[b,a,c,e]),m=d.useCallback(()=>{a.connect()},[a]),n=d.useCallback(()=>{try{a.disconnect()}catch(k){}},[a]);d.useEffect(()=>{const {root:k}=f,{awareness:r}=a,v=({status:p})=>{b.execCommand("connected","connected"===p)},w=p=>{!q&&p&&k.isEmpty()&&0===k._xmlText._length&&C(b)},x=()=>{z.syncCursorPositions(f,a)},y=(p,u)=>{u.origin!==f&&z.syncYjsChangesToLexical(f,a,p)};z.initLocalState(a,h,l,document.activeElement===b.getRootElement());
a.on("status",v);a.on("sync",w);r.on("update",x);k.getSharedType().observeDeep(y);const M=b.addListener("update",({prevEditorState:p,editorState:u,dirtyLeaves:I,dirtyElements:J,normalizedNodes:K,tags:L})=>{z.syncLexicalUpdateToYjs(f,a,p,u,J,I,K,L)});m();return()=>{n();a.off("sync",w);a.off("status",v);r.off("update",x);k.getSharedType().unobserveDeep(y);M()}},[f,l,m,n,b,h,a,q]);const N=d.useMemo(()=>t.createPortal(d.createElement("div",{ref:k=>{f.cursorsContainer=k}}),document.body),[f]);d.useEffect(()=>
b.addListener("command",(k,r)=>{"toggleConnect"===k&&void 0!==m&&void 0!==n&&(r?(console.log("Collaboration connected!"),m()):(console.log("Collaboration disconnected!"),n()));return!1},0),[m,n,b]);return[N,f]}
function E(b,c){d.useEffect(()=>{const a=()=>{z.setLocalStateFocus(c,!1)},e=()=>{z.setLocalStateFocus(c,!0)};return b.addListener("root",(h,l)=>{null!==l&&(l.removeEventListener("blur",a),l.removeEventListener("focus",e));null!==h&&(document.activeElement===h&&z.setLocalStateFocus(c,!0),h.addEventListener("blur",a),h.addEventListener("focus",e))})},[b,c,c.awareness])}
function F(b,c){const a=d.useMemo(()=>z.createUndoManager(c,c.root.getSharedType()),[c]);d.useEffect(()=>b.addListener("command",e=>"undo"===e?(a.undo(),!0):"redo"===e?(a.redo(),!0):!1,0));return d.useCallback(()=>{a.clear()},[a])}
const G=[["Cat","255,165,0"],["Dog","0,200,55"],["Rabbit","160,0,200"],["Frog","0,172,200"],["Fox","197,200,0"],["Hedgehog","31,200,0"],["Pigeon","200,0,0"],["Squirrel","200,0,148"],["Bear","255,235,0"],["Tiger","86,255,0"],["Leopard","0,255,208"],["Zebra","0,243,255"],["Wolf","0,102,255"],["Owl","147,0,255"],["Gull","255,0,153"],["Squid","0,220,255"]],H=G[Math.floor(Math.random()*(G.length-1+1))],O=d.createContext({yjsDocMap:new Map,name:H[0],color:H[1]});function P(){return d.useContext(O)}
exports.CollaborationContext=O;exports.CollaborationPlugin=function({id:b,providerFactory:c,skipInit:a}){const {yjsDocMap:e,name:h,color:l}=P(),[q]=g.useLexicalComposerContext(),f=d.useMemo(()=>c(b,e),[b,c,e]),[m,n]=D(q,b,f,e,h,l,a||!1);F(q,n);E(q,f);return m};exports.useCollaborationContext=P;

@@ -1,2 +0,2 @@

'use strict';var e=require("lexical"),f=require("@lexical/react/LexicalComposerContext"),k=require("react");
module.exports=function({children:l,initialDecoratorEditor:h,theme:g}){const c=k.useContext(f.LexicalComposerContext),m=k.useMemo(()=>{if(null!=g)var a=g;else if(null!=c){var d=c[0];var b=c[1].getTheme();null!=b&&(a=b)}d={theme:a||{},parentEditor:d};a=f.createLexicalComposerContext(c,a);b=void 0!==h?h.editor:null;null===b?b=e.createEditor({...d,context:a}):b._config={...d,context:a};return[b,a]},[g]);return k.createElement(f.LexicalComposerContext.Provider,{value:m},l)};
'use strict';var e=require("lexical"),f=require("@lexical/react/LexicalComposerContext"),h=require("react");
module.exports=function({namespace:k,children:l,initialEditor:m,theme:g}){const c=h.useContext(f.LexicalComposerContext),n=h.useMemo(()=>{if(null!=g)var b=g;else if(null!=c){var d=c[0];var a=c[1].getTheme();null!=a&&(b=a)}d={theme:b||{},namespace:k,parentEditor:d};b=f.createLexicalComposerContext(c,b);a=m||null;null===a?a=e.createEditor({...d,context:b}):a._config={...a._config,...d,context:b};return[a,b]},[g]);return h.createElement(f.LexicalComposerContext.Provider,{value:n},l)};

@@ -1,1 +0,7 @@

'use strict';var a=require("@lexical/react/LexicalComposerContext"),b=require("@lexical/react/useLexicalHistory");module.exports=function({externalHistoryState:c}){const [d]=a.useLexicalComposerContext();b.useLexicalHistory(d,c);return null};
'use strict';var n=require("@lexical/react/LexicalComposerContext"),r=require("lexical"),v=require("react"),w=require("@lexical/react/withSubscriptions");function x(a,b,f){b=Array.from(b);f=Array.from(f);a=a._nodeMap;const c=[];for(var h=0;h<b.length;h++){const e=a.get(b[h]);void 0!==e&&c.push(e)}for(b=0;b<f.length;b++)f[b][1]&&(h=a.get(f[b][0]),void 0===h||r.$isRootNode(h)||c.push(h));return c}
function y(a,b,f,c,h){if(null===a||0===f.size&&0===c.size)return 0;var e=b._selection,d=a._selection;if(h)return 1;if(null===e||null===d||!d.isCollapsed()||!e.isCollapsed())return 0;f=x(b,f,c);if(0===f.length)return 0;if(1<f.length){b=b._nodeMap;d=b.get(d.anchor.key);const g=b.get(e.anchor.key);return r.$isTextNode(g)&&r.$isElementNode(d)&&!a._nodeMap.has(g.__key)&&1===g.__text.length&&1===e.anchor.offset?f.every(k=>k===g||!r.$isTextNode(k))?2:0:0}b=f[0];a=a._nodeMap.get(b.__key);if(!r.$isTextNode(a)||
!r.$isTextNode(b)||a.__mode!==b.__mode)return 0;a=a.__text;b=b.__text;if(a===b)return 0;e=e.anchor;d=d.anchor;if(e.key!==d.key||"text"!==e.type)return 0;e=e.offset;d=d.offset;a=b.length-a.length;return 1===a&&d===e-1?2:-1===a&&d===e+1?3:-1===a&&d===e?4:0}
function z(a,b){let f=Date.now(),c=0;return(h,e,d,g,k,m)=>{const p=Date.now();if(m.has("historic"))return c=0,f=p,2;const l=y(h,e,g,k,a.isComposing()),u=(()=>{if(m.has("without-history"))return 0;if(null===h)return 1;var q=e._selection;const t=h._selection;if(!(0<g.size||0<k.size))return null===t&&null!==q?0:2;q=null===d||d.editor===a;return 0!==l&&l===c&&p<f+b&&q?0:1})();f=p;c=l;return u}}
function A(a,b,f=1E3){const c=v.useMemo(()=>b||B(),[b]),h=v.useCallback(()=>{c.undoStack=[];c.redoStack=[];c.current=null},[c]);v.useEffect(()=>{const e=z(a,f);return w(a.addListener("command",d=>{switch(d){case "undo":d=c.redoStack;var g=c.undoStack;if(0!==g.length){var k=c.current;const m=g.pop();null!==k&&(d.push(k),a.execCommand("canRedo",!0));0===g.length&&a.execCommand("canUndo",!1);c.current=m;m.editor.setEditorState(m.editorState.clone(m.undoSelection),{tag:"historic"})}return!0;case "redo":return d=
c.redoStack,g=c.undoStack,0!==d.length&&(k=c.current,null!==k&&(g.push(k),a.execCommand("canUndo",!0)),g=d.pop(),0===d.length&&a.execCommand("canRedo",!1),c.current=g,g.editor.setEditorState(g.editorState,{tag:"historic"})),!0;case "clearEditor":return h(),!1;case "clearHistory":return h(),!0;default:return!1}},0),a.addListener("update",({editorState:d,prevEditorState:g,dirtyLeaves:k,dirtyElements:m,tags:p})=>{const l=c.current,u=c.redoStack,q=c.undoStack,t=null===l?null:l.editorState;if(null===l||
d!==t){k=e(g,d,l,k,m,p);if(1===k)0!==u.length&&(c.redoStack=[]),null!==l&&(q.push({...l,undoSelection:g.read(r.$getSelection)}),a.execCommand("canUndo",!0));else if(2===k)return;c.current={editor:a,editorState:d}}}))},[h,f,a,c])}function B(){return{current:null,redoStack:[],undoStack:[]}}exports.HistoryPlugin=function({externalHistoryState:a}){const [b]=n.useLexicalComposerContext();A(b,a);return null};exports.createEmptyHistoryState=B;

@@ -1,1 +0,12 @@

'use strict';var a=require("@lexical/react/LexicalComposerContext"),b=require("@lexical/react/useLexicalList");module.exports=function(){const [c]=a.useLexicalComposerContext();b(c);return null};
'use strict';var g=require("@lexical/react/LexicalComposerContext"),l=require("react"),m=require("lexical"),p=require("lexical/ListItemNode"),q=require("lexical/ListNode"),r=require("lexical/ParagraphNode");function t(d){d=d.getParent();if(!q.$isListNode(d))throw Error("Minified Lexical error #2; see codes.json for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");let a=d;for(;null!==a;)a=a.getParent(),q.$isListNode(a)&&(d=a);return d}
function u(d){let a=[];d=d.getChildren().filter(p.$isListItemNode);for(let b=0;b<d.length;b++){const c=d[b],e=c.getFirstChild();q.$isListNode(e)?a=a.concat(u(e)):a.push(c)}return a}function v(d,a){for(;null!=d&&!(d instanceof a);)d=d.getParent();return d}
function w(d){d.update(()=>{m.$log("removeList");var a=m.$getSelection();if(null!==a){const c=new Set,e=a.getNodes();a=a.anchor.getNode();if(0===e.length&&p.$isListItemNode(a))c.add(t(a));else for(a=0;a<e.length;a++){var b=e[a];m.$isLeafNode(b)&&(b=v(b,p.ListItemNode),null!=b&&c.add(t(b)))}c.forEach(f=>{let h=f;u(f).forEach(k=>{if(null!=k){const n=r.$createParagraphNode();n.append(...k.getChildren());h.insertAfter(n);h=n;k.remove()}});f.remove()})}})}
function x(d,a){if(q.$isListNode(d))return d;const b=d.getPreviousSibling(),c=d.getNextSibling(),e=p.$createListItemNode();if(q.$isListNode(b))return e.append(d),b.append(e),q.$isListNode(c)&&(b.append(...c.getChildren()),c.remove()),b;if(q.$isListNode(c))return e.append(d),c.getFirstChildOrThrow().insertBefore(e),c;a=q.$createListNode(a);a.append(e);d.replace(a);e.append(d);return a}
function y(d,a){d.update(()=>{m.$log("formatList");var b=m.$getSelection();if(null!==b){var c=b.getNodes();b=b.anchor.getNode();var e=b.getParent();if(0===c.length)c=q.$createListNode(a),m.$isRootNode(e)?(b.replace(c),b=p.$createListItemNode(),c.append(b)):p.$isListItemNode(b)&&(b=b.getParentOrThrow(),c.append(...b.getChildren()),b.replace(c));else for(b=new Set,e=0;e<c.length;e++){var f=c[e];if(m.$isElementNode(f)&&f.isEmpty()&&!b.has(f.getKey()))x(f,a);else if(m.$isLeafNode(f))for(f=f.getParent();null!=
f;){const k=f.getKey();if(q.$isListNode(f)){if(!b.has(k)){var h=q.$createListNode(a);h.append(...f.getChildren());f.replace(h);b.add(k)}break}else{h=f.getParent();if(m.$isRootNode(h)&&!b.has(k)){b.add(k);x(f,a);break}f=h}}}}})}
function z(d){var a=m.$getSelection();if(null===a)return!1;var b=a.getNodes(),c=[];0===b.length&&b.push(a.anchor.getNode());if(1===b.length){a:{for(b=b[0];null!==b;){if(p.$isListItemNode(b))break a;b=b.getParent()}b=null}null!==b&&(c=[b])}else{c=new Set;for(a=0;a<b.length;a++){const e=b[a];p.$isListItemNode(e)&&c.add(e)}c=Array.from(c)}return 0<c.length?("indent"===d?A(c):B(c),!0):!1}function C(d){return p.$isListItemNode(d)&&q.$isListNode(d.getFirstChild())}
function A(d){d.forEach(a=>{if(!C(a)){var b=a.getParent(),c=a.getNextSibling(),e=a.getPreviousSibling();if(C(c)&&C(e))e=e.getFirstChild(),q.$isListNode(e)&&(e.append(a),a=c.getFirstChild(),q.$isListNode(a)&&(c=a.getChildren(),e.append(...c),a.remove()),e.getChildren().forEach(f=>f.markDirty()));else if(C(c))c=c.getFirstChild(),q.$isListNode(c)&&(e=c.getFirstChild(),null!==e&&e.insertBefore(a),c.getChildren().forEach(f=>f.markDirty()));else if(C(e))c=e.getFirstChild(),q.$isListNode(c)&&(c.append(a),
c.getChildren().forEach(f=>f.markDirty()));else if(q.$isListNode(b)){const f=p.$createListItemNode(),h=q.$createListNode(b.getTag());f.append(h);h.append(a);e?e.insertAfter(f):c?c.insertBefore(f):b.append(f)}q.$isListNode(b)&&b.getChildren().forEach(f=>f.markDirty())}})}
function B(d){d.forEach(a=>{if(!C(a)){var b=a.getParent(),c=b?b.getParent():void 0,e=c?c.getParent():void 0;if(q.$isListNode(e)&&p.$isListItemNode(c)&&q.$isListNode(b)){var f=b?b.getFirstChild():void 0,h=b?b.getLastChild():void 0;if(a.is(f))c.insertBefore(a),b.isEmpty()&&c.remove();else if(a.is(h))c.insertAfter(a),b.isEmpty()&&c.remove();else{var k=b.getTag();f=p.$createListItemNode();const n=q.$createListNode(k);f.append(n);a.getPreviousSiblings().forEach(D=>n.append(D));h=p.$createListItemNode();
k=q.$createListNode(k);h.append(k);k.append(...a.getNextSiblings());c.insertBefore(f);c.insertAfter(h);c.replace(a)}b.getChildren().forEach(n=>n.markDirty());e.getChildren().forEach(n=>n.markDirty())}}})}
function E(d){l.useEffect(()=>d.addListener("command",a=>{if("indentContent"===a){if(z("indent"))return!0}else if("outdentContent"===a){if(z("outdent"))return!0}else{if("insertOrderedList"===a)return y(d,"ol"),!0;if("insertUnorderedList"===a)return y(d,"ul"),!0;if("removeList"===a)return w(d),!0}return!1},1),[d])}module.exports=function(){const [d]=g.useLexicalComposerContext();E(d);return null};

@@ -1,1 +0,1 @@

'use strict';var b=require("react"),e=require("@lexical/react/LexicalComposer"),f=require("@lexical/react/LexicalOnChangePlugin");module.exports=function({children:g,initialDecoratorEditor:a,theme:h}){const [c,k]=b.useState(null);b.useEffect(()=>{a.isEmpty()||null===c||a.init(c)},[a,c]);const m=b.useCallback((l,d)=>{l.isEmpty()?k(d):a.set(d)},[a]);return b.createElement(e,{initialEditor:a.editor,theme:h},b.createElement(f,{onChange:m}),g)};
'use strict';var b=require("react"),e=require("@lexical/react/LexicalComposer"),f=require("@lexical/react/LexicalOnChangePlugin");module.exports=function({namespace:g,children:h,initialDecoratorEditor:a,theme:k}){const [c,l]=b.useState(null);b.useEffect(()=>{a.isEmpty()||null===c||a.init(c)},[a,c]);const n=b.useCallback((m,d)=>{m.isEmpty()?l(d):a.set(d)},[a]);return b.createElement(e,{namespace:g,initialEditor:a.editor,theme:k},b.createElement(f,{onChange:n}),h)};

@@ -1,2 +0,1 @@

'use strict';var a=require("@lexical/react/LexicalComposerContext"),d=require("react");const e="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,f=e&&"documentMode"in document?document.documentMode:null;e&&/Win/.test(navigator.platform);e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;e&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);e&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);e&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent);
e&&/^(?=.*Chrome).*/i.test(navigator.userAgent);e&&"InputEvent"in window&&!f?"getTargetRanges"in new window.InputEvent("input"):!1;var g=e?d.useLayoutEffect:d.useEffect;module.exports=function({onChange:b}){const [c]=a.useLexicalComposerContext();g(()=>{if(b)return c.addListener("update",({editorState:h})=>{b(h,c)})},[c,b]);return null};
'use strict';var c=require("@lexical/react/LexicalComposerContext"),d=require("react"),e="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?d.useLayoutEffect:d.useEffect;module.exports=function({onChange:a}){const [b]=c.useLexicalComposerContext();e(()=>{if(a)return b.addListener("update",({editorState:f})=>{a(f,b)})},[b,a]);return null};

@@ -1,30 +0,13 @@

'use strict';var g=require("react"),l=require("@lexical/react/LexicalComposerContext"),m=require("lexical"),n=require("lexical/ParagraphNode"),v=require("@lexical/react/withSubscriptions"),y=require("react-dom");const z="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,A=z&&"documentMode"in document?document.documentMode:null;z&&/Win/.test(navigator.platform);z&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;
const B=z&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),C=z&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);z&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent);z&&/^(?=.*Chrome).*/i.test(navigator.userAgent);const D=z&&"InputEvent"in window&&!A?"getTargetRanges"in new window.InputEvent("input"):!1;var E=z?g.useLayoutEffect:g.useEffect;function F(a,b){return"selectionchange"===a||"keyup"===a||"pointerup"===a||"pointercancel"===a?b.ownerDocument:b}
function G(a,b){E(()=>{const c=[],e=[];for(let d=0;d<a.length;d++){const [f,h]=a[d],k=p=>{const x=b.getRootElement();null!==x&&"true"===x.contentEditable&&h(p,b)};c.push(p=>{F(f,p).addEventListener(f,k)});e.push(p=>{F(f,p).removeEventListener(f,k)})}return b.addListener("root",(d,f)=>{null!==f&&e.forEach(h=>h(f));null!==d&&c.forEach(h=>h(d))})},[b,a])}
function H(a,b){const c=b.split(/\r?\n/);if(1===c.length)a.insertText(b);else{b=[];const e=c.length;for(let d=0;d<e;d++){const f=c[d];""!==f&&b.push(m.$createTextNode(f));d!==e-1&&b.push(m.$createLineBreakNode())}a.insertNodes(b)}}
function I(a){g.useEffect(()=>{const b=c=>{var e=a.getRootElement();if(document.activeElement===e&&(e=c.data,"string"===typeof e)){try{var d=JSON.parse(e)}catch(f){return}if(d&&"nuanria_messaging"===d.protocol&&"request"===d.type&&(d=d.payload)&&"makeChanges"===d.functionId&&(d=d.args)){const [f,h,k,p,x]=d;a.update(()=>{m.$log("useLexicalDragonSupport");const w=m.$getSelection();if(null!==w){var u=w.anchor;let q=u.getNode(),r=0,t=0;m.$isTextNode(q)&&0<=f&&0<=h&&(r=f,t=f+h,w.setTextNodeRange(q,r,q,
t));if(r!==t||""!==k)H(w,k),q=u.getNode();m.$isTextNode(q)&&(r=p,t=p+x,u=q.getTextContentSize(),r=r>u?u:r,t=t>u?u:t,w.setTextNodeRange(q,r,q,t));c.stopImmediatePropagation()}})}}};window.addEventListener("message",b,!0);return()=>{window.removeEventListener("message",b,!0)}},[a])}function J(a){return a.isToken()||a.isInert()}let K=!1;function L(a,b){a=a.getData("text/plain");null!=a&&H(b,a)}
function M(a,b){var c=a.focus;a=c.offset;"element"===c.type?b=c.getNode().getChildAtIndex(b?a-1:a):(c=c.getNode(),b=b&&0===a||!b&&a===c.getTextContentSize()?b?c.getPreviousSibling():c.getNextSibling():null);return m.$isDecoratorNode(b)}function N(a){a.preventDefault()}
function O(a,b){a.preventDefault();b.update(()=>{m.$log("onCopyForPlainText");const c=a.clipboardData,e=m.$getSelection();if(null!==e&&null!=c){var d=window.getSelection();if(!d.isCollapsed){var f=d.getRangeAt(0);f&&(d=document.createElement("div"),f=f.cloneContents(),d.appendChild(f),c.setData("text/html",d.innerHTML));c.setData("text/plain",e.getTextContent())}}})}function P(a,b){b.update(()=>{m.$log("onCompositionEnd");m.$setCompositionKey(null);Q(b,!0)})}
function R(a){return a.getEditorState().read(()=>m.$getSelection())}
function S(a,b,c,e,d){if(a.isAttached()&&(d||!a.isDirty())){const f=a.isComposing();let h=b;(f||d)&&"\u00a0"===b[b.length-1]&&(h=b.slice(0,-1));if(d||h!==a.getTextContent())""===h?(f&&m.$setCompositionKey(null),a.remove()):J(a)||null!==m.$getCompositionKey()&&!f?a.markDirty():(b=m.$getSelection(),null!==b&&null!==c&&null!==e&&(b.setTextNodeRange(a,c,a,e),a.isSegmented()&&(c=a.getTextContent(),c=m.$createTextNode(c),a.replace(c),a=c)),a.setTextContent(h))}}
function T(a,b,c){var e=a.anchor;const d=a.focus;var f=e.getNode();(b=e.key!==d.key||e.offset!==d.offset&&!f.isComposing()||(c||f.isDirty())&&1<b.length||!m.$isTextNode(f)||f.getFormat()!==a.format)||(f.isSegmented()?b=!0:a.isCollapsed()?(b=a.anchor.offset,c=f.getParentOrThrow(),e=f.isToken(),a=0===b&&(!f.canInsertTextBefore()||!c.canInsertTextBefore()||e),f=f.getTextContentSize()===b&&(!f.canInsertTextBefore()||!c.canInsertTextBefore()||e),b=a||f):b=!1);return b}
function U(a,b){const c=a.inputType;"deleteCompositionText"!==c&&"insertCompositionText"!==c&&b.update(()=>{m.$log("onBeforeInputForRichText");const e=m.$getSelection();if(null!==e)if("deleteContentBackward"===c)m.$setCompositionKey(null),a.preventDefault(),b.execCommand("deleteCharacter",!0);else{var d=a.data;if(!e.dirty&&e.isCollapsed()&&a.getTargetRanges){var f=a.getTargetRanges()[0];f&&e.applyDOMRange(f)}var h=e.focus;f=e.anchor.getNode();h=h.getNode();if("insertText"===c)"\n"===d?(a.preventDefault(),
b.execCommand("insertLineBreak")):"\n\n"===d?(a.preventDefault(),b.execCommand("insertParagraph")):null==d&&a.dataTransfer?(d=a.dataTransfer.getData("text/plain"),a.preventDefault(),H(e,d)):null!=d&&T(e,d,!0)&&(a.preventDefault(),b.execCommand("insertText",d));else switch(a.preventDefault(),c){case "insertFromComposition":d&&(m.$setCompositionKey(null),b.execCommand("insertText",d));break;case "insertLineBreak":m.$setCompositionKey(null);b.execCommand("insertLineBreak");break;case "insertParagraph":m.$setCompositionKey(null);
b.execCommand("insertParagraph");break;case "insertFromYank":case "insertFromDrop":case "insertReplacementText":case "insertFromPaste":f=a.dataTransfer;null!=f?L(f,e):d&&b.execCommand("insertText",d);break;case "deleteByComposition":f===h&&!m.$isElementNode(f)&&!m.$isElementNode(h)&&J(f)&&J(h)||b.execCommand("removeText");break;case "deleteByDrag":case "deleteByCut":b.execCommand("removeText");break;case "deleteContent":b.execCommand("deleteCharacter",!1);break;case "deleteWordBackward":b.execCommand("deleteWord",
!0);break;case "deleteWordForward":b.execCommand("deleteWord",!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":b.execCommand("deleteLine",!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":b.execCommand("deleteLine",!1);break;case "formatStrikeThrough":b.execCommand("formatText","strikethrough");break;case "formatBold":b.execCommand("formatText","bold");break;case "formatItalic":b.execCommand("formatText","italic");break;case "formatUnderline":b.execCommand("formatText",
"underline");break;case "historyUndo":b.execCommand("undo");break;case "historyRedo":b.execCommand("redo")}}})}function Q(a,b){a=window.getSelection();if(null!==a){var {anchorNode:c,anchorOffset:e,focusOffset:d}=a;null!==c&&3===c.nodeType&&(a=m.$getNearestNodeFromDOMNode(c),m.$isTextNode(a)&&S(a,c.nodeValue,e,d,b))}}function V(a){S(a.node,a.text,a.anchorOffset,a.focusOffset,!1)}
const W=[["selectionchange",function(a,b){a=window.getSelection();const c=b.getRootElement();c&&!c.contains(a.anchorNode)||b.update(()=>{m.$log("onSelectionChange");const e=m.$getSelection();if(null!==e&&e.isCollapsed()){var d=e.anchor;"text"===d.type?(d=d.getNode(),e.format=d.getFormat()):"element"===d.type&&(e.format=0)}b.execCommand("selectionChange")})}],["keydown",function(a,b){K="Unidentified"===a.key&&229===a.keyCode;b.isComposing()||b.update(()=>{m.$log("onKeyDown");if(null!==m.$getSelection()){var {keyCode:c,
shiftKey:e,ctrlKey:d,metaKey:f,altKey:h}=a;if(39!==c||d||f||h)if(37!==c||d||f||h)if(38!==c||d||f||h)if(40!==c||d||f||h)if(13===c&&e)b.execCommand("keyEnter",a);else if(B&&d&&79===c)a.preventDefault(),b.execCommand("insertLineBreak",!0);else if(13!==c||e){var k=B?h||f?!1:8===c||72===c&&d:d||h||f?!1:8===c;k?8===c?b.execCommand("keyBackspace",a):b.execCommand("deleteCharacter",!0):27===c?b.execCommand("keyEscape",a):(k=B?e||h||f?!1:46===c||68===c&&d:d||h||f?!1:46===c,k?46===c?b.execCommand("keyDelete",
a):b.execCommand("deleteCharacter",!1):8===c&&(B?h:d)?(a.preventDefault(),b.execCommand("deleteWord",!0)):46===c&&(B?h:d)?(a.preventDefault(),b.execCommand("deleteWord",!1)):B&&f&&8===c?(a.preventDefault(),b.execCommand("deleteLine",!0)):B&&f&&46===c?(a.preventDefault(),b.execCommand("deleteLine",!1)):66===c&&(B?f:d)?(a.preventDefault(),b.execCommand("formatText","bold")):85===c&&(B?f:d)?(a.preventDefault(),b.execCommand("formatText","underline")):73===c&&(B?f:d)?(a.preventDefault(),b.execCommand("formatText",
"italic")):9!==c||h||d||f?90===c&&!e&&(B?f:d)?(a.preventDefault(),b.execCommand("undo")):(k=B?90===c&&f&&e:89===c&&d||90===c&&d&&e,k&&(a.preventDefault(),b.execCommand("redo"))):b.execCommand("keyTab",a))}else b.execCommand("keyEnter",a);else b.execCommand("keyArrowDown",a);else b.execCommand("keyArrowUp",a);else b.execCommand("keyArrowLeft",a);else b.execCommand("keyArrowRight",a)}})}],["compositionstart",function(a,b){b.update(()=>{m.$log("onCompositionStart");const c=m.$getSelection();if(null!==
c&&!b.isComposing()){const e=c.anchor;m.$setCompositionKey(e.key);null==a.data||K&&"element"!==e.type&&c.isCollapsed()||b.execCommand("insertText"," ")}})}],["compositionend",function(a,b){C?setTimeout(()=>{P(a,b)},0):P(a,b)}],["cut",function(a,b){O(a,b);b.update(()=>{m.$log("onCutForPlainText");const c=m.$getSelection();null!==c&&c.removeText()})}],["copy",O],["dragstart",function(a){a.preventDefault()}],["paste",function(a,b){a.preventDefault();b.update(()=>{m.$log("onPasteForPlainText");const c=
m.$getSelection(),e=a.clipboardData;null!=e&&null!==c&&L(e,c)})}],["input",function(a,b){a.stopPropagation();b.update(()=>{m.$log("onInput");const c=m.$getSelection(),e=a.data;null!=e&&null!==c&&T(c,e,!1)?b.execCommand("insertText",e):Q(b,!1);m.$flushMutations()})}],["click",function(a,b){b.update(()=>{m.$log("onClick");const c=m.$getSelection();if(null!==c){var e=c.anchor;"element"===e.type&&0===e.offset&&c.isCollapsed()&&1===m.$getRoot().getChildrenSize()&&e.getNode().getTopLevelElementOrThrow().isEmpty()&&
(e=R(b),null!==e&&c.is(e)&&(window.getSelection().removeAllRanges(),c.dirty=!0))}})}]];D?W.push(["beforeinput",U]):W.push(["drop",N]);function X(a,b){const c=n.$createParagraphNode();a.append(c);a=document.activeElement;(null!==m.$getSelection()||null!==a&&a===b.getRootElement())&&c.select()}function Y(a){a.update(()=>{m.$log("initEditor");const b=m.$getRoot();null===b.getFirstChild()&&X(b,a)})}
function aa(a,b){a.update(()=>{m.$log("clearEditor");const c=m.$getRoot();c.clear();X(c,a)},{onUpdate:b})}
function ba(a,b){E(()=>{const c=v(a.registerNodes([n.ParagraphNode]),a.addListener("textmutation",V),a.addListener("command",(e,d)=>{const f=m.$getSelection();if(null===f)return!1;switch(e){case "deleteCharacter":return f.deleteCharacter(d),!0;case "deleteWord":return f.deleteWord(d),!0;case "deleteLine":return f.deleteLine(d),!0;case "insertText":return f.insertText(d),!0;case "removeText":return f.removeText(),!0;case "insertLineBreak":return f.insertLineBreak(d),!0;case "insertParagraph":return f.insertLineBreak(),
!0;case "indentContent":case "outdentContent":case "insertImage":case "insertTable":case "formatElement":case "formatText":return!0;case "keyArrowLeft":e=d.shiftKey;if(M(f,!0))return d.preventDefault(),d=e,e="rtl"===f.anchor.getNode().getParentOrThrow().getDirection(),f.modify(d?"extend":"move",!e,"character"),!0;break;case "keyArrowRight":e=d.shiftKey;if(M(f,!1))return d.preventDefault(),d=e,e="rtl"===f.anchor.getNode().getParentOrThrow().getDirection(),f.modify(d?"extend":"move",e,"character"),
!0;break;case "keyBackspace":return d.preventDefault(),a.execCommand("deleteCharacter",!0);case "keyDelete":return d.preventDefault(),a.execCommand("deleteCharacter",!1);case "keyEnter":return d.preventDefault(),a.execCommand("insertLineBreak");case "clearEditor":aa(a)}return!1},0));b&&Y(a);return c},[a,b]);G(W,a);I(a)}
function ca(a){const [b,c]=g.useState(()=>a.getDecorators());E(()=>a.addListener("decorator",e=>{y.flushSync(()=>{c(e)})}),[a]);return g.useMemo(()=>{const e=[],d=Object.keys(b);for(let h=0;h<d.length;h++){var f=d[h];const k=b[f];f=a.getElementByKey(f);null!==f&&e.push(y.createPortal(k,f))}return e},[b,a])}function da(a,b=!0){if(a)return!1;a=m.$getRoot().getTextContent();b&&(a=a.trim());return""===a}
function ea(a){if(!da(a,!1))return!1;a=m.$getRoot().getChildren();const b=a.length;if(1<b)return!1;for(let e=0;e<b;e++){var c=a[e];if(m.$isElementNode(c)){if("paragraph"!==c.__type||0!==c.__indent)return!1;c=c.getChildren();const d=c.length;for(let f=0;f<d;f++)if(!m.$isTextNode(c[e]))return!1}}return!0}function Z(a){return()=>ea(a)}
function fa(a){const [b,c]=g.useState(a.getEditorState().read(Z(a.isComposing())));E(()=>a.addListener("update",({editorState:e})=>{const d=a.isComposing();e=e.read(Z(d));c(e)}),[a]);return b}function ha(a){throw a;}module.exports=function({contentEditable:a,placeholder:b,skipInit:c,onError:e}){const [d]=l.useLexicalComposerContext(),f=fa(d);ba(d,!c);c=ca(d);E(()=>d.addListener("error",e||ha),[d,e]);return g.createElement(g.Fragment,null,a,f&&b,c)};
'use strict';var g=require("react"),h=require("@lexical/react/LexicalComposerContext"),t=require("lexical"),u=require("lexical/ParagraphNode"),v=require("@lexical/react/withSubscriptions"),x=require("react-dom");
function y(a){g.useEffect(()=>{const d=c=>{var e=a.getRootElement();if(document.activeElement===e&&(e=c.data,"string"===typeof e)){try{var b=JSON.parse(e)}catch(f){return}if(b&&"nuanria_messaging"===b.protocol&&"request"===b.type&&(b=b.payload)&&"makeChanges"===b.functionId&&(b=b.args)){const [f,p,r,w,F]=b;a.update(()=>{t.$log("useLexicalDragonSupport");const q=t.$getSelection();if(null!==q){var n=q.anchor;let k=n.getNode(),l=0,m=0;t.$isTextNode(k)&&0<=f&&0<=p&&(l=f,m=f+p,q.setTextNodeRange(k,l,k,
m));if(l!==m||""!==r)q.insertRawText(r),k=n.getNode();t.$isTextNode(k)&&(l=w,m=w+F,n=k.getTextContentSize(),l=l>n?n:l,m=m>n?n:m,q.setTextNodeRange(k,l,k,m));c.stopImmediatePropagation()}})}}};window.addEventListener("message",d,!0);return()=>{window.removeEventListener("message",d,!0)}},[a])}function z(a,d){a=a.getData("text/plain");null!=a&&d.insertRawText(a)}
function A(a,d){var c=a.focus;a=c.offset;"element"===c.type?d=c.getNode().getChildAtIndex(d?a-1:a):(c=c.getNode(),d=d&&0===a||!d&&a===c.getTextContentSize()?d?c.getPreviousSibling():c.getNextSibling():null);return t.$isDecoratorNode(d)}function B(a,d){a.preventDefault();d.update(()=>{t.$log("onPasteForPlainText");const c=t.$getSelection(),e=a.clipboardData;null!=e&&null!==c&&z(e,c)})}
function C(a,d){D(a,d);d.update(()=>{t.$log("onCutForPlainText");const c=t.$getSelection();null!==c&&c.removeText()})}function D(a,d){a.preventDefault();d.update(()=>{t.$log("onCopyForPlainText");const c=a.clipboardData,e=t.$getSelection();if(null!==e&&null!=c){var b=window.getSelection();if(!b.isCollapsed){var f=b.getRangeAt(0);f&&(b=document.createElement("div"),f=f.cloneContents(),b.appendChild(f),c.setData("text/html",b.innerHTML));c.setData("text/plain",e.getTextContent())}}})}
var E="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?g.useLayoutEffect:g.useEffect;function G(a,d){const c=u.$createParagraphNode();a.append(c);a=document.activeElement;(null!==t.$getSelection()||null!==a&&a===d.getRootElement())&&c.select()}function H(a){a.update(()=>{t.$log("initEditor");const d=t.$getRoot();null===d.getFirstChild()&&G(d,a)})}
function I(a,d){a.update(()=>{t.$log("clearEditor");const c=t.$getRoot();c.clear();G(c,a)},{onUpdate:d})}
function J(a,d){E(()=>{const c=v(a.registerNodes([u.ParagraphNode]),a.addListener("command",(e,b)=>{const f=t.$getSelection();if(null===f)return!1;switch(e){case "deleteCharacter":return f.deleteCharacter(b),!0;case "deleteWord":return f.deleteWord(b),!0;case "deleteLine":return f.deleteLine(b),!0;case "insertText":return"string"===typeof b?f.insertText(b):(e=b.dataTransfer,null!=e?z(e,f):(b=b.data)&&f.insertText(b)),!0;case "removeText":return f.removeText(),!0;case "insertLineBreak":return f.insertLineBreak(b),
!0;case "insertParagraph":return f.insertLineBreak(),!0;case "indentContent":case "outdentContent":case "insertImage":case "insertTable":case "formatElement":case "formatText":return!0;case "keyArrowLeft":e=b.shiftKey;if(A(f,!0))return b.preventDefault(),b=e,e="rtl"===f.anchor.getNode().getParentOrThrow().getDirection(),f.modify(b?"extend":"move",!e,"character"),!0;break;case "keyArrowRight":e=b.shiftKey;if(A(f,!1))return b.preventDefault(),b=e,e="rtl"===f.anchor.getNode().getParentOrThrow().getDirection(),
f.modify(b?"extend":"move",e,"character"),!0;break;case "keyBackspace":return b.preventDefault(),a.execCommand("deleteCharacter",!0);case "keyDelete":return b.preventDefault(),a.execCommand("deleteCharacter",!1);case "keyEnter":return b.preventDefault(),a.execCommand("insertLineBreak");case "clearEditor":I(a);break;case "copy":return D(b,a),!0;case "cut":return C(b,a),!0;case "paste":return B(b,a),!0;case "drop":case "dragstart":return b.preventDefault(),!0}return!1},0));d&&H(a);return c},[a,d]);
y(a)}function K(a){const [d,c]=g.useState(()=>a.getDecorators());E(()=>a.addListener("decorator",e=>{x.flushSync(()=>{c(e)})}),[a]);return g.useMemo(()=>{const e=[],b=Object.keys(d);for(let p=0;p<b.length;p++){var f=b[p];const r=d[f];f=a.getElementByKey(f);null!==f&&e.push(x.createPortal(r,f))}return e},[d,a])}function L(a,d=!0){if(a)return!1;a=t.$getRoot().getTextContent();d&&(a=a.trim());return""===a}
function M(a){if(!L(a,!1))return!1;a=t.$getRoot().getChildren();const d=a.length;if(1<d)return!1;for(let e=0;e<d;e++){var c=a[e];if(t.$isElementNode(c)){if("paragraph"!==c.__type||0!==c.__indent)return!1;c=c.getChildren();const b=c.length;for(let f=0;f<b;f++)if(!t.$isTextNode(c[e]))return!1}}return!0}function N(a){return()=>M(a)}
function O(a){const [d,c]=g.useState(a.getEditorState().read(N(a.isComposing())));E(()=>a.addListener("update",({editorState:e})=>{const b=a.isComposing();e=e.read(N(b));c(e)}),[a]);return d}function P(a){throw a;}module.exports=function({contentEditable:a,placeholder:d,skipInit:c,onError:e}){const [b]=h.useLexicalComposerContext(),f=O(b);J(b,!c);c=K(b);E(()=>b.addListener("error",e||P),[b,e]);return g.createElement(g.Fragment,null,a,f&&d,c)};

@@ -1,39 +0,25 @@

'use strict';var g=require("react"),u=require("@lexical/react/LexicalComposerContext"),v=require("lexical"),w=require("lexical/HeadingNode"),y=require("lexical/ListNode"),z=require("lexical/QuoteNode"),B=require("lexical/CodeNode"),C=require("lexical/ParagraphNode"),D=require("lexical/ListItemNode"),E=require("lexical/LinkNode"),aa=require("@lexical/react/withSubscriptions"),F=require("react-dom");
const G="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,ba=G&&"documentMode"in document?document.documentMode:null;G&&/Win/.test(navigator.platform);G&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;const H=G&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),ca=G&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);G&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent);G&&/^(?=.*Chrome).*/i.test(navigator.userAgent);
const da=G&&"InputEvent"in window&&!ba?"getTargetRanges"in new window.InputEvent("input"):!1;var I=G?g.useLayoutEffect:g.useEffect;function J(a,b){return"selectionchange"===a||"keyup"===a||"pointerup"===a||"pointercancel"===a?b.ownerDocument:b}
function ea(a,b){I(()=>{const e=[],f=[];for(let d=0;d<a.length;d++){const [c,h]=a[d],k=l=>{const m=b.getRootElement();null!==m&&"true"===m.contentEditable&&h(l,b)};e.push(l=>{J(c,l).addEventListener(c,k)});f.push(l=>{J(c,l).removeEventListener(c,k)})}return b.addListener("root",(d,c)=>{null!==c&&f.forEach(h=>h(c));null!==d&&e.forEach(h=>h(d))})},[b,a])}
function K(a){a=a.getLatest();const b=a.constructor.clone(a);b.__parent=a.__parent;v.$isElementNode(a)&&v.$isElementNode(b)?(b.__children=Array.from(a.__children),b.__format=a.__format,b.__indent=a.__indent,b.__dir=a.__dir):v.$isTextNode(a)&&v.$isTextNode(b)?(b.__format=a.__format,b.__style=a.__style,b.__mode=a.__mode,b.__detail=a.__detail):v.$isDecoratorNode(a)&&v.$isDecoratorNode(b)&&(b.__state=a.__state);return b}
function L(a,b,e,f,d){for(var c=b;null!==a;){for(b=a.getParent();null!==b&&b.excludeFromCopy();)b=b.getParent();if(null===b)break;if(!v.$isElementNode(a)||!a.excludeFromCopy()){const h=a.getKey();let k=d.get(h);const l=void 0===k;l&&(k=K(a),d.set(h,k));!v.$isTextNode(k)||k.isSegmented()||k.isToken()?v.$isElementNode(k)&&(k.__children=k.__children.slice(e?c:0,e?void 0:c+1)):k.__text=k.__text.slice(e?c:0,e?void 0:c);if(v.$isRootNode(b)){l&&f.push(h);break}}c=d.get(b.getKey());c=v.$isElementNode(c)?
c.__children.indexOf(a.getKey()):a.getIndexWithinParent();a=b}}function M(a,b){const e=b.split(/\r?\n/);if(1===e.length)a.insertText(b);else{b=[];const f=e.length;for(let d=0;d<f;d++){const c=e[d];""!==c&&b.push(v.$createTextNode(c));d!==f-1&&b.push(v.$createLineBreakNode())}a.insertNodes(b)}}
function fa(a){g.useEffect(()=>{const b=e=>{var f=a.getRootElement();if(document.activeElement===f&&(f=e.data,"string"===typeof f)){try{var d=JSON.parse(f)}catch(c){return}if(d&&"nuanria_messaging"===d.protocol&&"request"===d.type&&(d=d.payload)&&"makeChanges"===d.functionId&&(d=d.args)){const [c,h,k,l,m]=d;a.update(()=>{v.$log("useLexicalDragonSupport");const n=v.$getSelection();if(null!==n){var t=n.anchor;let p=t.getNode(),r=0,q=0;v.$isTextNode(p)&&0<=c&&0<=h&&(r=c,q=c+h,n.setTextNodeRange(p,r,
p,q));if(r!==q||""!==k)M(n,k),p=t.getNode();v.$isTextNode(p)&&(r=l,q=l+m,t=p.getTextContentSize(),r=r>t?t:r,q=q>t?t:q,n.setTextNodeRange(p,r,p,q));e.stopImmediatePropagation()}})}}};window.addEventListener("message",b,!0);return()=>{window.removeEventListener("message",b,!0)}},[a])}function N(a){return a.isToken()||a.isInert()}const ha={bold:1,underline:8,strikethrough:4,italic:2,code:16,subscript:32,superscript:64};let O=!1;
const ia={ul:()=>({node:y.$createListNode("ul")}),ol:()=>({node:y.$createListNode("ol")}),li:()=>({node:D.$createListItemNode()}),h1:()=>({node:w.$createHeadingNode("h1")}),h2:()=>({node:w.$createHeadingNode("h2")}),h3:()=>({node:w.$createHeadingNode("h3")}),h4:()=>({node:w.$createHeadingNode("h4")}),h5:()=>({node:w.$createHeadingNode("h5")}),p:()=>({node:C.$createParagraphNode()}),br:()=>({node:v.$createLineBreakNode()}),a:a=>({node:a instanceof HTMLAnchorElement?E.$createLinkNode(a.href):v.$createTextNode(a.textContent)}),
u:()=>({node:null,format:"underline"}),b:()=>({node:null,format:"bold"}),strong:()=>({node:null,format:"bold"}),i:()=>({node:null,format:"italic"}),em:()=>({node:null,format:"italic"}),"#text":a=>({node:v.$createTextNode(a.textContent)})};
function P(a,b,e,f){let d=[],c=null;var h=a.nodeName.toLowerCase();h=(h=(e._config.htmlTransforms||{})[h]||b[h])?h(a):null;null!==h&&(c=h.node,h.format&&(h=ha[h.format],f=f?f^h:h),null!==c&&(v.$isTextNode(c)&&void 0!==f&&c.setFormat(f),d.push(c)));a=a.childNodes;for(h=0;h<a.length;h++){const k=P(a[h],b,e,f);v.$isElementNode(c)?c.append(...k):null===c&&(d=d.concat(k))}return d}function Q(a,b){a=a.getData("text/plain");null!=a&&M(b,a)}
function R(a,b){var e=a.focus;a=e.offset;"element"===e.type?b=e.getNode().getChildAtIndex(b?a-1:a):(e=e.getNode(),b=b&&0===a||!b&&a===e.getTextContentSize()?b?e.getPreviousSibling():e.getNextSibling():null);return v.$isDecoratorNode(b)}function ja(a){a.preventDefault()}
function S(a,b){a.preventDefault();b.update(()=>{v.$log("onCopyForRichText");const e=a.clipboardData;var f=v.$getSelection();if(null!==f&&null!=e){var d=window.getSelection();if(!d.isCollapsed){var c=d.getRangeAt(0);c&&(d=document.createElement("div"),c=c.cloneContents(),d.appendChild(c),e.setData("text/html",d.innerHTML));e.setData("text/plain",f.getTextContent());d=e.setData;c=JSON;var h=c.stringify;{var k=f.anchor,l=f.focus;var m=k.getCharacterOffset();const A=l.getCharacterOffset();var n=k.getNode(),
t=l.getNode(),p=n.getParentOrThrow();if(n===t&&v.$isTextNode(n)&&(p.canBeEmpty()||1<p.getChildrenSize()))f=K(n),n=A>m,f.__text=f.__text.slice(n?m:A,n?A:m),m=f.getKey(),m={range:[m],nodeMap:[[m,f]]};else if(f=f.getNodes(),0===f.length)m={range:[],nodeMap:[]};else{n=f.length;t=f[0];p=t.getParent();if(null!==p&&!p.canBeEmpty()){var r=p.__children;if(r.length===n){var q=!0;for(var x=0;x<r.length;x++)if(r[x]!==f[x].__key){q=!1;break}q&&(n++,f.push(p))}}p=f[n-1];k=k.isBefore(l);l=new Map;r=[];L(t,k?m:A,
!0,r,l);for(t=0;t<n;t++)if(q=f[t],x=q.getKey(),!(l.has(x)||v.$isElementNode(q)&&q.excludeFromCopy())){const ka=K(q);v.$isRootNode(q.getParent())&&r.push(q.getKey());l.set(x,ka)}L(p,k?A:m,!1,r,l);m={range:r,nodeMap:Array.from(l.entries())}}}d.call(e,"application/x-lexical-nodes",h.call(c,m))}}})}function T(a,b){b.update(()=>{v.$log("onCompositionEnd");v.$setCompositionKey(null);U(b,!0)})}function la(a){return a.getEditorState().read(()=>v.$getSelection())}
function V(a,b,e,f,d){if(a.isAttached()&&(d||!a.isDirty())){const c=a.isComposing();let h=b;(c||d)&&"\u00a0"===b[b.length-1]&&(h=b.slice(0,-1));if(d||h!==a.getTextContent())""===h?(c&&v.$setCompositionKey(null),a.remove()):N(a)||null!==v.$getCompositionKey()&&!c?a.markDirty():(b=v.$getSelection(),null!==b&&null!==e&&null!==f&&(b.setTextNodeRange(a,e,a,f),a.isSegmented()&&(e=a.getTextContent(),e=v.$createTextNode(e),a.replace(e),a=e)),a.setTextContent(h))}}
function W(a,b,e){var f=a.anchor;const d=a.focus;var c=f.getNode();(b=f.key!==d.key||f.offset!==d.offset&&!c.isComposing()||(e||c.isDirty())&&1<b.length||!v.$isTextNode(c)||c.getFormat()!==a.format)||(c.isSegmented()?b=!0:a.isCollapsed()?(b=a.anchor.offset,e=c.getParentOrThrow(),f=c.isToken(),a=0===b&&(!c.canInsertTextBefore()||!e.canInsertTextBefore()||f),c=c.getTextContentSize()===b&&(!c.canInsertTextBefore()||!e.canInsertTextBefore()||f),b=a||c):b=!1);return b}
function ma(a,b){const e=a.inputType;"deleteCompositionText"!==e&&"insertCompositionText"!==e&&b.update(()=>{v.$log("onBeforeInputForRichText");const f=v.$getSelection();if(null!==f)if("deleteContentBackward"===e)v.$setCompositionKey(null),a.preventDefault(),b.execCommand("deleteCharacter",!0);else{var d=a.data;if(!f.dirty&&f.isCollapsed()&&a.getTargetRanges){var c=a.getTargetRanges()[0];c&&f.applyDOMRange(c)}var h=f.focus;c=f.anchor.getNode();h=h.getNode();if("insertText"===e)"\n"===d?(a.preventDefault(),
b.execCommand("insertLineBreak")):"\n\n"===d?(a.preventDefault(),b.execCommand("insertParagraph")):null==d&&a.dataTransfer?(d=a.dataTransfer.getData("text/plain"),a.preventDefault(),M(f,d)):null!=d&&W(f,d,!0)&&(a.preventDefault(),b.execCommand("insertText",d));else switch(a.preventDefault(),e){case "insertFromComposition":d&&(v.$setCompositionKey(null),b.execCommand("insertText",d));break;case "insertLineBreak":v.$setCompositionKey(null);b.execCommand("insertLineBreak");break;case "insertParagraph":v.$setCompositionKey(null);
b.execCommand("insertParagraph");break;case "insertFromYank":case "insertFromDrop":case "insertReplacementText":case "insertFromPaste":c=a.dataTransfer;null!=c?Q(c,f):d&&b.execCommand("insertText",d);break;case "deleteByComposition":c===h&&!v.$isElementNode(c)&&!v.$isElementNode(h)&&N(c)&&N(h)||b.execCommand("removeText");break;case "deleteByDrag":case "deleteByCut":b.execCommand("removeText");break;case "deleteContent":b.execCommand("deleteCharacter",!1);break;case "deleteWordBackward":b.execCommand("deleteWord",
!0);break;case "deleteWordForward":b.execCommand("deleteWord",!1);break;case "deleteHardLineBackward":case "deleteSoftLineBackward":b.execCommand("deleteLine",!0);break;case "deleteContentForward":case "deleteHardLineForward":case "deleteSoftLineForward":b.execCommand("deleteLine",!1);break;case "formatStrikeThrough":b.execCommand("formatText","strikethrough");break;case "formatBold":b.execCommand("formatText","bold");break;case "formatItalic":b.execCommand("formatText","italic");break;case "formatUnderline":b.execCommand("formatText",
"underline");break;case "historyUndo":b.execCommand("undo");break;case "historyRedo":b.execCommand("redo")}}})}function U(a,b){a=window.getSelection();if(null!==a){var {anchorNode:e,anchorOffset:f,focusOffset:d}=a;null!==e&&3===e.nodeType&&(a=v.$getNearestNodeFromDOMNode(e),v.$isTextNode(a)&&V(a,e.nodeValue,f,d,b))}}function na(a){V(a.node,a.text,a.anchorOffset,a.focusOffset,!1)}
const X=[["selectionchange",function(a,b){a=window.getSelection();const e=b.getRootElement();e&&!e.contains(a.anchorNode)||b.update(()=>{v.$log("onSelectionChange");const f=v.$getSelection();if(null!==f&&f.isCollapsed()){var d=f.anchor;"text"===d.type?(d=d.getNode(),f.format=d.getFormat()):"element"===d.type&&(f.format=0)}b.execCommand("selectionChange")})}],["keydown",function(a,b){O="Unidentified"===a.key&&229===a.keyCode;b.isComposing()||b.update(()=>{v.$log("onKeyDown");if(null!==v.$getSelection()){var {keyCode:e,
shiftKey:f,ctrlKey:d,metaKey:c,altKey:h}=a;if(39!==e||d||c||h)if(37!==e||d||c||h)if(38!==e||d||c||h)if(40!==e||d||c||h)if(13===e&&f)b.execCommand("keyEnter",a);else if(H&&d&&79===e)a.preventDefault(),b.execCommand("insertLineBreak",!0);else if(13!==e||f){var k=H?h||c?!1:8===e||72===e&&d:d||h||c?!1:8===e;k?8===e?b.execCommand("keyBackspace",a):b.execCommand("deleteCharacter",!0):27===e?b.execCommand("keyEscape",a):(k=H?f||h||c?!1:46===e||68===e&&d:d||h||c?!1:46===e,k?46===e?b.execCommand("keyDelete",
a):b.execCommand("deleteCharacter",!1):8===e&&(H?h:d)?(a.preventDefault(),b.execCommand("deleteWord",!0)):46===e&&(H?h:d)?(a.preventDefault(),b.execCommand("deleteWord",!1)):H&&c&&8===e?(a.preventDefault(),b.execCommand("deleteLine",!0)):H&&c&&46===e?(a.preventDefault(),b.execCommand("deleteLine",!1)):66===e&&(H?c:d)?(a.preventDefault(),b.execCommand("formatText","bold")):85===e&&(H?c:d)?(a.preventDefault(),b.execCommand("formatText","underline")):73===e&&(H?c:d)?(a.preventDefault(),b.execCommand("formatText",
"italic")):9!==e||h||d||c?90===e&&!f&&(H?c:d)?(a.preventDefault(),b.execCommand("undo")):(k=H?90===e&&c&&f:89===e&&d||90===e&&d&&f,k&&(a.preventDefault(),b.execCommand("redo"))):b.execCommand("keyTab",a))}else b.execCommand("keyEnter",a);else b.execCommand("keyArrowDown",a);else b.execCommand("keyArrowUp",a);else b.execCommand("keyArrowLeft",a);else b.execCommand("keyArrowRight",a)}})}],["compositionstart",function(a,b){b.update(()=>{v.$log("onCompositionStart");const e=v.$getSelection();if(null!==
e&&!b.isComposing()){const f=e.anchor;v.$setCompositionKey(f.key);null==a.data||O&&"element"!==f.type&&e.isCollapsed()||b.execCommand("insertText"," ")}})}],["compositionend",function(a,b){ca?setTimeout(()=>{T(a,b)},0):T(a,b)}],["cut",function(a,b){S(a,b);b.update(()=>{v.$log("onCutForRichText");const e=v.$getSelection();null!==e&&e.removeText()})}],["copy",S],["dragstart",function(a){a.preventDefault()}],["paste",function(a,b){a.preventDefault();b.update(()=>{v.$log("onPasteForRichText");const e=
v.$getSelection();var f=a.clipboardData;if(null!=f&&null!==e)a:{var d=f.getData("application/x-lexical-nodes");if(d)try{var c=JSON.parse(d);const {range:m,nodeMap:n}=c;var h=new Map(n);d=[];for(c=0;c<m.length;c++){var k=h.get(m[c]);if(void 0!==k){var l=v.$createNodeFromParse(k,h);d.push(l)}}e.insertNodes(d);break a}catch(m){}if(h=f.getData("text/html")){h=(new DOMParser).parseFromString(h,"text/html");f=[];h=h.body?Array.from(h.body.childNodes):[];k=h.length;for(l=0;l<k;l++)d=P(h[l],ia,b),null!==
d&&(f=f.concat(d));h=[];k=null;for(l=0;l<f.length;l++)d=f[l],!v.$isElementNode(d)||d.isInline()?(null===k&&(k=C.$createParagraphNode(),h.push(k)),null!==k&&k.append(d)):(h.push(d),k=null);e.insertNodes(h)}else Q(f,e)}})}],["input",function(a,b){a.stopPropagation();b.update(()=>{v.$log("onInput");const e=v.$getSelection(),f=a.data;null!=f&&null!==e&&W(e,f,!1)?b.execCommand("insertText",f):U(b,!1);v.$flushMutations()})}],["click",function(a,b){b.update(()=>{v.$log("onClick");const e=v.$getSelection();
if(null!==e){var f=e.anchor;"element"===f.type&&0===f.offset&&e.isCollapsed()&&1===v.$getRoot().getChildrenSize()&&f.getNode().getTopLevelElementOrThrow().isEmpty()&&(f=la(b),null!==f&&e.is(f)&&(window.getSelection().removeAllRanges(),e.dirty=!0))}})}]];da?X.push(["beforeinput",ma]):X.push(["drop",ja]);function Y(a,b){const e=C.$createParagraphNode();a.append(e);a=document.activeElement;(null!==v.$getSelection()||null!==a&&a===b.getRootElement())&&e.select()}
function oa(a){a.update(()=>{v.$log("initEditor");const b=v.$getRoot();null===b.getFirstChild()&&Y(b,a)})}function pa(a,b){a.update(()=>{v.$log("clearEditor");const e=v.$getRoot();e.clear();Y(e,a)},{onUpdate:b})}
function qa(a,b){I(()=>{const e=aa(a.registerNodes([w.HeadingNode,y.ListNode,z.QuoteNode,B.CodeNode,C.ParagraphNode,D.ListItemNode]),a.addListener("textmutation",na),a.addListener("command",(f,d)=>{var c=v.$getSelection();if(null===c)return!1;switch(f){case "deleteCharacter":return c.deleteCharacter(d),!0;case "deleteWord":return c.deleteWord(d),!0;case "deleteLine":return c.deleteLine(d),!0;case "insertText":return c.insertText(d),!0;case "removeText":return c.removeText(),!0;case "formatText":return c.formatText(d),
!0;case "formatElement":return c=c.anchor.getNode(),(v.$isElementNode(c)?c:c.getParentOrThrow()).setFormat(d),!0;case "insertLineBreak":return c.insertLineBreak(d),!0;case "insertParagraph":return c.insertParagraph(),!0;case "indentContent":return c=c.anchor,c="element"===c.type?c.getNode():c.getNode().getParentOrThrow(),c.canInsertTab()?a.execCommand("insertText","\t"):10!==c.getIndent()&&c.setIndent(c.getIndent()+1),!0;case "outdentContent":return c=c.anchor,d=c.getNode(),f="element"===c.type?c.getNode():
c.getNode().getParentOrThrow(),f.canInsertTab()?"\t"===d.getTextContent()[c.offset-1]&&a.execCommand("deleteCharacter",!0):0!==f.getIndent()&&f.setIndent(f.getIndent()-1),!0;case "keyArrowLeft":f=d.shiftKey;if(R(c,!0))return d.preventDefault(),d=f,f="rtl"===c.anchor.getNode().getParentOrThrow().getDirection(),c.modify(d?"extend":"move",!f,"character"),!0;break;case "keyArrowRight":f=d.shiftKey;if(R(c,!1))return d.preventDefault(),d=f,f="rtl"===c.anchor.getNode().getParentOrThrow().getDirection(),
c.modify(d?"extend":"move",f,"character"),!0;break;case "keyBackspace":return d.preventDefault(),a.execCommand("deleteCharacter",!0);case "keyDelete":return d.preventDefault(),a.execCommand("deleteCharacter",!1);case "keyEnter":return d.preventDefault(),d.shiftKey?a.execCommand("insertLineBreak"):a.execCommand("insertParagraph");case "keyTab":return d.preventDefault(),a.execCommand(d.shiftKey?"outdentContent":"indentContent");case "keyEscape":return a.blur(),!0;case "clearEditor":pa(a)}return!1},
0));b&&oa(a);return e},[a,b]);ea(X,a);fa(a)}function ra(a){const [b,e]=g.useState(()=>a.getDecorators());I(()=>a.addListener("decorator",f=>{F.flushSync(()=>{e(f)})}),[a]);return g.useMemo(()=>{const f=[],d=Object.keys(b);for(let h=0;h<d.length;h++){var c=d[h];const k=b[c];c=a.getElementByKey(c);null!==c&&f.push(F.createPortal(k,c))}return f},[b,a])}function sa(a,b=!0){if(a)return!1;a=v.$getRoot().getTextContent();b&&(a=a.trim());return""===a}
function ta(a){if(!sa(a,!1))return!1;a=v.$getRoot().getChildren();const b=a.length;if(1<b)return!1;for(let f=0;f<b;f++){var e=a[f];if(v.$isElementNode(e)){if("paragraph"!==e.__type||0!==e.__indent)return!1;e=e.getChildren();const d=e.length;for(let c=0;c<d;c++)if(!v.$isTextNode(e[f]))return!1}}return!0}function Z(a){return()=>ta(a)}
function ua(a){const [b,e]=g.useState(a.getEditorState().read(Z(a.isComposing())));I(()=>a.addListener("update",({editorState:f})=>{const d=a.isComposing();f=f.read(Z(d));e(f)}),[a]);return b}function va(a){throw a;}module.exports=function({contentEditable:a,placeholder:b,skipInit:e,onError:f}){const [d]=u.useLexicalComposerContext(),c=ua(d);qa(d,!e);e=ra(d);I(()=>d.addListener("error",f||va),[d,f]);return g.createElement(g.Fragment,null,a,c&&b,e)};
'use strict';var g=require("react"),v=require("@lexical/react/LexicalComposerContext"),x=require("lexical"),z=require("lexical/HeadingNode"),A=require("lexical/ListNode"),B=require("lexical/QuoteNode"),C=require("lexical/CodeNode"),D=require("lexical/ParagraphNode"),E=require("lexical/ListItemNode"),F=require("lexical/LinkNode"),G=require("@lexical/react/withSubscriptions"),H=require("react-dom");
function I(a){g.useEffect(()=>{const d=f=>{var e=a.getRootElement();if(document.activeElement===e&&(e=f.data,"string"===typeof e)){try{var c=JSON.parse(e)}catch(b){return}if(c&&"nuanria_messaging"===c.protocol&&"request"===c.type&&(c=c.payload)&&"makeChanges"===c.functionId&&(c=c.args)){const [b,k,h,n,t]=c;a.update(()=>{x.$log("useLexicalDragonSupport");const l=x.$getSelection();if(null!==l){var m=l.anchor;let q=m.getNode(),p=0,r=0;x.$isTextNode(q)&&0<=b&&0<=k&&(p=b,r=b+k,l.setTextNodeRange(q,p,q,
r));if(p!==r||""!==h)l.insertRawText(h),q=m.getNode();x.$isTextNode(q)&&(p=n,r=n+t,m=q.getTextContentSize(),p=p>m?m:p,r=r>m?m:r,l.setTextNodeRange(q,p,q,r));f.stopImmediatePropagation()}})}}};window.addEventListener("message",d,!0);return()=>{window.removeEventListener("message",d,!0)}},[a])}
function J(a){a=a.getLatest();const d=a.constructor.clone(a);d.__parent=a.__parent;x.$isElementNode(a)&&x.$isElementNode(d)?(d.__children=Array.from(a.__children),d.__format=a.__format,d.__indent=a.__indent,d.__dir=a.__dir):x.$isTextNode(a)&&x.$isTextNode(d)?(d.__format=a.__format,d.__style=a.__style,d.__mode=a.__mode,d.__detail=a.__detail):x.$isDecoratorNode(a)&&x.$isDecoratorNode(d)&&(d.__state=a.__state);return d}
function K(a,d,f,e,c){for(var b=d;null!==a;){for(d=a.getParent();null!==d&&d.excludeFromCopy();)d=d.getParent();if(null===d)break;if(!x.$isElementNode(a)||!a.excludeFromCopy()){const k=a.getKey();let h=c.get(k);const n=void 0===h;n&&(h=J(a),c.set(k,h));!x.$isTextNode(h)||h.isSegmented()||h.isToken()?x.$isElementNode(h)&&(h.__children=h.__children.slice(f?b:0,f?void 0:b+1)):h.__text=h.__text.slice(f?b:0,f?void 0:b);if(x.$isRootNode(d)){n&&e.push(k);break}}b=c.get(d.getKey());b=x.$isElementNode(b)?
b.__children.indexOf(a.getKey()):a.getIndexWithinParent();a=d}}
const L={bold:1,underline:8,strikethrough:4,italic:2,code:16,subscript:32,superscript:64},M={ul:()=>({node:A.$createListNode("ul")}),ol:()=>({node:A.$createListNode("ol")}),li:()=>({node:E.$createListItemNode()}),h1:()=>({node:z.$createHeadingNode("h1")}),h2:()=>({node:z.$createHeadingNode("h2")}),h3:()=>({node:z.$createHeadingNode("h3")}),h4:()=>({node:z.$createHeadingNode("h4")}),h5:()=>({node:z.$createHeadingNode("h5")}),p:()=>({node:D.$createParagraphNode()}),br:()=>({node:x.$createLineBreakNode()}),
a:a=>({node:a instanceof HTMLAnchorElement?F.$createLinkNode(a.href):x.$createTextNode(a.textContent)}),u:()=>({node:null,format:"underline"}),b:a=>({node:null,format:"normal"===a.style.fontWeight?null:"bold"}),strong:()=>({node:null,format:"bold"}),i:()=>({node:null,format:"italic"}),em:()=>({node:null,format:"italic"}),td:a=>{const d=a.classList.contains("js-file-line");return{node:null,after:f=>{d&&a.parentNode&&a.parentNode.nextSibling&&f.push(x.$createLineBreakNode());return f}}},table:a=>({node:a.classList.contains("js-file-line-container")?
C.$createCodeNode():null}),span:a=>({node:null,format:"700"===a.style.fontWeight?"bold":null}),"#text":a=>({node:x.$createTextNode(a.textContent)}),pre:()=>({node:C.$createCodeNode()}),div:a=>({node:null!==a.style.fontFamily.match("monospace")?C.$createCodeNode():null,after:d=>{const f=a.parentNode;null!=f&&a!==f.lastChild&&d.push(x.$createLineBreakNode());return d}})};
function N(a,d,f,e){let c=[],b=null;var k=a.nodeName.toLowerCase(),h=(k=(f._config.htmlTransforms||{})[k]||d[k])?k(a):null;k=null;null!==h&&(k=h.after,b=h.node,h.format&&(h=L[h.format],e=e?e^h:h),null!==b&&(x.$isTextNode(b)&&void 0!==e&&b.setFormat(e),c.push(b)));a=a.childNodes;for(h=0;h<a.length;h++){const n=N(a[h],d,f,e);x.$isElementNode(b)?b.append(...n):null===b&&(c=c.concat(n))}null!=k&&(c=k(c,b));return c}
function O(a,d,f){var e=a.getData("application/x-lexical-editor");if(e){var c=f._config.namespace;try{const n=JSON.parse(e);if(n.namespace===c){const {range:t,nodeMap:l}=n.state;var b=new Map(l);e=[];for(c=0;c<t.length;c++){var k=b.get(t[c]);if(void 0!==k){var h=x.$createNodeFromParse(k,b);e.push(h)}}d.insertNodes(e);return}}catch(n){}}if(b=a.getData("text/html")){b=(new DOMParser).parseFromString(b,"text/html");a=[];b=b.body?Array.from(b.body.childNodes):[];k=b.length;for(h=0;h<k;h++)e=N(b[h],M,
f),null!==e&&(a=a.concat(e));f=a;a=[];b=null;for(k=0;k<f.length;k++)h=f[k],!x.$isElementNode(h)||h.isInline()?(null===b&&(b=D.$createParagraphNode(),a.push(b)),null!==b&&b.append(h)):(a.push(h),b=null);d.insertNodes(a)}else f=a.getData("text/plain"),null!=f&&d.insertRawText(f)}
function P(a,d){var f=a.focus;a=f.offset;"element"===f.type?d=f.getNode().getChildAtIndex(d?a-1:a):(f=f.getNode(),d=d&&0===a||!d&&a===f.getTextContentSize()?d?f.getPreviousSibling():f.getNextSibling():null);return x.$isDecoratorNode(d)}function Q(a,d){a.preventDefault();d.update(()=>{x.$log("onPasteForRichText");const f=x.$getSelection(),e=a.clipboardData;null!=e&&null!==f&&O(e,f,d)})}
function R(a,d){S(a,d);d.update(()=>{x.$log("onCutForRichText");const f=x.$getSelection();null!==f&&f.removeText()})}
function S(a,d){a.preventDefault();d.update(()=>{x.$log("onCopyForRichText");const f=a.clipboardData;var e=x.$getSelection();if(null!==e&&null!=f){var c=window.getSelection();if(!c.isCollapsed){var b=c.getRangeAt(0);b&&(c=document.createElement("div"),b=b.cloneContents(),c.appendChild(b),f.setData("text/html",c.innerHTML));f.setData("text/plain",e.getTextContent());c=d._config.namespace;b=f.setData;var k=JSON,h=k.stringify;{var n=e.anchor,t=e.focus;var l=n.getCharacterOffset();const y=t.getCharacterOffset();
var m=n.getNode(),q=t.getNode(),p=m.getParentOrThrow();if(m===q&&x.$isTextNode(m)&&(p.canBeEmpty()||1<p.getChildrenSize()))e=J(m),m=y>l,e.__text=e.__text.slice(m?l:y,m?y:l),l=e.getKey(),l={range:[l],nodeMap:[[l,e]]};else if(e=e.getNodes(),0===e.length)l={range:[],nodeMap:[]};else{m=e.length;q=e[0];p=q.getParent();if(null!==p&&!p.canBeEmpty()){var r=p.__children;if(r.length===m){var u=!0;for(var w=0;w<r.length;w++)if(r[w]!==e[w].__key){u=!1;break}u&&(m++,e.push(p))}}p=e[m-1];n=n.isBefore(t);t=new Map;
r=[];K(q,n?l:y,!0,r,t);for(q=0;q<m;q++)if(u=e[q],w=u.getKey(),!(t.has(w)||x.$isElementNode(u)&&u.excludeFromCopy())){const W=J(u);x.$isRootNode(u.getParent())&&r.push(u.getKey());t.set(w,W)}K(p,n?y:l,!1,r,t);l={range:r,nodeMap:Array.from(t.entries())}}}b.call(f,"application/x-lexical-editor",h.call(k,{namespace:c,state:l}))}}})}var T="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?g.useLayoutEffect:g.useEffect;
function U(a,d){const f=D.$createParagraphNode();a.append(f);a=document.activeElement;(null!==x.$getSelection()||null!==a&&a===d.getRootElement())&&f.select()}function V(a){a.update(()=>{x.$log("initEditor");const d=x.$getRoot();null===d.getFirstChild()&&U(d,a)})}function X(a,d){a.update(()=>{x.$log("clearEditor");const f=x.$getRoot();f.clear();U(f,a)},{onUpdate:d})}
function Y(a,d){T(()=>{const f=G(a.registerNodes([z.HeadingNode,A.ListNode,B.QuoteNode,C.CodeNode,D.ParagraphNode,E.ListItemNode]),a.addListener("command",(e,c)=>{var b=x.$getSelection();if(null===b)return!1;switch(e){case "deleteCharacter":return b.deleteCharacter(c),!0;case "deleteWord":return b.deleteWord(c),!0;case "deleteLine":return b.deleteLine(c),!0;case "insertText":return"string"===typeof c?b.insertText(c):(e=c.dataTransfer,null!=e?O(e,b,a):(c=c.data)&&b.insertText(c)),!0;case "removeText":return b.removeText(),
!0;case "formatText":return b.formatText(c),!0;case "formatElement":return b=b.anchor.getNode(),(x.$isElementNode(b)?b:b.getParentOrThrow()).setFormat(c),!0;case "insertLineBreak":return b.insertLineBreak(c),!0;case "insertParagraph":return b.insertParagraph(),!0;case "indentContent":return b=b.anchor,b="element"===b.type?b.getNode():b.getNode().getParentOrThrow(),b.canInsertTab()?a.execCommand("insertText","\t"):10!==b.getIndent()&&b.setIndent(b.getIndent()+1),!0;case "outdentContent":return b=b.anchor,
c=b.getNode(),e="element"===b.type?b.getNode():b.getNode().getParentOrThrow(),e.canInsertTab()?"\t"===c.getTextContent()[b.offset-1]&&a.execCommand("deleteCharacter",!0):0!==e.getIndent()&&e.setIndent(e.getIndent()-1),!0;case "keyArrowLeft":e=c.shiftKey;if(P(b,!0))return c.preventDefault(),c=e,e="rtl"===b.anchor.getNode().getParentOrThrow().getDirection(),b.modify(c?"extend":"move",!e,"character"),!0;break;case "keyArrowRight":e=c.shiftKey;if(P(b,!1))return c.preventDefault(),c=e,e="rtl"===b.anchor.getNode().getParentOrThrow().getDirection(),
b.modify(c?"extend":"move",e,"character"),!0;break;case "keyBackspace":return c.preventDefault(),a.execCommand("deleteCharacter",!0);case "keyDelete":return c.preventDefault(),a.execCommand("deleteCharacter",!1);case "keyEnter":return c.preventDefault(),c.shiftKey?a.execCommand("insertLineBreak"):a.execCommand("insertParagraph");case "keyTab":return c.preventDefault(),a.execCommand(c.shiftKey?"outdentContent":"indentContent");case "keyEscape":return a.blur(),!0;case "clearEditor":X(a);break;case "copy":return S(c,
a),!0;case "cut":return R(c,a),!0;case "paste":return Q(c,a),!0;case "drop":case "dragstart":return c.preventDefault(),!0}return!1},0));d&&V(a);return f},[a,d]);I(a)}function aa(a){const [d,f]=g.useState(()=>a.getDecorators());T(()=>a.addListener("decorator",e=>{H.flushSync(()=>{f(e)})}),[a]);return g.useMemo(()=>{const e=[],c=Object.keys(d);for(let k=0;k<c.length;k++){var b=c[k];const h=d[b];b=a.getElementByKey(b);null!==b&&e.push(H.createPortal(h,b))}return e},[d,a])}
function ba(a,d=!0){if(a)return!1;a=x.$getRoot().getTextContent();d&&(a=a.trim());return""===a}function ca(a){if(!ba(a,!1))return!1;a=x.$getRoot().getChildren();const d=a.length;if(1<d)return!1;for(let e=0;e<d;e++){var f=a[e];if(x.$isElementNode(f)){if("paragraph"!==f.__type||0!==f.__indent)return!1;f=f.getChildren();const c=f.length;for(let b=0;b<c;b++)if(!x.$isTextNode(f[e]))return!1}}return!0}function Z(a){return()=>ca(a)}
function da(a){const [d,f]=g.useState(a.getEditorState().read(Z(a.isComposing())));T(()=>a.addListener("update",({editorState:e})=>{const c=a.isComposing();e=e.read(Z(c));f(e)}),[a]);return d}function ea(a){throw a;}module.exports=function({contentEditable:a,placeholder:d,skipInit:f,onError:e}){const [c]=v.useLexicalComposerContext(),b=da(c);Y(c,!f);f=aa(c);T(()=>c.addListener("error",e||ea),[c,e]);return g.createElement(g.Fragment,null,a,b&&d,f)};

@@ -1,3 +0,4 @@

'use strict';var d=require("react"),g=require("@lexical/react/LexicalComposerContext"),h=require("lexical"),k=require("lexical/TableNode"),p=require("lexical/TableCellNode"),q=require("lexical/TableRowNode"),r=require("lexical/ParagraphNode");function t(c,e,f=!0){const a=k.$createTableNode();for(let b=0;b<c;b++){const l=q.$createTableRowNode();for(let m=0;m<e;m++){const n=p.$createTableCellNode(0===b&&f);n.append(h.$createTextNode());l.append(n)}a.append(l)}return a}
module.exports=function(){const [c]=g.useLexicalComposerContext();d.useEffect(()=>{const e=c.addListener("command",a=>{if("insertTable"===a){h.$log("handleAddTable");a=h.$getSelection();if(null===a)return!0;a=a.focus.getNode();if(null!==a){a=a.getTopLevelElementOrThrow();const b=t(3,3);a.insertAfter(b);b.insertAfter(r.$createParagraphNode());b.getFirstChildOrThrow().getFirstChildOrThrow().select()}return!0}return!1},0),f=c.registerNodes([k.TableNode,p.TableCellNode,q.TableRowNode]);return()=>{e();
'use strict';var d=require("react"),g=require("@lexical/react/LexicalComposerContext"),h=require("lexical"),k=require("lexical/TableNode"),l=require("lexical/TableCellNode"),r=require("lexical/TableRowNode"),t=require("lexical/ParagraphNode");
function u(c,e,f=!0){const a=k.$createTableNode();for(let b=0;b<c;b++){const m=r.$createTableRowNode();for(let n=0;n<e;n++){const p=l.$createTableCellNode(0===b&&f),q=t.$createParagraphNode();q.append(h.$createTextNode());p.append(q);m.append(p)}a.append(m)}return a}
module.exports=function(){const [c]=g.useLexicalComposerContext();d.useEffect(()=>{const e=c.addListener("command",a=>{if("insertTable"===a){h.$log("handleAddTable");a=h.$getSelection();if(null===a)return!0;a=a.focus.getNode();if(null!==a){a=a.getTopLevelElementOrThrow();const b=u(3,3);a.insertAfter(b);b.insertAfter(t.$createParagraphNode());b.getFirstChildOrThrow().getFirstChildOrThrow().select()}return!0}return!1},0),f=c.registerNodes([k.TableNode,l.TableCellNode,r.TableRowNode]);return()=>{e();
f()}},[c]);return null};

@@ -15,7 +15,7 @@ {

"license": "MIT",
"version": "0.1.2",
"version": "0.1.3",
"dependencies": {
"lexical": "0.1.2",
"@lexical/helpers": "0.1.2",
"@lexical/yjs": "0.1.2"
"lexical": "0.1.3",
"@lexical/helpers": "0.1.3",
"@lexical/yjs": "0.1.3"
},

@@ -22,0 +22,0 @@ "peerDependencies": {

@@ -1,2 +0,1 @@

'use strict';var a=require("react");const e="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,g=e&&"documentMode"in document?document.documentMode:null;e&&/Win/.test(navigator.platform);e&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;e&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);e&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);e&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent);e&&/^(?=.*Chrome).*/i.test(navigator.userAgent);
e&&"InputEvent"in window&&!g?"getTargetRanges"in new window.InputEvent("input"):!1;var h=e?a.useLayoutEffect:a.useEffect;function k(b,d,c){b=b.get(d);return void 0!==b?b:"function"===typeof c?c():c}module.exports=function(b,d,c){c=k(b,d,c);const [f,l]=a.useState(c);h(()=>{b.get(d)!==f&&b.set(d,f)},[d,f,b]);return[c,l]};
'use strict';var e=require("react"),g="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?e.useLayoutEffect:e.useEffect;module.exports=function(a,c,f){const [d,h]=e.useState(()=>{var b=a.get(c);b=void 0!==b?b:"function"===typeof f?f():f;return b});g(()=>{a.get(c)!==d&&a.set(c,d)},[c,d,a]);g(()=>a.observe((b,k)=>{b===c&&(a._map.set(b,k),h(k))}),[a,c]);return[d,h]};

@@ -1,2 +0,2 @@

'use strict';var b=require("react"),d=require("lexical");const f="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,g=f&&"documentMode"in document?document.documentMode:null;f&&/Win/.test(navigator.platform);f&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;f&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);f&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);f&&/Version\/[\d\.]+.*Safari/.test(navigator.userAgent);
f&&/^(?=.*Chrome).*/i.test(navigator.userAgent);f&&"InputEvent"in window&&!g?"getTargetRanges"in new window.InputEvent("input"):!1;var h=f?b.useLayoutEffect:b.useEffect;function k(a,c=!0){if(a)return!1;a=d.$getRoot().getTextContent();c&&(a=a.trim());return""===a}function l(a,c){return()=>k(a,c)}module.exports=function(a,c){const [m,n]=b.useState(a.getEditorState().read(l(a.isComposing(),c)));h(()=>a.addListener("update",({editorState:e})=>{const p=a.isComposing();e=e.read(l(p,c));n(e)}),[a,c]);return m};
'use strict';var c=require("react"),e=require("lexical"),f="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?c.useLayoutEffect:c.useEffect;function g(a,b=!0){if(a)return!1;a=e.$getRoot().getTextContent();b&&(a=a.trim());return""===a}function h(a,b){return()=>g(a,b)}
module.exports=function(a,b){const [k,l]=c.useState(a.getEditorState().read(h(a.isComposing(),b)));f(()=>a.addListener("update",({editorState:d})=>{const m=a.isComposing();d=d.read(h(m,b));l(d)}),[a,b]);return k};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc