Capture text selection in Google Docs

前端 未结 3 1545
谎友^
谎友^ 2021-01-07 22:28

I\'m writing a Chrome extension that captures the user text selection and sends the selected text to Google search.

manifest.json

{
         


        
3条回答
  •  灰色年华
    2021-01-07 23:07

    Google Docs document does not really follow the normal ways of how a to access text on from a Extension. I have for this reason created a tool to work with Google Docs, which can be found here

    This should enable you to:

    //contentScript.js
    var googleDocument = googleDocsUtil.getGoogleDocument();
    console.log("The selected text is: " + googleDocument.selectedText);
    

提交回复
热议问题