Shiou-Ju / kbbi-selection-enhancer-chrome

Simplify working flow learning Indonesian using https://kbbi.co.id/
MIT License
0 stars 0 forks source link

右鍵選單將選取範圍在 kbbi 查詢 #13

Closed Shiou-Ju closed 9 months ago

Shiou-Ju commented 9 months ago

https://github.com/puppeteer/puppeteer/issues/1575

根據這一篇,似乎 puppeteer 只能透過模擬鍵盤的操作來選取

試著實作

Shiou-Ju commented 9 months ago

https://github.com/puppeteer/puppeteer/issues/2486#issuecomment-602116047

這篇回覆提到 chrome.contextMenus.onClicked

Shiou-Ju commented 9 months ago

先嘗試使用 puppeteer 實作

  1. 透過模擬鍵盤操作:或許開啟之後他的選單位置需要確定
  2. chrome.contextMenus.onClicked (待研究)

如有必要也可以用 Playwright

https://www.npmjs.com/package/playwright

並參考這篇

https://github.com/open-sauced/ai/issues/291

Shiou-Ju commented 9 months ago

Context Menu in 119.0.6045.105 (正式版本) (arm64)

截圖 2024-01-09 14 06 39
  1. 查詢 xxx
  2. 複製
  3. 複製醒目提醒...
  4. 透過 google 搜尋
  5. 列印...
  6. seperate line
  7. 檢查
  8. seperate line
  9. 語音
Shiou-Ju commented 9 months ago

發現模擬鍵盤往下按的功能只能 scroll page,不能跟 context menu 聯動。

https://github.com/asweigart/pyautogui

或許考慮使用這個套件

但這是 Python 的套件或許會讓專案變複雜