-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Feat(blocks): move blocks #18852
Feat(blocks): move blocks #18852
Conversation
… is not a number but number[], wrapped renderElement with Dnd component to have ability to move blocks around in editor
…chy of nodes, cmd/ctrl + shift + up/down arrow to move blocks around using keyboard, set live text on moving blocks for accessibility
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.
You've changed this hook and you've not updated the contributor documentation.
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.
Super excited to try it but I have a TS error when building strapi. It looks like it happens in the github actions too
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/hooks/useDragAndDrop.js
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/hooks/useDragAndDrop.js
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/hooks/useDragAndDrop.js
Outdated
Show resolved
Hide resolved
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 think your comments in the drag and drop hook need to be more & clearer because "node hierarchy" in the context of that hook doesn't mean much...
Let's continue to discuss the API changes there too 🙂
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksEditor.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/hooks/useDragAndDrop.js
Outdated
Show resolved
Hide resolved
Size Change: +2.06 kB (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
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.
Good idea to use the context 👍
I still need to test it
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksEditor.tsx
Outdated
Show resolved
Hide resolved
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.
The handle alignment is still odd, but I don't have reordering bugs anymore 💥
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.
Just 2 things:
- I think we need handle margin top for quotes too, it's not aligned with the first line of content
- I'm noticing some input lag now. Do you know if there's anything in the last few commits that could have impacted performance?
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksEditor.tsx
Outdated
Show resolved
Hide resolved
docs/docs/docs/01-core/content-manager/hooks/use-drag-and-drop.mdx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/Blocks/Heading.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/BlocksInput/BlocksContent.tsx
Outdated
Show resolved
Hide resolved
You're using a lot of props in styled-components, i'd see if it's recreating too many styles when you're dragging. I've had this before when I was passing |
Interesting @joshuaellis thanks. But do you think it would impact the lag when I'm just typing text? Not dragging blocks |
Looking at the things we've changed here, I wouldn't rule it out and still investigate it because it's easy to see – iirc in the devtools the But you're totally right to flag input lag, can't be serving users a laggy blocks editor lol |
@joshuaellis @remidej thanks for your inputs, I checked lagging issue but to me it doesn't seem to be blocking, as its very barely noticeable. There is no issue of styles applied as while typing nothing is getting updated except the element itself. |
Does this feature need re-QA'ing before merge since we've had lots of changes since the last one @madhurisandbhor? |
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 can't manage to reproduce the lag I had yesterday, so I think we can move on 👍
packages/core/admin/admin/src/content-manager/components/RepeatableComponent.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/components/DynamicZone/DynamicComponent.tsx
Outdated
Show resolved
Hide resolved
@joshuaellis I think me and Rémi did most of testing of the bugs reported so not really required, it's all good 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.
Unfortunately I'm seeing the input lag again (not sure why I couldn't on Friday). This time I made a Loom recording to show it better: https://www.loom.com/share/f264942f381040aaa75e95003ec23ffb?sid=1f09c45c-1caa-4312-97f1-b7378818d82f
I think this is something we need to fix. @joshuaellis would you maybe have some ideas?
@remidej thanks for the recording, But this is clearly somthing else as long_text, rich_text also have the same issue while typing, I am not able check profiler as its also getting stuck on my device recording this issue. |
@madhurisandbhor you're right I'm getting it on rich text too, even when I delete the blocks field. So it looks like the issue could come from something else in the develop branch, which would explain why it appeared suddenly in your branch. I'll check after lunch if it happens on main too to be sure. |
So actually the bad performance only happens with the |
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.
LGTM :)
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.
Great work @madhurisandbhor you overcame a lot of challenges in this feature 👏🏼
What does it do?
useDragAndDrop
hook Changes :Array<number>
, to support nested list items path, for eg: [1, 0] or for list-item path [1, 0, 0] and handled it separately.How to test it?
On hover user should be able to see drag option and be able to drag block and list-items. While dragging user will see a blue line drop-placeholder on droppable area. On drop, item will be moved to respective position specified by drop placeholder.
Design
Related issue(s)/PR(s)
Previous PR : #18690