mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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 React from 'react';
|
||||||
import ReactDOM from 'react-dom/client';
|
import ReactDOM from 'react-dom/client';
|
||||||
import DOMAttachedObject from 'vj/components/DOMAttachedObject';
|
import DOMAttachedObject from 'vj/components/DOMAttachedObject';
|
||||||
import { i18n } from 'vj/utils';
|
import { getTheme, i18n } from 'vj/utils';
|
||||||
import uploadFiles from '../upload';
|
import uploadFiles from '../upload';
|
||||||
|
|
||||||
interface MonacoOptions {
|
interface MonacoOptions {
|
||||||
@@ -40,7 +40,7 @@ export default class Editor extends DOMAttachedObject {
|
|||||||
const { load } = await import('vj/components/monaco/loader');
|
const { load } = await import('vj/components/monaco/loader');
|
||||||
const {
|
const {
|
||||||
onChange, language = 'markdown',
|
onChange, language = 'markdown',
|
||||||
theme = UserContext.monacoTheme || 'vs-light',
|
theme = `vs-${getTheme()}`,
|
||||||
model = `file://model-${Math.random().toString(16)}`,
|
model = `file://model-${Math.random().toString(16)}`,
|
||||||
autoResize = true, autoLayout = true,
|
autoResize = true, autoLayout = true,
|
||||||
hide = [], lineNumbers = 'on',
|
hide = [], lineNumbers = 'on',
|
||||||
@@ -170,7 +170,7 @@ export default class Editor extends DOMAttachedObject {
|
|||||||
codeStyleReverse={false}
|
codeStyleReverse={false}
|
||||||
ref={renderCallback}
|
ref={renderCallback}
|
||||||
modelValue={val}
|
modelValue={val}
|
||||||
theme={['light', 'dark'].includes(UserContext.theme) ? UserContext.theme : 'light'}
|
theme={getTheme()}
|
||||||
noMermaid
|
noMermaid
|
||||||
noPrettier
|
noPrettier
|
||||||
autoDetectCode
|
autoDetectCode
|
||||||
|
|||||||
@@ -48,13 +48,6 @@ preferredEditorType:
|
|||||||
family: markdown
|
family: markdown
|
||||||
category: preference
|
category: preference
|
||||||
value: sv
|
value: sv
|
||||||
monacoTheme:
|
|
||||||
type:
|
|
||||||
vs-dark: VS Dark
|
|
||||||
vs-light: VS Light
|
|
||||||
category: preference
|
|
||||||
value: vs-light
|
|
||||||
family: markdown
|
|
||||||
theme:
|
theme:
|
||||||
type:
|
type:
|
||||||
light: Light
|
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, {
|
Object.assign(window.Hydro.utils, {
|
||||||
i18n,
|
i18n,
|
||||||
rawHtml,
|
rawHtml,
|
||||||
|
|||||||
Reference in new issue
Block a user