Commit a32ad74c authored by Xiaowu Zhang's avatar Xiaowu Zhang

upload ace editor with gadget's new getContent API

parent 16dd8493
......@@ -2,14 +2,20 @@
/*jslint nomen: true*/
(function(window, rJS) {
"use strict";
var gk = rJS(window);
gk.declareMethod("setContent", function(value) {
this.editor.getSession().setValue(value);
}).declareMethod("getContent", function() {
return this.editor.getSession().getValue();
});
gk.ready(function(g) {
rJS(window).ready(function(g) {
g.props = {};
g.editor = ace.edit(g.__element.getElementsByTagName("div")[0]);
g.editor.setTheme("ace/theme/monokai");
}).ready(function(g) {
return g.getElement().push(function(element) {
g.props.element = element;
});
}).declareMethod("render", function(options) {
this.props.key = options.key || "";
this.editor.getSession().setValue(options.value);
}).declareMethod("getContent", function() {
var form_gadget = this, result = {};
result[form_gadget.props.key] = form_gadget.editor.getSession().getValue();
return result;
});
})(window, rJS, ace);
\ No newline at end of file
......@@ -3,18 +3,27 @@
(function (window, rJS) {
"use strict";
var gk = rJS(window);
gk.declareMethod('setContent', function (value) {
this.editor.getSession().setValue(value);
})
.declareMethod('getContent', function () {
return this.editor.getSession().getValue();
});
gk.ready(function (g) {
rJS(window)
.ready(function (g) {
g.props = {};
g.editor = ace.edit(g.__element.getElementsByTagName('div')[0]);
g.editor.setTheme("ace/theme/monokai");
})
.ready(function (g) {
return g.getElement()
.push(function (element) {
g.props.element = element;
});
})
.declareMethod('render', function (options) {
this.props.key = options.key || "";
this.editor.getSession().setValue(options.value);
})
.declareMethod('getContent', function () {
var form_gadget = this,
result = {};
result[form_gadget.props.key] =
form_gadget.editor.getSession().getValue();
return result;
});
}(window, rJS, ace));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment