Skip to content
Snippets Groups Projects
Unverified Commit c5ba23f5 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Check if elements are already in the dom

parent 488da7b6
No related branches found
No related tags found
No related merge requests found
...@@ -310,8 +310,11 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) { ...@@ -310,8 +310,11 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
} }
loadWebdavDirectory() { loadWebdavDirectory() {
if (this._('#nextcloud-file-picker').webDavClient !== null) { const filePicker = this._('#nextcloud-file-picker');
this._('#nextcloud-file-picker').loadDirectory(this._('#nextcloud-file-picker').directoryPath);
// check if element is already in the dom (for example if "dialog-open" attribute is set)
if (filePicker && filePicker.webDavClient !== null) {
filePicker.loadDirectory(filePicker.directoryPath);
} }
} }
...@@ -320,11 +323,16 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) { ...@@ -320,11 +323,16 @@ export class FileSource extends ScopedElementsMixin(DBPLitElement) {
this.loadWebdavDirectory(); this.loadWebdavDirectory();
} }
MicroModal.show(this._('#modal-picker'), { const filePicker = this._('#modal-picker');
disableScroll: true,
onClose: modal => { this.isDialogOpen = false; // check if element is already in the dom (for example if "dialog-open" attribute is set)
this._('#nextcloud-file-picker').selectAllButton = true;} if (filePicker) {
}); MicroModal.show(filePicker, {
disableScroll: true,
onClose: modal => { this.isDialogOpen = false;
this._('#nextcloud-file-picker').selectAllButton = true;}
});
}
} }
closeDialog() { closeDialog() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment