diff --git a/packages/engine/src/change/paste.ts b/packages/engine/src/change/paste.ts index c1c8baf2..11342891 100644 --- a/packages/engine/src/change/paste.ts +++ b/packages/engine/src/change/paste.ts @@ -47,7 +47,7 @@ export default class Paste { let parent = node.parent(); // 跳过已被删除的节点 if (!parent || node.isCard() || node.fragment === fragment) { - return; + return undefined; } if (node.isText()) { let text = node.text(); @@ -73,7 +73,7 @@ export default class Paste { node.text(text); } } - return; + return undefined; } const styles = node.css(); defautlStyleKeys.forEach((key) => { @@ -87,7 +87,7 @@ export default class Paste { let type = this.schema.getType(node); if (!type) { nodeApi.unwrap(node); - return; + return undefined; } nodeApi.removeMinusStyle(node, 'text-indent'); if (nodeApi.isList(node)) { @@ -113,17 +113,17 @@ export default class Paste { } parent = node.parent(); node.remove(); - if (!parent) return; + if (!parent) return undefined; node = parent; parent = node.parent(); - if (!parent) return; + if (!parent) return undefined; type = undefined; attributes = undefined; } if (!attributes) attributes = node.attributes(); // 跳过Card if (attributes[READY_CARD_KEY]) { - return; + return undefined; } const nodeIsBlock = type ? type === 'block' @@ -140,7 +140,7 @@ export default class Paste { nodeApi.html(node) === '' ) { node.remove(); - return; + return undefined; } // 段落 if (attributes['data-type'] === 'p') { @@ -160,7 +160,7 @@ export default class Paste { const ul = $('