TypeCellOS / BlockNote

A React Rich Text Editor that's block-based (Notion style) and extensible. Built on top of Prosemirror and Tiptap.
https://www.blocknotejs.org/
Mozilla Public License 2.0
6.46k stars 440 forks source link

TypeScript errors: `BlockNoteView` has no `editor` prop #775

Closed conr closed 3 months ago

conr commented 4 months ago

Describe the bug

Following the quickstart guide for BlockNote, I'm getting the following TypeScript errors stating that props like editor are not valid props for the BlockNoteView component (see screenshots attached).

I have installed @blocknote/core, @blocknote/react, and @blocknote/mantine versions 0.13.4.

I originally posted this in the Discord, and another user reported the same issue.

image image

To Reproduce

Misc

conr commented 4 months ago

I worked around this for now by wrapping a new custom component:

import { BlockNoteEditor } from "@blocknote/core";
import { BlockNoteView } from "@blocknote/mantine";
import React, { HTMLAttributes } from "react";

export type BlockNoteViewProps = {
  editor: BlockNoteEditor;
  editable?: boolean;
  onSelectionChange?: () => void;
  onChange?: () => void;
  theme?: "light" | "dark";
  formattingToolbar?: boolean;
  linkToolbar?: boolean;
  sideMenu?: boolean;
  slashMenu?: boolean;
  filePanel?: boolean;
  tableHandles?: boolean;
  children?: React.ReactNode;
} & HTMLAttributes<HTMLDivElement>;

export const Editor: React.FC<BlockNoteViewProps> = (props) => (
  <BlockNoteView {...props} />
);
YousefED commented 4 months ago

I can't seem to reproduce this. Are you able to create a stackblitz where this issue occurs?

YousefED commented 3 months ago

Closing this, lmk if it still occurs @conr