-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
URL Input: Use Popover instead of custom positionning and custom modals #6911
Conversation
8c2f92e
to
49e1997
Compare
Good catch, I'll take a look |
Actually, scratch that. I don't know what it was that I was seeing, but a hard reload made this work. Stellar work! Can you move the popover upwards about 10px? that would make it feel more connected with the link. |
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.
After the latest fix, this is cool from a design perspective.
editor/components/rich-text/index.js
Outdated
|
||
return { | ||
top: position.top - containerPosition.top + ( position.height ) + toolbarOffset.top, | ||
left: position.left - containerPosition.left + ( position.width / 2 ) + toolbarOffset.left, | ||
top: position.top - containerPosition.top + ( position.height ), |
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.
Tiny thing: unsure why there are brackets here, but they were here before.
Seeing the following error when adding the target attribute, and I don't see this error in master?
|
e33d232
to
12d88f0
Compare
@iseulde I'm seeing the same issue on master |
12d88f0
to
491828d
Compare
There's an issue for that: #6156 |
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.
@@ -98,6 +100,7 @@ class FormatToolbar extends Component { | |||
settingsVisible: false, | |||
opensInNewWindow: !! nextProps.formats.link && !! nextProps.formats.link.target, | |||
linkValue: '', | |||
popoverId: this.state.popoverId + 1, |
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.
Could we re-use this.props.selectedNodeId
instead of introducing more state? Note that RichText
increments this in much the same way.
https://github.com/WordPress/gutenberg/blob/master/editor/components/rich-text/index.js#L708
Thanks for the review, I didn't notice the selectedNodeId
. Good advice 👍👍
@@ -219,6 +220,7 @@ class Popover extends Component { | |||
'is-' + xAxis, | |||
{ | |||
'is-mobile': isMobile, | |||
'no-arrow': noArrow, |
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.
This is not very consistent with modifier class naming which are otherwise boolean-ish. I might have preferred something like has-no-arrow
or is-without-arrow
or is-no-arrow
.
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 like how you see a comment from Andrew from time to time on old PRs :P
Anyway, I just pushed a fix to master (accidentally, I thought I was on a branch 😬 )
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.
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 enjoy to surf the git blame
😄
This PR updates the URL Input and the format toolbar to use the
Popover
component to display the link modal. The Popover contain behavior to adapt the width and the position to the available space which will fix a lot of issues we have with link modals on mobile.Testing instructions
closes #3941 #4447 #6183 #6393 #6810