Allow CTRL-Click on more links
authorAdam Dullage <redacted>
Mon, 26 Sep 2022 19:43:16 +0000 (20:43 +0100)
committerAdam Dullage <redacted>
Mon, 26 Sep 2022 19:43:16 +0000 (20:43 +0100)
flatnotes/src/components/App.js
flatnotes/src/components/App.vue
flatnotes/src/components/NavBar.vue
flatnotes/src/components/SearchResults.vue
flatnotes/src/global.scss

index a3f3d1784e97c905f99abe6e40125a814e49aafe..0553ed9eaf43c005e17d2022cd4ef450293d4ab2 100644 (file)
@@ -105,18 +105,6 @@ export default {
       this.navigate(constants.basePaths.login);
     },
 
-    newNote: function() {
-      this.navigate(constants.basePaths.new);
-    },
-
-    az: function() {
-      let params = new URLSearchParams();
-      params.set(constants.params.searchTerm, "*");
-      params.set(constants.params.sortBy, constants.searchSortOptions.title);
-      params.set(constants.params.showHighlights, false);
-      this.navigate(`${constants.basePaths.search}?${params.toString()}`);
-    },
-
     noteDeletedToast: function() {
       this.$bvToast.toast("Note deleted ✓", {
         variant: "success",
index d6dec1d3ffee8be2e6b1e29f8964631d19d9abed..25654a09c53baa014d903acf221bc9f0246d8a2c 100644 (file)
@@ -12,9 +12,6 @@
       v-if="currentView != views.login"
       class="w-100 mb-5"
       :show-logo="currentView != views.home"
-      @navigate-home="navigate(constants.basePaths.home)"
-      @new-note="newNote()"
-      @a-z="az()"
       @logout="logout()"
       @search="openSearch()"
     ></NavBar>
index 4092d8f1086c035308295b85bf342007d4fffca6..1d3186f8015b565773fefef5da48a73955378b93 100644 (file)
@@ -1,19 +1,26 @@
 <template>
   <div class="d-flex justify-content-between align-items-center">
     <!-- Logo -->
-    <Logo
-      class="cursor-pointer"
-      :class="{ invisible: !showLogo }"
-      @click.native="$emit('navigate-home')"
-      responsive
-    ></Logo>
+    <a
+      :href="constants.basePaths.home"
+      @click.prevent="navigate(constants.basePaths.home, $event)"
+    >
+      <Logo
+        :class="{ invisible: !showLogo }"
+        responsive
+      ></Logo>
+    </a>
 
     <!-- Buttons -->
-    <div>
+    <div class="d-flex">
       <!-- New Note -->
-      <button type="button" class="bttn" @click="$emit('new-note')">
+      <a
+        :href="constants.basePaths.new"
+        class="bttn"
+        @click.prevent="navigate(constants.basePaths.new, $event)"
+      >
         <b-icon icon="plus-circle"></b-icon> New
-      </button>
+      </a>
 
       <!-- Log Out -->
       <button type="button" class="bttn" @click="$emit('logout')">
@@ -21,7 +28,9 @@
       </button>
 
       <!-- A-Z -->
-      <button type="button" class="bttn" @click="$emit('a-z')">A-Z</button>
+      <a :href="azHref" class="bttn" @click.prevent="navigate(azHref, $event)"
+        >A-Z</a
+      >
 
       <!-- Search -->
       <button
 .invisible {
   visibility: hidden;
 }
-
-.cursor-pointer {
-  cursor: pointer;
-}
 </style>
 
 <script>
+import * as constants from "../constants";
+
+import EventBus from "../eventBus";
 import Logo from "./Logo";
 
 export default {
@@ -63,5 +71,25 @@ export default {
       default: true,
     },
   },
+
+  computed: {
+    azHref: function () {
+      let params = new URLSearchParams();
+      params.set(constants.params.searchTerm, "*");
+      params.set(constants.params.sortBy, constants.searchSortOptions.title);
+      params.set(constants.params.showHighlights, false);
+      return `${constants.basePaths.search}?${params.toString()}`;
+    },
+  },
+
+  methods: {
+    navigate: function (href, event) {
+      EventBus.$emit("navigate", href, event);
+    },
+  },
+
+  created: function () {
+    this.constants = constants;
+  },
 };
 </script>
index 49fc1041d1f22460608b4a629f8481eae7ae5f23..2af9febcfad95794d7607619ab6f428e7af8537c 100644 (file)
@@ -54,7 +54,7 @@
           class="bttn result"
           :class="{ 'mb-3': searchResultsIncludeHighlights && showHighlights }"
         >
-          <a :href="result.href" @click.prevent="openNote(result.href)">
+          <a :href="result.href" @click.prevent="openNote(result.href, $event)">
             <div class="d-flex justify-content-between">
               <p
                 class="result-title"
@@ -308,8 +308,8 @@ export default {
       return notesGroupedArray;
     },
 
-    openNote: function (href) {
-      EventBus.$emit("navigate", href);
+    openNote: function (href, event) {
+      EventBus.$emit("navigate", href, event);
     },
 
     sortOptionToString: function (sortOption) {
index c61d84a4d7504a293c1f8984f0124d0fd4dc5ea9..17f4fbffeb54a2ced8a3b4f29251ac8833a378c6 100644 (file)
@@ -45,4 +45,5 @@ a {
 .bttn:hover {
   background-color: $button-background;
   cursor: pointer;
+  color: inherit;
 }
git clone https://git.99rst.org/PROJECT