diff --git a/modules/core/client/directives/torrent-image-list.client.directive.js b/modules/core/client/directives/torrent-image-list.client.directive.js index 883a1271..15215366 100644 --- a/modules/core/client/directives/torrent-image-list.client.directive.js +++ b/modules/core/client/directives/torrent-image-list.client.directive.js @@ -9,7 +9,6 @@ function torrentImageList($sce, $parse, $compile, $timeout) { var directive = { restrict: 'A', - replace: true, priority: 10, link: link }; @@ -18,15 +17,36 @@ function link(scope, element, attrs) { scope.$watch(attrs.torrentImageList, function (til) { - if (til) { - console.log(element[0]); + hideImage(); + + var targetNode = document.getElementById(attrs.torrentImageList); + + var config = {childList: true}; + + var callback = function (mutationsList) { + for (var mutation of mutationsList) { + if (mutation.type === 'childList') { + hideImage(); + } + } + }; + + var observer = new MutationObserver(callback); + observer.observe(targetNode, config); + + //observer.disconnect(); + + function hideImage() { var imgs = element[0].querySelectorAll('img:not(.emoji)'); console.log(imgs); angular.forEach(imgs, function (i) { + if (i.previousSibling && i.previousSibling.tagName.toUpperCase() === 'BR') { + i.previousSibling.remove(); + } if (i.parentElement.childElementCount === 1) { - angular.element(i.parentElement).css('display', 'none'); + angular.element(i.parentElement).remove(); } else { - angular.element(i).css('display', 'none'); + angular.element(i).remove(); } }); } diff --git a/modules/torrents/client/views/view-torrent.client.view.html b/modules/torrents/client/views/view-torrent.client.view.html index e5b565f2..67f1c42f 100644 --- a/modules/torrents/client/views/view-torrent.client.view.html +++ b/modules/torrents/client/views/view-torrent.client.view.html @@ -182,9 +182,10 @@ {{vm.TGI.getTorrentOverview(vm.torrentLocalInfo)}}
-
+
+
+
+ mt-markdown-editor="commentContent" + maxlength="{{vm.inputLengthConfig.torrentCommentLength}}">