tiptap/docs
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
..
api Adds attributes to toggleList (#3776) 2023-03-03 09:59:45 +01:00
examples docs: about & collab 2023-01-18 15:34:19 +01:00
experiments docs: use regular case for Tiptap 2021-10-19 22:30:45 +02:00
guide docs: add extension cli note to contributing docs (#3793) 2023-02-27 21:22:34 +01:00
installation Update php.md (#3618) 2023-02-24 15:14:28 +01:00
overview docs: add extension cli note to contributing docs (#3793) 2023-02-27 21:22:34 +01:00
about.md docs: about & collab 2023-01-18 15:34:19 +01:00
changelog.md docs: add a minimal changelog page 2021-10-29 17:48:38 +02:00
experiments.md demos: remove details experiment 2021-12-03 20:41:08 +01:00
installation.md Update installation guides (#3698) 2023-02-07 10:18:53 +01:00
introduction.md feat(pm): new prosemirror package for dependency resolving 2023-02-02 17:37:33 +01:00
jobs.md docs: fix typo in job description 2022-12-22 18:05:09 +01:00
links.yaml Update installation guides (#3698) 2023-02-07 10:18:53 +01:00