@lexical/react 0.50.1-nightly.20260904.0 → 0.50.1-nightly.20260908.0
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/dist/LexicalCollaborationContextUtils.d.ts +4 -1
- package/dist/LexicalCollaborationContextUtils.dev.js +26 -6
- package/dist/LexicalCollaborationContextUtils.dev.mjs +26 -6
- package/dist/LexicalCollaborationContextUtils.prod.js +3 -1
- package/dist/LexicalCollaborationContextUtils.prod.mjs +3 -1
- package/dist/LexicalComposerContext.dev.js +6 -1
- package/dist/LexicalComposerContext.dev.mjs +6 -1
- package/dist/LexicalComposerContext.prod.js +3 -1
- package/dist/LexicalComposerContext.prod.mjs +3 -1
- package/dist/LexicalContentEditable.dev.js +8 -2
- package/dist/LexicalContentEditable.dev.mjs +8 -2
- package/dist/LexicalContentEditable.prod.js +1 -1
- package/dist/LexicalContentEditable.prod.mjs +1 -1
- package/dist/LexicalDraggableBlockPlugin.prod.js +1 -1
- package/dist/LexicalDraggableBlockPlugin.prod.mjs +1 -1
- package/dist/LexicalMarkdownShortcutPlugin.d.ts +0 -5
- package/dist/LexicalMarkdownShortcutPlugin.dev.js +13 -1
- package/dist/LexicalMarkdownShortcutPlugin.dev.mjs +14 -2
- package/dist/LexicalMarkdownShortcutPlugin.prod.js +1 -1
- package/dist/LexicalMarkdownShortcutPlugin.prod.mjs +1 -1
- package/dist/LexicalNestedComposer.dev.js +9 -2
- package/dist/LexicalNestedComposer.dev.mjs +9 -2
- package/dist/LexicalNestedComposer.prod.js +3 -2
- package/dist/LexicalNestedComposer.prod.mjs +3 -2
- package/dist/LexicalNodeContextMenuPlugin.dev.js +7 -3
- package/dist/LexicalNodeContextMenuPlugin.dev.mjs +7 -3
- package/dist/LexicalNodeContextMenuPlugin.prod.js +1 -1
- package/dist/LexicalNodeContextMenuPlugin.prod.mjs +1 -1
- package/dist/LexicalReactExtension.dev.js +5 -3
- package/dist/LexicalReactExtension.dev.mjs +5 -3
- package/dist/LexicalReactExtension.prod.js +1 -1
- package/dist/LexicalReactExtension.prod.mjs +1 -1
- package/package.json +20 -20
- package/src/LexicalCollaborationContextUtils.ts +22 -5
- package/src/LexicalComposerContext.ts +7 -3
- package/src/LexicalContentEditable.tsx +4 -1
- package/src/LexicalMarkdownShortcutPlugin.tsx +14 -1
- package/src/LexicalNodeContextMenuPlugin.tsx +6 -3
- package/src/ReactExtension.tsx +5 -3
- package/src/shared/LexicalContentEditableElement.tsx +6 -1
|
@@ -23,7 +23,10 @@ export type CollaborationContextType = {
|
|
|
23
23
|
* it with {@link useCollaborationContext}.
|
|
24
24
|
*/
|
|
25
25
|
export declare const CollaborationContext: import("react").Context<CollaborationContextType | null>;
|
|
26
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
* @__NO_SIDE_EFFECTS__
|
|
29
|
+
*/
|
|
27
30
|
export declare function newContext(): CollaborationContextType;
|
|
28
31
|
/**
|
|
29
32
|
* Reads the current {@link CollaborationContextType} from the nearest
|
|
@@ -31,28 +31,48 @@ function formatDevErrorMessage(message) {
|
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
33
|
const entries = [['Cat', 'rgb(125, 50, 0)'], ['Dog', 'rgb(100, 0, 0)'], ['Rabbit', 'rgb(150, 0, 0)'], ['Frog', 'rgb(200, 0, 0)'], ['Fox', 'rgb(200, 75, 0)'], ['Hedgehog', 'rgb(0, 75, 0)'], ['Pigeon', 'rgb(0, 125, 0)'], ['Squirrel', 'rgb(75, 100, 0)'], ['Bear', 'rgb(125, 100, 0)'], ['Tiger', 'rgb(0, 0, 150)'], ['Leopard', 'rgb(0, 0, 200)'], ['Zebra', 'rgb(0, 0, 250)'], ['Wolf', 'rgb(0, 100, 150)'], ['Owl', 'rgb(0, 100, 100)'], ['Gull', 'rgb(100, 0, 100)'], ['Squid', 'rgb(150, 0, 150)']];
|
|
34
|
-
|
|
34
|
+
|
|
35
|
+
// Picked on first use rather than at module scope, where the `Math.random()`
|
|
36
|
+
// call is a side effect to bundlers that would pin this module (and the
|
|
37
|
+
// table above) into every bundle importing it. It is still picked once and
|
|
38
|
+
// shared by every context created afterwards, as before.
|
|
39
|
+
let randomEntry;
|
|
40
|
+
function getRandomEntry() {
|
|
41
|
+
if (randomEntry === undefined) {
|
|
42
|
+
randomEntry = entries[Math.floor(Math.random() * entries.length)];
|
|
43
|
+
}
|
|
44
|
+
return randomEntry;
|
|
45
|
+
}
|
|
35
46
|
|
|
36
47
|
/**
|
|
37
48
|
* The React context that holds the shared {@link CollaborationContextType} for
|
|
38
49
|
* collaborative editors. Provide it with {@link LexicalCollaboration} and read
|
|
39
50
|
* it with {@link useCollaborationContext}.
|
|
40
51
|
*/
|
|
41
|
-
const CollaborationContext =
|
|
52
|
+
const CollaborationContext =
|
|
53
|
+
// Annotated by hand: React's createContext is not a Lexical factory, so the
|
|
54
|
+
// build does not annotate it, and an unannotated module-scope call pins the
|
|
55
|
+
// module into every bundle.
|
|
56
|
+
/* @__PURE__ */
|
|
57
|
+
react.createContext(null);
|
|
42
58
|
|
|
43
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
* @__NO_SIDE_EFFECTS__
|
|
62
|
+
*/
|
|
44
63
|
function newContext() {
|
|
64
|
+
const [name, color] = getRandomEntry();
|
|
45
65
|
return {
|
|
46
|
-
color
|
|
66
|
+
color,
|
|
47
67
|
isCollabActive: false,
|
|
48
|
-
name
|
|
68
|
+
name,
|
|
49
69
|
yjsDocMap: new Map()
|
|
50
70
|
};
|
|
51
71
|
}
|
|
52
72
|
|
|
53
73
|
// This is here to help the transition post-#7818, however should be removed in a future release as
|
|
54
74
|
// a shared context across editors is likely to lead to bugs.
|
|
55
|
-
const UNSAFE_GLOBAL_CONTEXT = newContext();
|
|
75
|
+
const UNSAFE_GLOBAL_CONTEXT = /* @__PURE__ */newContext();
|
|
56
76
|
|
|
57
77
|
/**
|
|
58
78
|
* Reads the current {@link CollaborationContextType} from the nearest
|
|
@@ -29,28 +29,48 @@ function formatDevErrorMessage(message) {
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
const entries = [['Cat', 'rgb(125, 50, 0)'], ['Dog', 'rgb(100, 0, 0)'], ['Rabbit', 'rgb(150, 0, 0)'], ['Frog', 'rgb(200, 0, 0)'], ['Fox', 'rgb(200, 75, 0)'], ['Hedgehog', 'rgb(0, 75, 0)'], ['Pigeon', 'rgb(0, 125, 0)'], ['Squirrel', 'rgb(75, 100, 0)'], ['Bear', 'rgb(125, 100, 0)'], ['Tiger', 'rgb(0, 0, 150)'], ['Leopard', 'rgb(0, 0, 200)'], ['Zebra', 'rgb(0, 0, 250)'], ['Wolf', 'rgb(0, 100, 150)'], ['Owl', 'rgb(0, 100, 100)'], ['Gull', 'rgb(100, 0, 100)'], ['Squid', 'rgb(150, 0, 150)']];
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
// Picked on first use rather than at module scope, where the `Math.random()`
|
|
34
|
+
// call is a side effect to bundlers that would pin this module (and the
|
|
35
|
+
// table above) into every bundle importing it. It is still picked once and
|
|
36
|
+
// shared by every context created afterwards, as before.
|
|
37
|
+
let randomEntry;
|
|
38
|
+
function getRandomEntry() {
|
|
39
|
+
if (randomEntry === undefined) {
|
|
40
|
+
randomEntry = entries[Math.floor(Math.random() * entries.length)];
|
|
41
|
+
}
|
|
42
|
+
return randomEntry;
|
|
43
|
+
}
|
|
33
44
|
|
|
34
45
|
/**
|
|
35
46
|
* The React context that holds the shared {@link CollaborationContextType} for
|
|
36
47
|
* collaborative editors. Provide it with {@link LexicalCollaboration} and read
|
|
37
48
|
* it with {@link useCollaborationContext}.
|
|
38
49
|
*/
|
|
39
|
-
const CollaborationContext =
|
|
50
|
+
const CollaborationContext =
|
|
51
|
+
// Annotated by hand: React's createContext is not a Lexical factory, so the
|
|
52
|
+
// build does not annotate it, and an unannotated module-scope call pins the
|
|
53
|
+
// module into every bundle.
|
|
54
|
+
/* @__PURE__ */
|
|
55
|
+
createContext(null);
|
|
40
56
|
|
|
41
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* @internal
|
|
59
|
+
* @__NO_SIDE_EFFECTS__
|
|
60
|
+
*/
|
|
42
61
|
function newContext() {
|
|
62
|
+
const [name, color] = getRandomEntry();
|
|
43
63
|
return {
|
|
44
|
-
color
|
|
64
|
+
color,
|
|
45
65
|
isCollabActive: false,
|
|
46
|
-
name
|
|
66
|
+
name,
|
|
47
67
|
yjsDocMap: new Map()
|
|
48
68
|
};
|
|
49
69
|
}
|
|
50
70
|
|
|
51
71
|
// This is here to help the transition post-#7818, however should be removed in a future release as
|
|
52
72
|
// a shared context across editors is likely to lead to bugs.
|
|
53
|
-
const UNSAFE_GLOBAL_CONTEXT = newContext();
|
|
73
|
+
const UNSAFE_GLOBAL_CONTEXT = /* @__PURE__ */newContext();
|
|
54
74
|
|
|
55
75
|
/**
|
|
56
76
|
* Reads the current {@link CollaborationContextType} from the nearest
|
|
@@ -6,4 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
"use strict";var r=require("react");const e=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]]
|
|
9
|
+
"use strict";var r=require("react");const e=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]];let o;const n=
|
|
10
|
+
/* @__PURE__ */
|
|
11
|
+
r.createContext(null);function t(){const[r,n]=(void 0===o&&(o=e[Math.floor(Math.random()*e.length)]),o);return{color:n,isCollabActive:!1,name:r,yjsDocMap:new Map}}const l=/* @__PURE__ */t();exports.CollaborationContext=n,exports.newContext=t,exports.useCollaborationContext=function(e,o){let t=r.useContext(n);return null==t&&function(r,...e){const o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",r);for(const r of e)n.append("v",r);o.search=n.toString(),console.warn(`Minified Lexical warning #${r}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(319),t=t??l,null!=e&&(t.name=e),null!=o&&(t.color=o),t};
|
|
@@ -6,4 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{createContext as r,useContext as n}from"react";const
|
|
9
|
+
import{createContext as r,useContext as n}from"react";const o=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]];let e;const t=
|
|
10
|
+
/* @__PURE__ */
|
|
11
|
+
r(null);function l(){const[r,n]=(void 0===e&&(e=o[Math.floor(Math.random()*o.length)]),e);return{color:n,isCollabActive:!1,name:r,yjsDocMap:new Map}}const a=/* @__PURE__ */l();function i(r,o){let e=n(t);return null==e&&function(r,...n){const o=new URL("https://lexical.dev/docs/error"),e=new URLSearchParams;e.append("code",r);for(const r of n)e.append("v",r);o.search=e.toString(),console.warn(`Minified Lexical warning #${r}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(319),e=e??a,null!=r&&(e.name=r),null!=o&&(e.color=o),e}export{t as CollaborationContext,l as newContext,i as useCollaborationContext};
|
|
@@ -43,7 +43,12 @@ function formatDevErrorMessage(message) {
|
|
|
43
43
|
* Most code should read it through {@link useLexicalComposerContext} rather than
|
|
44
44
|
* consuming the context directly.
|
|
45
45
|
*/
|
|
46
|
-
const LexicalComposerContext =
|
|
46
|
+
const LexicalComposerContext =
|
|
47
|
+
// Annotated by hand: React's createContext is not a Lexical factory, so the
|
|
48
|
+
// build does not annotate it, and an unannotated module-scope call pins the
|
|
49
|
+
// module into every bundle.
|
|
50
|
+
/* @__PURE__ */
|
|
51
|
+
react.createContext(null);
|
|
47
52
|
|
|
48
53
|
/**
|
|
49
54
|
* Creates a {@link LexicalComposerContextType} for a composer. Theme resolution
|
|
@@ -41,7 +41,12 @@ function formatDevErrorMessage(message) {
|
|
|
41
41
|
* Most code should read it through {@link useLexicalComposerContext} rather than
|
|
42
42
|
* consuming the context directly.
|
|
43
43
|
*/
|
|
44
|
-
const LexicalComposerContext =
|
|
44
|
+
const LexicalComposerContext =
|
|
45
|
+
// Annotated by hand: React's createContext is not a Lexical factory, so the
|
|
46
|
+
// build does not annotate it, and an unannotated module-scope call pins the
|
|
47
|
+
// module into every bundle.
|
|
48
|
+
/* @__PURE__ */
|
|
49
|
+
createContext(null);
|
|
45
50
|
|
|
46
51
|
/**
|
|
47
52
|
* Creates a {@link LexicalComposerContextType} for a composer. Theme resolution
|
|
@@ -6,4 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
"use strict";var e=require("react");const n=
|
|
9
|
+
"use strict";var e=require("react");const n=
|
|
10
|
+
/* @__PURE__ */
|
|
11
|
+
e.createContext(null);exports.LexicalComposerContext=n,exports.createLexicalComposerContext=function(e,n){let t=null;return null!=e&&(t=e[1]),{getTheme:function(){return null!=n?n:null!=t?t.getTheme():null}}},exports.useLexicalComposerContext=function(){const t=e.useContext(n);return null==t&&function(e,...n){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of n)r.append("v",e);throw t.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),t};
|
|
@@ -6,4 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{createContext as n,useContext as e}from"react";const r=
|
|
9
|
+
import{createContext as n,useContext as e}from"react";const r=
|
|
10
|
+
/* @__PURE__ */
|
|
11
|
+
n(null);function t(n,e){let r=null;return null!=n&&(r=n[1]),{getTheme:function(){return null!=e?e:null!=r?r.getTheme():null}}}function o(){const n=e(r);return null==n&&function(n,...e){const r=new URL("https://lexical.dev/docs/error"),t=new URLSearchParams;t.append("code",n);for(const n of e)t.append("v",n);throw r.search=t.toString(),Error(`Minified Lexical error #${n}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),n}export{r as LexicalComposerContext,t as createLexicalComposerContext,o as useLexicalComposerContext};
|
|
@@ -141,7 +141,10 @@ function ContentEditableElementImpl({
|
|
|
141
141
|
* attributes. Prefer {@link ContentEditable}, which reads the editor from
|
|
142
142
|
* context and adds placeholder support, unless you need this extra control.
|
|
143
143
|
*/
|
|
144
|
-
|
|
144
|
+
// Annotated by hand: React's forwardRef is not a Lexical factory, so the build
|
|
145
|
+
// does not annotate it, and an unannotated module-scope call pins the module
|
|
146
|
+
// into every bundle that imports it.
|
|
147
|
+
const ContentEditableElement = /* @__PURE__ */react.forwardRef(ContentEditableElementImpl);
|
|
145
148
|
|
|
146
149
|
/**
|
|
147
150
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -195,7 +198,10 @@ function useCanShowPlaceholder(editor) {
|
|
|
195
198
|
* {@link PlainTextPlugin}. An optional `placeholder` is shown while the editor
|
|
196
199
|
* is empty. The `ref` is forwarded to the underlying `<div>`.
|
|
197
200
|
*/
|
|
198
|
-
|
|
201
|
+
// Annotated by hand: React's forwardRef is not a Lexical factory, so the build
|
|
202
|
+
// does not annotate it, and an unannotated module-scope call pins the module
|
|
203
|
+
// into every bundle that imports it.
|
|
204
|
+
const ContentEditable = /* @__PURE__ */react.forwardRef(ContentEditableImpl);
|
|
199
205
|
function ContentEditableImpl(props, ref) {
|
|
200
206
|
const {
|
|
201
207
|
placeholder,
|
|
@@ -139,7 +139,10 @@ function ContentEditableElementImpl({
|
|
|
139
139
|
* attributes. Prefer {@link ContentEditable}, which reads the editor from
|
|
140
140
|
* context and adds placeholder support, unless you need this extra control.
|
|
141
141
|
*/
|
|
142
|
-
|
|
142
|
+
// Annotated by hand: React's forwardRef is not a Lexical factory, so the build
|
|
143
|
+
// does not annotate it, and an unannotated module-scope call pins the module
|
|
144
|
+
// into every bundle that imports it.
|
|
145
|
+
const ContentEditableElement = /* @__PURE__ */forwardRef(ContentEditableElementImpl);
|
|
143
146
|
|
|
144
147
|
/**
|
|
145
148
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -193,7 +196,10 @@ function useCanShowPlaceholder(editor) {
|
|
|
193
196
|
* {@link PlainTextPlugin}. An optional `placeholder` is shown while the editor
|
|
194
197
|
* is empty. The `ref` is forwarded to the underlying `<div>`.
|
|
195
198
|
*/
|
|
196
|
-
|
|
199
|
+
// Annotated by hand: React's forwardRef is not a Lexical factory, so the build
|
|
200
|
+
// does not annotate it, and an unannotated module-scope call pins the module
|
|
201
|
+
// into every bundle that imports it.
|
|
202
|
+
const ContentEditable = /* @__PURE__ */forwardRef(ContentEditableImpl);
|
|
197
203
|
function ContentEditableImpl(props, ref) {
|
|
198
204
|
const {
|
|
199
205
|
placeholder,
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
"use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("react"),a=require("lexical"),r=require("react/jsx-runtime"),i=require("@lexical/text");const n=a.CAN_USE_DOM?t.useLayoutEffect:t.useEffect;function l({editor:e,ariaActiveDescendant:a,ariaAutoComplete:i,ariaControls:l,ariaDescribedBy:o,ariaErrorMessage:s,ariaExpanded:d,ariaInvalid:u,ariaLabel:c,ariaLabelledBy:f,ariaMultiline:b,ariaOwns:x,ariaRequired:m,autoCapitalize:E,className:p,id:C,role:v="textbox",spellCheck:y=!0,style:g,tabIndex:L,"data-testid":h,...w},q){const[j,R]=t.useState(e.isEditable()),D=t.useCallback(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),S=t.useMemo(()=>function(...e){return t=>{for(const a of e)"function"==typeof a?a(t):null!=a&&(a.current=t)}}(q,D),[D,q]);return n(()=>(R(e.isEditable()),e.registerEditableListener(e=>{R(e)})),[e]),/*#__PURE__*/r.jsx("div",{"aria-activedescendant":j?a:void 0,"aria-autocomplete":j?i:"none","aria-controls":j?l:void 0,"aria-describedby":o,...null!=s?{"aria-errormessage":s}:{},"aria-expanded":j&&"combobox"===v?!!d:void 0,...null!=u?{"aria-invalid":u}:{},"aria-label":c,"aria-labelledby":f,"aria-multiline":b,"aria-owns":j?x:void 0,"aria-readonly":!j||void 0,"aria-required":m,autoCapitalize:E,className:p,contentEditable:j,"data-testid":h,id:C,ref:S,role:v,spellCheck:y,style:g,tabIndex:L??(j?void 0:-1),...w})}const o
|
|
9
|
+
"use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("react"),a=require("lexical"),r=require("react/jsx-runtime"),i=require("@lexical/text");const n=a.CAN_USE_DOM?t.useLayoutEffect:t.useEffect;function l({editor:e,ariaActiveDescendant:a,ariaAutoComplete:i,ariaControls:l,ariaDescribedBy:o,ariaErrorMessage:s,ariaExpanded:d,ariaInvalid:u,ariaLabel:c,ariaLabelledBy:f,ariaMultiline:b,ariaOwns:x,ariaRequired:m,autoCapitalize:E,className:p,id:C,role:v="textbox",spellCheck:y=!0,style:g,tabIndex:L,"data-testid":h,...w},q){const[j,R]=t.useState(e.isEditable()),D=t.useCallback(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),S=t.useMemo(()=>function(...e){return t=>{for(const a of e)"function"==typeof a?a(t):null!=a&&(a.current=t)}}(q,D),[D,q]);return n(()=>(R(e.isEditable()),e.registerEditableListener(e=>{R(e)})),[e]),/*#__PURE__*/r.jsx("div",{"aria-activedescendant":j?a:void 0,"aria-autocomplete":j?i:"none","aria-controls":j?l:void 0,"aria-describedby":o,...null!=s?{"aria-errormessage":s}:{},"aria-expanded":j&&"combobox"===v?!!d:void 0,...null!=u?{"aria-invalid":u}:{},"aria-label":c,"aria-labelledby":f,"aria-multiline":b,"aria-owns":j?x:void 0,"aria-readonly":!j||void 0,"aria-required":m,autoCapitalize:E,className:p,contentEditable:j,"data-testid":h,id:C,ref:S,role:v,spellCheck:y,style:g,tabIndex:L??(j?void 0:-1),...w})}const o=/* @__PURE__ */t.forwardRef(l);function s(e){return e.read("latest",i.$canShowPlaceholderCurry(e.isComposing()))}const d=/* @__PURE__ */t.forwardRef(u);function u(t,a){const{placeholder:i,...n}=t,[l]=e.useLexicalComposerContext();
|
|
10
10
|
return r.jsxs(r.Fragment,{children:[/*#__PURE__*/r.jsx(o,{editor:l,...n,ref:a}),null!=i&&/*#__PURE__*/r.jsx(c,{editor:l,content:i})]})}function c({content:e,editor:i}){const l=function(e){const[r,i]=t.useState(()=>s(e));return n(()=>{function t(){const t=s(e);i(t)}return t(),a.mergeRegister(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),r}(i),[o,d]=t.useState(i.isEditable());if(n(()=>(d(i.isEditable()),i.registerEditableListener(e=>{d(e)})),[i]),!l)return null;let u=null;return"function"==typeof e?u=e(o):null!==e&&(u=e),null===u?null:/*#__PURE__*/r.jsx("div",{"aria-hidden":!0,children:u})}exports.ContentEditable=d,exports.ContentEditableElement=o;
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useLayoutEffect as t,useEffect as i,forwardRef as a,useState as r,useCallback as n,useMemo as o}from"react";import{CAN_USE_DOM as l,mergeRegister as d}from"lexical";import{jsx as s,jsxs as c,Fragment as u}from"react/jsx-runtime";import{$canShowPlaceholderCurry as m}from"@lexical/text";const f=l?t:i;function b({editor:e,ariaActiveDescendant:t,ariaAutoComplete:i,ariaControls:a,ariaDescribedBy:l,ariaErrorMessage:d,ariaExpanded:c,ariaInvalid:u,ariaLabel:m,ariaLabelledBy:b,ariaMultiline:p,ariaOwns:x,ariaRequired:v,autoCapitalize:E,className:y,id:C,role:g="textbox",spellCheck:L=!0,style:h,tabIndex:w,"data-testid":D,...I},R){const[k,q]=r(e.isEditable()),z=n(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),A=o(()=>function(...e){return t=>{for(const i of e)"function"==typeof i?i(t):null!=i&&(i.current=t)}}(R,z),[z,R]);return f(()=>(q(e.isEditable()),e.registerEditableListener(e=>{q(e)})),[e]),/*#__PURE__*/s("div",{"aria-activedescendant":k?t:void 0,"aria-autocomplete":k?i:"none","aria-controls":k?a:void 0,"aria-describedby":l,...null!=d?{"aria-errormessage":d}:{},"aria-expanded":k&&"combobox"===g?!!c:void 0,...null!=u?{"aria-invalid":u}:{},"aria-label":m,"aria-labelledby":b,"aria-multiline":p,"aria-owns":k?x:void 0,"aria-readonly":!k||void 0,"aria-required":v,autoCapitalize:E,className:y,contentEditable:k,"data-testid":D,id:C,ref:A,role:g,spellCheck:L,style:h,tabIndex:w??(k?void 0:-1),...I})}const p
|
|
9
|
+
import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useLayoutEffect as t,useEffect as i,forwardRef as a,useState as r,useCallback as n,useMemo as o}from"react";import{CAN_USE_DOM as l,mergeRegister as d}from"lexical";import{jsx as s,jsxs as c,Fragment as u}from"react/jsx-runtime";import{$canShowPlaceholderCurry as m}from"@lexical/text";const f=l?t:i;function b({editor:e,ariaActiveDescendant:t,ariaAutoComplete:i,ariaControls:a,ariaDescribedBy:l,ariaErrorMessage:d,ariaExpanded:c,ariaInvalid:u,ariaLabel:m,ariaLabelledBy:b,ariaMultiline:p,ariaOwns:x,ariaRequired:v,autoCapitalize:E,className:y,id:C,role:g="textbox",spellCheck:L=!0,style:h,tabIndex:w,"data-testid":D,...I},R){const[k,q]=r(e.isEditable()),z=n(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),A=o(()=>function(...e){return t=>{for(const i of e)"function"==typeof i?i(t):null!=i&&(i.current=t)}}(R,z),[z,R]);return f(()=>(q(e.isEditable()),e.registerEditableListener(e=>{q(e)})),[e]),/*#__PURE__*/s("div",{"aria-activedescendant":k?t:void 0,"aria-autocomplete":k?i:"none","aria-controls":k?a:void 0,"aria-describedby":l,...null!=d?{"aria-errormessage":d}:{},"aria-expanded":k&&"combobox"===g?!!c:void 0,...null!=u?{"aria-invalid":u}:{},"aria-label":m,"aria-labelledby":b,"aria-multiline":p,"aria-owns":k?x:void 0,"aria-readonly":!k||void 0,"aria-required":v,autoCapitalize:E,className:y,contentEditable:k,"data-testid":D,id:C,ref:A,role:g,spellCheck:L,style:h,tabIndex:w??(k?void 0:-1),...I})}const p=/* @__PURE__ */a(b);function x(e){return e.read("latest",m(e.isComposing()))}const v=/* @__PURE__ */a(E);function E(t,i){const{placeholder:a,...r}=t,[n]=e();
|
|
10
10
|
return c(u,{children:[/*#__PURE__*/s(p,{editor:n,...r,ref:i}),null!=a&&/*#__PURE__*/s(y,{editor:n,content:a})]})}function y({content:e,editor:t}){const i=function(e){const[t,i]=r(()=>x(e));return f(()=>{function t(){const t=x(e);i(t)}return t(),d(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(t),[a,n]=r(t.isEditable());if(f(()=>(n(t.isEditable()),t.registerEditableListener(e=>{n(e)})),[t]),!i)return null;let o=null;return"function"==typeof e?o=e(a):null!==e&&(o=e),null===o?null:/*#__PURE__*/s("div",{"aria-hidden":!0,children:o})}export{v as ContentEditable,p as ContentEditableElement};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
"use strict";var t=require("@lexical/react/LexicalComposerContext"),e=require("@lexical/react/useLexicalEditable"),n=require("@lexical/rich-text"),o=require("@lexical/utils"),r=require("lexical"),i=require("react"),s=require("react-dom"),l=require("react/jsx-runtime");class a{_x;_y;constructor(t,e){this._x=t,this._y=e}get x(){return this._x}get y(){return this._y}equals({x:t,y:e}){return this.x===t&&this.y===e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}}class c{_left;_top;_right;_bottom;constructor(t,e,n,o){const[r,i]=e<=o?[e,o]:[o,e],[s,l]=t<=n?[t,n]:[n,t];this._top=r,this._right=l,this._left=s,this._bottom=i}get top(){return this._top}get right(){return this._right}get bottom(){return this._bottom}get left(){return this._left}get width(){return Math.abs(this._left-this._right)}get height(){return Math.abs(this._bottom-this._top)}equals({top:t,left:e,bottom:n,right:o}){return t===this._top&&n===this._bottom&&e===this._left&&o===this._right}contains(t){if(t instanceof a){const{x:e,y:n}=t,o=n<this._top,r=n>this._bottom,i=e<this._left,s=e>this._right;return{reason:{isOnBottomSide:r,isOnLeftSide:i,isOnRightSide:s,isOnTopSide:o},result:!(o||r||i||s)}}{const{top:e,left:n,bottom:o,right:r}=t;return e>=this._top&&e<=this._bottom&&o>=this._top&&o<=this._bottom&&n>=this._left&&n<=this._right&&r>=this._left&&r<=this._right}}intersectsWith(t){const{left:e,top:n,width:o,height:r}=t,{left:i,top:s,width:l,height:a}=this;return(e+o>=i+l?e+o:i+l)-(e<=i?e:i)<=o+l&&(n+r>=s+a?n+r:s+a)-(n<=s?n:s)<=r+a}generateNewRect({left:t=this.left,top:e=this.top,right:n=this.right,bottom:o=this.bottom}){return new c(t,e,n,o)}static fromLTRB(t,e,n,o){return new c(t,e,n,o)}static fromLWTH(t,e,n,o){return new c(t,n,t+e,n+o)}static fromPoints(t,e){const{y:n,x:o}=t,{y:r,x:i}=e;return c.fromLTRB(o,n,i,r)}static fromDOM(t){const{top:e,width:n,left:o,height:r}=t.getBoundingClientRect();return c.fromLWTH(o,n,e,r)}}const u="application/x-lexical-drag-block";let g=
|
|
9
|
+
"use strict";var t=require("@lexical/react/LexicalComposerContext"),e=require("@lexical/react/useLexicalEditable"),n=require("@lexical/rich-text"),o=require("@lexical/utils"),r=require("lexical"),i=require("react"),s=require("react-dom"),l=require("react/jsx-runtime");class a{_x;_y;constructor(t,e){this._x=t,this._y=e}get x(){return this._x}get y(){return this._y}equals({x:t,y:e}){return this.x===t&&this.y===e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}}class c{_left;_top;_right;_bottom;constructor(t,e,n,o){const[r,i]=e<=o?[e,o]:[o,e],[s,l]=t<=n?[t,n]:[n,t];this._top=r,this._right=l,this._left=s,this._bottom=i}get top(){return this._top}get right(){return this._right}get bottom(){return this._bottom}get left(){return this._left}get width(){return Math.abs(this._left-this._right)}get height(){return Math.abs(this._bottom-this._top)}equals({top:t,left:e,bottom:n,right:o}){return t===this._top&&n===this._bottom&&e===this._left&&o===this._right}contains(t){if(t instanceof a){const{x:e,y:n}=t,o=n<this._top,r=n>this._bottom,i=e<this._left,s=e>this._right;return{reason:{isOnBottomSide:r,isOnLeftSide:i,isOnRightSide:s,isOnTopSide:o},result:!(o||r||i||s)}}{const{top:e,left:n,bottom:o,right:r}=t;return e>=this._top&&e<=this._bottom&&o>=this._top&&o<=this._bottom&&n>=this._left&&n<=this._right&&r>=this._left&&r<=this._right}}intersectsWith(t){const{left:e,top:n,width:o,height:r}=t,{left:i,top:s,width:l,height:a}=this;return(e+o>=i+l?e+o:i+l)-(e<=i?e:i)<=o+l&&(n+r>=s+a?n+r:s+a)-(n<=s?n:s)<=r+a}generateNewRect({left:t=this.left,top:e=this.top,right:n=this.right,bottom:o=this.bottom}){return new c(t,e,n,o)}static fromLTRB(t,e,n,o){return new c(t,e,n,o)}static fromLWTH(t,e,n,o){return new c(t,n,t+e,n+o)}static fromPoints(t,e){const{y:n,x:o}=t,{y:r,x:i}=e;return c.fromLTRB(o,n,i,r)}static fromDOM(t){const{top:e,width:n,left:o,height:r}=t.getBoundingClientRect();return c.fromLWTH(o,n,e,r)}}const u="application/x-lexical-drag-block";let g=Infinity;function m(t,e){e.focus({preventScroll:!0}),t.update(()=>{const t=r.$getSelection();null===t||t.dirty||(t.dirty=!0)})}function f(t){const e=t.ownerDocument.defaultView,n=(t,n)=>t&&e?parseFloat(e.getComputedStyle(t)[n]):0,{marginTop:o="0",marginBottom:r="0"}=e?e.getComputedStyle(t):{},i=n(t.previousElementSibling,"marginBottom"),s=n(t.nextElementSibling,"marginTop"),l=Math.max(parseFloat(o),i);return{marginBottom:Math.max(parseFloat(r),s),marginTop:l}}function h(t,e,n,i=!1){const s=t.getBoundingClientRect(),l=function(t){return t.read("latest",()=>r.$getRoot().getChildrenKeys())}(e);let u=null;return e.read("latest",()=>{if(i){const[t,r]=[e.getElementByKey(l[0]),e.getElementByKey(l[l.length-1])],[i,s]=[null!=t?t.getBoundingClientRect():void 0,null!=r?r.getBoundingClientRect():void 0];if(i&&s){const e=o.calculateZoomLevel(t),l=o.calculateZoomLevel(r);if(n.y/e<i.top?u=t:n.y/l>s.bottom&&(u=r),u)return}}let t=0===(r=l.length)?Infinity:g>=0&&g<r?g:Math.floor(r/2);var r;let m=0;for(;t>=0&&t<l.length;){const r=l[t],i=e.getElementByKey(r);if(null===i)break;const h=o.calculateZoomLevel(i),p=new a(n.x/h,n.y/h),d=c.fromDOM(i),{marginTop:_,marginBottom:y}=f(i),R=d.generateNewRect({bottom:d.bottom+y,left:s.left,right:s.right,top:d.top-_}),{result:x,reason:{isOnTopSide:E,isOnBottomSide:T}}=R.contains(p);if(x){u=i,g=t;break}0===m&&(m=E?-1:T?1:Infinity),t+=m}}),u}function p(t,e,a,c,g,p,d,_,y){const R=r.getParentElement(e),x=i.useRef(!1),[E,T]=i.useState(null),C=i.useCallback(t=>{T(t),y&&y(t)},[y]);return i.useEffect(()=>{if(null!=R)return r.registerEventListeners(R,{mouseleave:function(){C(null)},mousemove:function(n){const o=r.getComposedEventTarget(n);if(!r.isHTMLElement(o))return void C(null);if(_(o))return;const i=h(e,t,n);C(i)}})},[R,e,t,_,C]),i.useEffect(()=>{const n=o.calculateZoomLevel(t.getRootElement(),!0);a.current&&function(t,e,n,o){if(!t)return void(e.style.display="none");const r=t.getBoundingClientRect(),i=t.ownerDocument.defaultView,s=i?i.getComputedStyle(t):null,l=e.getBoundingClientRect(),a=n.getBoundingClientRect();let c=s?parseInt(s.lineHeight,10):NaN;isNaN(c)&&(c=r.bottom-r.top);const u=(r.top+(c-(l.height||c))/2-a.top+n.scrollTop)/o;e.style.display="flex",e.style.opacity="1",e.style.transform=`translate(4px, ${u}px)`}(E,a.current,e,n)},[t,e,E,a]),i.useEffect(()=>{function i(i){if(!x.current)return!1;const[s]=n.eventFiles(i);if(s)return!1;const l=i.pageY,a=r.getComposedEventTarget(i);if(!r.isHTMLElement(a))return!1;const u=h(e,t,i,!0),g=c.current;return null!==u&&null!==g&&(function(t,e,n,o){const{top:r,height:i}=e.getBoundingClientRect(),{top:s,width:l}=o.getBoundingClientRect(),{marginTop:a,marginBottom:c}=f(e);let u=r;n>=r?u+=i+c/2:u-=a/2;const g=u-s-2+o.scrollTop;t.style.transform=`translate(24px, ${g}px)`,t.style.width=l-48+"px",t.style.opacity=".4"}(g,u,l/o.calculateZoomLevel(a),e),i.preventDefault(),!0)}return r.mergeRegister(t.registerCommand(r.DRAGOVER_COMMAND,t=>i(t),r.COMMAND_PRIORITY_LOW),t.registerCommand(r.DROP_COMMAND,i=>function(i){if(!x.current)return!1;const[s]=n.eventFiles(i);if(s)return!1;const{dataTransfer:l,pageY:a}=i,c=r.getComposedEventTarget(i),g=null!=l?l.getData(u):"",m=r.$getNodeByKey(g);if(!m)return!1;if(!r.isHTMLElement(c))return!1;const f=h(e,t,i,!0);if(!f)return!1;const p=r.$getNearestNodeFromDOMNode(f);if(!p)return!1;if(p===m)return r.IS_FIREFOX&&t.focus(),!0;const d=f.getBoundingClientRect().top;return a/o.calculateZoomLevel(c)>=d?p.insertAfter(m):p.insertBefore(m),C(null),r.IS_FIREFOX&&r.$onUpdate(()=>{t.focus()}),!0}(i),r.COMMAND_PRIORITY_HIGH))},[e,t,c,C]),i.useEffect(()=>{if(r.IS_FIREFOX&&g)return r.mergeRegister(t.registerRootListener(e=>{if(e)return r.registerEventListener(e,"blur",function(n){const o=n.relatedTarget;r.isHTMLElement(o)&&_(o)&&(e&&m(t,e),n.stopImmediatePropagation())},!0)}),t.registerCommand(r.BLUR_COMMAND,()=>{const e=t.getRootElement(),n=r.getActiveElementDeep(r.getRootOwnerDocument(e));return!!(e&&r.isHTMLElement(n)&&_(n))&&(m(t,e),!0)},r.COMMAND_PRIORITY_HIGH))},[t,g,_]),/*#__PURE__*/s.createPortal(/*#__PURE__*/l.jsxs(l.Fragment,{children:[/*#__PURE__*/l.jsx("div",{draggable:!0,onDragStart:function(e){const n=e.dataTransfer;if(!n||!E)return;!function(t,e){const{transform:n}=e.style;e.style.transform="translateZ(0)",t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=n})}(n,E);let o="";if(t.update(()=>{const t=r.$getNearestNodeFromDOMNode(E);t&&(o=t.getKey())}),x.current=!0,n.setData(u,o),r.IS_FIREFOX){const e=t.getRootElement();null!==e&&r.getActiveElement(e)!==e&&m(t,e)}},onDragEnd:function(){var e;x.current=!1,(e=c.current)&&(e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)");const n=t.getRootElement();null!==n&&r.getActiveElement(n)!==n&&m(t,n)},children:g&&p}),d]}),e)}exports.DraggableBlockPlugin_EXPERIMENTAL=function({anchorElem:n=document.body,menuRef:o,targetLineRef:r,menuComponent:i,targetLineComponent:s,isOnMenu:l,onElementChanged:a}){const[c]=t.useLexicalComposerContext();return p(c,n,o,r,e.useLexicalEditable(),i,s,l,a)};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as e}from"@lexical/react/useLexicalEditable";import{eventFiles as n}from"@lexical/rich-text";import{calculateZoomLevel as o}from"@lexical/utils";import{getParentElement as r,registerEventListeners as i,mergeRegister as s,DRAGOVER_COMMAND as l,COMMAND_PRIORITY_LOW as a,DROP_COMMAND as c,COMMAND_PRIORITY_HIGH as u,IS_FIREFOX as m,registerEventListener as h,BLUR_COMMAND as
|
|
9
|
+
import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as e}from"@lexical/react/useLexicalEditable";import{eventFiles as n}from"@lexical/rich-text";import{calculateZoomLevel as o}from"@lexical/utils";import{getParentElement as r,registerEventListeners as i,mergeRegister as s,DRAGOVER_COMMAND as l,COMMAND_PRIORITY_LOW as a,DROP_COMMAND as c,COMMAND_PRIORITY_HIGH as u,IS_FIREFOX as m,registerEventListener as h,BLUR_COMMAND as f,getActiveElementDeep as g,getRootOwnerDocument as p,isHTMLElement as d,getComposedEventTarget as y,$getNodeByKey as _,$getNearestNodeFromDOMNode as x,$onUpdate as b,$getSelection as T,getActiveElement as B,$getRoot as C}from"lexical";import{useRef as R,useState as D,useCallback as w,useEffect as E}from"react";import{createPortal as M}from"react-dom";import{jsxs as S,Fragment as v,jsx as L}from"react/jsx-runtime";class O{_x;_y;constructor(t,e){this._x=t,this._y=e}get x(){return this._x}get y(){return this._y}equals({x:t,y:e}){return this.x===t&&this.y===e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}}class I{_left;_top;_right;_bottom;constructor(t,e,n,o){const[r,i]=e<=o?[e,o]:[o,e],[s,l]=t<=n?[t,n]:[n,t];this._top=r,this._right=l,this._left=s,this._bottom=i}get top(){return this._top}get right(){return this._right}get bottom(){return this._bottom}get left(){return this._left}get width(){return Math.abs(this._left-this._right)}get height(){return Math.abs(this._bottom-this._top)}equals({top:t,left:e,bottom:n,right:o}){return t===this._top&&n===this._bottom&&e===this._left&&o===this._right}contains(t){if(t instanceof O){const{x:e,y:n}=t,o=n<this._top,r=n>this._bottom,i=e<this._left,s=e>this._right;return{reason:{isOnBottomSide:r,isOnLeftSide:i,isOnRightSide:s,isOnTopSide:o},result:!(o||r||i||s)}}{const{top:e,left:n,bottom:o,right:r}=t;return e>=this._top&&e<=this._bottom&&o>=this._top&&o<=this._bottom&&n>=this._left&&n<=this._right&&r>=this._left&&r<=this._right}}intersectsWith(t){const{left:e,top:n,width:o,height:r}=t,{left:i,top:s,width:l,height:a}=this;return(e+o>=i+l?e+o:i+l)-(e<=i?e:i)<=o+l&&(n+r>=s+a?n+r:s+a)-(n<=s?n:s)<=r+a}generateNewRect({left:t=this.left,top:e=this.top,right:n=this.right,bottom:o=this.bottom}){return new I(t,e,n,o)}static fromLTRB(t,e,n,o){return new I(t,e,n,o)}static fromLWTH(t,e,n,o){return new I(t,n,t+e,n+o)}static fromPoints(t,e){const{y:n,x:o}=t,{y:r,x:i}=e;return I.fromLTRB(o,n,i,r)}static fromDOM(t){const{top:e,width:n,left:o,height:r}=t.getBoundingClientRect();return I.fromLWTH(o,n,e,r)}}const N="application/x-lexical-drag-block";let K=Infinity;function Y(t,e){e.focus({preventScroll:!0}),t.update(()=>{const t=T();null===t||t.dirty||(t.dirty=!0)})}function H(t){const e=t.ownerDocument.defaultView,n=(t,n)=>t&&e?parseFloat(e.getComputedStyle(t)[n]):0,{marginTop:o="0",marginBottom:r="0"}=e?e.getComputedStyle(t):{},i=n(t.previousElementSibling,"marginBottom"),s=n(t.nextElementSibling,"marginTop"),l=Math.max(parseFloat(o),i);return{marginBottom:Math.max(parseFloat(r),s),marginTop:l}}function k(t,e,n,r=!1){const i=t.getBoundingClientRect(),s=function(t){return t.read("latest",()=>C().getChildrenKeys())}(e);let l=null;return e.read("latest",()=>{if(r){const[t,r]=[e.getElementByKey(s[0]),e.getElementByKey(s[s.length-1])],[i,a]=[null!=t?t.getBoundingClientRect():void 0,null!=r?r.getBoundingClientRect():void 0];if(i&&a){const e=o(t),s=o(r);if(n.y/e<i.top?l=t:n.y/s>a.bottom&&(l=r),l)return}}let t=0===(a=s.length)?Infinity:K>=0&&K<a?K:Math.floor(a/2);var a;let c=0;for(;t>=0&&t<s.length;){const r=s[t],a=e.getElementByKey(r);if(null===a)break;const u=o(a),m=new O(n.x/u,n.y/u),h=I.fromDOM(a),{marginTop:f,marginBottom:g}=H(a),p=h.generateNewRect({bottom:h.bottom+g,left:i.left,right:i.right,top:h.top-f}),{result:d,reason:{isOnTopSide:y,isOnBottomSide:_}}=p.contains(m);if(d){l=a,K=t;break}0===c&&(c=y?-1:_?1:Infinity),t+=c}}),l}function q(t,e,T,C,O,I,K,q,F){const V=r(e),W=R(!1),[X,P]=D(null),$=w(t=>{P(t),F&&F(t)},[F]);return E(()=>{if(null!=V)return i(V,{mouseleave:function(){$(null)},mousemove:function(n){const o=y(n);if(!d(o))return void $(null);if(q(o))return;const r=k(e,t,n);$(r)}})},[V,e,t,q,$]),E(()=>{const n=o(t.getRootElement(),!0);T.current&&function(t,e,n,o){if(!t)return void(e.style.display="none");const r=t.getBoundingClientRect(),i=t.ownerDocument.defaultView,s=i?i.getComputedStyle(t):null,l=e.getBoundingClientRect(),a=n.getBoundingClientRect();let c=s?parseInt(s.lineHeight,10):NaN;isNaN(c)&&(c=r.bottom-r.top);const u=(r.top+(c-(l.height||c))/2-a.top+n.scrollTop)/o;e.style.display="flex",e.style.opacity="1",e.style.transform=`translate(4px, ${u}px)`}(X,T.current,e,n)},[t,e,X,T]),E(()=>{function r(r){if(!W.current)return!1;const[i]=n(r);if(i)return!1;const s=r.pageY,l=y(r);if(!d(l))return!1;const a=k(e,t,r,!0),c=C.current;return null!==a&&null!==c&&(function(t,e,n,o){const{top:r,height:i}=e.getBoundingClientRect(),{top:s,width:l}=o.getBoundingClientRect(),{marginTop:a,marginBottom:c}=H(e);let u=r;n>=r?u+=i+c/2:u-=a/2;const m=u-s-2+o.scrollTop;t.style.transform=`translate(24px, ${m}px)`,t.style.width=l-48+"px",t.style.opacity=".4"}(c,a,s/o(l),e),r.preventDefault(),!0)}return s(t.registerCommand(l,t=>r(t),a),t.registerCommand(c,r=>function(r){if(!W.current)return!1;const[i]=n(r);if(i)return!1;const{dataTransfer:s,pageY:l}=r,a=y(r),c=null!=s?s.getData(N):"",u=_(c);if(!u)return!1;if(!d(a))return!1;const h=k(e,t,r,!0);if(!h)return!1;const f=x(h);if(!f)return!1;if(f===u)return m&&t.focus(),!0;const g=h.getBoundingClientRect().top;return l/o(a)>=g?f.insertAfter(u):f.insertBefore(u),$(null),m&&b(()=>{t.focus()}),!0}(r),u))},[e,t,C,$]),E(()=>{if(m&&O)return s(t.registerRootListener(e=>{if(e)return h(e,"blur",function(n){const o=n.relatedTarget;d(o)&&q(o)&&(e&&Y(t,e),n.stopImmediatePropagation())},!0)}),t.registerCommand(f,()=>{const e=t.getRootElement(),n=g(p(e));return!!(e&&d(n)&&q(n))&&(Y(t,e),!0)},u))},[t,O,q]),/*#__PURE__*/M(/*#__PURE__*/S(v,{children:[/*#__PURE__*/L("div",{draggable:!0,onDragStart:function(e){const n=e.dataTransfer;if(!n||!X)return;!function(t,e){const{transform:n}=e.style;e.style.transform="translateZ(0)",t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=n})}(n,X);let o="";if(t.update(()=>{const t=x(X);t&&(o=t.getKey())}),W.current=!0,n.setData(N,o),m){const e=t.getRootElement();null!==e&&B(e)!==e&&Y(t,e)}},onDragEnd:function(){var e;W.current=!1,(e=C.current)&&(e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)");const n=t.getRootElement();null!==n&&B(n)!==n&&Y(t,n)},children:O&&I}),K]}),e)}function F({anchorElem:n=document.body,menuRef:o,targetLineRef:r,menuComponent:i,targetLineComponent:s,isOnMenu:l,onElementChanged:a}){const[c]=t();return q(c,n,o,r,e(),i,s,l,a)}export{F as DraggableBlockPlugin_EXPERIMENTAL};
|
|
@@ -6,11 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import { type Transformer } from '@lexical/markdown';
|
|
9
|
-
/**
|
|
10
|
-
* The default set of Markdown {@link Transformer}s used by
|
|
11
|
-
* {@link MarkdownShortcutPlugin}: the core `@lexical/markdown` `TRANSFORMERS`
|
|
12
|
-
* plus a transformer that turns `---`, `***`, or `___` into a horizontal rule.
|
|
13
|
-
*/
|
|
14
9
|
export declare const DEFAULT_TRANSFORMERS: Transformer[];
|
|
15
10
|
/**
|
|
16
11
|
* Registers Markdown shortcuts so that typing Markdown syntax (for example
|
|
@@ -46,7 +46,19 @@ const HR = {
|
|
|
46
46
|
* {@link MarkdownShortcutPlugin}: the core `@lexical/markdown` `TRANSFORMERS`
|
|
47
47
|
* plus a transformer that turns `---`, `***`, or `___` into a horizontal rule.
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A function declared side-effect free (so the build annotates the call)
|
|
52
|
+
* rather than an array spread at module scope, which is a side effect to
|
|
53
|
+
* bundlers and would pin every transformer into every bundle that imports
|
|
54
|
+
* this module.
|
|
55
|
+
*
|
|
56
|
+
* @__NO_SIDE_EFFECTS__
|
|
57
|
+
*/
|
|
58
|
+
function defaultTransformers() {
|
|
59
|
+
return [HR, ...markdown.TRANSFORMERS];
|
|
60
|
+
}
|
|
61
|
+
const DEFAULT_TRANSFORMERS = /* @__PURE__ */defaultTransformers();
|
|
50
62
|
|
|
51
63
|
/**
|
|
52
64
|
* Registers Markdown shortcuts so that typing Markdown syntax (for example
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { HorizontalRuleNode, $createHorizontalRuleNode, $isHorizontalRuleNode } from '@lexical/extension';
|
|
10
|
-
import {
|
|
10
|
+
import { registerMarkdownShortcuts, TRANSFORMERS } from '@lexical/markdown';
|
|
11
11
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
12
12
|
import { useEffect } from 'react';
|
|
13
13
|
|
|
@@ -44,7 +44,19 @@ const HR = {
|
|
|
44
44
|
* {@link MarkdownShortcutPlugin}: the core `@lexical/markdown` `TRANSFORMERS`
|
|
45
45
|
* plus a transformer that turns `---`, `***`, or `___` into a horizontal rule.
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* A function declared side-effect free (so the build annotates the call)
|
|
50
|
+
* rather than an array spread at module scope, which is a side effect to
|
|
51
|
+
* bundlers and would pin every transformer into every bundle that imports
|
|
52
|
+
* this module.
|
|
53
|
+
*
|
|
54
|
+
* @__NO_SIDE_EFFECTS__
|
|
55
|
+
*/
|
|
56
|
+
function defaultTransformers() {
|
|
57
|
+
return [HR, ...TRANSFORMERS];
|
|
58
|
+
}
|
|
59
|
+
const DEFAULT_TRANSFORMERS = /* @__PURE__ */defaultTransformers();
|
|
48
60
|
|
|
49
61
|
/**
|
|
50
62
|
* Registers Markdown shortcuts so that typing Markdown syntax (for example
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
"use strict";var e=require("@lexical/extension"),r=require("@lexical/markdown"),t=require("@lexical/react/LexicalComposerContext"),
|
|
9
|
+
"use strict";var e=require("@lexical/extension"),r=require("@lexical/markdown"),t=require("@lexical/react/LexicalComposerContext"),n=require("react");const o={dependencies:[e.HorizontalRuleNode],export:r=>e.$isHorizontalRuleNode(r)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(r,t,n,o)=>{const l=e.$createHorizontalRuleNode();o||null!=r.getNextSibling()?r.replace(l):r.insertBefore(l),l.selectNext()},triggerOnEnter:!0,type:"element"};function l(){return[o,...r.TRANSFORMERS]}const i=/* @__PURE__ */l();exports.DEFAULT_TRANSFORMERS=i,exports.MarkdownShortcutPlugin=function({transformers:e=i}){const[o]=t.useLexicalComposerContext();return n.useEffect(()=>r.registerMarkdownShortcuts(o,e),[o,e]),null};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{HorizontalRuleNode as e,$createHorizontalRuleNode as r,$isHorizontalRuleNode as t}from"@lexical/extension";import{
|
|
9
|
+
import{HorizontalRuleNode as e,$createHorizontalRuleNode as r,$isHorizontalRuleNode as t}from"@lexical/extension";import{registerMarkdownShortcuts as n,TRANSFORMERS as o}from"@lexical/markdown";import{useLexicalComposerContext as l}from"@lexical/react/LexicalComposerContext";import{useEffect as c}from"react";const i={dependencies:[e],export:e=>t(e)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(e,t,n,o)=>{const l=r();o||null!=e.getNextSibling()?e.replace(l):e.insertBefore(l),l.selectNext()},triggerOnEnter:!0,type:"element"};function m(){return[i,...o]}const p=/* @__PURE__ */m();function s({transformers:e=p}){const[r]=l();return c(()=>n(r,e),[r,e]),null}export{p as DEFAULT_TRANSFORMERS,s as MarkdownShortcutPlugin};
|
|
@@ -37,6 +37,13 @@ function formatDevErrorMessage(message) {
|
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Returns a function that logs `message` with `console.warn` the first time it
|
|
42
|
+
* is called (and never in production). Creating one has no effect, so the
|
|
43
|
+
* build annotates module-scope calls and a bundler can drop an unused warning.
|
|
44
|
+
*
|
|
45
|
+
* @__NO_SIDE_EFFECTS__
|
|
46
|
+
*/
|
|
40
47
|
/*@__INLINE__*/
|
|
41
48
|
function warnOnlyOnce(message) {
|
|
42
49
|
{
|
|
@@ -50,8 +57,8 @@ function warnOnlyOnce(message) {
|
|
|
50
57
|
}
|
|
51
58
|
}
|
|
52
59
|
|
|
53
|
-
const initialNodesWarning = warnOnlyOnce(`LexicalNestedComposer initialNodes is deprecated and will be removed in v0.32.0, it has never worked correctly.\nYou can configure your editor's nodes with createEditor({nodes: [], parentEditor: $getEditor()})`);
|
|
54
|
-
const explicitNamespaceWarning = warnOnlyOnce(`LexicalNestedComposer initialEditor should explicitly initialize its namespace when the node configuration differs from the parentEditor. For backwards compatibility, the namespace will be initialized from parentEditor until v0.32.0, but this has always had incorrect copy/paste behavior when the configuration differed.\nYou can configure your editor's namespace with createEditor({namespace: 'nested-editor-namespace', nodes: [], parentEditor: $getEditor()}).`);
|
|
60
|
+
const initialNodesWarning = /* @__PURE__ */warnOnlyOnce(`LexicalNestedComposer initialNodes is deprecated and will be removed in v0.32.0, it has never worked correctly.\nYou can configure your editor's nodes with createEditor({nodes: [], parentEditor: $getEditor()})`);
|
|
61
|
+
const explicitNamespaceWarning = /* @__PURE__ */warnOnlyOnce(`LexicalNestedComposer initialEditor should explicitly initialize its namespace when the node configuration differs from the parentEditor. For backwards compatibility, the namespace will be initialized from parentEditor until v0.32.0, but this has always had incorrect copy/paste behavior when the configuration differed.\nYou can configure your editor's namespace with createEditor({namespace: 'nested-editor-namespace', nodes: [], parentEditor: $getEditor()}).`);
|
|
55
62
|
|
|
56
63
|
/**
|
|
57
64
|
* Provides a nested {@link LexicalEditor} (for example the editor that backs a
|
|
@@ -35,6 +35,13 @@ function formatDevErrorMessage(message) {
|
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Returns a function that logs `message` with `console.warn` the first time it
|
|
40
|
+
* is called (and never in production). Creating one has no effect, so the
|
|
41
|
+
* build annotates module-scope calls and a bundler can drop an unused warning.
|
|
42
|
+
*
|
|
43
|
+
* @__NO_SIDE_EFFECTS__
|
|
44
|
+
*/
|
|
38
45
|
/*@__INLINE__*/
|
|
39
46
|
function warnOnlyOnce(message) {
|
|
40
47
|
{
|
|
@@ -48,8 +55,8 @@ function warnOnlyOnce(message) {
|
|
|
48
55
|
}
|
|
49
56
|
}
|
|
50
57
|
|
|
51
|
-
const initialNodesWarning = warnOnlyOnce(`LexicalNestedComposer initialNodes is deprecated and will be removed in v0.32.0, it has never worked correctly.\nYou can configure your editor's nodes with createEditor({nodes: [], parentEditor: $getEditor()})`);
|
|
52
|
-
const explicitNamespaceWarning = warnOnlyOnce(`LexicalNestedComposer initialEditor should explicitly initialize its namespace when the node configuration differs from the parentEditor. For backwards compatibility, the namespace will be initialized from parentEditor until v0.32.0, but this has always had incorrect copy/paste behavior when the configuration differed.\nYou can configure your editor's namespace with createEditor({namespace: 'nested-editor-namespace', nodes: [], parentEditor: $getEditor()}).`);
|
|
58
|
+
const initialNodesWarning = /* @__PURE__ */warnOnlyOnce(`LexicalNestedComposer initialNodes is deprecated and will be removed in v0.32.0, it has never worked correctly.\nYou can configure your editor's nodes with createEditor({nodes: [], parentEditor: $getEditor()})`);
|
|
59
|
+
const explicitNamespaceWarning = /* @__PURE__ */warnOnlyOnce(`LexicalNestedComposer initialEditor should explicitly initialize its namespace when the node configuration differs from the parentEditor. For backwards compatibility, the namespace will be initialized from parentEditor until v0.32.0, but this has always had incorrect copy/paste behavior when the configuration differed.\nYou can configure your editor's namespace with createEditor({namespace: 'nested-editor-namespace', nodes: [], parentEditor: $getEditor()}).`);
|
|
53
60
|
|
|
54
61
|
/**
|
|
55
62
|
* Provides a nested {@link LexicalEditor} (for example the editor that backs a
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
"use strict";var e=require("@lexical/react/LexicalCollaborationContext"),t=require("@lexical/react/LexicalComposerContext"),r=require("lexical"),o=require("react"),s=require("react/jsx-runtime");
|
|
10
|
-
/*@__INLINE__*/
|
|
9
|
+
"use strict";var e=require("@lexical/react/LexicalCollaborationContext"),t=require("@lexical/react/LexicalComposerContext"),r=require("lexical"),o=require("react"),s=require("react/jsx-runtime");
|
|
10
|
+
/*@__INLINE__*/
|
|
11
|
+
function a(e){return()=>{}}const n=/* @__PURE__ */a(),i=/* @__PURE__ */a();exports.LexicalNestedComposer=function({initialEditor:a,children:l,initialNodes:c,initialTheme:d,skipCollabChecks:p,skipEditableListener:f}){const u=o.useRef(!1),m=o.useContext(t.LexicalComposerContext);null==m&&function(e,...t){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw r.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(9);const[x,{getTheme:h}]=m,g=o.useMemo(()=>{const e=d||h()||void 0,o=t.createLexicalComposerContext(m,e);void 0!==e&&(a._config.theme=e),a._parentEditor=a._parentEditor||x;const s=a._createEditorArgs,l=s&&s.namespace;if(c){n(),l||(i(),a._config.namespace=x._config.namespace);for(let e of c){let t=null,o=null;if("function"!=typeof e){const r=e;e=r.replace,t=r.with,o=r.withKlass||null}const s=r.getRegisteredNode(a,e.getType());a._nodes.set(e.getType(),{exportDOM:s?s.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:o,sharedNodeState:r.createSharedNodeState(e),transforms:r.getTransformSetFromKlass(e)})}}else if(s&&s.nodes)l||(i(),a._config.namespace=x._config.namespace);else{const e=a._nodes=new Map(x._nodes);l||(a._config.namespace=x._config.namespace);for(const[t,o]of e)a._nodes.set(t,{exportDOM:o.exportDOM,klass:o.klass,replace:o.replace,replaceWithKlass:o.replaceWithKlass,sharedNodeState:r.createSharedNodeState(o.klass),transforms:r.getTransformSetFromKlass(o.klass)})}return[a,o]},[]),C=o.useContext(e.CollaborationContext),{isCollabActive:_,yjsDocMap:v}=C??{},E=p||u.current||v&&v.has(a.getKey());return o.useEffect(()=>{E&&(u.current=!0)},[E]),o.useEffect(()=>{if(!f){const e=e=>a.setEditable(e);return e(x.isEditable()),x.registerEditableListener(e)}},[a,x,f]),/*#__PURE__*/s.jsx(t.LexicalComposerContext.Provider,{value:g,children:!_||E?l:null})};
|
|
@@ -6,5 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{CollaborationContext as e}from"@lexical/react/LexicalCollaborationContext";import{LexicalComposerContext as t,createLexicalComposerContext as
|
|
10
|
-
/*@__INLINE__*/
|
|
9
|
+
import{CollaborationContext as e}from"@lexical/react/LexicalCollaborationContext";import{LexicalComposerContext as t,createLexicalComposerContext as r}from"@lexical/react/LexicalComposerContext";import{getTransformSetFromKlass as o,createSharedNodeState as n,getRegisteredNode as i}from"lexical";import{useRef as s,useContext as a,useMemo as l,useEffect as c}from"react";import{jsx as p}from"react/jsx-runtime";
|
|
10
|
+
/*@__INLINE__*/
|
|
11
|
+
function f(e){return()=>{}}const d=/* @__PURE__ */f(),m=/* @__PURE__ */f();function h({initialEditor:f,children:h,initialNodes:u,initialTheme:g,skipCollabChecks:x,skipEditableListener:_}){const v=s(!1),E=a(t);null==E&&function(e,...t){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw r.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(9);const[k,{getTheme:b}]=E,w=l(()=>{const e=g||b()||void 0,t=r(E,e);void 0!==e&&(f._config.theme=e),f._parentEditor=f._parentEditor||k;const s=f._createEditorArgs,a=s&&s.namespace;if(u){d(),a||(m(),f._config.namespace=k._config.namespace);for(let e of u){let t=null,r=null;if("function"!=typeof e){const o=e;e=o.replace,t=o.with,r=o.withKlass||null}const s=i(f,e.getType());f._nodes.set(e.getType(),{exportDOM:s?s.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:r,sharedNodeState:n(e),transforms:o(e)})}}else if(s&&s.nodes)a||(m(),f._config.namespace=k._config.namespace);else{const e=f._nodes=new Map(k._nodes);a||(f._config.namespace=k._config.namespace);for(const[t,r]of e)f._nodes.set(t,{exportDOM:r.exportDOM,klass:r.klass,replace:r.replace,replaceWithKlass:r.replaceWithKlass,sharedNodeState:n(r.klass),transforms:o(r.klass)})}return[f,t]},[]),C=a(e),{isCollabActive:L,yjsDocMap:M}=C??{},y=x||v.current||M&&M.has(f.getKey());return c(()=>{y&&(v.current=!0)},[y]),c(()=>{if(!_){const e=e=>f.setEditable(e);return e(k.isEditable()),k.registerEditableListener(e)}},[f,k,_]),/*#__PURE__*/p(t.Provider,{value:w,children:!L||y?h:null})}export{h as LexicalNestedComposer};
|
|
@@ -81,7 +81,11 @@ class NodeContextMenuSeparator extends MenuOption {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
|
|
85
|
+
// The forwardRef calls are annotated by hand: React's forwardRef is not a
|
|
86
|
+
// Lexical factory, so the build does not annotate it, and an unannotated
|
|
87
|
+
// module-scope call pins the module into every bundle that imports it.
|
|
88
|
+
const ContextMenuSeparatorItem = /* @__PURE__ */react.forwardRef(({
|
|
85
89
|
className,
|
|
86
90
|
disabled,
|
|
87
91
|
...props
|
|
@@ -90,7 +94,7 @@ const ContextMenuSeparatorItem = /*#__PURE__*/react.forwardRef(({
|
|
|
90
94
|
className: className
|
|
91
95
|
});
|
|
92
96
|
});
|
|
93
|
-
const ContextMenuItem =
|
|
97
|
+
const ContextMenuItem = /* @__PURE__ */react.forwardRef(({
|
|
94
98
|
className,
|
|
95
99
|
label,
|
|
96
100
|
disabled,
|
|
@@ -116,7 +120,7 @@ const ContextMenuItem = /*#__PURE__*/react.forwardRef(({
|
|
|
116
120
|
*
|
|
117
121
|
* @returns A portal containing the floating context menu while it is open.
|
|
118
122
|
*/
|
|
119
|
-
const NodeContextMenuPlugin =
|
|
123
|
+
const NodeContextMenuPlugin = /* @__PURE__ */react.forwardRef(({
|
|
120
124
|
items,
|
|
121
125
|
className,
|
|
122
126
|
itemClassName,
|
|
@@ -79,7 +79,11 @@ class NodeContextMenuSeparator extends MenuOption {
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
|
|
83
|
+
// The forwardRef calls are annotated by hand: React's forwardRef is not a
|
|
84
|
+
// Lexical factory, so the build does not annotate it, and an unannotated
|
|
85
|
+
// module-scope call pins the module into every bundle that imports it.
|
|
86
|
+
const ContextMenuSeparatorItem = /* @__PURE__ */forwardRef(({
|
|
83
87
|
className,
|
|
84
88
|
disabled,
|
|
85
89
|
...props
|
|
@@ -88,7 +92,7 @@ const ContextMenuSeparatorItem = /*#__PURE__*/forwardRef(({
|
|
|
88
92
|
className: className
|
|
89
93
|
});
|
|
90
94
|
});
|
|
91
|
-
const ContextMenuItem =
|
|
95
|
+
const ContextMenuItem = /* @__PURE__ */forwardRef(({
|
|
92
96
|
className,
|
|
93
97
|
label,
|
|
94
98
|
disabled,
|
|
@@ -114,7 +118,7 @@ const ContextMenuItem = /*#__PURE__*/forwardRef(({
|
|
|
114
118
|
*
|
|
115
119
|
* @returns A portal containing the floating context menu while it is open.
|
|
116
120
|
*/
|
|
117
|
-
const NodeContextMenuPlugin =
|
|
121
|
+
const NodeContextMenuPlugin = /* @__PURE__ */forwardRef(({
|
|
118
122
|
items,
|
|
119
123
|
className,
|
|
120
124
|
itemClassName,
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
"use strict";var e=require("@floating-ui/react"),t=require("@lexical/react/LexicalComposerContext"),s=require("lexical"),n=require("react"),i=require("react/jsx-runtime");class a{key;ref;constructor(e){this.key=e,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(e){this.ref={current:e}}}const r
|
|
9
|
+
"use strict";var e=require("@floating-ui/react"),t=require("@lexical/react/LexicalComposerContext"),s=require("lexical"),n=require("react"),i=require("react/jsx-runtime");class a{key;ref;constructor(e){this.key=e,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(e){this.ref={current:e}}}const r=/* @__PURE__ */n.forwardRef(({className:e,disabled:t,...s},n)=>/*#__PURE__*/i.jsx("hr",{className:e})),o=/* @__PURE__ */n.forwardRef(({className:e,label:t,disabled:s,icon:n,...a},r)=>/*#__PURE__*/i.jsxs("button",{...a,className:e,ref:r,role:"menuitem",disabled:s,children:[n,t]})),l=/* @__PURE__ */n.forwardRef(({items:a,className:l,itemClassName:c,separatorClassName:u},d)=>{const[p]=t.useLexicalComposerContext(),[f,h]=n.useState(null),[m,x]=n.useState(!1),g=n.useRef([]),y=n.useRef([]),{refs:N,floatingStyles:b,context:k}=e.useFloating({middleware:[e.offset({alignmentAxis:4,mainAxis:5}),e.flip({fallbackPlacements:["left-start"]}),e.shift({padding:10})],onOpenChange:x,open:m,placement:"right-start",strategy:"fixed",whileElementsMounted:e.autoUpdate}),w=e.useRole(k,{role:"menu"}),$=e.useDismiss(k),C=e.useListNavigation(k,{activeIndex:f,listRef:g,onNavigate:h}),R=e.useTypeahead(k,{activeIndex:f,enabled:m,listRef:y,onMatch:h}),{getFloatingProps:O,getItemProps:v}=e.useInteractions([w,$,C,R]),[S,F]=n.useState([]);return n.useEffect(()=>{function e(e){let t=[];if(a&&p.read(()=>{const n=s.$getNearestNodeFromDOMNode(e.target)??s.$getRoot();n&&(t=a.filter(e=>!e.$showOn||e.$showOn(n)))}),!t.some(e=>"separator"!==e.type))return;e.preventDefault(),N.setPositionReference({getBoundingClientRect:()=>({bottom:e.clientY,height:0,left:e.clientX,right:e.clientX,top:e.clientY,width:0,x:e.clientX,y:e.clientY})});const n=t.map((e,t)=>"separator"===e.type?{className:u,key:e.key+"-"+t,type:e.type}:{className:c,disabled:e.disabled,icon:e.icon,key:e.key,label:e.title,onClick:()=>p.update(()=>e.$onSelect()),title:e.title,type:e.type});y.current=n.map(e=>e.key),F(n),x(!0)}return p.registerRootListener(t=>{if(null!==t)return s.registerEventListener(t,"contextmenu",e)})},[a,c,u,N,p]),/*#__PURE__*/i.jsx(e.FloatingPortal,{children:m&&/*#__PURE__*/i.jsx(e.FloatingOverlay,{lockScroll:!0,children:/*#__PURE__*/i.jsx(e.FloatingFocusManager,{context:k,initialFocus:N.floating,children:/*#__PURE__*/i.jsx("div",{className:l,ref:N.setFloating,style:b,...O(),children:S.map((e,t)=>"item"===e.type?/*#__PURE__*/n.createElement(o,{...v({...e,onClick(){e.onClick(),x(!1)},onMouseUp(){e.onClick(),x(!1)},ref(e){g.current[t]=e},tabIndex:f===t?0:-1}),key:e.key}):"separator"===e.type?/*#__PURE__*/n.createElement(r,{...v({...e,ref(e){g.current[t]=e},tabIndex:f===t?0:-1}),key:e.key}):void 0)})})})})});exports.NodeContextMenuOption=class extends a{type;title;icon;disabled;$onSelect;$showOn;constructor(e,t){super(e),this.type="item",this.title=e,this.disabled=t.disabled??!1,this.icon=t.icon??null,this.$onSelect=t.$onSelect,t.$showOn&&(this.$showOn=t.$showOn)}},exports.NodeContextMenuPlugin=l,exports.NodeContextMenuSeparator=class extends a{type;$showOn;constructor(e){super("_separator"),this.type="separator",e&&e.$showOn&&(this.$showOn=e.$showOn)}};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{useFloating as e,autoUpdate as t,offset as n,flip as s,shift as i,useRole as l,useDismiss as o,useListNavigation as r,useTypeahead as a,useInteractions as c,FloatingPortal as m,FloatingOverlay as d,FloatingFocusManager as p}from"@floating-ui/react";import{useLexicalComposerContext as h}from"@lexical/react/LexicalComposerContext";import{registerEventListener as f,$getNearestNodeFromDOMNode as u,$getRoot as y}from"lexical";import{forwardRef as g,useState as x,useRef as b,useEffect as k,createElement as $}from"react";import{jsx as w,jsxs as N}from"react/jsx-runtime";class O{key;ref;constructor(e){this.key=e,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(e){this.ref={current:e}}}class C extends O{type;title;icon;disabled;$onSelect;$showOn;constructor(e,t){super(e),this.type="item",this.title=e,this.disabled=t.disabled??!1,this.icon=t.icon??null,this.$onSelect=t.$onSelect,t.$showOn&&(this.$showOn=t.$showOn)}}class R extends O{type;$showOn;constructor(e){super("_separator"),this.type="separator",e&&e.$showOn&&(this.$showOn=e.$showOn)}}const v
|
|
9
|
+
import{useFloating as e,autoUpdate as t,offset as n,flip as s,shift as i,useRole as l,useDismiss as o,useListNavigation as r,useTypeahead as a,useInteractions as c,FloatingPortal as m,FloatingOverlay as d,FloatingFocusManager as p}from"@floating-ui/react";import{useLexicalComposerContext as h}from"@lexical/react/LexicalComposerContext";import{registerEventListener as f,$getNearestNodeFromDOMNode as u,$getRoot as y}from"lexical";import{forwardRef as g,useState as x,useRef as b,useEffect as k,createElement as $}from"react";import{jsx as w,jsxs as N}from"react/jsx-runtime";class O{key;ref;constructor(e){this.key=e,this.ref={current:null},this.setRefElement=this.setRefElement.bind(this)}setRefElement(e){this.ref={current:e}}}class C extends O{type;title;icon;disabled;$onSelect;$showOn;constructor(e,t){super(e),this.type="item",this.title=e,this.disabled=t.disabled??!1,this.icon=t.icon??null,this.$onSelect=t.$onSelect,t.$showOn&&(this.$showOn=t.$showOn)}}class R extends O{type;$showOn;constructor(e){super("_separator"),this.type="separator",e&&e.$showOn&&(this.$showOn=e.$showOn)}}const v=/* @__PURE__ */g(({className:e,disabled:t,...n},s)=>/*#__PURE__*/w("hr",{className:e})),S=/* @__PURE__ */g(({className:e,label:t,disabled:n,icon:s,...i},l)=>/*#__PURE__*/N("button",{...i,className:e,ref:l,role:"menuitem",disabled:n,children:[s,t]})),I=/* @__PURE__ */g(({items:g,className:N,itemClassName:O,separatorClassName:C},R)=>{const[I]=h(),[E,P]=x(null),[F,M]=x(!1),X=b([]),Y=b([]),{refs:A,floatingStyles:L,context:j}=e({middleware:[n({alignmentAxis:4,mainAxis:5}),s({fallbackPlacements:["left-start"]}),i({padding:10})],onOpenChange:M,open:F,placement:"right-start",strategy:"fixed",whileElementsMounted:t}),B=l(j,{role:"menu"}),D=o(j),U=r(j,{activeIndex:E,listRef:X,onNavigate:P}),_=a(j,{activeIndex:E,enabled:F,listRef:Y,onMatch:P}),{getFloatingProps:q,getItemProps:z}=c([B,D,U,_]),[G,H]=x([]);return k(()=>{function e(e){let t=[];if(g&&I.read(()=>{const n=u(e.target)??y();n&&(t=g.filter(e=>!e.$showOn||e.$showOn(n)))}),!t.some(e=>"separator"!==e.type))return;e.preventDefault(),A.setPositionReference({getBoundingClientRect:()=>({bottom:e.clientY,height:0,left:e.clientX,right:e.clientX,top:e.clientY,width:0,x:e.clientX,y:e.clientY})});const n=t.map((e,t)=>"separator"===e.type?{className:C,key:e.key+"-"+t,type:e.type}:{className:O,disabled:e.disabled,icon:e.icon,key:e.key,label:e.title,onClick:()=>I.update(()=>e.$onSelect()),title:e.title,type:e.type});Y.current=n.map(e=>e.key),H(n),M(!0)}return I.registerRootListener(t=>{if(null!==t)return f(t,"contextmenu",e)})},[g,O,C,A,I]),/*#__PURE__*/w(m,{children:F&&/*#__PURE__*/w(d,{lockScroll:!0,children:/*#__PURE__*/w(p,{context:j,initialFocus:A.floating,children:/*#__PURE__*/w("div",{className:N,ref:A.setFloating,style:L,...q(),children:G.map((e,t)=>"item"===e.type?/*#__PURE__*/$(S,{...z({...e,onClick(){e.onClick(),M(!1)},onMouseUp(){e.onClick(),M(!1)},ref(e){X.current[t]=e},tabIndex:E===t?0:-1}),key:e.key}):"separator"===e.type?/*#__PURE__*/$(v,{...z({...e,ref(e){X.current[t]=e},tabIndex:E===t?0:-1}),key:e.key}):void 0)})})})})});export{C as NodeContextMenuOption,I as NodeContextMenuPlugin,R as NodeContextMenuSeparator};
|
|
@@ -188,9 +188,11 @@ const ReactExtension = {
|
|
|
188
188
|
},
|
|
189
189
|
name: '@lexical/react/React',
|
|
190
190
|
peerDependencies: [
|
|
191
|
-
// We are not trying to avoid the import, just the direct dependency
|
|
192
|
-
//
|
|
193
|
-
|
|
191
|
+
// We are not trying to avoid the import, just the direct dependency. The
|
|
192
|
+
// name is a literal rather than `ReactProviderExtension.name` because a
|
|
193
|
+
// module-scope property read is a side effect to bundlers, which would pin
|
|
194
|
+
// this extension into every bundle that imports the module.
|
|
195
|
+
(['@lexical/react/ReactProvider'])]
|
|
194
196
|
};
|
|
195
197
|
|
|
196
198
|
exports.DefaultEditorChildrenComponent = DefaultEditorChildrenComponent;
|
|
@@ -186,9 +186,11 @@ const ReactExtension = {
|
|
|
186
186
|
},
|
|
187
187
|
name: '@lexical/react/React',
|
|
188
188
|
peerDependencies: [
|
|
189
|
-
// We are not trying to avoid the import, just the direct dependency
|
|
190
|
-
//
|
|
191
|
-
|
|
189
|
+
// We are not trying to avoid the import, just the direct dependency. The
|
|
190
|
+
// name is a literal rather than `ReactProviderExtension.name` because a
|
|
191
|
+
// module-scope property read is a side effect to bundlers, which would pin
|
|
192
|
+
// this extension into every bundle that imports the module.
|
|
193
|
+
(['@lexical/react/ReactProvider'])]
|
|
192
194
|
};
|
|
193
195
|
|
|
194
196
|
export { DefaultEditorChildrenComponent, ReactExtension };
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
|
|
9
9
|
"use strict";var e=require("@lexical/react/LexicalContentEditable"),r=require("@lexical/react/LexicalErrorBoundary"),n=require("@lexical/react/ReactProviderExtension"),t=require("lexical"),o=require("@lexical/react/LexicalComposerContext"),i=require("react"),c=require("react-dom"),a=require("react/jsx-runtime");function s(e,r){const[n,t]=i.useMemo(()=>[r=>e.registerDecoratorListener(r),()=>e.getDecorators()],[e]),o=i.useSyncExternalStore(n,t,t),s=function(e){const[r,n]=i.useMemo(()=>[e.registerRootListener.bind(e),e.getRootElement.bind(e)],[e]);return i.useSyncExternalStore(r,n,n)}(e);return i.useMemo(()=>{const n=r=>e._onError(r),t=[];for(const s in o){const l=e.getElementByKey(s);if(null!==l){const e=/*#__PURE__*/a.jsx(r,{onError:n,children:/*#__PURE__*/a.jsx(i.Suspense,{fallback:null,children:o[s]})});t.push(/*#__PURE__*/c.createPortal(e,l,s))}}return t},[r,o,e,s])}function l({contentEditable:e,children:r}){
|
|
10
10
|
return a.jsxs(a.Fragment,{children:[e,r]})}const d={EditorChildrenComponent:l,ErrorBoundary:r.LexicalErrorBoundary,contentEditable:/*#__PURE__*/a.jsx(e.ContentEditable,{}),decorators:[]},u={build(e,r,t){t.getPeer(n.ReactProviderExtension.name)||function(e,...r){const n=new URL("https://lexical.dev/docs/error"),t=new URLSearchParams;t.append("code",e);for(const e of r)t.append("v",e);throw n.search=t.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(321,[...t.getDirectDependentNames()].join(" "));const c=[e,{getTheme:()=>e._config.theme}],l=function(e,r){const[n]=r,t=e.decorators.map(e=>"function"==typeof e?/*#__PURE__*/a.jsx(e,{context:r}):e);return function(c){const{EditorChildrenComponent:l=e.EditorChildrenComponent,ErrorBoundary:d=e.ErrorBoundary,contentEditable:u=e.contentEditable,children:x}=c,m=s(n,d),E=i.useMemo(()=>t.map((e,r)=>/*#__PURE__*/a.jsx(d,{onError:e=>{n._onError(e)},children:/*#__PURE__*/a.jsx(i.Suspense,{fallback:null,children:e})},r)),[d]);
|
|
11
|
-
return a.jsx(o.LexicalComposerContext.Provider,{value:r,children:/*#__PURE__*/a.jsxs(l,{context:r,contentEditable:u,children:[x,E,m]})})}}(r,c);return{Component:l,context:c}},config:d,mergeConfig(e,r){const n=t.shallowMergeConfig(e,r);return r.decorators&&(n.decorators=r.decorators.length>0?[...e.decorators,...r.decorators]:e.decorators),n},name:"@lexical/react/React",peerDependencies:[[
|
|
11
|
+
return a.jsx(o.LexicalComposerContext.Provider,{value:r,children:/*#__PURE__*/a.jsxs(l,{context:r,contentEditable:u,children:[x,E,m]})})}}(r,c);return{Component:l,context:c}},config:d,mergeConfig(e,r){const n=t.shallowMergeConfig(e,r);return r.decorators&&(n.decorators=r.decorators.length>0?[...e.decorators,...r.decorators]:e.decorators),n},name:"@lexical/react/React",peerDependencies:[["@lexical/react/ReactProvider"]]};exports.DefaultEditorChildrenComponent=l,exports.ReactExtension=u;
|
|
@@ -8,4 +8,4 @@
|
|
|
8
8
|
|
|
9
9
|
import{ContentEditable as r}from"@lexical/react/LexicalContentEditable";import{LexicalErrorBoundary as e}from"@lexical/react/LexicalErrorBoundary";import{ReactProviderExtension as o}from"@lexical/react/ReactProviderExtension";import{shallowMergeConfig as t}from"lexical";import{LexicalComposerContext as n}from"@lexical/react/LexicalComposerContext";import{useMemo as i,useSyncExternalStore as c,Suspense as a}from"react";import{createPortal as l}from"react-dom";import{jsx as d,jsxs as s,Fragment as m}from"react/jsx-runtime";function f(r,e){const[o,t]=i(()=>[e=>r.registerDecoratorListener(e),()=>r.getDecorators()],[r]),n=c(o,t,t),s=function(r){const[e,o]=i(()=>[r.registerRootListener.bind(r),r.getRootElement.bind(r)],[r]);return c(e,o,o)}(r);return i(()=>{const o=e=>r._onError(e),t=[];for(const i in n){const c=r.getElementByKey(i);if(null!==c){const r=/*#__PURE__*/d(e,{onError:o,children:/*#__PURE__*/d(a,{fallback:null,children:n[i]})});t.push(/*#__PURE__*/l(r,c,i))}}return t},[e,n,r,s])}function u({contentEditable:r,children:e}){
|
|
10
10
|
return s(m,{children:[r,e]})}const p={EditorChildrenComponent:u,ErrorBoundary:e,contentEditable:/*#__PURE__*/d(r,{}),decorators:[]},h={build(r,e,t){t.getPeer(o.name)||function(r,...e){const o=new URL("https://lexical.dev/docs/error"),t=new URLSearchParams;t.append("code",r);for(const r of e)t.append("v",r);throw o.search=t.toString(),Error(`Minified Lexical error #${r}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(321,[...t.getDirectDependentNames()].join(" "));const c=[r,{getTheme:()=>r._config.theme}],l=function(r,e){const[o]=e,t=r.decorators.map(r=>"function"==typeof r?/*#__PURE__*/d(r,{context:e}):r);return function(c){const{EditorChildrenComponent:l=r.EditorChildrenComponent,ErrorBoundary:m=r.ErrorBoundary,contentEditable:u=r.contentEditable,children:p}=c,h=f(o,m),E=i(()=>t.map((r,e)=>/*#__PURE__*/d(m,{onError:r=>{o._onError(r)},children:/*#__PURE__*/d(a,{fallback:null,children:r})},e)),[m]);
|
|
11
|
-
return d(n.Provider,{value:e,children:/*#__PURE__*/s(l,{context:e,contentEditable:u,children:[p,E,h]})})}}(e,c);return{Component:l,context:c}},config:p,mergeConfig(r,e){const o=t(r,e);return e.decorators&&(o.decorators=e.decorators.length>0?[...r.decorators,...e.decorators]:r.decorators),o},name:"@lexical/react/React",peerDependencies:[[
|
|
11
|
+
return d(n.Provider,{value:e,children:/*#__PURE__*/s(l,{context:e,contentEditable:u,children:[p,E,h]})})}}(e,c);return{Component:l,context:c}},config:p,mergeConfig(r,e){const o=t(r,e);return e.decorators&&(o.decorators=e.decorators.length>0?[...r.decorators,...e.decorators]:r.decorators),o},name:"@lexical/react/React",peerDependencies:[["@lexical/react/ReactProvider"]]};export{u as DefaultEditorChildrenComponent,h as ReactExtension};
|
package/package.json
CHANGED
|
@@ -8,28 +8,28 @@
|
|
|
8
8
|
"rich-text"
|
|
9
9
|
],
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"version": "0.50.1-nightly.
|
|
11
|
+
"version": "0.50.1-nightly.20260908.0",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@floating-ui/react": "^0.27.19",
|
|
14
|
-
"@lexical/a11y": "0.50.1-nightly.
|
|
15
|
-
"@lexical/devtools-core": "0.50.1-nightly.
|
|
16
|
-
"@lexical/dragon": "0.50.1-nightly.
|
|
17
|
-
"@lexical/extension": "0.50.1-nightly.
|
|
18
|
-
"@lexical/hashtag": "0.50.1-nightly.
|
|
19
|
-
"@lexical/history": "0.50.1-nightly.
|
|
20
|
-
"@lexical/internal": "0.50.1-nightly.
|
|
21
|
-
"@lexical/link": "0.50.1-nightly.
|
|
22
|
-
"@lexical/list": "0.50.1-nightly.
|
|
23
|
-
"@lexical/mark": "0.50.1-nightly.
|
|
24
|
-
"@lexical/markdown": "0.50.1-nightly.
|
|
25
|
-
"@lexical/overflow": "0.50.1-nightly.
|
|
26
|
-
"@lexical/plain-text": "0.50.1-nightly.
|
|
27
|
-
"@lexical/rich-text": "0.50.1-nightly.
|
|
28
|
-
"@lexical/table": "0.50.1-nightly.
|
|
29
|
-
"@lexical/text": "0.50.1-nightly.
|
|
30
|
-
"@lexical/utils": "0.50.1-nightly.
|
|
31
|
-
"@lexical/yjs": "0.50.1-nightly.
|
|
32
|
-
"lexical": "0.50.1-nightly.
|
|
14
|
+
"@lexical/a11y": "0.50.1-nightly.20260908.0",
|
|
15
|
+
"@lexical/devtools-core": "0.50.1-nightly.20260908.0",
|
|
16
|
+
"@lexical/dragon": "0.50.1-nightly.20260908.0",
|
|
17
|
+
"@lexical/extension": "0.50.1-nightly.20260908.0",
|
|
18
|
+
"@lexical/hashtag": "0.50.1-nightly.20260908.0",
|
|
19
|
+
"@lexical/history": "0.50.1-nightly.20260908.0",
|
|
20
|
+
"@lexical/internal": "0.50.1-nightly.20260908.0",
|
|
21
|
+
"@lexical/link": "0.50.1-nightly.20260908.0",
|
|
22
|
+
"@lexical/list": "0.50.1-nightly.20260908.0",
|
|
23
|
+
"@lexical/mark": "0.50.1-nightly.20260908.0",
|
|
24
|
+
"@lexical/markdown": "0.50.1-nightly.20260908.0",
|
|
25
|
+
"@lexical/overflow": "0.50.1-nightly.20260908.0",
|
|
26
|
+
"@lexical/plain-text": "0.50.1-nightly.20260908.0",
|
|
27
|
+
"@lexical/rich-text": "0.50.1-nightly.20260908.0",
|
|
28
|
+
"@lexical/table": "0.50.1-nightly.20260908.0",
|
|
29
|
+
"@lexical/text": "0.50.1-nightly.20260908.0",
|
|
30
|
+
"@lexical/utils": "0.50.1-nightly.20260908.0",
|
|
31
|
+
"@lexical/yjs": "0.50.1-nightly.20260908.0",
|
|
32
|
+
"lexical": "0.50.1-nightly.20260908.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": ">=18.x",
|
|
@@ -42,7 +42,17 @@ const entries = [
|
|
|
42
42
|
['Squid', 'rgb(150, 0, 150)'],
|
|
43
43
|
];
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
// Picked on first use rather than at module scope, where the `Math.random()`
|
|
46
|
+
// call is a side effect to bundlers that would pin this module (and the
|
|
47
|
+
// table above) into every bundle importing it. It is still picked once and
|
|
48
|
+
// shared by every context created afterwards, as before.
|
|
49
|
+
let randomEntry: undefined | (typeof entries)[number];
|
|
50
|
+
function getRandomEntry(): (typeof entries)[number] {
|
|
51
|
+
if (randomEntry === undefined) {
|
|
52
|
+
randomEntry = entries[Math.floor(Math.random() * entries.length)];
|
|
53
|
+
}
|
|
54
|
+
return randomEntry;
|
|
55
|
+
}
|
|
46
56
|
|
|
47
57
|
/**
|
|
48
58
|
* The React context that holds the shared {@link CollaborationContextType} for
|
|
@@ -50,14 +60,21 @@ const randomEntry = entries[Math.floor(Math.random() * entries.length)];
|
|
|
50
60
|
* it with {@link useCollaborationContext}.
|
|
51
61
|
*/
|
|
52
62
|
export const CollaborationContext =
|
|
53
|
-
createContext
|
|
63
|
+
// Annotated by hand: React's createContext is not a Lexical factory, so the
|
|
64
|
+
// build does not annotate it, and an unannotated module-scope call pins the
|
|
65
|
+
// module into every bundle.
|
|
66
|
+
/* @__PURE__ */ createContext<CollaborationContextType | null>(null);
|
|
54
67
|
|
|
55
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
* @__NO_SIDE_EFFECTS__
|
|
71
|
+
*/
|
|
56
72
|
export function newContext(): CollaborationContextType {
|
|
73
|
+
const [name, color] = getRandomEntry();
|
|
57
74
|
return {
|
|
58
|
-
color
|
|
75
|
+
color,
|
|
59
76
|
isCollabActive: false,
|
|
60
|
-
name
|
|
77
|
+
name,
|
|
61
78
|
yjsDocMap: new Map(),
|
|
62
79
|
};
|
|
63
80
|
}
|
|
@@ -39,9 +39,13 @@ export type LexicalComposerContextWithEditor = [
|
|
|
39
39
|
*/
|
|
40
40
|
export const LexicalComposerContext: React.Context<
|
|
41
41
|
LexicalComposerContextWithEditor | null | undefined
|
|
42
|
-
> =
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
> =
|
|
43
|
+
// Annotated by hand: React's createContext is not a Lexical factory, so the
|
|
44
|
+
// build does not annotate it, and an unannotated module-scope call pins the
|
|
45
|
+
// module into every bundle.
|
|
46
|
+
/* @__PURE__ */ createReactContext<
|
|
47
|
+
LexicalComposerContextWithEditor | null | undefined
|
|
48
|
+
>(null);
|
|
45
49
|
|
|
46
50
|
/**
|
|
47
51
|
* Creates a {@link LexicalComposerContextType} for a composer. Theme resolution
|
|
@@ -47,7 +47,10 @@ export type ContentEditableProps = Omit<ContentEditableElementProps, 'editor'> &
|
|
|
47
47
|
* {@link PlainTextPlugin}. An optional `placeholder` is shown while the editor
|
|
48
48
|
* is empty. The `ref` is forwarded to the underlying `<div>`.
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
// Annotated by hand: React's forwardRef is not a Lexical factory, so the build
|
|
51
|
+
// does not annotate it, and an unannotated module-scope call pins the module
|
|
52
|
+
// into every bundle that imports it.
|
|
53
|
+
export const ContentEditable = /* @__PURE__ */ forwardRef(ContentEditableImpl);
|
|
51
54
|
|
|
52
55
|
function ContentEditableImpl(
|
|
53
56
|
props: ContentEditableProps,
|
|
@@ -48,7 +48,20 @@ const HR: ElementTransformer = {
|
|
|
48
48
|
* {@link MarkdownShortcutPlugin}: the core `@lexical/markdown` `TRANSFORMERS`
|
|
49
49
|
* plus a transformer that turns `---`, `***`, or `___` into a horizontal rule.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A function declared side-effect free (so the build annotates the call)
|
|
54
|
+
* rather than an array spread at module scope, which is a side effect to
|
|
55
|
+
* bundlers and would pin every transformer into every bundle that imports
|
|
56
|
+
* this module.
|
|
57
|
+
*
|
|
58
|
+
* @__NO_SIDE_EFFECTS__
|
|
59
|
+
*/
|
|
60
|
+
function defaultTransformers(): Transformer[] {
|
|
61
|
+
return [HR, ...TRANSFORMERS];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const DEFAULT_TRANSFORMERS: Transformer[] = defaultTransformers();
|
|
52
65
|
|
|
53
66
|
/**
|
|
54
67
|
* Registers Markdown shortcuts so that typing Markdown syntax (for example
|
|
@@ -105,7 +105,10 @@ class NodeContextMenuSeparator extends MenuOption {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
// The forwardRef calls are annotated by hand: React's forwardRef is not a
|
|
109
|
+
// Lexical factory, so the build does not annotate it, and an unannotated
|
|
110
|
+
// module-scope call pins the module into every bundle that imports it.
|
|
111
|
+
const ContextMenuSeparatorItem = /* @__PURE__ */ forwardRef<
|
|
109
112
|
HTMLButtonElement,
|
|
110
113
|
React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
111
114
|
disabled?: boolean;
|
|
@@ -114,7 +117,7 @@ const ContextMenuSeparatorItem = forwardRef<
|
|
|
114
117
|
return <hr className={className} />;
|
|
115
118
|
});
|
|
116
119
|
|
|
117
|
-
const ContextMenuItem = forwardRef<
|
|
120
|
+
const ContextMenuItem = /* @__PURE__ */ forwardRef<
|
|
118
121
|
HTMLButtonElement,
|
|
119
122
|
React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
120
123
|
label?: string;
|
|
@@ -170,7 +173,7 @@ interface Props {
|
|
|
170
173
|
*
|
|
171
174
|
* @returns A portal containing the floating context menu while it is open.
|
|
172
175
|
*/
|
|
173
|
-
const NodeContextMenuPlugin = forwardRef<
|
|
176
|
+
const NodeContextMenuPlugin = /* @__PURE__ */ forwardRef<
|
|
174
177
|
HTMLButtonElement,
|
|
175
178
|
Props & React.HTMLProps<HTMLButtonElement>
|
|
176
179
|
>(({items, className, itemClassName, separatorClassName}, forwardedRef) => {
|
package/src/ReactExtension.tsx
CHANGED
|
@@ -104,10 +104,12 @@ export const ReactExtension = defineExtension({
|
|
|
104
104
|
},
|
|
105
105
|
name: '@lexical/react/React',
|
|
106
106
|
peerDependencies: [
|
|
107
|
-
// We are not trying to avoid the import, just the direct dependency
|
|
108
|
-
//
|
|
107
|
+
// We are not trying to avoid the import, just the direct dependency. The
|
|
108
|
+
// name is a literal rather than `ReactProviderExtension.name` because a
|
|
109
|
+
// module-scope property read is a side effect to bundlers, which would pin
|
|
110
|
+
// this extension into every bundle that imports the module.
|
|
109
111
|
declarePeerDependency<typeof ReactProviderExtension>(
|
|
110
|
-
|
|
112
|
+
'@lexical/react/ReactProvider',
|
|
111
113
|
),
|
|
112
114
|
],
|
|
113
115
|
});
|
|
@@ -146,4 +146,9 @@ function ContentEditableElementImpl(
|
|
|
146
146
|
* attributes. Prefer {@link ContentEditable}, which reads the editor from
|
|
147
147
|
* context and adds placeholder support, unless you need this extra control.
|
|
148
148
|
*/
|
|
149
|
-
|
|
149
|
+
// Annotated by hand: React's forwardRef is not a Lexical factory, so the build
|
|
150
|
+
// does not annotate it, and an unannotated module-scope call pins the module
|
|
151
|
+
// into every bundle that imports it.
|
|
152
|
+
export const ContentEditableElement = /* @__PURE__ */ forwardRef(
|
|
153
|
+
ContentEditableElementImpl,
|
|
154
|
+
);
|