From c06fe4199c937cde6305633a3ccc5860e88fa5fe Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 2 Apr 2020 09:06:55 +0800 Subject: [PATCH 1/5] =?UTF-8?q?REPORT-20059=20fix:=20textarea=E6=B0=B4?= =?UTF-8?q?=E5=8D=B0=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/editor/editor.textarea.js | 13 ++++++++----- src/base/single/label/abstract.label.js | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/base/single/editor/editor.textarea.js b/src/base/single/editor/editor.textarea.js index 59cd55ca1..e91f9df4a 100644 --- a/src/base/single/editor/editor.textarea.js +++ b/src/base/single/editor/editor.textarea.js @@ -33,7 +33,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { left: 4, right: 4, top: 4, - bottom: 8 + bottom: 4 }] }); @@ -86,7 +86,9 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { whiteSpace: "normal", text: o.watermark, invalid: o.invalid, - disabled: o.disabled + disabled: o.disabled, + hgap: 4, + vgap: 4 }); this.watermark.on(BI.TextButton.EVENT_CHANGE, function () { self.focus(); @@ -96,9 +98,10 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { element: this, items: [{ el: this.watermark, - left: 4, - top: 4, - right: 0 + left: 0, + top: 0, + right: 0, + bottom: 0 }] }); } else { diff --git a/src/base/single/label/abstract.label.js b/src/base/single/label/abstract.label.js index 3d6759e4b..a3954e094 100644 --- a/src/base/single/label/abstract.label.js +++ b/src/base/single/label/abstract.label.js @@ -324,6 +324,7 @@ BI.AbstractLabel = BI.inherit(BI.Single, { BI.createWidget({ type: adaptLayout, element: this, + scrollable: o.whiteSpace === "normal", items: [this.text] }); }, From a94c1a7b5998b6836f8bb41e07fe6bc8c99ddbe9 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 2 Apr 2020 09:08:02 +0800 Subject: [PATCH 2/5] REPORT-29022 --- changelog.md | 3 +++ src/core/alias.js | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 5412b15c3..0a07e7d2e 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,7 @@ # 更新日志 +2.0(2020-04) +- 支持文本区域水印可滚动 + 2.0(2020-03) - 修复了IE9下使用bi.file上传包含特殊字符的excel出错的问题 - 修复了下拉类型控件不允许编辑的时候没有title的问题 diff --git a/src/core/alias.js b/src/core/alias.js index bcb82eef0..5ea9ef1e0 100644 --- a/src/core/alias.js +++ b/src/core/alias.js @@ -416,8 +416,7 @@ "&": "&", "\"": """, "<": "<", - ">": ">", - " ": " " + ">": ">" }; BI.htmlEncode = function (text) { return BI.isNull(text) ? "" : BI.replaceAll(text + "", "&|\"|<|>|\\s", function (v) { From 37b0db2b089deea9e17777cd3f0261dab07b2f16 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 2 Apr 2020 09:09:02 +0800 Subject: [PATCH 3/5] revert --- src/core/alias.js | 3 ++- src/widget/multitree/multi.tree.combo.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/alias.js b/src/core/alias.js index 5ea9ef1e0..bcb82eef0 100644 --- a/src/core/alias.js +++ b/src/core/alias.js @@ -416,7 +416,8 @@ "&": "&", "\"": """, "<": "<", - ">": ">" + ">": ">", + " ": " " }; BI.htmlEncode = function (text) { return BI.isNull(text) ? "" : BI.replaceAll(text + "", "&|\"|<|>|\\s", function (v) { diff --git a/src/widget/multitree/multi.tree.combo.js b/src/widget/multitree/multi.tree.combo.js index 89ce0949d..e12d4fa2a 100644 --- a/src/widget/multitree/multi.tree.combo.js +++ b/src/widget/multitree/multi.tree.combo.js @@ -85,7 +85,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { }; self.trigger.getSearcher().setState(val); self.numberCounter.setButtonChecked(val); - self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM); + self.fireEvent(BI.MultiTreeCombo.EVENT_CLICK_ITEM, self.combo.getValue()); } }, { eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, From e4e31893db5fea91097380b86029d94ce25e7845 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 2 Apr 2020 10:07:42 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=A9=BA=E6=A0=BC=E4=B8=8D=E7=BC=96?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/single/text.js | 21 ++++++++++++++------- src/core/alias.js | 5 ++--- src/css/base/tree/ztree.css | 2 +- src/less/base/tree/ztree.less | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/base/single/text.js b/src/base/single/text.js index b5d819e5b..c3457e85a 100644 --- a/src/base/single/text.js +++ b/src/base/single/text.js @@ -55,7 +55,7 @@ BI.Text = BI.inherit(BI.Single, { } this.element.css({ textAlign: o.textAlign, - whiteSpace: o.whiteSpace, + whiteSpace: this._getTextWrap(), textOverflow: o.whiteSpace === "nowrap" ? "ellipsis" : "", overflow: o.whiteSpace === "nowrap" ? "" : (BI.isWidthOrHeight(o.height) ? "auto" : "") }); @@ -90,6 +90,17 @@ BI.Text = BI.inherit(BI.Single, { } }, + _getTextWrap: function () { + var o = this.options; + switch (o.whiteSpace) { + case "nowrap": + return "pre"; + case "normal": + default: + return "pre-wrap"; + } + }, + _getShowText: function () { var o = this.options; return BI.isFunction(o.text) ? o.text() : o.text; @@ -136,12 +147,8 @@ BI.Text = BI.inherit(BI.Single, { this.text.element.html(BI.htmlEncode(this._getShowText())); return; } - if (/\s/.test(text)) { - this.text.element[0].innerHTML = BI.htmlEncode(this._getShowText()); - } else { - // textContent性能更好,并且原生防xss - this.text.element[0].textContent = this._getShowText(); - } + // textContent性能更好,并且原生防xss + this.text.element[0].textContent = this._getShowText(); BI.isKey(this.options.keyword) && this.doRedMark(this.options.keyword); } }); diff --git a/src/core/alias.js b/src/core/alias.js index bcb82eef0..a41d967a4 100644 --- a/src/core/alias.js +++ b/src/core/alias.js @@ -416,11 +416,10 @@ "&": "&", "\"": """, "<": "<", - ">": ">", - " ": " " + ">": ">" }; BI.htmlEncode = function (text) { - return BI.isNull(text) ? "" : BI.replaceAll(text + "", "&|\"|<|>|\\s", function (v) { + return BI.isNull(text) ? "" : BI.replaceAll(text + "", "&|\"|<|>", function (v) { return SPECIAL_TAGS[v] ? SPECIAL_TAGS[v] : " "; }); }; diff --git a/src/css/base/tree/ztree.css b/src/css/base/tree/ztree.css index f6f6668ca..5f2d9413a 100644 --- a/src/css/base/tree/ztree.css +++ b/src/css/base/tree/ztree.css @@ -12,7 +12,7 @@ list-style: none; line-height: 14px; text-align: left; - white-space: nowrap; + white-space: pre; outline: 0; } .ztree li ul { diff --git a/src/less/base/tree/ztree.less b/src/less/base/tree/ztree.less index 0b9cde391..77e5fed2a 100644 --- a/src/less/base/tree/ztree.less +++ b/src/less/base/tree/ztree.less @@ -16,7 +16,7 @@ list-style: none; line-height: 14px; text-align: left; - white-space: nowrap; + white-space: pre; outline: 0 } From d435ef9cdf230796b19dfc5e4f0e079c49b46825 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 2 Apr 2020 10:09:14 +0800 Subject: [PATCH 5/5] update --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index 0a07e7d2e..171704388 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-04) +- 空格不再编码成  - 支持文本区域水印可滚动 2.0(2020-03)