mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-18 23:44:29 -06:00
Fix #125 Add characters count to status bar
This commit is contained in:
parent
62b95316b2
commit
e1527365d2
@ -1677,7 +1677,7 @@ function EasyMDE(options) {
|
|||||||
|
|
||||||
// Handle status bar
|
// Handle status bar
|
||||||
if (!Object.prototype.hasOwnProperty.call(options, 'status')) {
|
if (!Object.prototype.hasOwnProperty.call(options, 'status')) {
|
||||||
options.status = ['autosave', 'lines', 'words', 'cursor'];
|
options.status = ['autosave', 'lines', 'words', 'characters', 'cursor'];
|
||||||
|
|
||||||
if (options.uploadImage) {
|
if (options.uploadImage) {
|
||||||
options.status.unshift('upload-image');
|
options.status.unshift('upload-image');
|
||||||
@ -2590,7 +2590,14 @@ EasyMDE.prototype.createStatusbar = function (status) {
|
|||||||
} else {
|
} else {
|
||||||
var name = status[i];
|
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) {
|
defaultValue = function (el) {
|
||||||
el.innerHTML = wordCount(cm.getValue());
|
el.innerHTML = wordCount(cm.getValue());
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user