mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:58:07 +08:00
chore: renderTextByKeyword过滤掉非法输入 (#7319)
This commit is contained in:
parent
340bb31d73
commit
a4aaac2d19
@ -279,6 +279,10 @@ export function getStyleNumber(element: HTMLElement, styleName: string) {
|
||||
|
||||
/** 根据关键字高亮显示文本内容 */
|
||||
export function renderTextByKeyword(rendererText: string, curKeyword: string) {
|
||||
if (!rendererText || typeof rendererText !== 'string') {
|
||||
return rendererText;
|
||||
}
|
||||
|
||||
if (curKeyword && ~rendererText.indexOf(curKeyword)) {
|
||||
const keywordStartIndex = rendererText.indexOf(curKeyword);
|
||||
const keywordEndIndex = keywordStartIndex + curKeyword.length;
|
||||
|
Loading…
Reference in New Issue
Block a user