You can also combine a series of less frequently used actions under one button on the action bar. This is useful for example on an iPad without an external keyboard.
// Choose action to perform using a prompt
const buttonNames =
("🔗 Link|𝒾 Italicise|— Strike|☑ Make Tasks|< Move Left|> Move Right|" +
"↦ Indent|↤ Outdent|↥ Move Line Up|↧ Move Line Down").split("|");
let p = new Prompt();
p.title = "Act";
p.message = "Choose action to perform:";
buttonNames.forEach(name => p.addButton(name));
let splitRE = /^(?<symbol>.) (?<verb>.*)$/u;
while (true) {
if (!p.show()) break;
let { symbol, verb } = p.buttonPressed.match(splitRE).groups;
let action = Action.find(verb);
if (action) app.queueAction(action, draft);
else
throw new Error(
`Unimplemented: button="${p.buttonPressed}" symbol=${symbol} verb="${verb}"`
);
if (!verb.startsWith("Move")) break;
}
editor.activate();