mirror of
https://github.com/heyman/heynote.git
synced 2025-06-28 13:31:38 +02:00
Fix issue where deleteLine command could fuck up the Heynote block syntax
This commit is contained in:
parent
863a721bef
commit
deedf24394
@ -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++
|
||||
|
Loading…
x
Reference in New Issue
Block a user