defensestation / blocknote-comments

comments plugin for blocknote

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comments for Blocknote

Stability Badge

Comments feature for Blocknote.

Demo

A demo is worth a thousand words

Installation

Install via YARN

Get the package

$ yarn add @defensestation/blocknote-comments

Usage

Include module at your application

import {
  commentStyleSpec,
  CommentToolbarController,
  CreateCommentButton,
} from "@defensestation/blocknote-comments";

Create schema with comment style spec.

const schema = BlockNoteSchema.create({
  styleSpecs: {
    // Adds all default styles.
    ...defaultStyleSpecs,
    comment: commentStyleSpec,
  },
});

Add comment button in toolbar.

const CustomToolbar = () => (<FormattingToolbarController
          formattingToolbar={() => (
            <FormattingToolbar>
              <CreateCommentButton key={"createCommentButtin"} />
            </FormattingToolbar>
          )}
        />)

Add comment controller.

<BlockNoteView formattingToolbar={false} editor={editor}>
    <CustomToolbar />
    <CommentToolbarController />
</BlockNoteView>

About

comments plugin for blocknote

License:Apache License 2.0


Languages

Language:TypeScript 86.6%Language:JavaScript 6.2%Language:CSS 5.8%Language:HTML 1.5%