Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Set redacted style on replayer side
  • Loading branch information
John Pham committed Mar 25, 2021
commit 9ab9619d93129b4660d3ac600b314745c2bf8c29
4 changes: 2 additions & 2 deletions src/record/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ function record<T = eventWithTime>(
emit,
checkoutEveryNms,
checkoutEveryNth,
blockClass = 'rr-block',
blockClass = 'highlight-block',
blockSelector = null,
ignoreClass = 'rr-ignore',
ignoreClass = 'highlight-ignore',
inlineStylesheet = true,
maskAllInputs,
maskInputOptions: _maskInputOptions,
Expand Down
3 changes: 2 additions & 1 deletion src/replay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class Replayer {
skipInactive: false,
showWarning: true,
showDebug: false,
blockClass: 'rr-block',
blockClass: 'highlight-block',
liveMode: false,
insertStyleRules: [],
triggerFocus: true,
Expand Down Expand Up @@ -641,6 +641,7 @@ export class Replayer {
const styleEl = document.createElement('style');
const { documentElement, head } = this.iframe.contentDocument;
documentElement!.insertBefore(styleEl, head);
console.log(this.config.blockClass);
const injectStylesRules = getInjectStyleRules(
this.config.blockClass,
).concat(this.config.insertStyleRules);
Expand Down
2 changes: 2 additions & 0 deletions src/replay/styles/inject-style.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const rules: (blockClass: string) => string[] = (blockClass: string) => [
`iframe, .${blockClass} { background: #ccc }`,
'noscript { display: none !important; }',
`.${blockClass} { background: black; border-radius: 5px; }`,
`.${blockClass}:hover::after {content: 'Redacted'; color: white; text-align: center; width: 100%; display: block;}`,
];

export default rules;
7 changes: 0 additions & 7 deletions src/snapshot/rebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,6 @@ function buildNode(
if (name === 'rr_height') {
(node as HTMLElement).style.height = value;
}
/** Highlight Code Start */
// rr_width and rr_height are only set if the node is blocked/censored.
if (name === 'rr_width' || name === 'rr_height') {
(node as HTMLElement).style.backgroundColor = '#000000';
(node as HTMLElement).style.borderRadius = '5px';
}
/** Highlight Code End */
if (name === 'rr_mediaState') {
switch (value) {
case 'played':
Expand Down
5 changes: 4 additions & 1 deletion src/snapshot/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ function serializeNode(
if (parentTagName === 'SCRIPT') {
textContent = 'SCRIPT_PLACEHOLDER';
textContentHandled = true;
} else if (parentTagName === 'NOSCRIPT') {
textContent = '';
textContentHandled = true;
}

// Randomizes the text content to a string of the same length.
Expand Down Expand Up @@ -616,7 +619,7 @@ function snapshot(
},
): [serializedNodeWithId | null, idNodeMap] {
const {
blockClass = 'rr-block',
blockClass = 'highlight-block',
inlineStylesheet = true,
recordCanvas = false,
blockSelector = null,
Expand Down
2 changes: 1 addition & 1 deletion test/html/block.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<title>Block record</title>
</head>
<body>
<div class="rr-block" style="width: 50px; height: 50px;">
<div class="highlight-block" style="width: 50px; height: 50px">
<input type="text" /> <span id="text"></span>
</div>
</body>
Expand Down