mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
fix(code): indentation working in read-only mode
This commit is contained in:
parent
3e5e19b8a5
commit
a20a51fa75
@ -1,5 +1,5 @@
|
||||
import { indentLess, indentMore } from "@codemirror/commands";
|
||||
import { EditorSelection, type ChangeSpec } from "@codemirror/state";
|
||||
import { EditorSelection, EditorState, type ChangeSpec } from "@codemirror/state";
|
||||
import type { KeyBinding } from "@codemirror/view";
|
||||
|
||||
/**
|
||||
@ -14,6 +14,10 @@ const smartIndentWithTab: KeyBinding[] = [
|
||||
{
|
||||
key: "Tab",
|
||||
run({ state, dispatch }) {
|
||||
if (state.facet(EditorState.readOnly)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const { selection } = state;
|
||||
const changes = [];
|
||||
const newSelections = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user