Hello.
I need some help with the CustomWidget in makeblock. I can’t find any fresh documentation (if you know where is the fresh developer docs for the mblock v5 share the link please), and I’ve just found two options to make the dialog, but both do not work, here they are:
-
This code is from the ‘Custom widgets’
(widget) => {
widget.setContent = (text, value) => {
// TODO YOUR CODE
widget.setValue([text, value]);
console.log(“setContent t”, text);
console.log(“setContent v”, value);
}
widget.showEditor_ = async () => {
// TODO YOUR CODE
console.log(“showEditor_”);
DialogWidget(widget, ‘helloDialog’, ‘hey’, getOptions);
}
};
it prints “showEditor_” and then give me : “DialogWidget is not defined”
-
Second option:
(widget) => {
widget.setContent = (text, value) => {
// TODO YOUR CODE
widget.setValue([text, value]);
console.log(“setContent t”, text);
console.log(“setContent v”, value);
}
widget.showEditor_ = async () => {
// TODO YOUR CODE
console.log(“showEditor_”);
const service = window[’_appContext’].getService(‘system.ui’);
return await service.dialog(‘test’, { title: ‘hello’, width: ‘340px’ });
}
};
it prints “howEditor” and then give me : “Cannot read properties of undefined (reading ‘getService’)” , so the window[’_appContext’] - is undefined.
Any ideas on how to make the dialog work?
Another way is using my own UI solution, linking some JS library(materializecss or similar), and getting the values back and forth.
PS: ChatGPT did not help as well…