Skip to content

Commit

Permalink
✨ Copy image context menu item
Browse files Browse the repository at this point in the history
  • Loading branch information
trickypr committed Nov 18, 2023
1 parent 812562b commit eb7ca2d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/content/globalOverlay.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
declare function closeWindow(aClose, aPromptFunction, aSource)

/**
* @depends @mozilla.org/browser/browserglue;1
*/
declare function canQuitApplication(aData, aSource)

/**
* @depends @mozilla.org/browser/browserglue;1
*/
declare function goQuitApplication(event)

declare function goUpdateCommand(aCommand: string)

declare function goDoCommand(aCommand: string)

declare function goSetCommandEnabled(aID, aEnabled)
4 changes: 4 additions & 0 deletions src/content/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
'chrome://global/content/contentAreaUtils.js',
this,
)
Services.scriptloader.loadSubScript(
'chrome://global/content/globalOverlay.js',
this,
)
</script>
</head>
<body></body>
Expand Down
1 change: 1 addition & 0 deletions src/content/shared/contextMenus/MenuItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const MENU_ITEM_ACTION_IDS = [
'navigation__forward',
'navigation__reload',
'navigation__bookmark',
'image__copy',
'image__copy-link',
'image__new-tab',
'image__save',
Expand Down
7 changes: 7 additions & 0 deletions src/content/shared/contextMenus/menuItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ export const MENU_ITEM_ACTIONS: MenuItemAction[] = (
visible: ALWAYS,
action: () => window.windowApi.windowTriggers.emit('bookmarkCurrentPage'),
},
{
id: 'image__copy',
title: 'Copy Image',

visible: HAS_IMAGE_SRC,
action: () => goDoCommand('cmd_copyImage'),
},
{
id: 'image__copy-link',
title: 'Copy Image Link',
Expand Down
4 changes: 3 additions & 1 deletion src/content/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/// <reference types="gecko-types" />
/// <reference types="svelte" />

/// <reference path='./contentAreaUtils' />
/// <reference path='./globalOverlay' />

declare module '*.txt' {
const contents: string
export = contents
Expand Down

0 comments on commit eb7ca2d

Please sign in to comment.