aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/button/ButtonScripts.ts
blob: b4a382fafb97bf4d37a4559df93b3076b8fc7d3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { ScriptingGlobals } from "../../../util/ScriptingGlobals";
import { SelectionManager } from "../../../util/SelectionManager";
import { Colors } from "../../global/globalEnums";

// toggle: Set overlay status of selected document
ScriptingGlobals.add(function changeView(view: string) {
    const selected = SelectionManager.Views().length ? SelectionManager.Views()[0] : undefined;
    selected ? selected.Document._viewType = view : console.log("[FontIconBox.tsx] changeView failed");
});

// toggle: Set overlay status of selected document
ScriptingGlobals.add(function toggleOverlay(readOnly?: boolean) {
    const selected = SelectionManager.Views().length ? SelectionManager.Views()[0] : undefined;
    if (readOnly) return selected?.Document.z ? Colors.MEDIUM_BLUE : "transparent";
    selected ? selected.props.CollectionFreeFormDocumentView?.().float() : console.log("failed");
});