-
-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Alignment Issue : When whole text is selected it always shows left aligned #3171
Comments
I think this issue is caused by isCollapsed function which is using range.isCollapsed from slate
the problem is arising because our anchor and focus are equal but we have different offsets which is making isCollapsed false |
Yes, for the sake of reducing the complexity of the work, we haven't considered the expanded situation temporarily. |
@felixfeng33 can i create a PR for this fix by adding below function const isCollapsedInternalFunction = (range?: Range | null) => {
// Early return for null or undefined range
if (!range ||!range.anchor ||!range.focus) {
return false;
}
// Destructure the anchor and focus properties for easier access
const { anchor, focus } = range;
const { anchor, focus } = range;
// Check if both anchor and focus exist and have the same path coordinates
if (anchor && focus && anchor.path.length > 0 && focus.path.length > 0) {
return anchor.path[0] === focus.path[0] && anchor.path[1] === focus.path[1];
}
}; |
I think you can check the parent node props in the else statement. |
yes you can do cross selection in blocks as alignment is always block level I have a question if a selection has first block center next block left what should be the overall alignment to be shown on top in mostly cases we show first block selection details can we do the same here |
It's better the overall alignment is none. |
I think we had better do some thing here since it's have more readability· |
We should check the value of all selected blocks using |
Hey @zbeyens pls look into the PR that i opened regarding above bug |
Description
Alignment Issue : When whole text is selected it always shows left aligned
Steps to Reproduce
go to https://platejs.org/ and try selecting whole sentence which is center aligned and when you select all it shows left aligned
Screen.Recording.2024-05-06.at.12.17.37.PM.mov
Funding
The text was updated successfully, but these errors were encountered: