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

Editors with the same name override eachother's availableBlocks #2502

Open
Tofandel opened this issue Feb 27, 2024 · 0 comments · May be fixed by #2503
Open

Editors with the same name override eachother's availableBlocks #2502

Tofandel opened this issue Feb 27, 2024 · 0 comments · May be fixed by #2503

Comments

@Tofandel
Copy link
Contributor

Tofandel commented Feb 27, 2024

Description

When making a BlockEditor::make() with ->blocks() or ->excludedBlocks() if any other editor (eg one in a block on in the form, or two from different blocks) on the page has the same name, then the available blocks of both blocks are the same (one overrode the available blocks of the other)

Steps to reproduce

Create a few different blocks with nesting using

BlockEditor::make()
            ->name('description')->label(twillTrans('Description'))
            ->withoutSeparator()
            ->excludeBlocks(['text']);
BlockEditor::make()
            ->name('description')->label(twillTrans('Description'))
            ->withoutSeparator()
            ->excludeBlocks(['image']);

When you add one of this blocks into the other block, the nested block will show the wrong available blocks

This is due to this line which only uses the name of the block editor as a key

window['{{ config('twill.js_namespace') }}'].STORE.form.availableBlocks['{{ $name }}'] =

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

Successfully merging a pull request may close this issue.

1 participant