Repository navigation
Enhanced exporting and printing - #2903
silverkszlo wants to merge 4 commits into
Conversation
e99ef40 to
a2ce890
Compare
a2ce890 to
7f7246c
Compare
|
@marcoambrosini a design review would be much appreciated here :) |
Signed-off-by: Silver <s.szmajduch@posteo.de> Assisted-by: Claude Code:claude-opus-5-5
…ters Also start at the root page's parent so page shares print their pages. Signed-off-by: Silver <s.szmajduch@posteo.de> Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Silver <s.szmajduch@posteo.de> Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Silver <s.szmajduch@posteo.de> Assisted-by: Claude Code:claude-opus-5-5
7f7246c to
d296437
Compare
mejo-
left a comment
There was a problem hiding this comment.
Overall this looks really nice and is a great improvement in my opinion. I have some comments, none of them critical.
| }, | ||
| }, | ||
|
|
||
| async mounted() { |
There was a problem hiding this comment.
Deselected pages still hold up the first load (e.g. when opening an URL with exclude=... directly). It's a minor thing, but could easily be refactored to only wait for the pages that are selected to be loaded. This would speed up loading dramatically if load a large collective with only few pages selected.
| </div> | ||
| <template #list> | ||
| <SkeletonLoading v-if="loadingPages" type="items" /> | ||
| <CollectivePrintPageTree |
There was a problem hiding this comment.
What do you think about passing a :disabled="printing" flag to the component that disables the checkboxes while printing is true, so one cannot change the selection while the printing is in process.
| this.$imageTimeout() | ||
| async print() { | ||
| this.printing = true | ||
| await this.waitForImages() |
There was a problem hiding this comment.
Maybe better to catch errors here:
async print() {
this.printing = true
try {
await this.waitForImages()
} finally {
this.printing = false
}
await this.$nextTick()
if (!this.canPrint) {
return
}
document.title = this.documentTitle
window.print()
},| * @param checked Whether to select the pages | ||
| */ | ||
| togglePage(node: PageTreeNode<PageInfo>, checked: boolean) { | ||
| const selectedIds = new Set(this.selectedIds) |
There was a problem hiding this comment.
Creating a new Set each time will result in the full page tree being reloaded each time. Better to change the Set in place, so selectedIds prop keeps its identity:
togglePage(node: PageTreeNode<PageInfo>, checked: boolean) {
// Change the reactive set in place, so only the checkboxes of changed pages re-render
for (const id of subtreePageIds(node)) {
if (checked) {
this.selectedIds.add(id)
} else {
this.selectedIds.delete(id)
}
}
this.renderSelectedPages()
this.updateRouteQuery()
},
/**
* Render selected pages that were not rendered before
*/
renderSelectedPages() {
for (const id of this.selectedIds) {
if (!this.renderedIds.has(id)) {
this.renderedIds.add(id)
this.waitingFor.add(id)
}
}
},this.selectedIds() would go away and mounted() would need to be updated accordingly.
| * | ||
| * Waits 1 sec for each image (min 3 sec, max. 15 sec) and gives up afterwards. | ||
| */ | ||
| async waitForImages(): Promise<void> { |
There was a problem hiding this comment.
On error events (because an image did not get loaded), the function waits for the full timeout. Better to count error events as finished as well.
📝 Summary
"Export or print" now opens the print view with a list of all pages next to the preview. Selecting or unselecting a page shows or hides it in the preview right away, so you see exactly what will be exported or printed.
?pages=or?exclude=(whichever is shorter, so the URL stays short in large collectives), so it survives a reload. If none of the requested pages exist, or no page is selected, the print view shows an empty state.0.🖼️ Screenshots
🏁 Checklist
npm run lint/npm run stylelint/composer run cs:check)🤖 AI