@lobehub/editor 1.9.2 → 1.9.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.
|
@@ -162,6 +162,10 @@ export function registerCursorNode(editor) {
|
|
|
162
162
|
}), editor.registerUpdateListener(function () {
|
|
163
163
|
editor.read(function () {
|
|
164
164
|
var selection = $getSelection();
|
|
165
|
+
var isComposing = editor.isComposing();
|
|
166
|
+
if (isComposing) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
165
169
|
if (!$isRangeSelection(selection) || !selection.isCollapsed()) {
|
|
166
170
|
return false;
|
|
167
171
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $wrapNodeInElement } from '@lexical/utils';
|
|
2
|
-
import { $createParagraphNode, $
|
|
2
|
+
import { $createParagraphNode, $insertNodes, $isRootOrShadowRoot, COMMAND_PRIORITY_HIGH, createCommand } from 'lexical';
|
|
3
3
|
import { $createMentionNode } from "../node/MentionNode";
|
|
4
4
|
export var INSERT_MENTION_COMMAND = createCommand('INSERT_MENTION_COMMAND');
|
|
5
5
|
export function registerMentionCommand(editor) {
|
|
@@ -11,12 +11,8 @@ export function registerMentionCommand(editor) {
|
|
|
11
11
|
$insertNodes([mentionNode]);
|
|
12
12
|
// Ensure mention is inside a paragraph when inserted at root
|
|
13
13
|
if ($isRootOrShadowRoot(mentionNode.getParentOrThrow())) {
|
|
14
|
-
$wrapNodeInElement(mentionNode, $createParagraphNode);
|
|
14
|
+
$wrapNodeInElement(mentionNode, $createParagraphNode).selectEnd();
|
|
15
15
|
}
|
|
16
|
-
// Insert a trailing text node and move caret into it to enable IME input
|
|
17
|
-
var trailingText = $createTextNode("\u200B");
|
|
18
|
-
mentionNode.insertAfter(trailingText);
|
|
19
|
-
trailingText.selectEnd();
|
|
20
16
|
});
|
|
21
17
|
return true;
|
|
22
18
|
}, COMMAND_PRIORITY_HIGH // Priority
|
package/package.json
CHANGED