@lobehub/editor 3.4.0 → 3.4.1
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.
|
@@ -25,7 +25,7 @@ import { registerDragonSupport } from '@lexical/dragon';
|
|
|
25
25
|
import { registerHistory } from '@lexical/history';
|
|
26
26
|
import { $createHeadingNode, $createQuoteNode, $isHeadingNode, $isQuoteNode, HeadingNode, QuoteNode, registerRichText } from '@lexical/rich-text';
|
|
27
27
|
import { CAN_USE_DOM } from '@lexical/utils';
|
|
28
|
-
import { $createLineBreakNode, $createParagraphNode, $getSelection, $isRangeSelection, $isTextNode, COMMAND_PRIORITY_HIGH, INSERT_LINE_BREAK_COMMAND, INSERT_PARAGRAPH_COMMAND, ParagraphNode, TEXT_TYPE_TO_FORMAT, TextNode } from 'lexical';
|
|
28
|
+
import { $createLineBreakNode, $createParagraphNode, $getSelection, $isRangeSelection, $isTextNode, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_HIGH, INSERT_LINE_BREAK_COMMAND, INSERT_PARAGRAPH_COMMAND, PASTE_COMMAND, ParagraphNode, TEXT_TYPE_TO_FORMAT, TextNode } from 'lexical';
|
|
29
29
|
import { noop } from "../../../editor-kernel";
|
|
30
30
|
import { INodeHelper } from "../../../editor-kernel/inode/helper";
|
|
31
31
|
import { KernelPlugin } from "../../../editor-kernel/plugin";
|
|
@@ -325,7 +325,15 @@ export var CommonPlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
325
325
|
}, {
|
|
326
326
|
key: "onInit",
|
|
327
327
|
value: function onInit(editor) {
|
|
328
|
-
var
|
|
328
|
+
var _this2 = this,
|
|
329
|
+
_this$config2;
|
|
330
|
+
this.register(this.kernel.registerHighCommand(PASTE_COMMAND, function (event) {
|
|
331
|
+
if (!(event instanceof ClipboardEvent)) return false;
|
|
332
|
+
var clipboardData = event.clipboardData;
|
|
333
|
+
if (!clipboardData) return false;
|
|
334
|
+
_this2.kernel.emit('onPaste', event);
|
|
335
|
+
return false;
|
|
336
|
+
}, COMMAND_PRIORITY_CRITICAL));
|
|
329
337
|
this.registerClears(registerRichText(editor), CAN_USE_DOM ? registerDragonSupport(editor) : noop, registerHistory(editor, this.kernel.getHistoryState(), 300), registerHeaderBackspace(editor), registerRichKeydown(editor, this.kernel, {
|
|
330
338
|
enableHotkey: (_this$config2 = this.config) === null || _this$config2 === void 0 ? void 0 : _this$config2.enableHotkey
|
|
331
339
|
}), registerCommands(editor), registerBreakLineClick(editor), registerCursorNode(editor), registerLastElement(editor),
|
|
@@ -21,19 +21,21 @@ export function $parseSerializedNodeImpl(serializedNode, editor) {
|
|
|
21
21
|
}
|
|
22
22
|
var children = serializedNode.children;
|
|
23
23
|
if ($isElementNode(node) && Array.isArray(children)) {
|
|
24
|
+
var childNodes = [];
|
|
24
25
|
var _iterator = _createForOfIteratorHelper(children),
|
|
25
26
|
_step;
|
|
26
27
|
try {
|
|
27
28
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
28
29
|
var serializedJSONChildNode = _step.value;
|
|
29
30
|
var childNode = $parseSerializedNodeImpl(serializedJSONChildNode, editor, keepId, state);
|
|
30
|
-
|
|
31
|
+
childNodes.push(childNode);
|
|
31
32
|
}
|
|
32
33
|
} catch (err) {
|
|
33
34
|
_iterator.e(err);
|
|
34
35
|
} finally {
|
|
35
36
|
_iterator.f();
|
|
36
37
|
}
|
|
38
|
+
node.append.apply(node, childNodes);
|
|
37
39
|
}
|
|
38
40
|
return node;
|
|
39
41
|
}
|
package/es/types/kernel.d.ts
CHANGED
package/package.json
CHANGED