Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(uniscript): fix dark theme support to ScriptEditorPanel (#5776)

白熱8d8acbaa4ab5
diff --git a/packages/design/src/components/input-number/InputNumber.tsx b/packages/design/src/components/input-number/InputNumber.tsx
index 984fa1c21b..efe2c0bb8c 100644
--- a/packages/design/src/components/input-number/InputNumber.tsx
+++ b/packages/design/src/components/input-number/InputNumber.tsx
@@ -348,6 +348,7 @@ export const InputNumber = forwardRef<HTMLInputElement, IInputNumberProps>(
univer-items-center univer-justify-center univer-border-none univer-bg-transparent
univer-p-0 univer-transition-colors
hover:univer-bg-gray-100
+ dark:!univer-text-white dark:hover:!univer-bg-gray-600
`}
type="button"
aria-label="increment"
@@ -363,7 +364,7 @@ export const InputNumber = forwardRef<HTMLInputElement, IInputNumberProps>(
univer-items-center univer-justify-center univer-border-none univer-bg-transparent
univer-p-0 univer-transition-colors
hover:univer-bg-gray-100
- dark:hover:!univer-bg-gray-700
+ dark:!univer-text-white dark:hover:!univer-bg-gray-600
`}
type="button"
aria-label="decrement"
diff --git a/packages/uniscript/src/views/components/ScriptEditorPanel.tsx b/packages/uniscript/src/views/components/ScriptEditorPanel.tsx
index 457b6739e1..8e6faaf2f2 100644
--- a/packages/uniscript/src/views/components/ScriptEditorPanel.tsx
+++ b/packages/uniscript/src/views/components/ScriptEditorPanel.tsx
@@ -16,7 +16,7 @@
import type { IDisposable, Nullable } from '@univerjs/core';
import type { MutableRefObject } from 'react';
-import { DisposableCollection, LocaleService, toDisposable } from '@univerjs/core';
+import { DisposableCollection, LocaleService, ThemeService, toDisposable } from '@univerjs/core';
import { Button, MessageType } from '@univerjs/design';
import { IMessageService, IShortcutService, useDependency } from '@univerjs/ui';
import { editor } from 'monaco-editor';
@@ -33,6 +33,7 @@ export function ScriptEditorPanel() {
const localeService = useDependency(LocaleService);
const shortcutService = useDependency(IShortcutService);
const editorService = useDependency(ScriptEditorService);
+ const themeService = useDependency(ThemeService);
useEffect(() => {
const containerElement = editorContainerRef.current;
@@ -46,6 +47,7 @@ export function ScriptEditorPanel() {
const monacoEditor = (monacoEditorRef.current = editor.create(containerElement, {
value: '',
language: 'javascript',
+ theme: themeService.darkMode ? 'vs-dark' : 'vs-light',
}));
resizeObserver = new ResizeObserver(() => {