Log inGet started
Package

document.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

edui.document

One open document in an editor panel. edui.document.new{ id } makes one; doc:open(path, line?) shows a VFS file or asset in the viewer its kind calls for; doc:build(edui.palette()) is the panel content. Text is editable (doc:save() writes it and runs a .luau file through the LSP) and the document follows its file on disk: a write lands in a buffer with no unsaved edits, and raises a "changed on disk" bar over one that has them. doc:setText tells the owner (onChange) when it moves doc:dirty(), so a panel can mark its tab.

doc:suspend() sets a document aside while its panel is closed: the watch and the viewer's resources go, the path and the unsaved edits stay. doc:resume() picks it back up and reads the file as it is now — a clean buffer adopts what changed meanwhile, an edited one raises the conflict.

Viewers are modes. The built-in ones are code, markdown (rendered, with a Source toggle), image, asset (a live orbitable render for any asset type that declares a preview) and info. edui.document.registerMode{ name, match, build } adds another.

The Code panel is one document; edui.shown opens a panel around another.