diff --git a/templates/index.html b/templates/index.html index ab6cb47..14fa0c6 100644 --- a/templates/index.html +++ b/templates/index.html @@ -93,11 +93,35 @@ // Initialisiere GridStack var grid = GridStack.init({ cellHeight: 70, - acceptWidgets: true, - dragIn: '.newWidget', + margin: 5, resizable: { handles: 'se, sw, ne, nw, e, w, s, n' } }); + // FUNKTION: Layout laden + function loadLayout() { + let serialization = localStorage.getItem('grid-layout'); + if (serialization) { + let layout = JSON.parse(serialization); + grid.load(layout); + } + } + + // FUNKTION: Layout speichern + function saveLayout() { + let serialization = grid.save(); + localStorage.setItem('grid-layout', JSON.stringify(serialization)); + } + + // Events: Speichere bei jeder Änderung + grid.on('dragstop resizestop', function(event, el) { + saveLayout(); + // Falls du das Terminal-Plugin 'fit' nutzt, hier triggern: + // fitAddon.fit(); + }); + + // Beim Start das gespeicherte Layout laden + loadLayout(); + // Xterm.js Setup const term = new Terminal({ theme: { background: '#000' }, fontSize: 13, cursorBlink: true }); term.open(document.getElementById('terminal'));