@lexical/react 0.3.3 → 0.3.6
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/DEPRECATED_useLexical.d.ts +18 -0
- package/DEPRECATED_useLexical.dev.js +18 -9
- package/DEPRECATED_useLexical.js.flow +4 -1
- package/DEPRECATED_useLexical.prod.js +2 -3
- package/DEPRECATED_useLexicalAutoFormatter.d.ts +9 -0
- package/DEPRECATED_useLexicalAutoFormatter.js.flow +4 -1
- package/DEPRECATED_useLexicalCanShowPlaceholder.d.ts +9 -0
- package/DEPRECATED_useLexicalCanShowPlaceholder.dev.js +18 -9
- package/DEPRECATED_useLexicalCanShowPlaceholder.js.flow +4 -1
- package/DEPRECATED_useLexicalCanShowPlaceholder.prod.js +2 -2
- package/DEPRECATED_useLexicalCharacterLimit.d.ts +8 -0
- package/DEPRECATED_useLexicalCharacterLimit.js.flow +4 -1
- package/DEPRECATED_useLexicalDecorators.d.ts +9 -0
- package/DEPRECATED_useLexicalDecorators.js.flow +4 -1
- package/DEPRECATED_useLexicalEditor.d.ts +9 -0
- package/DEPRECATED_useLexicalEditor.dev.js +18 -9
- package/DEPRECATED_useLexicalEditor.prod.js +2 -2
- package/DEPRECATED_useLexicalEditorEvents.d.ts +10 -0
- package/DEPRECATED_useLexicalEditorEvents.js.flow +4 -1
- package/DEPRECATED_useLexicalHistory.d.ts +12 -0
- package/DEPRECATED_useLexicalHistory.js.flow +4 -1
- package/DEPRECATED_useLexicalList.d.ts +9 -0
- package/DEPRECATED_useLexicalList.js.flow +4 -1
- package/DEPRECATED_useLexicalPlainText.d.ts +10 -0
- package/DEPRECATED_useLexicalPlainText.js.flow +4 -1
- package/DEPRECATED_useLexicalRichText.d.ts +10 -0
- package/DEPRECATED_useLexicalRichText.js.flow +4 -1
- package/LexicalAutoFocusPlugin.d.ts +1 -2
- package/LexicalAutoFocusPlugin.dev.js +1 -1
- package/LexicalAutoFocusPlugin.prod.js +1 -1
- package/LexicalAutoLinkPlugin.d.ts +11 -11
- package/LexicalAutoScrollPlugin.d.ts +6 -4
- package/LexicalBlockWithAlignableContents.d.ts +12 -8
- package/LexicalBlockWithAlignableContents.dev.js +6 -6
- package/LexicalBlockWithAlignableContents.js.flow +4 -0
- package/LexicalBlockWithAlignableContents.prod.js +4 -4
- package/LexicalCharacterLimitPlugin.d.ts +3 -4
- package/LexicalCheckListPlugin.d.ts +1 -2
- package/LexicalCheckListPlugin.dev.js +11 -6
- package/LexicalCheckListPlugin.prod.js +7 -7
- package/LexicalClearEditorPlugin.d.ts +4 -4
- package/LexicalCollaborationPlugin.d.ts +17 -31
- package/LexicalComposer.d.ts +16 -15
- package/LexicalComposer.dev.js +39 -1
- package/LexicalComposer.js.flow +5 -0
- package/LexicalComposer.prod.js +3 -2
- package/LexicalComposerContext.d.ts +10 -15
- package/LexicalContentEditable.d.ts +24 -23
- package/LexicalContentEditable.dev.js +3 -3
- package/LexicalContentEditable.prod.js +1 -1
- package/LexicalDecoratorBlockNode.d.ts +13 -24
- package/LexicalDecoratorBlockNode.dev.js +1 -1
- package/LexicalDecoratorBlockNode.prod.js +1 -1
- package/LexicalHashtagPlugin.d.ts +1 -2
- package/LexicalHistoryPlugin.d.ts +6 -23
- package/LexicalHorizontalRuleNode.d.ts +19 -17
- package/LexicalLinkPlugin.d.ts +1 -2
- package/LexicalLinkPlugin.dev.js +1 -0
- package/LexicalListPlugin.d.ts +1 -2
- package/LexicalMarkdownShortcutPlugin.d.ts +4 -6
- package/LexicalNestedComposer.d.ts +7 -8
- package/LexicalOnChangePlugin.d.ts +5 -7
- package/LexicalPlainTextPlugin.d.ts +6 -9
- package/LexicalPlainTextPlugin.dev.js +43 -11
- package/LexicalPlainTextPlugin.prod.js +4 -4
- package/LexicalRichTextPlugin.d.ts +6 -9
- package/LexicalRichTextPlugin.dev.js +43 -11
- package/LexicalRichTextPlugin.prod.js +4 -4
- package/LexicalTablePlugin.d.ts +1 -2
- package/LexicalTablePlugin.dev.js +1 -1
- package/LexicalTablePlugin.prod.js +3 -3
- package/LexicalTreeView.d.ts +9 -11
- package/package.json +19 -22
- package/shared/useCanShowPlaceholder.d.ts +9 -0
- package/shared/useCharacterLimit.d.ts +16 -0
- package/shared/useDecorators.d.ts +9 -0
- package/shared/useEditorEvents.d.ts +10 -0
- package/shared/useHistory.d.ts +10 -0
- package/shared/useList.d.ts +9 -0
- package/shared/usePlainTextSetup.d.ts +10 -0
- package/shared/useRichTextSetup.d.ts +10 -0
- package/shared/useYjsCollaboration.d.ts +14 -0
- package/useLexicalIsTextContentEmpty.d.ts +2 -7
- package/useLexicalNodeSelection.d.ts +2 -6
- package/useLexicalTextEntity.d.ts +3 -13
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
'use strict';var e=require("@lexical/list"),g=require("@lexical/react/LexicalComposerContext"),k=require("@lexical/utils"),l=require("lexical"),m=require("react");let n=0;function p(){0===n++&&(document.addEventListener("click",q),document.addEventListener("pointerdown",r));return()=>{0===--n&&(document.removeEventListener("click",q),document.removeEventListener("pointerdown",r))}}
|
|
8
|
-
function t(a,
|
|
9
|
-
function r(a){t(a,()=>{a.preventDefault()})}function u(a){for(;a;){if(a.__lexicalEditor)return a.__lexicalEditor;a=a.parentNode}return null}function v(){let a=document.activeElement;return null!=a&&"LI"===a.tagName&&null!=a.parentNode&&"check"===a.parentNode.__lexicalListType?a:null}
|
|
10
|
-
function w(a,
|
|
11
|
-
function x(a,
|
|
12
|
-
exports.CheckListPlugin=function(){let [a]=g.useLexicalComposerContext();m.useEffect(()=>k.mergeRegister(a.registerCommand(e.INSERT_CHECK_LIST_COMMAND,()=>{e.insertList(a,"check");return!0},l.COMMAND_PRIORITY_LOW),a.registerCommand(l.KEY_ARROW_DOWN_COMMAND,
|
|
13
|
-
a.registerCommand(l.KEY_SPACE_COMMAND,
|
|
14
|
-
if(e.$isListItemNode(f)&&(b||f.getFirstDescendant()===
|
|
8
|
+
function t(a,d){let b=a.target;if(b instanceof HTMLElement){var c=b.firstChild;null!=c&&c instanceof HTMLElement&&("UL"===c.tagName||"OL"===c.tagName)||(c=b.parentNode)&&"check"===c.__lexicalListType&&(a=a.pageX,c=b.getBoundingClientRect(),("rtl"===b.dir?a<c.right&&a>c.right-20:a>c.left&&a<c.left+20)&&d())}}
|
|
9
|
+
function q(a){t(a,()=>{let d=a.target,b=u(d);null==b||b.isReadOnly()||b.update(()=>{if(a.target){let c=l.$getNearestNodeFromDOMNode(d);e.$isListItemNode(c)&&(d.focus(),c.toggleChecked())}})})}function r(a){t(a,()=>{a.preventDefault()})}function u(a){for(;a;){if(a.__lexicalEditor)return a.__lexicalEditor;a=a.parentNode}return null}function v(){let a=document.activeElement;return null!=a&&"LI"===a.tagName&&null!=a.parentNode&&"check"===a.parentNode.__lexicalListType?a:null}
|
|
10
|
+
function w(a,d){let b=d?a.getPreviousSibling():a.getNextSibling();for(;null==b&&e.$isListItemNode(a);)a=a.getParentOrThrow().getParent(),null!=a&&(b=d?a.getPreviousSibling():a.getNextSibling());for(;e.$isListItemNode(b);){a=d?b.getLastChild():b.getFirstChild();if(!e.$isListNode(a))return b;b=d?a.getLastChild():a.getFirstChild()}return null}
|
|
11
|
+
function x(a,d,b){let c=v();null!=c&&d.update(()=>{var f=l.$getNearestNodeFromDOMNode(c);if(e.$isListItemNode(f)&&(f=w(f,b),null!=f)){f.selectStart();let h=d.getElementByKey(f.__key);null!=h&&(a.preventDefault(),setTimeout(()=>{h.focus()},0))}});return!1}
|
|
12
|
+
exports.CheckListPlugin=function(){let [a]=g.useLexicalComposerContext();m.useEffect(()=>k.mergeRegister(a.registerCommand(e.INSERT_CHECK_LIST_COMMAND,()=>{e.insertList(a,"check");return!0},l.COMMAND_PRIORITY_LOW),a.registerCommand(l.KEY_ARROW_DOWN_COMMAND,d=>x(d,a,!1),l.COMMAND_PRIORITY_LOW),a.registerCommand(l.KEY_ARROW_UP_COMMAND,d=>x(d,a,!0),l.COMMAND_PRIORITY_LOW),a.registerCommand(l.KEY_ESCAPE_COMMAND,()=>{if(null!=v()){let d=a.getRootElement();null!=d&&d.focus();return!0}return!1},l.COMMAND_PRIORITY_LOW),
|
|
13
|
+
a.registerCommand(l.KEY_SPACE_COMMAND,d=>{let b=v();return null==b||a.isReadOnly()?!1:(a.update(()=>{let c=l.$getNearestNodeFromDOMNode(b);e.$isListItemNode(c)&&(d.preventDefault(),c.toggleChecked())}),!0)},l.COMMAND_PRIORITY_LOW),a.registerCommand(l.KEY_ARROW_LEFT_COMMAND,d=>a.getEditorState().read(()=>{var b=l.$getSelection();if(l.$isRangeSelection(b)&&b.isCollapsed()){var {anchor:c}=b;if((b="element"===c.type)||0===c.offset){c=c.getNode();let f=k.$findMatchingParent(c,h=>l.$isElementNode(h)&&!h.isInline());
|
|
14
|
+
if(e.$isListItemNode(f)&&(b||f.getFirstDescendant()===c)&&(b=a.getElementByKey(f.__key),null!=b&&document.activeElement!==b))return b.focus(),d.preventDefault(),!0}}return!1}),l.COMMAND_PRIORITY_LOW),p()));return null}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
onClear?: () => void;
|
|
8
|
+
declare type Props = Readonly<{
|
|
9
|
+
onClear?: () => void;
|
|
11
10
|
}>;
|
|
12
|
-
export function ClearEditorPlugin(
|
|
11
|
+
export declare function ClearEditorPlugin({ onClear }: Props): JSX.Element | null;
|
|
12
|
+
export {};
|
|
@@ -5,35 +5,21 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
import type {
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
color: string;
|
|
17
|
-
focusing: boolean;
|
|
8
|
+
/// <reference types="react" />
|
|
9
|
+
import type { Doc } from 'yjs';
|
|
10
|
+
import { WebsocketProvider } from 'y-websocket';
|
|
11
|
+
declare type CollaborationContextType = {
|
|
12
|
+
clientID: number;
|
|
13
|
+
color: string;
|
|
14
|
+
name: string;
|
|
15
|
+
yjsDocMap: Map<string, Doc>;
|
|
18
16
|
};
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
color: string;
|
|
29
|
-
name: string;
|
|
30
|
-
yjsDocMap: Map<string, Doc>;
|
|
31
|
-
};
|
|
32
|
-
export function CollaborationPlugin(arg0: {
|
|
33
|
-
id: string;
|
|
34
|
-
providerFactory(id: string, yjsDocMap: Map<string, Doc>): Provider;
|
|
35
|
-
shouldBootstrap: boolean;
|
|
36
|
-
username?: string;
|
|
37
|
-
}): JSX.Element | null;
|
|
38
|
-
export declare var CollaborationContext: React.Context<CollaborationContextType>;
|
|
39
|
-
export function useCollaborationContext(): CollaborationContextType;
|
|
17
|
+
export declare function CollaborationPlugin({ id, providerFactory, shouldBootstrap, username, }: {
|
|
18
|
+
id: string;
|
|
19
|
+
providerFactory: (id: string, yjsDocMap: Map<string, Doc>) => WebsocketProvider;
|
|
20
|
+
shouldBootstrap: boolean;
|
|
21
|
+
username?: string;
|
|
22
|
+
}): JSX.Element;
|
|
23
|
+
export declare const CollaborationContext: React.Context<CollaborationContextType>;
|
|
24
|
+
export declare function useCollaborationContext(username?: string): CollaborationContextType;
|
|
25
|
+
export {};
|
package/LexicalComposer.d.ts
CHANGED
|
@@ -5,19 +5,20 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
import type { Klass } from 'lexical';
|
|
9
|
+
import { EditorState, EditorThemeClasses, LexicalEditor, LexicalNode } from 'lexical';
|
|
10
|
+
export declare type InitialEditorStateType = null | string | EditorState | ((editor: LexicalEditor) => void);
|
|
11
|
+
declare type Props = {
|
|
12
|
+
children: JSX.Element | string | (JSX.Element | string)[];
|
|
13
|
+
initialConfig: Readonly<{
|
|
14
|
+
editor__DEPRECATED?: LexicalEditor | null;
|
|
15
|
+
namespace: string;
|
|
16
|
+
nodes?: ReadonlyArray<Klass<LexicalNode>>;
|
|
17
|
+
onError: (error: Error, editor: LexicalEditor) => void;
|
|
18
|
+
readOnly?: boolean;
|
|
19
|
+
theme?: EditorThemeClasses;
|
|
20
|
+
editorState?: InitialEditorStateType;
|
|
21
|
+
}>;
|
|
22
22
|
};
|
|
23
|
-
export function LexicalComposer(
|
|
23
|
+
export declare function LexicalComposer({ initialConfig, children }: Props): JSX.Element;
|
|
24
|
+
export {};
|
package/LexicalComposer.dev.js
CHANGED
|
@@ -36,6 +36,9 @@ var useLayoutEffect = useLayoutEffectImpl;
|
|
|
36
36
|
* LICENSE file in the root directory of this source tree.
|
|
37
37
|
*
|
|
38
38
|
*/
|
|
39
|
+
const HISTORY_MERGE_OPTIONS = {
|
|
40
|
+
tag: 'history-merge'
|
|
41
|
+
};
|
|
39
42
|
function LexicalComposer({
|
|
40
43
|
initialConfig,
|
|
41
44
|
children
|
|
@@ -46,7 +49,8 @@ function LexicalComposer({
|
|
|
46
49
|
namespace,
|
|
47
50
|
editor__DEPRECATED: initialEditor,
|
|
48
51
|
nodes,
|
|
49
|
-
onError
|
|
52
|
+
onError,
|
|
53
|
+
editorState: initialEditorState
|
|
50
54
|
} = initialConfig;
|
|
51
55
|
const context = LexicalComposerContext.createLexicalComposerContext(null, theme);
|
|
52
56
|
let editor = initialEditor || null;
|
|
@@ -59,6 +63,7 @@ function LexicalComposer({
|
|
|
59
63
|
readOnly: true,
|
|
60
64
|
theme
|
|
61
65
|
});
|
|
66
|
+
initializeEditor(newEditor, initialEditorState);
|
|
62
67
|
editor = newEditor;
|
|
63
68
|
}
|
|
64
69
|
|
|
@@ -77,4 +82,37 @@ function LexicalComposer({
|
|
|
77
82
|
}, children);
|
|
78
83
|
}
|
|
79
84
|
|
|
85
|
+
function initializeEditor(editor, initialEditorState) {
|
|
86
|
+
if (initialEditorState === null) {
|
|
87
|
+
return;
|
|
88
|
+
} else if (initialEditorState === undefined) ; else if (initialEditorState !== null) {
|
|
89
|
+
switch (typeof initialEditorState) {
|
|
90
|
+
case 'string':
|
|
91
|
+
{
|
|
92
|
+
const parsedEditorState = editor.parseEditorState(initialEditorState);
|
|
93
|
+
editor.setEditorState(parsedEditorState, HISTORY_MERGE_OPTIONS);
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
case 'object':
|
|
98
|
+
{
|
|
99
|
+
editor.setEditorState(initialEditorState, HISTORY_MERGE_OPTIONS);
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
case 'function':
|
|
104
|
+
{
|
|
105
|
+
editor.update(() => {
|
|
106
|
+
const root = lexical.$getRoot();
|
|
107
|
+
|
|
108
|
+
if (root.isEmpty()) {
|
|
109
|
+
initialEditorState(editor);
|
|
110
|
+
}
|
|
111
|
+
}, HISTORY_MERGE_OPTIONS);
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
80
118
|
exports.LexicalComposer = LexicalComposer;
|
package/LexicalComposer.js.flow
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type {EditorThemeClasses, LexicalEditor, LexicalNode} from 'lexical';
|
|
11
|
+
import type {InitialEditorStateType as InitialEditorStatePlainTextType} from '@lexical/plain-text';
|
|
12
|
+
import type {InitialEditorStateType as InitialEditorStateRichTextType} from '@lexical/rich-text';
|
|
11
13
|
|
|
12
14
|
type Props = {
|
|
13
15
|
initialConfig: $ReadOnly<{
|
|
@@ -16,6 +18,9 @@ type Props = {
|
|
|
16
18
|
namespace: string,
|
|
17
19
|
nodes?: $ReadOnlyArray<Class<LexicalNode>>,
|
|
18
20
|
theme?: EditorThemeClasses,
|
|
21
|
+
editorState?:
|
|
22
|
+
| InitialEditorStateRichTextType
|
|
23
|
+
| InitialEditorStatePlainTextType,
|
|
19
24
|
onError: (error: Error, editor: LexicalEditor) => void,
|
|
20
25
|
}>,
|
|
21
26
|
children: React$Node,
|
package/LexicalComposer.prod.js
CHANGED
|
@@ -4,5 +4,6 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
'use strict';var
|
|
8
|
-
|
|
7
|
+
'use strict';var c=require("@lexical/react/LexicalComposerContext"),f=require("lexical"),l=require("react"),m="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?l.useLayoutEffect:l.useEffect;let n={tag:"history-merge"};
|
|
8
|
+
function p(b,a){if(null!==a&&void 0!==a&&null!==a)switch(typeof a){case "string":let d=b.parseEditorState(a);b.setEditorState(d,n);break;case "object":b.setEditorState(a,n);break;case "function":b.update(()=>{f.$getRoot().isEmpty()&&a(b)},n)}}
|
|
9
|
+
exports.LexicalComposer=function({initialConfig:b,children:a}){let d=l.useMemo(()=>{const {theme:e,namespace:g,editor__DEPRECATED:q,nodes:r,onError:t,editorState:u}=b,v=c.createLexicalComposerContext(null,e);let h=q||null;if(null===h){const k=f.createEditor({namespace:g,nodes:r,onError:w=>t(w,k),readOnly:!0,theme:e});p(k,u);h=k}return[h,v]},[]);m(()=>{let e=b.readOnly,[g]=d;g.setReadOnly(e||!1)},[]);return l.createElement(c.LexicalComposerContext.Provider,{value:d},a)}
|
|
@@ -5,20 +5,15 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
import type {EditorThemeClasses, LexicalEditor} from 'lexical';
|
|
10
|
-
export type LexicalComposerContextType = {
|
|
11
|
-
|
|
8
|
+
/// <reference types="react" />
|
|
9
|
+
import type { EditorThemeClasses, LexicalEditor } from 'lexical';
|
|
10
|
+
export declare type LexicalComposerContextType = {
|
|
11
|
+
getTheme: () => EditorThemeClasses | null | undefined;
|
|
12
12
|
};
|
|
13
|
-
export type LexicalComposerContextWithEditor = [
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
export declare type LexicalComposerContextWithEditor = [
|
|
14
|
+
LexicalEditor,
|
|
15
|
+
LexicalComposerContextType
|
|
16
16
|
];
|
|
17
|
-
export declare
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export function createLexicalComposerContext(
|
|
21
|
-
parent: LexicalComposerContextWithEditor | null | undefined,
|
|
22
|
-
theme: EditorThemeClasses | null | undefined,
|
|
23
|
-
): LexicalComposerContextType;
|
|
24
|
-
export function useLexicalComposerContext(): LexicalComposerContextWithEditor;
|
|
17
|
+
export declare const LexicalComposerContext: React.Context<LexicalComposerContextWithEditor | null | undefined>;
|
|
18
|
+
export declare function createLexicalComposerContext(parent: LexicalComposerContextWithEditor | null | undefined, theme: EditorThemeClasses | null | undefined): LexicalComposerContextType;
|
|
19
|
+
export declare function useLexicalComposerContext(): LexicalComposerContextWithEditor;
|
|
@@ -5,27 +5,28 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
export type Props = Readonly<{
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
8
|
+
import { CSSProperties } from 'react';
|
|
9
|
+
export declare type Props = Readonly<{
|
|
10
|
+
ariaActiveDescendantID?: string;
|
|
11
|
+
ariaAutoComplete?: string;
|
|
12
|
+
ariaControls?: string;
|
|
13
|
+
ariaDescribedBy?: string;
|
|
14
|
+
ariaExpanded?: boolean;
|
|
15
|
+
ariaLabel?: string;
|
|
16
|
+
ariaLabelledBy?: string;
|
|
17
|
+
ariaMultiline?: boolean;
|
|
18
|
+
ariaOwneeID?: string;
|
|
19
|
+
ariaRequired?: string;
|
|
20
|
+
autoCapitalize?: boolean;
|
|
21
|
+
autoComplete?: boolean;
|
|
22
|
+
autoCorrect?: boolean;
|
|
23
|
+
className?: string;
|
|
24
|
+
id?: string;
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
role?: string;
|
|
27
|
+
spellCheck?: boolean;
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
tabIndex?: number;
|
|
30
|
+
testid?: string;
|
|
30
31
|
}>;
|
|
31
|
-
export function ContentEditable(
|
|
32
|
+
export declare function ContentEditable({ ariaActiveDescendantID, ariaAutoComplete, ariaControls, ariaDescribedBy, ariaExpanded, ariaLabel, ariaLabelledBy, ariaMultiline, ariaOwneeID, ariaRequired, autoCapitalize, autoComplete, autoCorrect, className, id, role, spellCheck, style, tabIndex, testid, }: Props): JSX.Element;
|
|
@@ -79,16 +79,16 @@ function ContentEditable({
|
|
|
79
79
|
"aria-multiline": ariaMultiline,
|
|
80
80
|
"aria-owns": isReadOnly ? null : ariaOwneeID,
|
|
81
81
|
"aria-required": ariaRequired,
|
|
82
|
-
autoCapitalize: autoCapitalize !== undefined ? String(autoCapitalize) :
|
|
82
|
+
autoCapitalize: autoCapitalize !== undefined ? String(autoCapitalize) : undefined // @ts-ignore This is a valid attribute
|
|
83
83
|
,
|
|
84
84
|
autoComplete: autoComplete,
|
|
85
|
-
autoCorrect: autoCorrect !== undefined ? String(autoCorrect) :
|
|
85
|
+
autoCorrect: autoCorrect !== undefined ? String(autoCorrect) : undefined,
|
|
86
86
|
className: className,
|
|
87
87
|
contentEditable: !isReadOnly,
|
|
88
88
|
"data-testid": testid,
|
|
89
89
|
id: id,
|
|
90
90
|
ref: ref,
|
|
91
|
-
role: isReadOnly ?
|
|
91
|
+
role: isReadOnly ? undefined : role,
|
|
92
92
|
spellCheck: spellCheck,
|
|
93
93
|
style: style,
|
|
94
94
|
tabIndex: tabIndex
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*/
|
|
7
7
|
'use strict';var b=require("@lexical/react/LexicalComposerContext"),k=require("react"),l="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?k.useLayoutEffect:k.useEffect;
|
|
8
8
|
exports.ContentEditable=function({ariaActiveDescendantID:m,ariaAutoComplete:n,ariaControls:p,ariaDescribedBy:q,ariaExpanded:r,ariaLabel:t,ariaLabelledBy:u,ariaMultiline:v,ariaOwneeID:w,ariaRequired:x,autoCapitalize:e,autoComplete:y,autoCorrect:f,className:z,id:A,role:g="textbox",spellCheck:B=!0,style:C,tabIndex:D,testid:E}){let [c]=b.useLexicalComposerContext(),[a,h]=k.useState(!0),F=k.useCallback(d=>{c.setRootElement(d)},[c]);l(()=>{h(c.isReadOnly());return c.registerReadOnlyListener(d=>{h(d)})},
|
|
9
|
-
[c]);return k.createElement("div",{"aria-activedescendant":a?null:m,"aria-autocomplete":a?null:n,"aria-controls":a?null:p,"aria-describedby":q,"aria-expanded":a?null:"combobox"===g?!!r:null,"aria-label":t,"aria-labelledby":u,"aria-multiline":v,"aria-owns":a?null:w,"aria-required":x,autoCapitalize:void 0!==e?String(e):
|
|
9
|
+
[c]);return k.createElement("div",{"aria-activedescendant":a?null:m,"aria-autocomplete":a?null:n,"aria-controls":a?null:p,"aria-describedby":q,"aria-expanded":a?null:"combobox"===g?!!r:null,"aria-label":t,"aria-labelledby":u,"aria-multiline":v,"aria-owns":a?null:w,"aria-required":x,autoCapitalize:void 0!==e?String(e):void 0,autoComplete:y,autoCorrect:void 0!==f?String(f):void 0,className:z,contentEditable:!a,"data-testid":E,id:A,ref:F,role:a?void 0:g,spellCheck:B,style:C,tabIndex:D})}
|
|
@@ -5,28 +5,17 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
declare class DecoratorBlockNode<T> extends DecoratorNode<T> {
|
|
23
|
-
__format: ElementFormatType;
|
|
24
|
-
constructor(format?: ElementFormatType | null, key?: NodeKey);
|
|
25
|
-
createDOM(): HTMLElement;
|
|
26
|
-
setFormat(format: ElementFormatType): void;
|
|
27
|
-
exportJSON(): SerializedDecoratorBlockNode;
|
|
8
|
+
import type { ElementFormatType, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical';
|
|
9
|
+
import { DecoratorNode } from 'lexical';
|
|
10
|
+
export declare type SerializedDecoratorBlockNode = Spread<{
|
|
11
|
+
format: ElementFormatType;
|
|
12
|
+
}, SerializedLexicalNode>;
|
|
13
|
+
export declare class DecoratorBlockNode extends DecoratorNode<JSX.Element> {
|
|
14
|
+
__format: ElementFormatType;
|
|
15
|
+
constructor(format?: ElementFormatType, key?: NodeKey);
|
|
16
|
+
exportJSON(): SerializedDecoratorBlockNode;
|
|
17
|
+
createDOM(): HTMLElement;
|
|
18
|
+
updateDOM(): false;
|
|
19
|
+
setFormat(format: ElementFormatType): void;
|
|
28
20
|
}
|
|
29
|
-
|
|
30
|
-
declare function $isDecoratorBlockNode<T>(
|
|
31
|
-
node: LexicalNode,
|
|
32
|
-
): node is DecoratorBlockNode<T>;
|
|
21
|
+
export declare function $isDecoratorBlockNode(node: LexicalNode | null | undefined): node is DecoratorBlockNode;
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
'use strict';var b=require("lexical");class c extends b.DecoratorNode{constructor(a,d){super(d);this.__format=a}exportJSON(){return{format:this.__format||"",type:"decorator-block",version:1}}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(a){this.getWritable().__format=a}}exports.$isDecoratorBlockNode=function(a){return a instanceof c};exports.DecoratorBlockNode=c
|
|
7
|
+
'use strict';var b=require("lexical");class c extends b.DecoratorNode{constructor(a,d){super(d);this.__format=a||""}exportJSON(){return{format:this.__format||"",type:"decorator-block",version:1}}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(a){this.getWritable().__format=a}}exports.$isDecoratorBlockNode=function(a){return a instanceof c};exports.DecoratorBlockNode=c
|
|
@@ -5,26 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
RangeSelection,
|
|
15
|
-
} from 'lexical';
|
|
16
|
-
|
|
17
|
-
export type HistoryStateEntry = {
|
|
18
|
-
editor: LexicalEditor;
|
|
19
|
-
editorState: EditorState;
|
|
20
|
-
undoSelection?: RangeSelection | NodeSelection | GridSelection | null;
|
|
21
|
-
};
|
|
22
|
-
export type HistoryState = {
|
|
23
|
-
current: null | HistoryStateEntry;
|
|
24
|
-
redoStack: Array<HistoryStateEntry>;
|
|
25
|
-
undoStack: Array<HistoryStateEntry>;
|
|
26
|
-
};
|
|
27
|
-
export function HistoryPlugin(arg0: {
|
|
28
|
-
externalHistoryState?: HistoryState;
|
|
29
|
-
}): JSX.Element | null;
|
|
30
|
-
export function createEmptyHistoryState(): HistoryState;
|
|
8
|
+
import type { HistoryState } from '@lexical/history';
|
|
9
|
+
export { createEmptyHistoryState } from '@lexical/history';
|
|
10
|
+
export type { HistoryState };
|
|
11
|
+
export declare function HistoryPlugin({ externalHistoryState, }: {
|
|
12
|
+
externalHistoryState?: HistoryState;
|
|
13
|
+
}): null;
|
|
@@ -5,21 +5,23 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
import type { LexicalCommand, LexicalNode, SerializedLexicalNode } from 'lexical';
|
|
9
|
+
import { DecoratorNode } from 'lexical';
|
|
10
|
+
export declare type SerializedHorizontalRuleNode = SerializedLexicalNode & {
|
|
11
|
+
type: 'horizontalrule';
|
|
12
|
+
version: 1;
|
|
13
|
+
};
|
|
14
|
+
export declare const INSERT_HORIZONTAL_RULE_COMMAND: LexicalCommand<void>;
|
|
15
|
+
export declare class HorizontalRuleNode extends DecoratorNode<JSX.Element> {
|
|
16
|
+
static getType(): string;
|
|
17
|
+
static clone(node: HorizontalRuleNode): HorizontalRuleNode;
|
|
18
|
+
static importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode;
|
|
19
|
+
exportJSON(): SerializedLexicalNode;
|
|
20
|
+
createDOM(): HTMLElement;
|
|
21
|
+
getTextContent(): '\n';
|
|
22
|
+
isTopLevel(): true;
|
|
23
|
+
updateDOM(): false;
|
|
24
|
+
decorate(): JSX.Element;
|
|
20
25
|
}
|
|
21
|
-
export function $createHorizontalRuleNode(): HorizontalRuleNode;
|
|
22
|
-
export function $isHorizontalRuleNode(
|
|
23
|
-
node: LexicalNode | null | undefined,
|
|
24
|
-
): node is HorizontalRuleNode;
|
|
25
|
-
export var INSERT_HORIZONTAL_RULE_COMMAND: LexicalCommand<void>;
|
|
26
|
+
export declare function $createHorizontalRuleNode(): HorizontalRuleNode;
|
|
27
|
+
export declare function $isHorizontalRuleNode(node: LexicalNode | null | undefined): node is HorizontalRuleNode;
|
package/LexicalLinkPlugin.d.ts
CHANGED
package/LexicalLinkPlugin.dev.js
CHANGED
|
@@ -16,6 +16,7 @@ var react = require('react');
|
|
|
16
16
|
*
|
|
17
17
|
* This source code is licensed under the MIT license found in the
|
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*
|
|
19
20
|
*/
|
|
20
21
|
function LinkPlugin() {
|
|
21
22
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
package/LexicalListPlugin.d.ts
CHANGED
|
@@ -5,9 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
transformers?: Array<Transformer>;
|
|
13
|
-
}): JSX.Element | null;
|
|
8
|
+
import type { Transformer } from '@lexical/markdown';
|
|
9
|
+
export declare function MarkdownShortcutPlugin({ transformers, }: Readonly<{
|
|
10
|
+
transformers?: Array<Transformer>;
|
|
11
|
+
}>): null;
|
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}): JSX.Element | null;
|
|
8
|
+
import type { EditorThemeClasses, LexicalEditor } from 'lexical';
|
|
9
|
+
import { ReactNode } from 'react';
|
|
10
|
+
export declare function LexicalNestedComposer({ initialEditor, children, initialTheme, }: {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
initialEditor: LexicalEditor;
|
|
13
|
+
initialTheme?: EditorThemeClasses;
|
|
14
|
+
}): JSX.Element;
|
|
@@ -5,11 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
ignoreSelectionChange?: boolean;
|
|
14
|
-
onChange: (editorState: EditorState, editor: LexicalEditor) => void;
|
|
8
|
+
import type { EditorState, LexicalEditor } from 'lexical';
|
|
9
|
+
export declare function OnChangePlugin({ ignoreInitialChange, ignoreSelectionChange, onChange, }: {
|
|
10
|
+
ignoreInitialChange?: boolean;
|
|
11
|
+
ignoreSelectionChange?: boolean;
|
|
12
|
+
onChange: (editorState: EditorState, editor: LexicalEditor) => void;
|
|
15
13
|
}): null;
|
|
@@ -5,12 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
initialEditorState?: InitialEditorStateType;
|
|
15
|
-
placeholder: JSX.Element | string | null;
|
|
16
|
-
}): JSX.Element | null;
|
|
8
|
+
import { InitialEditorStateType } from '@lexical/plain-text';
|
|
9
|
+
export declare function PlainTextPlugin({ contentEditable, placeholder, initialEditorState, }: {
|
|
10
|
+
contentEditable: JSX.Element;
|
|
11
|
+
initialEditorState?: InitialEditorStateType;
|
|
12
|
+
placeholder: JSX.Element | string;
|
|
13
|
+
}): JSX.Element;
|