Skip to content

Commit

Permalink
Fix(textAngularSetup): Corrected bug #1201 due to an issue with Firefox.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelParke committed Jul 13, 2016
1 parent 328cd69 commit dab42a3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/textAngularSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,16 @@ angular.module('textAngularSetup', [])
var imageLink;
imageLink = $window.prompt(taTranslations.insertImage.dialogPrompt, 'http://');
if(imageLink && imageLink !== '' && imageLink !== 'http://'){
return this.$editor().wrapSelection('insertImage', imageLink, true);
// In the past we used the simple statement:
//return this.$editor().wrapSelection('insertImage', imageLink, true);
//
// However on Firefox only, when the content is empty this is a problem
// See Issue #1201
// Investigation reveals that Firefox only inserts a <p> only!!!!
// So now we use insertHTML here and all is fine.
// NOTE: this is what 'insertImage' is supposed to do anyway!
var embed = '<img src="' + imageLink + '">';
return this.$editor().wrapSelection('insertHTML', embed, true);
}
},
onElementSelect: {
Expand Down

0 comments on commit dab42a3

Please sign in to comment.