@react-fabric/lexical 1.0.0-beta.6 → 1.0.0-beta.60
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} +8 -4
- package/css/styles.css +24 -0
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +62 -20
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.js +1 -1
- package/dist/cjs/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +11 -11
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.dev.js +643 -245
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.js +1 -1
- package/dist/cjs/node_modules/@lexical/code/LexicalCode.prod.js +29 -22
- package/dist/cjs/node_modules/@lexical/html/LexicalHtml.dev.js +13 -6
- 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 +242 -141
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.js +1 -1
- package/dist/cjs/node_modules/@lexical/link/LexicalLink.prod.js +11 -10
- package/dist/cjs/node_modules/@lexical/list/LexicalList.dev.js +594 -255
- package/dist/cjs/node_modules/@lexical/list/LexicalList.js +1 -1
- package/dist/cjs/node_modules/@lexical/list/LexicalList.prod.js +23 -16
- package/dist/cjs/node_modules/@lexical/rich-text/LexicalRichText.dev.js +102 -53
- 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 +275 -194
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.js +5 -1
- package/dist/cjs/node_modules/@lexical/selection/LexicalSelection.prod.js +28 -18
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.dev.js +2293 -878
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.js +1 -1
- package/dist/cjs/node_modules/@lexical/table/LexicalTable.prod.js +53 -40
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.dev.js +471 -193
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.js +13 -1
- package/dist/cjs/node_modules/@lexical/utils/LexicalUtils.prod.js +47 -32
- package/dist/cjs/node_modules/prismjs/prism.js +1 -1
- package/dist/cjs/packages/lexical/src/components/StickyComponent.js +1 -1
- package/dist/cjs/packages/lexical/src/editor/LexicalEditor.js +30 -5
- package/dist/cjs/packages/lexical/src/hooks/useFormatWatcher.js +86 -83
- package/dist/cjs/packages/lexical/src/plugins/ToolbarPlugin.js +25 -17
- package/dist/esm/node_modules/@lexical/clipboard/LexicalClipboard.dev.js +62 -20
- 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 +637 -246
- 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 +14 -7
- 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 +244 -144
- 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 +590 -257
- package/dist/esm/node_modules/@lexical/list/LexicalList.js +1 -1
- package/dist/esm/node_modules/@lexical/list/LexicalList.prod.js +5 -4
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.dev.js +104 -55
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.js +1 -1
- package/dist/esm/node_modules/@lexical/rich-text/LexicalRichText.prod.js +4 -4
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.dev.js +267 -196
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.js +4 -2
- package/dist/esm/node_modules/@lexical/selection/LexicalSelection.prod.js +4 -4
- package/dist/esm/node_modules/@lexical/table/LexicalTable.dev.js +2283 -881
- 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 +457 -194
- package/dist/esm/node_modules/@lexical/utils/LexicalUtils.js +8 -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/components/StickyComponent.js +1 -1
- package/dist/esm/packages/lexical/src/editor/LexicalEditor.js +30 -5
- package/dist/esm/packages/lexical/src/hooks/useFormatWatcher.js +88 -85
- package/dist/esm/packages/lexical/src/plugins/ToolbarPlugin.js +25 -17
- package/dist/types/editor/LexicalEditor.d.ts +25 -0
- package/dist/types/hooks/useFormatWatcher.d.ts +2 -2
- package/dist/types/nodes/StickyNode.d.ts +0 -1
- package/package.json +14 -13
- package/src/components/StickyComponent.tsx +2 -2
- package/src/editor/LexicalEditor.tsx +57 -26
- package/src/hooks/useFormatWatcher.ts +35 -31
- package/src/plugins/ToolbarPlugin.tsx +27 -17
- package/dist/cjs/editor/Lexical.module.css +0 -1
- package/dist/esm/editor/Lexical.module.css +0 -1
|
@@ -11,11 +11,17 @@ var LexicalUtils_prod = require('./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;
|
|
24
|
+
const calculateZoomLevel = mod.calculateZoomLevel;
|
|
19
25
|
const isBlockDomNode = mod.isBlockDomNode;
|
|
20
26
|
const isHTMLAnchorElement = mod.isHTMLAnchorElement;
|
|
21
27
|
const isHTMLElement = mod.isHTMLElement;
|
|
@@ -23,10 +29,16 @@ const mergeRegister = mod.mergeRegister;
|
|
|
23
29
|
const objectKlassEquals = mod.objectKlassEquals;
|
|
24
30
|
const removeClassNamesFromElement = mod.removeClassNamesFromElement;
|
|
25
31
|
|
|
32
|
+
exports.$descendantsMatching = $descendantsMatching;
|
|
26
33
|
exports.$findMatchingParent = $findMatchingParent;
|
|
34
|
+
exports.$getAdjacentCaret = $getAdjacentCaret;
|
|
27
35
|
exports.$getNearestBlockElementAncestorOrThrow = $getNearestBlockElementAncestorOrThrow;
|
|
28
36
|
exports.$getNearestNodeOfType = $getNearestNodeOfType;
|
|
37
|
+
exports.$insertFirst = $insertFirst;
|
|
38
|
+
exports.$insertNodeToNearestRoot = $insertNodeToNearestRoot;
|
|
39
|
+
exports.$unwrapAndFilterDescendants = $unwrapAndFilterDescendants;
|
|
29
40
|
exports.addClassNamesToElement = addClassNamesToElement;
|
|
41
|
+
exports.calculateZoomLevel = calculateZoomLevel;
|
|
30
42
|
exports.isBlockDomNode = isBlockDomNode;
|
|
31
43
|
exports.isHTMLAnchorElement = isHTMLAnchorElement;
|
|
32
44
|
exports.isHTMLElement = isHTMLElement;
|
|
@@ -11,7 +11,7 @@ var LexicalSelection = require('../selection/LexicalSelection.js');
|
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
function
|
|
14
|
+
function N(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 M="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement,R=M&&"documentMode"in document?document.documentMode:null,T=M&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),B=M&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),_=!(!M||!("InputEvent"in window)||R)&&"getTargetRanges"in new window.InputEvent("input"),k=M&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),K=M&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,H=M&&/Android/.test(navigator.userAgent),O=M&&/^(?=.*Chrome).*/i.test(navigator.userAgent),$=M&&H&&O,D=M&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!O;function I(...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 j(...t){return ()=>{for(let e=t.length-1;e>=0;e--)t[e]();t.length=0;}}function F(t){return `${t}px`}const U={attributes:!0,characterData:!0,childList:!0,subtree:!0};function z(e,n,o){let r=null,i=null,l=null,u=[];const s=document.createElement("div");function c(){null===r&&N(182),null===i&&N(183);const{left:t,top:l}=i.getBoundingClientRect(),c=LexicalSelection.createRectsFromDOMRange(e,n);var f,a;s.isConnected||(a=s,(f=i).insertBefore(a,f.firstChild));let d=!1;for(let e=0;e<c.length;e++){const n=c[e],o=u[e]||document.createElement("div"),r=o.style;"absolute"!==r.position&&(r.position="absolute",d=!0);const i=F(n.left-t);r.left!==i&&(r.left=i,d=!0);const f=F(n.top-l);r.top!==f&&(o.style.top=f,d=!0);const a=F(n.width);r.width!==a&&(o.style.width=a,d=!0);const g=F(n.height);r.height!==g&&(o.style.height=g,d=!0),o.parentNode!==s&&(s.append(o),d=!0),u[e]=o;}for(;u.length>c.length;)u.pop();d&&o(u);}function f(){i=null,r=null,null!==l&&l.disconnect(),l=null,s.remove();for(const t of u)t.remove();u=[];}s.style.position="relative";const a=e.registerRootListener((function n(){const o=e.getRootElement();if(null===o)return f();const u=o.parentElement;if(!lexical.isHTMLElement(u))return f();f(),r=o,i=u,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(!s.contains(e.target))return c()})),l.observe(u,U),c();}));return ()=>{a(),f();}}function V(t,e,n){if("text"!==t.type&&lexical.$isElementNode(e)){const o=e.getDOMSlot(n);return [o.element,o.getFirstChildOffset()+t.offset]}return [lexical.getDOMTextNode(n)||n,t.offset]}function W(t,o){let r=null,i=null,l=null,u=null,s=null,c=null,f=()=>{};function a(a){a.read((()=>{const a=lexical.$getSelection();if(!lexical.$isRangeSelection(a))return r=null,l=null,u=null,c=null,f(),void(f=()=>{});const[d,g]=function(t){const e=t.getStartEndPoints();return t.isBackward()?[e[1],e[0]]:e}(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===u||E!==s||w!==c||y!==u.getKey();if((S||A)&&null!==x&&null!==E){const e=function(t,e,n,o,r,i,l){const u=(t._window?t._window.document:document).createRange();return u.setStart(...V(e,n,o)),u.setEnd(...V(r,i,l)),u}(t,d,p,x,g,v,E);f(),f=z(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!==F(-1.5)&&(t.marginTop=F(-1.5)),t.paddingTop!==F(4)&&(t.paddingTop=F(4)),t.paddingBottom!==F(0)&&(t.paddingBottom=F(0));}else o(t);}));}r=p,i=x,l=h,u=v,s=E,c=w;}));}return a(t.getEditorState()),j(t.registerUpdateListener((({editorState:t})=>a(t))),(()=>{f();}))}function G(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=W(t));};return document.addEventListener("selectionchange",n),()=>{null!==e&&e(),document.removeEventListener("selectionchange",n);}}const q=_,J=M,Q=H,X=$,Y=T,Z=D,tt=O,et=B,nt=K,ot=k;function rt(t,...e){const n=I(...e);n.length>0&&t.classList.add(...n);}function it(t,...e){const n=I(...e);n.length>0&&t.classList.remove(...n);}function lt(t,e){for(const n of e)if(t.type.startsWith(n))return !0;return !1}function ut(t,e){const n=t[Symbol.iterator]();return new Promise(((t,o)=>{const r=[],i=()=>{const{done:l,value:u}=n.next();if(l)return t(r);const s=new FileReader;s.addEventListener("error",o),s.addEventListener("load",(()=>{const t=s.result;"string"==typeof t&&r.push({file:u,result:t}),i();})),lt(u,e)?s.readAsDataURL(u):i();};i();}))}function st(t,e){return Array.from(at(t,e))}function ct(t){return t?t.getAdjacentCaret():null}function ft(t,e){return Array.from(ht(t,e))}function at(t,e){return dt("next",t,e)}function dt(t,e,n){const r=lexical.$getRoot(),d=e||r,g=lexical.$isElementNode(d)?lexical.$getChildCaret(d,t):lexical.$getSiblingCaret(d,t),p=pt(d),m=n?lexical.$getAdjacentChildCaret(lexical.$getChildCaretOrSelf(lexical.$getSiblingCaret(n,t))):function(t,e){const n=$t(lexical.$getSiblingCaret(t,e));return n&&n[0]}(d,t);let h=p;return lexical.makeStepwiseIterator({hasNext:t=>null!==t,initial:g,map:t=>({depth:h,node:t.origin}),step:t=>{if(t.isSameNodeCaret(m))return null;lexical.$isChildCaret(t)&&h++;const e=$t(t);return !e||e[0].isSameNodeCaret(m)?null:(h+=e[1],e[0])}})}function gt(t){const e=$t(lexical.$getSiblingCaret(t,"next"));return e&&[e[0].origin,e[1]]}function pt(t){let e=-1;for(let n=t;null!==n;n=n.getParent())e++;return e}function mt(t){const e=$t(lexical.$getChildCaretOrSelf(lexical.$getSiblingCaret(t,"previous")),"root");return e&&e[0].origin}function ht(t,e){return dt("previous",t,e)}function vt(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent();}return null}function yt(t){const e=wt(t,(t=>lexical.$isElementNode(t)&&!t.isInline()));return lexical.$isElementNode(e)||N(4,t.__key),e}const wt=(t,e)=>{let n=t;for(;n!==lexical.$getRoot()&&null!=n;){if(e(n))return n;n=n.getParent();}return null};function xt(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 Et(t,e){const n=new Map,o=t._pendingEditorState;for(const[t,o]of e._nodeMap)n.set(t,lexical.$cloneWithProperties(o));o&&(o._nodeMap=n),t._dirtyType=2;const r=e._selection;lexical.$setSelection(null===r?null:r.clone());}function St(t){const o=lexical.$getSelection()||lexical.$getPreviousSelection();let r;if(lexical.$isRangeSelection(o))r=lexical.$caretFromPoint(o.focus,"next");else {if(null!=o){const t=o.getNodes(),e=t[t.length-1];e&&(r=lexical.$getSiblingCaret(e,"next"));}r=r||lexical.$getChildCaret(lexical.$getRoot(),"previous").getFlipped().insert(lexical.$createParagraphNode());}const c=At(t,r),f=lexical.$getAdjacentChildCaret(c),d=lexical.$isChildCaret(f)?lexical.$normalizeCaret(f):c;return lexical.$setSelectionFromCaretRange(lexical.$getCollapsedCaretRange(d)),t.getLatest()}function At(t,e,n){let o=lexical.$getCaretInDirection(e,"next");for(let t=o;t;t=lexical.$splitAtPointCaretNext(t,n))o=t;return lexical.$isTextPointCaret(o)&&N(283),o.insert(t.isInline()?lexical.$createParagraphNode().append(t):t),lexical.$getCaretInDirection(lexical.$getSiblingCaret(t.getLatest(),"next"),e.direction)}function Ct(t,e){const n=e();return t.replace(n),n.append(t),n}function Lt(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}function Pt(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 bt(t,e){lexical.$getChildCaret(t,"next").insert(e);}let Nt=!(et||!J)&&void 0;function Mt(t){let e=1;if(function(){if(void 0===Nt){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"),Nt=t.getBoundingClientRect().width===e.width,document.body.removeChild(t);}return Nt}())for(;t;)e*=Number(window.getComputedStyle(t).getPropertyValue("zoom")),t=t.parentElement;return e}function Rt(t){return null!==t._parentEditor}function Tt(t,e){return Bt(t,e,null)}function Bt(t,e,n){let r=!1;for(const i of Kt(t))e(i)?null!==n&&n(i):(r=!0,lexical.$isElementNode(i)&&Bt(i,e,n||(t=>i.insertAfter(t))),i.remove());return r}function _t(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(lexical.$isElementNode(t))for(const e of Kt(t))r.push(e);return n}function kt(t){return Ht(lexical.$getChildCaret(t,"next"))}function Kt(t){return Ht(lexical.$getChildCaret(t,"previous"))}function Ht(t){return lexical.makeStepwiseIterator({hasNext:lexical.$isSiblingCaret,initial:t.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function Ot(t){lexical.$rewindSiblingCaret(lexical.$getSiblingCaret(t,"next")).splice(1,t.getChildren());}function $t(t,e="root"){let n=0,o=t,r=lexical.$getAdjacentChildCaret(o);for(;null===r;){if(n--,r=o.getParentCaret(e),!r)return null;o=r,r=lexical.$getAdjacentChildCaret(o);}return r&&[r,n]}function Dt(t){const e=e=>lexical.$getState(e,t),n=(e,n)=>lexical.$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}}
|
|
15
15
|
|
|
16
16
|
Object.defineProperty(exports, "$splitNode", {
|
|
17
17
|
enumerable: true,
|
|
@@ -33,34 +33,49 @@ Object.defineProperty(exports, "isInlineDomNode", {
|
|
|
33
33
|
enumerable: true,
|
|
34
34
|
get: function () { return lexical.isInlineDomNode; }
|
|
35
35
|
});
|
|
36
|
-
exports.$
|
|
37
|
-
exports.$
|
|
38
|
-
exports.$
|
|
39
|
-
exports.$
|
|
40
|
-
exports.$
|
|
41
|
-
exports.$
|
|
42
|
-
exports.$
|
|
43
|
-
exports.$
|
|
44
|
-
exports.$
|
|
45
|
-
exports.$
|
|
46
|
-
exports.$
|
|
47
|
-
exports
|
|
48
|
-
exports
|
|
49
|
-
exports
|
|
50
|
-
exports
|
|
51
|
-
exports
|
|
52
|
-
exports
|
|
53
|
-
exports
|
|
54
|
-
exports
|
|
55
|
-
exports
|
|
56
|
-
exports
|
|
57
|
-
exports
|
|
58
|
-
exports
|
|
59
|
-
exports
|
|
60
|
-
exports.
|
|
61
|
-
exports.
|
|
62
|
-
exports.
|
|
63
|
-
exports.
|
|
64
|
-
exports.
|
|
65
|
-
exports.
|
|
66
|
-
exports.
|
|
36
|
+
exports.$descendantsMatching = _t;
|
|
37
|
+
exports.$dfs = st;
|
|
38
|
+
exports.$dfsIterator = at;
|
|
39
|
+
exports.$filter = Pt;
|
|
40
|
+
exports.$findMatchingParent = wt;
|
|
41
|
+
exports.$firstToLastIterator = kt;
|
|
42
|
+
exports.$getAdjacentCaret = ct;
|
|
43
|
+
exports.$getAdjacentSiblingOrParentSiblingCaret = $t;
|
|
44
|
+
exports.$getDepth = pt;
|
|
45
|
+
exports.$getNearestBlockElementAncestorOrThrow = yt;
|
|
46
|
+
exports.$getNearestNodeOfType = vt;
|
|
47
|
+
exports.$getNextRightPreorderNode = mt;
|
|
48
|
+
exports.$getNextSiblingOrParentSibling = gt;
|
|
49
|
+
exports.$insertFirst = bt;
|
|
50
|
+
exports.$insertNodeToNearestRoot = St;
|
|
51
|
+
exports.$insertNodeToNearestRootAtCaret = At;
|
|
52
|
+
exports.$isEditorIsNestedEditor = Rt;
|
|
53
|
+
exports.$lastToFirstIterator = Kt;
|
|
54
|
+
exports.$restoreEditorState = Et;
|
|
55
|
+
exports.$reverseDfs = ft;
|
|
56
|
+
exports.$reverseDfsIterator = ht;
|
|
57
|
+
exports.$unwrapAndFilterDescendants = Tt;
|
|
58
|
+
exports.$unwrapNode = Ot;
|
|
59
|
+
exports.$wrapNodeInElement = Ct;
|
|
60
|
+
exports.CAN_USE_BEFORE_INPUT = q;
|
|
61
|
+
exports.CAN_USE_DOM = J;
|
|
62
|
+
exports.IS_ANDROID = Q;
|
|
63
|
+
exports.IS_ANDROID_CHROME = X;
|
|
64
|
+
exports.IS_APPLE = Y;
|
|
65
|
+
exports.IS_APPLE_WEBKIT = Z;
|
|
66
|
+
exports.IS_CHROME = tt;
|
|
67
|
+
exports.IS_FIREFOX = et;
|
|
68
|
+
exports.IS_IOS = nt;
|
|
69
|
+
exports.IS_SAFARI = ot;
|
|
70
|
+
exports.addClassNamesToElement = rt;
|
|
71
|
+
exports.calculateZoomLevel = Mt;
|
|
72
|
+
exports.isMimeType = lt;
|
|
73
|
+
exports.makeStateWrapper = Dt;
|
|
74
|
+
exports.markSelection = W;
|
|
75
|
+
exports.mediaFileReader = ut;
|
|
76
|
+
exports.mergeRegister = j;
|
|
77
|
+
exports.objectKlassEquals = Lt;
|
|
78
|
+
exports.positionNodeOnRange = z;
|
|
79
|
+
exports.registerNestedElementResolver = xt;
|
|
80
|
+
exports.removeClassNamesFromElement = it;
|
|
81
|
+
exports.selectionAlwaysOnDisplay = G;
|
|
@@ -231,7 +231,7 @@ var prism = require('../../_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
|
|
|
@@ -211,7 +211,7 @@ var StickyComponent = function StickyComponent(_ref) {
|
|
|
211
211
|
className: "sticky-placeholder",
|
|
212
212
|
children: "Sticky note..."
|
|
213
213
|
}),
|
|
214
|
-
ErrorBoundary: LexicalErrorBoundary
|
|
214
|
+
ErrorBoundary: LexicalErrorBoundary.LexicalErrorBoundary
|
|
215
215
|
}), /*#__PURE__*/jsxRuntime.jsx(LexicalAutoFocusPlugin.AutoFocusPlugin, {})]
|
|
216
216
|
})]
|
|
217
217
|
})]
|
|
@@ -21,18 +21,42 @@ var react = require('react');
|
|
|
21
21
|
var StickyNode = require('../nodes/StickyNode.js');
|
|
22
22
|
var DraggableBlockPlugin = require('../plugins/DraggableBlockPlugin.js');
|
|
23
23
|
var StickyPlugin = require('../plugins/StickyPlugin.js');
|
|
24
|
-
var Lexical_module = require('./Lexical.module.css');
|
|
25
|
-
var theme = require('./theme.js');
|
|
26
24
|
var ToolbarPlugin = require('../plugins/ToolbarPlugin.js');
|
|
25
|
+
var theme = require('./theme.js');
|
|
27
26
|
var jsxRuntime = require('react/jsx-runtime');
|
|
28
27
|
|
|
28
|
+
/**
|
|
29
|
+
* LexicalEditor component is a rich text editor built using Lexical.
|
|
30
|
+
* It supports various features such as code highlighting, lists, tables, and sticky notes.
|
|
31
|
+
* It provides a customizable toolbar and handles editor state changes.
|
|
32
|
+
* It also supports drag-and-drop functionality for blocks.
|
|
33
|
+
* It can be used in both read-only and editable modes, and supports publishing mode for exporting content.
|
|
34
|
+
* It uses a custom theme and provides error handling for Lexical updates.
|
|
35
|
+
*
|
|
36
|
+
* @param {EditorProps} props - The properties for the LexicalEditor component.
|
|
37
|
+
* @returns {JSX.Element} The rendered LexicalEditor component.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```jsx
|
|
41
|
+
* <LexicalEditor
|
|
42
|
+
* value={initialValue}
|
|
43
|
+
* readOnly={false}
|
|
44
|
+
* publishMode={false}
|
|
45
|
+
* onChange={(value) => console.log("Editor value changed:", value)}
|
|
46
|
+
* onDirty={(isDirty) => console.log("Editor is dirty:", isDirty)}
|
|
47
|
+
* />
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @see {@link https://adarshpastakia.github.io/react-fabric/?path=/story/lexical-playground--playground}
|
|
51
|
+
* @see {@link https://lexical.dev/docs/}
|
|
52
|
+
*/
|
|
29
53
|
var LexicalEditor = function LexicalEditor(_ref) {
|
|
30
54
|
var value = _ref.value,
|
|
31
55
|
readOnly = _ref.readOnly,
|
|
32
56
|
publishMode = _ref.publishMode,
|
|
33
57
|
onChange = _ref.onChange,
|
|
34
58
|
onDirty = _ref.onDirty;
|
|
35
|
-
var editorRef = react.useRef();
|
|
59
|
+
var editorRef = react.useRef(null);
|
|
36
60
|
var _useState = react.useState(null),
|
|
37
61
|
_useState2 = _slicedToArray(_useState, 2),
|
|
38
62
|
editorContainer = _useState2[0],
|
|
@@ -108,7 +132,7 @@ var LexicalEditor = function LexicalEditor(_ref) {
|
|
|
108
132
|
return !publishMode ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
109
133
|
className: "lexical-scroller area-content overflow-auto",
|
|
110
134
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
111
|
-
className: classNames(
|
|
135
|
+
className: classNames("fabric-lexicalToolbar", "sticky top-0 z-1"),
|
|
112
136
|
children: /*#__PURE__*/jsxRuntime.jsx(core.Header, {
|
|
113
137
|
className: "bg-base",
|
|
114
138
|
children: /*#__PURE__*/jsxRuntime.jsx(ToolbarPlugin.ToolbarPlugin, {})
|
|
@@ -124,7 +148,7 @@ var LexicalEditor = function LexicalEditor(_ref) {
|
|
|
124
148
|
colorScheme: "light",
|
|
125
149
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
126
150
|
role: "none",
|
|
127
|
-
className: classNames(
|
|
151
|
+
className: classNames("fabric-lexicalEditor", "lexical-container relative bg-white min-h-full mx-auto shadow-md print:shadow-none"),
|
|
128
152
|
onDragOver: function onDragOver(e) {
|
|
129
153
|
return e.stopPropagation();
|
|
130
154
|
},
|
|
@@ -134,6 +158,7 @@ var LexicalEditor = function LexicalEditor(_ref) {
|
|
|
134
158
|
ref: setEditorContainer,
|
|
135
159
|
children: [/*#__PURE__*/jsxRuntime.jsx(LexicalRichTextPlugin.RichTextPlugin, {
|
|
136
160
|
contentEditable: /*#__PURE__*/jsxRuntime.jsx(LexicalContentEditable.ContentEditable, {
|
|
161
|
+
readOnly: !!readOnly || publishMode,
|
|
137
162
|
className: "lexical-editor px-[2cm] py-[1cm] min-h-screen"
|
|
138
163
|
}),
|
|
139
164
|
placeholder: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
@@ -11,6 +11,7 @@ var LexicalRichText = require('../../../../node_modules/@lexical/rich-text/Lexic
|
|
|
11
11
|
var LexicalSelection = require('../../../../node_modules/@lexical/selection/LexicalSelection.js');
|
|
12
12
|
var LexicalTable = require('../../../../node_modules/@lexical/table/LexicalTable.js');
|
|
13
13
|
var LexicalUtils = require('../../../../node_modules/@lexical/utils/LexicalUtils.js');
|
|
14
|
+
var utilities = require('@react-fabric/utilities');
|
|
14
15
|
var lexical = require('lexical');
|
|
15
16
|
var react = require('react');
|
|
16
17
|
|
|
@@ -44,9 +45,6 @@ function getSelectedNode(selection) {
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
var useFormatWatcher = function useFormatWatcher() {
|
|
47
|
-
var _useTransition = react.useTransition(),
|
|
48
|
-
_useTransition2 = _slicedToArray(_useTransition, 2),
|
|
49
|
-
startTransition = _useTransition2[1];
|
|
50
48
|
var _useLexicalComposerCo = LexicalComposerContext.useLexicalComposerContext(),
|
|
51
49
|
_useLexicalComposerCo2 = _slicedToArray(_useLexicalComposerCo, 1),
|
|
52
50
|
editor = _useLexicalComposerCo2[0];
|
|
@@ -54,88 +52,92 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
54
52
|
_useState2 = _slicedToArray(_useState, 2),
|
|
55
53
|
activeEditor = _useState2[0],
|
|
56
54
|
setActiveEditor = _useState2[1];
|
|
57
|
-
var _useState3 = react.useState(
|
|
55
|
+
var _useState3 = react.useState(),
|
|
58
56
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
var _useState5 = react.useState("
|
|
57
|
+
currentSelection = _useState4[0],
|
|
58
|
+
setCurrentSelection = _useState4[1];
|
|
59
|
+
var _useState5 = react.useState("paragraph"),
|
|
62
60
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var _useState7 = react.useState(
|
|
61
|
+
blockType = _useState6[0],
|
|
62
|
+
setBlockType = _useState6[1];
|
|
63
|
+
var _useState7 = react.useState("root"),
|
|
66
64
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
var _useState9 = react.useState(
|
|
65
|
+
rootType = _useState8[0],
|
|
66
|
+
setRootType = _useState8[1];
|
|
67
|
+
var _useState9 = react.useState(null),
|
|
70
68
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var _useState11 = react.useState("
|
|
69
|
+
selectedElementKey = _useState10[0],
|
|
70
|
+
setSelectedElementKey = _useState10[1];
|
|
71
|
+
var _useState11 = react.useState("16"),
|
|
74
72
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var _useState13 = react.useState("#
|
|
73
|
+
fontSize = _useState12[0],
|
|
74
|
+
setFontSize = _useState12[1];
|
|
75
|
+
var _useState13 = react.useState("#000"),
|
|
78
76
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
var _useState15 = react.useState("
|
|
77
|
+
fontColor = _useState14[0],
|
|
78
|
+
setFontColor = _useState14[1];
|
|
79
|
+
var _useState15 = react.useState("#fff"),
|
|
82
80
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
var _useState17 = react.useState(
|
|
81
|
+
bgColor = _useState16[0],
|
|
82
|
+
setBgColor = _useState16[1];
|
|
83
|
+
var _useState17 = react.useState("Arial"),
|
|
86
84
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
fontFamily = _useState18[0],
|
|
86
|
+
setFontFamily = _useState18[1];
|
|
89
87
|
var _useState19 = react.useState(false),
|
|
90
88
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
isLink = _useState20[0],
|
|
90
|
+
setIsLink = _useState20[1];
|
|
93
91
|
var _useState21 = react.useState(false),
|
|
94
92
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
isBold = _useState22[0],
|
|
94
|
+
setIsBold = _useState22[1];
|
|
97
95
|
var _useState23 = react.useState(false),
|
|
98
96
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
isItalic = _useState24[0],
|
|
98
|
+
setIsItalic = _useState24[1];
|
|
101
99
|
var _useState25 = react.useState(false),
|
|
102
100
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
isUnderline = _useState26[0],
|
|
102
|
+
setIsUnderline = _useState26[1];
|
|
105
103
|
var _useState27 = react.useState(false),
|
|
106
104
|
_useState28 = _slicedToArray(_useState27, 2),
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
isStrikethrough = _useState28[0],
|
|
106
|
+
setIsStrikethrough = _useState28[1];
|
|
109
107
|
var _useState29 = react.useState(false),
|
|
110
108
|
_useState30 = _slicedToArray(_useState29, 2),
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
isSubscript = _useState30[0],
|
|
110
|
+
setIsSubscript = _useState30[1];
|
|
113
111
|
var _useState31 = react.useState(false),
|
|
114
112
|
_useState32 = _slicedToArray(_useState31, 2),
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
isSuperscript = _useState32[0],
|
|
114
|
+
setIsSuperscript = _useState32[1];
|
|
117
115
|
var _useState33 = react.useState(false),
|
|
118
116
|
_useState34 = _slicedToArray(_useState33, 2),
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
isCode = _useState34[0],
|
|
118
|
+
setIsCode = _useState34[1];
|
|
121
119
|
var _useState35 = react.useState(false),
|
|
122
120
|
_useState36 = _slicedToArray(_useState35, 2),
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
canUndo = _useState36[0],
|
|
122
|
+
setCanUndo = _useState36[1];
|
|
125
123
|
var _useState37 = react.useState(false),
|
|
126
124
|
_useState38 = _slicedToArray(_useState37, 2),
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
var _useState39 = react.useState(
|
|
125
|
+
canRedo = _useState38[0],
|
|
126
|
+
setCanRedo = _useState38[1];
|
|
127
|
+
var _useState39 = react.useState(false),
|
|
130
128
|
_useState40 = _slicedToArray(_useState39, 2),
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
var _useState41 = react.useState(
|
|
129
|
+
isRTL = _useState40[0],
|
|
130
|
+
setIsRTL = _useState40[1];
|
|
131
|
+
var _useState41 = react.useState(""),
|
|
132
|
+
_useState42 = _slicedToArray(_useState41, 2),
|
|
133
|
+
codeLanguage = _useState42[0],
|
|
134
|
+
setCodeLanguage = _useState42[1];
|
|
135
|
+
var _useState43 = react.useState(function () {
|
|
134
136
|
return editor.isEditable();
|
|
135
137
|
}),
|
|
136
|
-
|
|
137
|
-
isEditable =
|
|
138
|
-
setIsEditable =
|
|
138
|
+
_useState44 = _slicedToArray(_useState43, 2),
|
|
139
|
+
isEditable = _useState44[0],
|
|
140
|
+
setIsEditable = _useState44[1];
|
|
139
141
|
var $updateToolbar = react.useCallback(function () {
|
|
140
142
|
var selection = lexical.$getSelection();
|
|
141
143
|
if (lexical.$isRangeSelection(selection)) {
|
|
@@ -158,7 +160,9 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
158
160
|
setIsSubscript(selection.hasFormat("subscript"));
|
|
159
161
|
setIsSuperscript(selection.hasFormat("superscript"));
|
|
160
162
|
setIsCode(selection.hasFormat("code"));
|
|
161
|
-
|
|
163
|
+
editor.read(function () {
|
|
164
|
+
setIsRTL(LexicalSelection.$isParentElementRTL(selection));
|
|
165
|
+
});
|
|
162
166
|
|
|
163
167
|
// Update links
|
|
164
168
|
var node = getSelectedNode(selection);
|
|
@@ -194,22 +198,29 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
194
198
|
}
|
|
195
199
|
// Handle buttons
|
|
196
200
|
setFontSize(parseInt(LexicalSelection.$getSelectionStyleValueForProperty(selection, "font-size", "16")) + "");
|
|
197
|
-
setFontColor(LexicalSelection.$getSelectionStyleValueForProperty(selection, "color",
|
|
198
|
-
|
|
201
|
+
setFontColor(LexicalSelection.$getSelectionStyleValueForProperty(selection, "color",
|
|
202
|
+
// @ts-expect-error ignore
|
|
203
|
+
// eslint-disable-next-line no-new-wrappers
|
|
204
|
+
new String("#000")));
|
|
205
|
+
setBgColor(LexicalSelection.$getSelectionStyleValueForProperty(selection, "background-color",
|
|
206
|
+
// @ts-expect-error ignore
|
|
207
|
+
// eslint-disable-next-line no-new-wrappers
|
|
208
|
+
new String("#fff")));
|
|
199
209
|
setFontFamily(LexicalSelection.$getSelectionStyleValueForProperty(selection, "font-family", "inherit"));
|
|
200
210
|
}
|
|
201
|
-
}, [
|
|
211
|
+
}, []);
|
|
202
212
|
react.useEffect(function () {
|
|
203
|
-
return editor.registerCommand(lexical.
|
|
213
|
+
return editor.registerCommand(lexical.SELECTION_CHANGE_COMMAND, function (_payload, newEditor) {
|
|
204
214
|
setActiveEditor(newEditor);
|
|
215
|
+
setCurrentSelection(lexical.$getSelection());
|
|
216
|
+
$updateToolbar();
|
|
205
217
|
return false;
|
|
206
218
|
}, lexical.COMMAND_PRIORITY_CRITICAL);
|
|
207
|
-
}, [editor]);
|
|
219
|
+
}, [editor, $updateToolbar]);
|
|
208
220
|
react.useEffect(function () {
|
|
209
|
-
|
|
221
|
+
activeEditor.getEditorState().read(function () {
|
|
210
222
|
$updateToolbar();
|
|
211
|
-
|
|
212
|
-
}, lexical.COMMAND_PRIORITY_CRITICAL);
|
|
223
|
+
});
|
|
213
224
|
}, [activeEditor, $updateToolbar]);
|
|
214
225
|
react.useEffect(function () {
|
|
215
226
|
return LexicalUtils.mergeRegister(editor.registerEditableListener(function (editable) {
|
|
@@ -228,15 +239,14 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
228
239
|
}, lexical.COMMAND_PRIORITY_CRITICAL));
|
|
229
240
|
}, [$updateToolbar, activeEditor, editor]);
|
|
230
241
|
var applyStyleText = react.useCallback(function (styles) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}, [editor]);
|
|
242
|
+
// activeEditor.focus();
|
|
243
|
+
activeEditor.update(function () {
|
|
244
|
+
if (!utilities.isNil(currentSelection)) {
|
|
245
|
+
lexical.$setSelection(currentSelection.clone());
|
|
246
|
+
LexicalSelection.$patchStyleText(currentSelection, styles);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
249
|
+
}, [activeEditor, currentSelection]);
|
|
240
250
|
var formatBulletList = function formatBulletList() {
|
|
241
251
|
setTimeout(function () {
|
|
242
252
|
if (blockType !== "bullet") {
|
|
@@ -364,25 +374,18 @@ var useFormatWatcher = function useFormatWatcher() {
|
|
|
364
374
|
});
|
|
365
375
|
}, [activeEditor]);
|
|
366
376
|
var onSizeChange = react.useCallback(function (value) {
|
|
367
|
-
startTransition(function () {
|
|
368
|
-
return setFontColor(value);
|
|
369
|
-
});
|
|
370
377
|
applyStyleText({
|
|
371
378
|
"font-size": +value + "px"
|
|
372
379
|
});
|
|
373
380
|
}, [applyStyleText]);
|
|
374
|
-
var onFontColorSelect = react.useCallback(function (
|
|
375
|
-
|
|
376
|
-
return setFontColor(value);
|
|
377
|
-
});
|
|
381
|
+
var onFontColorSelect = react.useCallback(function () {
|
|
382
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "#000000";
|
|
378
383
|
applyStyleText({
|
|
379
384
|
color: value
|
|
380
385
|
});
|
|
381
386
|
}, [applyStyleText]);
|
|
382
|
-
var onBgColorSelect = react.useCallback(function (
|
|
383
|
-
|
|
384
|
-
return setBgColor(value);
|
|
385
|
-
});
|
|
387
|
+
var onBgColorSelect = react.useCallback(function () {
|
|
388
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "#ffffff";
|
|
386
389
|
applyStyleText({
|
|
387
390
|
"background-color": value
|
|
388
391
|
});
|
|
@@ -135,9 +135,11 @@ var ToolbarPlugin = function ToolbarPlugin() {
|
|
|
135
135
|
variant: "link",
|
|
136
136
|
children: [/*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
|
|
137
137
|
value: "start",
|
|
138
|
-
rtlFlip: true,
|
|
139
138
|
label: t("tool.alignStart"),
|
|
140
|
-
icon:
|
|
139
|
+
icon: {
|
|
140
|
+
icon: core.CoreIcons.alignLeft,
|
|
141
|
+
rtlFlip: true
|
|
142
|
+
},
|
|
141
143
|
onClick: function onClick() {
|
|
142
144
|
return watch.activeEditor.dispatchCommand(lexical.FORMAT_ELEMENT_COMMAND, "start");
|
|
143
145
|
}
|
|
@@ -150,33 +152,41 @@ var ToolbarPlugin = function ToolbarPlugin() {
|
|
|
150
152
|
}
|
|
151
153
|
}), /*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
|
|
152
154
|
value: "end",
|
|
153
|
-
rtlFlip: true,
|
|
154
155
|
label: t("tool.alignEnd"),
|
|
155
|
-
icon:
|
|
156
|
+
icon: {
|
|
157
|
+
icon: core.CoreIcons.alignRight,
|
|
158
|
+
rtlFlip: true
|
|
159
|
+
},
|
|
156
160
|
onClick: function onClick() {
|
|
157
161
|
return watch.activeEditor.dispatchCommand(lexical.FORMAT_ELEMENT_COMMAND, "end");
|
|
158
162
|
}
|
|
159
163
|
}), /*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
|
|
160
164
|
value: "justify",
|
|
161
|
-
rtlFlip: true,
|
|
162
165
|
label: t("tool.alignJustify"),
|
|
163
|
-
icon:
|
|
166
|
+
icon: {
|
|
167
|
+
icon: core.CoreIcons.alignJustify,
|
|
168
|
+
rtlFlip: true
|
|
169
|
+
},
|
|
164
170
|
onClick: function onClick() {
|
|
165
171
|
return watch.activeEditor.dispatchCommand(lexical.FORMAT_ELEMENT_COMMAND, "justify");
|
|
166
172
|
}
|
|
167
173
|
}), /*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
|
|
168
174
|
value: "justify",
|
|
169
|
-
rtlFlip: true,
|
|
170
175
|
label: t("tool.indentOut"),
|
|
171
|
-
icon:
|
|
176
|
+
icon: {
|
|
177
|
+
icon: core.CoreIcons.formatIndentDecrease,
|
|
178
|
+
rtlFlip: true
|
|
179
|
+
},
|
|
172
180
|
onClick: function onClick() {
|
|
173
181
|
return watch.outdent();
|
|
174
182
|
}
|
|
175
183
|
}), /*#__PURE__*/jsxRuntime.jsx(ButtonWrapper, {
|
|
176
184
|
value: "justify",
|
|
177
|
-
rtlFlip: true,
|
|
178
185
|
label: t("tool.identIn"),
|
|
179
|
-
icon:
|
|
186
|
+
icon: {
|
|
187
|
+
icon: core.CoreIcons.formatIndentIncrease,
|
|
188
|
+
rtlFlip: true
|
|
189
|
+
},
|
|
180
190
|
onClick: function onClick() {
|
|
181
191
|
return watch.indent();
|
|
182
192
|
}
|
|
@@ -220,9 +230,8 @@ var ToolbarPlugin = function ToolbarPlugin() {
|
|
|
220
230
|
}), /*#__PURE__*/jsxRuntime.jsx(form.ColorInput, {
|
|
221
231
|
noOutline: true,
|
|
222
232
|
value: watch.fontColor,
|
|
223
|
-
onChange: function onChange() {
|
|
224
|
-
|
|
225
|
-
return watch.onFontColorSelect(v);
|
|
233
|
+
onChange: function onChange(v) {
|
|
234
|
+
return watch.onFontColorSelect(v !== null && v !== void 0 ? v : undefined);
|
|
226
235
|
},
|
|
227
236
|
decorateStart: /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
228
237
|
icon: core.CoreIcons.formatText
|
|
@@ -230,9 +239,8 @@ var ToolbarPlugin = function ToolbarPlugin() {
|
|
|
230
239
|
}), /*#__PURE__*/jsxRuntime.jsx(form.ColorInput, {
|
|
231
240
|
noOutline: true,
|
|
232
241
|
value: watch.bgColor,
|
|
233
|
-
onChange: function onChange() {
|
|
234
|
-
|
|
235
|
-
return watch.onBgColorSelect(v);
|
|
242
|
+
onChange: function onChange(v) {
|
|
243
|
+
return watch.onBgColorSelect(v !== null && v !== void 0 ? v : undefined);
|
|
236
244
|
},
|
|
237
245
|
decorateStart: /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
238
246
|
icon: core.CoreIcons.formatFill
|
|
@@ -251,7 +259,7 @@ var ToolbarPlugin = function ToolbarPlugin() {
|
|
|
251
259
|
onClick: function onClick() {
|
|
252
260
|
return watch.clearFormatting();
|
|
253
261
|
}
|
|
254
|
-
})
|
|
262
|
+
})]
|
|
255
263
|
});
|
|
256
264
|
};
|
|
257
265
|
|