Merge pull request #44803 from nextcloud/fix/smartpicker-file-picker

pull/44892/head
Benjamin Gaussorgues 1 month ago committed by GitHub
commit 75935b83da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -21,11 +21,12 @@
-->
<template>
<FilePicker :buttons="buttons"
<FilePicker allow-pick-directory
:buttons="buttons"
:container="null"
:name="t('files', 'Select file or folder to link to')"
:multiselect="false"
@close="$emit('cancel')" />
@close="onClose" />
</template>
<script>
@ -48,24 +49,32 @@ export default {
default: false,
},
},
data() {
return {
buttons: [
{
label: t('files', 'Choose'),
type: 'primary',
callback: (nodes) => {
logger.debug('FileReferencePicker - Nodes picked', { nodes })
this.submit(nodes[0].fileid)
},
setup() {
// Buttons to show
const buttons = [
{
label: t('files', 'Choose'),
type: 'primary',
callback: (nodes) => {
logger.debug('FileReferencePicker - Nodes picked', { nodes })
},
],
},
]
return {
buttons,
}
},
methods: {
submit(fileId) {
const fileLink = `${window.location.protocol}//${window.location.host}${generateUrl('/f/{fileId}', { fileId })}`
this.$emit('submit', fileLink)
onClose(selectedNodes) {
if (!selectedNodes || selectedNodes.length === 0) {
this.$emit('cancel')
} else {
const fileLink = `${window.location.protocol}//${window.location.host}${generateUrl('/f/{fileId}', { fileId: selectedNodes[0].fileid })}`
this.$emit('submit', fileLink)
}
},
},
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

14
package-lock.json generated

@ -17,7 +17,7 @@
"@nextcloud/browserslist-config": "^2.3.0",
"@nextcloud/calendar-availability-vue": "^0.6.0-alpha1",
"@nextcloud/capabilities": "^1.0.4",
"@nextcloud/dialogs": "^4.2.6",
"@nextcloud/dialogs": "^4.2.7",
"@nextcloud/event-bus": "^3.0.2",
"@nextcloud/files": "3.0.0-beta.8",
"@nextcloud/initial-state": "^2.0.0",
@ -3743,9 +3743,9 @@
}
},
"node_modules/@nextcloud/dialogs": {
"version": "4.2.6",
"resolved": "https://registry.npmjs.org/@nextcloud/dialogs/-/dialogs-4.2.6.tgz",
"integrity": "sha512-y3hXga9l2swlAcopj77uPcgGX6zm+OW2RGM9urdDUTn8KH5cid4JldgqH6rzpt/5CSsyUQAKWNTwHX4pFoeA1w==",
"version": "4.2.7",
"resolved": "https://registry.npmjs.org/@nextcloud/dialogs/-/dialogs-4.2.7.tgz",
"integrity": "sha512-20211P3F+Kg/Cy56pd19hneluIQm54nZtrM5OP5Sjxw15LkZhIfkNcMKepJV8vvPK3p9sCv6wOWe0uu+GtZW2Q==",
"dependencies": {
"@mdi/svg": "^7.4.47",
"@nextcloud/files": "3.0.0-beta.21",
@ -29446,9 +29446,9 @@
"requires": {}
},
"@nextcloud/dialogs": {
"version": "4.2.6",
"resolved": "https://registry.npmjs.org/@nextcloud/dialogs/-/dialogs-4.2.6.tgz",
"integrity": "sha512-y3hXga9l2swlAcopj77uPcgGX6zm+OW2RGM9urdDUTn8KH5cid4JldgqH6rzpt/5CSsyUQAKWNTwHX4pFoeA1w==",
"version": "4.2.7",
"resolved": "https://registry.npmjs.org/@nextcloud/dialogs/-/dialogs-4.2.7.tgz",
"integrity": "sha512-20211P3F+Kg/Cy56pd19hneluIQm54nZtrM5OP5Sjxw15LkZhIfkNcMKepJV8vvPK3p9sCv6wOWe0uu+GtZW2Q==",
"requires": {
"@mdi/svg": "^7.4.47",
"@nextcloud/files": "3.0.0-beta.21",

@ -42,7 +42,7 @@
"@nextcloud/browserslist-config": "^2.3.0",
"@nextcloud/calendar-availability-vue": "^0.6.0-alpha1",
"@nextcloud/capabilities": "^1.0.4",
"@nextcloud/dialogs": "^4.2.6",
"@nextcloud/dialogs": "^4.2.7",
"@nextcloud/event-bus": "^3.0.2",
"@nextcloud/files": "3.0.0-beta.8",
"@nextcloud/initial-state": "^2.0.0",

Loading…
Cancel
Save