tiptap/docs/api
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
..
commands Adds attributes to toggleList (#3776) 2023-03-03 09:59:45 +01:00
extensions Make y-prosemirror a peer dependency (extension-collaboration) (#3697) 2023-02-07 10:20:37 +01:00
marks add optionalSlashSlash to protocol options (#3675) 2023-02-27 14:03:47 +01:00
nodes feat: #3540 Ability to preserve marks on lists (#3541) 2023-02-22 10:13:28 +01:00
utilities feat: Allow multiple prefix characters to trigger a suggestion (#2896) 2022-06-21 23:17:26 +02:00
commands.md feat(pm): new prosemirror package for dependency resolving 2023-02-02 17:37:33 +01:00
editor.md 🧹 Allow editor.setEditable to omit updates (#3301) 2023-01-20 09:55:28 +01:00
events.md docs: fix typos 2022-11-07 21:41:00 +01:00
extensions.md docs: add extension cli note to contributing docs (#3793) 2023-02-27 21:22:34 +01:00
introduction.md feat(pm): new prosemirror package for dependency resolving 2023-02-02 17:37:33 +01:00
keyboard-shortcuts.md docs: fix typos 2022-11-07 21:41:00 +01:00
marks.md Merge branch 'main' of https://github.com/ueberdosis/tiptap into docs/remove-gridsome 2021-09-17 23:45:04 +02:00
nodes.md docs: fix typos 2022-11-07 21:41:00 +01:00
schema.md Update schema.md (#3645) 2023-01-27 14:39:24 +01:00