-
Notifications
You must be signed in to change notification settings - Fork 116
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
refactor: hyperlink extract common logic [TOL-1637] #1568
Conversation
6f04ccb
to
e933820
Compare
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.
Wondering if we can also have a base component
?
So we only need to provide the handleEditLink, handleRemoveLink and the toooltipContent and the children to it? 🤔
I tried something like that, but we are calling different hooks in all those components, the types are also different and there are other quirks (different data attributes, different forma components (link vs text), etc) It wasn't very readable in the end so I left it the way it is now |
import { useSdkContext } from '../../../SdkProvider'; | ||
|
||
export function useHyperlinkCommon(element) { | ||
const editor = useContentfulEditor(); |
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.
nit: I'm not sure I see the benefits for editor
and sdk
feels like adding a layer of complexity rather than removing. isLinkFocused
and pathToElement
make sense
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.
Please feel free to ignore though just my opinion
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.
Hmm yes not sure, I think we need editor
to calculate pathToElement
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.
Ah right okay then
No description provided.