nested record iframe (#63)

* pick nested branch

* iframe snapshot

* temp: add bundle file to git

* revert ignore file

* refactor iframe impl
1. do callback one iframe is loaded, let rrweb handle the rest
2. handle iframe as normal element in rebuild

* rename hook function
This commit is contained in:
yz-yu
2021-02-07 14:00:22 +08:00
committed by GitHub
parent a3ff5e5ea8
commit 98aa732d17
11 changed files with 343 additions and 7 deletions

View File

@@ -5,10 +5,12 @@ export declare function buildNodeWithSN(n: serializedNodeWithId, options: {
map: idNodeMap;
skipChild?: boolean;
hackCss: boolean;
afterAppend?: (n: INode) => unknown;
}): INode | null;
declare function rebuild(n: serializedNodeWithId, options: {
doc: Document;
onVisit?: (node: INode) => unknown;
hackCss?: boolean;
afterAppend?: (n: INode) => unknown;
}): [Node | null, idNodeMap];
export default rebuild;

View File

@@ -15,6 +15,8 @@ export declare function serializeNodeWithId(n: Node | INode, options: {
slimDOMOptions: SlimDOMOptions;
recordCanvas?: boolean;
preserveWhiteSpace?: boolean;
onSerialize?: (n: INode) => unknown;
onIframeLoad?: (iframeINode: INode, node: serializedNodeWithId) => unknown;
}): serializedNodeWithId | null;
declare function snapshot(n: Document, options?: {
blockClass?: string | RegExp;
@@ -23,6 +25,9 @@ declare function snapshot(n: Document, options?: {
slimDOM?: boolean | SlimDOMOptions;
recordCanvas?: boolean;
blockSelector?: string | null;
preserveWhiteSpace?: boolean;
onSerialize?: (n: INode) => unknown;
onIframeLoad?: (iframeINode: INode, node: serializedNodeWithId) => unknown;
}): [serializedNodeWithId | null, idNodeMap];
export declare function visitSnapshot(node: serializedNodeWithId, onVisit: (node: serializedNodeWithId) => unknown): void;
export declare function cleanupSnapshot(): void;

4
typings/types.d.ts vendored
View File

@@ -40,7 +40,9 @@ export declare type commentNode = {
type: NodeType.Comment;
textContent: string;
};
export declare type serializedNode = documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode;
export declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
rootId?: number;
};
export declare type serializedNodeWithId = serializedNode & {
id: number;
};