Ensure new UDIs for blocks when copying #8842
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is when we do a full node copy (not a JS copy). When that occurs we need to re-generate new UDIs for each block in the block list value. We do this already for Nested Content too and just like NC this code will deal with nested block editors and even nested block editors within nested other complex editors that are in a block editor.
I've come to realize however that this is still problematic and it's the same for Nested Content. If there's a block editor, or nested content within another complex editor where the root editor is not itself then the GUIDs/UDIs won't be replaced in that nested json data. I'm not too worried about that scenario for now for the 8.7 release since that scenario probably won't exist very often but it's something to consider in the future.
All of this logic will need to be entirely deleted and/or refactored when blocks of data are stored as centralized/shareable element blocks in the database umbraco/rfcs#24. That will have it's own challenges for what 'Copy' actually means.
For testing: