Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e9c878

Browse files
Trevor davis/another inline toolbar positioning fix (draft-js-plugins#2787)
* inline toolbar plugin should account for ancestor scrolltop * change log * change log link to issue * update version * account for scroll offsets of 0 in parent elements of DraftEditor-root Co-authored-by: fxOne <[email protected]>
1 parent 10bdfef commit 0e9c878

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

packages/inline-toolbar/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55

66
## To be released
77

8-
#4.1.4
8+
## 4.1.5
9+
10+
- Account for scroll offsets of 0 in parent elements of DraftEditor-root
11+
12+
## 4.1.4
913

1014
- Account for scroll offsets in parent elements of DraftEditor-root [#2766](https://github.com/draft-js-plugins/draft-js-plugins/issues/2766)
1115

packages/inline-toolbar/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@draft-js-plugins/inline-toolbar",
3-
"version": "4.1.4",
3+
"version": "4.1.5",
44
"sideEffects": [
55
"*.css"
66
],

packages/inline-toolbar/src/components/Toolbar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ export default class Toolbar extends React.Component<ToolbarProps> {
115115
// Account for scrollTop of all ancestors
116116
let scrollOffset = 0;
117117
let ancestorNode = editorRoot.parentNode as HTMLElement;
118-
while (ancestorNode !== null && !! ancestorNode.scrollTop) {
119-
scrollOffset += ancestorNode.scrollTop;
118+
while (ancestorNode !== null) {
119+
scrollOffset += ancestorNode.scrollTop ?? 0;
120120
ancestorNode = ancestorNode.parentNode as HTMLElement;
121121
}
122122

0 commit comments

Comments
 (0)