-
Notifications
You must be signed in to change notification settings - Fork 66
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
Duplicate Block #15
Comments
I've got the basics down under the |
I am testing it out! Where is the UI for duplicating a block? Or is there some other way to test it? I am happy to give it a whirl |
Yeah it's a development branch so the Javascript needs building. I've attached the compiled versions here (just replace the Currently duplicating blocks won't duplicate their children, and it doesn't adhere to any max block rules either. I should point out the |
I've reworked my solution for duplicate blocks, and now it's essentially guaranteed to work with any field type. So look forward to this in |
Accidentally closed it... my bad. |
Cool! Want any testing? I tested the last version and definitely ran into some bugs... but figured you would find them too : ) |
I'd be happy for you to test :) Here's a copy of the latest changes. I hadn't had a chance to really test the older version you were testing, but I could imagine it would've had quite a few bugs. The newer version renders the duplicated block server-side, instead of trying to rebuild one on the client (which no doubt would be problematic for certain fields). I'm happy for you to report any bugs you find here. Thanks for helping out! |
Nice it works much better and actually preserves data which it wasn't before! The only bug I am noticing off the bat is that if I duplicate a top level block it is then moved into a child of the parent instead of creating another parent block - as a side effect of that behavior the sub blocks aren't being duplicated either. |
Ah yeah, that was a silly mistake. I've fixed it now. Here are the updated JS files. Child blocks not being duplicated is still something I'm working on. |
Child blocks now duplicate with blocks. Here's the updated compiled JS if you want to test it. |
Testing it now |
Ah I see, so it's not working with Matrix fields. Seems a little strange... I'm looking into it. Thanks! |
It would be a great piece of functionality if it was possible to duplicate an existing and already built block when adding content... with all of the sub fields in tact (although they don't necessarily have to be filled out, for my use case at least)
The text was updated successfully, but these errors were encountered: