ui: change default editor mode to sv

This commit is contained in:
undefined committed 2022-02-25 22:36:45 +08:00
1 parent e80e8815cb
commit f4dbce5a76
4 files changed
+20 -8

No files matched your search

+11 -1
View File
@@ -1,4 +1,5 @@
import _ from 'lodash'; import _ from 'lodash';
import Notification from 'vj/components/notification';
import DOMAttachedObject from 'vj/components/DOMAttachedObject'; import DOMAttachedObject from 'vj/components/DOMAttachedObject';
export const config = { export const config = {
@@ -168,7 +169,16 @@ export default class Editor extends DOMAttachedObject {
this.vditor = new Vditor(ele, { this.vditor = new Vditor(ele, {
...config, ...config,
...this.options, ...this.options,
after: () => resolve(null), after: () => {
const pos = $(ele).find('button[data-mode="sv"]').get();
const button = $('<button data-mode="monaco">Monaco Editor</button>');
button.on('click', (e) => {
Notification.info('You can select this in PreferenceSettings');
e.preventDefault();
});
button.insertAfter(pos);
resolve(null);
},
input(v) { input(v) {
$dom.val(v); $dom.val(v);
$dom.text(v); $dom.text(v);
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.32.8", "version": "4.32.9",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "hydro.js", "main": "hydro.js",
+1 -1
View File
@@ -54,7 +54,7 @@ preferredEditorType:
monaco: Monaco Editor monaco: Monaco Editor
family: markdown family: markdown
category: preference category: preference
value: monaco value: sv
monacoTheme: monacoTheme:
type: type:
vs-dark: VS Dark vs-dark: VS Dark
@@ -6,7 +6,7 @@
<dt>{{ _('Code blocks') }}</dt> <dt>{{ _('Code blocks') }}</dt>
<dd><pre>```c++ <dd><pre>```c++
int main() { int main() {
return 0; return 0;
} }
```</pre></dd> ```</pre></dd>
<dt>{{ _('Inline formulas') }}</dt> <dt>{{ _('Inline formulas') }}</dt>
@@ -20,13 +20,15 @@ return 0;
<dt>{{ _('Images') }}</dt> <dt>{{ _('Images') }}</dt>
<dd><pre>![{{ _('Description') }}](https://...)</pre></dd> <dd><pre>![{{ _('Description') }}](https://...)</pre></dd>
<dt>{{ _('Images With Size') }}</dt> <dt>{{ _('Images With Size') }}</dt>
<dd><pre>![{{ _('Description') }}](url = 100x100)</pre></dd> <dd><pre>![{{ _('Description') }}](url =100x100)</pre></dd>
<dt>{{ _('Footnote') }}</dt> <dt>{{ _('Footnote') }}</dt>
<dd><pre>Here is a reference[^1]. <dd><pre>Here is a ref[^1].
[^1]: Here is the footnote.</pre></dd> [^1]: And the footnote.</pre></dd>
<dt>{{ _('Videos') }}</dt> <dt>{{ _('Videos') }}</dt>
<dd><pre>@[video](https://.../file.mp4)</pre></dd> <dd><pre>@[video](https://.../a.mp4)</pre></dd>
<dt>{{ _('Mention')}}</dt>
<dd><pre>@[](/user/uid)</pre></dd>
</dl> </dl>
<h2>{{ _('Learn More') }}</h2> <h2>{{ _('Learn More') }}</h2>
<ul> <ul>