mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-02 12:47:41 +02:00
macOS: Fixes #3404: Show context menu option to copy a link
This commit is contained in:
parent
8543849ea1
commit
68e4b4eaad
@ -117,7 +117,7 @@ export function menuItems():ContextMenuItems {
|
||||
onAction: async (options:ContextMenuOptions) => {
|
||||
clipboard.writeText(options.linkToCopy !== null ? options.linkToCopy : options.textToCopy);
|
||||
},
|
||||
isActive: (itemType:ContextMenuItemType) => itemType === ContextMenuItemType.Link,
|
||||
isActive: (itemType:ContextMenuItemType, options:ContextMenuOptions) => itemType === ContextMenuItemType.Link || !!options.linkToCopy,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ export default function useMessageHandler(scrollWhenReady:any, setScrollWhenRead
|
||||
itemType: arg0 && arg0.type,
|
||||
resourceId: arg0.resourceId,
|
||||
textToCopy: arg0.textToCopy,
|
||||
linkToCopy: null,
|
||||
linkToCopy: arg0.linkToCopy || null,
|
||||
htmlToCopy: '',
|
||||
insertContent: () => { console.warn('insertContent() not implemented'); },
|
||||
});
|
||||
|
@ -368,9 +368,12 @@
|
||||
const selectedText = window.getSelection().toString();
|
||||
|
||||
if (selectedText) {
|
||||
const linkToCopy = event.target && event.target.getAttribute('href') ? event.target.getAttribute('href') : null;
|
||||
|
||||
ipcProxySendToHost('contextMenu', {
|
||||
type: 'text',
|
||||
textToCopy: selectedText,
|
||||
linkToCopy: linkToCopy,
|
||||
});
|
||||
} else if (event.target.getAttribute('href')) {
|
||||
ipcProxySendToHost('contextMenu', {
|
||||
|
Loading…
Reference in New Issue
Block a user