]> BookStack Code Mirror - bookstack/commitdiff
Aligned entity-selector-popup button and dblclick behaviour
authorDan Brown <redacted>
Mon, 27 Jun 2022 13:27:29 +0000 (14:27 +0100)
committerDan Brown <redacted>
Mon, 27 Jun 2022 13:27:29 +0000 (14:27 +0100)
Fixes #3534

resources/js/components/entity-selector-popup.js

index fb74fa5b829c8c14d625e335042e6e1d8e48df17..e7cb60b1f6c4c05c751033ebec4424b8de7fea1d 100644 (file)
@@ -16,7 +16,7 @@ class EntitySelectorPopup {
 
         this.selectButton.addEventListener('click', this.onSelectButtonClick.bind(this));
         window.$events.listen('entity-select-change', this.onSelectionChange.bind(this));
-        window.$events.listen('entity-select-confirm', this.onSelectionConfirm.bind(this));
+        window.$events.listen('entity-select-confirm', this.handleConfirmedSelection.bind(this));
     }
 
     show(callback) {
@@ -34,14 +34,7 @@ class EntitySelectorPopup {
     }
 
     onSelectButtonClick() {
-        this.hide();
-        if (this.selection !== null && this.callback) this.callback(this.selection);
-    }
-
-    onSelectionConfirm(entity) {
-        this.hide();
-        this.getSelector().reset();
-        if (this.callback && entity) this.callback(entity);
+        this.handleConfirmedSelection(this.selection);
     }
 
     onSelectionChange(entity) {
@@ -52,6 +45,12 @@ class EntitySelectorPopup {
             this.selectButton.removeAttribute('disabled');
         }
     }
+
+    handleConfirmedSelection(entity) {
+        this.hide();
+        this.getSelector().reset();
+        if (this.callback && entity) this.callback(entity);
+    }
 }
 
 export default EntitySelectorPopup;
\ No newline at end of file
Morty Proxy This is a proxified and sanitized view of the page, visit original site.