diff --git a/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx b/renderer/carbone-templates/433a0593-d3cf-414e-8763-ab5f87cbc75c.docx index 2ba4ff5..2db4c18 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 7d48d87..28652d7 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-17T08:58:13.712Z" + "updatedAt": "2026-07-17T09:01:35.526Z" } ] \ No newline at end of file diff --git a/static/carbone.js b/static/carbone.js index 7a60077..69a4d98 100644 --- a/static/carbone.js +++ b/static/carbone.js @@ -277,10 +277,6 @@ function closeOnlyofficeEditor() { // Delete the DocsAPI global and remove the script tag so the next // openOnlyofficeEditor call loads a completely fresh ONLYOFFICE API. - // This is the key: destroyEditor() cleans the editor instance, but - // the DocsAPI object itself retains internal state (websocket pools, - // document session references) that causes the next editor to load - // a stale document. Removing the script + global forces a fresh init. delete window.DocsAPI; const oldScript = document.querySelector('script[src*="api/documents/api.js"]'); if (oldScript) oldScript.remove(); @@ -290,9 +286,14 @@ function closeOnlyofficeEditor() { // Open ONLYOFFICE editor in a modal async function openOnlyofficeEditor(templateId, templateName) { + // Block reopening if a previous editor is still tearing down. + // destroyEditor() is async — the ONLYOFFICE websocket/session needs + // time to close before a new editor can be created cleanly. if (onlyofficeEditorInstance) { try { onlyofficeEditorInstance.destroyEditor(); } catch (e) {} onlyofficeEditorInstance = null; + // Give ONLYOFFICE's internal session 2 seconds to fully close + await new Promise(r => setTimeout(r, 2000)); } try { @@ -317,7 +318,6 @@ async function openOnlyofficeEditor(templateId, templateName) { showModal(body, '', 'xlarge'); // Load ONLYOFFICE API script fresh each time with cache-buster. - // This ensures a completely new DocsAPI instance with no stale state. const scriptUrl = onlyofficeUrl + '/web-apps/apps/api/documents/api.js?cb=' + Date.now(); await new Promise((resolve, reject) => { const s = document.createElement('script'); diff --git a/static/index.html b/static/index.html index f06ab67..90fe4cd 100644 --- a/static/index.html +++ b/static/index.html @@ -139,7 +139,7 @@ - - + + \ No newline at end of file