0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 12:22:54 +01:00
discourse-custom-wizard/assets/javascripts/wizard/helpers/char-counter.js.es6
2021-01-08 12:24:51 +05:30

9 Zeilen
437 B
JavaScript

import { registerUnbound } from "discourse-common/lib/helpers";
import I18n from "I18n";
export default registerUnbound("char-counter", function(body) {
let bodyLength = body ? body.length : 0;
let characterString = bodyLength == 1 ? 'wizard.character' : 'wizard.characters';
let finalString = `<div class="body-length">${bodyLength} ${ I18n.t(characterString)}</div>`;
return new Handlebars.SafeString(finalString);
});