diff --git a/src/editor/block/delete-line.js b/src/editor/block/delete-line.js index 9066231..31f82cc 100644 --- a/src/editor/block/delete-line.js +++ b/src/editor/block/delete-line.js @@ -1,5 +1,5 @@ import { EditorSelection } from "@codemirror/state" -import { getActiveNoteBlock } from "./block" +import { getNoteBlockFromPos } from "./block" function updateSel(sel, by) { return EditorSelection.create(sel.ranges.map(by), sel.mainIndex); @@ -28,10 +28,10 @@ export const deleteLine = (view) => { const { state } = view - const block = getActiveNoteBlock(view.state) const selectedLines = selectedLineBlocks(state) const changes = state.changes(selectedLines.map(({ from, to }) => { + const block = getNoteBlockFromPos(state, from) if(from !== block.content.from || to !== block.content.to) { if (from > 0) from-- else if (to < state.doc.length) to++