lexical 0.1.8 → 0.1.11

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.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type {LexicalNode, RangeSelection} from 'lexical';
11
+
12
+ import {LinkNode} from 'lexical/LinkNode';
13
+
14
+ declare export class AutoLinkNode extends LinkNode {
15
+ static getType(): string;
16
+ // $FlowFixMe[incompatible-extend]
17
+ static clone(node: AutoLinkNode): AutoLinkNode;
18
+ insertNewAfter(selection: RangeSelection): null | LexicalNode;
19
+ // $FlowFixMe[incompatible-extend]
20
+ canInsertTextAfter(): true;
21
+ }
22
+ declare export function $createAutoLinkNode(url: string): AutoLinkNode;
23
+ declare export function $isAutoLinkNode(
24
+ node: ?LexicalNode,
25
+ ): boolean %checks(node instanceof AutoLinkNode);
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type {
11
+ EditorConfig,
12
+ EditorThemeClasses,
13
+ LexicalNode,
14
+ NodeKey,
15
+ } from 'lexical';
16
+
17
+ import {TextNode} from 'lexical';
18
+
19
+ declare export class CodeHighlightNode extends TextNode {
20
+ __highlightType: ?string;
21
+ constructor(text: string, highlightType?: string, key?: NodeKey): void;
22
+ static getType(): string;
23
+ static clone(node: CodeHighlightNode): CodeHighlightNode;
24
+ createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
25
+ updateDOM<EditorContext>(
26
+ // $FlowFixMe
27
+ prevNode: CodeHighlightNode,
28
+ dom: HTMLElement,
29
+ config: EditorConfig<EditorContext>,
30
+ ): boolean;
31
+ setFormat(format: number): this;
32
+ }
33
+ declare function getHighlightThemeClass(
34
+ theme: EditorThemeClasses,
35
+ highlightType: ?string,
36
+ ): ?string;
37
+ declare export function $createCodeHighlightNode(
38
+ text: string,
39
+ highlightType?: string,
40
+ ): CodeHighlightNode;
41
+ declare export function $isCodeHighlightNode(
42
+ node: ?LexicalNode,
43
+ ): boolean %checks(node instanceof CodeHighlightNode);
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type {
11
+ EditorConfig,
12
+ LexicalNode,
13
+ NodeKey,
14
+ ParagraphNode,
15
+ RangeSelection,
16
+ } from 'lexical';
17
+ import type {CodeHighlightNode} from 'lexical/CodeHighlightNode';
18
+
19
+ import {ElementNode} from 'lexical';
20
+
21
+ declare export class CodeNode extends ElementNode {
22
+ static getType(): string;
23
+ static clone(node: CodeNode): CodeNode;
24
+ constructor(key?: NodeKey): void;
25
+ createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
26
+ updateDOM(prevNode: CodeNode, dom: HTMLElement): boolean;
27
+ insertNewAfter(
28
+ selection: RangeSelection,
29
+ ): null | ParagraphNode | CodeHighlightNode;
30
+ canInsertTab(): true;
31
+ collapseAtStart(): true;
32
+ setLanguage(language: string): void;
33
+ getLanguage(): string | void;
34
+ }
35
+ declare export function $createCodeNode(): CodeNode;
36
+ declare export function $isCodeNode(
37
+ node: ?LexicalNode,
38
+ ): boolean %checks(node instanceof CodeNode);
39
+
40
+ declare export function getFirstCodeHighlightNodeOfLine(
41
+ anchor: LexicalNode,
42
+ ): ?CodeHighlightNode;
43
+
44
+ declare export function getLastCodeHighlightNodeOfLine(
45
+ anchor: LexicalNode,
46
+ ): ?CodeHighlightNode;
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type {EditorConfig, LexicalNode, NodeKey} from 'lexical';
11
+
12
+ import {TextNode} from 'lexical';
13
+
14
+ declare export class HashtagNode extends TextNode {
15
+ static getType(): string;
16
+ static clone(node: HashtagNode): HashtagNode;
17
+ constructor(text: string, key?: NodeKey): void;
18
+ createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
19
+ setTextContent(text: string): TextNode;
20
+ canInsertTextBefore(): boolean;
21
+ canInsertTextAfter(): boolean;
22
+ }
23
+ declare export function $toggleHashtag(node: TextNode): TextNode;
24
+ declare export function $createHashtagNode(text?: string): TextNode;
25
+ declare export function $isHashtagNode(
26
+ node: ?LexicalNode,
27
+ ): boolean %checks(node instanceof HashtagNode);
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ * @flow strict
8
+ */
9
+
10
+ import type {EditorConfig, LexicalNode, NodeKey, ParagraphNode} from 'lexical';
11
+
12
+ import {ElementNode} from 'lexical';
13
+
14
+ type HeadingTagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5';
15
+ declare export class HeadingNode extends ElementNode {
16
+ __tag: HeadingTagType;
17
+ static getType(): string;
18
+ static clone(node: HeadingNode): HeadingNode;
19
+ constructor(tag: HeadingTagType, key?: NodeKey): void;
20
+ getTag(): HeadingTagType;
21
+ createDOM<EditorContext>(config: EditorConfig<EditorContext>): HTMLElement;
22
+ updateDOM(prevNode: HeadingNode, dom: HTMLElement): boolean;
23
+ insertNewAfter(): ParagraphNode;
24
+ collapseAtStart(): true;
25
+ }
26
+ declare export function $createHeadingNode(
27
+ headingTag: HeadingTagType,
28
+ ): HeadingNode;
29
+
30
+ declare export function $isHeadingNode(
31
+ node: ?LexicalNode,
32
+ ): boolean %checks(node instanceof HeadingNode);