feat: test item, when icon is svg, add svg format check
This commit is contained in:
@@ -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 };
|
||||||
|
|||||||
Reference in New Issue
Block a user