From 1fd6abe047d9d950ac35126fcfe572c52af850b7 Mon Sep 17 00:00:00 2001 From: NamelessContributor Date: Thu, 5 May 2022 12:39:23 +0200 Subject: [PATCH] related tags: fix wiki link adding "undefined" tag Fix #5154 Only add `toggle_tag` listener to links with the `search-tag` class, add `target="_blank"` to wiki links to prevent accidentally leaving the edit form. --- app/javascript/src/javascripts/related_tag.js | 2 +- app/views/related_tags/_current_tags.html.erb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/src/javascripts/related_tag.js b/app/javascript/src/javascripts/related_tag.js index 945ccd894..ad3b221d3 100644 --- a/app/javascript/src/javascripts/related_tag.js +++ b/app/javascript/src/javascripts/related_tag.js @@ -6,7 +6,7 @@ let RelatedTag = {}; RelatedTag.initialize_all = function() { $(document).on("click.danbooru", ".related-tags-button", RelatedTag.on_click_related_tags_button); $(document).on("change.danbooru", ".related-tags input", RelatedTag.toggle_tag); - $(document).on("click.danbooru", ".related-tags a", RelatedTag.toggle_tag); + $(document).on("click.danbooru", ".related-tags a.search-tag", RelatedTag.toggle_tag); $(document).on("click.danbooru", "#show-related-tags-link", RelatedTag.show); $(document).on("click.danbooru", "#hide-related-tags-link", RelatedTag.hide); $(document).on("keyup.danbooru.relatedTags", "#post_tag_string", RelatedTag.update_selected); diff --git a/app/views/related_tags/_current_tags.html.erb b/app/views/related_tags/_current_tags.html.erb index ecf389b2d..4a97ed8df 100644 --- a/app/views/related_tags/_current_tags.html.erb +++ b/app/views/related_tags/_current_tags.html.erb @@ -1,10 +1,10 @@