Enhancement/add link textbox - #106
Conversation
| title="Link" | ||
| onClose={onClose} | ||
| cancel={{ text: 'Edit', onClick: () => onEdit() }} | ||
| extraTrailingButtons={ |
There was a problem hiding this comment.
Can we use the confirm button instead of a new trailing one? Or swap the remove and edit buttons
There was a problem hiding this comment.
The issue here is that I want the remove button to have a different style than the confirmation button. In case I swap them the remove button will be with primary color.
There was a problem hiding this comment.
Yes, but we can pass it additional styling with the confirm={{ ... }} attribute
There was a problem hiding this comment.
Oh, yes. Okay I will change it, but should I also remove the different positioning of the additional buttons, or leave it?
There was a problem hiding this comment.
I think we don't need them since the extra buttons were enough
There was a problem hiding this comment.
I mean yes, we should remove the different positioning and bring back the single extraButtons prop
|
|
||
| const TRAILING_EMPTY_PARAGRAPHS_REGEX = /(<p>(\s|<br\s*\/?>)*<\/p>)+$/gi | ||
|
|
||
| interface LinkModalState { |
There was a problem hiding this comment.
I saw this interface twice, and some duplicated logic at places. Is there a way to remove the duplication?
There was a problem hiding this comment.
I think there will be a way, but I can't come up with a scenario where I can devise a good abstraction.
There was a problem hiding this comment.
The easiest way to do it is to extract a hook useTextboxLink, which receives the editorAPI, and isEditMode, internally handles the LinkModalState and returns the modal UI as a single JSX variable, and also returns the addLink function. See client/src/components/item-picker/use-item-picker.tsx, should have similarities with it...
No description provided.