-
Notifications
You must be signed in to change notification settings - Fork 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
Image Editor: Add Inline Edit Button #14143
Conversation
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.
Context -- I started working on this independently from you in #14086 before I realized your PR existed, sorry I missed your comment!
@@ -68,6 +68,7 @@ function wpEditImage( editor ) { | |||
'wp_img_alignnone', | |||
'wpcom_img_size_decrease', | |||
'wpcom_img_size_increase', | |||
'wp_img_edit', // See plugins/media |
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'd move this down 2 lines so the button appears next to the remove
/ delete
button
editor.addButton( 'wp_img_edit', { | ||
tooltip: i18n.translate( 'Edit', { context: 'verb' } ), | ||
icon: 'dashicon dashicons-edit', | ||
onclick: function() { |
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'd add in a line:
classes: 'toolbar-segment-start',
...such that the Edit
button is "grouped" with the next button (as I mention in the other inline comment, I feel it's conceptually similar to Delete
).
@msmithgu do you mind rebasing with master? There appear to be many unrelated commits in this branch. |
This reverts commit 38a8ded.
5e889c8
to
bf9a929
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.
We're very close, I retested edit/edit vs edit/delete behavior.
I did notice an extra case, when the edited image is still uploading to the server, which creates a duplicate image in the dom.
To Reproduce:
- Insert an image
- Select it, click the edit pencil on the toolbar
- Click Edit, then edit the photo
- Make some changes in the image editor
- Save the image
- Before the image finishes updating, update the new value. (It may help to throttle your internet connection in dev tools).
|
||
// If we were pasting into an img, remove it so it's replaced | ||
// with the new one. | ||
if ( node.nodeName === 'IMG' || node.nodeName === 'DT' ) { |
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.
Interesting that this wraps the node with a <DT />
after editing an image.
visible: true, | ||
labels: { | ||
confirm: i18n.translate( 'Update', { context: 'verb' } ) | ||
} |
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.
We can set the view with an options object:
renderModal(
{
visible: true,
labels: {
confirm: i18n.translate( 'Update', { context: 'verb' } )
}
},
{
view: ModalViews.DETAIL
}
);
@msmithgu before merging I would recommend updating behavior to open in the detail view. We can probably open up another issue for the dup case for images that are still loading. |
I added #14233 so we can tackle that next |
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.
Let's
Regarding issue #8306 .
Clicking on an image in the post editor brings up an in-context menu:

This PR adds an edit icon (the pencil) to the in-context menu:

When we click on that the inline edit button, it brings up the gallery with the clicked on image pre-selected. I found when testing out usability that being able to swap the image with others was desirable and less confusing.
This completes #8306 .
To Test