ui: auto update editor height

This commit is contained in:
undefined committed 2021-05-06 13:44:09 +08:00
1 parent 58dca1d7bf
commit 2794a866c2
3 files changed
+6 -5

No files matched your search

@@ -37,7 +37,7 @@ export default class Editor extends DOMAttachedObject {
async initMonaco() {
const monaco = await import('monaco-editor/esm/vs/editor/editor.api');
const { $dom } = this;
const hasFocus = $dom.is(':focus');
const hasFocus = $dom.is(':focus') || $dom.hasClass('autofocus');
const origin = $dom.get(0);
const ele = document.createElement('div');
$(ele).width('100%');
@@ -103,12 +103,13 @@ export default class Editor extends DOMAttachedObject {
});
this.isValid = true;
if (hasFocus) this.focus();
updateEditorHeight();
}
async initVditor() {
const { default: Vditor } = await import('vditor');
const { $dom } = this;
const hasFocus = $dom.is(':focus');
const hasFocus = $dom.is(':focus') || $dom.hasClass('autofocus');
const origin = $dom.get(0);
const ele = document.createElement('div');
const value = $dom.val();