mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
fix(code): indentation working in read-only mode
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { indentLess, indentMore } from "@codemirror/commands";
|
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";
|
import type { KeyBinding } from "@codemirror/view";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,6 +14,10 @@ const smartIndentWithTab: KeyBinding[] = [
|
|||||||
{
|
{
|
||||||
key: "Tab",
|
key: "Tab",
|
||||||
run({ state, dispatch }) {
|
run({ state, dispatch }) {
|
||||||
|
if (state.facet(EditorState.readOnly)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const { selection } = state;
|
const { selection } = state;
|
||||||
const changes = [];
|
const changes = [];
|
||||||
const newSelections = [];
|
const newSelections = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user