mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
deps: update dependencies with lint fixes (#2565)
This commit is contained in:
committed by
GitHub
parent
e7a021ab93
commit
b2902ec31c
@@ -2,15 +2,14 @@ export class DocumentCloner {
|
||||
clonedReferenceElement?: HTMLElement;
|
||||
|
||||
constructor() {
|
||||
// eslint-disable-next-line @typescript-eslint/no-object-literal-type-assertion
|
||||
this.clonedReferenceElement = {} as HTMLElement;
|
||||
}
|
||||
|
||||
toIFrame() {
|
||||
return Promise.resolve({});
|
||||
toIFrame(): Promise<HTMLIFrameElement> {
|
||||
return Promise.resolve({} as HTMLIFrameElement);
|
||||
}
|
||||
|
||||
static destroy() {
|
||||
static destroy(): boolean {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,9 +130,7 @@ export class DocumentCloner {
|
||||
}
|
||||
|
||||
const clone = node.cloneNode(false) as T;
|
||||
// @ts-ignore
|
||||
if (isImageElement(clone) && clone.loading === 'lazy') {
|
||||
// @ts-ignore
|
||||
clone.loading = 'eager';
|
||||
}
|
||||
|
||||
@@ -351,7 +349,7 @@ export class DocumentCloner {
|
||||
const anonymousReplacedElement = document.createElement('html2canvaspseudoelement');
|
||||
copyCSSStyles(style, anonymousReplacedElement);
|
||||
|
||||
declaration.content.forEach(token => {
|
||||
declaration.content.forEach((token) => {
|
||||
if (token.type === TokenType.STRING_TOKEN) {
|
||||
anonymousReplacedElement.appendChild(document.createTextNode(token.value));
|
||||
} else if (token.type === TokenType.URL_TOKEN) {
|
||||
@@ -390,7 +388,7 @@ export class DocumentCloner {
|
||||
: LIST_STYLE_TYPE.DECIMAL;
|
||||
const separator = delim && delim.type === TokenType.STRING_TOKEN ? delim.value : '';
|
||||
const text = counterStates
|
||||
.map(value => createCounterText(value, counterType, false))
|
||||
.map((value) => createCounterText(value, counterType, false))
|
||||
.join(separator);
|
||||
|
||||
anonymousReplacedElement.appendChild(document.createTextNode(text));
|
||||
@@ -474,15 +472,18 @@ const iframeLoader = (iframe: HTMLIFrameElement): Promise<HTMLIFrameElement> =>
|
||||
|
||||
const documentClone = cloneWindow.document;
|
||||
|
||||
cloneWindow.onload = iframe.onload = documentClone.onreadystatechange = () => {
|
||||
cloneWindow.onload = iframe.onload = documentClone.onreadystatechange = null;
|
||||
const interval = setInterval(() => {
|
||||
if (documentClone.body.childNodes.length > 0 && documentClone.readyState === 'complete') {
|
||||
clearInterval(interval);
|
||||
resolve(iframe);
|
||||
}
|
||||
}, 50);
|
||||
};
|
||||
cloneWindow.onload =
|
||||
iframe.onload =
|
||||
documentClone.onreadystatechange =
|
||||
() => {
|
||||
cloneWindow.onload = iframe.onload = documentClone.onreadystatechange = null;
|
||||
const interval = setInterval(() => {
|
||||
if (documentClone.body.childNodes.length > 0 && documentClone.readyState === 'complete') {
|
||||
clearInterval(interval);
|
||||
resolve(iframe);
|
||||
}
|
||||
}, 50);
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -28,8 +28,9 @@ export class IFrameElementContainer extends ElementContainer {
|
||||
|
||||
// http://www.w3.org/TR/css3-background/#special-backgrounds
|
||||
const documentBackgroundColor = iframe.contentWindow.document.documentElement
|
||||
? parseColor(getComputedStyle(iframe.contentWindow.document.documentElement)
|
||||
.backgroundColor as string)
|
||||
? parseColor(
|
||||
getComputedStyle(iframe.contentWindow.document.documentElement).backgroundColor as string
|
||||
)
|
||||
: COLORS.TRANSPARENT;
|
||||
const bodyBackgroundColor = iframe.contentWindow.document.body
|
||||
? parseColor(getComputedStyle(iframe.contentWindow.document.body).backgroundColor as string)
|
||||
|
||||
@@ -56,10 +56,21 @@ export class InputElementContainer extends ElementContainer {
|
||||
|
||||
if (this.type === CHECKBOX || this.type === RADIO) {
|
||||
this.styles.backgroundColor = 0xdededeff;
|
||||
this.styles.borderTopColor = this.styles.borderRightColor = this.styles.borderBottomColor = this.styles.borderLeftColor = 0xa5a5a5ff;
|
||||
this.styles.borderTopWidth = this.styles.borderRightWidth = this.styles.borderBottomWidth = this.styles.borderLeftWidth = 1;
|
||||
this.styles.borderTopStyle = this.styles.borderRightStyle = this.styles.borderBottomStyle = this.styles.borderLeftStyle =
|
||||
BORDER_STYLE.SOLID;
|
||||
this.styles.borderTopColor =
|
||||
this.styles.borderRightColor =
|
||||
this.styles.borderBottomColor =
|
||||
this.styles.borderLeftColor =
|
||||
0xa5a5a5ff;
|
||||
this.styles.borderTopWidth =
|
||||
this.styles.borderRightWidth =
|
||||
this.styles.borderBottomWidth =
|
||||
this.styles.borderLeftWidth =
|
||||
1;
|
||||
this.styles.borderTopStyle =
|
||||
this.styles.borderRightStyle =
|
||||
this.styles.borderBottomStyle =
|
||||
this.styles.borderLeftStyle =
|
||||
BORDER_STYLE.SOLID;
|
||||
this.styles.backgroundClip = [BACKGROUND_CLIP.BORDER_BOX];
|
||||
this.styles.backgroundOrigin = [BACKGROUND_ORIGIN.BORDER_BOX];
|
||||
this.bounds = reformatInputBounds(this.bounds);
|
||||
@@ -67,10 +78,18 @@ export class InputElementContainer extends ElementContainer {
|
||||
|
||||
switch (this.type) {
|
||||
case CHECKBOX:
|
||||
this.styles.borderTopRightRadius = this.styles.borderTopLeftRadius = this.styles.borderBottomRightRadius = this.styles.borderBottomLeftRadius = CHECKBOX_BORDER_RADIUS;
|
||||
this.styles.borderTopRightRadius =
|
||||
this.styles.borderTopLeftRadius =
|
||||
this.styles.borderBottomRightRadius =
|
||||
this.styles.borderBottomLeftRadius =
|
||||
CHECKBOX_BORDER_RADIUS;
|
||||
break;
|
||||
case RADIO:
|
||||
this.styles.borderTopRightRadius = this.styles.borderTopLeftRadius = this.styles.borderBottomRightRadius = this.styles.borderBottomLeftRadius = RADIO_BORDER_RADIUS;
|
||||
this.styles.borderTopRightRadius =
|
||||
this.styles.borderTopLeftRadius =
|
||||
this.styles.borderBottomRightRadius =
|
||||
this.styles.borderBottomLeftRadius =
|
||||
RADIO_BORDER_RADIUS;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user