ui: 优化系统设置页面

This commit is contained in:
undefined committed 2021-05-07 23:14:34 +08:00
1 parent 29c8fded62
commit 03cddc00b2
7 files changed
+26 -14

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "2.25.1", "version": "2.25.2",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "dist/loader.js", "main": "dist/loader.js",
"typings": "dist/loader.d.ts", "typings": "dist/loader.d.ts",
+11 -8
View File
@@ -3,14 +3,17 @@ langs:
desc: Code language settings desc: Code language settings
default: default:
__hint__: __hint__:
- All keys started with _ will be ignored - ~ All keys starting with _ will be ignored
- Entries named like [foo], [foo].[bar] [foo].[baz] will be merged into one category. - ~ Entries named like [foo], [foo].[bar] [foo].[baz]
- A entry named [foo].[bar] will inhert all options defined in entry [foo] if not overwritten - will be merged into one category.
- code_file option defaults to foo.[name] - ~ A entry named [foo].[bar] will inhert all options
- highlight option defaults to [name] - defined in entry [foo] if not overwritten
- if highlight option was set, monaco option defaults to [highlight], otherwise defaults to [name] - ~ code_file option defaults to foo.[name]
- Compile step will be ignored if compile option was not set - ~ highlight option defaults to [name]
- Key marked with a ? means the option is optional - ~ 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): - (name):
compile?: Compile Command compile?: Compile Command
code_file?: Where to write code file when compiling code_file?: Where to write code file when compiling
@@ -3,10 +3,12 @@ import delay from 'vj/utils/delay';
import CmEditor from '.'; import CmEditor from '.';
function runSubstitute($container) { function runSubstitute($container) {
const selector = ['textarea[data-markdown]']; $container.find('textarea[data-markdown]').get().forEach((element) => {
$container.find(selector.join(', ')).get().forEach((element) => {
CmEditor.getOrConstruct($(element)); CmEditor.getOrConstruct($(element));
}); });
$container.find('textarea[data-yaml]').get().forEach((element) => {
CmEditor.getOrConstruct($(element), { language: 'yaml' });
});
} }
const cmEditorPage = new AutoloadPage('cmEditorPage', () => { const cmEditorPage = new AutoloadPage('cmEditorPage', () => {
@@ -58,10 +58,16 @@ export default class Editor extends DOMAttachedObject {
lightbulb: { enabled: true }, lightbulb: { enabled: true },
model: this.model, model: this.model,
automaticLayout: true, automaticLayout: true,
wordWarp: 'bounded',
minimap: { enabled: false },
hideCursorInOverviewRuler: true,
overviewRulerLanes: 0,
overviewRulerBorder: false,
}; };
if (autoResize) { if (autoResize) {
cfg.scrollbar = { cfg.scrollbar = {
vertical: 'hidden', vertical: 'hidden',
horizontal: 'hidden',
handleMouseWheel: false, handleMouseWheel: false,
}; };
cfg.scrollBeyondLastLine = false; cfg.scrollBeyondLastLine = false;
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.8.2", "version": "4.8.3",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "hydro.js", "main": "hydro.js",
@@ -183,7 +183,7 @@
{% endmacro %} {% endmacro %}
{% macro form_textarea(args) %} {% macro form_textarea(args) %}
{{ form_begin({columns:8}|assign(args)) }} {{ form_begin({columns:10}|assign(args)) }}
{{ textarea(args) }} {{ textarea(args) }}
{{ form_end(args) }} {{ form_end(args) }}
{% endmacro %} {% endmacro %}
@@ -52,7 +52,8 @@
name:setting.key, name:setting.key,
value:'' if secret else (current[setting.key]|default(setting.value)), value:'' if secret else (current[setting.key]|default(setting.value)),
disabled:setting.disabled, 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' %} {% elif setting.type == 'markdown' %}
{{ form.form_textarea({ {{ form.form_textarea({