Custom IAL attr name support more symbol (#8172)

* 🎨 custom ial key support '_' symbol

* Revert "🎨 custom ial key support '_' symbol"

This reverts commit 50883cb4e1.

* 🎨 custom ial key support `_` and `.` symbol

* Update commonMenuItem.ts
This commit is contained in:
颖逸 2023-05-06 15:32:07 +08:00 committed by GitHub
parent 9f6983cd09
commit 825822ec93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -310,7 +310,7 @@ export const openFileAttr = (attrs: IObject, id: string, focusName = "bookmark")
name = "custom-" + (item.parentElement.querySelector(".b3-text-field") as HTMLInputElement).value;
}
if (item.value.trim()) {
if (!/^[0-9a-zA-Z\-]*$/.test(name.replace("custom-", "")) || name === "custom-") {
if (!/^custom-[_.\-0-9a-zA-Z]+$/.test(name)) {
errorTip += name.replace("custom-", "") + ", ";
return;
}
@ -381,7 +381,7 @@ export const openAttr = (nodeElement: Element, protyle: IProtyle, focusName = "b
name = "custom-" + (item.parentElement.querySelector(".b3-text-field") as HTMLInputElement).value;
}
if (item.value.trim()) {
if (!/^[0-9a-zA-Z\-]*$/.test(name.replace("custom-", "")) || name === "custom-") {
if (!/^custom-[_.\-0-9a-zA-Z]+$/.test(name)) {
errorTip += name.replace("custom-", "") + ", ";
return;
}