tiptap/packages/core
René Eschke b2ec51374d
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
2023-03-03 09:59:45 +01:00
..
src Adds attributes to toggleList (#3776) 2023-03-03 09:59:45 +01:00
CHANGELOG.md v2.0.0-beta.209 2023-02-28 11:11:02 +01:00
package.json v2.0.0-beta.209 2023-02-28 11:11:02 +01:00
README.md docs: fix typo (#1339) 2021-05-18 18:36:18 +02:00
rollup.config.js fix: fix builds including prosemirror 2023-02-08 11:51:10 +01:00

@tiptap/core

Version Downloads License Sponsor

Introduction

tiptap is a headless wrapper around ProseMirror a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as New York Times, The Guardian or Atlassian.

Official Documentation

Documentation can be found on the tiptap website.

License

tiptap is open sourced software licensed under the MIT license.