From be8a89e01ee9a69546fe226bd43437475fdbe908 Mon Sep 17 00:00:00 2001 From: buddh4 Date: Fri, 6 Jul 2018 22:37:33 +0200 Subject: [PATCH] Fix: UI addition mutation observer interfering with new rich-text mutation logic --- protected/humhub/docs/CHANGELOG.md | 1 + protected/humhub/modules/comment/resources/js/humhub.comment.js | 2 +- static/js/humhub/humhub.ui.additions.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/protected/humhub/docs/CHANGELOG.md b/protected/humhub/docs/CHANGELOG.md index 37ae98c541..050ed7ae6d 100644 --- a/protected/humhub/docs/CHANGELOG.md +++ b/protected/humhub/docs/CHANGELOG.md @@ -5,6 +5,7 @@ HumHub Change Log 1.3.0-beta.2 (Unreleased) -------------------------- - Enh: Added CounterSet Widget to handle Space/Profile header statistic counts +- Fix: UI addition mutation observer interfering with new rich-text mutation logic 1.3.0-beta.1 (July 4, 2018) diff --git a/protected/humhub/modules/comment/resources/js/humhub.comment.js b/protected/humhub/modules/comment/resources/js/humhub.comment.js index b4abf04e1d..151487da2c 100644 --- a/protected/humhub/modules/comment/resources/js/humhub.comment.js +++ b/protected/humhub/modules/comment/resources/js/humhub.comment.js @@ -19,7 +19,6 @@ humhub.module('comment', function (module, require, $) { that.addComment(response.html); that.getInput().val('').trigger('autosize.resize'); richText.$.trigger('clear'); - //richText.focus(); that.getUpload().reset(); }).catch(function (err) { module.log.error(err, true); @@ -224,6 +223,7 @@ humhub.module('comment', function (module, require, $) { var toggleComment = function(evt) { var visible = evt.$target.is(':visible'); evt.$target.slideToggle(undefined, function() { + debugger; evt.$target.find('.humhub-ui-richtext').trigger('focus'); }); }; diff --git a/static/js/humhub/humhub.ui.additions.js b/static/js/humhub/humhub.ui.additions.js index d639c51de9..1af6688e59 100644 --- a/static/js/humhub/humhub.ui.additions.js +++ b/static/js/humhub/humhub.ui.additions.js @@ -239,7 +239,7 @@ humhub.module('ui.additions', function (module, require, $) { var observer = new MutationObserver(function (mutations) { mutations.forEach(function (mutation) { var $nodes = $(mutation.addedNodes).filter(function () { - return this.nodeType === 1; // filter out text nodes + return this.nodeType === 1 && !$(this).closest('.humhub-ui-richtext').length; // filter out text nodes and ignore richtext changes }); $nodes.each(function () {