JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
866 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I've followed the following guides to set up custom keyboard shortcuts for a Powerpoint add-in. It should all be ready to go.
The shortcuts.json resides in the src directory of the plugin, and I've created the required functions in taskpane.js like so:
shortcuts.json:
{
"actions": [
{
"id": "SHOWTASKPANE",
"type": "ExecuteFunction",
"name": "Show task pane for add-in"
},
{
"id": "HIDETASKPANE",
"type": "ExecuteFunction",
"name": "Hide task pane for add-in"
}
],
"shortcuts": [
{
"action": "SHOWTASKPANE",
"key": {
"default": "Cmd+Shift+K"
}
},
{
"action": "HIDETASKPANE",
"key": {
"default": "Cmd+Shift+J"
}
}
]
}
taskpane.js:
Office.actions.associate('SHOWTASKPANE', function () {
return Office.addin.showAsTaskpane()
.then(function () {
return;
})
.catch(function (error) {
return error.code;
});
});
Office.actions.associate('HIDETASKPANE', function () {
return Office.addin.hide()
.then(function () {
return;
})
.catch(function (error) {
return error.code;
});
});
manifest.xml:
</VersionOverrides>
<ExtendedOverrides Url="https://localhost:3000/src/shortcuts.json"></ExtendedOverrides>
</OfficeApp>
Has anyone managed to get this working for Mac? My shortcuts failed to work after trying multiple different command chains, and no logs showed up via npm logging or the inspect elements panel.
Thank you for your help.