mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-09-24 16:40:55 -06:00
Merge dc3c9b51c3bf95bbb1824f82573c6a70a4e2aebc into 6abda7ab68cc20f4aca870eb243747951b90ab04
This commit is contained in:
commit
8516757807
18239
debug/simplemde.debug.js
18239
debug/simplemde.debug.js
File diff suppressed because one or more lines are too long
18236
debug/simplemde.js
18236
debug/simplemde.js
File diff suppressed because it is too large
Load Diff
18
dist/simplemde.min.js
vendored
18
dist/simplemde.min.js
vendored
File diff suppressed because one or more lines are too long
@ -618,13 +618,29 @@ function drawLink(editor) {
|
|||||||
var stat = getState(cm);
|
var stat = getState(cm);
|
||||||
var options = editor.options;
|
var options = editor.options;
|
||||||
var url = "http://";
|
var url = "http://";
|
||||||
if(options.promptURLs) {
|
if(options.drawLink) {
|
||||||
url = prompt(options.promptTexts.link);
|
options.drawLink(__drawLink(editor));
|
||||||
if(!url) {
|
} else {
|
||||||
return false;
|
if(options.promptURLs) {
|
||||||
|
url = prompt(options.promptTexts.link);
|
||||||
|
if(!url) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
_replaceSelection(cm, stat.link, options.insertTexts.link, url);
|
||||||
}
|
}
|
||||||
_replaceSelection(cm, stat.link, options.insertTexts.link, url);
|
}
|
||||||
|
/**
|
||||||
|
* Custom Action for drawing a link
|
||||||
|
* by ucev
|
||||||
|
*/
|
||||||
|
function __drawLink(editor) {
|
||||||
|
var cm = editor.codemirror;
|
||||||
|
var stat = getState(cm);
|
||||||
|
var options = editor.options;
|
||||||
|
return function(url) {
|
||||||
|
_replaceSelection(cm, stat.link, options.insertTexts.link, url);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -634,14 +650,30 @@ function drawImage(editor) {
|
|||||||
var cm = editor.codemirror;
|
var cm = editor.codemirror;
|
||||||
var stat = getState(cm);
|
var stat = getState(cm);
|
||||||
var options = editor.options;
|
var options = editor.options;
|
||||||
var url = "http://";
|
if(options.drawImage) {
|
||||||
if(options.promptURLs) {
|
options.drawImage(__drawImage(editor));
|
||||||
url = prompt(options.promptTexts.image);
|
} else {
|
||||||
if(!url) {
|
var url = "http://";
|
||||||
return false;
|
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);
|
}
|
||||||
|
/**
|
||||||
|
* Custom Action for drawing am img.
|
||||||
|
* by ucev
|
||||||
|
*/
|
||||||
|
function __drawImage(editor) {
|
||||||
|
var cm = editor.codemirror;
|
||||||
|
var stat = getState(cm);
|
||||||
|
var options = editor.options;
|
||||||
|
return function(url) {
|
||||||
|
_replaceSelection(cm, stat.image, options.insertTexts.image, url);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1242,7 +1274,7 @@ var toolbarBuiltInButtons = {
|
|||||||
|
|
||||||
var insertTexts = {
|
var insertTexts = {
|
||||||
link: ["[", "](#url#)"],
|
link: ["[", "](#url#)"],
|
||||||
image: [""],
|
image: [""],
|
||||||
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
|
table: ["", "\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],
|
||||||
horizontalRule: ["", "\n\n-----\n\n"]
|
horizontalRule: ["", "\n\n-----\n\n"]
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user