        const currentMindmap = JSON.parse(viewer.dataset.currentMindmap || '{}');
            currentMarkdown = currentMindmap.markdown || '';
            textarea.value = currentMarkdown;
            textarea.focus();
        } else {
            viewerContent.style.display = 'block';
            editorElement.style.display = 'none';
            editorOverlay.style.display = 'none';
        }
    }

    function updateMindmapFromEdit() {
        const textarea = document.getElementById('markdown-textarea')