fix: suppression boutons doublons Forge + delegation parent modal
CI / lint (push) Failing after 7s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / security (push) Failing after -8s

- Retrait des 3 boutons (delete/cancel/save) de la barre Forge (doublons)
- Retrait des handlers JS associés dans editor-poc.html
- Le header parent ObsiGate reste visible quand Forge est ouvert
- Les boutons save/delete du parent délèguent à Forge via postMessage
- Forge écoute 'parent-save' et 'parent-delete' du parent
- state.editorVault/editorPath settés dans viewer.js pour le parent
This commit is contained in:
2026-06-15 13:57:21 -04:00
parent feeb46b873
commit cc2ec9e869
3 changed files with 41 additions and 28 deletions
+16 -21
View File
@@ -233,9 +233,6 @@ body { font-family: var(--sans); background: var(--bg); color: var(--text); heig
<button class="btn" id="btn-preview" title="Toggle preview">&#128065;</button>
<button class="btn btn-ai off" id="btn-ai" title="AI Panel (Ctrl+J)">&#10024;</button>
<div class="save-dot ok" id="save-dot"><span class="dot"></span><span id="save-label">Saved</span></div>
<button class="btn btn-square danger" id="forge-delete" title="Supprimer">&#128465;</button>
<button class="btn btn-square" id="forge-cancel" title="Annuler">&#10005;</button>
<button class="btn btn-square primary" id="forge-save" title="Sauvegarder (Ctrl+S)">&#10003;</button>
</div>
</div>
@@ -1407,26 +1404,24 @@ body { font-family: var(--sans); background: var(--bg); color: var(--text); heig
btnPreview.addEventListener('click', togglePreview);
// Action buttons (delete/cancel/save) — same as basic editor
document.getElementById('forge-save').addEventListener('click', function() { forceSave(); });
document.getElementById('forge-cancel').addEventListener('click', function() {
if (window.parent && window.parent !== window) {
window.parent.postMessage({ type: 'forge-close' }, '*');
// Listen for parent save/delete commands (parent modal buttons)
window.addEventListener('message', function(e) {
if (!e.data || !e.data.type) return;
if (e.data.type === 'parent-save') { forceSave(); }
if (e.data.type === 'parent-delete') {
if (!fileVault || !filePath) return;
if (!confirm('Supprimer definitivement ' + filePath + ' ?')) return;
fetch('/api/file/' + encodeURIComponent(fileVault) + '?path=' + encodeURIComponent(filePath), {
method: 'DELETE', credentials: 'include'
}).then(function(r) {
if (!r.ok) throw new Error('HTTP ' + r.status);
showToast('Fichier supprime', 'ok');
if (window.parent && window.parent !== window) {
window.parent.postMessage({ type: 'forge-close' }, '*');
}
}).catch(function(e) { showToast('Echec suppression: ' + e.message, 'err'); });
}
});
document.getElementById('forge-delete').addEventListener('click', function() {
if (!fileVault || !filePath) return;
if (!confirm('Supprimer definitivement ' + filePath + ' ?')) return;
fetch('/api/file/' + encodeURIComponent(fileVault) + '?path=' + encodeURIComponent(filePath), {
method: 'DELETE', credentials: 'include'
}).then(function(r) {
if (!r.ok) throw new Error('HTTP ' + r.status);
showToast('Fichier supprime', 'ok');
if (window.parent && window.parent !== window) {
window.parent.postMessage({ type: 'forge-close' }, '*');
}
}).catch(function(e) { showToast('Echec suppression: ' + e.message, 'err'); });
});
document.getElementById('poc-title').addEventListener('input', function() { markDirty(); });