]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/entity-selector-popup.js
Merge branch 'development' of github.com:BookStackApp/BookStack into development
[bookstack] / resources / js / components / entity-selector-popup.js
index 231f1021fcbe1158f7f7ba331276e6ba5ba68135..fb74fa5b829c8c14d625e335042e6e1d8e48df17 100644 (file)
@@ -7,9 +7,9 @@ class EntitySelectorPopup {
     setup() {
         this.elem = this.$el;
         this.selectButton = this.$refs.select;
-        this.searchInput = this.$refs.searchInput;
 
         window.EntitySelectorPopup = this;
+        this.selectorEl = this.$refs.selector;
 
         this.callback = null;
         this.selection = null;
@@ -22,13 +22,17 @@ class EntitySelectorPopup {
     show(callback) {
         this.callback = callback;
         this.elem.components.popup.show();
-        this.searchInput.focus();
+        this.getSelector().focusSearch();
     }
 
     hide() {
         this.elem.components.popup.hide();
     }
 
+    getSelector() {
+        return this.selectorEl.components['entity-selector'];
+    }
+
     onSelectButtonClick() {
         this.hide();
         if (this.selection !== null && this.callback) this.callback(this.selection);
@@ -36,6 +40,7 @@ class EntitySelectorPopup {
 
     onSelectionConfirm(entity) {
         this.hide();
+        this.getSelector().reset();
         if (this.callback && entity) this.callback(entity);
     }