-
-
Notifications
You must be signed in to change notification settings - Fork 757
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9df3506
commit b4a0002
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
'@udecode/plate-selection': patch | ||
--- | ||
|
||
Remove the Div rendered above the editor. | ||
|
||
This div is to solve the issue of the browser's default scrolling behavior being too fast. | ||
|
||
However, it caused some other issues and complicated configurations, such as being unable to focus on the editor when clicking the padding-right area. | ||
|
||
If you think this issue is more important, you refer to the flowing code. | ||
```tsx | ||
BlockSelectionPlugin.configure({ | ||
render: { | ||
aboveEditable: ({ children }) => { | ||
return ( <div style={{ position: 'relative', width: '100%' }}> | ||
{/* | ||
*select text then move cursor to the very bottom will trigger the default browser behavior | ||
*this div is a workaround to prevent the default browser behavior (set userSelect: none) | ||
*Make sure the div with is the same with the editor's padding-right | ||
*/} | ||
|
||
{/* TODO: click to focus the node */} | ||
<div | ||
style={{ | ||
height: '100%', | ||
position: 'absolute', | ||
right: 0, | ||
top: 0, | ||
userSelect: 'none', | ||
width: editorPaddingRight ?? 'max(5%, 24px)', | ||
zIndex: 1, | ||
}} | ||
data-plate-selectable | ||
/> | ||
{children} | ||
</div>) | ||
}, | ||
}, | ||
}), | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters