Skip to content

Commit

Permalink
fix(core): modify the method of getting matches in move_node #WIK-6050
Browse files Browse the repository at this point in the history
  • Loading branch information
huanhuanwa committed Mar 17, 2022
1 parent bb237a8 commit dd780fe
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions packages/src/plugins/with-angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,16 @@ export const withAngular = <T extends Editor>(editor: T, clipboardFormatKey = 'x
}

case 'move_node': {
for (const [node, path] of Editor.levels(e, {
at: Path.common(Path.parent(op.path), Path.parent(op.newPath)),
})) {
const key = AngularEditor.findKey(e, node);
matches.push([path, key]);
const commonPath = Path.common(Path.parent(op.path), Path.parent(op.newPath));
for (const [node, path] of Editor.levels(e, { at: Path.parent(op.path) })) {
const key = AngularEditor.findKey(e, node);
matches.push([path, key]);
}
for (const [node, path] of Editor.levels(e, { at: Path.parent(op.newPath) })) {
if(path.length > commonPath.length){
const key = AngularEditor.findKey(e, node);
matches.push([path, key]);
}
}
break;
}
Expand Down

0 comments on commit dd780fe

Please sign in to comment.