@lobehub/editor 1.9.1 → 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/es/utils/debug.js
CHANGED
|
@@ -5,7 +5,6 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
5
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
7
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
-
// @ts-ignore - debug package types
|
|
9
8
|
import createDebug from 'debug';
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -141,32 +140,6 @@ export var DebugLogger = /*#__PURE__*/function () {
|
|
|
141
140
|
*/
|
|
142
141
|
export var debugLogger = new DebugLogger();
|
|
143
142
|
|
|
144
|
-
/**
|
|
145
|
-
* Browser environment debug initialization - Zero configuration approach
|
|
146
|
-
* Automatically enables debug based on environment variables or development mode
|
|
147
|
-
*/
|
|
148
|
-
if (typeof window !== 'undefined') {
|
|
149
|
-
// Check for server-side DEBUG environment variable (passed through build process)
|
|
150
|
-
var envDebug = typeof process !== 'undefined' ? process.env.DEBUG : undefined;
|
|
151
|
-
|
|
152
|
-
// Simple logic: Environment variable takes precedence, then development mode
|
|
153
|
-
var debugConfig = null;
|
|
154
|
-
if (envDebug) {
|
|
155
|
-
// Environment variable exists - use it directly
|
|
156
|
-
debugConfig = envDebug;
|
|
157
|
-
localStorage.debug = envDebug;
|
|
158
|
-
} else if (isDev) {
|
|
159
|
-
// Development mode - auto-enable all lobe-editor debug
|
|
160
|
-
debugConfig = 'lobe-editor:*';
|
|
161
|
-
localStorage.debug = debugConfig;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// Apply debug configuration
|
|
165
|
-
if (debugConfig) {
|
|
166
|
-
createDebug.enable(debugConfig);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
143
|
/**
|
|
171
144
|
* Convenience function to create a debug logger for a specific category
|
|
172
145
|
* @param category - Main category (e.g., 'kernel', 'plugin', 'upload')
|
|
@@ -293,11 +266,11 @@ export var browserDebug = {
|
|
|
293
266
|
*/
|
|
294
267
|
getConfig: function getConfig() {
|
|
295
268
|
if (typeof window !== 'undefined') {
|
|
296
|
-
var
|
|
269
|
+
var envDebug = typeof process !== 'undefined' ? process.env.DEBUG : undefined;
|
|
297
270
|
var currentDebug = localStorage.getItem('debug');
|
|
298
|
-
if (
|
|
271
|
+
if (envDebug) {
|
|
299
272
|
return {
|
|
300
|
-
enabled:
|
|
273
|
+
enabled: envDebug,
|
|
301
274
|
source: 'environment variable (auto-applied)'
|
|
302
275
|
};
|
|
303
276
|
} else if (isDev && currentDebug) {
|
package/package.json
CHANGED