Forked from villander/application.controller.js
Last active
December 23, 2015 16:46
-
-
Save edygar/36cb71a16222ccb854c5 to your computer and use it in GitHub Desktop.
Meu input
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName:'Ember Twiddle', | |
init() { | |
setTimeout(()=>{ | |
this.set('value', | |
` | |
<h2>Permito qualquer tag?</h2> | |
entende pq Michael? | |
`); | |
}, 2000); | |
} | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: ['meu-input'], | |
attributeBindings: [ 'contentEditable' ], | |
contentEditable: true, | |
input(event) { | |
console.log(this.element.innerHTML); | |
const value = this.element.innerHTML | |
.replace(/ /g, ' ') | |
.replace(/<([^>]+?)([^>]*?)>(.*?)<\/\1>/ig, "") | |
.replace(/<\/?div.*?>/g, '\n') | |
.replace(/<br\s*\/?>/g, '\n'); | |
this.set('value', value); | |
}, | |
}); |
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
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
.meu-input { | |
border: 1px solid #999; | |
border-radius: 6px; | |
min-height: 1em; | |
padding: 6px; | |
} |
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
{ | |
"version": "0.4.17", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember.debug.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/2.2.0/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/2.2.0/ember-template-compiler.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment