Skip to content
Draft
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
57 changes: 51 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@nextcloud/axios": "^2.5.1",
"@nextcloud/dialogs": "^7.1.0",
"@nextcloud/event-bus": "^3.3.3",
"@nextcloud/files": "^4.0.0-rc.1",
"@nextcloud/initial-state": "^3.0.0",
"@nextcloud/moment": "^1.3.5",
"@nextcloud/router": "^3.1.0",
Expand Down
23 changes: 20 additions & 3 deletions src/components/NoteItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ import { showError } from '@nextcloud/dialogs'
import { setFavorite, setTitle, fetchNote, deleteNote, setCategory } from '../NotesService.js'
import ShareVariantOutlineIcon from 'vue-material-design-icons/ShareVariantOutline.vue'
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { getSidebar } from '@nextcloud/files'

export default {
name: 'NoteItem',
Expand Down Expand Up @@ -239,6 +240,7 @@ export default {
this.loading.favorite = true
setFavorite(this.note.id, !this.note.favorite)
.catch(() => {
this.loading.favorite = false
})
.then(() => {
this.loading.favorite = false
Expand Down Expand Up @@ -312,13 +314,28 @@ export default {
}
},
onToggleSharing() {
if (window?.OCA?.Files?.Sidebar?.setActiveTab) {
const sidebar = getSidebar()
if (!sidebar) {
showError(this.t('notes', 'Sharing not available.'))
return
}

try {
emit('toggle-navigation', { open: false })
setTimeout(() => {
window.dispatchEvent(new Event('resize'))
}, 200)
window.OCA.Files.Sidebar.setActiveTab('sharing')
window.OCA.Files.Sidebar.open(this.note.internalPath)
sidebar.open(this.note.internalPath)
setTimeout(() => {
try {
sidebar.setActiveTab('sharing')
} catch (e) {
console.warn('Could not activate sharing tab:', e.message)
}
}, 100)
} catch (error) {
console.error('Failed to open sidebar:', error)
showError(this.t('notes', 'Could not open the sharing sidebar.'))
}
},
async onShareCreated(event) {
Expand Down
Loading