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
Labels
impact: low a minor issue for some people type: bug Something isn't working

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 }}'] =

@ifox ifox added type: bug Something isn't working impact: low a minor issue for some people labels May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact: low a minor issue for some people type: bug Something isn't working
Projects
Status: In progress
Development

Successfully merging a pull request may close this issue.

2 participants