Builtin Library
README.md
edui.inspector.presetActions
The Settings section's preset actions, offered on an asset's Settings section and on a component card's:
- Save as preset opens a name field beneath the section. Save captures the
values the section shows as a typed preset targeting the declarer that
governs them (
preset.capture), and selects the new preset. A bare name lands in/source/presets; a path ending in.presetlands where it says. A name the capture refuses shows its reason beneath the section. - Apply preset… lists the presets whose target is that declarer. Picking
one applies it to the section's subject (
preset.apply) as one undo step, and the outcome — the fields written, and any the target refuses — shows beneath the section.
local PresetActions = require("@builtin::editor.edui.inspector.presetActions")
local subject, declarer = PresetActions.subjectOf(ctx) -- asset ref, or { entity, component }
for _, c in ipairs(PresetActions.presetsFor(declarer)) do -- { ref, guid, name }
print(c.name)
end
local outcome = PresetActions.applyInto(c.ref, c.name, { subject }) -- { text, tone }
SAVE and APPLY are the two entries settingsSection.ACTIONS carries.
release(keyPrefix) forgets the open action, typed name, listed presets and
outcome kept under a Context's key prefix; Inspector.release calls it.