@jsvision/files / FileCommands
Variable: FileCommands
constFileCommands:object
Defined in: files/src/editor/commands.ts:19
The command names for the file operations, for wiring a menu or status bar to a file editor. Save behaviour lives on FileEditor (the base editor package is filesystem-free), so these names are defined here alongside it. Bind your File menu items to these and handle them in your app.
Type Declaration
new
readonlynew:"new"='new'
Create a new untitled editor window.
open
readonlyopen:"open"='open'
Open an existing file.
save
readonlysave:"save"='save'
Save the focused file editor.
saveAs
readonlysaveAs:"saveAs"='saveAs'
Save the focused file editor under a new name (prompts for a path).
Example
ts
import { menuBar, subMenu, item } from '@jsvision/ui';
import { FileCommands } from '@jsvision/files';
const bar = menuBar([
subMenu('~F~ile', [
item('~N~ew', FileCommands.new),
item('~O~pen', FileCommands.open),
item('~S~ave', FileCommands.save),
item('Save ~a~s', FileCommands.saveAs),
]),
]);