mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
Add new context menu item: Copy Custom Field Name (#2045)
* Add "Copy custom field name" context menu item * Title case context menu string * Improve Copy Custom Field Name logic * Move CopyClickedElement to runtime.background * Update dependencies * Add comments, refactor logic, add failure messages * Fix typo and linting * Fix typos * Move null check inside function
This commit is contained in:
@@ -29,6 +29,8 @@ export default class ContextMenusBackground {
|
||||
this.contextMenus.onClicked.addListener(async (info: any, tab: any) => {
|
||||
if (info.menuItemId === 'generate-password') {
|
||||
await this.generatePasswordToClipboard();
|
||||
} else if (info.menuItemId === 'copy-identifier') {
|
||||
await this.getClickedElement();
|
||||
} else if (info.parentMenuItemId === 'autofill' ||
|
||||
info.parentMenuItemId === 'copy-username' ||
|
||||
info.parentMenuItemId === 'copy-password' ||
|
||||
@@ -45,6 +47,15 @@ export default class ContextMenusBackground {
|
||||
this.passwordGenerationService.addHistory(password);
|
||||
}
|
||||
|
||||
private async getClickedElement() {
|
||||
const tab = await BrowserApi.getTabFromCurrentWindow();
|
||||
if (tab == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
BrowserApi.tabSendMessageData(tab, 'getClickedElement');
|
||||
}
|
||||
|
||||
private async cipherAction(info: any) {
|
||||
const id = info.menuItemId.split('_')[1];
|
||||
if (id === 'noop') {
|
||||
|
||||
Reference in New Issue
Block a user