Commit Graph

1123 Commits

Author SHA1 Message Date
Yanzhen Yu
7d817be155 upgrade to rrweb-snapshot v1.0 2020-11-29 13:54:37 +08:00
Yanzhen Yu
924d2d9911 Release 1.0.0 2020-11-29 13:34:33 +08:00
Yanzhen Yu
852632656f refactoring public API 2020-11-29 13:22:01 +08:00
Lucky Feng
f9d8fb7844 style: delete a useless constant 2020-11-27 17:52:56 +08:00
Lucky Feng
96e4bfdddd fix: elements would lose some states like scroll position because of "virtual parent" optimization (#427)
* fix: elements would lose some state like scroll position because of "virtual parent" optimization

* refactor: the bugfix code

bug: elements would lose some state like scroll position because of "virtual parent" optimization

* fix: an error occured at applyMutation(remove nodes part)

error message:
Uncaught (in promise) DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node
2020-11-27 17:46:52 +08:00
Lucky Feng
658999c6e0 feat: add an option to determine whether to pause CSS animation when playback is paused (#428)
set pauseAnimation to true by default
2020-11-27 16:16:18 +08:00
Lucky Feng
8f3086c18c fix: applyScroll function doesn't work in sync mode(play at a specific time) (#426)
applyScroll function should be called after all of new nodes mounted on dom
2020-11-26 13:40:57 +08:00
Eoghan Murray
facd6cc121 Ensure animations don't continue playing when we've paused playback (#417) 2020-11-25 23:20:04 +08:00
Yanzhen Yu
555398d3f5 close #38, update data uri regexp 2020-11-21 11:05:08 +08:00
Yanzhen Yu
da182f4927 fix lint 2020-11-21 11:03:43 +08:00
Yanzhen Yu
e75277c917 update link style 2020-11-19 16:46:06 +08:00
Yanzhen Yu
6c4f10e4e7 update docs 2020-11-19 16:42:10 +08:00
Yaozu Lv
a2cd3e2da0 Add record option maskInputFn for custom mask input function (#409) 2020-11-15 16:39:17 +08:00
Eoghan Murray
5c9919e481 Allow .on to be chained directly after the constructor so that event handling for the first full snapshot can be added straight after constructor. See #216 (#416) 2020-11-15 16:37:39 +08:00
Yanzhen Yu
284fbcc9e6 add link to rrvideo 2020-11-15 16:04:04 +08:00
Yanzhen Yu
918153c89e Release 0.6.5 2020-11-15 14:43:54 +08:00
Yanzhen Yu
79a8198c03 limit max scale to 1 2020-11-15 14:42:23 +08:00
踩坑小王子
db5b1fe8ac feat: enable to change the config of mouse tail while playing (#410)
fix a potential bug: handleResize function might change the display style of mouseTail
2020-11-10 10:56:21 +08:00
Yanzhen Yu
9434db4a6b Release 0.6.4 2020-10-26 23:36:21 +08:00
Yanzhen Yu
e8dc87add1 upgrade rrweb 2020-10-26 23:35:40 +08:00
Yanzhen Yu
476ae33d7a Release 0.9.9 2020-10-26 23:34:44 +08:00
Yanzhen Yu
c822e344a8 fix serializeNodeWithId args 2020-10-26 23:25:11 +08:00
Yanzhen Yu
fe36b17ebc Release 0.6.3 2020-10-24 23:15:02 +08:00
Yanzhen Yu
e192497b9a upgrade rrweb 2020-10-24 23:14:43 +08:00
yz-yu
55c5038528 Fix CI (#405)
* add yarn.lock to CI

* update travis config

* replace data url by placeholder in CI
2020-10-24 17:34:51 +08:00
Jonithan
c3c8ee3ac8 docs: add “重新制作快照” anchor link and "隐私" anchor link (#399) 2020-10-24 16:38:55 +08:00
Yanzhen Yu
7d5d003325 upgrade rrweb-snapshot 2020-10-24 16:36:06 +08:00
Yanzhen Yu
c489e06acf Release 0.8.4 2020-10-24 16:13:58 +08:00
Karl-Aksel Puulmann
036d3df692 Allow blocking elements by selector (#50)
* Extract method (isElementBlocked) and add tests

* Add blockSelector argument to snapshot

If blockSelector is passed, it will be matched against the element.

Reasoning: Mutating class names can get messy, so providing another hook
helps keep code clean by using data-attributes instead.
2020-10-24 16:11:39 +08:00
Eoghan Murray
14bdd67459 Add ability to reset the mapping id, to facilitate destructor in rrweb (rrwebRecord.stop) (#49) 2020-10-24 16:10:51 +08:00
Yanzhen Yu
6cef61882e optimize the append queue algorithm
Loop the append queue has been proved to be very inefficient, and
some times lead to N^2 time complexity.

Especially when some abnormal data could not be appended into the
real DOM, will make a dead loop.

Previously we use a 5000ms time out to handle this, which is not
user-friendly and not explicitly.

In this patch, we transform the queue into a tree data structure,
which reflects the layout of real DOM. With the tree data structure,
we can find whether there are dangling nodes that need to be dropped.
Also, the iteration will be much more efficient.

There is still a 500ms time out to avoid a dead loop, but should not
be called in expected scenarios.
2020-10-24 15:35:02 +08:00
Yanzhen Yu
0e63852bbc Release 0.9.8 2020-10-23 13:49:37 +08:00
Yanzhen Yu
7c04765752 ignore removed move set 2020-10-23 13:40:13 +08:00
Justin Halsall
07ff4db2a6 Add support for StylesheetRule in document fragment (#293)
* add failing test

* add stylesheet to dom to manipulate the rules

* cleanup
2020-10-17 16:37:32 +08:00
Eoghan Murray
b3e7d5a476 Prefer a map and a join as feel it's easier to understand, and I found a case in the wild where Array.prototype.reduce was overwritten (which admittedly is also a danger with map) (#52) 2020-10-15 13:14:57 +08:00
Karl-Aksel Puulmann
ea0ac76418 Update rrwebPlayer types (#46)
Without this change, the following fails to compile in typescript:

```js
new rrwebPlayer({
                target: document.body,
                props: {
                    width: 900,
                    events,
                    autoPlay: true,
                },
            })
```
2020-10-10 09:05:10 +08:00
Eoghan Murray
665567119d Suspend mutations during snapshot (#385)
* The `processMutations` function needed to be bound to the `mutationBuffer` object, as otherwise `this` referred to the `MutationObserver` object itself

* Enable external pausing of mutation buffer emissions

 - no automatic pausing based on e.g. pageVisibility yet, assuming such a thing is desirable
   https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
 - user code has to call new API method `freezePage` e.g. when page is hidden or after a timeout
 - automatically unpauses when the next user initiated event occurs
   (am assuming everything that isn't a mutation event counts as 'user initiated'
   either way think this is the correct thing to do until I see a counterexample
   of an event that shouldn't cause the mutations to be unbufferred)

* Avoid a build up of duplicate `adds` by delaying pushing to adds until emission time

* Need to export freezePage in order to use it from rrweb.min.js

* Add a test to check if mutations can be turned off with the `freezePage` method

* I noticed out of order ids (in terms of a DOM walk) in a FullSnapshot.  A DOM mutation was executed against the mirror asynchronously before it could be fully processed. This would lead to a situation in replay where a mutation is executed against a DOM tree that already has the mutation applied. This changeset fixes that by freezing any mutations until the snapshot is completed.

* Remove attribute modifications from a mutation event that were incorrect in that they were repeating the attributes of those nodes present in the 'adds' array of the same mutation

* I've manually verified that this empty text node is actually removed when the dropdown is opened:

document.getElementById('select2-results-1').childNodes
NodeList(2) [li.select2-results-dept-0.select2-result.select2-result-selectable.select2-highlighted, li.select2-results-dept-0.select2-result.select2-result-selectable]

and also that it is not reinstated after the second `await page.click('.select2-container');`

* Rearrange when removal happens in order to satisfy tests. I'm also reverting a recent test change (2600fe7) so that tests pass after this rearrangement; I believe that test change to still be the correct way of doing it, but maybe it is not strictly important that there are extra mutations on attributes of just added nodes

* As mutations are now paused during FullSnapshots, we shouldn't be counting this as a 'user emission'. We automatically emit mutations after unpause anyway ('emit anything queued up now')

* Ensure that we clear arrays before emitting, as the mutation could have the side effect of triggering a FullSnapshot (checkoutEveryNth), which would otherwise re-trigger emission of same mutation (through the new pause/fullsnapshot/mutationemit/unpause process)

* Don't let the programattic pausing during TakeFullSnapshot accidentally unpause a manual call to the API method `freezePage`

* Rename paused -> frozen for consistency and change to use getter/setter access methods
2020-10-04 20:54:10 +08:00
Yanzhen Yu
1251091d64 Release 0.8.3 2020-10-04 20:49:17 +08:00
Yanzhen Yu
57a124ff74 update typings 2020-10-04 20:48:51 +08:00
Eoghan Murray
8b0bc7c505 Preserve url quotes (#47)
* Preserve original quotes when rewriting CSS url() paths - important for inline SVG files which often have spaces

* Found an example in the wild with the 'charset=' part left off. This is supported by https://css-tricks.com/lodge/svg/09-svg-data-uris/ ... not sure why we aren't just testing for the 'data:' prefix here?

* Not sure why this is now coming back with a double quote after recent changes here; it's supposed to preserve the single quote from style.css??
2020-10-04 20:46:57 +08:00
yz-yu
3e18d20418 fix docs link (#386) 2020-10-01 22:19:04 +08:00
yz-yu
c0f8902410 Update zh_CN Docs (#384)
* update zh_CN guide, with latest API and options

* add receipes

* update receipes and guide

* update #329 add links to README
2020-10-01 22:12:54 +08:00
Yanzhen Yu
4cff4225cf Release 0.6.2 2020-10-01 22:04:24 +08:00
Yanzhen Yu
459f8249b6 export speed as props 2020-10-01 15:24:57 +08:00
Yanzhen Yu
1277dbd1df by pass all options to rrweb 2020-10-01 14:17:46 +08:00
Yanzhen Yu
9bdf9692db Release 0.6.1 2020-09-24 10:28:58 +08:00
Yanzhen Yu
325ca4cc69 expose trigger resize method 2020-09-24 10:28:35 +08:00
Yanzhen Yu
9488deb6d5 Release 0.9.7 2020-09-23 19:18:21 +08:00
Yanzhen Yu
c5e8d0bee9 fix queue and use a unsafe but performant checker 2020-09-23 19:15:10 +08:00
Yanzhen Yu
183daf34b0 Release 0.6.0 2020-09-23 16:08:23 +08:00