Skip to content

Ensure draggable placeholder has same column structure as dragged item.#15

Merged
adamsilverstein merged 4 commits into
10up:developfrom
benhuson:placeholder-width-fix
Apr 6, 2018
Merged

Ensure draggable placeholder has same column structure as dragged item.#15
adamsilverstein merged 4 commits into
10up:developfrom
benhuson:placeholder-width-fix

Conversation

@benhuson

@benhuson benhuson commented Apr 3, 2018

Copy link
Copy Markdown
Contributor

Fresh PR for jakemgold/simple-page-ordering#7

This PR copies the column structure of the dragged item, empties all the cell content and uses that as the placeholder to ensure the table structure is preserved. This prevents the page jump for a much smoother experience.

Ryan Welcher and others added 3 commits March 6, 2018 11:52
Copies the column structure of the dragged item, empties all the cell content and uses that as the placeholder to ensure the table structure is preserved.

Signed-off-by: Ben Huson <ben@thewhiteroom.net>
@adamsilverstein

Copy link
Copy Markdown

This works well in my testing, going to review code and what it changes next.

Before:

After:

@adamsilverstein

Copy link
Copy Markdown

@benhuson Thanks for the PR! I tested this out and while it works well, it can be simplified a bit. The placeholder we are setting here is the string that jQuery UI uses for the blank space showing where you are about to drop the item you are dragging. By default this is constructed from the dragged element and this is what your code fixes. A simpler more solid/safer fix is just clearing the placeholder directly, see 8585aec - in my testing this has the exact same results as your code.

Can you please update your PR with this approach (or open it so I can) and I'll happily merge!

Thanks.

@adamsilverstein adamsilverstein left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change to ui.placeholder.empty();

…on when dragging.

Signed-off-by: Ben Huson <ben@thewhiteroom.net>
@benhuson

benhuson commented Apr 5, 2018

Copy link
Copy Markdown
Contributor Author

@adamsilverstein Works well for me - I've made the changes :)

@adamsilverstein

Copy link
Copy Markdown

Perfect, thanks @benhuson!

@adamsilverstein adamsilverstein merged commit 74e1a9b into 10up:develop Apr 6, 2018
helen added a commit that referenced this pull request Apr 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants