@@ -15729,6 +15729,9 @@ function toggleSideBySide(editor) {
1572915729 } else {
1573015730 cm.off("update", cm.sideBySideRenderingFunction);
1573115731 }
15732+
15733+ // Refresh to fix selection being off (#309)
15734+ cm.refresh();
1573215735}
1573315736
1573415737
@@ -16038,7 +16041,7 @@ function extend(target) {
1603816041
1603916042/* The right word count in respect for CJK. */
1604016043function wordCount(data) {
16041- var pattern = /[a-zA-Z0-9_\u0392-\u03c9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g;
16044+ var pattern = /[a-zA-Z0-9_\u0392-\u03c9\u0410-\u04F9 ]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g;
1604216045 var m = data.match(pattern);
1604316046 var count = 0;
1604416047 if(m === null) return count;
@@ -16228,7 +16231,7 @@ var toolbarBuiltInButtons = {
1622816231
1622916232var insertTexts = {
1623016233 link: ["[", "](#url#)"],
16231- image: [""],
16234+ image: [""],
1623216235 table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
1623316236 horizontalRule: ["", "\n\n-----\n\n"]
1623416237};
@@ -16503,6 +16506,13 @@ SimpleMDE.prototype.render = function(el) {
1650316506 this.gui.sideBySide = this.createSideBySide();
1650416507
1650516508 this._rendered = this.element;
16509+
16510+
16511+ // Fixes CodeMirror bug (#344)
16512+ var temp_cm = this.codemirror;
16513+ setTimeout(function() {
16514+ temp_cm.refresh();
16515+ }.bind(temp_cm), 0);
1650616516};
1650716517
1650816518// Safari, in Private Browsing Mode, looks like it supports localStorage but all calls to setItem throw QuotaExceededError. We're going to detect this and set a variable accordingly.
@@ -16689,7 +16699,8 @@ SimpleMDE.prototype.createToolbar = function(items) {
1668916699 // bind events, special for info
1669016700 if(item.action) {
1669116701 if(typeof item.action === "function") {
16692- el.onclick = function() {
16702+ el.onclick = function(e) {
16703+ e.preventDefault();
1669316704 item.action(self);
1669416705 };
1669516706 } else if(typeof item.action === "string") {
@@ -16760,14 +16771,14 @@ SimpleMDE.prototype.createStatusbar = function(status) {
1676016771
1676116772 if(name === "words") {
1676216773 defaultValue = function(el) {
16763- el.innerHTML = "0" ;
16774+ el.innerHTML = wordCount(cm.getValue()) ;
1676416775 };
1676516776 onUpdate = function(el) {
1676616777 el.innerHTML = wordCount(cm.getValue());
1676716778 };
1676816779 } else if(name === "lines") {
1676916780 defaultValue = function(el) {
16770- el.innerHTML = "0" ;
16781+ el.innerHTML = cm.lineCount() ;
1677116782 };
1677216783 onUpdate = function(el) {
1677316784 el.innerHTML = cm.lineCount();
0 commit comments