1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-04-11 11:12:03 +02:00

when deleting notebook or tag, display name (#1253)

The delete dialog for notebooks and tags does not display the name of the item to be deleted.
This can lead to an undesired result.

closes #1245
This commit is contained in:
Helmut K. C. Tessarek 2019-02-24 06:11:34 -05:00 committed by Laurent Cozic
parent 4845a21287
commit c34872bb26

View File

@ -13,6 +13,7 @@ const { bridge } = require("electron").remote.require("./bridge");
const Menu = bridge().Menu;
const MenuItem = bridge().MenuItem;
const InteropServiceHelper = require("../InteropServiceHelper.js");
const { substrWithEllipsis } = require('lib/string-utils');
const { shim } = require('lib/shim');
class SideBarComponent extends React.Component {
@ -261,7 +262,7 @@ class SideBarComponent extends React.Component {
}
}
itemContextMenu(event) {
async itemContextMenu(event) {
const itemId = event.target.getAttribute("data-id");
if (itemId === Folder.conflictFolderId()) return;
@ -270,9 +271,11 @@ class SideBarComponent extends React.Component {
let deleteMessage = "";
if (itemType === BaseModel.TYPE_FOLDER) {
deleteMessage = _("Delete notebook? All notes and sub-notebooks within this notebook will also be deleted.");
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));
} else if (itemType === BaseModel.TYPE_TAG) {
deleteMessage = _("Remove this tag from all the notes?");
const tag = await Tag.load(itemId);
deleteMessage = _('Remove tag "%s" from all notes?', substrWithEllipsis(tag.title, 0, 32));
} else if (itemType === BaseModel.TYPE_SEARCH) {
deleteMessage = _("Remove this search from the sidebar?");
}