Forked from sergiferran/controllers.application.js
Last active
November 6, 2018 10:47
-
-
Save CvX/f3a41f8c4d7b92d9224043cb82c8ce8f 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.15.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "3.6.0-beta.1", | |
"ember-template-compiler": "3.4.3", | |
"ember-testing": "3.4.3" | |
}, | |
"addons": { | |
"ember-data": "3.4.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment