-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Add support for file upload property editor within the block list and grid #18976
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
Open
PeterKvayt
wants to merge
43
commits into
umbraco:main
Choose a base branch
from
PeterKvayt:temp/18872
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
5841e38
Fix for https://github.com/umbraco/Umbraco-CMS/issues/18872
PeterKvayt 7ea9270
Parsing added for current value
PeterKvayt c6fc1e5
Build fix.
PeterKvayt 0ed2358
Cyclomatic complexity fix
PeterKvayt dd7eb0a
Merge branch 'contrib' into temp/18872
PeterKvayt 7292d9d
Merge branch 'v15/dev' into contrib
AndyButland f01efa2
Merge branch 'contrib' into temp/18872
AndyButland 10bde34
Resolved breaking change.
AndyButland 5414937
Pass content key.
AndyButland bba1f21
Simplified collections.
AndyButland d164bcc
Merge branch 'contrib' of https://github.com/umbraco/Umbraco-CMS into…
AndyButland bbd2387
Merge branch 'contrib' into temp/18872
AndyButland 5586531
Added unit tests to verify behaviour.
AndyButland e6e007e
Allow file upload on block list.
AndyButland ea06fb2
Added unit test verifying added property.
AndyButland e0f1c1b
Added unit test verifying removed property.
AndyButland 468beb1
Restored null return for null value fixing failing integration tests.
AndyButland fd5c8bc
Merge branch 'main' into temp/18872
AndyButland a9f5e81
Merge branch 'umbraco:main' into temp/18872
PeterKvayt f3e928d
Logic has been updated according edge cases
PeterKvayt a53ddec
Logic to copy files from block list items has been added.
PeterKvayt 54d1b7e
Logic to delete files from block list items on content deletion has b…
PeterKvayt 8ecd279
Test fix.
PeterKvayt d2f45e8
Refactoring.
PeterKvayt 430b90f
WIP: Resolved breaking changes, minor refactoring.
AndyButland 270cd88
Consistently return null over empty, resolving failure in integration…
AndyButland b2fa3d9
Removed unnecessary code nesting.
AndyButland 653a3c2
Handle distinct paths.
AndyButland d40a7cd
Handles clean up of files added via file upload in rich text blocks o…
AndyButland f016933
Update src/Umbraco.Infrastructure/PropertyEditors/FileUploadPropertyE…
AndyButland 7cd6f81
Merge branch 'main' into temp/18872
AndyButland fc5a257
Fixed build of integration tests project.
AndyButland 579a812
Merge branch 'temp/18872' of https://github.com/PeterKvayt/Umbraco-CM…
AndyButland 0d77fc6
Handled delete of file uploads when deleting a block from an RTE usin…
AndyButland 0070a3f
Refactored ensure of property type property populated on rich text va…
AndyButland 2211eb6
Fixed integration tests build.
AndyButland 0af6e98
Handle create of new file from file upload block in an RTE when the d…
AndyButland 0b77239
Fixed failing integration tests.
AndyButland 4c8c9c9
Refactored notification handlers relating to file uploads into separa…
AndyButland 71357ed
Handle nested rich text editor block with file upload when copying co…
AndyButland 1808b0e
Handle nested rich text editor block with file upload when deleting c…
AndyButland 9492892
Minor refactor.
AndyButland 831b34d
Merge branch 'umbraco:main' into temp/18872
PeterKvayt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/Umbraco.Infrastructure/Extensions/RichTextEditorValueExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Umbraco.Cms.Core; | ||
using Umbraco.Cms.Core.Cache.PropertyEditors; | ||
using Umbraco.Cms.Core.Models; | ||
using Umbraco.Cms.Core.Models.Blocks; | ||
|
||
namespace Umbraco.Cms.Infrastructure.Extensions; | ||
|
||
/// <summary> | ||
/// Defines extensions on <see cref="RichTextEditorValue"/>. | ||
/// </summary> | ||
internal static class RichTextEditorValueExtensions | ||
{ | ||
/// <summary> | ||
/// Ensures that the property type property is populated on all blocks. | ||
/// </summary> | ||
/// <param name="richTextEditorValue">The <see cref="RichTextEditorValue"/> providing the blocks.</param> | ||
/// <param name="elementTypeCache">Cache for element types.</param> | ||
public static void EnsurePropertyTypePopulatedOnBlocks(this RichTextEditorValue richTextEditorValue, IBlockEditorElementTypeCache elementTypeCache) | ||
{ | ||
Guid[] elementTypeKeys = (richTextEditorValue.Blocks?.ContentData ?? []) | ||
.Select(x => x.ContentTypeKey) | ||
.Union((richTextEditorValue.Blocks?.SettingsData ?? []) | ||
.Select(x => x.ContentTypeKey)) | ||
.Distinct() | ||
.ToArray(); | ||
|
||
IEnumerable<IContentType> elementTypes = elementTypeCache.GetMany(elementTypeKeys); | ||
|
||
foreach (BlockItemData dataItem in (richTextEditorValue.Blocks?.ContentData ?? []) | ||
.Union(richTextEditorValue.Blocks?.SettingsData ?? [])) | ||
{ | ||
foreach (BlockPropertyValue item in dataItem.Values) | ||
{ | ||
item.PropertyType = elementTypes.FirstOrDefault(x => x.Key == dataItem.ContentTypeKey)?.PropertyTypes.FirstOrDefault(pt => pt.Alias == item.Alias); | ||
} | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.