Is it possible to create a custom dialog (React TinyMCE) that fetches data from an API and lists items for the user to select one? Appearently, TinyMCE only allows me to create a custom dialog with static data.
const internalLinksDialog = editor => ({
title: 'Internal Links',
body: {
type: 'panel',
items: [
{
type: 'input',
name: 'search',
inputMode: 'text',
placeholder: 'Search internal links',
},
// ...render a list with items
],
},
initialData: {
search: '',
items: [], // ...data fetched from an api
},
onSubmit: api => {
const data = api.getData();
editor.execCommand('mceInsertContent', false, `<p>${JSON.stringify(data)}</p>`);
api.close();
},
});