explicit url param setting in drawImage function, and add this api to simplemde prototype.

This commit is contained in:
colo 2017-09-16 14:52:59 +08:00
parent 6abda7ab68
commit 990e4b065b

View File

@ -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);
};