File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @print-one/grapesjs" ,
3
3
"description" : " Free and Open Source Web Builder Framework" ,
4
- "version" : " 0.21.19 " ,
4
+ "version" : " 0.21.20 " ,
5
5
"author" : " Print.one" ,
6
6
"license" : " BSD-3-Clause" ,
7
7
"homepage" : " http://grapesjs.com" ,
Original file line number Diff line number Diff line change @@ -153,11 +153,17 @@ export const isCommentNode = (el?: Node): el is Comment => el?.nodeType === Node
153
153
export const isTaggableNode = ( el ?: Node ) => el && ! isTextNode ( el ) && ! isCommentNode ( el ) ;
154
154
155
155
export const getBoundingRect = ( el : HTMLElement ) => {
156
- const top = el . offsetTop ;
157
- const left = el . offsetLeft ;
156
+ let top = el . offsetTop ;
157
+ let left = el . offsetLeft ;
158
158
const width = el . offsetWidth ;
159
159
const height = el . offsetHeight ;
160
160
161
+ let currentEl = el ;
162
+ while ( ( currentEl = currentEl . offsetParent as HTMLElement ) ) {
163
+ top += currentEl . offsetTop ;
164
+ left += currentEl . offsetLeft ;
165
+ }
166
+
161
167
return {
162
168
top,
163
169
left,
@@ -168,7 +174,7 @@ export const getBoundingRect = (el: HTMLElement) => {
168
174
x : left ,
169
175
y : top ,
170
176
} ;
171
- }
177
+ } ;
172
178
173
179
/**
174
180
* Get DOMRect of the element.
You can’t perform that action at this time.
0 commit comments