Fix backgroundColor option documentation (Fix #1164)

This commit is contained in:
Niklas von Hertzen 2017-12-12 21:23:53 +08:00
parent 77d258f1d8
commit 3965a0fd40
4 changed files with 5 additions and 4 deletions

View File

@ -13,7 +13,7 @@ These are all of the available configuration options.
| ------------- | :------: | ----------- | | ------------- | :------: | ----------- |
| async | `true` | Whether to parse and render the element asynchronously | async | `true` | Whether to parse and render the element asynchronously
| allowTaint | `false` | Whether to allow cross-origin images to taint the canvas | allowTaint | `false` | Whether to allow cross-origin images to taint the canvas
| backgroundColor | `#ffffff` | Canvas background color, if none is specified in DOM. Set undefined for transparent | backgroundColor | `#ffffff` | Canvas background color, if none is specified in DOM. Set `null` for transparent
| canvas | `null` | Existing `canvas` element to use as a base for drawing on | canvas | `null` | Existing `canvas` element to use as a base for drawing on
| foreignObjectRendering | `false` | Whether to use ForeignObject rendering if the browser supports it | foreignObjectRendering | `false` | Whether to use ForeignObject rendering if the browser supports it
| imageTimeout | `15000` | Timeout for loading an image (in milliseconds). Set to `0` to disable timeout. | imageTimeout | `15000` | Timeout for loading an image (in milliseconds). Set to `0` to disable timeout.

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "html2canvas", "name": "html2canvas",
"version": "1.0.0-alpha.1", "version": "1.0.0-alpha.4",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -353,8 +353,8 @@ export default class Renderer {
render(stack: StackingContext): Promise<*> { render(stack: StackingContext): Promise<*> {
if (this.options.backgroundColor) { if (this.options.backgroundColor) {
this.target.rectangle( this.target.rectangle(
0, this.options.x,
0, this.options.y,
this.options.width, this.options.width,
this.options.height, this.options.height,
this.options.backgroundColor this.options.backgroundColor

View File

@ -64,6 +64,7 @@ const html2canvas = (element: HTMLElement, conf: ?Options): Promise<*> => {
const defaultOptions = { const defaultOptions = {
async: true, async: true,
allowTaint: false, allowTaint: false,
backgroundColor: '#ffffff',
imageTimeout: 15000, imageTimeout: 15000,
logging: true, logging: true,
proxy: null, proxy: null,