google-slides
Advanced tools
Comparing version 2.1.0 to 2.1.1
{ | ||
"name": "google-slides", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "NPM package for some simple Google Slides operations", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -13,8 +13,9 @@ [![Build Status](https://travis-ci.org/wpbdry/google-slides.svg?branch=main)](https://travis-ci.org/wpbdry/google-slides) | ||
- [share](#share) | ||
- [Presentation.replaceAllText](#presentationreplacealltext) | ||
- [batchUpdate](#batchupdate) | ||
- [API](#api) | ||
- [copyPresentation](#copypresentation) | ||
- [sharePresentation](#sharepresentation) | ||
- [API.replaceAllText](#apireplacealltext) | ||
- [TextReplacement](#textreplacement) | ||
- [presentationBatchUpdate](#presentationbatchupdate) | ||
- [TextReplacement](#textreplacement) | ||
- [ShapeReplacementWithImage](#shapereplacementwithimage) | ||
- [underlying services](#underlying-services) | ||
@@ -59,4 +60,4 @@ - [driveService](#driveservice) | ||
#### Presentation.replaceAllText | ||
See [API.replaceAllText](#apireplacealltext). | ||
#### batchUpdate | ||
See [API.presentationBatchUpdate](#presentationbatchupdate). | ||
Instead of `api` use `presentation` and don't pass `presentationId`. | ||
@@ -87,33 +88,32 @@ | ||
#### API.replaceAllText | ||
#### presentationBatchUpdate | ||
```javascript | ||
api.replaceAllText(presentationId, { | ||
text: '{{title}}', | ||
replaceText: 'My Presentation' | ||
}) | ||
import { API, TextReplacement, ShapeReplacementWithImage } from 'google-slides' | ||
const api = new API('path/to/credentials.json') | ||
api.presentationBatchUpdate(presentationId, [ | ||
new TextReplacement('{{client-name}}', 'My Client'), | ||
new ShapeReplacementWithImage('{{client-logo}}', logoUrl) | ||
]) | ||
.catch(error => doSomething(error)) | ||
``` | ||
or | ||
##### TextReplacement | ||
Replaces all instances of text matching a criterion with `replaceText`. \ | ||
```javascript | ||
api.replaceAllText(presentationId, [{ | ||
text: 'Cape', | ||
replaceText: 'Cape Town' | ||
matchCase: true | ||
}, { | ||
text: 'bandana', | ||
replaceText: 'shawl' | ||
}]) | ||
.catch(error => doSomething(error)) | ||
const text = '{{some-text-to-replace}}' | ||
const replaceText = 'Replacement Text' | ||
const matchCase = true // default | ||
const textReplacement = new TextReplacement(text, replaceText, matchCase) | ||
``` | ||
### TextReplacement | ||
##### ShapeReplacementWithImage | ||
Replaces all shapes that match the given criteria with the provided image. | ||
```javascript | ||
import { API, TextReplacement } from 'google-slides' | ||
const api = new API('path/to/credentials.json') | ||
api.replaceAllText(presentationId, [ | ||
new TextReplacement('Cape', 'Cape Town', true), | ||
new TextReplacement('bandana', 'shawl') | ||
]) | ||
.catch(error => doSomething(error)) | ||
const text = '{{text-contained-within-shape}}' | ||
const imageUrl = 'https://example.com/my-img' | ||
const matchCase = true // default | ||
const replaceMethod = 'CENTER_INSIDE' // default | ||
const shapeReplacement = new ShapeReplacementWithImage(text, imageUrl, matchCase, replaceMethod) | ||
``` | ||
@@ -152,2 +152,2 @@ | ||
Since logging in happens asynchronously, the services may not yet exist by the time they are used. These services are `await`ed every time | ||
they are used in the [built in methods](#usage). You only need to `await` each service the first time you use it in any single promise chain. | ||
they are used in the [built in methods](#usage). You only need to `await` each service the first time you use it in any single promise chain. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19907
149