Skip to content
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/vanilla/src/ui/blockSideMenuFactory.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { BlockSideMenuFactory } from "@blocknote/core";
import { BlockSideMenuFactory, DefaultBlockSchema } from "@blocknote/core";
import { createButton } from "./util";

/**
* This menu is drawn next to a block, when it's hovered over
* It renders a drag handle and + button to create a new block
*/
export const blockSideMenuFactory: BlockSideMenuFactory = (staticParams) => {
export const blockSideMenuFactory: BlockSideMenuFactory<DefaultBlockSchema> = (
staticParams
) => {
const container = document.createElement("div");
container.style.background = "gray";
container.style.position = "absolute";
Expand Down
8 changes: 4 additions & 4 deletions examples/vanilla/src/ui/formattingToolbarFactory.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { FormattingToolbarFactory } from "@blocknote/core";
import { DefaultBlockSchema, FormattingToolbarFactory } from "@blocknote/core";
import { createButton } from "./util";

/**
* This menu is drawn when a piece of text is selected. We can use it to change formatting options
* such as bold, italic, indentation, etc.
*/
export const formattingToolbarFactory: FormattingToolbarFactory = (
staticParams
) => {
export const formattingToolbarFactory: FormattingToolbarFactory<
DefaultBlockSchema
> = (staticParams) => {
const container = document.createElement("div");
container.style.background = "gray";
container.style.position = "absolute";
Expand Down
16 changes: 10 additions & 6 deletions examples/vanilla/src/ui/slashMenuFactory.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { BaseSlashMenuItem, SuggestionsMenuFactory } from "@blocknote/core";
import {
BaseSlashMenuItem,
DefaultBlockSchema,
SuggestionsMenuFactory,
} from "@blocknote/core";
import { createButton } from "./util";

/**
* This menu is drawn when the cursor is moved to a hyperlink (using the keyboard),
* or when the mouse is hovering over a hyperlink
*/
export const slashMenuFactory: SuggestionsMenuFactory<BaseSlashMenuItem> = (
staticParams
) => {
export const slashMenuFactory: SuggestionsMenuFactory<
BaseSlashMenuItem<DefaultBlockSchema>
> = (staticParams) => {
const container = document.createElement("div");
container.style.background = "gray";
container.style.position = "absolute";
Expand All @@ -17,8 +21,8 @@ export const slashMenuFactory: SuggestionsMenuFactory<BaseSlashMenuItem> = (
document.body.appendChild(container);

function updateItems(
items: BaseSlashMenuItem[],
onClick: (item: BaseSlashMenuItem) => void,
items: BaseSlashMenuItem<DefaultBlockSchema>[],
onClick: (item: BaseSlashMenuItem<DefaultBlockSchema>) => void,
selected: number
) {
container.innerHTML = "";
Expand Down
Loading