im triyng to develop a new package for may upwest bundle products and i want to add a macro to my richtext builder but when i open the macroPicker nothing appears and it gives an error
"Cannot read properties of undefined (reading 'allowedMacros')"
i am using this code to open macroPicker
function openMacroPicker(e) {
var macroPickerOptions = {
submit: function (model) {
//do something
},
close: function () {
editorService.close();
}
};
editorService.macroPicker(macroPickerOptions);
};
probably is some missig parameter but i could not find any documentation about theis macroPicker ... so im stucked here :(
It looks like the Macro picker needs the configuration to exist for which macros are allowed to be inserted (not all macros have the checkboxes enabled to allow them to be inserted into Rich Text Editors).
Looking at the source, it seems to read it here in the macropicker.controller.js
It looks like there needs to be a string array of 'macro alias' or an empty string array present on the dialogData model when the Macro Picker dialog is opened:
if (Utilities.isArray($scope.model.dialogData.allowedMacros) && $scope.model.dialogData.allowedMacros.length > 0) {
so think you would need to add a dialogData property to your macroPickerOptions model, with an allowedMacros property being an empty array of alias or a list of alias you want to allow...
var macroPickerOptions = {
dialogData: {
allowedMacros: [], < ------------------------- LIKE THIS IF YOU WANT TO SHOW ALL ALLOWED MACROS
},
submit: function (model) {
},
close: function () {
editorService.close();
}
};
and it worked ... thank you a lot Marc unfortunately there is no documentation about this macro Picker :( ... but you helped a lot :)
macroPicker
Hello
im triyng to develop a new package for may upwest bundle products and i want to add a macro to my richtext builder but when i open the macroPicker nothing appears and it gives an error
"Cannot read properties of undefined (reading 'allowedMacros')"
i am using this code to open macroPicker
probably is some missig parameter but i could not find any documentation about theis macroPicker ... so im stucked here :(
any help would be welcome ! ... thank you
HI Angelo
It looks like the Macro picker needs the configuration to exist for which macros are allowed to be inserted (not all macros have the checkboxes enabled to allow them to be inserted into Rich Text Editors).
Looking at the source, it seems to read it here in the macropicker.controller.js
https://github.com/umbraco/Umbraco-CMS/blob/f3668e0aabee6c4ff7c3ed0dea55fd2421a79fc4/src/Umbraco.Web.UI.Client/src/views/common/infiniteeditors/macropicker/macropicker.controller.js#L137
It looks like there needs to be a string array of 'macro alias' or an empty string array present on the dialogData model when the Macro Picker dialog is opened:
so think you would need to add a dialogData property to your macroPickerOptions model, with an allowedMacros property being an empty array of alias or a list of alias you want to allow...
regards
Marc
Hello Marc ...yes thats it ... :D
and it worked ... thank you a lot Marc unfortunately there is no documentation about this macro Picker :( ... but you helped a lot :)
all the best
Angelo
is working on a reply...