From 650bb18c0b25928a1415c4410abf4aaa23ad36c9 Mon Sep 17 00:00:00 2001 From: wolimst <64784258+wolimst@users.noreply.github.com> Date: Thu, 22 Feb 2024 21:11:30 +0900 Subject: [PATCH] Add annotation on state change to ignore first block protection filter --- src/editor/annotation.js | 1 + src/editor/block/commands.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/editor/annotation.js b/src/editor/annotation.js index 6b4e83c..ad0c5eb 100644 --- a/src/editor/annotation.js +++ b/src/editor/annotation.js @@ -5,3 +5,4 @@ export const LANGUAGE_CHANGE = "heynote-change" export const CURRENCIES_LOADED = "heynote-currencies-loaded" export const SET_CONTENT = "heynote-set-content" export const ADD_NEW_BLOCK = "heynote-add-new-block" +export const MOVE_BLOCK = "heynote-move-block" diff --git a/src/editor/block/commands.js b/src/editor/block/commands.js index 63144f7..08c9ff9 100644 --- a/src/editor/block/commands.js +++ b/src/editor/block/commands.js @@ -1,5 +1,5 @@ import { EditorSelection } from "@codemirror/state" -import { heynoteEvent, LANGUAGE_CHANGE, CURRENCIES_LOADED, ADD_NEW_BLOCK } from "../annotation.js"; +import { heynoteEvent, LANGUAGE_CHANGE, CURRENCIES_LOADED, ADD_NEW_BLOCK, MOVE_BLOCK } from "../annotation.js"; import { blockState, getActiveNoteBlock, getFirstNoteBlock, getLastNoteBlock, getNoteBlockFromPos } from "./block" import { moveLineDown, moveLineUp } from "./move-lines.js"; import { selectAll } from "./select-all.js"; @@ -362,6 +362,7 @@ function moveCurrentBlock(state, dispatch, up) { insert: newContent, }, selection: newSelectionRange, + annotations: [heynoteEvent.of(MOVE_BLOCK)], }, { scrollIntoView: true, userEvent: "input",