chore(script/jsx): get widgets to be interpreted

This commit is contained in:
Elian Doran
2025-12-20 19:36:02 +02:00
parent eee7c49f6e
commit fe8f033409
2 changed files with 20 additions and 6 deletions

View File

@@ -480,6 +480,10 @@ export interface WidgetDefinition {
render: () => VNode
}
export interface WidgetDefinitionWithType extends WidgetDefinition {
type: "react-widget"
}
/**
* <p>This is the main frontend API interface for scripts. All the properties and methods are published in the "api" object
* available in the JS frontend notes. You can use e.g. <code>api.showMessage(api.startNote.title);</code></p>
@@ -736,7 +740,10 @@ function FrontendScriptApi(this: Api, startNote: FNote, currentNote: FNote, orig
this.logSpacedUpdates[noteId].scheduleUpdate();
};
this.defineWidget = (definition) => {
return definition;
return {
type: "react-widget",
...definition
};
};
}