From 4ece67f72c66d46c60df41fab9399683a747128b Mon Sep 17 00:00:00 2001 From: Richard Kiewiet Date: Fri, 12 Oct 2018 14:50:48 +0200 Subject: [PATCH] Bugfix for empty $oldTag empty oldTag tags get surrounded by newTag on every keystroke. This resulted in huge content. I dont know what the best solution would be but I added a simple contents().length check and only replace it when there is content inside the tag. This would occur with tags when using font-awesome for example. --- src/trumbowyg.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/trumbowyg.js b/src/trumbowyg.js index 329e9c8af..99a267dd0 100644 --- a/src/trumbowyg.js +++ b/src/trumbowyg.js @@ -1178,6 +1178,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', { $(oldTag, this.$ed).each(function () { var $oldTag = $(this); + if($oldTag.contents().length == 0) return false $oldTag.wrap('<' + newTag + '/>'); if (copyAttributes) { $.each($oldTag.prop('attributes'), function () {