mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: allow using html in markdown
This commit is contained in:
1 parent
9632b425d5
commit
5c745fff82
8 files changed
+151
-77
No files matched your search
@@ -59,7 +59,6 @@ export default class Editor extends DOMAttachedObject {
|
||||
lightbulb: { enabled: true },
|
||||
model: this.model,
|
||||
automaticLayout: true,
|
||||
wordWarp: 'bounded',
|
||||
minimap: { enabled: false },
|
||||
hideCursorInOverviewRuler: true,
|
||||
overviewRulerLanes: 0,
|
||||
@@ -71,6 +70,7 @@ export default class Editor extends DOMAttachedObject {
|
||||
horizontal: 'hidden',
|
||||
handleMouseWheel: false,
|
||||
};
|
||||
cfg.wordWrap = 'bounded';
|
||||
cfg.scrollBeyondLastLine = false;
|
||||
}
|
||||
this.editor = monaco.editor.create(ele, cfg);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
|
||||
monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
||||
noSemanticValidation: false,
|
||||
noSyntaxValidation: false,
|
||||
});
|
||||
monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
|
||||
target: monaco.languages.typescript.ScriptTarget.ES6,
|
||||
allowNonTsExtensions: true,
|
||||
});
|
||||
const libSource = [
|
||||
'declare function readline(): string;',
|
||||
'declare function print(content: string): void;',
|
||||
].join('\n');
|
||||
const libUri = 'ts:filename/basic.d.ts';
|
||||
monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
|
||||
monaco.editor.createModel(libSource, 'typescript', monaco.Uri.parse(libUri));
|
||||
monaco.languages.yaml.yamlDefaults.setDiagnosticsOptions({
|
||||
validate: true,
|
||||
enableSchemaRequest: true,
|
||||
hover: true,
|
||||
completion: true,
|
||||
schemas: [
|
||||
{
|
||||
uri: '/manage/system-schema.json',
|
||||
fileMatch: ['hydro://system/config.yaml'],
|
||||
},
|
||||
...window.Context.schemas,
|
||||
],
|
||||
});
|
||||
|
||||
export default monaco;
|
||||
@@ -1,7 +1,14 @@
|
||||
import { AutoloadPage } from 'vj/misc/Page';
|
||||
import Notification from 'vj/components/notification/index';
|
||||
import i18n from 'vj/utils/i18n';
|
||||
|
||||
export default new AutoloadPage('notificationPage', () => {
|
||||
export default new AutoloadPage('notificationPage', (pagename) => {
|
||||
const message = i18n(`Hint::Page::${pagename}`);
|
||||
const item = localStorage.getItem(`hint.${message}`);
|
||||
if (message !== `Hint::Page::${pagename}` && !item) {
|
||||
Notification.info(message, message.length * 500);
|
||||
localStorage.setItem(`hint.${message}`, true);
|
||||
}
|
||||
const text = new URL(window.location.href).searchParams.get('notification');
|
||||
if (text) Notification.success(text);
|
||||
});
|
||||
Reference in new issue
Block a user