What it does
dockLayout
Saves and loads the editor dock's split-and-tab arrangement. The live arrangement is read from the dock controller published by the dock service (EditorRegistry.dock()), serialized to JSON, and written to a layout file; loading reads it back and applies it live through the controller's one-shot restore. Layouts are stored under /zero/source/editor/layout/<name>.json, which is world content shared with collaborators and synced.
Exports
M.save(name?) -> boolean— snapshot the live dock arrangement to a named layout file (default"last"). Returnsfalsewhen no dock is mounted or the layout is unavailable.M.read(name?) -> string?— the saved layout's raw JSON, ornilif there is no such layout. Used to seed the dock at mount before the controller is published.M.load(name?) -> boolean— restore a saved layout into the live dock, applied immediately. Returnsfalsewhen no dock is mounted or no such layout exists.M.list() -> {string}— saved layout names (the.jsonfiles under the layout dir, without the suffix).M.DIR— the layout directory path.M.DEFAULT— the default layout name ("last").
Usage
local Layout = require("modules.api.editor.dock_layout")
Layout.save() -- snapshot the live arrangement to "last"
Layout.load() -- restore "last" into the live dock
Layout.list() -- { "last", "wide", ... }
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.