Browse Source

添加focus方法

es6
windy 7 years ago
parent
commit
96bbfda8c4
  1. 12
      dist/bundle.js
  2. 12
      dist/case.js
  3. 19
      dist/demo.js
  4. 8
      src/case/richeditor/niceditor/niceditor.js
  5. 4
      src/case/richeditor/richeditor.js

12
dist/bundle.js vendored

@ -82266,6 +82266,10 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
// return false; // return false;
}, },
focus: function () {
this.instance.focus();
},
setValue: function (v) { setValue: function (v) {
this.instance.setContent(v); this.instance.setContent(v);
}, },
@ -82451,6 +82455,10 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
// return false; // return false;
}, },
focus: function () {
this.setFocus(this.elm.element[0]);
},
blur: function () { blur: function () {
this.isFocused = false; this.isFocused = false;
this.elm.element.removeClass(prefix + "selected"); this.elm.element.removeClass(prefix + "selected");
@ -83085,6 +83093,10 @@ BI.RichEditor = BI.inherit(BI.Widget, {
}); });
}, },
focus: function () {
this.editor.focus();
},
setValue: function (v) { setValue: function (v) {
this.editor.setValue(v); this.editor.setValue(v);
}, },

12
dist/case.js vendored

@ -10324,6 +10324,10 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
// return false; // return false;
}, },
focus: function () {
this.instance.focus();
},
setValue: function (v) { setValue: function (v) {
this.instance.setContent(v); this.instance.setContent(v);
}, },
@ -10509,6 +10513,10 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
// return false; // return false;
}, },
focus: function () {
this.setFocus(this.elm.element[0]);
},
blur: function () { blur: function () {
this.isFocused = false; this.isFocused = false;
this.elm.element.removeClass(prefix + "selected"); this.elm.element.removeClass(prefix + "selected");
@ -11143,6 +11151,10 @@ BI.RichEditor = BI.inherit(BI.Widget, {
}); });
}, },
focus: function () {
this.editor.focus();
},
setValue: function (v) { setValue: function (v) {
this.editor.setValue(v); this.editor.setValue(v);
}, },

19
dist/demo.js vendored

@ -859,15 +859,26 @@ BI.shortcut("demo.multifile_editor", Demo.CodeEditor);Demo.RichEditor = BI.inher
this.editor = BI.createWidget({ this.editor = BI.createWidget({
type: "bi.rich_editor", type: "bi.rich_editor",
cls: "mvc-border", cls: "mvc-border",
width: 600, width: "100%",
height: 400 height: "100%"
}); });
BI.createWidget({ BI.createWidget({
type: "bi.vertical", type: "bi.vertical",
element: this, element: this,
hgap: 30, hgap: 30,
vgap: 50, 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; var style = image.style;
this.editor.setValue("<div>这是一条<font size=\"4\" color=\"#009de3\">测试</font>数据<img width='" + image.width + "' height='" + image.height + "' src='" + src + "' style='" + style + "' /></div>"); this.editor.setValue("<div>这是一条<font size=\"4\" color=\"#009de3\">测试</font>数据<img width='" + image.width + "' height='" + image.height + "' src='" + src + "' style='" + style + "' /></div>");
this.editor.focus();
} }
}); });
BI.shortcut("demo.rich_editor", Demo.RichEditor);/** BI.shortcut("demo.rich_editor", Demo.RichEditor);/**

8
src/case/richeditor/niceditor/niceditor.js

@ -65,6 +65,10 @@
// return false; // return false;
}, },
focus: function () {
this.instance.focus();
},
setValue: function (v) { setValue: function (v) {
this.instance.setContent(v); this.instance.setContent(v);
}, },
@ -250,6 +254,10 @@
// return false; // return false;
}, },
focus: function () {
this.setFocus(this.elm.element[0]);
},
blur: function () { blur: function () {
this.isFocused = false; this.isFocused = false;
this.elm.element.removeClass(prefix + "selected"); this.elm.element.removeClass(prefix + "selected");

4
src/case/richeditor/richeditor.js

@ -52,6 +52,10 @@ BI.RichEditor = BI.inherit(BI.Widget, {
}); });
}, },
focus: function () {
this.editor.focus();
},
setValue: function (v) { setValue: function (v) {
this.editor.setValue(v); this.editor.setValue(v);
}, },

Loading…
Cancel
Save