- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
Google Docs - new components #18153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Google Docs - new components #18153
Changes from all commits
      Commits
    
    
            Show all changes
          
          
            6 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      e7f2196
              
                new components
              
              
                michelle0927 a2a0672
              
                pnpm-lock.yaml
              
              
                michelle0927 8da5f82
              
                versions
              
              
                michelle0927 aec6926
              
                Merge remote-tracking branch 'origin/master' into issue-18045
              
              
                michelle0927 e130a20
              
                pnpm-lock.yaml
              
              
                michelle0927 5e5f18c
              
                fix typo
              
              
                michelle0927 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
          
            37 changes: 37 additions & 0 deletions
          
          37 
        
  components/google_docs/actions/get-tab-content/get-tab-content.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import googleDocs from "../../google_docs.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "google_docs-get-tab-content", | ||
| name: "Get Tab Content", | ||
| description: "Get the content of a tab in a document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/get)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| googleDocs, | ||
| docId: { | ||
| propDefinition: [ | ||
| googleDocs, | ||
| "docId", | ||
| ], | ||
| }, | ||
| tabIds: { | ||
| type: "string[]", | ||
| label: "Tab IDs", | ||
| description: "Return content for the specified tabs", | ||
| async options() { | ||
| const { tabs } = await this.googleDocs.getDocument(this.docId, true); | ||
| if (!tabs?.length) return []; | ||
| return tabs.map((tab) => ({ | ||
| label: tab.tabProperties.title, | ||
| value: tab.tabProperties.tabId, | ||
| })); | ||
| }, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.googleDocs.getDocument(this.docId, true); | ||
| const tabs = response.tabs.filter((tab) => this.tabIds.includes(tab.tabProperties.tabId)); | ||
| $.export("$summary", `Successfully retrieved tab content for document with ID: ${this.docId}`); | ||
| return tabs; | ||
| }, | ||
| }; | 
        
          
          
            45 changes: 45 additions & 0 deletions
          
          45 
        
  components/google_docs/actions/insert-page-break/insert-page-break.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import googleDocs from "../../google_docs.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "google_docs-insert-page-break", | ||
| name: "Insert Page Break", | ||
| description: "Insert a page break into a document. [See the documentation](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#insertpagebreakrequest)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| googleDocs, | ||
| docId: { | ||
| propDefinition: [ | ||
| googleDocs, | ||
| "docId", | ||
| ], | ||
| }, | ||
| index: { | ||
| type: "integer", | ||
| label: "Index", | ||
| description: "The index to insert the page break at", | ||
| default: 1, | ||
| optional: true, | ||
| }, | ||
| tabId: { | ||
| propDefinition: [ | ||
| googleDocs, | ||
| "tabId", | ||
| (c) => ({ | ||
| documentId: c.docId, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const pageBreak = { | ||
| location: { | ||
| index: this.index, | ||
| tabId: this.tabId, | ||
| }, | ||
| }; | ||
| await this.googleDocs.insertPageBreak(this.docId, pageBreak); | ||
| $.export("$summary", "Successfully inserted page break"); | ||
| return this.googleDocs.getDocument(this.docId, !!this.tabId); | ||
| }, | ||
| }; | 
        
          
          
            57 changes: 57 additions & 0 deletions
          
          57 
        
  components/google_docs/actions/insert-table/insert-table.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import googleDocs from "../../google_docs.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "google_docs-insert-table", | ||
| name: "Insert Table", | ||
| description: "Insert a table into a document. [See the documentation](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#inserttablerequest)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| googleDocs, | ||
| docId: { | ||
| propDefinition: [ | ||
| googleDocs, | ||
| "docId", | ||
| ], | ||
| }, | ||
| rows: { | ||
| type: "integer", | ||
| label: "Rows", | ||
| description: "The number of rows in the table", | ||
| }, | ||
| columns: { | ||
| type: "integer", | ||
| label: "Columns", | ||
| description: "The number of columns in the table", | ||
| }, | ||
| index: { | ||
| type: "integer", | ||
| label: "Index", | ||
| description: "The index to insert the table at", | ||
| default: 1, | ||
| optional: true, | ||
| }, | ||
| tabId: { | ||
| propDefinition: [ | ||
| googleDocs, | ||
| "tabId", | ||
| (c) => ({ | ||
| documentId: c.docId, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const table = { | ||
| rows: this.rows, | ||
| columns: this.columns, | ||
| location: { | ||
| index: this.index, | ||
| tabId: this.tabId, | ||
| }, | ||
| }; | ||
| await this.googleDocs.insertTable(this.docId, table); | ||
| $.export("$summary", "Successfully inserted table"); | ||
| return this.googleDocs.getDocument(this.docId, !!this.tabId); | ||
| }, | ||
| }; | 
        
          
          
            52 changes: 52 additions & 0 deletions
          
          52 
        
  components/google_docs/actions/insert-text/insert-text.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import googleDocs from "../../google_docs.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "google_docs-insert-text", | ||
| name: "Insert Text", | ||
| description: "Insert text into a document. [See the documentation](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#inserttextrequest)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| googleDocs, | ||
| docId: { | ||
| propDefinition: [ | ||
| googleDocs, | ||
| "docId", | ||
| ], | ||
| }, | ||
| text: { | ||
| propDefinition: [ | ||
| googleDocs, | ||
| "text", | ||
| ], | ||
| }, | ||
| index: { | ||
| type: "integer", | ||
| label: "Index", | ||
| description: "The index to insert the text at", | ||
| default: 1, | ||
| optional: true, | ||
| }, | ||
| tabId: { | ||
| propDefinition: [ | ||
| googleDocs, | ||
| "tabId", | ||
| (c) => ({ | ||
| documentId: c.docId, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const text = { | ||
| text: this.text, | ||
| location: { | ||
| index: this.index, | ||
| tabId: this.tabId, | ||
| }, | ||
| }; | ||
| await this.googleDocs._batchUpdate(this.docId, "insertText", text); | ||
| $.export("$summary", "Successfully inserted text"); | ||
| return this.googleDocs.getDocument(this.docId, !!this.tabId); | ||
| }, | ||
| }; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.