fix: rules
This commit is contained in:
@@ -271,29 +271,8 @@ const RULES_MAP = {
|
|||||||
|
|
||||||
export const BUILTIN_RULES = Object.entries(RULES_MAP)
|
export const BUILTIN_RULES = Object.entries(RULES_MAP)
|
||||||
.sort((a, b) => a[0].localeCompare(b[0]))
|
.sort((a, b) => a[0].localeCompare(b[0]))
|
||||||
.map(
|
.map(([pattern, rule]) => ({
|
||||||
([
|
...DEFAULT_RULE,
|
||||||
pattern,
|
...rule,
|
||||||
{
|
pattern,
|
||||||
selector,
|
}));
|
||||||
keepSelector = "",
|
|
||||||
terms = "",
|
|
||||||
selectStyle = "",
|
|
||||||
parentStyle = "",
|
|
||||||
injectCss = "",
|
|
||||||
fixerSelector = "",
|
|
||||||
fixerFunc = GLOBAL_KEY,
|
|
||||||
},
|
|
||||||
]) => ({
|
|
||||||
...DEFAULT_RULE,
|
|
||||||
pattern,
|
|
||||||
selector,
|
|
||||||
keepSelector,
|
|
||||||
terms,
|
|
||||||
selectStyle,
|
|
||||||
parentStyle,
|
|
||||||
injectCss,
|
|
||||||
fixerSelector,
|
|
||||||
fixerFunc,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import Alert from "@mui/material/Alert";
|
|||||||
import {
|
import {
|
||||||
GLOBAL_KEY,
|
GLOBAL_KEY,
|
||||||
DEFAULT_RULE,
|
DEFAULT_RULE,
|
||||||
|
GLOBLA_RULE,
|
||||||
OPT_LANGS_FROM,
|
OPT_LANGS_FROM,
|
||||||
OPT_LANGS_TO,
|
OPT_LANGS_TO,
|
||||||
OPT_TRANS_ALL,
|
OPT_TRANS_ALL,
|
||||||
@@ -56,7 +57,10 @@ import UploadButton from "./UploadButton";
|
|||||||
import { FIXER_ALL } from "../../libs/webfix";
|
import { FIXER_ALL } from "../../libs/webfix";
|
||||||
|
|
||||||
function RuleFields({ rule, rules, setShow, setKeyword }) {
|
function RuleFields({ rule, rules, setShow, setKeyword }) {
|
||||||
const initFormValues = { ...DEFAULT_RULE, ...(rule || {}) };
|
const initFormValues = {
|
||||||
|
...(rule?.pattern === "*" ? GLOBLA_RULE : DEFAULT_RULE),
|
||||||
|
...(rule || {}),
|
||||||
|
};
|
||||||
const editMode = !!rule;
|
const editMode = !!rule;
|
||||||
|
|
||||||
const i18n = useI18n();
|
const i18n = useI18n();
|
||||||
|
|||||||
Reference in New Issue
Block a user