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

[MS] Improve document viewer pages management #9238

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion client/src/services/storageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class StorageManager {
confirmBeforeQuit: data.confirmBeforeQuit !== undefined ? data.confirmBeforeQuit : StorageManager.DEFAULT_CONFIG.confirmBeforeQuit,
meteredConnection: data.meteredConnection !== undefined ? data.synchroWifiOnly : StorageManager.DEFAULT_CONFIG.meteredConnection,
unsyncFiles: data.unsyncFiles !== undefined ? data.unsyncFiles : StorageManager.DEFAULT_CONFIG.unsyncFiles,
skipViewers: true, // data.skipViewers !== undefined ? data.skipViewers : StorageManager.DEFAULT_CONFIG.skipViewers,
skipViewers: false, // data.skipViewers !== undefined ? data.skipViewers : StorageManager.DEFAULT_CONFIG.skipViewers,
};
return config;
}
Expand Down
28 changes: 26 additions & 2 deletions client/src/views/viewers/DocumentViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,34 @@

onMounted(async () => {
loading.value = true;
const result = await mammoth.convertToHtml({ arrayBuffer: props.contentInfo.data.buffer });
const result = await mammoth.convertToHtml({
arrayBuffer: props.contentInfo.data.buffer,
}, {
styleMap: [
"br[type='page'] => hr.page-break",
],
});
const pattern = '<hr class=\"page-break\" />';

Check failure on line 39 in client/src/views/viewers/DocumentViewer.vue

View workflow job for this annotation

GitHub Actions / web / 🌐 Web tests

Unnecessary escape character: \"

Check failure on line 39 in client/src/views/viewers/DocumentViewer.vue

View workflow job for this annotation

GitHub Actions / web / 🌐 Web tests

Unnecessary escape character: \"
const pages = result.value.split(pattern);
pages.map((page, index) => {
pages[index] = `<div class="page">${page}</div>`;
});
result.value = pages.join(pattern);
htmlContent.value = result.value;
loading.value = false;
});
</script>

<style scoped lang="scss"></style>
<style scoped lang="scss">
.document-content {
height: 100%;
overflow-y: auto;

.page {

Check warning on line 55 in client/src/views/viewers/DocumentViewer.vue

View workflow job for this annotation

GitHub Actions / web / 🌐 Web tests

The selector `.page` is unused
background: white;
padding: 5em;
margin: 1em;
border-radius: 1em;
}
}
</style>
Loading