mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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,
|
overviewRulerLanes: 0,
|
||||||
overviewRulerBorder: false,
|
overviewRulerBorder: false,
|
||||||
fontFamily: UserContext.codeFontFamily,
|
fontFamily: UserContext.codeFontFamily,
|
||||||
|
fontLigatures: '',
|
||||||
unicodeHighlight: {
|
unicodeHighlight: {
|
||||||
ambiguousCharacters: language !== 'markdown',
|
ambiguousCharacters: language !== 'markdown',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ function emoji(range) {
|
|||||||
function qqEmoji(range) {
|
function qqEmoji(range) {
|
||||||
return qface.data.flatMap((i) => {
|
return qface.data.flatMap((i) => {
|
||||||
const url = qface.getUrl(i.QSid, 'https://qq-face.vercel.app');
|
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}`,
|
label: `/${input}`,
|
||||||
kind: monaco.languages.CompletionItemKind.Keyword,
|
kind: monaco.languages.CompletionItemKind.Keyword,
|
||||||
documentation: { value: ``, isTrusted: true },
|
documentation: { value: ``, isTrusted: true },
|
||||||
insertText: `![${i.Input[0]}](${url} =32x32) `,
|
insertText: `![${i.Input ? i.Input[0] : i.QDes.substring(1)}](${url} =32x32) `,
|
||||||
range,
|
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';
|
import problemConfigSchema from '../schema/problemconfig';
|
||||||
|
|
||||||
setDiagnosticsOptions({
|
configureMonacoYaml(monaco, {
|
||||||
validate: true,
|
validate: true,
|
||||||
enableSchemaRequest: true,
|
enableSchemaRequest: true,
|
||||||
hover: true,
|
hover: true,
|
||||||
|
|||||||
@@ -18,6 +18,14 @@ export function localize(path, message, ...args) {
|
|||||||
return format(CURRENT_LOCALE_DATA[path.key || 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) {
|
export function setLocaleData(data) {
|
||||||
CURRENT_LOCALE_DATA = Object.assign(...Object.values(data));
|
CURRENT_LOCALE_DATA = Object.assign(...Object.values(data));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ export default connect((state: any) => ({
|
|||||||
glyphMargin: true,
|
glyphMargin: true,
|
||||||
lightbulb: { enabled: true },
|
lightbulb: { enabled: true },
|
||||||
model: this.model,
|
model: this.model,
|
||||||
|
fontLigatures: '',
|
||||||
};
|
};
|
||||||
this.editor = monaco.editor.create(this.containerElement, config);
|
this.editor = monaco.editor.create(this.containerElement, config);
|
||||||
registerAction(this.editor, this.model);
|
registerAction(this.editor, this.model);
|
||||||
|
|||||||
@@ -73,11 +73,11 @@
|
|||||||
"matchmedia-polyfill": "^0.3.2",
|
"matchmedia-polyfill": "^0.3.2",
|
||||||
"mini-css-extract-plugin": "^2.7.6",
|
"mini-css-extract-plugin": "^2.7.6",
|
||||||
"moment": "^2.29.4",
|
"moment": "^2.29.4",
|
||||||
"monaco-editor": "0.38.0",
|
"monaco-editor": "0.45.0",
|
||||||
"monaco-editor-nls": "^3.1.0",
|
"monaco-editor-nls": "^3.1.0",
|
||||||
"monaco-editor-webpack-plugin": "^7.1.0",
|
"monaco-editor-webpack-plugin": "^7.1.0",
|
||||||
"monaco-themes": "^0.4.4",
|
"monaco-themes": "^0.4.4",
|
||||||
"monaco-yaml": "^4.0.4",
|
"monaco-yaml": "^5.1.0",
|
||||||
"nanoid": "^5.0.4",
|
"nanoid": "^5.0.4",
|
||||||
"normalize.css": "^8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
"nprogress": "^0.2.0",
|
"nprogress": "^0.2.0",
|
||||||
|
|||||||
Reference in new issue
Block a user