@@ -829,7 +829,7 @@ angular.module('textAngularSetup', [])
829
829
/* istanbul ignore next: don't know how to test this... since it needs a dialogPrompt */
830
830
// block javascript here
831
831
if ( ! blockJavascript ( imageLink ) ) {
832
- if ( taSelection . getSelectionElement ( ) . tagName . toLowerCase ( ) === 'a' ) {
832
+ if ( taSelection . getSelectionElement ( ) . tagName && taSelection . getSelectionElement ( ) . tagName . toLowerCase ( ) === 'a' ) {
833
833
// due to differences in implementation between FireFox and Chrome, we must move the
834
834
// insertion point past the <a> element, otherwise FireFox inserts inside the <a>
835
835
// With this change, both FireFox and Chrome behave the same way!
@@ -876,7 +876,7 @@ angular.module('textAngularSetup', [])
876
876
// maxresdefault.jpg seems to be undefined on some.
877
877
var embed = '<img class="ta-insert-video" src="https://img.youtube.com/vi/' + videoId + '/hqdefault.jpg" ta-insert-video="' + urlLink + '" contenteditable="false" allowfullscreen="true" frameborder="0" />' ;
878
878
/* istanbul ignore next: don't know how to test this... since it needs a dialogPrompt */
879
- if ( taSelection . getSelectionElement ( ) . tagName . toLowerCase ( ) === 'a' ) {
879
+ if ( taSelection . getSelectionElement ( ) . tagName && taSelection . getSelectionElement ( ) . tagName . toLowerCase ( ) === 'a' ) {
880
880
// due to differences in implementation between FireFox and Chrome, we must move the
881
881
// insertion point past the <a> element, otherwise FireFox inserts inside the <a>
882
882
// With this change, both FireFox and Chrome behave the same way!
@@ -901,7 +901,7 @@ angular.module('textAngularSetup', [])
901
901
var urlLink ;
902
902
// if this link has already been set, we need to just edit the existing link
903
903
/* istanbul ignore if: we do not test this */
904
- if ( taSelection . getSelectionElement ( ) . tagName . toLowerCase ( ) === 'a' ) {
904
+ if ( taSelection . getSelectionElement ( ) . tagName && taSelection . getSelectionElement ( ) . tagName . toLowerCase ( ) === 'a' ) {
905
905
urlLink = $window . prompt ( taTranslations . insertLink . dialogPrompt , taSelection . getSelectionElement ( ) . href ) ;
906
906
} else {
907
907
urlLink = $window . prompt ( taTranslations . insertLink . dialogPrompt , 'http://' ) ;
0 commit comments