After digging a bit in Redactor code, I found that if your element intended to be an editor is not a textarea element, Redactor will do the opposite and add textarea if your a uses a div instead.
I updated my view and changed it based on the code from Ember.TextArea and Ember.TextSupport so that it gets the correct value, this will probably work fine if you also use an element with contenteditable support.
App.RedactorView = Ember.View.extend({ tagName: 'div', init: function() { this._super(); this.on("focusOut", this, this._elementValueDidChange); this.on("change", this, this._elementValueDidChange); this.on("paste", this, this._elementValueDidChange); this.on("cut", this, this._elementValueDidChange); this.on("input", this, this._elementValueDidChange); }, _updateElementValue: Ember.observer(function() { var $el, value; value = Ember.get(this, "value"); $el = this.$().context; if ($el && value !== $el.innerHTML) { return $el.innerHTML = value; } }, "value"), _elementValueDidChange: function() { var $el; $el = this.$().context; return Ember.set(this, "value", $el.innerHTML); }, didInsertElement: function() { this.$().redactor(); this._updateElementValue(); } });
Here's JSBin demonstrating this: http://emberjs.jsbin.com/cefebepa/1/edit
source share