mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Don't copy styles for regular computed rendering
This commit is contained in:
parent
4f96abfb7b
commit
f79ae2b73a
@ -18,11 +18,11 @@ export class DocumentCloner {
|
||||
inlineImages: boolean;
|
||||
copyStyles: boolean;
|
||||
|
||||
constructor(element: HTMLElement, options: Options, logger: Logger) {
|
||||
constructor(element: HTMLElement, options: Options, logger: Logger, copyInline: boolean) {
|
||||
this.referenceElement = element;
|
||||
this.scrolledElements = [];
|
||||
this.copyStyles = true;
|
||||
this.inlineImages = true;
|
||||
this.copyStyles = copyInline;
|
||||
this.inlineImages = copyInline;
|
||||
this.logger = logger;
|
||||
this.imageLoader = new ImageLoader(options, logger, window);
|
||||
// $FlowFixMe
|
||||
@ -237,7 +237,7 @@ export const cloneWindow = (
|
||||
options: Options,
|
||||
logger: Logger
|
||||
): Promise<[HTMLIFrameElement, HTMLElement]> => {
|
||||
const cloner = new DocumentCloner(referenceElement, options, logger);
|
||||
const cloner = new DocumentCloner(referenceElement, options, logger, false);
|
||||
const cloneIframeContainer = ownerDocument.createElement('iframe');
|
||||
|
||||
cloneIframeContainer.className = 'html2canvas-container';
|
||||
|
@ -38,7 +38,11 @@ export default class ImageLoader<T> {
|
||||
return this.addImage(src, src);
|
||||
}
|
||||
} else {
|
||||
if (this.options.allowTaint === true || isInlineBase64Image(src) || this.isSameOrigin(src)) {
|
||||
if (
|
||||
this.options.allowTaint === true ||
|
||||
isInlineBase64Image(src) ||
|
||||
this.isSameOrigin(src)
|
||||
) {
|
||||
return this.addImage(src, src);
|
||||
} else if (typeof this.options.proxy === 'string' && !this.isSameOrigin(src)) {
|
||||
// TODO proxy
|
||||
|
@ -23,7 +23,7 @@ export type Options = {
|
||||
proxy: ?string,
|
||||
removeContainer: ?boolean,
|
||||
scale: number,
|
||||
target: RenderTarget<*> | Array<RenderTarget<*>>,
|
||||
target: RenderTarget<*>,
|
||||
type: ?string,
|
||||
windowWidth: number,
|
||||
windowHeight: number,
|
||||
@ -98,7 +98,7 @@ const html2canvas = (element: HTMLElement, config: Options): Promise<*> => {
|
||||
scale: options.scale
|
||||
});
|
||||
});
|
||||
})(new DocumentCloner(element, options, logger))
|
||||
})(new DocumentCloner(element, options, logger, true))
|
||||
: cloneWindow(
|
||||
ownerDocument,
|
||||
windowBounds,
|
||||
|
@ -115,7 +115,7 @@ const assertPath = (result, expected, desc) => {
|
||||
.html2canvas(testContainer.contentWindow.document.documentElement, {
|
||||
removeContainer: true
|
||||
})
|
||||
.then((canvas) => {
|
||||
.then(canvas => {
|
||||
try {
|
||||
canvas
|
||||
.getContext('2d')
|
||||
|
Loading…
Reference in New Issue
Block a user