@innoviatech/lexical-text-editor 2.0.4 → 2.0.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/README.md +4 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/googlebd703883f12c69e4.html +1 -0
- package/package.json +2 -1
- package/src/components/LexicalTextEditor.tsx +3 -2
- package/src/nodes/ExtendedTextNode.tsx +28 -17
- package/innoviatech-lexical-text-editor-2.0.0.tgz +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
google-site-verification: googlebd703883f12c69e4.html
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@innoviatech/lexical-text-editor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"license": "MIT",
|
|
9
|
+
"homepage": "https://technohaattech.github.io/Lexical-Text-Editor/",
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
11
12
|
"url": "https://github.com/technohaattech/Lexical-Text-Editor"
|
|
@@ -5,7 +5,7 @@ import { CodeHighlightNode, CodeNode } from "@lexical/code"
|
|
|
5
5
|
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin"
|
|
6
6
|
import { ContentEditable } from "@lexical/react/LexicalContentEditable"
|
|
7
7
|
import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary"
|
|
8
|
-
import { TextNode, type EditorThemeClasses } from "lexical"
|
|
8
|
+
import { LineBreakNode, TextNode, type EditorThemeClasses } from "lexical"
|
|
9
9
|
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin"
|
|
10
10
|
import { ListPlugin } from "@lexical/react/LexicalListPlugin"
|
|
11
11
|
import { ListItemNode, ListNode } from "@lexical/list"
|
|
@@ -76,7 +76,8 @@ export const LexicalTextEditor: React.FC<LexiTexProps> = React.memo(
|
|
|
76
76
|
LinkNode,
|
|
77
77
|
ImageNode,
|
|
78
78
|
YoutubeNode,
|
|
79
|
-
VideoNode
|
|
79
|
+
VideoNode,
|
|
80
|
+
LineBreakNode
|
|
80
81
|
],
|
|
81
82
|
}) as any,
|
|
82
83
|
[name]
|
|
@@ -7,7 +7,9 @@ import {
|
|
|
7
7
|
NodeKey,
|
|
8
8
|
TextNode,
|
|
9
9
|
SerializedTextNode,
|
|
10
|
-
LexicalNode
|
|
10
|
+
LexicalNode,
|
|
11
|
+
LineBreakNode,
|
|
12
|
+
$createLineBreakNode,
|
|
11
13
|
} from 'lexical';
|
|
12
14
|
|
|
13
15
|
export class ExtendedTextNode extends TextNode {
|
|
@@ -27,50 +29,58 @@ export class ExtendedTextNode extends TextNode {
|
|
|
27
29
|
const importers = TextNode.importDOM();
|
|
28
30
|
return {
|
|
29
31
|
...importers,
|
|
32
|
+
|
|
33
|
+
br: () => ({
|
|
34
|
+
conversion: () => ({
|
|
35
|
+
node: $createLineBreakNode(),
|
|
36
|
+
}),
|
|
37
|
+
priority: 1,
|
|
38
|
+
}),
|
|
39
|
+
|
|
30
40
|
span: () => ({
|
|
31
41
|
conversion: patchStyleConversion(importers?.span),
|
|
32
|
-
priority: 1
|
|
42
|
+
priority: 1,
|
|
33
43
|
}),
|
|
34
44
|
div: () => ({
|
|
35
45
|
conversion: patchStyleConversion(importers?.div),
|
|
36
|
-
priority: 1
|
|
46
|
+
priority: 1,
|
|
37
47
|
}),
|
|
38
48
|
p: () => ({
|
|
39
49
|
conversion: patchStyleConversion(importers?.p),
|
|
40
|
-
priority: 1
|
|
50
|
+
priority: 1,
|
|
41
51
|
}),
|
|
42
52
|
b: () => ({
|
|
43
53
|
conversion: patchStyleConversion(importers?.b),
|
|
44
|
-
priority: 1
|
|
54
|
+
priority: 1,
|
|
45
55
|
}),
|
|
46
56
|
strong: () => ({
|
|
47
57
|
conversion: patchStyleConversion(importers?.strong),
|
|
48
|
-
priority: 1
|
|
58
|
+
priority: 1,
|
|
49
59
|
}),
|
|
50
60
|
i: () => ({
|
|
51
61
|
conversion: patchStyleConversion(importers?.i),
|
|
52
|
-
priority: 1
|
|
62
|
+
priority: 1,
|
|
53
63
|
}),
|
|
54
64
|
em: () => ({
|
|
55
65
|
conversion: patchStyleConversion(importers?.em),
|
|
56
|
-
priority: 1
|
|
66
|
+
priority: 1,
|
|
57
67
|
}),
|
|
58
68
|
u: () => ({
|
|
59
69
|
conversion: patchStyleConversion(importers?.u),
|
|
60
|
-
priority: 1
|
|
70
|
+
priority: 1,
|
|
61
71
|
}),
|
|
62
72
|
s: () => ({
|
|
63
73
|
conversion: patchStyleConversion(importers?.s),
|
|
64
|
-
priority: 1
|
|
74
|
+
priority: 1,
|
|
65
75
|
}),
|
|
66
76
|
strike: () => ({
|
|
67
77
|
conversion: patchStyleConversion(importers?.strike),
|
|
68
|
-
priority: 1
|
|
78
|
+
priority: 1,
|
|
69
79
|
}),
|
|
70
80
|
code: () => ({
|
|
71
81
|
conversion: patchStyleConversion(importers?.code),
|
|
72
|
-
priority: 1
|
|
73
|
-
})
|
|
82
|
+
priority: 1,
|
|
83
|
+
}),
|
|
74
84
|
};
|
|
75
85
|
}
|
|
76
86
|
|
|
@@ -87,7 +97,9 @@ export function $createExtendedTextNode(text: string = ''): ExtendedTextNode {
|
|
|
87
97
|
return $applyNodeReplacement(new ExtendedTextNode(text));
|
|
88
98
|
}
|
|
89
99
|
|
|
90
|
-
export function $isExtendedTextNode(
|
|
100
|
+
export function $isExtendedTextNode(
|
|
101
|
+
node: LexicalNode | null | undefined
|
|
102
|
+
): node is ExtendedTextNode {
|
|
91
103
|
return node instanceof ExtendedTextNode;
|
|
92
104
|
}
|
|
93
105
|
|
|
@@ -148,7 +160,6 @@ function patchStyleConversion(
|
|
|
148
160
|
|
|
149
161
|
const inlineStyle = node.getAttribute('style');
|
|
150
162
|
if (inlineStyle) {
|
|
151
|
-
// Parse the style string to avoid duplicates
|
|
152
163
|
const stylePairs = inlineStyle.split(';').filter(pair => pair.trim());
|
|
153
164
|
stylePairs.forEach(pair => {
|
|
154
165
|
const [property] = pair.split(':').map(s => s.trim());
|
|
@@ -168,7 +179,7 @@ function patchStyleConversion(
|
|
|
168
179
|
return result.setStyle(styleString);
|
|
169
180
|
}
|
|
170
181
|
return result;
|
|
171
|
-
}
|
|
182
|
+
},
|
|
172
183
|
};
|
|
173
184
|
};
|
|
174
|
-
}
|
|
185
|
+
}
|
|
Binary file
|