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();
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.7.0",
"version": "4.7.1",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",
+2 -2
View File
@@ -32,9 +32,9 @@ export default async function readYamlCases(cfg: Record<string, any> = {}, check
}
if (cfg.outputs) {
config.type = 'submit_answer';
} else if (cfg.cases) {
} else if (cfg.cases?.length) {
config.subtasks = [{
score: parseInt(cfg.score, 10) || Math.floor(100 / cfg.cases.length),
score: +cfg.score || Math.floor(100 / cfg.cases.length),
time: parseTimeMS(cfg.time || '1s'),
memory: parseMemoryMB(cfg.memory || '256m'),
cases: [],