]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/dropdown-search.js
Drawings: Added class to extract drawio data from png files
[bookstack] / resources / js / components / dropdown-search.js
index e2d55f9694ded7b9d938050f563fad4791a93cb4..fcbabc022a7c21395272c092e175fb968d773ab2 100644 (file)
@@ -1,6 +1,8 @@
-import {debounce} from "../services/util";
+import {debounce} from '../services/util.ts';
+import {transitionHeight} from '../services/animations.ts';
+import {Component} from './component';
 
-class DropdownSearch {
+export class DropdownSearch extends Component {
 
     setup() {
         this.elem = this.$el;
@@ -38,7 +40,7 @@ class DropdownSearch {
 
     runLocalSearch(searchTerm) {
         const listItems = this.listContainerElem.querySelectorAll(this.localSearchSelector);
-        for (let listItem of listItems) {
+        for (const listItem of listItems) {
             const match = !searchTerm || listItem.textContent.toLowerCase().includes(searchTerm);
             listItem.style.display = match ? 'flex' : 'none';
             listItem.classList.toggle('hidden', !match);
@@ -51,7 +53,9 @@ class DropdownSearch {
 
         try {
             const resp = await window.$http.get(this.getAjaxUrl(searchTerm));
+            const animate = transitionHeight(this.listContainerElem, 80);
             this.listContainerElem.innerHTML = resp.data;
+            animate();
         } catch (err) {
             console.error(err);
         }
@@ -76,5 +80,3 @@ class DropdownSearch {
     }
 
 }
-
-export default DropdownSearch;
\ No newline at end of file