mirror of
https://github.com/langgenius/dify.git
synced 2026-03-27 15:09:57 +08:00
26 lines
609 B
TypeScript
26 lines
609 B
TypeScript
import type { InitOptions } from 'modern-monaco'
|
|
|
|
export const LIGHT_THEME_ID = 'light-plus'
|
|
export const DARK_THEME_ID = 'dark-plus'
|
|
|
|
const DEFAULT_INIT_OPTIONS: InitOptions = {
|
|
defaultTheme: DARK_THEME_ID,
|
|
themes: [
|
|
LIGHT_THEME_ID,
|
|
DARK_THEME_ID,
|
|
],
|
|
}
|
|
|
|
let monacoInitPromise: Promise<typeof import('modern-monaco/editor-core') | null> | null = null
|
|
|
|
export const initMonaco = async () => {
|
|
if (!monacoInitPromise) {
|
|
monacoInitPromise = (async () => {
|
|
const { init } = await import('modern-monaco')
|
|
return init(DEFAULT_INIT_OPTIONS)
|
|
})()
|
|
}
|
|
|
|
return monacoInitPromise
|
|
}
|