@liveblocks/react-blocknote
Version:
An integration of BlockNote + React to enable collaboration, comments, live cursors, and more with Liveblocks.
31 lines (28 loc) • 1.07 kB
JavaScript
import { createBlockNoteExtension } from '@blocknote/core';
import { withLiveblocksSchema } from './schema.js';
const withLiveblocksEditorOptions = (liveblocksExtension, blocknoteOptions = {}, liveblocksOptions = {}) => {
const {
schema: blocknoteSchema,
extensions: blocknoteExtensions,
disableExtensions: blocknoteDisableExtensions,
...extraBlocknoteOptions
} = blocknoteOptions;
return {
// add the liveblocks schema (i.e.: add the mentions nodes to the schema)
schema: withLiveblocksSchema(blocknoteSchema, liveblocksOptions),
// add the liveblocks extension
extensions: [
createBlockNoteExtension({
key: "liveblocksExtension",
tiptapExtensions: [liveblocksExtension]
}),
...blocknoteExtensions ?? []
],
// disable the history extension
disableExtensions: ["history", ...blocknoteDisableExtensions || []],
// pass the rest of the options through
...extraBlocknoteOptions
};
};
export { withLiveblocksEditorOptions };
//# sourceMappingURL=liveblocksEditorOptions.js.map