mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
fix: correctly respect logging option (#2013)
* test: update to using jest for unit tests * remove mocha types * revert to using mocha for testrunner.ts * add logger unit testing * fix reftest previewer scaling * fix LoggerOptions to interface * fix linting
This commit is contained in:
@@ -11,7 +11,7 @@ import {ForeignObjectRenderer} from './render/canvas/foreignobject-renderer';
|
||||
export type Options = CloneOptions &
|
||||
RenderOptions &
|
||||
ResourceOptions & {
|
||||
backgroundColor: string;
|
||||
backgroundColor: string | null;
|
||||
foreignObjectRendering: boolean;
|
||||
logging: boolean;
|
||||
removeContainer?: boolean;
|
||||
@@ -76,7 +76,7 @@ const renderElement = async (element: HTMLElement, opts: Partial<Options>): Prom
|
||||
|
||||
const windowBounds = new Bounds(options.scrollX, options.scrollY, options.windowWidth, options.windowHeight);
|
||||
|
||||
Logger.create(instanceName);
|
||||
Logger.create({id: instanceName, enabled: options.logging});
|
||||
Logger.getInstance(instanceName).debug(`Starting document clone`);
|
||||
const documentCloner = new DocumentCloner(element, {
|
||||
id: instanceName,
|
||||
@@ -101,7 +101,8 @@ const renderElement = async (element: HTMLElement, opts: Partial<Options>): Prom
|
||||
: COLORS.TRANSPARENT;
|
||||
|
||||
const bgColor = opts.backgroundColor;
|
||||
const defaultBackgroundColor = typeof bgColor === 'string' ? parseColor(bgColor) : bgColor === null ? COLORS.TRANSPARENT : 0xffffffff;
|
||||
const defaultBackgroundColor =
|
||||
typeof bgColor === 'string' ? parseColor(bgColor) : bgColor === null ? COLORS.TRANSPARENT : 0xffffffff;
|
||||
|
||||
const backgroundColor =
|
||||
element === ownerDocument.documentElement
|
||||
|
||||
Reference in New Issue
Block a user