mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-11 18:24:43 +02:00
* set cancel as the default in dangerous operations, rename buttons (delete, remove) and context menu (for tags) fixes #1662 (partially, because I can't fix the upstream issue, unless we update Electron) * add default value for buttonLabel
This commit is contained in:
parent
4a88343372
commit
d7a50a1b48
@ -267,9 +267,11 @@ class SideBarComponent extends React.Component {
|
||||
if (!itemId || !itemType) throw new Error('No data on element');
|
||||
|
||||
let deleteMessage = '';
|
||||
let buttonLabel = _('Remove');
|
||||
if (itemType === BaseModel.TYPE_FOLDER) {
|
||||
const folder = await Folder.load(itemId);
|
||||
deleteMessage = _('Delete notebook "%s"?\n\nAll notes and sub-notebooks within this notebook will also be deleted.', substrWithEllipsis(folder.title, 0, 32));
|
||||
buttonLabel = _('Delete');
|
||||
} else if (itemType === BaseModel.TYPE_TAG) {
|
||||
const tag = await Tag.load(itemId);
|
||||
deleteMessage = _('Remove tag "%s" from all notes?', substrWithEllipsis(tag.title, 0, 32));
|
||||
@ -286,9 +288,12 @@ class SideBarComponent extends React.Component {
|
||||
|
||||
menu.append(
|
||||
new MenuItem({
|
||||
label: _('Delete'),
|
||||
label: buttonLabel,
|
||||
click: async () => {
|
||||
const ok = bridge().showConfirmMessageBox(deleteMessage);
|
||||
const ok = bridge().showConfirmMessageBox(deleteMessage, {
|
||||
buttons: [buttonLabel, _('Cancel')],
|
||||
defaultId: 1,
|
||||
});
|
||||
if (!ok) return;
|
||||
|
||||
if (itemType === BaseModel.TYPE_FOLDER) {
|
||||
|
Loading…
Reference in New Issue
Block a user