Created
April 1, 2012 22:16
-
-
Save cloke/2279116 to your computer and use it in GitHub Desktop.
Custom view
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
M.Paragraph = Em.View.extend(Ember.TextSupport, { | |
viewName: 'paragraph_view', | |
content: null, | |
attributeBindings: ['text'], | |
text: '', | |
editable: false, | |
_editable: (function() { | |
console.log(arguments); | |
return this.set('editable', Em.getPath(arguments[1])); | |
}).observes('M.editable.status'), | |
template: Ember.Handlebars.compile('{{#if this.editable}}\ | |
<div contentEditable="true">{{content.text}}</div>\ | |
{{view Em.TextArea valueBinding="content.text"}}\ | |
{{else}}\ | |
<p>{{content.text}}</p>\ | |
{{/if}}'), | |
change: function() { | |
return console.log(5); | |
}, | |
keyup: function() { | |
return console.log(7); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment