-
-
Notifications
You must be signed in to change notification settings - Fork 142
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Can we serialise Lumino layouts?
This might be useful to:
- Persist layouts between sessions (e.g. on the filesystem or in LocalStorage).
- Define default layouts.
- Test Lumino applications.
Note, the app would need its own logic to restore the components within the Lumino layout, this is beyond the scope of Lumino itself.
Problem
With Lumino, we can save layouts in a format that we can restore later:
const layout = dockPanel.saveLayout()
dockPanel.restoreLayout(layout)
This works great, however, it is difficult to persist these layouts beyond the life of the session because they contain references to HTML elements:
>> layout.main.children[0].widgets[0].node
<div id="widget3" class="lm-Widget content lm-DockPanel-widget" role="tabpanel" aria-labelledby="tab-key-1-0" style="position: absolute; cont…: 300px; height: 996px;">
And cannot be easily serialised:
>> JSON.stringify(layout)
Uncaught TypeError: cyclic object value
Proposed Solution
The ability to reconstruct a layout in a new session.
E.g, something along the lines of:
function serialise(layout) {}
function deserialise(layout, context) {}
biru-codeastromer, 5cript and MetRonnie
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request