X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/63cb6015a8c6db453f5551e50c04bf6ebbc0f3f1..refs/heads/development:/resources/js/components/confirm-dialog.js diff --git a/resources/js/components/confirm-dialog.js b/resources/js/components/confirm-dialog.js index 858be1b85..00f3cfed2 100644 --- a/resources/js/components/confirm-dialog.js +++ b/resources/js/components/confirm-dialog.js @@ -1,12 +1,12 @@ -import {onSelect} from "../services/dom"; +import {onSelect} from '../services/dom.ts'; +import {Component} from './component'; /** * Custom equivalent of window.confirm() using our popup component. * Is promise based so can be used like so: * `const result = await dialog.show()` - * @extends {Component} */ -class ConfirmDialog { +export class ConfirmDialog extends Component { setup() { this.container = this.$el; @@ -25,8 +25,8 @@ class ConfirmDialog { this.sendResult(false); }); - return new Promise((res, rej) => { - this.res = res; + return new Promise(res => { + this.res = res; }); } @@ -34,7 +34,7 @@ class ConfirmDialog { * @returns {Popup} */ getPopup() { - return this.container.components.popup; + return window.$components.firstOnElement(this.container, 'popup'); } /** @@ -42,11 +42,9 @@ class ConfirmDialog { */ sendResult(result) { if (this.res) { - this.res(result) + this.res(result); this.res = null; } } } - -export default ConfirmDialog; \ No newline at end of file