@payloadcms/richtext-lexical 3.0.0-beta.39 → 3.0.0-beta.40
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/cell/index.d.ts +2 -1
- package/dist/cell/index.d.ts.map +1 -1
- package/dist/cell/index.js +19 -11
- package/dist/cell/index.js.map +1 -1
- package/dist/exports/components.d.ts +0 -1
- package/dist/exports/components.d.ts.map +1 -1
- package/dist/exports/components.js +0 -1
- package/dist/exports/components.js.map +1 -1
- package/dist/field/features/createFeaturePropComponent.d.ts.map +1 -1
- package/dist/field/features/createFeaturePropComponent.js +6 -1
- package/dist/field/features/createFeaturePropComponent.js.map +1 -1
- package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts +2 -1
- package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts.map +1 -1
- package/dist/field/features/toolbars/fixed/Toolbar/index.js +72 -18
- package/dist/field/features/toolbars/fixed/Toolbar/index.js.map +1 -1
- package/dist/field/features/toolbars/fixed/Toolbar/index.scss +8 -1
- package/dist/field/features/toolbars/fixed/feature.client.d.ts +2 -1
- package/dist/field/features/toolbars/fixed/feature.client.d.ts.map +1 -1
- package/dist/field/features/toolbars/fixed/feature.client.js.map +1 -1
- package/dist/field/features/toolbars/fixed/feature.server.d.ts +17 -1
- package/dist/field/features/toolbars/fixed/feature.server.d.ts.map +1 -1
- package/dist/field/features/toolbars/fixed/feature.server.js +6 -1
- package/dist/field/features/toolbars/fixed/feature.server.js.map +1 -1
- package/dist/field/features/toolbars/shared/ToolbarButton/index.js +5 -5
- package/dist/field/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js +5 -5
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/field/features/toolbars/types.d.ts +5 -5
- package/dist/field/features/toolbars/types.d.ts.map +1 -1
- package/dist/field/features/toolbars/types.js.map +1 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +10 -5
- package/dist/field/index.js.map +1 -1
- package/dist/field/lexical/LexicalEditor.d.ts +3 -1
- package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/field/lexical/LexicalEditor.js +27 -12
- package/dist/field/lexical/LexicalEditor.js.map +1 -1
- package/dist/field/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/field/lexical/LexicalProvider.js +42 -35
- package/dist/field/lexical/LexicalProvider.js.map +1 -1
- package/dist/field/lexical/config/client/EditorConfigProvider.d.ts +13 -1
- package/dist/field/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
- package/dist/field/lexical/config/client/EditorConfigProvider.js +56 -8
- package/dist/field/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/field/lexical/ui/ContentEditable.scss +2 -2
- package/dist/field/lexical/ui/icons/Link/index.d.ts.map +1 -1
- package/dist/field/lexical/ui/icons/Link/index.js +8 -25
- package/dist/field/lexical/ui/icons/Link/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/useLexicalFeature.d.ts.map +1 -1
- package/dist/useLexicalFeature.js +6 -1
- package/dist/useLexicalFeature.js.map +1 -1
- package/package.json +11 -9
- package/dist/field/lexical/EditorFocusProvider.d.ts +0 -19
- package/dist/field/lexical/EditorFocusProvider.d.ts.map +0 -1
- package/dist/field/lexical/EditorFocusProvider.js +0 -80
- package/dist/field/lexical/EditorFocusProvider.js.map +0 -1
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
3
|
-
import React, { createContext, useCallback, useContext, useState } from 'react';
|
|
4
|
-
import { useEditorConfigContext } from './config/client/EditorConfigProvider.js';
|
|
5
|
-
const EditorFocusContext = /*#__PURE__*/ createContext({
|
|
6
|
-
blurEditor: null,
|
|
7
|
-
editor: null,
|
|
8
|
-
focusEditor: null,
|
|
9
|
-
focusedEditor: null,
|
|
10
|
-
focusedEditorConfigContext: null,
|
|
11
|
-
isChildEditorFocused: null,
|
|
12
|
-
isEditorFocused: null,
|
|
13
|
-
isParentEditorFocused: null,
|
|
14
|
-
parentEditorConfigContext: null,
|
|
15
|
-
parentEditorFocus: null
|
|
16
|
-
});
|
|
17
|
-
export const useEditorFocus = ()=>{
|
|
18
|
-
return useContext(EditorFocusContext);
|
|
19
|
-
};
|
|
20
|
-
export const EditorFocusProvider = ({ children })=>{
|
|
21
|
-
const parentEditorFocus = useEditorFocus();
|
|
22
|
-
const parentEditorConfigContext = useEditorConfigContext() // Is parent, as this EditorFocusProvider sits outside the EditorConfigProvider
|
|
23
|
-
;
|
|
24
|
-
const [editor] = useLexicalComposerContext();
|
|
25
|
-
const [focusedEditor, setFocusedEditor] = useState(null);
|
|
26
|
-
const [focusedEditorConfigContext, setFocusedEditorConfigContext] = useState(null);
|
|
27
|
-
const focusEditor = useCallback((_editor, _editorConfigContext)=>{
|
|
28
|
-
setFocusedEditor(_editor !== undefined ? _editor : editor);
|
|
29
|
-
setFocusedEditorConfigContext(_editorConfigContext);
|
|
30
|
-
if (parentEditorFocus.focusEditor) {
|
|
31
|
-
parentEditorFocus.focusEditor(_editor !== undefined ? _editor : editor, _editorConfigContext);
|
|
32
|
-
}
|
|
33
|
-
}, [
|
|
34
|
-
editor,
|
|
35
|
-
parentEditorFocus
|
|
36
|
-
]);
|
|
37
|
-
const blurEditor = useCallback(()=>{
|
|
38
|
-
if (focusedEditor === editor) {
|
|
39
|
-
setFocusedEditor(null);
|
|
40
|
-
setFocusedEditorConfigContext(null);
|
|
41
|
-
}
|
|
42
|
-
}, [
|
|
43
|
-
editor,
|
|
44
|
-
focusedEditor
|
|
45
|
-
]);
|
|
46
|
-
const isEditorFocused = useCallback(()=>{
|
|
47
|
-
return focusedEditor === editor;
|
|
48
|
-
}, [
|
|
49
|
-
editor,
|
|
50
|
-
focusedEditor
|
|
51
|
-
]);
|
|
52
|
-
const isParentEditorFocused = useCallback(()=>{
|
|
53
|
-
return parentEditorFocus?.isEditorFocused ? parentEditorFocus.isEditorFocused() : false;
|
|
54
|
-
}, [
|
|
55
|
-
parentEditorFocus
|
|
56
|
-
]);
|
|
57
|
-
const isChildEditorFocused = useCallback(()=>{
|
|
58
|
-
return focusedEditor !== editor && !!focusedEditor;
|
|
59
|
-
}, [
|
|
60
|
-
editor,
|
|
61
|
-
focusedEditor
|
|
62
|
-
]);
|
|
63
|
-
return /*#__PURE__*/ _jsx(EditorFocusContext.Provider, {
|
|
64
|
-
value: {
|
|
65
|
-
blurEditor,
|
|
66
|
-
editor,
|
|
67
|
-
focusEditor,
|
|
68
|
-
focusedEditor,
|
|
69
|
-
focusedEditorConfigContext,
|
|
70
|
-
isChildEditorFocused,
|
|
71
|
-
isEditorFocused,
|
|
72
|
-
isParentEditorFocused,
|
|
73
|
-
parentEditorConfigContext,
|
|
74
|
-
parentEditorFocus
|
|
75
|
-
},
|
|
76
|
-
children: children
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
//# sourceMappingURL=EditorFocusProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/field/lexical/EditorFocusProvider.tsx"],"sourcesContent":["import type { LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport React, { createContext, useCallback, useContext, useState } from 'react'\n\nimport type { EditorConfigContextType } from './config/client/EditorConfigProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\n\nexport type EditorFocusContextType = {\n blurEditor: () => void\n editor: LexicalEditor\n focusEditor: (_editor?: LexicalEditor, _editorConfigContext?: EditorConfigContextType) => void\n focusedEditor: LexicalEditor | null\n focusedEditorConfigContext: EditorConfigContextType\n isChildEditorFocused: () => boolean\n isEditorFocused: () => boolean\n isParentEditorFocused: () => boolean\n parentEditorConfigContext: EditorConfigContextType\n parentEditorFocus: EditorFocusContextType\n}\n\nconst EditorFocusContext = createContext<EditorFocusContextType>({\n blurEditor: null,\n editor: null,\n focusEditor: null,\n focusedEditor: null,\n focusedEditorConfigContext: null,\n isChildEditorFocused: null,\n isEditorFocused: null,\n isParentEditorFocused: null,\n parentEditorConfigContext: null,\n parentEditorFocus: null,\n})\n\nexport const useEditorFocus = (): EditorFocusContextType => {\n return useContext(EditorFocusContext)\n}\n\nexport const EditorFocusProvider = ({ children }) => {\n const parentEditorFocus = useEditorFocus()\n const parentEditorConfigContext = useEditorConfigContext() // Is parent, as this EditorFocusProvider sits outside the EditorConfigProvider\n const [editor] = useLexicalComposerContext()\n\n const [focusedEditor, setFocusedEditor] = useState<LexicalEditor | null>(null)\n const [focusedEditorConfigContext, setFocusedEditorConfigContext] =\n useState<EditorConfigContextType | null>(null)\n\n const focusEditor = useCallback(\n (_editor: LexicalEditor, _editorConfigContext: EditorConfigContextType) => {\n setFocusedEditor(_editor !== undefined ? _editor : editor)\n setFocusedEditorConfigContext(_editorConfigContext)\n if (parentEditorFocus.focusEditor) {\n parentEditorFocus.focusEditor(\n _editor !== undefined ? _editor : editor,\n _editorConfigContext,\n )\n }\n },\n [editor, parentEditorFocus],\n )\n\n const blurEditor = useCallback(() => {\n if (focusedEditor === editor) {\n setFocusedEditor(null)\n setFocusedEditorConfigContext(null)\n }\n }, [editor, focusedEditor])\n\n const isEditorFocused = useCallback(() => {\n return focusedEditor === editor\n }, [editor, focusedEditor])\n\n const isParentEditorFocused = useCallback(() => {\n return parentEditorFocus?.isEditorFocused ? parentEditorFocus.isEditorFocused() : false\n }, [parentEditorFocus])\n\n const isChildEditorFocused = useCallback(() => {\n return focusedEditor !== editor && !!focusedEditor\n }, [editor, focusedEditor])\n\n return (\n <EditorFocusContext.Provider\n value={{\n blurEditor,\n editor,\n focusEditor,\n focusedEditor,\n focusedEditorConfigContext,\n isChildEditorFocused,\n isEditorFocused,\n isParentEditorFocused,\n parentEditorConfigContext,\n parentEditorFocus,\n }}\n >\n {children}\n </EditorFocusContext.Provider>\n )\n}\n"],"names":["useLexicalComposerContext","React","createContext","useCallback","useContext","useState","useEditorConfigContext","EditorFocusContext","blurEditor","editor","focusEditor","focusedEditor","focusedEditorConfigContext","isChildEditorFocused","isEditorFocused","isParentEditorFocused","parentEditorConfigContext","parentEditorFocus","useEditorFocus","EditorFocusProvider","children","setFocusedEditor","setFocusedEditorConfigContext","_editor","_editorConfigContext","undefined","Provider","value"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAEA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,OAAOC,SAASC,aAAa,EAAEC,WAAW,EAAEC,UAAU,EAAEC,QAAQ,QAAQ,QAAO;AAI/E,SAASC,sBAAsB,QAAQ,0CAAyC;AAehF,MAAMC,mCAAqBL,cAAsC;IAC/DM,YAAY;IACZC,QAAQ;IACRC,aAAa;IACbC,eAAe;IACfC,4BAA4B;IAC5BC,sBAAsB;IACtBC,iBAAiB;IACjBC,uBAAuB;IACvBC,2BAA2B;IAC3BC,mBAAmB;AACrB;AAEA,OAAO,MAAMC,iBAAiB;IAC5B,OAAOd,WAAWG;AACpB,EAAC;AAED,OAAO,MAAMY,sBAAsB,CAAC,EAAEC,QAAQ,EAAE;IAC9C,MAAMH,oBAAoBC;IAC1B,MAAMF,4BAA4BV,yBAAyB,+EAA+E;;IAC1I,MAAM,CAACG,OAAO,GAAGT;IAEjB,MAAM,CAACW,eAAeU,iBAAiB,GAAGhB,SAA+B;IACzE,MAAM,CAACO,4BAA4BU,8BAA8B,GAC/DjB,SAAyC;IAE3C,MAAMK,cAAcP,YAClB,CAACoB,SAAwBC;QACvBH,iBAAiBE,YAAYE,YAAYF,UAAUd;QACnDa,8BAA8BE;QAC9B,IAAIP,kBAAkBP,WAAW,EAAE;YACjCO,kBAAkBP,WAAW,CAC3Ba,YAAYE,YAAYF,UAAUd,QAClCe;QAEJ;IACF,GACA;QAACf;QAAQQ;KAAkB;IAG7B,MAAMT,aAAaL,YAAY;QAC7B,IAAIQ,kBAAkBF,QAAQ;YAC5BY,iBAAiB;YACjBC,8BAA8B;QAChC;IACF,GAAG;QAACb;QAAQE;KAAc;IAE1B,MAAMG,kBAAkBX,YAAY;QAClC,OAAOQ,kBAAkBF;IAC3B,GAAG;QAACA;QAAQE;KAAc;IAE1B,MAAMI,wBAAwBZ,YAAY;QACxC,OAAOc,mBAAmBH,kBAAkBG,kBAAkBH,eAAe,KAAK;IACpF,GAAG;QAACG;KAAkB;IAEtB,MAAMJ,uBAAuBV,YAAY;QACvC,OAAOQ,kBAAkBF,UAAU,CAAC,CAACE;IACvC,GAAG;QAACF;QAAQE;KAAc;IAE1B,qBACE,KAACJ,mBAAmBmB,QAAQ;QAC1BC,OAAO;YACLnB;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;YACAC;QACF;kBAECG;;AAGP,EAAC"}
|