From 96bbfda8c4e5645f9ac6891d51669784d2669675 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 26 Mar 2018 22:09:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0focus=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/bundle.js | 12 ++++++++++++ dist/case.js | 12 ++++++++++++ dist/demo.js | 19 ++++++++++++++++--- src/case/richeditor/niceditor/niceditor.js | 8 ++++++++ src/case/richeditor/richeditor.js | 4 ++++ 5 files changed, 52 insertions(+), 3 deletions(-) diff --git a/dist/bundle.js b/dist/bundle.js index be2dbad9e3..6d9d7f52d9 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -82266,6 +82266,10 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/** // return false; }, + focus: function () { + this.instance.focus(); + }, + setValue: function (v) { this.instance.setContent(v); }, @@ -82451,6 +82455,10 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/** // return false; }, + focus: function () { + this.setFocus(this.elm.element[0]); + }, + blur: function () { this.isFocused = false; this.elm.element.removeClass(prefix + "selected"); @@ -83085,6 +83093,10 @@ BI.RichEditor = BI.inherit(BI.Widget, { }); }, + focus: function () { + this.editor.focus(); + }, + setValue: function (v) { this.editor.setValue(v); }, diff --git a/dist/case.js b/dist/case.js index c48c75ead3..ebd0660647 100644 --- a/dist/case.js +++ b/dist/case.js @@ -10324,6 +10324,10 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/** // return false; }, + focus: function () { + this.instance.focus(); + }, + setValue: function (v) { this.instance.setContent(v); }, @@ -10509,6 +10513,10 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/** // return false; }, + focus: function () { + this.setFocus(this.elm.element[0]); + }, + blur: function () { this.isFocused = false; this.elm.element.removeClass(prefix + "selected"); @@ -11143,6 +11151,10 @@ BI.RichEditor = BI.inherit(BI.Widget, { }); }, + focus: function () { + this.editor.focus(); + }, + setValue: function (v) { this.editor.setValue(v); }, diff --git a/dist/demo.js b/dist/demo.js index 5c030dbee2..c7a2b39875 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -859,15 +859,26 @@ BI.shortcut("demo.multifile_editor", Demo.CodeEditor);Demo.RichEditor = BI.inher this.editor = BI.createWidget({ type: "bi.rich_editor", cls: "mvc-border", - width: 600, - height: 400 + width: "100%", + height: "100%" }); BI.createWidget({ type: "bi.vertical", element: this, hgap: 30, vgap: 50, - items: [this.editor] + items: [{ + type: "bi.absolute", + width: 600, + height: 400, + items: [{ + el: this.editor, + left: 10, + right: 10, + top: 10, + bottom: 10 + }] + }] }); }, @@ -877,6 +888,8 @@ BI.shortcut("demo.multifile_editor", Demo.CodeEditor);Demo.RichEditor = BI.inher var style = image.style; this.editor.setValue("
这是一条测试数据
"); + + this.editor.focus(); } }); BI.shortcut("demo.rich_editor", Demo.RichEditor);/** diff --git a/src/case/richeditor/niceditor/niceditor.js b/src/case/richeditor/niceditor/niceditor.js index 8261c8416d..9f74fa9359 100644 --- a/src/case/richeditor/niceditor/niceditor.js +++ b/src/case/richeditor/niceditor/niceditor.js @@ -65,6 +65,10 @@ // return false; }, + focus: function () { + this.instance.focus(); + }, + setValue: function (v) { this.instance.setContent(v); }, @@ -250,6 +254,10 @@ // return false; }, + focus: function () { + this.setFocus(this.elm.element[0]); + }, + blur: function () { this.isFocused = false; this.elm.element.removeClass(prefix + "selected"); diff --git a/src/case/richeditor/richeditor.js b/src/case/richeditor/richeditor.js index 39c4763403..e440dc1319 100644 --- a/src/case/richeditor/richeditor.js +++ b/src/case/richeditor/richeditor.js @@ -52,6 +52,10 @@ BI.RichEditor = BI.inherit(BI.Widget, { }); }, + focus: function () { + this.editor.focus(); + }, + setValue: function (v) { this.editor.setValue(v); },