mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-06 05:03:45 +08:00
feat: test item, when icon is svg, add svg format check
This commit is contained in:
parent
0b8f24a92e
commit
0e1e54aff4
@ -67,6 +67,16 @@ export const TestViewer = forwardRef<TestViewerRef, Props>((props, ref) => {
|
|||||||
let newList;
|
let newList;
|
||||||
let uid;
|
let uid;
|
||||||
|
|
||||||
|
if (form.icon && form.icon.startsWith("<svg")) {
|
||||||
|
const doc = new DOMParser().parseFromString(
|
||||||
|
form.icon,
|
||||||
|
"image/svg+xml"
|
||||||
|
);
|
||||||
|
if (doc.querySelector("parsererror")) {
|
||||||
|
throw new Error("`Icon`svg format error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (openType === "new") {
|
if (openType === "new") {
|
||||||
uid = nanoid();
|
uid = nanoid();
|
||||||
const item = { ...form, uid };
|
const item = { ...form, uid };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user