Skip to content

Commit

Permalink
Bug fix: Clipping and folder names with ampersand display incorrectly…
Browse files Browse the repository at this point in the history
… in Clippings menu

(issue #422)
  • Loading branch information
aecreations committed Jul 1, 2023
1 parent 90bb6ab commit 0f68e89
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions wx-src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,16 @@ function getContextMenuData(aFolderID)
return rv;
}

function sanitizeMenuTitle(aTitle)
{
// Escape the ampersand character, which would normally be used to denote
// the access key for the menu item.
let rv = aTitle.replace(/&/g, "&&");

return rv;
}
// END nested functions

let rv = [];
let clippingsDB = aeClippings.getDB();

Expand All @@ -796,7 +806,7 @@ function getContextMenuData(aFolderID)

let submenuItemData = {
id: fldrMenuItemID,
title: aItem.name,
title: sanitizeMenuTitle(aItem.name),
};

// Submenu icon
Expand Down Expand Up @@ -839,7 +849,7 @@ function getContextMenuData(aFolderID)

let menuItemData = {
id: menuItemID,
title: aItem.name,
title: sanitizeMenuTitle(aItem.name),
icons: {
16: "img/" + (aItem.label ? `clipping-${aItem.label}.svg` : "clipping.svg")
},
Expand Down

0 comments on commit 0f68e89

Please sign in to comment.