Skip to content

Commit

Permalink
Fix Ionaru#125 Add characters count to status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoHood committed Feb 18, 2021
1 parent 62b9531 commit e152736
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/js/easymde.js
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,7 @@ function EasyMDE(options) {

// Handle status bar
if (!Object.prototype.hasOwnProperty.call(options, 'status')) {
options.status = ['autosave', 'lines', 'words', 'cursor'];
options.status = ['autosave', 'lines', 'words', 'characters', 'cursor'];

if (options.uploadImage) {
options.status.unshift('upload-image');
Expand Down Expand Up @@ -2590,7 +2590,14 @@ EasyMDE.prototype.createStatusbar = function (status) {
} else {
var name = status[i];

if (name === 'words') {
if (name === 'characters') {
defaultValue = function (el) {
el.innerHTML = cm.getValue().length;
};
onUpdate = function (el) {
el.innerHTML = cm.getValue().length;
};
} else if (name === 'words') {
defaultValue = function (el) {
el.innerHTML = wordCount(cm.getValue());
};
Expand Down

0 comments on commit e152736

Please sign in to comment.