Skip to content

Commit 0b43df1

Browse files
committed
Update docs an prepare v3.4.5
1 parent ad2bb59 commit 0b43df1

6 files changed

Lines changed: 26 additions & 17 deletions

File tree

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,28 +170,34 @@ on the root node.
170170

171171
#### adjustClonedNode
172172

173-
A function that will be invoked on each node as they are cloned. Useful to adjust nodes in any way needed before the conversion.
174-
Note that this be invoked before the onclone callback.
175-
The handler gets the original node, the cloned node, and a boolean that says if we've cloned the children already (so you can handle either before or after)
173+
A function that will be invoked on each node as they are cloned. Useful to adjust nodes in
174+
any way needed before the conversion. Note that this be invoked before the onclone
175+
callback. The handler gets the original node, the cloned node, and a boolean that says if
176+
we've cloned the children already (so you can handle either before or after)
176177

177178
Sample use:
178179

179180
```const adjustClone = (node, clone, after) => {
180181
if (!after && clone.id === 'element') {
181182
clone.style.transform = 'translateY(100px)';
182183
}
183-
return clone;
184+
return clone;
184185
}
185186
```
186187

187-
const wrapper = document.getElementById('wrapper');
188-
const blob = domtoimage.toBlob(wrapper, { adjustClonedNode: adjustClone});
188+
const wrapper = document.getElementById('wrapper'); const blob =
189+
domtoimage.toBlob(wrapper, { adjustClonedNode: adjustClone});
189190

190191
#### onclone
191192

192-
A function taking the cloned and modified DOM node as argument. It allows to make final adjustements to the elements before rendering, on the whole clone, after all elements have been individually cloned. Note that this will be invoked after all the onclone callbacks have been fired.
193+
A function taking the cloned and modified DOM node as argument. It allows to make final
194+
adjustements to the elements before rendering, on the whole clone, after all elements have
195+
been individually cloned. Note that this will be invoked after all the onclone callbacks
196+
have been fired.
193197

194-
The cloned DOM might differ a lot from the original DOM, for example canvas will be replaced with image tags, some class might have changed, the style are inlined. It can be useful to log the clone to get a better senses of the transformations.
198+
The cloned DOM might differ a lot from the original DOM, for example canvas will be
199+
replaced with image tags, some class might have changed, the style are inlined. It can be
200+
useful to log the clone to get a better senses of the transformations.
195201

196202
#### bgcolor
197203

@@ -386,7 +392,8 @@ DOLCIMASCOLO (packaging), Zee (ZM) @zm-cttae (many major updates), Joshua Walsh
386392
@nstuyvesant (fixes), King Wang @eachmawzw (CORS image proxy), TMM Schmit @tmmschmit
387393
(useCredentialsFilters), Aravind @codesculpture (fix overridden props), Shi Wenyu @cWenyu
388394
(shadow slot fix), David Burns @davidburns573 and Yujia Cheng @YujiaCheng1996 (font copy
389-
optional), Julien Dorra @juliendorra (documentation)
395+
optional), Julien Dorra @juliendorra (documentation), Sean Zhang @SeanZhang-eaton (regex
396+
fixes)
390397

391398
## License
392399

dist/dom-to-image-more.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/dom-to-image-more.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dom-to-image-more",
3-
"version": "3.4.5-beta.0",
3+
"version": "3.4.5",
44
"description": "Generates an image from a DOM node using HTML5 canvas and SVG",
55
"main": "dist/dom-to-image-more.min.js",
66
"devDependencies": {
@@ -69,7 +69,8 @@
6969
"Shi Wenyu @cWenyu",
7070
"David Burns @davidburns573",
7171
"Yujia Cheng @YujiaCheng1996",
72-
"Julien Dorra @juliendorra"
72+
"Julien Dorra @juliendorra",
73+
"Sean Zhang @SeanZhang-eaton"
7374
],
7475
"license": "MIT",
7576
"bugs": {

src/dom-to-image-more.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,8 @@
664664

665665
function isInShadowRoot(value) {
666666
// not calling the method, getting the method
667-
if (value === null || value === undefined || value.getRootNode === undefined) return false;
667+
if (value === null || value === undefined || value.getRootNode === undefined)
668+
return false;
668669
return isShadowRoot(value.getRootNode());
669670
}
670671

@@ -950,7 +951,7 @@
950951
}
951952

952953
function escapeRegEx(string) {
953-
return string.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
954+
return string.replace(/([.*+?^${}()|[\]/\\])/g, '\\$1');
954955
}
955956

956957
function delay(ms) {

0 commit comments

Comments
 (0)