Skip to content

Instantly share code, notes, and snippets.

@ramrrr
Created September 22, 2014 12:51
Show Gist options
  • Select an option

  • Save ramrrr/03c4bae5399f26399cdb to your computer and use it in GitHub Desktop.

Select an option

Save ramrrr/03c4bae5399f26399cdb to your computer and use it in GitHub Desktop.
CKEditor
var App = require("core/App");
module.exports = App.EmailMessageTextArea = Ember.TextArea.extend({
useMainMessage:function() {
return this.get('target.useMainMessage');
}.property('target.useMainMessage'),
classNames:['sosDescriptionTextArea','ckeditor'],
mainMessageObserver:function() {
if(this.get('useMainMessage')) {
this.setValue(this.get('target.mainMessage'));
}
}.observes('target.mainMessage'),
valueObserver: function() {
if(this.get('value')==null || this.get('value').trim()==""){
this.setValue(null);
} else {
this.setValue(this.get('value'));
}
}.observes('value'),
keyDown: function (e) {
this.set('target.useMainMessage',false);
},
didInsertElement: function () {
if (!this.get('target.messageDescription') && this.get('target.useMainMessage')) {
this.setValue(this.get('target.mainMessage'));
} else {
this.setValue(this.get('target.messageDescription'));
}
},
setValue: function(value) {
this.set('value',value)
this.set('target.messageDescription',this.get('value'))
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment