Last active
November 6, 2018 10:34
-
-
Save sergiferran/9b46de7b2f4e387e7d710948019d0912 to your computer and use it in GitHub Desktop.
WhiteSpace Control error
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', | |
value: 'abc\ntest here\nAlso here', | |
values: Ember.computed('value', function(){ | |
return (this.get('value') || '').split('\n'); | |
}) | |
}); |
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 function highlightText(params, {value = '', highlight = ''}) { | |
if (!value || Ember.isBlank(highlight)) { | |
return Ember.String.htmlSafe(value || ''); | |
} | |
let regexp = new RegExp(`(${highlight})`, 'gim'); | |
let result = (value || '').toString().replace(regexp, '<b class="highlight">$1</b>'); | |
return Ember.String.htmlSafe(result); | |
} | |
export default Ember.Helper.helper(highlightText); |
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.11.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.11.0", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.11.0", | |
"ember-testing": "2.11.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment