From 990e4b065bd5faf161ec4faea405ac32dfafec6a Mon Sep 17 00:00:00 2001 From: colo Date: Sat, 16 Sep 2017 14:52:59 +0800 Subject: [PATCH] explicit url param setting in drawImage function, and add this api to simplemde prototype. --- 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 016d693..7abb900 100644 --- a/src/js/simplemde.js +++ b/src/js/simplemde.js @@ -630,11 +630,11 @@ 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://"; + url || (url = "http://"); if(options.promptURLs) { url = prompt(options.promptTexts.image); if(!url) { @@ -1950,6 +1950,9 @@ SimpleMDE.prototype.drawLink = function() { SimpleMDE.prototype.drawImage = function() { drawImage(this); }; +SimpleMDE.prototype.drawImageUrl = function(url) { + drawImage(this, url); +}; SimpleMDE.prototype.drawTable = function() { drawTable(this); };