Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

589 B
Raw Blame
import { mergeAttributes, Node } from '@tiptap/core';
import { ReactNodeViewRenderer } from '@tiptap/react';

import { FolderNodeView } from '@colanode/ui/editor/views';

export const FolderNode = Node.create({
  name: 'folder',
  group: 'block',
  atom: true,
  defining: true,
  draggable: true,
  addAttributes() {
    return {
      id: {
        default: null,
      },
    };
  },
  renderHTML({ HTMLAttributes }) {
    return ['folder', mergeAttributes(HTMLAttributes)];
  },
  addNodeView() {
    return ReactNodeViewRenderer(FolderNodeView, {
      as: 'folder',
    });
  },
});