From ad98e29da059f8859e2de3ad72beb408ccf56f32 Mon Sep 17 00:00:00 2001 From: daihere Date: Wed, 19 Jul 2017 19:13:52 +0800 Subject: [PATCH] Fix bug --- src/js/simplemde.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/js/simplemde.js b/src/js/simplemde.js index 0e77eb8..667e536 100644 --- a/src/js/simplemde.js +++ b/src/js/simplemde.js @@ -110,7 +110,7 @@ function createIcon(options, enableTooltips, shortcuts) { // create element hook if(options.whenEleCreate && typeof options.whenEleCreate === "function") { - el = options.whenEleCreate(el); + el = options.whenEleCreate.call(this, el); } el.tabIndex = -1; @@ -1450,6 +1450,9 @@ function SimpleMDE(options) { } } +// support replaceSelection to user +SimpleMDE.prototype.replaceSelection = _replaceSelection; + /** * Default markdown render. */ @@ -1777,7 +1780,7 @@ SimpleMDE.prototype.createToolbar = function(items) { if(item === "|") { el = createSep(); } else { - el = createIcon(item, self.options.toolbarTips, self.options.shortcuts); + el = createIcon.call(self, item, self.options.toolbarTips, self.options.shortcuts); } // bind events, special for info