fix(editeur): #93 garde-fous de session d'edition inline (onglets, ecriture externe) + hooks de versionnage documentes
Une session d'edition inline (Editer/Forge) qui possede la zone de contenu etait detruite par deux chemins qui vident cette zone : activation d'onglet (TabManager.activate, PaneTabManager.activate) -> detachInlineEditor() avant le placeholder ; evenement SSE index_updated -> reloadExternalWrite() recharge le tampon de l'editeur au lieu de re-rendre la vue lecture. Nouveau helper queryEditor() ; closeEditor() remet le conteneur dans la modale avant de restaurer en-tete/pied/marque. docs/CONTRIBUTING.md documente scripts/install-hooks.sh.
This commit is contained in:
+14
-13
@@ -6,9 +6,11 @@ import { createAIToolbar } from './ai.js';
|
||||
import { startCollab, stopCollab } from './collab.js';
|
||||
import {
|
||||
getInlineHostArea,
|
||||
getEditorContainer,
|
||||
mountEditorInline,
|
||||
unmountEditorInline,
|
||||
isInlineEditorActive,
|
||||
queryEditor,
|
||||
} from './editor-inline.js';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -372,9 +374,9 @@ async function openEditor(vaultName, filePath) {
|
||||
const bodyEl = document.getElementById("editor-body");
|
||||
|
||||
// Restore header/footer (may be hidden by Forge)
|
||||
var headerEl = modal.querySelector(".editor-header");
|
||||
var footerEl = modal.querySelector(".editor-footer");
|
||||
var container = modal.querySelector(".editor-container");
|
||||
var headerEl = queryEditor(".editor-header");
|
||||
var footerEl = queryEditor(".editor-footer");
|
||||
var container = getEditorContainer();
|
||||
if (headerEl) headerEl.style.display = "";
|
||||
if (footerEl) footerEl.style.display = "";
|
||||
if (container) container.style.maxHeight = "";
|
||||
@@ -580,14 +582,6 @@ function closeEditor() {
|
||||
const modal = document.getElementById("editor-modal");
|
||||
if (!modal) return;
|
||||
modal.classList.remove("active");
|
||||
// Restore brand text
|
||||
var brand = modal.querySelector('.editor-brand');
|
||||
if (brand) brand.textContent = 'ObsiGate';
|
||||
// Restore header/footer (may be hidden by Forge)
|
||||
var headerEl = modal.querySelector(".editor-header");
|
||||
var footerEl = modal.querySelector(".editor-footer");
|
||||
if (headerEl) headerEl.style.display = "";
|
||||
if (footerEl) footerEl.style.display = "";
|
||||
stopCollab();
|
||||
if (state.editorView) {
|
||||
state.editorView.destroy();
|
||||
@@ -598,9 +592,16 @@ function closeEditor() {
|
||||
// Remove forge iframe if present
|
||||
var forgeFrame = document.getElementById("forge-iframe");
|
||||
if (forgeFrame) forgeFrame.remove();
|
||||
// #93 — give the editor container back to the modal; an inline session also
|
||||
// releases the content area, whose read view must be re-rendered.
|
||||
// #93 — hand the editor container back to the modal BEFORE restoring the
|
||||
// header/footer/brand: they live inside the container and therefore travel
|
||||
// with it in inline mode (a `modal.querySelector` would miss them).
|
||||
const host = unmountEditorInline();
|
||||
var brand = queryEditor('.editor-brand');
|
||||
if (brand) brand.textContent = 'ObsiGate';
|
||||
var headerEl = queryEditor(".editor-header");
|
||||
var footerEl = queryEditor(".editor-footer");
|
||||
if (headerEl) headerEl.style.display = "";
|
||||
if (footerEl) footerEl.style.display = "";
|
||||
_invalidateActiveTabCache(vault, path);
|
||||
state.editorVault = null;
|
||||
state.editorPath = null;
|
||||
|
||||
Reference in New Issue
Block a user