mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
ui: drop monacoTheme setting
This commit is contained in:
3 files changed
+7
-10
No files matched your search
@@ -3,7 +3,7 @@ import { nanoid } from 'nanoid';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
import DOMAttachedObject from 'vj/components/DOMAttachedObject';
|
||||
import { i18n } from 'vj/utils';
|
||||
import { getTheme, i18n } from 'vj/utils';
|
||||
import uploadFiles from '../upload';
|
||||
|
||||
interface MonacoOptions {
|
||||
@@ -40,7 +40,7 @@ export default class Editor extends DOMAttachedObject {
|
||||
const { load } = await import('vj/components/monaco/loader');
|
||||
const {
|
||||
onChange, language = 'markdown',
|
||||
theme = UserContext.monacoTheme || 'vs-light',
|
||||
theme = `vs-${getTheme()}`,
|
||||
model = `file://model-${Math.random().toString(16)}`,
|
||||
autoResize = true, autoLayout = true,
|
||||
hide = [], lineNumbers = 'on',
|
||||
@@ -170,7 +170,7 @@ export default class Editor extends DOMAttachedObject {
|
||||
codeStyleReverse={false}
|
||||
ref={renderCallback}
|
||||
modelValue={val}
|
||||
theme={['light', 'dark'].includes(UserContext.theme) ? UserContext.theme : 'light'}
|
||||
theme={getTheme()}
|
||||
noMermaid
|
||||
noPrettier
|
||||
autoDetectCode
|
||||
|
||||
@@ -48,13 +48,6 @@ preferredEditorType:
|
||||
family: markdown
|
||||
category: preference
|
||||
value: sv
|
||||
monacoTheme:
|
||||
type:
|
||||
vs-dark: VS Dark
|
||||
vs-light: VS Light
|
||||
category: preference
|
||||
value: vs-light
|
||||
family: markdown
|
||||
theme:
|
||||
type:
|
||||
light: Light
|
||||
|
||||
@@ -200,6 +200,10 @@ export async function setTemporaryViewTransitionNames(entries, vtPromise: Promis
|
||||
}
|
||||
}
|
||||
|
||||
export function getTheme(): 'dark' | 'light' {
|
||||
return ['light', 'dark'].includes(UserContext.theme) ? UserContext.theme : 'light';
|
||||
}
|
||||
|
||||
Object.assign(window.Hydro.utils, {
|
||||
i18n,
|
||||
rawHtml,
|
||||
|
||||
Reference in new issue
Block a user