@react-fabric/lexical 1.0.0-beta.5 → 1.0.0-beta.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{src/editor/Lexical.module.css → css/_lexical.css} +4 -4
- package/css/styles.css +24 -0
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +29 -19
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.js +1 -1
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +9 -9
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.dev.js +142 -75
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.js +1 -1
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.prod.js +25 -21
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.dev.js +10 -3
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.js +1 -1
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.prod.js +3 -3
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.dev.js +147 -103
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.js +1 -1
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.prod.js +10 -10
- package/dist/cjs/node_modules/@lexical/list/LexicalList.dev.js +254 -178
- package/dist/cjs/node_modules/@lexical/list/LexicalList.js +1 -1
- package/dist/cjs/node_modules/@lexical/list/LexicalList.prod.js +19 -16
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.dev.js +53 -29
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.js +1 -1
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.prod.js +10 -10
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.dev.js +176 -194
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.js +1 -1
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.prod.js +25 -18
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.dev.js +1925 -793
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.js +1 -1
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.prod.js +48 -40
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.dev.js +426 -144
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.js +11 -1
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.prod.js +46 -32
- package/dist/cjs/node_modules/prismjs/prism.js +1 -1
- package/dist/cjs/packages/lexical/src/editor/LexicalEditor.js +4 -5
- package/dist/cjs/packages/lexical/src/hooks/useFormatWatcher.js +81 -76
- package/dist/cjs/packages/lexical/src/plugins/ToolbarPlugin.js +4 -6
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +29 -19
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.js +1 -1
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +3 -3
- package/dist/esm/node_modules/@lexical/code/LexicalCode.dev.js +139 -76
- package/dist/esm/node_modules/@lexical/code/LexicalCode.js +1 -1
- package/dist/esm/node_modules/@lexical/code/LexicalCode.prod.js +4 -4
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.dev.js +11 -4
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.js +1 -1
- package/dist/esm/node_modules/@lexical/html/LexicalHtml.prod.js +3 -3
- package/dist/esm/node_modules/@lexical/link/LexicalLink.dev.js +149 -105
- package/dist/esm/node_modules/@lexical/link/LexicalLink.js +1 -1
- package/dist/esm/node_modules/@lexical/link/LexicalLink.prod.js +4 -4
- package/dist/esm/node_modules/@lexical/list/LexicalList.dev.js +253 -180
- package/dist/esm/node_modules/@lexical/list/LexicalList.js +1 -1
- package/dist/esm/node_modules/@lexical/list/LexicalList.prod.js +4 -4
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.dev.js +54 -30
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.js +1 -1
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.prod.js +3 -3
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.dev.js +171 -196
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.js +1 -1
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.prod.js +4 -4
- package/dist/esm/node_modules/@lexical/table/LexicalTable.dev.js +1920 -796
- package/dist/esm/node_modules/@lexical/table/LexicalTable.js +1 -1
- package/dist/esm/node_modules/@lexical/table/LexicalTable.prod.js +4 -4
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.dev.js +413 -145
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.js +7 -2
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.prod.js +3 -3
- package/dist/esm/node_modules/prismjs/prism.js +1 -1
- package/dist/esm/packages/lexical/src/editor/LexicalEditor.js +4 -5
- package/dist/esm/packages/lexical/src/hooks/useFormatWatcher.js +82 -77
- package/dist/esm/packages/lexical/src/plugins/ToolbarPlugin.js +4 -6
- package/dist/types/hooks/useFormatWatcher.d.ts +2 -2
- package/dist/types/nodes/StickyNode.d.ts +0 -1
- package/package.json +13 -12
- package/src/components/StickyComponent.tsx +1 -1
- package/src/editor/LexicalEditor.tsx +28 -25
- package/src/hooks/useFormatWatcher.ts +28 -27
- package/src/plugins/ToolbarPlugin.tsx +22 -6
- package/dist/cjs/editor/Lexical.module.css +0 -1
- package/dist/esm/editor/Lexical.module.css +0 -1
|
@@ -11,10 +11,15 @@ import * as LexicalUtils_prod from './LexicalUtils.prod.js';
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
const mod = process.env.NODE_ENV
|
|
14
|
+
const mod = process.env.NODE_ENV !== 'production' ? LexicalUtils_dev : LexicalUtils_prod;
|
|
15
|
+
const $descendantsMatching = mod.$descendantsMatching;
|
|
15
16
|
const $findMatchingParent = mod.$findMatchingParent;
|
|
17
|
+
const $getAdjacentCaret = mod.$getAdjacentCaret;
|
|
16
18
|
const $getNearestBlockElementAncestorOrThrow = mod.$getNearestBlockElementAncestorOrThrow;
|
|
17
19
|
const $getNearestNodeOfType = mod.$getNearestNodeOfType;
|
|
20
|
+
const $insertFirst = mod.$insertFirst;
|
|
21
|
+
const $insertNodeToNearestRoot = mod.$insertNodeToNearestRoot;
|
|
22
|
+
const $unwrapAndFilterDescendants = mod.$unwrapAndFilterDescendants;
|
|
18
23
|
const addClassNamesToElement = mod.addClassNamesToElement;
|
|
19
24
|
const isBlockDomNode = mod.isBlockDomNode;
|
|
20
25
|
const isHTMLAnchorElement = mod.isHTMLAnchorElement;
|
|
@@ -23,4 +28,4 @@ const mergeRegister = mod.mergeRegister;
|
|
|
23
28
|
const objectKlassEquals = mod.objectKlassEquals;
|
|
24
29
|
const removeClassNamesFromElement = mod.removeClassNamesFromElement;
|
|
25
30
|
|
|
26
|
-
export { $findMatchingParent, $getNearestBlockElementAncestorOrThrow, $getNearestNodeOfType, addClassNamesToElement, isBlockDomNode, isHTMLAnchorElement, isHTMLElement, mergeRegister, objectKlassEquals, removeClassNamesFromElement };
|
|
31
|
+
export { $descendantsMatching, $findMatchingParent, $getAdjacentCaret, $getNearestBlockElementAncestorOrThrow, $getNearestNodeOfType, $insertFirst, $insertNodeToNearestRoot, $unwrapAndFilterDescendants, addClassNamesToElement, isBlockDomNode, isHTMLAnchorElement, isHTMLElement, mergeRegister, objectKlassEquals, removeClassNamesFromElement };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { $getRoot, $isElementNode, $cloneWithProperties, $setSelection, $getSelection, $getPreviousSelection, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, $splitNode, $createParagraphNode,
|
|
3
|
+
import { isHTMLElement, $getRoot, $isElementNode, $getChildCaret, $getSiblingCaret, $getAdjacentChildCaret, $getChildCaretOrSelf, makeStepwiseIterator, $isChildCaret, $cloneWithProperties, $setSelection, $getSelection, $getPreviousSelection, $isRangeSelection, $isRootOrShadowRoot, $getChildCaretAtIndex, $isTextNode, $splitNode, $createParagraphNode, $isSiblingCaret, $rewindSiblingCaret, $getState, $setState, getDOMTextNode } from 'lexical';
|
|
4
4
|
export { $splitNode, isBlockDomNode, isHTMLAnchorElement, isHTMLElement, isInlineDomNode } from 'lexical';
|
|
5
5
|
import { createRectsFromDOMRange } from '../selection/LexicalSelection.js';
|
|
6
6
|
|
|
@@ -12,6 +12,6 @@ import { createRectsFromDOMRange } from '../selection/LexicalSelection.js';
|
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
function
|
|
15
|
+
function L(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}const N="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,P=N&&"documentMode"in document?document.documentMode:null,b=N&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),T=N&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),M=!(!N||!("InputEvent"in window)||P)&&"getTargetRanges"in new window.InputEvent("input"),R=N&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),B=N&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,_=N&&/Android/.test(navigator.userAgent),O=N&&/^(?=.*Chrome).*/i.test(navigator.userAgent),k=N&&_&&O,K=N&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!O;function H(...t){const e=[];for(const n of t)if(n&&"string"==typeof n)for(const[t]of n.matchAll(/\S+/g))e.push(t);return e}function $(...t){return ()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0;}}function D(t){return `${t}px`}const I={attributes:!0,characterData:!0,childList:!0,subtree:!0};function j(e,n,o){let r=null,i=null,l=null,s=[];const u=document.createElement("div");function c(){null===r&&L(182),null===i&&L(183);const{left:t,top:l}=i.getBoundingClientRect(),c=createRectsFromDOMRange(e,n);var f,a;u.isConnected||(a=u,(f=i).insertBefore(a,f.firstChild));let d=!1;for(let e=0;e<c.length;e++){const n=c[e],o=s[e]||document.createElement("div"),r=o.style;"absolute"!==r.position&&(r.position="absolute",d=!0);const i=D(n.left-t);r.left!==i&&(r.left=i,d=!0);const f=D(n.top-l);r.top!==f&&(o.style.top=f,d=!0);const a=D(n.width);r.width!==a&&(o.style.width=a,d=!0);const g=D(n.height);r.height!==g&&(o.style.height=g,d=!0),o.parentNode!==u&&(u.append(o),d=!0),s[e]=o;}for(;s.length>c.length;)s.pop();d&&o(s);}function f(){i=null,r=null,null!==l&&l.disconnect(),l=null,u.remove();for(const t of s)t.remove();s=[];}u.style.position="relative";const a=e.registerRootListener((function n(){const o=e.getRootElement();if(null===o)return f();const s=o.parentElement;if(!isHTMLElement(s))return f();f(),r=o,i=s,l=new MutationObserver((t=>{const o=e.getRootElement(),l=o&&o.parentElement;if(o!==r||l!==i)return n();for(const e of t)if(!u.contains(e.target))return c()})),l.observe(s,I),c();}));return ()=>{a(),f();}}function U(t,e,n){if("text"!==t.type&&$isElementNode(e)){const o=e.getDOMSlot(n);return [o.element,o.getFirstChildOffset()+t.offset]}return [getDOMTextNode(n)||n,t.offset]}function z(t,o){let r=null,i=null,l=null,s=null,u=null,c=null,f=()=>{};function a(a){a.read((()=>{const a=$getSelection();if(!$isRangeSelection(a))return r=null,l=null,s=null,c=null,f(),void(f=()=>{});const{anchor:d,focus:g}=a,p=d.getNode(),m=p.getKey(),h=d.offset,v=g.getNode(),y=v.getKey(),w=g.offset,x=t.getElementByKey(m),E=t.getElementByKey(y),S=null===r||x!==i||h!==l||m!==r.getKey(),A=null===s||E!==u||w!==c||y!==s.getKey();if((S||A)&&null!==x&&null!==E){const e=function(t,e,n,o,r,i,l){const s=(t._window?t._window.document:document).createRange();return i.isBefore(n)?(s.setStart(...U(r,i,l)),s.setEnd(...U(e,n,o))):(s.setStart(...U(e,n,o)),s.setEnd(...U(r,i,l))),s}(t,d,p,x,g,v,E);f(),f=j(t,e,(t=>{if(void 0===o)for(const e of t){const t=e.style;"Highlight"!==t.background&&(t.background="Highlight"),"HighlightText"!==t.color&&(t.color="HighlightText"),t.marginTop!==D(-1.5)&&(t.marginTop=D(-1.5)),t.paddingTop!==D(4)&&(t.paddingTop=D(4)),t.paddingBottom!==D(0)&&(t.paddingBottom=D(0));}else o(t);}));}r=p,i=x,l=h,s=v,u=E,c=w;}));}return a(t.getEditorState()),$(t.registerUpdateListener((({editorState:t})=>a(t))),(()=>{f();}))}function F(t){let e=null;const n=()=>{const n=getSelection(),o=n&&n.anchorNode,r=t.getRootElement();null!==o&&null!==r&&r.contains(o)?null!==e&&(e(),e=null):null===e&&(e=z(t));};return document.addEventListener("selectionchange",n),()=>{null!==e&&e(),document.removeEventListener("selectionchange",n);}}const W=M,V=N,G=_,q=k,J=b,Q=K,X=O,Y=T,Z=B,tt=R;function et(t,...e){const n=H(...e);n.length>0&&t.classList.add(...n);}function nt(t,...e){const n=H(...e);n.length>0&&t.classList.remove(...n);}function ot(t,e){for(const n of e)if(t.type.startsWith(n))return !0;return !1}function rt(t,e){const n=t[Symbol.iterator]();return new Promise(((t,o)=>{const r=[],i=()=>{const{done:l,value:s}=n.next();if(l)return t(r);const u=new FileReader;u.addEventListener("error",o),u.addEventListener("load",(()=>{const t=u.result;"string"==typeof t&&r.push({file:s,result:t}),i();})),ot(s,e)?u.readAsDataURL(s):i();};i();}))}function it(t,e){return Array.from(ut(t,e))}function lt(t){return t?t.getAdjacentCaret():null}function st(t,e){return Array.from(gt(t,e))}function ut(t,e){return ct("next",t,e)}function ct(t,e,n){const r=$getRoot(),d=e||r,g=$isElementNode(d)?$getChildCaret(d,t):$getSiblingCaret(d,t),p=at(d),m=n?$getAdjacentChildCaret($getChildCaretOrSelf($getSiblingCaret(n,t))):function(t,e){const n=Ot($getSiblingCaret(t,e));return n&&n[0]}(d,t);let h=p;return makeStepwiseIterator({hasNext:t=>null!==t,initial:g,map:t=>({depth:h,node:t.origin}),step:t=>{if(t.isSameNodeCaret(m))return null;$isChildCaret(t)&&h++;const e=Ot(t);return !e||e[0].isSameNodeCaret(m)?null:(h+=e[1],e[0])}})}function ft(t){const e=Ot($getSiblingCaret(t,"next"));return e&&[e[0].origin,e[1]]}function at(t){let e=-1;for(let n=t;null!==n;n=n.getParent())e++;return e}function dt(t){const e=Ot($getChildCaretOrSelf($getSiblingCaret(t,"previous")),"root");return e&&e[0].origin}function gt(t,e){return ct("previous",t,e)}function pt(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent();}return null}function mt(t){const e=ht(t,(t=>$isElementNode(t)&&!t.isInline()));return $isElementNode(e)||L(4,t.__key),e}const ht=(t,e)=>{let n=t;for(;n!==$getRoot()&&null!=n;){if(e(n))return n;n=n.getParent();}return null};function vt(t,e,n,o){const r=t=>t instanceof e;return t.registerNodeTransform(e,(t=>{const e=(t=>{const e=t.getChildren();for(let t=0;t<e.length;t++){const n=e[t];if(r(n))return null}let n=t,o=t;for(;null!==n;)if(o=n,n=n.getParent(),r(n))return {child:o,parent:n};return null})(t);if(null!==e){const{child:r,parent:i}=e;if(r.is(t)){o(i,t);const e=r.getNextSiblings(),l=e.length;if(i.insertAfter(r),0!==l){const t=n(i);r.insertAfter(t);for(let n=0;n<l;n++)t.append(e[n]);}i.canBeEmpty()||0!==i.getChildrenSize()||i.remove();}}}))}function yt(t,e){const n=new Map,o=t._pendingEditorState;for(const[t,o]of e._nodeMap)n.set(t,$cloneWithProperties(o));o&&(o._nodeMap=n),t._dirtyType=2;const r=e._selection;$setSelection(null===r?null:r.clone());}function wt(t){const o=$getSelection()||$getPreviousSelection();if($isRangeSelection(o)){const{focus:e}=o,n=e.getNode(),r=e.offset;if($isRootOrShadowRoot(n))$getChildCaretAtIndex(n,r,"next").insert(t),t.selectNext();else {let e,o;$isTextNode(n)?(e=n.getParentOrThrow(),o=n.getIndexWithinParent(),r>0&&(o+=1,n.splitText(r))):(e=n,o=r);const[,i]=$splitNode(e,o);i.insertBefore(t),i.selectStart();}}else {if(null!=o){const e=o.getNodes();e[e.length-1].getTopLevelElementOrThrow().insertAfter(t);}else $getRoot().append(t);const e=$createParagraphNode();t.insertAfter(e),e.select();}return t.getLatest()}function xt(t,e){const n=e();return t.replace(n),n.append(t),n}function Et(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}function St(t,e){const n=[];for(let o=0;o<t.length;o++){const r=e(t[o]);null!==r&&n.push(r);}return n}function At(t,e){$getChildCaret(t,"next").insert(e);}let Ct=!(Y||!V)&&void 0;function Lt(t){let e=1;if(function(){if(void 0===Ct){const t=document.createElement("div");t.style.cssText="position: absolute; opacity: 0; width: 100px; left: -1000px;",document.body.appendChild(t);const e=t.getBoundingClientRect();t.style.setProperty("zoom","2"),Ct=t.getBoundingClientRect().width===e.width,document.body.removeChild(t);}return Ct}())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue("zoom")),t=t.parentElement;return e}function Nt(t){return null!==t._parentEditor}function Pt(t,e){return bt(t,e,null)}function bt(t,e,n){let r=!1;for(const i of Rt(t))e(i)?null!==n&&n(i):(r=!0,$isElementNode(i)&&bt(i,e,n||(t=>i.insertAfter(t))),i.remove());return r}function Tt(t,e){const n=[],r=Array.from(t).reverse();for(let t=r.pop();void 0!==t;t=r.pop())if(e(t))n.push(t);else if($isElementNode(t))for(const e of Rt(t))r.push(e);return n}function Mt(t){return Bt($getChildCaret(t,"next"))}function Rt(t){return Bt($getChildCaret(t,"previous"))}function Bt(t){return makeStepwiseIterator({hasNext:$isSiblingCaret,initial:t.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function _t(t){$rewindSiblingCaret($getSiblingCaret(t,"next")).splice(1,t.getChildren());}function Ot(t,e="root"){let n=0,o=t,r=$getAdjacentChildCaret(o);for(;null===r;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=$getAdjacentChildCaret(o);}return r&&[r,n]}function kt(t){const e=e=>$getState(e,t),n=(e,n)=>$setState(e,t,n);return {$get:e,$set:n,accessors:[e,n],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(t){return n(this,t)},stateConfig:t}}
|
|
16
16
|
|
|
17
|
-
export {
|
|
17
|
+
export { Tt as $descendantsMatching, it as $dfs, ut as $dfsIterator, St as $filter, ht as $findMatchingParent, Mt as $firstToLastIterator, lt as $getAdjacentCaret, Ot as $getAdjacentSiblingOrParentSiblingCaret, at as $getDepth, mt as $getNearestBlockElementAncestorOrThrow, pt as $getNearestNodeOfType, dt as $getNextRightPreorderNode, ft as $getNextSiblingOrParentSibling, At as $insertFirst, wt as $insertNodeToNearestRoot, Nt as $isEditorIsNestedEditor, Rt as $lastToFirstIterator, yt as $restoreEditorState, st as $reverseDfs, gt as $reverseDfsIterator, Pt as $unwrapAndFilterDescendants, _t as $unwrapNode, xt as $wrapNodeInElement, W as CAN_USE_BEFORE_INPUT, V as CAN_USE_DOM, G as IS_ANDROID, q as IS_ANDROID_CHROME, J as IS_APPLE, Q as IS_APPLE_WEBKIT, X as IS_CHROME, Y as IS_FIREFOX, Z as IS_IOS, tt as IS_SAFARI, et as addClassNamesToElement, Lt as calculateZoomLevel, ot as isMimeType, kt as makeStateWrapper, z as markSelection, rt as mediaFileReader, $ as mergeRegister, Et as objectKlassEquals, j as positionNodeOnRange, vt as registerNestedElementResolver, nt as removeClassNamesFromElement, F as selectionAlwaysOnDisplay };
|
|
@@ -231,7 +231,7 @@ import { __module as prism } from '../../_virtual/prism.js';
|
|
|
231
231
|
if (typeof document === 'undefined') {
|
|
232
232
|
return null;
|
|
233
233
|
}
|
|
234
|
-
if (
|
|
234
|
+
if (document.currentScript && document.currentScript.tagName === 'SCRIPT' && 1 < 2 /* hack to trip TS' flow analysis */) {
|
|
235
235
|
return /** @type {any} */ (document.currentScript);
|
|
236
236
|
}
|
|
237
237
|
|
|
@@ -21,9 +21,8 @@ import { useRef, useState, useCallback, useEffect, useMemo } from 'react';
|
|
|
21
21
|
import { StickyNode } from '../nodes/StickyNode.js';
|
|
22
22
|
import { DraggableBlockPlugin } from '../plugins/DraggableBlockPlugin.js';
|
|
23
23
|
import { StickyPlugin } from '../plugins/StickyPlugin.js';
|
|
24
|
-
import classes from './Lexical.module.css';
|
|
25
|
-
import { LexicalTheme } from './theme.js';
|
|
26
24
|
import { ToolbarPlugin } from '../plugins/ToolbarPlugin.js';
|
|
25
|
+
import { LexicalTheme } from './theme.js';
|
|
27
26
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
28
27
|
|
|
29
28
|
var LexicalEditor = function LexicalEditor(_ref) {
|
|
@@ -32,7 +31,7 @@ var LexicalEditor = function LexicalEditor(_ref) {
|
|
|
32
31
|
publishMode = _ref.publishMode,
|
|
33
32
|
onChange = _ref.onChange,
|
|
34
33
|
onDirty = _ref.onDirty;
|
|
35
|
-
var editorRef = useRef();
|
|
34
|
+
var editorRef = useRef(null);
|
|
36
35
|
var _useState = useState(null),
|
|
37
36
|
_useState2 = _slicedToArray(_useState, 2),
|
|
38
37
|
editorContainer = _useState2[0],
|
|
@@ -108,7 +107,7 @@ var LexicalEditor = function LexicalEditor(_ref) {
|
|
|
108
107
|
return !publishMode ? /*#__PURE__*/jsxs("div", {
|
|
109
108
|
className: "lexical-scroller area-content overflow-auto",
|
|
110
109
|
children: [/*#__PURE__*/jsx("div", {
|
|
111
|
-
className: classNames(
|
|
110
|
+
className: classNames("fabric-lexicalToolbar", "sticky top-0 z-1"),
|
|
112
111
|
children: /*#__PURE__*/jsx(Header, {
|
|
113
112
|
className: "bg-base",
|
|
114
113
|
children: /*#__PURE__*/jsx(ToolbarPlugin, {})
|
|
@@ -124,7 +123,7 @@ var LexicalEditor = function LexicalEditor(_ref) {
|
|
|
124
123
|
colorScheme: "light",
|
|
125
124
|
children: /*#__PURE__*/jsxs("div", {
|
|
126
125
|
role: "none",
|
|
127
|
-
className: classNames(
|
|
126
|
+
className: classNames("fabric-lexicalEditor", "lexical-container relative bg-white min-h-full mx-auto shadow-md print:shadow-none"),
|
|
128
127
|
onDragOver: function onDragOver(e) {
|
|
129
128
|
return e.stopPropagation();
|
|
130
129
|
},
|
|
@@ -11,7 +11,8 @@ import { $isHeadingNode, $createQuoteNode, $createHeadingNode, $isQuoteNode } fr
|
|
|
11
11
|
import { $isParentElementRTL, $getSelectionStyleValueForProperty, $patchStyleText, $setBlocksType, $isAtNodeEnd } from '../../../../node_modules/@lexical/selection/LexicalSelection.js';
|
|
12
12
|
import { $isTableNode } from '../../../../node_modules/@lexical/table/LexicalTable.js';
|
|
13
13
|
import { $findMatchingParent, $getNearestNodeOfType, mergeRegister, $getNearestBlockElementAncestorOrThrow } from '../../../../node_modules/@lexical/utils/LexicalUtils.js';
|
|
14
|
-
import {
|
|
14
|
+
import { isNil } from '@react-fabric/utilities';
|
|
15
|
+
import { $getSelection, $isRangeSelection, $isRootOrShadowRoot, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_CRITICAL, CAN_UNDO_COMMAND, CAN_REDO_COMMAND, $createParagraphNode, INDENT_CONTENT_COMMAND, OUTDENT_CONTENT_COMMAND, $isTextNode } from 'lexical';
|
|
15
16
|
import { useTransition, useState, useCallback, useEffect } from 'react';
|
|
16
17
|
|
|
17
18
|
var blockTypeToBlockName = {
|
|
@@ -54,88 +55,92 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
54
55
|
_useState2 = _slicedToArray(_useState, 2),
|
|
55
56
|
activeEditor = _useState2[0],
|
|
56
57
|
setActiveEditor = _useState2[1];
|
|
57
|
-
var _useState3 = useState(
|
|
58
|
+
var _useState3 = useState(),
|
|
58
59
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var _useState5 = useState("
|
|
60
|
+
currentSelection = _useState4[0],
|
|
61
|
+
setCurrentSelection = _useState4[1];
|
|
62
|
+
var _useState5 = useState("paragraph"),
|
|
62
63
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var _useState7 = useState(
|
|
64
|
+
blockType = _useState6[0],
|
|
65
|
+
setBlockType = _useState6[1];
|
|
66
|
+
var _useState7 = useState("root"),
|
|
66
67
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var _useState9 = useState(
|
|
68
|
+
rootType = _useState8[0],
|
|
69
|
+
setRootType = _useState8[1];
|
|
70
|
+
var _useState9 = useState(null),
|
|
70
71
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var _useState11 = useState("
|
|
72
|
+
selectedElementKey = _useState10[0],
|
|
73
|
+
setSelectedElementKey = _useState10[1];
|
|
74
|
+
var _useState11 = useState("16"),
|
|
74
75
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var _useState13 = useState("#
|
|
76
|
+
fontSize = _useState12[0],
|
|
77
|
+
setFontSize = _useState12[1];
|
|
78
|
+
var _useState13 = useState("#000"),
|
|
78
79
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var _useState15 = useState("
|
|
80
|
+
fontColor = _useState14[0],
|
|
81
|
+
setFontColor = _useState14[1];
|
|
82
|
+
var _useState15 = useState("#fff"),
|
|
82
83
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var _useState17 = useState(
|
|
84
|
+
bgColor = _useState16[0],
|
|
85
|
+
setBgColor = _useState16[1];
|
|
86
|
+
var _useState17 = useState("Arial"),
|
|
86
87
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
fontFamily = _useState18[0],
|
|
89
|
+
setFontFamily = _useState18[1];
|
|
89
90
|
var _useState19 = useState(false),
|
|
90
91
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
91
|
-
|
|
92
|
-
|
|
92
|
+
isLink = _useState20[0],
|
|
93
|
+
setIsLink = _useState20[1];
|
|
93
94
|
var _useState21 = useState(false),
|
|
94
95
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
isBold = _useState22[0],
|
|
97
|
+
setIsBold = _useState22[1];
|
|
97
98
|
var _useState23 = useState(false),
|
|
98
99
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
isItalic = _useState24[0],
|
|
101
|
+
setIsItalic = _useState24[1];
|
|
101
102
|
var _useState25 = useState(false),
|
|
102
103
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
isUnderline = _useState26[0],
|
|
105
|
+
setIsUnderline = _useState26[1];
|
|
105
106
|
var _useState27 = useState(false),
|
|
106
107
|
_useState28 = _slicedToArray(_useState27, 2),
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
isStrikethrough = _useState28[0],
|
|
109
|
+
setIsStrikethrough = _useState28[1];
|
|
109
110
|
var _useState29 = useState(false),
|
|
110
111
|
_useState30 = _slicedToArray(_useState29, 2),
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
isSubscript = _useState30[0],
|
|
113
|
+
setIsSubscript = _useState30[1];
|
|
113
114
|
var _useState31 = useState(false),
|
|
114
115
|
_useState32 = _slicedToArray(_useState31, 2),
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
isSuperscript = _useState32[0],
|
|
117
|
+
setIsSuperscript = _useState32[1];
|
|
117
118
|
var _useState33 = useState(false),
|
|
118
119
|
_useState34 = _slicedToArray(_useState33, 2),
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
isCode = _useState34[0],
|
|
121
|
+
setIsCode = _useState34[1];
|
|
121
122
|
var _useState35 = useState(false),
|
|
122
123
|
_useState36 = _slicedToArray(_useState35, 2),
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
canUndo = _useState36[0],
|
|
125
|
+
setCanUndo = _useState36[1];
|
|
125
126
|
var _useState37 = useState(false),
|
|
126
127
|
_useState38 = _slicedToArray(_useState37, 2),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
var _useState39 = useState(
|
|
128
|
+
canRedo = _useState38[0],
|
|
129
|
+
setCanRedo = _useState38[1];
|
|
130
|
+
var _useState39 = useState(false),
|
|
130
131
|
_useState40 = _slicedToArray(_useState39, 2),
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
var _useState41 = useState(
|
|
132
|
+
isRTL = _useState40[0],
|
|
133
|
+
setIsRTL = _useState40[1];
|
|
134
|
+
var _useState41 = useState(""),
|
|
135
|
+
_useState42 = _slicedToArray(_useState41, 2),
|
|
136
|
+
codeLanguage = _useState42[0],
|
|
137
|
+
setCodeLanguage = _useState42[1];
|
|
138
|
+
var _useState43 = useState(function () {
|
|
134
139
|
return editor.isEditable();
|
|
135
140
|
}),
|
|
136
|
-
|
|
137
|
-
isEditable =
|
|
138
|
-
setIsEditable =
|
|
141
|
+
_useState44 = _slicedToArray(_useState43, 2),
|
|
142
|
+
isEditable = _useState44[0],
|
|
143
|
+
setIsEditable = _useState44[1];
|
|
139
144
|
var $updateToolbar = useCallback(function () {
|
|
140
145
|
var selection = $getSelection();
|
|
141
146
|
if ($isRangeSelection(selection)) {
|
|
@@ -194,22 +199,29 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
194
199
|
}
|
|
195
200
|
// Handle buttons
|
|
196
201
|
setFontSize(parseInt($getSelectionStyleValueForProperty(selection, "font-size", "16")) + "");
|
|
197
|
-
setFontColor($getSelectionStyleValueForProperty(selection, "color",
|
|
198
|
-
|
|
202
|
+
setFontColor($getSelectionStyleValueForProperty(selection, "color",
|
|
203
|
+
// @ts-expect-error ignore
|
|
204
|
+
// eslint-disable-next-line no-new-wrappers
|
|
205
|
+
new String("#000")));
|
|
206
|
+
setBgColor($getSelectionStyleValueForProperty(selection, "background-color",
|
|
207
|
+
// @ts-expect-error ignore
|
|
208
|
+
// eslint-disable-next-line no-new-wrappers
|
|
209
|
+
new String("#fff")));
|
|
199
210
|
setFontFamily($getSelectionStyleValueForProperty(selection, "font-family", "inherit"));
|
|
200
211
|
}
|
|
201
|
-
}, [
|
|
212
|
+
}, []);
|
|
202
213
|
useEffect(function () {
|
|
203
|
-
return editor.registerCommand(
|
|
214
|
+
return editor.registerCommand(SELECTION_CHANGE_COMMAND, function (_payload, newEditor) {
|
|
204
215
|
setActiveEditor(newEditor);
|
|
216
|
+
setCurrentSelection($getSelection());
|
|
217
|
+
$updateToolbar();
|
|
205
218
|
return false;
|
|
206
219
|
}, COMMAND_PRIORITY_CRITICAL);
|
|
207
|
-
}, [editor]);
|
|
220
|
+
}, [editor, $updateToolbar]);
|
|
208
221
|
useEffect(function () {
|
|
209
|
-
|
|
222
|
+
activeEditor.getEditorState().read(function () {
|
|
210
223
|
$updateToolbar();
|
|
211
|
-
|
|
212
|
-
}, COMMAND_PRIORITY_CRITICAL);
|
|
224
|
+
});
|
|
213
225
|
}, [activeEditor, $updateToolbar]);
|
|
214
226
|
useEffect(function () {
|
|
215
227
|
return mergeRegister(editor.registerEditableListener(function (editable) {
|
|
@@ -228,15 +240,12 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
228
240
|
}, COMMAND_PRIORITY_CRITICAL));
|
|
229
241
|
}, [$updateToolbar, activeEditor, editor]);
|
|
230
242
|
var applyStyleText = useCallback(function (styles) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
});
|
|
238
|
-
}, 100);
|
|
239
|
-
}, [editor]);
|
|
243
|
+
activeEditor.update(function () {
|
|
244
|
+
if (!isNil(currentSelection)) {
|
|
245
|
+
$patchStyleText(currentSelection, styles);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}, [activeEditor, currentSelection]);
|
|
240
249
|
var formatBulletList = function formatBulletList() {
|
|
241
250
|
setTimeout(function () {
|
|
242
251
|
if (blockType !== "bullet") {
|
|
@@ -371,18 +380,14 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
371
380
|
"font-size": +value + "px"
|
|
372
381
|
});
|
|
373
382
|
}, [applyStyleText]);
|
|
374
|
-
var onFontColorSelect = useCallback(function (
|
|
375
|
-
|
|
376
|
-
return setFontColor(value);
|
|
377
|
-
});
|
|
383
|
+
var onFontColorSelect = useCallback(function () {
|
|
384
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "#000000";
|
|
378
385
|
applyStyleText({
|
|
379
386
|
color: value
|
|
380
387
|
});
|
|
381
388
|
}, [applyStyleText]);
|
|
382
|
-
var onBgColorSelect = useCallback(function (
|
|
383
|
-
|
|
384
|
-
return setBgColor(value);
|
|
385
|
-
});
|
|
389
|
+
var onBgColorSelect = useCallback(function () {
|
|
390
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "#ffffff";
|
|
386
391
|
applyStyleText({
|
|
387
392
|
"background-color": value
|
|
388
393
|
});
|
|
@@ -220,9 +220,8 @@ var ToolbarPlugin = function ToolbarPlugin() {
|
|
|
220
220
|
}), /*#__PURE__*/jsx(ColorInput, {
|
|
221
221
|
noOutline: true,
|
|
222
222
|
value: watch.fontColor,
|
|
223
|
-
onChange: function onChange() {
|
|
224
|
-
|
|
225
|
-
return watch.onFontColorSelect(v);
|
|
223
|
+
onChange: function onChange(v) {
|
|
224
|
+
return watch.onFontColorSelect(v !== null && v !== void 0 ? v : undefined);
|
|
226
225
|
},
|
|
227
226
|
decorateStart: /*#__PURE__*/jsx(Icon, {
|
|
228
227
|
icon: CoreIcons.formatText
|
|
@@ -230,9 +229,8 @@ var ToolbarPlugin = function ToolbarPlugin() {
|
|
|
230
229
|
}), /*#__PURE__*/jsx(ColorInput, {
|
|
231
230
|
noOutline: true,
|
|
232
231
|
value: watch.bgColor,
|
|
233
|
-
onChange: function onChange() {
|
|
234
|
-
|
|
235
|
-
return watch.onBgColorSelect(v);
|
|
232
|
+
onChange: function onChange(v) {
|
|
233
|
+
return watch.onBgColorSelect(v !== null && v !== void 0 ? v : undefined);
|
|
236
234
|
},
|
|
237
235
|
decorateStart: /*#__PURE__*/jsx(Icon, {
|
|
238
236
|
icon: CoreIcons.formatFill
|
|
@@ -27,8 +27,8 @@ export declare const useFormatWatcher: () => {
|
|
|
27
27
|
indent: () => void;
|
|
28
28
|
outdent: () => void;
|
|
29
29
|
clearFormatting: () => void;
|
|
30
|
-
onFontColorSelect: (value
|
|
31
|
-
onBgColorSelect: (value
|
|
30
|
+
onFontColorSelect: (value?: string) => void;
|
|
31
|
+
onBgColorSelect: (value?: string) => void;
|
|
32
32
|
formatQuote: () => void;
|
|
33
33
|
onSizeChange: (value: string) => void;
|
|
34
34
|
formatBlock: () => void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { DecoratorNode, type DOMConversionMap, type DOMExportOutput, type EditorConfig, type LexicalEditor, type LexicalNode, type NodeKey, type SerializedLexicalNode, type Spread } from "lexical";
|
|
3
2
|
type StickyNoteColor = "pink" | "yellow" | "green" | "blue";
|
|
4
3
|
interface StickyNodeType {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/lexical",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.51",
|
|
4
4
|
"description": "RUF: Lexical editor",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
"types": "dist/types/index.d.ts",
|
|
12
12
|
"directories": {
|
|
13
13
|
"src": "src",
|
|
14
|
+
"styles": "css",
|
|
14
15
|
"test": "tests"
|
|
15
16
|
},
|
|
16
17
|
"files": [
|
|
18
|
+
"css",
|
|
17
19
|
"src",
|
|
18
20
|
"dist"
|
|
19
21
|
],
|
|
@@ -33,23 +35,22 @@
|
|
|
33
35
|
"watch": "npm-run-all -p watch:rollup watch:dts"
|
|
34
36
|
},
|
|
35
37
|
"dependencies": {
|
|
36
|
-
"@lexical/
|
|
37
|
-
"@
|
|
38
|
-
"@react-fabric/
|
|
39
|
-
"@react-fabric/
|
|
40
|
-
"@react-fabric/utilities": "^1.0.0-beta.5",
|
|
38
|
+
"@lexical/react": "^0.27.1",
|
|
39
|
+
"@react-fabric/core": "^1.0.0-beta.51",
|
|
40
|
+
"@react-fabric/form": "^1.0.0-beta.51",
|
|
41
|
+
"@react-fabric/utilities": "^1.0.0-beta.50",
|
|
41
42
|
"classnames": "^2.5.1",
|
|
42
|
-
"lexical": "^0.
|
|
43
|
+
"lexical": "^0.27.1"
|
|
43
44
|
},
|
|
44
45
|
"peerDependencies": {
|
|
45
|
-
"i18next": "^
|
|
46
|
-
"react": "
|
|
47
|
-
"react-dom": "
|
|
48
|
-
"react-i18next": "^15.
|
|
46
|
+
"i18next": "^25.2.1",
|
|
47
|
+
"react": "^19.0.0",
|
|
48
|
+
"react-dom": "^19.0.0",
|
|
49
|
+
"react-i18next": "^15.5.2"
|
|
49
50
|
},
|
|
50
51
|
"engines": {
|
|
51
52
|
"node": ">=18.12.0",
|
|
52
53
|
"npm": ">=8.19.0"
|
|
53
54
|
},
|
|
54
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "a1b04de4663045f82992bff2aef8db26608eac74"
|
|
55
56
|
}
|
|
@@ -261,7 +261,7 @@ export const StickyComponent = ({
|
|
|
261
261
|
placeholder={
|
|
262
262
|
<div className="sticky-placeholder">Sticky note...</div>
|
|
263
263
|
}
|
|
264
|
-
ErrorBoundary={LexicalErrorBoundary}
|
|
264
|
+
ErrorBoundary={LexicalErrorBoundary as any}
|
|
265
265
|
/>
|
|
266
266
|
<AutoFocusPlugin />
|
|
267
267
|
</LexicalNestedComposer>
|
|
@@ -25,7 +25,10 @@ import { CodeHighlightNode, CodeNode } from "@lexical/code";
|
|
|
25
25
|
import { ListItemNode, ListNode } from "@lexical/list";
|
|
26
26
|
import { AutoFocusPlugin } from "@lexical/react/LexicalAutoFocusPlugin";
|
|
27
27
|
import { CheckListPlugin } from "@lexical/react/LexicalCheckListPlugin";
|
|
28
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
type InitialConfigType,
|
|
30
|
+
LexicalComposer,
|
|
31
|
+
} from "@lexical/react/LexicalComposer";
|
|
29
32
|
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
30
33
|
import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
31
34
|
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
|
|
@@ -42,9 +45,8 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
|
42
45
|
import { StickyNode } from "../nodes/StickyNode";
|
|
43
46
|
import { DraggableBlockPlugin } from "../plugins/DraggableBlockPlugin";
|
|
44
47
|
import { StickyPlugin } from "../plugins/StickyPlugin";
|
|
45
|
-
import classes from "./Lexical.module.css";
|
|
46
|
-
import { LexicalTheme } from "./theme";
|
|
47
48
|
import { ToolbarPlugin } from "../plugins/ToolbarPlugin";
|
|
49
|
+
import { LexicalTheme } from "./theme";
|
|
48
50
|
|
|
49
51
|
export interface EditorProps {
|
|
50
52
|
value?: string | AnyObject;
|
|
@@ -69,7 +71,7 @@ export const LexicalEditor = ({
|
|
|
69
71
|
onChange,
|
|
70
72
|
onDirty,
|
|
71
73
|
}: EditorProps) => {
|
|
72
|
-
const editorRef = useRef<LXE>();
|
|
74
|
+
const editorRef = useRef<LXE>(null);
|
|
73
75
|
const [editorContainer, setEditorContainer] = useState<HTMLDivElement | null>(
|
|
74
76
|
null,
|
|
75
77
|
);
|
|
@@ -135,25 +137,26 @@ export const LexicalEditor = ({
|
|
|
135
137
|
}, [readOnly, publishMode]);
|
|
136
138
|
|
|
137
139
|
const initialConfig = useMemo(
|
|
138
|
-
() =>
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
140
|
+
() =>
|
|
141
|
+
({
|
|
142
|
+
editorState: initEditor,
|
|
143
|
+
namespace: "MyEditor",
|
|
144
|
+
editable: !readOnly && !publishMode,
|
|
145
|
+
theme: LexicalTheme,
|
|
146
|
+
nodes: [
|
|
147
|
+
QuoteNode,
|
|
148
|
+
HeadingNode,
|
|
149
|
+
CodeHighlightNode,
|
|
150
|
+
CodeNode,
|
|
151
|
+
ListItemNode,
|
|
152
|
+
ListNode,
|
|
153
|
+
TableCellNode,
|
|
154
|
+
TableNode,
|
|
155
|
+
TableRowNode,
|
|
156
|
+
StickyNode,
|
|
157
|
+
],
|
|
158
|
+
onError,
|
|
159
|
+
}) as InitialConfigType,
|
|
157
160
|
[],
|
|
158
161
|
);
|
|
159
162
|
|
|
@@ -162,7 +165,7 @@ export const LexicalEditor = ({
|
|
|
162
165
|
return !publishMode ? (
|
|
163
166
|
<div className="lexical-scroller area-content overflow-auto">
|
|
164
167
|
<div
|
|
165
|
-
className={classNames(
|
|
168
|
+
className={classNames("fabric-lexicalToolbar", "sticky top-0 z-1")}
|
|
166
169
|
>
|
|
167
170
|
<Header className="bg-base">
|
|
168
171
|
<ToolbarPlugin />
|
|
@@ -185,7 +188,7 @@ export const LexicalEditor = ({
|
|
|
185
188
|
<div
|
|
186
189
|
role="none"
|
|
187
190
|
className={classNames(
|
|
188
|
-
|
|
191
|
+
"fabric-lexicalEditor",
|
|
189
192
|
"lexical-container relative bg-white min-h-full mx-auto shadow-md print:shadow-none",
|
|
190
193
|
)}
|
|
191
194
|
onDragOver={(e) => e.stopPropagation()}
|