From d2e2fcc581d8a4cab06962f710e1a77dc1580556 Mon Sep 17 00:00:00 2001 From: guy Date: Mon, 18 Sep 2017 23:55:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=8C=E6=96=87=E6=9C=AC=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/base.js | 19 +++++++++++++++++++ demo/js/base/editor/demo.rich_editor.js | 2 +- dist/base.js | 19 +++++++++++++++++++ dist/bundle.js | 19 +++++++++++++++++++ dist/demo.js | 2 +- dist/resource.css | 4 ++++ src/base/richeditor/bar/texttoolbar.js | 19 +++++++++++++++++++ src/css/resource/font.css | 4 ++++ src/less/resource/font.less | 7 +++++++ 9 files changed, 93 insertions(+), 2 deletions(-) diff --git a/bi/base.js b/bi/base.js index c3981ad98..7e899402e 100644 --- a/bi/base.js +++ b/bi/base.js @@ -16200,6 +16200,25 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { vgap: 3 }) }, + + mounted: function () { + var self = this; + if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 + this.element.mousedown(function () { + self._noSelect(self.element[0]); + }); + this._noSelect(this.element[0]); + } + }, + + _noSelect: function (element) { + if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { + element.setAttribute('unselectable', 'on'); + } + for (var i = 0; i < element.childNodes.length; i++) { + this._noSelect(element.childNodes[i]); + } + } }); BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** * 富文本编辑器 diff --git a/demo/js/base/editor/demo.rich_editor.js b/demo/js/base/editor/demo.rich_editor.js index 1f66c4fb6..862ee7b75 100644 --- a/demo/js/base/editor/demo.rich_editor.js +++ b/demo/js/base/editor/demo.rich_editor.js @@ -13,7 +13,7 @@ Demo.RichEditor = BI.inherit(BI.Widget, { type: "bi.vertical", element: this, hgap: 30, - vgap: 20, + vgap: 50, items: [this.editor] }) }, diff --git a/dist/base.js b/dist/base.js index 51d3a8f33..4edce5990 100644 --- a/dist/base.js +++ b/dist/base.js @@ -16200,6 +16200,25 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { vgap: 3 }) }, + + mounted: function () { + var self = this; + if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 + this.element.mousedown(function () { + self._noSelect(self.element[0]); + }); + this._noSelect(this.element[0]); + } + }, + + _noSelect: function (element) { + if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { + element.setAttribute('unselectable', 'on'); + } + for (var i = 0; i < element.childNodes.length; i++) { + this._noSelect(element.childNodes[i]); + } + } }); BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** * 富文本编辑器 diff --git a/dist/bundle.js b/dist/bundle.js index ed4993064..1c5982084 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -45006,6 +45006,25 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { vgap: 3 }) }, + + mounted: function () { + var self = this; + if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 + this.element.mousedown(function () { + self._noSelect(self.element[0]); + }); + this._noSelect(this.element[0]); + } + }, + + _noSelect: function (element) { + if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { + element.setAttribute('unselectable', 'on'); + } + for (var i = 0; i < element.childNodes.length; i++) { + this._noSelect(element.childNodes[i]); + } + } }); BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar);/** * 富文本编辑器 diff --git a/dist/demo.js b/dist/demo.js index 720ed67b7..545f614a2 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -824,7 +824,7 @@ BI.shortcut("demo.multifile_editor", Demo.CodeEditor);Demo.RichEditor = BI.inher type: "bi.vertical", element: this, hgap: 30, - vgap: 20, + vgap: 50, items: [this.editor] }) }, diff --git a/dist/resource.css b/dist/resource.css index 9426ebd30..35eab79e1 100644 --- a/dist/resource.css +++ b/dist/resource.css @@ -138,6 +138,10 @@ textarea::-webkit-scrollbar-thumb:hover { /* iOS 4.1- */ } +@font-face { + font-family: 'bi'; + src: url('font/iconfont.eot') /* IE6-IE8 */; +} .b-font { font-family: "bi"; font-style: normal; diff --git a/src/base/richeditor/bar/texttoolbar.js b/src/base/richeditor/bar/texttoolbar.js index 2b0379f58..0525bef36 100644 --- a/src/base/richeditor/bar/texttoolbar.js +++ b/src/base/richeditor/bar/texttoolbar.js @@ -39,5 +39,24 @@ BI.RichEditorTextToolbar = BI.inherit(BI.Widget, { vgap: 3 }) }, + + mounted: function () { + var self = this; + if (BI.isIE9Below()) {//IE8下必须要设置unselectable才能不blur输入框 + this.element.mousedown(function () { + self._noSelect(self.element[0]); + }); + this._noSelect(this.element[0]); + } + }, + + _noSelect: function (element) { + if (element.setAttribute && element.nodeName.toLowerCase() != 'input' && element.nodeName.toLowerCase() != 'textarea') { + element.setAttribute('unselectable', 'on'); + } + for (var i = 0; i < element.childNodes.length; i++) { + this._noSelect(element.childNodes[i]); + } + } }); BI.shortcut('bi.rich_editor_text_toolbar', BI.RichEditorTextToolbar); \ No newline at end of file diff --git a/src/css/resource/font.css b/src/css/resource/font.css index 78c39f1a0..40413daa9 100644 --- a/src/css/resource/font.css +++ b/src/css/resource/font.css @@ -4,6 +4,10 @@ /* iOS 4.1- */ } +@font-face { + font-family: 'bi'; + src: url('font/iconfont.eot') /* IE6-IE8 */; +} .b-font { font-family: "bi"; font-style: normal; diff --git a/src/less/resource/font.less b/src/less/resource/font.less index 5c901c705..c8c928b4f 100644 --- a/src/less/resource/font.less +++ b/src/less/resource/font.less @@ -7,6 +7,13 @@ src: url('@{webUrl}font/iconfont.eot'), /* IE6-IE8 */ url('@{webUrl}font/iconfont.woff') format('woff'), /* chrome、firefox */ url('@{webUrl}font/iconfont.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/ url('@{webUrl}font/iconfont.svg#svgFontName') format('svg'); /* iOS 4.1- */ } +html.ie9below { + @font-face { + font-family: 'bi'; + src: url('@{webUrl}font/iconfont.eot') /* IE6-IE8 */ + } +} + .b-font { font-family: "bi"; font-style: normal;