After Migrating Ember 2.3.0 . Ace editor component issue happens?


#1

This is my old version ember component code … This code working fine …

export default Ember.Component.extend({

didInsertElement: function() {
	var self = this;
	var editorid = self.editorid; /*get editor name with unique id*/
	
	/*generate ace editor with the name of editor*/ 
	var editor = window.ace.edit(editorid);
	self.set('editor', editor);
	editor.setReadOnly(true);
	editor.setOptions({
		maxLines: 400000
	});
	/*set ace editor settings*/
	editor.setShowPrintMargin(false);
	editor.setTheme("ace/theme/monokai");
	editor.setFontSize('16px');
	editor.session.setMode("ace/mode/java");
},

contentChange: function() {
	var self = this,
		editor = self.get('editor');
	editor.setValue(self.get('fileContent'), -1);
}.observes('fileContent'),

actions: {
	
}

});

After Migration Ember 2.3.0 version , component I changed , After Migrating I cannot setmode in ace editor . Beacuse of throwing this error Uncaught TypeError: Cannot set property ‘isDescriptor’ of undefined …

const ace = window.ace;

export default Ember.Component.extend({

didInsertElement: function() {
	var self = this;
	Ember.run.scheduleOnce('afterRender', self, self._codeViewer);
},

_codeViewer: function() {
	console.log('code viewer called ...');
	var self = this;
	self._super(...arguments);
	var editorid = this.get('editorid');
	var editorObj = ace.edit(editorid);
	self.set('editor', editorObj);
	editorObj.setReadOnly(true);
	editorObj.setOptions({
		maxLines: 400000
	});
	/*set ace editor settings*/
	editorObj.setShowPrintMargin(false);
	editorObj.setTheme("ace/theme/monokai");
	editorObj.setFontSize('16px');
	console.log(editorObj.session);
	editorObj.session.setMode("ace/mode/java");
},

contentChange: function() {
	var self = this,
		editor = self.get('editor');
	editor.setValue(self.get('fileContent'), -1);
}.observes('fileContent')

});