Hi,
Iβm using a custom extension to wrap selected text in a span, with custom attributes. These items can be defined in the manifest:
{
type: 'tiptapToolbarExtension',
kind: 'menu',
alias: 'test.tiptap.toolbar.languageMenu',
name: 'Language Menu',
js: () => import('./language-menu.tiptap-toolbar-api.js'),
forExtensions: ['test.tiptap.languageMark'],
meta: {
alias: 'languageMenu',
icon: 'icon-globe',
label: 'Language',
},
items: [
{
label: 'π¬π§ EN',
value: 'en',
},
],
},
The problem is, i want to populate the menu dynamically. I tried the following (and variants of it):
export default class UmbTiptapToolbarLanguageMenuExtensionApi extends UmbTiptapToolbarElementApiBase {
private _languages: LanguageItem[] = [];
constructor(host: any, elementName?: string) {
super(host, elementName);
// ...
this.manifest.items = [
{
label: 'π³π± NL',
value: 'nl',
},
{
label: 'π¬π§ EN',
value: 'en',
},
{
label: 'π©πͺ DE',
value: 'de',
},
];
}
// ...
}
That does set the manifest items, but these items are not shown in the Language Menu.
Is it at all possible to dynamically update the items in a tiptapToolbarExtension (type βmenuβ)? Or is there a different approach that i could try?