-
Notifications
You must be signed in to change notification settings - Fork 4k
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
RichTextValue: Typescript Adjustment #54002
Conversation
@noahtallen Saw you working on this in #49651. Was there a reason why I threw in another small JSDoc type error I had noticed while using this package as well. |
I think I just copy/pasted the |
Really appreciate the quick response @noahtallen 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I triggered the e2e tests again -- should be unrelated. Otherwise this is looking good! I'll merge once the checks pass.
Thanks! |
start: number | undefined; | ||
end: number | undefined; | ||
start: number; | ||
end: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has this been removed? These are optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are they optional properties i.e. a typescript start?: number
Or optionally set as undefined? Would you mind linking code where this would be set as undefined? My bad I must have totally missed it. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably both. A rich text instance may not have selection
gutenberg/packages/block-editor/src/components/rich-text/index.js
Lines 149 to 150 in f706c86
selectionStart: isSelected ? selectionStart.offset : undefined, | |
selectionEnd: isSelected ? selectionEnd.offset : undefined, |
const index = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O boy, looks like my eyes deceived me. Mind explaining to me the context for which you'd end up with an undefined value? In my usage I have never been able to get an undefined value appear when there is no selection or when there is. Attaching a short video:
Screen_Recording_2023-08-30_at_3.52.39_PM.mov
Would you like me to push another revert commit to put back the optional undefined? Are you good with the other change that was in this commit (the null value for className)?
While I have you attention, through for the wrong reason sadly, has there been any discussion about porting this package to typescript? If so, was there any blockers etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ellatrix bumping this. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All rich text instances have an undefined selection unless it is selected. So if you select one paragraph, all the other paragraph's rich text instances have an undefined selection except for the selected paragraph's.
@noahtallen I pulled in the updated types today. I believe |
What?
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast