compose: Add spaces around markdown for attachments.

If your cursor is in the middle of a word when you upload
an image, the code will now properly put spaces in the markdown
around the attachment link.

Fixes: #7212.
This commit is contained in:
elenaoat
2017-11-02 23:01:50 +02:00
committed by Steve Howell
parent 76898dd4d3
commit 7b455f597b
2 changed files with 11 additions and 5 deletions

View File

@@ -114,10 +114,12 @@ exports.options = function (config) {
if (i === -1) {
// This is a paste, so there's no filename. Show the image directly
textarea.val(textarea.val() + "[pasted image](" + uri + ") ");
var pasted_image_uri = "[pasted image](" + uri + ")";
compose_ui.insert_syntax_and_focus(pasted_image_uri);
} else {
// This is a dropped file, so make the filename a link to the image
textarea.val(textarea.val() + "[" + filename + "](" + uri + ")" + " ");
var filename_uri = "[" + filename + "](" + uri + ")";
compose_ui.insert_syntax_and_focus(filename_uri);
}
compose_ui.autosize_textarea();
send_button.prop("disabled", false);