ThunderAI icon indicating copy to clipboard operation
ThunderAI copied to clipboard

Add a contextual menu

Open micz opened this issue 1 year ago • 0 comments

Add a contextual menu that let the user use a prompt on the selected text.

  • [ ] Add a new properties to prompts, to choose if the prompt has to be shown in the context menu (available only if a selection is needed).
  • [ ] Add the methods to the background script to create the context menu. Filter the menu also with the type attribute (just before showing it?).
  • [ ] Pass to the AI popup the tab type we are coming from. If it's a mailTab, a compose window or a generic window.
  • [ ] In the AI popup change the allowed actions depending of the tab type we are coming from.
    • [ ] Composing and reading, keep the actual actions.
    • [ ] Generic webpage, copy to clipboard and close.



Available info when clicking the menu item:


Generic window

>>>>>>>>> info: {"menuItemId":2,"parentMenuItemId":3,"viewType":"tab","frameId":0,"editable":false,"targetElementId":2059837,"pageUrl":"https://web.telegram.org/a/","selectionText":"prova questo","modifiers":[],"button":0} [background.js:51:17](moz-extension://4daf2c62-7aadasd5e85ed07/background.js)
>>>>>>>>> tab: {"id":7,"index":4,"windowId":1,"highlighted":true,"active":true,"status":"complete","width":1206,"height":681,"cookieStoreId":"firefox-default","type":"content","mailTab":false}



Tab mail window

>>>>>>>>> info: {"menuItemId":2,"parentMenuItemId":3,"editable":false,"pageUrl":"imap://micthdev%[email protected]:993/fetch%3EUID%3E/%5BGmail%5D/Sent%20Mail%3E43","selectionText":"vediamo ","modifiers":[],"button":0} [background.js:51:17](moz-extension://4daf2c62-7aa4-4808-bafd-0bc65e85ed07/background.js)
>>>>>>>>> tab: {"id":4,"index":0,"windowId":1,"highlighted":true,"active":true,"status":"complete","width":789,"height":370,"cookieStoreId":"firefox-default","spaceId":1,"type":"mail","mailTab":true}



Compose window

>>>>>>>>> info: {"menuItemId":2,"parentMenuItemId":3,"editable":true,"pageUrl":"about:blank?compose","selectionText":"dssdfsdf","modifiers":[],"button":0} [background.js:51:17](moz-extension://4daf2c62asd4808-asd85ed07/background.js)
>>>>>>>>> tab: {"id":9,"index":0,"windowId":93,"highlighted":true,"active":true,"status":"complete","width":860,"height":581,"cookieStoreId":"firefox-default","type":"messageCompose","mailTab":false}



[Originally proposed by @grossherr in #180]

micz avatar Nov 23 '24 14:11 micz