Greetings colleagues,
In the past, I developed a small private application with the web sdk v1. It was very basic, I added the application in the context menu and when selecting a series of widgets (sticky notes, app cards, etc..) my application appeared in the context menu and in its inner workings what it did was to go through the selected widgets, search the tags inside them and add those that matched a specific numerical format.
I want to migrate it to version 2 of the new sdk and the truth is, it is being quite difficult.
I have read the documentation and I think that the closest thing to my needs is to make a CustomAction.
I have been able to add my customAction to the context menu and show an information message when I click on it.
I need to be able to read somehow the content of the tags, their text, but I can't find any way to do it. Is it possible to do it somehow? I share my code with you:
import type { CustomAction, CustomEvent } from "@mirohq/websdk-types";
const actionHandler = () => async (props: CustomEvent) => {
// Do something with all tags whitin the selected widgets
//let total = doSomething();
await miro.board.notifications.showInfo("TOTAL POINTS: " /*+ total*/);
};
export async function init() {
await miro.board.ui.on("custom:calculate", actionHandler());
const calculateCustomAction: CustomAction = {
scope: "local",
event: "calculate",
ui: {
label: {
en: "Calculate"
},
icon: "grid-six",
description: {
en: "Calculator"
},
position: 1,
},
predicate: {
$or: :
// Matching multiple types
{type: "app_card"},
{type: "card"},
{type: "connector"},
{type:"frame"},
{type: "shape"},
{type: "sticky_note"},
{type: "text"}
],
},
};
await miro.board.experimental.action.register(calculateCustomAction);
}
init();
In the actionHandler function I only see the tagIds as an array of ids but is it possible to access the text of these tags?
Thanks in advance