Encoding URI for images when added to the editor (fixes #31)

This commit is contained in:
Djamil Legato
2015-08-07 16:27:13 -07:00
parent 181c3b55e7
commit 2bd83fb22f
2 changed files with 2 additions and 2 deletions

View File

@@ -80,7 +80,7 @@
$("#gravDropzone").delegate('[data-dz-insert]', 'click', function(e) {
var target = $(e.currentTarget).parent('.dz-preview').find('.dz-filename');
editor.focus();
editor.doc.replaceSelection('![](' + target.text() + ')');
editor.doc.replaceSelection('![](' + encodeURI(target.text()) + ')');
});
this.preview.container = this.preview;

View File

@@ -121,7 +121,7 @@
var dropzone = new Dropzone("#gravDropzone", { url: URI + '/task:addmedia', createImageThumbnails: { thumbnailWidth: 150} });
$("#gravDropzone").delegate('.dz-preview', 'dragstart', function(e){
var uri = $(this).find('.dz-filename').text(), shortcode = '![](' + uri + ')';
var uri = $(this).find('.dz-filename').text(), shortcode = '![](' + encodeURI(uri) + ')';
dropzone.disable();
$(this).addClass('hide-backface');
e.originalEvent.dataTransfer.effectAllowed = 'copy';