@lobehub/editor 1.14.1 → 1.14.2
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.
|
@@ -16,6 +16,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
16
16
|
import { $isCodeNode } from '@lexical/code';
|
|
17
17
|
import { $getNodeByKey, $getSelection, $isRangeSelection, $isTextNode, COLLABORATION_TAG, COMMAND_PRIORITY_CRITICAL, HISTORIC_TAG, KEY_ENTER_COMMAND, PASTE_COMMAND } from 'lexical';
|
|
18
18
|
import { KernelPlugin } from "../../../editor-kernel/plugin";
|
|
19
|
+
import { createDebugLogger } from "../../../utils/debug";
|
|
19
20
|
import MarkdownDataSource from "../data-source/markdown-data-source";
|
|
20
21
|
import { parseMarkdownToLexical } from "../data-source/markdown/parse";
|
|
21
22
|
import { IMarkdownShortCutService, MarkdownShortCutService } from "../service/shortcut";
|
|
@@ -30,6 +31,7 @@ export var MarkdownPlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
30
31
|
var _this;
|
|
31
32
|
_classCallCheck(this, MarkdownPlugin);
|
|
32
33
|
_this = _super.call(this);
|
|
34
|
+
_defineProperty(_assertThisInitialized(_this), "logger", createDebugLogger('plugin', 'markdown'));
|
|
33
35
|
_defineProperty(_assertThisInitialized(_this), "service", void 0);
|
|
34
36
|
_this.kernel = kernel;
|
|
35
37
|
_this.service = new MarkdownShortCutService(kernel);
|
|
@@ -133,13 +135,13 @@ export var MarkdownPlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
133
135
|
// If there's HTML content, it's a rich text paste
|
|
134
136
|
// Let Lexical's rich text handler process it
|
|
135
137
|
if (html && html.trim()) {
|
|
136
|
-
|
|
138
|
+
_this2.logger.debug('paste content analysis: HTML detected, letting Lexical handle it');
|
|
137
139
|
return false;
|
|
138
140
|
}
|
|
139
141
|
|
|
140
142
|
// Only handle plain text paste - check for markdown patterns
|
|
141
143
|
var hasMarkdownContent = _this2.detectMarkdownContent(text);
|
|
142
|
-
|
|
144
|
+
_this2.logger.debug('paste content analysis:', {
|
|
143
145
|
hasHTML: false,
|
|
144
146
|
hasMarkdown: hasMarkdownContent,
|
|
145
147
|
markdownPatterns: _this2.getMarkdownPatterns(text),
|
|
@@ -256,7 +258,7 @@ export var MarkdownPlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
256
258
|
$insertGeneratedNodes(editor, nodes, selection);
|
|
257
259
|
return true;
|
|
258
260
|
} catch (error) {
|
|
259
|
-
|
|
261
|
+
this.logger.error('Failed to handle markdown paste:', error);
|
|
260
262
|
}
|
|
261
263
|
return false;
|
|
262
264
|
}
|
package/package.json
CHANGED