`File` menu items (Whiteboard) are accessible using the keyboard

WIP #1284
This commit is contained in:
daria 2024-02-20 16:11:25 +02:00
parent 2c4bedb056
commit 05e1874f9b
1 changed files with 30 additions and 9 deletions

View File

@ -17,6 +17,7 @@ define([
'/whiteboard/colors.js', '/whiteboard/colors.js',
'/customize/application_config.js', '/customize/application_config.js',
'/components/chainpad/chainpad.dist.js', '/components/chainpad/chainpad.dist.js',
'/common/common-ui-elements.js',
'/lib/fabric.min.js', '/lib/fabric.min.js',
'less!/whiteboard/app-whiteboard.less' 'less!/whiteboard/app-whiteboard.less'
@ -34,7 +35,8 @@ define([
Messages, Messages,
Colors, Colors,
AppConfig, AppConfig,
ChainPad) ChainPad,
UIElements)
{ {
var APP = window.APP = { var APP = window.APP = {
@ -298,8 +300,16 @@ define([
var mkHelpMenu = function (framework) { var mkHelpMenu = function (framework) {
var $appContainer = $('#cp-app-whiteboard-container'); var $appContainer = $('#cp-app-whiteboard-container');
var helpMenu = framework._.sfCommon.createHelpMenu(['whiteboard']); var helpMenu = framework._.sfCommon.createHelpMenu(['whiteboard']);
var $helpMenuButton = UIElements.createDropdownEntry({
tag: 'a',
attributes: { 'class': helpMenu.button.attr('class') },
content: h('span', helpMenu.button.text()),
action: function () {
helpMenu.button.click();
}
});
$appContainer.prepend(helpMenu.menu); $appContainer.prepend(helpMenu.menu);
framework._.toolbar.$drawer.append(helpMenu.button); framework._.toolbar.$drawer.append($helpMenuButton);
}; };
// Start of the main loop // Start of the main loop
@ -434,13 +444,24 @@ define([
}); });
// Export to drive as PNG // Export to drive as PNG
framework._.sfCommon.createButton('savetodrive', true, {}).click(function () { var $saveToDriveButton = framework._.sfCommon.createButton('savetodrive', true, {});
var defaultName = framework._.title.getTitle(); var $saveToDrive = UIElements.createDropdownEntry({
UI.prompt(Messages.exportPrompt, defaultName + '.png', function (name) { tag: 'a',
if (name === null || !name.trim()) { return; } attributes: { 'class': $saveToDriveButton.attr('class') },
APP.upload(name); content: [
}); h('i', { 'class': $saveToDriveButton.children('i').attr('class') }),
}).appendTo($drawer); h('span', $saveToDriveButton.text())
],
action: function () {
var defaultName = framework._.title.getTitle();
UI.prompt(Messages.exportPrompt, defaultName + '.png', function (name) {
if (name === null || !name.trim()) { return; }
APP.upload(name);
});
}
});
$saveToDrive.appendTo($drawer);
} else { } else {
framework._.sfCommon.createButton('', true, { framework._.sfCommon.createButton('', true, {
title: Messages.canvas_imageEmbed, title: Messages.canvas_imageEmbed,