Skip to content

EditorShell beta ​

Interface of @v12-engine/editor

ts
export interface EditorShell

What the editor asks of the page that draws it: the one object its interface gives it (EditorOptions.shell), in the place of functions set one by one after it is made. A page that cannot do one of these leaves it out (headlessShell says why not), a game's page that does it its own way gives its own

Members ​

confirmDiscard ​

ts
confirmDiscard(): Promise<boolean>;

Asks whether changes that are not saved may be lost: the kit's question, not the browser's. Yes, without a page to ask

element ​

ts
element?(): HTMLElement | undefined;

The element of the page the editor is drawn in: what fills the screen (toggleFullScreen). The whole page when left out

leave ​

ts
leave?: {
        label: string;
        tip?: string;
        run: () => void;
    };

The way out of the editor, when the page gave one: what the File menu's last line says and does

openDialog ​

ts
openDialog<K extends ShellDialogId>(id: K, ...args: ShellDialogArgs<K>): void;

Opens a dialog of the editor's (ShellDialogs): the page may draw it as it likes, or give another

openMenu ​

ts
openMenu(at: {
        x: number;
        y: number;
    }, items: EditorMenuItem[]): void;

Opens a menu at a point of the screen. Nothing happens on a right click where it does nothing

pickAssets ​

ts
pickAssets(): void;

Asks for files to take in (models, pictures, sounds): the page's file dialog, then the editor imports them (importFiles)

pickFile ​

ts
pickFile(): void;

Asks for a map file to open: the page's file dialog, then the file is opened by the editor

playHere ​

ts
playHere?(from?: WorldSave): void;

Plays the map here, as the bar's Play does; from a save, a test point's (plays.playFrom), where one is given, the game played here started again from it. Left out where the page cannot play it over the editor

resolveConflict ​

ts
resolveConflict(file: string): Promise<ConflictChoice | undefined>;

The map's file changed on disk since it was opened: the person says what to keep. Nothing is saved, and the status line says why, where the page asks nobody (undefined)

revealFold ​

ts
revealFold(fold: string): void;

Shows a fold of a panel (Fold) by its title, once the panel is open: opened, scrolled to and marked for a moment. What the search does with a setting

stop ​

ts
stop?(): void;

Ends the game played here, back to the map as it was. Left out with playHere

toast ​

ts
toast?(message: string, options?: {
        tone?: 'default' | 'success' | 'danger';
        seconds?: number;
        action?: {
            label: string;
            run: () => void;
        };
    }): void;

Says something for a moment, over the editor, and lets it go by itself (a file taken in, what went wrong with it): the kit's toast, with a button where action is given (Undo). Said in the status line where the page gives none

watchReplay ​

ts
watchReplay?(replay: Replay, name: string): void;

Plays a replay of the map back here, in the game's place (plays.watchReplay), with its bar: in the place of a game played here, and stopped as one is. Left out with playHere