fix: unique container ID per editor session + 1.5s settle delay on close
This commit is contained in:
Binary file not shown.
@@ -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:15:01.909Z"
|
||||
"updatedAt": "2026-07-16T11:17:19.354Z"
|
||||
}
|
||||
]
|
||||
@@ -275,7 +275,9 @@ async function openOnlyofficeEditor(templateId, templateName) {
|
||||
const config = data.config;
|
||||
const onlyofficeUrl = data.onlyofficeUrl;
|
||||
|
||||
// Build the editor modal
|
||||
// Build the editor modal with a unique container ID each time
|
||||
// so ONLYOFFICE never reuses a cached DOM element
|
||||
const containerId = 'oo-editor-' + Date.now();
|
||||
const body = `
|
||||
<div class="flex-between mb-16">
|
||||
<h3>Editing: ${templateName}</h3>
|
||||
@@ -284,7 +286,7 @@ async function openOnlyofficeEditor(templateId, templateName) {
|
||||
<button class="btn btn-sm btn-danger" onclick="closeOnlyofficeEditor()">Close Editor</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="onlyoffice-editor-container" style="width:100%;height:800px;border:1px solid var(--border);border-radius:8px;overflow:hidden"></div>
|
||||
<div id="${containerId}" style="width:100%;height:800px;border:1px solid var(--border);border-radius:8px;overflow:hidden"></div>
|
||||
<p class="text-muted text-sm mt-8">Changes are saved automatically. Click "Save" to force-save, or "Close Editor" to return to the template list.</p>
|
||||
`;
|
||||
showModal(body, '', 'xlarge');
|
||||
@@ -307,7 +309,7 @@ async function openOnlyofficeEditor(templateId, templateName) {
|
||||
throw new Error('ONLYOFFICE API not loaded. Check that the server is running at ' + onlyofficeUrl);
|
||||
}
|
||||
|
||||
onlyofficeEditorInstance = new DocsAPI.DocEditor('onlyoffice-editor-container', {
|
||||
onlyofficeEditorInstance = new DocsAPI.DocEditor(containerId, {
|
||||
...config,
|
||||
width: '100%',
|
||||
height: '800px',
|
||||
@@ -354,8 +356,10 @@ function closeOnlyofficeEditor() {
|
||||
onlyofficeEditorInstance = null;
|
||||
}
|
||||
closeModal();
|
||||
// Refresh the templates list to show any changes
|
||||
loadOnlyofficeTemplates();
|
||||
// Wait 1.5s for ONLYOFFICE save callbacks to settle, then refresh
|
||||
setTimeout(() => {
|
||||
loadOnlyofficeTemplates();
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
// Call status check when templates page becomes active
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
<!-- Modals -->
|
||||
<div class="modal-overlay" id="modal-overlay"></div>
|
||||
|
||||
<script src="/static/app.js?v=2"></script>
|
||||
<script src="/static/carbone.js?v=2"></script>
|
||||
<script src="/static/app.js?v=3"></script>
|
||||
<script src="/static/carbone.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user