X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/85db812feaae5f36ea6214931cec4adb67a9cb39..refs/pull/3908/head:/resources/js/components/entity-selector.js diff --git a/resources/js/components/entity-selector.js b/resources/js/components/entity-selector.js index 6d9d06f86..1384b33a9 100644 --- a/resources/js/components/entity-selector.js +++ b/resources/js/components/entity-selector.js @@ -1,10 +1,10 @@ import {onChildEvent} from "../services/dom"; +import {Component} from "./component"; /** * Entity Selector - * @extends {Component} */ -class EntitySelector { +export class EntitySelector extends Component { setup() { this.elem = this.$el; @@ -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) { @@ -175,6 +185,4 @@ class EntitySelector { this.selectedItemData = null; } -} - -export default EntitySelector; \ No newline at end of file +} \ No newline at end of file