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: default action value & image public page style #1929

Merged
merged 2 commits into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Binary file modified cypress/snapshots/base/visual-regression.cy.js/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cypress/snapshots/base/visual-regression.cy.js/image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cypress/snapshots/base/visual-regression.cy.js/non-dav.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified cypress/snapshots/base/visual-regression.cy.js/video.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions src/components/Images.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@
zoomed: zoomRatio !== 1
}"
:src="data"
:style="{
marginTop: Math.round(shiftY * 2) + 'px',
marginLeft: Math.round(shiftX * 2) + 'px',
height: zoomHeight + 'px',
width: zoomWidth + 'px',
}"
:style="imgStyle"
@error.capture.prevent.stop.once="onFail"
@load="updateImgSize"
@wheel="updateZoom"
Expand Down Expand Up @@ -97,6 +92,17 @@
alt() {
return this.basename
},
imgStyle() {
if (this.zoomRatio === 1) {
return {}
}
return {
marginTop: Math.round(shiftY * 2) + 'px',
marginLeft: Math.round(shiftX * 2) + 'px',
height: zoomHeight + 'px',
width: zoomWidth + 'px',
}
},
},

asyncComputed: {
Expand Down Expand Up @@ -158,7 +164,7 @@
return `data:${this.mime};base64,${btoa(file.data)}`
},

/**

Check warning on line 167 in src/components/Images.vue

View workflow job for this annotation

GitHub Actions / eslint

JSDoc @return declaration present but return expression not available in function
* Handle zooming
*
* @param {Event} event the scroll event
Expand Down Expand Up @@ -257,7 +263,7 @@
},

// Fallback to the original image if not already done
onFail(event) {

Check warning on line 266 in src/components/Images.vue

View workflow job for this annotation

GitHub Actions / eslint

'event' is defined but never used
if (!this.fallback) {
console.error(`Loading of file preview ${basename(this.src)} failed, falling back to original file`)
this.fallback = true
Expand Down
4 changes: 2 additions & 2 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ import axios from '@nextcloud/axios'
import '@nextcloud/dialogs/dist/index.css'
import { showError } from '@nextcloud/dialogs'
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { registerFileAction, FileAction, Permission } from '@nextcloud/files'
import { registerFileAction, FileAction, Permission, DefaultType } from '@nextcloud/files'

import isFullscreen from '@nextcloud/vue/dist/Mixins/isFullscreen.js'
import isMobile from '@nextcloud/vue/dist/Mixins/isMobile.js'
Expand Down Expand Up @@ -921,7 +921,7 @@ export default {
return t('viewer', 'View')
},
iconSvgInline: () => '',
default: true,
default: DefaultType.DEFAULT,
enabled: (nodes) => {
return nodes.filter((node) => node.permissions & Permission.READ
&& this.Viewer.mimetypes.indexOf(node.mime) !== -1,
Expand Down
Loading