Insert image links wherever cursor is in the editor

This commit is contained in:
Andrew Manning 2016-06-25 06:50:24 -05:00
parent 83a42afddf
commit 241b257556

View File

@ -423,8 +423,8 @@ function wiki_delete_wiki(wikiHtmlName, resource_id) {
$.post("embedphotos/photolink", {href: href},
function(ddata) {
if (ddata['status']) {
var imgURL = ddata['photolink'].replace( /\[.*\]\[.*\](.*)\[.*\]\[.*\]/, '![image]($1)' )
editor.getSession().setValue(editor.getValue() + imgURL);
var imgURL = ddata['photolink'].replace( /\[.*\]\[.*\](.*)\[.*\]\[.*\]/, '\n![image]($1)' )
editor.getSession().insert(editor.getCursorPosition(), imgURL)
} else {
window.console.log('{{$modalerrorlink}}' + ':' + ddata['errormsg']);
}