fix: page reload on editor close to clear ONLYOFFICE in-memory state + auto-return to Templates

This commit is contained in:
root
2026-07-16 12:05:50 +00:00
parent 8b6b083d3d
commit 8b9783060e
5 changed files with 19 additions and 8 deletions

View File

@@ -6,6 +6,6 @@
"originalName": "master_cv_template.docx",
"path": "/root/workspace/cv-app/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx",
"uploadedAt": "2026-07-16T09:03:29.601Z",
"updatedAt": "2026-07-16T11:52:26.701Z"
"updatedAt": "2026-07-16T12:03:58.509Z"
}
]

View File

@@ -694,3 +694,13 @@ function formatDate(d) {
// Initial load
loadDashboard();
// Restore active page after an ONLYOFFICE editor close triggered a page reload
(function() {
var returnPage = sessionStorage.getItem('returnPage');
if (returnPage) {
sessionStorage.removeItem('returnPage');
var link = document.querySelector('[data-page="' + returnPage + '"]');
if (link) link.click();
}
})();

View File

@@ -280,11 +280,12 @@ function closeOnlyofficeEditor() {
onlyofficeEditorInstance = null;
}
closeModal();
// Force a small delay then reload the template list so the
// user sees the updated list with the latest save timestamp
// Reload the page to clear ONLYOFFICE's in-memory state.
// Save the active page so the user returns to Templates automatically
sessionStorage.setItem('returnPage', 'templates');
setTimeout(() => {
loadOnlyofficeTemplates();
}, 500);
location.reload();
}, 300);
}
// Open ONLYOFFICE editor in a modal

View File

@@ -139,7 +139,7 @@
<!-- Modals -->
<div class="modal-overlay" id="modal-overlay"></div>
<script src="/static/app.js?v=6"></script>
<script src="/static/carbone.js?v=6"></script>
<script src="/static/app.js?v=7"></script>
<script src="/static/carbone.js?v=7"></script>
</body>
</html>