Custom Toolbar List Menu action
Posted: Fri Aug 27, 2021 12:24 pm
I have successfully added the custom toolbar action list on DITA toolbar. And now my custom toolbar list is showing in the DITA toolbar but in the drop-down menu there are no items is showing.
So Can you please tell me how can I add n items to my custom toolbar list menu? With the help of the Javascript Plugin
I am attaching the screenshot for the same.
Implemented Code:
goog.events.listen(editor, sync.api.Editor.EventTypes.ACTIONS_LOADED, function(e) {
var actionsConfig = e.actionsConfiguration;
var ditaToolbar = null;
if (actionsConfig.toolbars) {
for (var i = 0; i < actionsConfig.toolbars.length; i++) {
var toolbar = actionsConfig.toolbars;
console.log(toolbar);
if (toolbar.name === "DITA") {
ditaToolbar = toolbar;
}
}
}
if (ditaToolbar) {
ditaToolbar.children.push({
children: [
{id: "covh1", type: "action"},
{id: "covh2", type: "action"},
{id: "covh3", type: "action"},
{id: "covh4", type: "action"},
],
name: actionId,
type: "list"
});
}
});
And after adding the menu items into the drop-down list. How I get the user-selected item from the drop-down with the help of JS plugin
So Can you please tell me how can I add n items to my custom toolbar list menu? With the help of the Javascript Plugin
I am attaching the screenshot for the same.
Implemented Code:
goog.events.listen(editor, sync.api.Editor.EventTypes.ACTIONS_LOADED, function(e) {
var actionsConfig = e.actionsConfiguration;
var ditaToolbar = null;
if (actionsConfig.toolbars) {
for (var i = 0; i < actionsConfig.toolbars.length; i++) {
var toolbar = actionsConfig.toolbars;
console.log(toolbar);
if (toolbar.name === "DITA") {
ditaToolbar = toolbar;
}
}
}
if (ditaToolbar) {
ditaToolbar.children.push({
children: [
{id: "covh1", type: "action"},
{id: "covh2", type: "action"},
{id: "covh3", type: "action"},
{id: "covh4", type: "action"},
],
name: actionId,
type: "list"
});
}
});
And after adding the menu items into the drop-down list. How I get the user-selected item from the drop-down with the help of JS plugin