Skip to content

Add block tool name to block class wrapper#2302

Open
wmnnd wants to merge 3 commits intocodex-team:nextfrom
pentacent:add-block-tool-name-class
Open

Add block tool name to block class wrapper#2302
wmnnd wants to merge 3 commits intocodex-team:nextfrom
pentacent:add-block-tool-name-class

Conversation

@wmnnd
Copy link

@wmnnd wmnnd commented Mar 15, 2023

This PR adds the tool name to block wrapper elements. This makes it easy to apply custom styles to existing/third-party blocks where it’s not possible to add such classes to the block itself.

In the case of the paragraph block, this would mean that the block receives the ce-block--type-paragraph class in addition to ce-block.

I’ve found this change tremendously helpful when working on integrating Editor.js into Keila.

* @returns {HTMLDivElement}
*/
private compose(): HTMLDivElement {
const wrapper = $.make('div', Block.CSS.wrapper) as HTMLDivElement,
Copy link
Member

@neSpecc neSpecc Mar 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to use the data-tool attribute instead of class

@neSpecc
Copy link
Member

neSpecc commented Mar 17, 2023

This makes it easy to apply custom styles to existing/third-party blocks where it’s not possible to add such classes to the block itself.

Could you provide some real examples? Why not using tools' class names?

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants