Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix no close option on app pdf-viewer #7201

Merged
merged 6 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog/unreleased/enhancement-pdf-viewer-app-toolbar
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enhancement: Added a toolbar to pdf-viewer app

We've added a toolbar to the pdf-viewer app,
where the user can see the name of the opened pdf file and also close the app.

https://github.com/owncloud/web/pull/7201
https://github.com/owncloud/web/issues/7198
28 changes: 21 additions & 7 deletions packages/web-app-pdf-viewer/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
<main>
<loading-screen v-if="loading" />
<error-screen v-else-if="loadingError" />
<object
v-else
class="pdf-viewer oc-width-1-1 oc-height-1-1"
:data="blobUrl"
type="application/pdf"
/>
<div v-else class="oc-height-1-1">
<div class="oc-flex oc-p-s pdf-viewer-tool-bar">
<span>{{ fileName }}</span>
<oc-button id="text-editor-controls-close" size="small" @click="closeApp">
<oc-icon name="close" size="small" />
</oc-button>
</div>
<object class="pdf-viewer oc-width-1-1" :data="blobUrl" type="application/pdf" />
</div>
</main>
</template>
<script>
Expand Down Expand Up @@ -36,7 +39,11 @@ export default {
blobUrl: ''
}),
computed: {
...mapGetters(['getToken'])
...mapGetters(['getToken']),

fileName() {
return this.currentFileContext.fileName
}
},
created() {
this.loadPdf(this.currentFileContext)
Expand All @@ -46,6 +53,7 @@ export default {
},
methods: {
async loadPdf(fileContext) {
console.log(fileContext)
AlexAndBear marked this conversation as resolved.
Show resolved Hide resolved
try {
this.loading = true
const response = await this.getFileContents(fileContext.path, { responseType: 'blob' })
Expand All @@ -69,5 +77,11 @@ export default {
margin: 0;
padding: 0;
overflow: hidden;
height: 90%;
AlexAndBear marked this conversation as resolved.
Show resolved Hide resolved
}

.pdf-viewer-tool-bar {
align-items: center;
justify-content: space-between;
}
</style>