]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/attachments.js
Fix timestamp in API docs example response
[bookstack] / resources / js / components / attachments.js
index 6dcfe9f128cf39a8e7a2d0586b32b9320613c5f8..9555a59e811c999aa10a98fa4e4df3337f3595f6 100644 (file)
@@ -1,10 +1,7 @@
-/**
- * Attachments
- * @extends {Component}
- */
-import {showLoading} from "../services/dom";
+import {showLoading} from '../services/dom';
+import {Component} from './component';
 
-class Attachments {
+export class Attachments extends Component {
 
     setup() {
         this.container = this.$el;
@@ -30,7 +27,7 @@ class Attachments {
             this.startEdit(event.detail.id);
         });
 
-        this.container.addEventListener('event-emit-select-edit-back', event => {
+        this.container.addEventListener('event-emit-select-edit-back', () => {
             this.stopEdit();
         });
 
@@ -46,10 +43,12 @@ class Attachments {
 
     reloadList() {
         this.stopEdit();
-        this.mainTabs.components.tabs.show('items');
+        /** @var {Tabs} */
+        const tabs = window.$components.firstOnElement(this.mainTabs, 'tabs');
+        tabs.show('attachment-panel-items');
         window.$http.get(`/attachments/get/page/${this.pageId}`).then(resp => {
             this.list.innerHTML = resp.data;
-            window.components.init(this.list);
+            window.$components.init(this.list);
         });
     }
 
@@ -66,7 +65,7 @@ class Attachments {
         showLoading(this.editContainer);
         const resp = await window.$http.get(`/attachments/edit/${id}`);
         this.editContainer.innerHTML = resp.data;
-        window.components.init(this.editContainer);
+        window.$components.init(this.editContainer);
     }
 
     stopEdit() {
@@ -75,5 +74,3 @@ class Attachments {
     }
 
 }
-
-export default Attachments;
\ No newline at end of file