From 5b8a45b75c43b281ed171d98a2e0f3bbb6049bed Mon Sep 17 00:00:00 2001 From: Arthur Corenzan Date: Tue, 14 Jun 2016 16:02:01 -0300 Subject: [PATCH] Accept url when calling drawImage --- src/js/simplemde.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/js/simplemde.js b/src/js/simplemde.js index 016d693..f61835d 100644 --- a/src/js/simplemde.js +++ b/src/js/simplemde.js @@ -630,18 +630,17 @@ function drawLink(editor) { /** * Action for drawing an img. */ -function drawImage(editor) { +function drawImage(editor, url) { var cm = editor.codemirror; var stat = getState(cm); var options = editor.options; - var url = "http://"; if(options.promptURLs) { url = prompt(options.promptTexts.image); if(!url) { return false; } } - _replaceSelection(cm, stat.image, options.insertTexts.image, url); + _replaceSelection(cm, stat.image, options.insertTexts.image, url || "http://"); } /** @@ -1947,8 +1946,8 @@ SimpleMDE.prototype.cleanBlock = function() { SimpleMDE.prototype.drawLink = function() { drawLink(this); }; -SimpleMDE.prototype.drawImage = function() { - drawImage(this); +SimpleMDE.prototype.drawImage = function(url) { + drawImage(this, url); }; SimpleMDE.prototype.drawTable = function() { drawTable(this); @@ -2025,4 +2024,4 @@ SimpleMDE.prototype.toTextArea = function() { } }; -module.exports = SimpleMDE; \ No newline at end of file +module.exports = SimpleMDE;