-
Notifications
You must be signed in to change notification settings - Fork 383
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
Page reordering from carousel #4048
Conversation
Fix clicking on page thumbs.
Follow-up issue for keyboard reordering only: https://github.com/ampproject/amp-wp/issues/4112 |
What is the expected behaviour when a page is reordered and the presses undo / redo? |
Good question. It should undo it :) Note: When testing, it looks like the history is generally not working properly, e.g. when adding a Page and clicking Undo, it removes the Page, however, clicking again adds the Page back again. Same with adding an element -- the first Undo removes it, the second adds it back again, instead of undoing a previous action. Try adding a few elements and then clicking Undo: It looks like the Undo/Redo should be looked at separately, I was (incorrectly) assuming that it already worked as expected with the actions in the reducer but looks like not. I think it would be good to create a separate issue for fixing History first. Thoughts? cc @barklund |
Yes, I think it actually broke all the way back in #3910 at some stage in the revisions of the PR. I have an idea about what the problem is (essentially that restore doesn't actually set the same objects, but clone at least one of them, which makes the history think that state hasn't be restored to an old state, it's just a new state). I think it's a fairly easy fix once looked at separately. |
There are now some merge conflicts after the page carousel revamp. |
Just pushed the change, the conflicts should be resolved now. |
Seems like the editor is crashing when adding new pages. Getting |
Thanks, @swissspidy! Should be fixed now. |
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'm LGTM otherwise, but please take a look at the display:inherit
issue. It's a bit dangerous IMHO.
if ( droppedEl.index !== arrangedIndex ) { | ||
const pageId = pages[ droppedEl.index ].id; | ||
arrangePage( { pageId, position: arrangedIndex } ); | ||
setCurrentPage( { pageId } ); |
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 know I'm a bit late with this question, but just to confirm: does reordering of pages ever change the currently shown page?
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.
Yes, currently it sets the page that was reordered as current. Perhaps it shouldn't be like this? That was an assumption but maybe the current page should not change? It made more sense without the page preview that we have now.
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.
Opened an issue to confirm this: GoogleForCreators/web-stories-wp#141
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.
Yeah. I tried both ways and either seem pretty logical to me. I think this is low priority and let's assign to Sam.
Summary
Fixes #3835
Checklist