forked from fanruan/fineui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.1 KiB
39 lines
1.1 KiB
8 years ago
|
Demo.CodeEditor = BI.inherit(BI.Widget, {
|
||
|
props: {
|
||
|
baseCls: "demo-editor"
|
||
|
},
|
||
|
render: function () {
|
||
|
var editor = BI.createWidget({
|
||
|
type: "bi.textarea_editor",
|
||
|
cls: "mvc-border",
|
||
|
width: 600,
|
||
|
height: 400
|
||
|
});
|
||
|
editor.on(BI.TextAreaEditor.EVENT_FOCUS, function () {
|
||
|
BI.Msg.toast("Focus");
|
||
|
});
|
||
|
editor.on(BI.TextAreaEditor.EVENT_BLUR, function () {
|
||
|
BI.Msg.toast("Blur");
|
||
|
});
|
||
|
BI.createWidget({
|
||
|
type: "bi.vertical",
|
||
|
element: this,
|
||
|
hgap: 30,
|
||
|
vgap: 20,
|
||
|
items: [editor, {
|
||
|
type: "bi.button",
|
||
|
text: "getValue",
|
||
|
handler: function () {
|
||
|
BI.Msg.toast(JSON.stringify(editor.getValue()));
|
||
|
}
|
||
|
}, {
|
||
|
type: "bi.button",
|
||
|
text: "setValue",
|
||
|
handler: function () {
|
||
|
editor.setValue("测试数据");
|
||
|
}
|
||
|
}]
|
||
|
})
|
||
|
}
|
||
|
});
|
||
|
$.shortcut("demo.textarea_editor", Demo.CodeEditor);
|