fix: rules

This commit is contained in:
Gabe Yuan
2024-03-17 11:35:43 +08:00
parent 14b5ba9c4c
commit 61ef5df559
2 changed files with 10 additions and 27 deletions

View File

@@ -7,6 +7,7 @@ import Alert from "@mui/material/Alert";
import {
GLOBAL_KEY,
DEFAULT_RULE,
GLOBLA_RULE,
OPT_LANGS_FROM,
OPT_LANGS_TO,
OPT_TRANS_ALL,
@@ -56,7 +57,10 @@ import UploadButton from "./UploadButton";
import { FIXER_ALL } from "../../libs/webfix";
function RuleFields({ rule, rules, setShow, setKeyword }) {
const initFormValues = { ...DEFAULT_RULE, ...(rule || {}) };
const initFormValues = {
...(rule?.pattern === "*" ? GLOBLA_RULE : DEFAULT_RULE),
...(rule || {}),
};
const editMode = !!rule;
const i18n = useI18n();