add the inline stylesheet option when recording
This commit is contained in:
@@ -59,7 +59,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/smoothscroll-polyfill": "^0.3.0",
|
"@types/smoothscroll-polyfill": "^0.3.0",
|
||||||
"mitt": "^1.1.3",
|
"mitt": "^1.1.3",
|
||||||
"rrweb-snapshot": "^0.7.9",
|
"rrweb-snapshot": "^0.7.10",
|
||||||
"smoothscroll-polyfill": "^0.4.3"
|
"smoothscroll-polyfill": "^0.4.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ function record(options: recordOptions = {}): listenerHandler | undefined {
|
|||||||
checkoutEveryNth,
|
checkoutEveryNth,
|
||||||
blockClass = 'rr-block',
|
blockClass = 'rr-block',
|
||||||
ignoreClass = 'rr-ignore',
|
ignoreClass = 'rr-ignore',
|
||||||
|
inlineStylesheet = true,
|
||||||
} = options;
|
} = options;
|
||||||
// runtime checks for user options
|
// runtime checks for user options
|
||||||
if (!emit) {
|
if (!emit) {
|
||||||
@@ -62,7 +63,7 @@ function record(options: recordOptions = {}): listenerHandler | undefined {
|
|||||||
}),
|
}),
|
||||||
isCheckout,
|
isCheckout,
|
||||||
);
|
);
|
||||||
const [node, idNodeMap] = snapshot(document, blockClass);
|
const [node, idNodeMap] = snapshot(document, blockClass, inlineStylesheet);
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return console.warn('Failed to snapshot the document');
|
return console.warn('Failed to snapshot the document');
|
||||||
}
|
}
|
||||||
@@ -160,6 +161,7 @@ function record(options: recordOptions = {}): listenerHandler | undefined {
|
|||||||
),
|
),
|
||||||
blockClass,
|
blockClass,
|
||||||
ignoreClass,
|
ignoreClass,
|
||||||
|
inlineStylesheet,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import { deepDelete, isParentRemoved, isParentDropped } from './collection';
|
|||||||
function initMutationObserver(
|
function initMutationObserver(
|
||||||
cb: mutationCallBack,
|
cb: mutationCallBack,
|
||||||
blockClass: blockClass,
|
blockClass: blockClass,
|
||||||
|
inlineStylesheet: boolean,
|
||||||
): MutationObserver {
|
): MutationObserver {
|
||||||
const observer = new MutationObserver(mutations => {
|
const observer = new MutationObserver(mutations => {
|
||||||
const texts: textCursor[] = [];
|
const texts: textCursor[] = [];
|
||||||
@@ -407,7 +408,11 @@ function initInputObserver(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function initObservers(o: observerParam): listenerHandler {
|
export default function initObservers(o: observerParam): listenerHandler {
|
||||||
const mutationObserver = initMutationObserver(o.mutationCb, o.blockClass);
|
const mutationObserver = initMutationObserver(
|
||||||
|
o.mutationCb,
|
||||||
|
o.blockClass,
|
||||||
|
o.inlineStylesheet,
|
||||||
|
);
|
||||||
const mousemoveHandler = initMousemoveObserver(o.mousemoveCb);
|
const mousemoveHandler = initMousemoveObserver(o.mousemoveCb);
|
||||||
const mouseInteractionHandler = initMouseInteractionObserver(
|
const mouseInteractionHandler = initMouseInteractionObserver(
|
||||||
o.mouseInteractionCb,
|
o.mouseInteractionCb,
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
.replayer-wrapper {
|
.replayer-wrapper {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ export type recordOptions = {
|
|||||||
checkoutEveryNms?: number;
|
checkoutEveryNms?: number;
|
||||||
blockClass?: blockClass;
|
blockClass?: blockClass;
|
||||||
ignoreClass?: string;
|
ignoreClass?: string;
|
||||||
|
inlineStylesheet?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type observerParam = {
|
export type observerParam = {
|
||||||
@@ -117,6 +118,7 @@ export type observerParam = {
|
|||||||
inputCb: inputCallback;
|
inputCb: inputCallback;
|
||||||
blockClass: blockClass;
|
blockClass: blockClass;
|
||||||
ignoreClass: string;
|
ignoreClass: string;
|
||||||
|
inlineStylesheet: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type textCursor = {
|
export type textCursor = {
|
||||||
|
|||||||
Reference in New Issue
Block a user