mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: auto update editor height
This commit is contained in:
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() {
|
async initMonaco() {
|
||||||
const monaco = await import('monaco-editor/esm/vs/editor/editor.api');
|
const monaco = await import('monaco-editor/esm/vs/editor/editor.api');
|
||||||
const { $dom } = this;
|
const { $dom } = this;
|
||||||
const hasFocus = $dom.is(':focus');
|
const hasFocus = $dom.is(':focus') || $dom.hasClass('autofocus');
|
||||||
const origin = $dom.get(0);
|
const origin = $dom.get(0);
|
||||||
const ele = document.createElement('div');
|
const ele = document.createElement('div');
|
||||||
$(ele).width('100%');
|
$(ele).width('100%');
|
||||||
@@ -103,12 +103,13 @@ export default class Editor extends DOMAttachedObject {
|
|||||||
});
|
});
|
||||||
this.isValid = true;
|
this.isValid = true;
|
||||||
if (hasFocus) this.focus();
|
if (hasFocus) this.focus();
|
||||||
|
updateEditorHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
async initVditor() {
|
async initVditor() {
|
||||||
const { default: Vditor } = await import('vditor');
|
const { default: Vditor } = await import('vditor');
|
||||||
const { $dom } = this;
|
const { $dom } = this;
|
||||||
const hasFocus = $dom.is(':focus');
|
const hasFocus = $dom.is(':focus') || $dom.hasClass('autofocus');
|
||||||
const origin = $dom.get(0);
|
const origin = $dom.get(0);
|
||||||
const ele = document.createElement('div');
|
const ele = document.createElement('div');
|
||||||
const value = $dom.val();
|
const value = $dom.val();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/ui-default",
|
"name": "@hydrooj/ui-default",
|
||||||
"version": "4.7.0",
|
"version": "4.7.1",
|
||||||
"author": "undefined <i@undefined.moe>",
|
"author": "undefined <i@undefined.moe>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"main": "hydro.js",
|
"main": "hydro.js",
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ export default async function readYamlCases(cfg: Record<string, any> = {}, check
|
|||||||
}
|
}
|
||||||
if (cfg.outputs) {
|
if (cfg.outputs) {
|
||||||
config.type = 'submit_answer';
|
config.type = 'submit_answer';
|
||||||
} else if (cfg.cases) {
|
} else if (cfg.cases?.length) {
|
||||||
config.subtasks = [{
|
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'),
|
time: parseTimeMS(cfg.time || '1s'),
|
||||||
memory: parseMemoryMB(cfg.memory || '256m'),
|
memory: parseMemoryMB(cfg.memory || '256m'),
|
||||||
cases: [],
|
cases: [],
|
||||||
|
|||||||
Reference in new issue
Block a user