guy 4 years ago
parent
commit
6f0e701f5c
  1. 8
      src/base/single/text.js
  2. 5
      src/base/tree/ztree/treeview.js

8
src/base/single/text.js

@ -144,13 +144,15 @@ BI.Text = BI.inherit(BI.Single, {
// 为textContext赋值为undefined时在ie和edge下会真的显示undefined
this.options.text = BI.isNotNull(text) ? text : "";
if (BI.isIE9Below()) {
this.text.element.html(BI.htmlEncode(this._getShowText()));
this.text.element.html(BI.htmlEncode(BI.Text.formatText(this._getShowText())));
return;
}
// textContent性能更好,并且原生防xss
this.text.element[0].textContent = this._getShowText();
this.text.element[0].textContent = BI.Text.formatText(this._getShowText());
BI.isKey(this.options.keyword) && this.doRedMark(this.options.keyword);
}
});
BI.Text.formatText = function (text) {
return text;
};
BI.shortcut("bi.text", BI.Text);

5
src/base/tree/ztree/treeview.js

@ -333,11 +333,12 @@ BI.TreeView = BI.inherit(BI.Pane, {
BI.each(ns, function (i, n) {
n.title = n.title || n.text || n.value;
n.isParent = n.isParent || n.parent;
n.value = n.value || n.text;
// 处理标红
if (BI.isKey(o.paras.keyword)) {
n.text = BI.$("<div>").__textKeywordMarked__(n.text, o.paras.keyword, n.py).html();
n.text = BI.$("<div>").__textKeywordMarked__(BI.Text.formatText(n.text + ""), o.paras.keyword, n.py).html();
} else {
n.text = BI.htmlEncode(n.text + "");
n.text = BI.htmlEncode(BI.Text.formatText(n.text + ""));
}
});
return nodes;

Loading…
Cancel
Save