mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
ui: upgrade monaco-editor
This commit is contained in:
6 files changed
+17
-6
No files matched your search
@@ -97,6 +97,7 @@ export default class Editor extends DOMAttachedObject {
|
||||
overviewRulerLanes: 0,
|
||||
overviewRulerBorder: false,
|
||||
fontFamily: UserContext.codeFontFamily,
|
||||
fontLigatures: '',
|
||||
unicodeHighlight: {
|
||||
ambiguousCharacters: language !== 'markdown',
|
||||
},
|
||||
|
||||
@@ -17,11 +17,11 @@ function emoji(range) {
|
||||
function qqEmoji(range) {
|
||||
return qface.data.flatMap((i) => {
|
||||
const url = qface.getUrl(i.QSid, 'https://qq-face.vercel.app');
|
||||
return i.Input.map((input) => ({
|
||||
return [i.QDes.substring(1), ...(i.Input || [])].map((input) => ({
|
||||
label: `/${input}`,
|
||||
kind: monaco.languages.CompletionItemKind.Keyword,
|
||||
documentation: { value: ``, isTrusted: true },
|
||||
insertText: `![${i.Input[0]}](${url} =32x32) `,
|
||||
insertText: `![${i.Input ? i.Input[0] : i.QDes.substring(1)}](${url} =32x32) `,
|
||||
range,
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { setDiagnosticsOptions } from 'monaco-yaml';
|
||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import { configureMonacoYaml } from 'monaco-yaml';
|
||||
import problemConfigSchema from '../schema/problemconfig';
|
||||
|
||||
setDiagnosticsOptions({
|
||||
configureMonacoYaml(monaco, {
|
||||
validate: true,
|
||||
enableSchemaRequest: true,
|
||||
hover: true,
|
||||
|
||||
@@ -18,6 +18,14 @@ export function localize(path, message, ...args) {
|
||||
return format(CURRENT_LOCALE_DATA[path.key || path] || message, args);
|
||||
}
|
||||
|
||||
export function localize2(data, message, ...args) {
|
||||
const original = localize(message, args);
|
||||
return {
|
||||
value: original,
|
||||
original,
|
||||
};
|
||||
}
|
||||
|
||||
export function setLocaleData(data) {
|
||||
CURRENT_LOCALE_DATA = Object.assign(...Object.values(data));
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ export default connect((state: any) => ({
|
||||
glyphMargin: true,
|
||||
lightbulb: { enabled: true },
|
||||
model: this.model,
|
||||
fontLigatures: '',
|
||||
};
|
||||
this.editor = monaco.editor.create(this.containerElement, config);
|
||||
registerAction(this.editor, this.model);
|
||||
|
||||
Reference in new issue
Block a user