How to use @tiptap/extension-list-item - 1 common examples

To help you get started, we’ve selected a few @tiptap/extension-list-item examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gitlabhq / gitlabhq / spec / frontend / content_editor / services / track_input_rules_and_shortcuts_spec.js View on Github external
const shortcuts = Heading.config.addKeyboardShortcuts.call(Heading);
        const [firstShortcut] = Object.keys(shortcuts);
        const nodeName = Heading.name;

        editor.chain().keyboardShortcut(firstShortcut).insertContent(HEADING_TEXT).run();

        expect(trackingSpy).toHaveBeenCalledWith(undefined, KEYBOARD_SHORTCUT_TRACKING_ACTION, {
          label: CONTENT_EDITOR_TRACKING_LABEL,
          property: `${nodeName}.${firstShortcut}`,
        });
      });
    });

    it.each`
      extension                 | shortcut
      ${ListItem.name}          | ${ENTER_KEY}
      ${CodeBlockLowlight.name} | ${BACKSPACE_KEY}
    `('does not track $shortcut shortcut for $extension extension', ({ shortcut }) => {
      editor.chain().keyboardShortcut(shortcut).run();

      expect(trackingSpy).not.toHaveBeenCalled();
    });

    describe('when creating a heading using an input rule', () => {
      it('sends a tracking event indicating that a heading was created using an input rule', async () => {
        const nodeName = Heading.name;
        const { view } = editor;
        const { selection } = view.state;

        // Triggers the event handler that input rules listen to
        view.someProp('handleTextInput', (f) => f(view, selection.from, selection.to, '## '));

@tiptap/extension-list-item

list item extension for tiptap

MIT
Latest version published 6 days ago

Package Health Score

89 / 100
Full package analysis

Popular @tiptap/extension-list-item functions