feat: add essential keymaps to codemirror input box - resolved #2264
This commit is contained in:
@@ -29,10 +29,13 @@ import {
|
|||||||
placeholder as placeholderExt,
|
placeholder as placeholderExt,
|
||||||
ViewPlugin,
|
ViewPlugin,
|
||||||
ViewUpdate,
|
ViewUpdate,
|
||||||
|
keymap,
|
||||||
} from "@codemirror/view"
|
} from "@codemirror/view"
|
||||||
import { EditorState, Extension } from "@codemirror/state"
|
import { EditorState, Extension } from "@codemirror/state"
|
||||||
import clone from "lodash/clone"
|
import clone from "lodash/clone"
|
||||||
import { tooltips } from "@codemirror/tooltip"
|
import { tooltips } from "@codemirror/tooltip"
|
||||||
|
import { history, historyKeymap } from "@codemirror/history"
|
||||||
|
import { defaultKeymap } from "@codemirror/commands"
|
||||||
import { inputTheme } from "~/helpers/editor/themes/baseTheme"
|
import { inputTheme } from "~/helpers/editor/themes/baseTheme"
|
||||||
import { HoppReactiveEnvPlugin } from "~/helpers/editor/extensions/HoppEnvironment"
|
import { HoppReactiveEnvPlugin } from "~/helpers/editor/extensions/HoppEnvironment"
|
||||||
import { useReadonlyStream } from "~/helpers/utils/composables"
|
import { useReadonlyStream } from "~/helpers/utils/composables"
|
||||||
@@ -172,6 +175,8 @@ const initView = (el: any) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
history(),
|
||||||
|
keymap.of([...defaultKeymap, ...historyKeymap]),
|
||||||
]
|
]
|
||||||
|
|
||||||
view.value = new EditorView({
|
view.value = new EditorView({
|
||||||
|
|||||||
Reference in New Issue
Block a user