mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: support ctrl+enter
This commit is contained in:
1 parent
e67c1c333a
commit
16fcd80a00
4 files changed
+54
-38
No files matched your search
@@ -36,7 +36,7 @@ export default class Editor extends DOMAttachedObject {
|
||||
}
|
||||
|
||||
async initMonaco() {
|
||||
const { default: monaco } = await import('vj/components/monaco/index');
|
||||
const { default: monaco, registerAction } = await import('vj/components/monaco/index');
|
||||
const {
|
||||
onChange, language = 'markdown',
|
||||
theme = UserContext.monacoTheme || 'vs-light',
|
||||
@@ -95,16 +95,7 @@ export default class Editor extends DOMAttachedObject {
|
||||
cfg.scrollBeyondLastLine = false;
|
||||
}
|
||||
this.editor = monaco.editor.create(ele, cfg);
|
||||
this.editor.addAction({
|
||||
id: 'theme-dark',
|
||||
label: 'Use dark theme',
|
||||
run: () => monaco.editor.setTheme('vs-dark'),
|
||||
});
|
||||
this.editor.addAction({
|
||||
id: 'theme-light',
|
||||
label: 'Use light theme',
|
||||
run: () => monaco.editor.setTheme('vs-light'),
|
||||
});
|
||||
registerAction(this.editor, this.model, this.$dom);
|
||||
if (autoResize) {
|
||||
this.editor.onDidChangeModelDecorations(() => {
|
||||
updateEditorHeight(); // typing
|
||||
|
||||
Reference in new issue
Block a user