cms/app-client/app/helpers/newlines-br.js
author ymh <ymh.work@gmail.com>
Tue, 20 Mar 2018 15:02:24 +0100
changeset 572 190ae1dee68d
parent 502 74fba571487e
permissions -rw-r--r--
New version, update js requirements + package files.
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);