mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
fix(move_block): keep moved blocks in view
This commit is contained in:
parent
48613da57f
commit
be447b4139
@ -70,12 +70,21 @@ abstract class MoveBlockUpDownCommand extends Command {
|
||||
writer.createPositionAt(
|
||||
selectedBlocks[selectedBlocks.length - 1], offsets[1]));
|
||||
writer.setSelection(range);
|
||||
|
||||
this.scrollToSelection();
|
||||
});
|
||||
}
|
||||
|
||||
getSelectedBlocks(selection: DocumentSelection) {
|
||||
return [...selection.getSelectedBlocks()];
|
||||
}
|
||||
|
||||
scrollToSelection() {
|
||||
// Ensure scroll happens in sync with DOM updates
|
||||
requestAnimationFrame(() => {
|
||||
this.editor.editing.view.scrollToTheSelection();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
class MoveBlockUpCommand extends MoveBlockUpDownCommand {
|
||||
|
Loading…
x
Reference in New Issue
Block a user