cms/app-client/app/helpers/newlines-br.js
author ymh <ymh.work@gmail.com>
Tue, 26 Sep 2017 21:41:49 +0200
changeset 550 fbd1bfc9f963
parent 502 74fba571487e
permissions -rw-r--r--
Improve label resolution in french for geonames.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
502
74fba571487e Complete the notice display. add various fields to document to correctly display the notice. Correct bug #0025746
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
import Ember from 'ember';
74fba571487e Complete the notice display. add various fields to document to correctly display the notice. Correct bug #0025746
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
74fba571487e Complete the notice display. add various fields to document to correctly display the notice. Correct bug #0025746
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
export function newlinesBr(params) {
74fba571487e Complete the notice display. add various fields to document to correctly display the notice. Correct bug #0025746
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
  const param = params[0];
74fba571487e Complete the notice display. add various fields to document to correctly display the notice. Correct bug #0025746
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
  let text = Ember.Handlebars.Utils.escapeExpression(param);
74fba571487e Complete the notice display. add various fields to document to correctly display the notice. Correct bug #0025746
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
  text = text.replace(/(\r\n|\n|\r)/gm, '<br>');
74fba571487e Complete the notice display. add various fields to document to correctly display the notice. Correct bug #0025746
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
  return Ember.String.htmlSafe(text);
74fba571487e Complete the notice display. add various fields to document to correctly display the notice. Correct bug #0025746
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
}
74fba571487e Complete the notice display. add various fields to document to correctly display the notice. Correct bug #0025746
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
74fba571487e Complete the notice display. add various fields to document to correctly display the notice. Correct bug #0025746
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
export default Ember.Helper.helper(newlinesBr);