feat: pdf and local file support

This commit is contained in:
josc146
2023-03-29 17:36:37 +08:00
parent 47fe460853
commit 479a2ab553
3 changed files with 18 additions and 13 deletions
+12 -9
View File
@@ -180,15 +180,18 @@ function refreshMenu() {
}
Browser.contextMenus.onClicked.addListener((info, tab) => {
const message = {
itemId: info.menuItemId.replace(menuId, ''),
selectionText: info.selectionText,
useMenuPosition: true,
}
console.debug('menu clicked', message)
Browser.tabs.sendMessage(tab.id, {
type: 'CREATE_CHAT',
data: message,
Browser.tabs.query({ active: true, currentWindow: true }).then((tabs) => {
const currentTab = tabs[0]
const message = {
itemId: info.menuItemId.replace(menuId, ''),
selectionText: info.selectionText,
useMenuPosition: tab.id === currentTab.id,
}
console.debug('menu clicked', message)
Browser.tabs.sendMessage(currentTab.id, {
type: 'CREATE_CHAT',
data: message,
})
})
})
})
+3 -2
View File
@@ -33,7 +33,8 @@
{
"matches": [
"https://*/*",
"http://*/*"
"http://*/*",
"file://*/*"
],
"js": [
"shared.js",
@@ -47,7 +48,7 @@
"web_accessible_resources": [
{
"resources": [
"*.png"
"logo.png"
],
"matches": [
"<all_urls>"
+3 -2
View File
@@ -33,7 +33,8 @@
{
"matches": [
"https://*/*",
"http://*/*"
"http://*/*",
"file://*/*"
],
"js": [
"shared.js",
@@ -45,7 +46,7 @@
}
],
"web_accessible_resources": [
"*.png"
"logo.png"
],
"commands": {
"newChat": {