]> BookStack Code Mirror - bookstack/commitdiff
Updated comment delete action to be a button
authorDan Brown <redacted>
Mon, 7 Oct 2019 19:21:04 +0000 (20:21 +0100)
committerDan Brown <redacted>
Mon, 7 Oct 2019 19:21:04 +0000 (20:21 +0100)
Fixes issue that causes code error when an anchor tag.

Closes #1650

resources/assets/js/components/page-comments.js
resources/views/comments/comment.blade.php

index cabce91396082cf1944153e274d590643ed25742..5d8d169589804a5c92fd355281353bdcdaf6ed88 100644 (file)
@@ -26,10 +26,12 @@ class PageComments {
 
     handleAction(event) {
         let actionElem = event.target.closest('[action]');
+
         if (event.target.matches('a[href^="#"]')) {
             const id = event.target.href.split('#')[1];
             scrollAndHighlightElement(document.querySelector('#' + id));
         }
+
         if (actionElem === null) return;
         event.preventDefault();
 
index 5fbdfa500c6f10d14ddc64db887eb5ee2c8a824f..ea96a9250dd24a22f2bf274fc093f52edcd6454e 100644 (file)
@@ -31,7 +31,7 @@
                         <button type="button" dropdown-toggle aria-haspopup="true" aria-expanded="false" class="text-button" title="{{ trans('common.delete') }}">@icon('delete')</button>
                         <ul class="dropdown-menu" role="menu">
                             <li class="px-m text-small text-muted pb-s">{{trans('entities.comment_delete_confirm')}}</li>
-                            <li><a action="delete" href="#" class="text-button text-neg" >@icon('delete'){{ trans('common.delete') }}</a></li>
+                            <li><button action="delete" type="button" class="text-button text-neg" >@icon('delete'){{ trans('common.delete') }}</button></li>
                         </ul>
                     </div>
                 @endif