@lexical/rich-text 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.
@@ -38,6 +38,7 @@ const IS_IOS = CAN_USE_DOM && /iPad|iPhone|iPod/.test(navigator.userAgent) && //
38
38
  * LICENSE file in the root directory of this source tree.
39
39
  *
40
40
  */
41
+
41
42
  // Convoluted logic to make this work with Flow. Order matters.
42
43
  const options = {
43
44
  tag: 'history-merge'
package/index.d.ts ADDED
@@ -0,0 +1,52 @@
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
+ */
8
+ import type { DOMConversionMap, EditorConfig, EditorState, LexicalEditor, LexicalNode, NodeKey, ParagraphNode, SerializedElementNode, Spread } from 'lexical';
9
+ import { ElementNode } from 'lexical';
10
+ export declare type InitialEditorStateType = null | string | EditorState | ((editor: LexicalEditor) => void);
11
+ export declare type SerializedHeadingNode = Spread<{
12
+ tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
13
+ type: 'heading';
14
+ version: 1;
15
+ }, SerializedElementNode>;
16
+ export declare type SerializedQuoteNode = Spread<{
17
+ type: 'quote';
18
+ version: 1;
19
+ }, SerializedElementNode>;
20
+ export declare class QuoteNode extends ElementNode {
21
+ static getType(): string;
22
+ static clone(node: QuoteNode): QuoteNode;
23
+ constructor(key?: NodeKey);
24
+ createDOM(config: EditorConfig): HTMLElement;
25
+ updateDOM(prevNode: QuoteNode, dom: HTMLElement): boolean;
26
+ static importDOM(): DOMConversionMap | null;
27
+ static importJSON(serializedNode: SerializedQuoteNode): QuoteNode;
28
+ exportJSON(): SerializedElementNode;
29
+ insertNewAfter(): ParagraphNode;
30
+ collapseAtStart(): true;
31
+ }
32
+ export declare function $createQuoteNode(): QuoteNode;
33
+ export declare function $isQuoteNode(node: LexicalNode | null | undefined): node is QuoteNode;
34
+ export declare type HeadingTagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
35
+ export declare class HeadingNode extends ElementNode {
36
+ __tag: HeadingTagType;
37
+ static getType(): string;
38
+ static clone(node: HeadingNode): HeadingNode;
39
+ constructor(tag: HeadingTagType, key?: NodeKey);
40
+ getTag(): HeadingTagType;
41
+ createDOM(config: EditorConfig): HTMLElement;
42
+ updateDOM(prevNode: HeadingNode, dom: HTMLElement): boolean;
43
+ static importDOM(): DOMConversionMap | null;
44
+ static importJSON(serializedNode: SerializedHeadingNode): HeadingNode;
45
+ exportJSON(): SerializedHeadingNode;
46
+ insertNewAfter(): ParagraphNode;
47
+ collapseAtStart(): true;
48
+ extractWithChild(): boolean;
49
+ }
50
+ export declare function $createHeadingNode(headingTag: HeadingTagType): HeadingNode;
51
+ export declare function $isHeadingNode(node: LexicalNode | null | undefined): node is HeadingNode;
52
+ export declare function registerRichText(editor: LexicalEditor, initialEditorState?: InitialEditorStateType): () => void;
package/package.json CHANGED
@@ -7,13 +7,13 @@
7
7
  "rich-text"
8
8
  ],
9
9
  "license": "MIT",
10
- "version": "0.3.3",
10
+ "version": "0.3.6",
11
11
  "main": "LexicalRichText.js",
12
12
  "peerDependencies": {
13
- "lexical": "0.3.3",
14
- "@lexical/selection": "0.3.3",
15
- "@lexical/clipboard": "0.3.3",
16
- "@lexical/utils": "0.3.3"
13
+ "lexical": "0.3.6",
14
+ "@lexical/selection": "0.3.6",
15
+ "@lexical/clipboard": "0.3.6",
16
+ "@lexical/utils": "0.3.6"
17
17
  },
18
18
  "repository": {
19
19
  "type": "git",
@@ -1,81 +0,0 @@
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
- */
8
-
9
- import type {
10
- DOMConversionMap,
11
- EditorConfig,
12
- EditorState,
13
- LexicalNode,
14
- NodeKey,
15
- ParagraphNode,
16
- LexicalEditor,
17
- SerializedElementNode,
18
- } from 'lexical';
19
- import {ElementNode} from 'lexical';
20
- import type {Spread} from 'lexical';
21
-
22
- export type InitialEditorStateType =
23
- | null
24
- | string
25
- | EditorState
26
- | ((editor: LexicalEditor) => void);
27
-
28
- export declare class QuoteNode extends ElementNode {
29
- static getType(): string;
30
- static clone(node: QuoteNode): QuoteNode;
31
- constructor(key?: NodeKey);
32
- createDOM(config: EditorConfig): HTMLElement;
33
- updateDOM(prevNode: QuoteNode, dom: HTMLElement): boolean;
34
- insertNewAfter(): ParagraphNode;
35
- collapseAtStart(): true;
36
- importJSON(serializedNode: SerializedQuoteNode): QuoteNode;
37
- }
38
- export function $createQuoteNode(): QuoteNode;
39
- export function $isQuoteNode(
40
- node: LexicalNode | null | undefined,
41
- ): node is QuoteNode;
42
- export type HeadingTagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
43
- export declare class HeadingNode extends ElementNode {
44
- __tag: HeadingTagType;
45
- static getType(): string;
46
- static clone(node: HeadingNode): HeadingNode;
47
- constructor(tag: HeadingTagType, key?: NodeKey);
48
- getTag(): HeadingTagType;
49
- createDOM(config: EditorConfig): HTMLElement;
50
- updateDOM(prevNode: HeadingNode, dom: HTMLElement): boolean;
51
- static importDOM(): DOMConversionMap | null;
52
- insertNewAfter(): ParagraphNode;
53
- collapseAtStart(): true;
54
- importJSON(serializedNode: SerializedHeadingNode): QuoteNode;
55
- }
56
-
57
- export function $createHeadingNode(headingTag: HeadingTagType): HeadingNode;
58
- export function $isHeadingNode(
59
- node: LexicalNode | null | undefined,
60
- ): node is HeadingNode;
61
- export function registerRichText(
62
- editor: LexicalEditor,
63
- initialEditorState?: InitialEditorStateType,
64
- ): () => void;
65
-
66
- export type SerializedHeadingNode = Spread<
67
- {
68
- tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
69
- type: 'heading';
70
- version: 1;
71
- },
72
- SerializedElementNode
73
- >;
74
-
75
- export type SerializedQuoteNode = Spread<
76
- {
77
- type: 'quote';
78
- version: 1;
79
- },
80
- SerializedElementNode
81
- >;