fix(monaco): disable MUI Dialog focus enforcement for Monaco editor #5885

Closes #5885
This commit is contained in:
Slinetrac
2025-12-20 16:08:07 +08:00
parent 6f61759a39
commit 5afe11e55b
7 changed files with 37 additions and 5 deletions

View File

@@ -3,6 +3,7 @@
### 🐞 修复问题
- 修复 macOS 有线网络 DNS 劫持失败
- 修复 Monaco 编辑器内右键菜单显示异常
<details>
<summary><strong> ✨ 新增功能 </strong></summary>

View File

@@ -15,6 +15,7 @@ interface Props {
open: boolean;
okBtn?: ReactNode;
cancelBtn?: ReactNode;
disableEnforceFocus?: boolean;
disableOk?: boolean;
disableCancel?: boolean;
disableFooter?: boolean;
@@ -37,6 +38,7 @@ export const BaseDialog: React.FC<Props> = ({
children,
okBtn,
cancelBtn,
disableEnforceFocus,
contentSx,
disableCancel,
disableOk,
@@ -47,7 +49,11 @@ export const BaseDialog: React.FC<Props> = ({
onClose,
}) => {
return (
<Dialog open={open} onClose={onClose}>
<Dialog
open={open}
onClose={onClose}
disableEnforceFocus={disableEnforceFocus}
>
<DialogTitle>{title}</DialogTitle>
<DialogContent sx={contentSx}>{children}</DialogContent>

View File

@@ -382,7 +382,13 @@ export const EditorViewer = <T extends Language>(props: Props<T>) => {
}, []);
return (
<Dialog open={open} onClose={onClose} maxWidth="xl" fullWidth>
<Dialog
open={open}
onClose={onClose}
maxWidth="xl"
fullWidth
disableEnforceFocus
>
<DialogTitle>{resolvedTitle}</DialogTitle>
<DialogContent

View File

@@ -427,7 +427,13 @@ export const GroupsEditorViewer = (props: Props) => {
});
return (
<Dialog open={open} onClose={onClose} maxWidth="xl" fullWidth>
<Dialog
open={open}
onClose={onClose}
maxWidth="xl"
fullWidth
disableEnforceFocus={!visualization}
>
<DialogTitle>
{
<Box display="flex" justifyContent="space-between">

View File

@@ -272,7 +272,13 @@ export const ProxiesEditorViewer = (props: Props) => {
});
return (
<Dialog open={open} onClose={onClose} maxWidth="xl" fullWidth>
<Dialog
open={open}
onClose={onClose}
maxWidth="xl"
fullWidth
disableEnforceFocus={!visualization}
>
<DialogTitle>
{
<Box display="flex" justifyContent="space-between">

View File

@@ -506,7 +506,13 @@ export const RulesEditorViewer = (props: Props) => {
});
return (
<Dialog open={open} onClose={onClose} maxWidth="xl" fullWidth>
<Dialog
open={open}
onClose={onClose}
maxWidth="xl"
fullWidth
disableEnforceFocus={!visualization}
>
<DialogTitle>
{
<Box display="flex" justifyContent="space-between">

View File

@@ -612,6 +612,7 @@ export function DnsViewer({ ref }: { ref?: Ref<DialogRef> }) {
return (
<BaseDialog
open={open}
disableEnforceFocus={!visualization}
title={
<Box display="flex" justifyContent="space-between" alignItems="center">
{t("settings.modals.dns.dialog.title")}