« get me outta code hell

client: sidebar-search: split 2+ dashes in single-word drop - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/js/client
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-12-11 17:44:00 -0400
committer(quasar) nebula <qznebula@protonmail.com>2024-12-19 13:24:59 -0400
commit613bfbc6e8d492852cd2d9fd4842dadeb6bb4a77 (patch)
treecef3dac5899c780e0e1141f622d7ab1aa1ede861 /src/static/js/client
parent43ac0861fee49b28a0cd6b4e7822eeebb654ea54 (diff)
client: sidebar-search: split 2+ dashes in single-word drop
Diffstat (limited to 'src/static/js/client')
-rw-r--r--src/static/js/client/sidebar-search.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/static/js/client/sidebar-search.js b/src/static/js/client/sidebar-search.js
index b7b0b8f0..9d2cae34 100644
--- a/src/static/js/client/sidebar-search.js
+++ b/src/static/js/client/sidebar-search.js
@@ -963,6 +963,16 @@ async function handleDroppedIntoSearchInput(domEvent) {
     droppedText = matchedLink.innerText;
   }
 
+  if (droppedText.includes('-')) splitDashes: {
+    if (droppedURL) break splitDashes;
+    if (droppedText.includes(' ')) break splitDashes;
+
+    const parts = droppedText.split('-');
+    if (parts.length === 2) break splitDashes;
+
+    droppedText = parts.join(' ');
+  }
+
   info.searchInput.value = droppedText;
   activateSidebarSearch(info.searchInput.value);
 }