-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds attributes to toggleList (#3776)
* Adds attributes to toggleList When dealing with different variants of bullet lists, I wanted to adopt the same technique I used for different paragraph variants. Since `wrapInList` is capable of receiving attributes, just like `setNode` is, I don't see any reason why `toggleList` should not be capable of the same. Here's my bullet list extension in action that is in need of attributes support. ```js export const CustomBulletList = BulletList.extend({ content: 'listItem*', addAttributes() { return { variant: { default: DEFAULT_LIST, renderHTML: attributes => { return { class: `list-${attributes.variant}`, }; }, }, }; }, addCommands() { return { toggleBulletList: attributes => (c) => { return c.commands.toggleListCustom(this.name, this.options.itemTypeName, attributes); }, }; }, }); ``` * Update toggle-list.md * Update toggle-list.md
- Loading branch information
1 parent
10a4a46
commit b2ec513
Showing
2 changed files
with
14 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters