Shows word and character counts in the status bar. Updates automatically on every editor change.
Counts plain text from the document (whitespace is normalized). No toolbar button — stats appear in the status bar as soon as the plugin is loaded.
<script src="/assets/redactor/redactor.js"></script>
<script src="/assets/redactor/plugins/counter/counter.js"></script>
const app = Redactor('#entry', {
plugins: ['counter']
});
This plugin has no options.
Fired after each recount.
app.on('counter', ({ data }) => {
console.log(data.words, data.characters);
});
Payload:
Recalculates stats, updates the status bar, and emits the counter event.
app.counter.count();