From a3744f812ea75b03e3f8f453bd6242b6455081af Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 20 Aug 2020 15:25:24 +0300 Subject: [PATCH 1/2] CmsKit: Should focus on the comment area after login and return back https://github.com/abpframework/abp/issues/5073 --- .../CmsKit/Shared/Components/Commenting/Default.cshtml | 2 +- .../CmsKit/Shared/Components/Commenting/default.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml index 5246f9a0f1..b8118e99ca 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/Default.cshtml @@ -87,7 +87,7 @@ ; } -
+

diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js index 2950f8239b..8cce108ee5 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js @@ -135,6 +135,14 @@ }); } + function focusOnHash($container) { + if (location.hash === ''){ + return; + } + + $('html, body').animate({ scrollTop: $(location.hash).offset().top + $(this).height() / 2 }, 'slow'); + } + function init() { registerReplyLinks($widget); registerEditLinks($widget); @@ -142,6 +150,8 @@ registerUpdateOfNewComment($widget); registerSubmissionOfNewComment($widget); + + focusOnHash($widget); } return { From d59dd4a28821c018e11ba993e9650dc3cc137158 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 24 Aug 2020 10:19:35 +0300 Subject: [PATCH 2/2] pull/5134 requested changes --- .../Pages/CmsKit/Shared/Components/Commenting/default.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js index 8cce108ee5..f7bf554638 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Pages/CmsKit/Shared/Components/Commenting/default.js @@ -136,11 +136,15 @@ } function focusOnHash($container) { - if (location.hash === ''){ + if (!location.hash.toLowerCase().startsWith('#cms-comment')){ return; } - $('html, body').animate({ scrollTop: $(location.hash).offset().top + $(this).height() / 2 }, 'slow'); + $('html, body').animate( + { + scrollTop: $(location.hash).offset().top + $(this).height() / 2 + }, + 'slow'); } function init() {