Skip to content

Commit

Permalink
fix: Remove custom handling for public share pages with single files
Browse files Browse the repository at this point in the history
Since Nextcloud 31 the public share pages for single files and folders
were unified, and public single file shares now show a file list with a
single file. Due to that it is no longer needed to explicitly inject the
PDF viewer in public shage pages or adjust the style, as the PDF viewer
will be loaded as needed by the Viewer component.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Feb 26, 2025
1 parent 57eba4c commit 67a1805
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 108 deletions.
78 changes: 0 additions & 78 deletions src/public.js

This file was deleted.

6 changes: 0 additions & 6 deletions src/utils/isPdf.js

This file was deleted.

6 changes: 0 additions & 6 deletions src/utils/isPublicPage.js

This file was deleted.

7 changes: 0 additions & 7 deletions src/utils/isSecureViewerAvailable.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/views/PDFView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import { generateUrl } from '@nextcloud/router'
import logger from '../services/logger.js'
import uploadPdfFile from '../services/uploadPdfFile.js'
import hideDownload from '../utils/hideDownload.js'
import isPdf from '../utils/isPdf.js'
import isPublicPage from '../utils/isPublicPage.js'

export default {
name: 'PDFView',
Expand Down Expand Up @@ -73,14 +71,6 @@ export default {

document.addEventListener('webviewerloaded', this.handleWebviewerloaded)

if (isPublicPage() && isPdf()) {
// Force style for public shares of a single PDF file, as there are
// no CSS selectors that could be used only for that case.
this.$refs.iframe.style.height = '100%'
this.$refs.iframe.style.position = 'absolute'
this.$refs.iframe.style.marginTop = 'unset'
}

this.doneLoading()
this.$nextTick(function() {
this.$el.focus()
Expand Down
1 change: 0 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const { readdirSync } = require('fs')
const l10nContent = readdirSync(path.resolve(__dirname, 'js', 'pdfjs', 'web', 'locale'))

webpackConfig.entry.workersrc = path.resolve(path.join('src', 'workersrc.js'))
webpackConfig.entry.public = path.resolve(path.join('src', 'public.js'))

// keep pdfjs vendor in the js folder
webpackConfig.output.clean = false
Expand Down

0 comments on commit 67a1805

Please sign in to comment.