Skip to content
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

Custom BlockEditors inheriting from BlockListPropertyEditorBase do not save #14959

Closed
FullStackChef opened this issue Oct 12, 2023 · 7 comments · Fixed by #14960
Closed

Custom BlockEditors inheriting from BlockListPropertyEditorBase do not save #14959

FullStackChef opened this issue Oct 12, 2023 · 7 comments · Fixed by #14960

Comments

@FullStackChef
Copy link
Contributor

FullStackChef commented Oct 12, 2023

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

12.2.0

Bug summary

BlockListPropertyEditorBase includes a nested internal class BlockListEditorPropertyValueEditor which implements the internal abstract class BlockEditorPropertyValueEditor.

The constructor of BlockListEditorPropertyValueEditor Sets BlockEditorValues:

BlockEditorValues = new BlockEditorValues(new BlockListEditorDataConverter(), contentTypeService, logger);

Where BlockListEditorDataConverter has a hard coded value of Constants.PropertyEditors.Aliases.BlockList (Umbraco.Blocklist) for the BlockEditorDataConverter data converter.

Because of this any custom property that inherits from BlockListPropertyEditorBase successfully completes the process of saving but does not actually save.

Specifics

No response

Steps to reproduce

  1. Create a new custom property editor that extends BlockListPropertyEditorBase
[DataEditor(
 PropertyEditorType,
 EditorType.PropertyValue,
 "Block Dictionary Editor",
 "blocklist",
 ValueType = ValueTypes.Json,
 Group = Constants.PropertyEditors.Groups.Lists,
 Icon = "icon-list",
 HideLabel = true)]
public class BlockDictionaryEditor : BlockListPropertyEditorBase
{
    public const string PropertyEditorType = "MCF.BlockDictionaryEditor";
    private readonly IEditorConfigurationParser _editorConfigurationParser;
    private readonly IIOHelper _ioHelper;

    public BlockDictionaryEditor(
                                IIOHelper ioHelper,
                                IDataValueEditorFactory dataValueEditorFactory,
                                IEditorConfigurationParser editorConfigurationParser,
                                IBlockValuePropertyIndexValueFactory blockValuePropertyIndexValueFactory) :
        base(dataValueEditorFactory, blockValuePropertyIndexValueFactory)
    {
        _ioHelper = ioHelper;
        _editorConfigurationParser = editorConfigurationParser;
    }

    protected override IConfigurationEditor CreateConfigurationEditor() => new BlockDictionaryConfigurationEditor(_ioHelper, _editorConfigurationParser);
}
  1. Install / configure in umbraco as per usual
  2. Add Content, Click Save

Expected result / actual result

Expected result:

  • An error OR
  • Content to be persisted

Actual result:

  • No error
  • Content Resets
@github-actions
Copy link

Hi there @FullStackChef!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

  • We'll assess whether this issue relates to something that has already been fixed in a later version of the release that it has been raised for.
  • If it's a bug, is it related to a release that we are actively supporting or is it related to a release that's in the end-of-life or security-only phase?
  • We'll replicate the issue to ensure that the problem is as described.
  • We'll decide whether the behavior is an issue or if the behavior is intended.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

@FullStackChef
Copy link
Contributor Author

Note: I have a draft pull request #14960 with a fix for this.

@elit0451 elit0451 self-assigned this Oct 12, 2023
@elit0451
Copy link
Member

Hey @FullStackChef 👋
Thanks for reaching out! Can you provide a bit more info about your document type structure? As well as your custom BlockDictionaryConfigurationEditor class? So we can try to reproduce the issue 🙂

@elit0451 elit0451 added state/needs-more-info We don't have enough information to give a good reply state/needs-investigation This requires input from HQ or community to proceed labels Oct 12, 2023
@elit0451 elit0451 removed their assignment Oct 12, 2023
@FullStackChef
Copy link
Contributor Author

ExtendedBlockListConfiguration.zip

Hey @elit0451 reproduction package attached.
ExtendedBlockListEditor contains commented out code that fixes the issue using a rather large amount of duplicated code.

@FullStackChef
Copy link
Contributor Author

Images showing usage:

image

image

image

@netcamo netcamo self-assigned this Oct 12, 2023
@netcamo
Copy link
Contributor

netcamo commented Oct 12, 2023

Hi @FullStackChef

Thank you for bringing up this issue to us!

We have been able to reproduce it and I will assign proper labels to the issue.

Thank you again and I wish you a wonderful rest of the week!

@netcamo netcamo added community/pr affected/v12 and removed state/needs-more-info We don't have enough information to give a good reply state/needs-investigation This requires input from HQ or community to proceed labels Oct 12, 2023
@netcamo netcamo removed their assignment Oct 12, 2023
@nul800sebastiaan
Copy link
Member

Fixed in #14960

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants