@lexical/text 0.3.1 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
package/index.d.ts ADDED
@@ -0,0 +1,30 @@
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 { ElementNode, LexicalEditor, RootNode } from 'lexical';
9
+ import type { Klass } from 'shared/types';
10
+ import { TextNode } from 'lexical';
11
+ export declare type TextNodeWithOffset = {
12
+ node: TextNode;
13
+ offset: number;
14
+ };
15
+ export declare function $findTextIntersectionFromCharacters(root: RootNode, targetCharacters: number): null | {
16
+ node: TextNode;
17
+ offset: number;
18
+ };
19
+ export declare function $joinTextNodesInElementNode(elementNode: ElementNode, separator: string, stopAt: TextNodeWithOffset): string;
20
+ export declare function $findNodeWithOffsetFromJoinedText(offsetInJoinedText: number, joinedTextLength: number, separatorLength: number, elementNode: ElementNode): TextNodeWithOffset | null;
21
+ export declare function $isRootTextContentEmpty(isEditorComposing: boolean, trim?: boolean): boolean;
22
+ export declare function $isRootTextContentEmptyCurry(isEditorComposing: boolean, trim?: boolean): () => boolean;
23
+ export declare function $rootTextContent(): string;
24
+ export declare function $canShowPlaceholder(isComposing: boolean): boolean;
25
+ export declare function $canShowPlaceholderCurry(isEditorComposing: boolean): () => boolean;
26
+ export declare type EntityMatch = {
27
+ end: number;
28
+ start: number;
29
+ };
30
+ export declare function registerLexicalTextEntity<N extends TextNode>(editor: LexicalEditor, getMatch: (text: string) => null | EntityMatch, targetNode: Klass<N>, createNode: (textNode: TextNode) => N): Array<() => void>;
package/package.json CHANGED
@@ -9,14 +9,17 @@
9
9
  "text"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.3.1",
12
+ "version": "0.3.4",
13
13
  "main": "LexicalText.js",
14
14
  "peerDependencies": {
15
- "lexical": "0.3.1"
15
+ "lexical": "0.3.4"
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",
19
19
  "url": "https://github.com/facebook/lexical",
20
20
  "directory": "packages/lexical-text"
21
+ },
22
+ "devDependencies": {
23
+ "utility-types": "^3.10.0"
21
24
  }
22
25
  }
package/LexicalText.d.ts DELETED
@@ -1,56 +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 {ElementNode, LexicalEditor, RootNode, TextNode} from 'lexical';
10
- import {Class} from 'utility-types';
11
-
12
- export type TextNodeWithOffset = {
13
- node: TextNode;
14
- offset: number;
15
- };
16
- export function $findTextIntersectionFromCharacters(
17
- root: RootNode,
18
- targetCharacters: number,
19
- ): null | {
20
- node: TextNode;
21
- offset: number;
22
- };
23
- export function $joinTextNodesInElementNode(
24
- elementNode: ElementNode,
25
- separator: string,
26
- stopAt: TextNodeWithOffset,
27
- ): string;
28
- export function $findNodeWithOffsetFromJoinedText(
29
- offsetInJoinedText: number,
30
- joinedTextLength: number,
31
- separatorLength: number,
32
- elementNode: ElementNode,
33
- ): TextNodeWithOffset | null | undefined;
34
- export function $isRootTextContentEmpty(
35
- isEditorComposing: boolean,
36
- trim?: boolean,
37
- ): boolean;
38
- export function $isRootTextContentEmptyCurry(
39
- isEditorComposing: boolean,
40
- trim?: boolean,
41
- ): () => boolean;
42
- export function $rootTextContent(): string;
43
- export function $canShowPlaceholder(isComposing: boolean): boolean;
44
- export function $canShowPlaceholderCurry(
45
- isEditorComposing: boolean,
46
- ): () => boolean;
47
- export type EntityMatch = {
48
- end: number;
49
- start: number;
50
- };
51
- export function registerLexicalTextEntity<N extends TextNode>(
52
- editor: LexicalEditor,
53
- getMatch: (text: string) => null | EntityMatch,
54
- targetNode: Class<N>,
55
- createNode: (textNode: TextNode) => N,
56
- ): Array<() => void>;