mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
fix editor theme
This commit is contained in:
parent
eeb3f7b30a
commit
1515788458
@ -39,8 +39,8 @@ const monacoInitialization = (): void => {
|
||||
}
|
||||
|
||||
export const BaseEditor: React.FC<Props> = (props) => {
|
||||
const { theme } = useTheme()
|
||||
|
||||
const { theme, systemTheme } = useTheme()
|
||||
const trueTheme = theme === 'system' ? systemTheme : theme
|
||||
const { value, readOnly = false, language, onChange } = props
|
||||
|
||||
const editorRef = useRef<monaco.editor.IStandaloneCodeEditor>()
|
||||
@ -73,7 +73,7 @@ export const BaseEditor: React.FC<Props> = (props) => {
|
||||
language={language}
|
||||
value={value}
|
||||
height="100%"
|
||||
theme={theme?.includes('light') ? 'vs' : 'vs-dark'}
|
||||
theme={trueTheme?.includes('light') ? 'vs' : 'vs-dark'}
|
||||
options={{
|
||||
tabSize: ['yaml', 'javascript', 'json'].includes(language) ? 2 : 4, // 根据语言类型设置缩进大小
|
||||
minimap: {
|
||||
|
||||
@ -30,7 +30,7 @@ const EditFileModal: React.FC<Props> = (props) => {
|
||||
scrollBehavior="inside"
|
||||
>
|
||||
<ModalContent className="h-full w-[calc(100%-100px)]">
|
||||
<ModalHeader className="flex">
|
||||
<ModalHeader className="flex pb-0">
|
||||
编辑覆写{language === 'javascript' ? '脚本' : '配置'}
|
||||
</ModalHeader>
|
||||
<ModalBody className="h-full">
|
||||
@ -40,11 +40,12 @@ const EditFileModal: React.FC<Props> = (props) => {
|
||||
onChange={(value) => setCurrData(value)}
|
||||
/>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button variant="light" onPress={onClose}>
|
||||
<ModalFooter className="pt-0">
|
||||
<Button size="sm" variant="light" onPress={onClose}>
|
||||
取消
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
color="primary"
|
||||
onPress={async () => {
|
||||
try {
|
||||
|
||||
@ -31,7 +31,7 @@ const EditFileModal: React.FC<Props> = (props) => {
|
||||
scrollBehavior="inside"
|
||||
>
|
||||
<ModalContent className="h-full w-[calc(100%-100px)]">
|
||||
<ModalHeader className="flex">
|
||||
<ModalHeader className="flex pb-0">
|
||||
<div className="flex justify-start">
|
||||
<div className="flex items-center">编辑订阅</div>
|
||||
<small className="ml-2 text-default-500">
|
||||
@ -53,11 +53,12 @@ const EditFileModal: React.FC<Props> = (props) => {
|
||||
<ModalBody className="h-full">
|
||||
<BaseEditor language="yaml" value={currData} onChange={(value) => setCurrData(value)} />
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button variant="light" onPress={onClose}>
|
||||
<ModalFooter className="pt-0">
|
||||
<Button size="sm" variant="light" onPress={onClose}>
|
||||
取消
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
color="primary"
|
||||
onPress={async () => {
|
||||
await setProfileStr(id, currData)
|
||||
|
||||
@ -28,12 +28,12 @@ const ConfigViewer: React.FC<Props> = (props) => {
|
||||
scrollBehavior="inside"
|
||||
>
|
||||
<ModalContent className="h-full w-[calc(100%-100px)]">
|
||||
<ModalHeader className="flex">当前运行时配置</ModalHeader>
|
||||
<ModalHeader className="flex pb-0">当前运行时配置</ModalHeader>
|
||||
<ModalBody className="h-full">
|
||||
<BaseEditor language="yaml" value={currData} readOnly={true} />
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button variant="light" onPress={onClose}>
|
||||
<ModalFooter className="pt-0">
|
||||
<Button size="sm" variant="light" onPress={onClose}>
|
||||
关闭
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
|
||||
@ -21,7 +21,7 @@ const PacEditorViewer: React.FC<Props> = (props) => {
|
||||
scrollBehavior="inside"
|
||||
>
|
||||
<ModalContent className="h-full w-[calc(100%-100px)]">
|
||||
<ModalHeader className="flex">编辑PAC脚本</ModalHeader>
|
||||
<ModalHeader className="flex pb-0">编辑PAC脚本</ModalHeader>
|
||||
<ModalBody className="h-full">
|
||||
<BaseEditor
|
||||
language="javascript"
|
||||
@ -29,11 +29,11 @@ const PacEditorViewer: React.FC<Props> = (props) => {
|
||||
onChange={(value) => setCurrData(value || '')}
|
||||
/>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<Button variant="light" onPress={onCancel}>
|
||||
<ModalFooter className="pt-0">
|
||||
<Button size="sm" variant="light" onPress={onCancel}>
|
||||
取消
|
||||
</Button>
|
||||
<Button color="primary" onPress={() => onConfirm(currData)}>
|
||||
<Button size="sm" color="primary" onPress={() => onConfirm(currData)}>
|
||||
确认
|
||||
</Button>
|
||||
</ModalFooter>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user