Skip to content

Commit fc9e452

Browse files
committed
Removed checkDefaultInlineContentTypeInSchema
1 parent 1ff7474 commit fc9e452

File tree

2 files changed

+8
-35
lines changed

2 files changed

+8
-35
lines changed

packages/core/src/blocks/defaultBlockTypeGuards.ts

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
import { CellSelection } from "prosemirror-tables";
22
import type { BlockNoteEditor } from "../editor/BlockNoteEditor.js";
3-
import {
4-
BlockConfig,
5-
BlockSchema,
6-
PropSchema,
7-
PropSpec,
8-
StyleSchema,
9-
} from "../schema/index.js";
10-
import {
11-
Block,
12-
DefaultInlineContentSchema,
13-
defaultInlineContentSchema,
14-
} from "./defaultBlocks.js";
3+
import { BlockConfig, PropSchema, PropSpec } from "../schema/index.js";
4+
import { Block } from "./defaultBlocks.js";
155
import { Selection } from "prosemirror-state";
166

177
export function editorHasBlockWithType<
@@ -173,27 +163,6 @@ export function blockHasType<
173163
);
174164
}
175165

176-
// TODO: Only used once in the emoji picker - is it even needed? If so, should
177-
// be changed to be like the block type guards.
178-
export function checkDefaultInlineContentTypeInSchema<
179-
InlineContentType extends keyof DefaultInlineContentSchema,
180-
B extends BlockSchema,
181-
S extends StyleSchema,
182-
>(
183-
inlineContentType: InlineContentType,
184-
editor: BlockNoteEditor<B, any, S>,
185-
): editor is BlockNoteEditor<
186-
B,
187-
{ [K in InlineContentType]: DefaultInlineContentSchema[InlineContentType] },
188-
S
189-
> {
190-
return (
191-
inlineContentType in editor.schema.inlineContentSchema &&
192-
editor.schema.inlineContentSchema[inlineContentType] ===
193-
defaultInlineContentSchema[inlineContentType]
194-
);
195-
}
196-
197166
export function isTableCellSelection(
198167
selection: Selection,
199168
): selection is CellSelection {

packages/core/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Emoji, EmojiMartData } from "@emoji-mart/data";
22

3-
import { checkDefaultInlineContentTypeInSchema } from "../../blocks/defaultBlockTypeGuards.js";
3+
import { defaultInlineContentSchema } from "../../blocks/defaultBlocks.js";
44
import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
55
import {
66
BlockSchema,
@@ -54,7 +54,11 @@ export async function getDefaultEmojiPickerItems<
5454
editor: BlockNoteEditor<BSchema, I, S>,
5555
query: string,
5656
): Promise<DefaultGridSuggestionItem[]> {
57-
if (!checkDefaultInlineContentTypeInSchema("text", editor)) {
57+
if (
58+
!("text" in editor.schema.inlineContentSchema) ||
59+
editor.schema.inlineContentSchema["text"] !==
60+
defaultInlineContentSchema["text"]
61+
) {
5862
return [];
5963
}
6064

0 commit comments

Comments
 (0)