fix: 修复 removeHTMLTag 可能出现的数据问题 (#2843)

This commit is contained in:
RickCole 2021-11-03 18:21:30 +08:00 committed by GitHub
parent f1b2a5cd33
commit 386c1de082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -507,7 +507,6 @@ export function isDisabled(
);
}
export function hasAbility(
schema: any,
ability: string,
@ -1618,7 +1617,7 @@ export function detectPropValueChanged<
// 去掉字符串中的 html 标签,不完全准确但效率比较高
export function removeHTMLTag(str: string) {
return str.replace(/<\/?[^>]+(>|$)/g, '');
return typeof str === 'string' ? str.replace(/<\/?[^>]+(>|$)/g, '') : str;
}
/**