Skip to content
Snippets Groups Projects
Commit ee46e174 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update AceEditor to simplify the javaScript code.

parent 0896b426
No related branches found
No related tags found
1 merge request!30Release 0.9.3
......@@ -48,8 +48,6 @@ Ext.define('Dbui.form.field.AceEditor', {
// private property
editor: null,
panel: null,
value: undefined,
// jshint strict: false
......@@ -59,13 +57,10 @@ Ext.define('Dbui.form.field.AceEditor', {
var me = this;
me.items = [{
height: me.editorHeight,
layout: 'fit',
frame: true,
items: {
xtype: 'component',
height: me.editorHeight
},
xtype: 'panel'
style: 'border: 1px solid #99BCE8;',
xtype: 'component'
}];
me.anchor = '100%';
......@@ -75,17 +70,18 @@ Ext.define('Dbui.form.field.AceEditor', {
},
// private method requests by the component model of ExtJS
// notice that afterLayout is called after setValue
//
// NOTE:
// - method afterLayout is called after setValue
// - method setValue fill the property me.value
//
afterLayout: function () {
var me = this;
if (!me.panel) {
me.panel = me.child('panel');
}
// instantiate the editor
if (!me.editor) {
me.editor = ace.edit(me.panel.child('component').getId());
me.editor = ace.edit(me.child('component').getId());
me.editor.getSession().setMode('ace/mode/' + me.language);
me.editor.setTheme('ace/theme/' + me.theme);
me.editor.setFontSize(me.fontSize);
......@@ -107,7 +103,6 @@ Ext.define('Dbui.form.field.AceEditor', {
me.editor.destroy();
delete me.editor;
delete me.panel;
me.callParent(arguments);
},
......@@ -130,22 +125,5 @@ Ext.define('Dbui.form.field.AceEditor', {
}
return undefined;
},
/**
* Set the value for this field.
* Notice that setValue is called before afterLayout
*
* @param {String} value
*
*/
setValue: function (value) {
"use strict";
var me = this;
me.value = value;
return me;
}
});
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment