]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/entity-selector.js
Added new endpoint for search suggestions
[bookstack] / resources / js / components / entity-selector.js
index 6d9d06f860329b402c9166db51ffc646537ca988..2f009b2daf6242751ff59a93de0f2ad9e8c495df 100644 (file)
@@ -87,6 +87,16 @@ class EntitySelector {
         }
     }
 
+    reset() {
+        this.searchInput.value = '';
+        this.showLoading();
+        this.initialLoad();
+    }
+
+    focusSearch() {
+        this.searchInput.focus();
+    }
+
     showLoading() {
         this.loading.style.display = 'block';
         this.resultsContainer.style.display = 'none';
@@ -105,7 +115,7 @@ class EntitySelector {
     }
 
     searchUrl() {
-        return `/ajax/search/entities?types=${encodeURIComponent(this.entityTypes)}&permission=${encodeURIComponent(this.entityPermission)}`;
+        return `/search/entity-selector?types=${encodeURIComponent(this.entityTypes)}&permission=${encodeURIComponent(this.entityPermission)}`;
     }
 
     searchEntities(searchTerm) {