@lexical/hashtag 0.12.1 → 0.12.3
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/LexicalHashtag.dev.js +5 -12
- package/package.json +3 -3
package/LexicalHashtag.dev.js
CHANGED
|
@@ -16,27 +16,23 @@ var lexical = require('lexical');
|
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
|
-
/** @noInheritDoc */
|
|
20
19
|
|
|
20
|
+
/** @noInheritDoc */
|
|
21
21
|
class HashtagNode extends lexical.TextNode {
|
|
22
22
|
static getType() {
|
|
23
23
|
return 'hashtag';
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
static clone(node) {
|
|
27
26
|
return new HashtagNode(node.__text, node.__key);
|
|
28
27
|
}
|
|
29
|
-
|
|
30
28
|
constructor(text, key) {
|
|
31
29
|
super(text, key);
|
|
32
30
|
}
|
|
33
|
-
|
|
34
31
|
createDOM(config) {
|
|
35
32
|
const element = super.createDOM(config);
|
|
36
33
|
utils.addClassNamesToElement(element, config.theme.hashtag);
|
|
37
34
|
return element;
|
|
38
35
|
}
|
|
39
|
-
|
|
40
36
|
static importJSON(serializedNode) {
|
|
41
37
|
const node = $createHashtagNode(serializedNode.text);
|
|
42
38
|
node.setFormat(serializedNode.format);
|
|
@@ -45,37 +41,34 @@ class HashtagNode extends lexical.TextNode {
|
|
|
45
41
|
node.setStyle(serializedNode.style);
|
|
46
42
|
return node;
|
|
47
43
|
}
|
|
48
|
-
|
|
49
44
|
exportJSON() {
|
|
50
|
-
return {
|
|
45
|
+
return {
|
|
46
|
+
...super.exportJSON(),
|
|
51
47
|
type: 'hashtag'
|
|
52
48
|
};
|
|
53
49
|
}
|
|
54
|
-
|
|
55
50
|
canInsertTextBefore() {
|
|
56
51
|
return false;
|
|
57
52
|
}
|
|
58
|
-
|
|
59
53
|
isTextEntity() {
|
|
60
54
|
return true;
|
|
61
55
|
}
|
|
62
|
-
|
|
63
56
|
}
|
|
57
|
+
|
|
64
58
|
/**
|
|
65
59
|
* Generates a HashtagNode, which is a string following the format of a # followed by some text, eg. #lexical.
|
|
66
60
|
* @param text - The text used inside the HashtagNode.
|
|
67
61
|
* @returns - The HashtagNode with the embedded text.
|
|
68
62
|
*/
|
|
69
|
-
|
|
70
63
|
function $createHashtagNode(text = '') {
|
|
71
64
|
return lexical.$applyNodeReplacement(new HashtagNode(text));
|
|
72
65
|
}
|
|
66
|
+
|
|
73
67
|
/**
|
|
74
68
|
* Determines if node is a HashtagNode.
|
|
75
69
|
* @param node - The node to be checked.
|
|
76
70
|
* @returns true if node is a HashtagNode, false otherwise.
|
|
77
71
|
*/
|
|
78
|
-
|
|
79
72
|
function $isHashtagNode(node) {
|
|
80
73
|
return node instanceof HashtagNode;
|
|
81
74
|
}
|
package/package.json
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
"hashtag"
|
|
9
9
|
],
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"version": "0.12.
|
|
11
|
+
"version": "0.12.3",
|
|
12
12
|
"main": "LexicalHashtag.js",
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"lexical": "0.12.
|
|
14
|
+
"lexical": "0.12.3"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@lexical/utils": "0.12.
|
|
17
|
+
"@lexical/utils": "0.12.3"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|