Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 9b1a5c3

Browse files
committed
workaround for error during removing image link input
1 parent d079c66 commit 9b1a5c3

File tree

5 files changed

+20
-23
lines changed

5 files changed

+20
-23
lines changed

dist/js/addons/medium-editor-insert-images.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -407,17 +407,16 @@
407407
.removeClass('mediumInsert-imageLink')
408408
.addClass('mediumInsert-imageUnlink');
409409

410-
that.$el.trigger('keyup').trigger('input');
411-
412-
if ($('.mediumInsert-imageLinkWire').length) {
410+
// Workaround for "Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is no longer a child of this node. Perhaps it was moved in a 'blur' event handler?"
411+
try {
413412
$('.mediumInsert-imageLinkWire').remove();
414-
}
413+
} catch(err) {}
414+
415+
that.$el.trigger('keyup').trigger('input');
415416
}
416417
})
417418
.on('blur', '.mediumInsert-imageLinkText', function () {
418-
if ($('.mediumInsert-imageLinkWire').length) {
419-
$('.mediumInsert-imageLinkWire').remove();
420-
}
419+
$('.mediumInsert-imageLinkWire').remove();
421420
})
422421
.on('paste', '.mediumInsert-imageLinkText', function (e) {
423422
if ($.fn.mediumInsert.insert.isFirefox && e.originalEvent.clipboardData) {

dist/js/addons/medium-editor-insert-images.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/medium-editor-insert-plugin.all.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,17 +1080,16 @@
10801080
.removeClass('mediumInsert-imageLink')
10811081
.addClass('mediumInsert-imageUnlink');
10821082

1083-
that.$el.trigger('keyup').trigger('input');
1084-
1085-
if ($('.mediumInsert-imageLinkWire').length) {
1083+
// Workaround for "Uncaught NotFoundError: Failed to execute 'removeChild' on 'Node': The node to be removed is no longer a child of this node. Perhaps it was moved in a 'blur' event handler?"
1084+
try {
10861085
$('.mediumInsert-imageLinkWire').remove();
1087-
}
1086+
} catch(err) {}
1087+
1088+
that.$el.trigger('keyup').trigger('input');
10881089
}
10891090
})
10901091
.on('blur', '.mediumInsert-imageLinkText', function () {
1091-
if ($('.mediumInsert-imageLinkWire').length) {
1092-
$('.mediumInsert-imageLinkWire').remove();
1093-
}
1092+
$('.mediumInsert-imageLinkWire').remove();
10941093
})
10951094
.on('paste', '.mediumInsert-imageLinkText', function (e) {
10961095
if ($.fn.mediumInsert.insert.isFirefox && e.originalEvent.clipboardData) {

0 commit comments

Comments
 (0)