How to use @tiptap/core - 2 common examples

To help you get started, we’ve selected a few @tiptap/core 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 / test_utils.js View on Github external
export const createTestContentEditorExtension = ({ commands = [] } = {}) => {
  const commandMocks = commands.reduce(
    (accum, commandName) => ({
      ...accum,
      [commandName]: jest.fn(),
    }),
    {},
  );

  return {
    commandMocks,
    tiptapExtension: Node.create({
      name: 'label',
      priority: 101,
      inline: true,
      group: 'inline',
      addCommands() {
        return commands.reduce(
          (accum, commandName) => ({
            ...accum,
            [commandName]: (...params) => () => commandMocks[commandName](...params),
          }),
          {},
        );
      },
      addAttributes() {
        return {
          labelName: {
github gitlabhq / gitlabhq / spec / frontend / content_editor / components / toolbar_button_spec.js View on Github external
const buildEditor = () => {
    toggleFooSpy = jest.fn();
    tiptapEditor = createContentEditor({
      extensions: [
        {
          tiptapExtension: Extension.create({
            addCommands() {
              return {
                toggleFoo: () => toggleFooSpy,
              };
            },
          }),
        },
      ],
      renderMarkdown: () => true,
    }).tiptapEditor;

    jest.spyOn(tiptapEditor, 'isActive');
  };

@tiptap/core

headless rich text editor

MIT
Latest version published 3 days ago

Package Health Score

92 / 100
Full package analysis