diff --git a/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx b/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx index fc5a0b1..f223f58 100644 Binary files a/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx and b/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx differ diff --git a/renderer/carbone-templates/registry.json b/renderer/carbone-templates/registry.json index 1086756..f637f33 100644 --- a/renderer/carbone-templates/registry.json +++ b/renderer/carbone-templates/registry.json @@ -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:21:01.888Z" + "updatedAt": "2026-07-16T11:23:15.854Z" } ] \ No newline at end of file diff --git a/static/carbone.js b/static/carbone.js index dc5f3e0..886201a 100644 --- a/static/carbone.js +++ b/static/carbone.js @@ -260,8 +260,41 @@ async function loadOnlyofficeTemplates() { } } +// Force save the document +function forceSaveOnlyoffice() { + if (onlyofficeEditorInstance) { + // The ONLYOFFICE editor's onSave event will trigger the callback + // which saves the file to our backend + toast('Saving... changes will be stored automatically'); + } +} + +// Close the editor and clean up +function closeOnlyofficeEditor() { + if (onlyofficeEditorInstance) { + try { + onlyofficeEditorInstance.destroyEditor(); + } catch (e) { + console.error('Error closing editor:', e); + } + onlyofficeEditorInstance = null; + } + closeModal(); + // Force a small delay then reload the template list so the + // user sees the updated list with the latest save timestamp + setTimeout(() => { + loadOnlyofficeTemplates(); + }, 500); +} + // Open ONLYOFFICE editor in a modal async function openOnlyofficeEditor(templateId, templateName) { + // If there's a previous editor instance still lingering, destroy it first + if (onlyofficeEditorInstance) { + try { onlyofficeEditorInstance.destroyEditor(); } catch (e) {} + onlyofficeEditorInstance = null; + } + try { // Get the JWT-signed editor config from our backend // Add cache-buster to prevent browser caching the old config @@ -335,34 +368,6 @@ async function openOnlyofficeEditor(templateId, templateName) { toast('Failed to open editor: ' + e.message, 'error'); } } - -// Force save the document -function forceSaveOnlyoffice() { - if (onlyofficeEditorInstance) { - // The ONLYOFFICE editor's onSave event will trigger the callback - // which saves the file to our backend - toast('Saving... changes will be stored automatically'); - } -} - -// Close the editor and clean up -function closeOnlyofficeEditor() { - if (onlyofficeEditorInstance) { - try { - onlyofficeEditorInstance.destroyEditor(); - } catch (e) { - console.error('Error closing editor:', e); - } - onlyofficeEditorInstance = null; - } - closeModal(); - // Wait 1.5s for ONLYOFFICE save callbacks to settle, then refresh - setTimeout(() => { - loadOnlyofficeTemplates(); - }, 1500); -} - -// Call status check when templates page becomes active document.addEventListener('DOMContentLoaded', () => { const templatesPage = document.getElementById('page-templates'); if (templatesPage) { diff --git a/static/index.html b/static/index.html index 5e32c0c..b099f2c 100644 --- a/static/index.html +++ b/static/index.html @@ -139,7 +139,7 @@
- - + +