From 03cddc00b2694866cfa8d9934e94392202528cf4 Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 7 May 2021 23:14:34 +0800 Subject: [PATCH] =?UTF-8?q?ui:=20=E4=BC=98=E5=8C=96=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hydrooj/package.json | 2 +- packages/hydrooj/setting.yaml | 19 +++++++++++-------- .../components/editor/cmeditor.page.js | 6 ++++-- .../ui-default/components/editor/index.js | 6 ++++++ packages/ui-default/package.json | 2 +- .../ui-default/templates/components/form.html | 2 +- .../templates/partials/setting.html | 3 ++- 7 files changed, 26 insertions(+), 14 deletions(-) diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 0b951f2b..d464a30c 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.25.1", + "version": "2.25.2", "bin": "bin/hydrooj.js", "main": "dist/loader.js", "typings": "dist/loader.d.ts", diff --git a/packages/hydrooj/setting.yaml b/packages/hydrooj/setting.yaml index dcfabbcf..88bbfac6 100644 --- a/packages/hydrooj/setting.yaml +++ b/packages/hydrooj/setting.yaml @@ -3,14 +3,17 @@ langs: desc: Code language settings default: __hint__: - - All keys started with _ will be ignored - - Entries named like [foo], [foo].[bar] [foo].[baz] will be merged into one category. - - A entry named [foo].[bar] will inhert all options defined in entry [foo] if not overwritten - - code_file option defaults to foo.[name] - - highlight option defaults to [name] - - if highlight option was set, monaco option defaults to [highlight], otherwise defaults to [name] - - Compile step will be ignored if compile option was not set - - Key marked with a ? means the option is optional + - ~ All keys starting with _ will be ignored + - ~ Entries named like [foo], [foo].[bar] [foo].[baz] + - will be merged into one category. + - ~ A entry named [foo].[bar] will inhert all options + - defined in entry [foo] if not overwritten + - ~ code_file option defaults to foo.[name] + - ~ highlight option defaults to [name] + - ~ if highlight option was set, monaco option defaults + - to [highlight], otherwise defaults to [name] + - ~ Compiling be be ignored if compile option wasn't set + - ~ Key marked with a ? means the option is optional - (name): compile?: Compile Command code_file?: Where to write code file when compiling diff --git a/packages/ui-default/components/editor/cmeditor.page.js b/packages/ui-default/components/editor/cmeditor.page.js index 8d4459c1..c59e7aed 100644 --- a/packages/ui-default/components/editor/cmeditor.page.js +++ b/packages/ui-default/components/editor/cmeditor.page.js @@ -3,10 +3,12 @@ import delay from 'vj/utils/delay'; import CmEditor from '.'; function runSubstitute($container) { - const selector = ['textarea[data-markdown]']; - $container.find(selector.join(', ')).get().forEach((element) => { + $container.find('textarea[data-markdown]').get().forEach((element) => { CmEditor.getOrConstruct($(element)); }); + $container.find('textarea[data-yaml]').get().forEach((element) => { + CmEditor.getOrConstruct($(element), { language: 'yaml' }); + }); } const cmEditorPage = new AutoloadPage('cmEditorPage', () => { diff --git a/packages/ui-default/components/editor/index.js b/packages/ui-default/components/editor/index.js index 66c84a2a..85a4d031 100644 --- a/packages/ui-default/components/editor/index.js +++ b/packages/ui-default/components/editor/index.js @@ -58,10 +58,16 @@ export default class Editor extends DOMAttachedObject { lightbulb: { enabled: true }, model: this.model, automaticLayout: true, + wordWarp: 'bounded', + minimap: { enabled: false }, + hideCursorInOverviewRuler: true, + overviewRulerLanes: 0, + overviewRulerBorder: false, }; if (autoResize) { cfg.scrollbar = { vertical: 'hidden', + horizontal: 'hidden', handleMouseWheel: false, }; cfg.scrollBeyondLastLine = false; diff --git a/packages/ui-default/package.json b/packages/ui-default/package.json index acd65013..4004fcb6 100644 --- a/packages/ui-default/package.json +++ b/packages/ui-default/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/ui-default", - "version": "4.8.2", + "version": "4.8.3", "author": "undefined ", "license": "AGPL-3.0", "main": "hydro.js", diff --git a/packages/ui-default/templates/components/form.html b/packages/ui-default/templates/components/form.html index 731183ac..d9019477 100644 --- a/packages/ui-default/templates/components/form.html +++ b/packages/ui-default/templates/components/form.html @@ -183,7 +183,7 @@ {% endmacro %} {% macro form_textarea(args) %} -{{ form_begin({columns:8}|assign(args)) }} +{{ form_begin({columns:10}|assign(args)) }} {{ textarea(args) }} {{ form_end(args) }} {% endmacro %} diff --git a/packages/ui-default/templates/partials/setting.html b/packages/ui-default/templates/partials/setting.html index 7744009b..3abd8dab 100644 --- a/packages/ui-default/templates/partials/setting.html +++ b/packages/ui-default/templates/partials/setting.html @@ -52,7 +52,8 @@ name:setting.key, value:'' if secret else (current[setting.key]|default(setting.value)), disabled:setting.disabled, - placeholder:_('(Not changed)') if secret else '' + placeholder:_('(Not changed)') if secret else '', + extra_attr: 'data-yaml' if setting.subType == 'yaml' else '' }) }} {% elif setting.type == 'markdown' %} {{ form.form_textarea({