discourse/test/javascripts/helpers/d-editor-helper.js.es6
Joffrey JAFFEUX df95457468
DEV: d-editor helper should be synchronous (#7706)
Also ensures trigger has happened before assertion and prevents leaking formatTextWithSelection into global context
2019-06-05 14:52:38 +02:00

12 lines
218 B
JavaScript

export default function formatTextWithSelection(text, [start, len]) {
return [
'"',
text.substr(0, start),
"<",
text.substr(start, len),
">",
text.substr(start + len),
'"'
].join("");
}