codex-team / codex-team/editor.js
Changing block root class
- Dominant language
- TypeScript
- Stars
- 31.9k
- Forks
- 2.2k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
Is there a way of adding a class to a block root element? I want to identify each block by it's type using class names or any other attribute so I can style it accordingly.
In certain situations, I'll be floating items to create a `column` layout with certain blocks; ie a two column list layout. It would be ideal if we can add the block type to the root element: `
I currently do this in `onChange` which works but isn't ideal. I don't have a way of doing this for old data which may never be changed.
```
if (event.detail.target.holder) {
const element = event.detail.target.holder;
const blockType = event.detail.target.name;
element?.classList.add(blockType);
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.