@blocknote/core 0.30.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocknote.cjs +9 -9
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +2771 -2245
- package/dist/blocknote.js.map +1 -1
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.js.map +1 -1
- package/dist/{en-D4taoCs4.cjs → en-BXVKCwYt.cjs} +2 -2
- package/dist/en-BXVKCwYt.cjs.map +1 -0
- package/dist/{en-B7ycW7c8.js → en-qGo6sk9V.js} +2 -3
- package/dist/en-qGo6sk9V.js.map +1 -0
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +20 -39
- package/dist/locales.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +8 -7
- package/src/api/README.md +1 -1
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +19 -14
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +7 -8
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.test.ts +3 -3
- package/src/api/blockManipulation/commands/mergeBlocks/mergeBlocks.ts +12 -12
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.test.ts +14 -14
- package/src/api/blockManipulation/commands/moveBlocks/moveBlocks.ts +16 -16
- package/src/api/blockManipulation/commands/nestBlock/nestBlock.ts +8 -8
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +12 -12
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +8 -8
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.test.ts +10 -10
- package/src/api/blockManipulation/commands/splitBlock/splitBlock.ts +2 -2
- package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +2816 -0
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +200 -42
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +104 -34
- package/src/api/blockManipulation/getBlock/getBlock.ts +9 -9
- package/src/api/blockManipulation/insertContentAt.ts +1 -1
- package/src/api/blockManipulation/selections/selection.ts +59 -12
- package/src/api/blockManipulation/selections/{textCursorPosition/textCursorPosition.ts → textCursorPosition.ts} +13 -13
- package/src/api/blockManipulation/tables/tables.test.ts +106 -106
- package/src/api/blockManipulation/tables/tables.ts +35 -35
- package/src/api/clipboard/fromClipboard/fileDropExtension.ts +2 -2
- package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +9 -9
- package/src/api/clipboard/fromClipboard/handleVSCodePaste.ts +3 -3
- package/src/api/clipboard/fromClipboard/pasteExtension.ts +3 -3
- package/src/api/clipboard/toClipboard/copyExtension.ts +22 -22
- package/src/api/exporters/html/externalHTMLExporter.ts +6 -6
- package/src/api/exporters/html/internalHTMLSerializer.ts +3 -3
- package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +16 -16
- package/src/api/exporters/html/util/serializeBlocksInternalHTML.ts +14 -14
- package/src/api/exporters/markdown/markdownExporter.ts +3 -3
- package/src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts +3 -3
- package/src/api/getBlockInfoFromPos.ts +6 -6
- package/src/api/nodeConversions/blockToNode.ts +31 -28
- package/src/api/nodeConversions/fragmentToBlocks.ts +1 -1
- package/src/api/nodeConversions/nodeToBlock.ts +240 -41
- package/src/api/nodeUtil.test.ts +16 -16
- package/src/api/nodeUtil.ts +10 -10
- package/src/api/parsers/html/parseHTML.ts +1 -1
- package/src/api/parsers/html/util/nestedLists.ts +2 -2
- package/src/api/parsers/markdown/parseMarkdown.ts +1 -1
- package/src/api/pmUtil.ts +7 -7
- package/src/api/positionMapping.test.ts +3 -3
- package/src/api/positionMapping.ts +5 -5
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +4 -4
- package/src/blocks/CodeBlockContent/CodeBlockContent.ts +18 -18
- package/src/blocks/FileBlockContent/FileBlockContent.ts +2 -2
- package/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts +2 -2
- package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +6 -6
- package/src/blocks/FileBlockContent/helpers/render/createFileBlockWrapper.ts +2 -2
- package/src/blocks/FileBlockContent/helpers/render/createFileNameWithIcon.ts +1 -1
- package/src/blocks/FileBlockContent/helpers/render/createResizableFileBlockWrapper.ts +7 -7
- package/src/blocks/FileBlockContent/helpers/toExternalHTML/createFigureWithCaption.ts +1 -1
- package/src/blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.ts +1 -1
- package/src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts +2 -2
- package/src/blocks/HeadingBlockContent/HeadingBlockContent.ts +6 -6
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +4 -4
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +4 -4
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +10 -10
- package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +1 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +1 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +4 -4
- package/src/blocks/ListItemBlockContent/getListItemContent.ts +5 -5
- package/src/blocks/PageBreakBlockContent/PageBreakBlockContent.ts +1 -1
- package/src/blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.ts +3 -3
- package/src/blocks/PageBreakBlockContent/schema.ts +2 -2
- package/src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts +3 -3
- package/src/blocks/QuoteBlockContent/QuoteBlockContent.ts +4 -4
- package/src/blocks/README.md +1 -1
- package/src/blocks/TableBlockContent/TableBlockContent.ts +37 -7
- package/src/blocks/TableBlockContent/TableExtension.ts +3 -3
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +4 -4
- package/src/blocks/defaultBlockHelpers.ts +8 -8
- package/src/blocks/defaultBlockTypeGuards.ts +16 -16
- package/src/blocks/defaultBlocks.ts +3 -3
- package/src/comments/threadstore/DefaultThreadStoreAuth.ts +3 -3
- package/src/comments/threadstore/ThreadStore.ts +1 -1
- package/src/comments/threadstore/TipTapThreadStore.ts +10 -10
- package/src/comments/threadstore/yjs/RESTYjsThreadStore.ts +4 -4
- package/src/comments/threadstore/yjs/YjsThreadStore.test.ts +2 -2
- package/src/comments/threadstore/yjs/YjsThreadStore.ts +14 -14
- package/src/comments/threadstore/yjs/YjsThreadStoreBase.ts +1 -1
- package/src/comments/threadstore/yjs/yjsHelpers.ts +6 -6
- package/src/editor/Block.css +35 -1
- package/src/editor/BlockNoteEditor.test.ts +10 -3
- package/src/editor/BlockNoteEditor.ts +95 -38
- package/src/editor/BlockNoteExtension.ts +26 -0
- package/src/editor/BlockNoteExtensions.ts +38 -22
- package/src/editor/BlockNoteSchema.ts +4 -4
- package/src/editor/BlockNoteTipTapEditor.ts +33 -12
- package/src/editor/README.md +1 -1
- package/src/editor/cursorPositionTypes.ts +1 -1
- package/src/editor/editor.css +15 -3
- package/src/editor/selectionTypes.ts +1 -1
- package/src/editor/transformPasted.ts +2 -2
- package/src/exporter/Exporter.ts +5 -5
- package/src/exporter/mapping.ts +7 -7
- package/src/extensions/BackgroundColor/BackgroundColorMark.ts +1 -1
- package/src/extensions/Collaboration/CursorPlugin.ts +15 -9
- package/src/extensions/Collaboration/ForkYDocPlugin.test.ts +166 -0
- package/src/extensions/Collaboration/ForkYDocPlugin.ts +174 -0
- package/src/extensions/Collaboration/SyncPlugin.ts +7 -4
- package/src/extensions/Collaboration/UndoPlugin.ts +7 -4
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor-forked.json +30 -0
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-editor.json +30 -0
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap-forked.html +1 -0
- package/src/extensions/Collaboration/__snapshots__/fork-yjs-snap.html +1 -0
- package/src/extensions/Comments/CommentsPlugin.ts +80 -75
- package/src/extensions/Comments/userstore/UserStore.ts +2 -2
- package/src/extensions/FilePanel/FilePanelPlugin.ts +56 -55
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +60 -30
- package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +26 -26
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +33 -32
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +45 -42
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +113 -110
- package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +179 -170
- package/src/extensions/README.md +1 -1
- package/src/extensions/ShowSelection/ShowSelectionPlugin.ts +22 -19
- package/src/extensions/SideMenu/MultipleNodeSelection.ts +1 -1
- package/src/extensions/SideMenu/SideMenuPlugin.ts +49 -48
- package/src/extensions/SideMenu/dragging.ts +8 -8
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +176 -176
- package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +2 -2
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +16 -16
- package/src/extensions/Suggestions/SuggestionMarks.ts +175 -0
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +199 -195
- package/src/extensions/TrailingNode/TrailingNodeExtension.ts +1 -1
- package/src/extensions/UniqueID/UniqueID.ts +6 -6
- package/src/extensions/getDraggableBlockFromElement.ts +1 -1
- package/src/fonts/inter.css +18 -9
- package/src/i18n/locales/ar.ts +0 -1
- package/src/i18n/locales/de.ts +0 -1
- package/src/i18n/locales/en.ts +0 -1
- package/src/i18n/locales/es.ts +0 -1
- package/src/i18n/locales/fr.ts +0 -1
- package/src/i18n/locales/hr.ts +0 -1
- package/src/i18n/locales/is.ts +0 -1
- package/src/i18n/locales/it.ts +0 -1
- package/src/i18n/locales/ja.ts +0 -1
- package/src/i18n/locales/ko.ts +0 -1
- package/src/i18n/locales/nl.ts +0 -1
- package/src/i18n/locales/no.ts +0 -1
- package/src/i18n/locales/pl.ts +0 -1
- package/src/i18n/locales/pt.ts +0 -1
- package/src/i18n/locales/ru.ts +0 -1
- package/src/i18n/locales/sk.ts +0 -1
- package/src/i18n/locales/uk.ts +0 -1
- package/src/i18n/locales/vi.ts +0 -1
- package/src/i18n/locales/zh-tw.ts +0 -1
- package/src/i18n/locales/zh.ts +0 -1
- package/src/index.ts +18 -8
- package/src/locales.ts +1 -1
- package/src/pm-nodes/BlockContainer.ts +1 -1
- package/src/pm-nodes/BlockGroup.ts +2 -2
- package/src/pm-nodes/Doc.ts +5 -4
- package/src/schema/README.md +1 -1
- package/src/schema/blocks/createSpec.ts +14 -14
- package/src/schema/blocks/internal.ts +17 -17
- package/src/schema/blocks/types.ts +25 -25
- package/src/schema/inlineContent/createSpec.ts +16 -20
- package/src/schema/inlineContent/internal.ts +9 -9
- package/src/schema/inlineContent/types.ts +26 -26
- package/src/schema/propTypes.ts +8 -8
- package/src/schema/styles/createSpec.ts +2 -2
- package/src/schema/styles/internal.ts +7 -7
- package/src/schema/styles/types.ts +2 -2
- package/src/util/EventEmitter.ts +4 -4
- package/src/util/README.md +1 -1
- package/src/util/combineByGroup.ts +1 -1
- package/src/util/table.ts +33 -30
- package/types/src/api/blockManipulation/commands/insertBlocks/insertBlocks.d.ts +1 -1
- package/types/src/api/blockManipulation/commands/removeBlocks/removeBlocks.d.ts +4 -0
- package/types/src/api/blockManipulation/commands/removeBlocks/removeBlocks.test.d.ts +1 -0
- package/types/src/api/blockManipulation/commands/updateBlock/updateBlock.d.ts +3 -1
- package/types/src/api/blockManipulation/selections/selection.d.ts +10 -0
- package/types/src/api/blockManipulation/selections/textCursorPosition.d.ts +5 -0
- package/types/src/api/blockManipulation/transactions.test.d.ts +0 -0
- package/types/src/api/clipboard/clipboardExternal.test.d.ts +1 -0
- package/types/src/api/clipboard/clipboardInternal.test.d.ts +1 -0
- package/types/src/api/clipboard/testUtil.d.ts +541 -0
- package/types/src/api/exporters/html/htmlConversion.test.d.ts +1 -0
- package/types/src/api/exporters/markdown/markdownExporter.test.d.ts +1 -0
- package/types/src/api/nodeConversions/nodeConversions.test.d.ts +1 -0
- package/types/src/api/nodeConversions/nodeToBlock.d.ts +39 -2
- package/types/src/api/parsers/html/parseHTML.test.d.ts +1 -0
- package/types/src/api/parsers/markdown/parseMarkdown.test.d.ts +1 -0
- package/types/src/api/pmUtil.d.ts +3 -3
- package/types/src/api/testUtil/cases/customBlocks.d.ts +670 -0
- package/types/src/api/testUtil/cases/customInlineContent.d.ts +558 -0
- package/types/src/api/testUtil/cases/customStyles.d.ts +552 -0
- package/types/src/api/testUtil/cases/defaultSchema.d.ts +4 -0
- package/types/src/api/testUtil/index.d.ts +14 -0
- package/types/src/api/testUtil/partialBlockTestUtil.d.ts +9 -0
- package/types/src/api/testUtil/paste.d.ts +2 -0
- package/types/src/blocks/CodeBlockContent/defaultSupportedLanguages.d.ts +6 -0
- package/types/src/blocks/TableBlockContent/TableBlockContent.d.ts +9 -1
- package/types/src/editor/BlockNoteEditor.d.ts +58 -10
- package/types/src/editor/BlockNoteExtension.d.ts +9 -0
- package/types/src/editor/BlockNoteExtensions.d.ts +2 -2
- package/types/src/editor/BlockNoteTipTapEditor.d.ts +2 -2
- package/types/src/extensions/Collaboration/CursorPlugin.d.ts +3 -3
- package/types/src/extensions/Collaboration/ForkYDocPlugin.d.ts +41 -0
- package/types/src/extensions/Collaboration/ForkYDocPlugin.test.d.ts +1 -0
- package/types/src/extensions/Collaboration/SyncPlugin.d.ts +3 -3
- package/types/src/extensions/Collaboration/UndoPlugin.d.ts +3 -3
- package/types/src/extensions/Collaboration/createCollaborationExtensions.d.ts +17 -0
- package/types/src/extensions/Comments/CommentsPlugin.d.ts +2 -4
- package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +3 -4
- package/types/src/extensions/FormattingToolbar/FormattingToolbarPlugin.d.ts +5 -5
- package/types/src/extensions/LinkToolbar/LinkToolbarPlugin.d.ts +3 -4
- package/types/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.d.ts +2 -3
- package/types/src/extensions/Placeholder/PlaceholderPlugin.d.ts +2 -3
- package/types/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.d.ts +2 -3
- package/types/src/extensions/ShowSelection/ShowSelectionPlugin.d.ts +2 -3
- package/types/src/extensions/SideMenu/SideMenuPlugin.d.ts +3 -4
- package/types/src/extensions/SuggestionMenu/SuggestionPlugin.d.ts +2 -4
- package/types/src/extensions/Suggestions/SuggestionMarks.d.ts +4 -0
- package/types/src/extensions/TableHandles/TableHandlesPlugin.d.ts +5 -6
- package/types/src/i18n/locales/en.d.ts +0 -1
- package/types/src/i18n/locales/sk.d.ts +0 -1
- package/types/src/index.d.ts +15 -8
- package/dist/en-B7ycW7c8.js.map +0 -1
- package/dist/en-D4taoCs4.cjs.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/src/api/blockManipulation/selections/__snapshots__/selection.test.ts.snap +0 -844
- package/src/api/blockManipulation/selections/selection.test.ts +0 -72
- package/src/api/blockManipulation/selections/textCursorPosition/__snapshots__/textCursorPosition.test.ts.snap +0 -316
- package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.ts +0 -74
|
@@ -23,7 +23,7 @@ describe("PositionStorage with local editor", () => {
|
|
|
23
23
|
|
|
24
24
|
expect(editor._tiptapEditor.on).toHaveBeenCalledWith(
|
|
25
25
|
"transaction",
|
|
26
|
-
expect.any(Function)
|
|
26
|
+
expect.any(Function),
|
|
27
27
|
);
|
|
28
28
|
});
|
|
29
29
|
});
|
|
@@ -59,7 +59,7 @@ describe("PositionStorage with local editor", () => {
|
|
|
59
59
|
},
|
|
60
60
|
],
|
|
61
61
|
editor.document[0],
|
|
62
|
-
"before"
|
|
62
|
+
"before",
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
// Start tracking
|
|
@@ -98,7 +98,7 @@ describe("PositionStorage with local editor", () => {
|
|
|
98
98
|
},
|
|
99
99
|
],
|
|
100
100
|
editor.document[0],
|
|
101
|
-
"before"
|
|
101
|
+
"before",
|
|
102
102
|
);
|
|
103
103
|
// Start tracking
|
|
104
104
|
const getPos = trackPosition(editor, 10);
|
|
@@ -59,10 +59,10 @@ export function trackPosition(
|
|
|
59
59
|
/**
|
|
60
60
|
* This is the side of the position to track. "left" is the default. "right" would move with the change if the change is in the right direction.
|
|
61
61
|
*/
|
|
62
|
-
side: "left" | "right" = "left"
|
|
62
|
+
side: "left" | "right" = "left",
|
|
63
63
|
): () => number {
|
|
64
64
|
const ySyncPluginState = ySyncPluginKey.getState(
|
|
65
|
-
editor._tiptapEditor.state
|
|
65
|
+
editor._tiptapEditor.state,
|
|
66
66
|
) as {
|
|
67
67
|
doc: Y.Doc;
|
|
68
68
|
binding: ProsemirrorBinding;
|
|
@@ -90,18 +90,18 @@ export function trackPosition(
|
|
|
90
90
|
// Track the position after the position if we are on the right side
|
|
91
91
|
position + (side === "right" ? 1 : 0),
|
|
92
92
|
ySyncPluginState.binding.type,
|
|
93
|
-
ySyncPluginState.binding.mapping
|
|
93
|
+
ySyncPluginState.binding.mapping,
|
|
94
94
|
);
|
|
95
95
|
|
|
96
96
|
return () => {
|
|
97
97
|
const curYSyncPluginState = ySyncPluginKey.getState(
|
|
98
|
-
editor._tiptapEditor.state
|
|
98
|
+
editor._tiptapEditor.state,
|
|
99
99
|
) as typeof ySyncPluginState;
|
|
100
100
|
const pos = relativePositionToAbsolutePosition(
|
|
101
101
|
curYSyncPluginState.doc,
|
|
102
102
|
curYSyncPluginState.binding.type,
|
|
103
103
|
relativePosition,
|
|
104
|
-
curYSyncPluginState.binding.mapping
|
|
104
|
+
curYSyncPluginState.binding.mapping,
|
|
105
105
|
);
|
|
106
106
|
|
|
107
107
|
// This can happen if the element is garbage collected
|
|
@@ -47,7 +47,7 @@ export const audioBlockConfig = {
|
|
|
47
47
|
|
|
48
48
|
export const audioRender = (
|
|
49
49
|
block: BlockFromConfig<typeof audioBlockConfig, any, any>,
|
|
50
|
-
editor: BlockNoteEditor<any, any, any
|
|
50
|
+
editor: BlockNoteEditor<any, any, any>,
|
|
51
51
|
) => {
|
|
52
52
|
const icon = document.createElement("div");
|
|
53
53
|
icon.innerHTML = FILE_AUDIO_ICON_SVG;
|
|
@@ -70,12 +70,12 @@ export const audioRender = (
|
|
|
70
70
|
editor,
|
|
71
71
|
{ dom: audio },
|
|
72
72
|
editor.dictionary.file_blocks.audio.add_button_text,
|
|
73
|
-
icon.firstElementChild as HTMLElement
|
|
73
|
+
icon.firstElementChild as HTMLElement,
|
|
74
74
|
);
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
export const audioParse = (
|
|
78
|
-
element: HTMLElement
|
|
78
|
+
element: HTMLElement,
|
|
79
79
|
): Partial<Props<typeof audioBlockConfig.propSchema>> | undefined => {
|
|
80
80
|
if (element.tagName === "AUDIO") {
|
|
81
81
|
// Ignore if parent figure has already been parsed.
|
|
@@ -104,7 +104,7 @@ export const audioParse = (
|
|
|
104
104
|
};
|
|
105
105
|
|
|
106
106
|
export const audioToExternalHTML = (
|
|
107
|
-
block: BlockFromConfig<typeof audioBlockConfig, any, any
|
|
107
|
+
block: BlockFromConfig<typeof audioBlockConfig, any, any>,
|
|
108
108
|
) => {
|
|
109
109
|
if (!block.props.url) {
|
|
110
110
|
const div = document.createElement("p");
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import type { HighlighterGeneric } from "@shikijs/types";
|
|
1
2
|
import { InputRule, isTextSelection } from "@tiptap/core";
|
|
2
3
|
import { TextSelection } from "@tiptap/pm/state";
|
|
3
|
-
import {
|
|
4
|
+
import { Parser, createHighlightPlugin } from "prosemirror-highlight";
|
|
4
5
|
import { createParser } from "prosemirror-highlight/shiki";
|
|
6
|
+
import { BlockNoteEditor } from "../../index.js";
|
|
5
7
|
import {
|
|
8
|
+
PropSchema,
|
|
6
9
|
createBlockSpecFromStronglyTypedTiptapNode,
|
|
7
10
|
createStronglyTypedTiptapNode,
|
|
8
|
-
PropSchema,
|
|
9
11
|
} from "../../schema/index.js";
|
|
10
12
|
import { createDefaultBlockDOMOutputSpec } from "../defaultBlockHelpers.js";
|
|
11
|
-
import type { HighlighterGeneric } from "@shikijs/types";
|
|
12
|
-
import { BlockNoteEditor } from "../../index.js";
|
|
13
13
|
|
|
14
14
|
export type CodeBlockOptions = {
|
|
15
15
|
/**
|
|
@@ -64,7 +64,7 @@ type CodeBlockConfigOptions = {
|
|
|
64
64
|
|
|
65
65
|
export const shikiParserSymbol = Symbol.for("blocknote.shikiParser");
|
|
66
66
|
export const shikiHighlighterPromiseSymbol = Symbol.for(
|
|
67
|
-
"blocknote.shikiHighlighterPromise"
|
|
67
|
+
"blocknote.shikiHighlighterPromise",
|
|
68
68
|
);
|
|
69
69
|
export const defaultCodeBlockPropSchema = {
|
|
70
70
|
language: {
|
|
@@ -76,7 +76,7 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
76
76
|
name: "codeBlock",
|
|
77
77
|
content: "inline*",
|
|
78
78
|
group: "blockContent",
|
|
79
|
-
marks: "",
|
|
79
|
+
marks: "insertion deletion modification",
|
|
80
80
|
code: true,
|
|
81
81
|
defining: true,
|
|
82
82
|
addOptions() {
|
|
@@ -152,7 +152,7 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
152
152
|
// Parse from external HTML.
|
|
153
153
|
{
|
|
154
154
|
tag: "pre",
|
|
155
|
-
contentElement: "code",
|
|
155
|
+
// contentElement: "code",
|
|
156
156
|
preserveWhitespace: "full",
|
|
157
157
|
},
|
|
158
158
|
];
|
|
@@ -166,7 +166,7 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
166
166
|
{
|
|
167
167
|
...(this.options.domAttributes?.inlineContent || {}),
|
|
168
168
|
...HTMLAttributes,
|
|
169
|
-
}
|
|
169
|
+
},
|
|
170
170
|
);
|
|
171
171
|
|
|
172
172
|
dom.removeChild(contentDOM);
|
|
@@ -192,7 +192,7 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
192
192
|
...(this.options.domAttributes?.blockContent || {}),
|
|
193
193
|
...HTMLAttributes,
|
|
194
194
|
},
|
|
195
|
-
this.options.domAttributes?.inlineContent || {}
|
|
195
|
+
this.options.domAttributes?.inlineContent || {},
|
|
196
196
|
);
|
|
197
197
|
const handleLanguageChange = (event: Event) => {
|
|
198
198
|
const language = (event.target as HTMLSelectElement).value;
|
|
@@ -205,7 +205,7 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
Object.entries(
|
|
208
|
-
options.editor.settings.codeBlock.supportedLanguages
|
|
208
|
+
options.editor.settings.codeBlock.supportedLanguages,
|
|
209
209
|
).forEach(([id, { name }]) => {
|
|
210
210
|
const option = document.createElement("option");
|
|
211
211
|
|
|
@@ -256,7 +256,7 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
256
256
|
if (process.env.NODE_ENV === "development" && !hasWarned) {
|
|
257
257
|
// eslint-disable-next-line no-console
|
|
258
258
|
console.log(
|
|
259
|
-
"For syntax highlighting of code blocks, you must provide a `codeBlock.createHighlighter` function"
|
|
259
|
+
"For syntax highlighting of code blocks, you must provide a `codeBlock.createHighlighter` function",
|
|
260
260
|
);
|
|
261
261
|
hasWarned = true;
|
|
262
262
|
}
|
|
@@ -270,12 +270,12 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
270
270
|
return globalThisForShiki[shikiHighlighterPromiseSymbol].then(
|
|
271
271
|
(createdHighlighter) => {
|
|
272
272
|
highlighter = createdHighlighter;
|
|
273
|
-
}
|
|
273
|
+
},
|
|
274
274
|
);
|
|
275
275
|
}
|
|
276
276
|
const language = getLanguageId(
|
|
277
277
|
options.editor.settings.codeBlock,
|
|
278
|
-
parserOptions.language
|
|
278
|
+
parserOptions.language!,
|
|
279
279
|
);
|
|
280
280
|
|
|
281
281
|
if (
|
|
@@ -331,7 +331,7 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
331
331
|
.canReplaceWith(
|
|
332
332
|
$start.index(-1),
|
|
333
333
|
$start.indexAfter(-1),
|
|
334
|
-
this.type
|
|
334
|
+
this.type,
|
|
335
335
|
)
|
|
336
336
|
) {
|
|
337
337
|
return null;
|
|
@@ -418,7 +418,7 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
418
418
|
$from.pos - $from.parentOffset + $from.parent.nodeSize,
|
|
419
419
|
{
|
|
420
420
|
type: "paragraph",
|
|
421
|
-
}
|
|
421
|
+
},
|
|
422
422
|
)
|
|
423
423
|
.run();
|
|
424
424
|
|
|
@@ -430,16 +430,16 @@ const CodeBlockContent = createStronglyTypedTiptapNode({
|
|
|
430
430
|
|
|
431
431
|
export const CodeBlock = createBlockSpecFromStronglyTypedTiptapNode(
|
|
432
432
|
CodeBlockContent,
|
|
433
|
-
defaultCodeBlockPropSchema
|
|
433
|
+
defaultCodeBlockPropSchema,
|
|
434
434
|
);
|
|
435
435
|
|
|
436
436
|
function getLanguageId(
|
|
437
437
|
options: CodeBlockOptions,
|
|
438
|
-
languageName: string
|
|
438
|
+
languageName: string,
|
|
439
439
|
): string | undefined {
|
|
440
440
|
return Object.entries(options.supportedLanguages).find(
|
|
441
441
|
([id, { aliases }]) => {
|
|
442
442
|
return aliases?.includes(languageName) || id === languageName;
|
|
443
|
-
}
|
|
443
|
+
},
|
|
444
444
|
)?.[0];
|
|
445
445
|
}
|
|
@@ -36,7 +36,7 @@ export const fileBlockConfig = {
|
|
|
36
36
|
|
|
37
37
|
export const fileRender = (
|
|
38
38
|
block: BlockFromConfig<typeof fileBlockConfig, any, any>,
|
|
39
|
-
editor: BlockNoteEditor<any, any, any
|
|
39
|
+
editor: BlockNoteEditor<any, any, any>,
|
|
40
40
|
) => {
|
|
41
41
|
return createFileBlockWrapper(block, editor);
|
|
42
42
|
};
|
|
@@ -69,7 +69,7 @@ export const fileParse = (element: HTMLElement) => {
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
export const fileToExternalHTML = (
|
|
72
|
-
block: BlockFromConfig<typeof fileBlockConfig, any, any
|
|
72
|
+
block: BlockFromConfig<typeof fileBlockConfig, any, any>,
|
|
73
73
|
) => {
|
|
74
74
|
if (!block.props.url) {
|
|
75
75
|
const div = document.createElement("p");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export const parseFigureElement = (
|
|
2
2
|
figureElement: HTMLElement,
|
|
3
|
-
targetTag: string
|
|
3
|
+
targetTag: string,
|
|
4
4
|
) => {
|
|
5
5
|
const targetElement = figureElement.querySelector(
|
|
6
|
-
targetTag
|
|
6
|
+
targetTag,
|
|
7
7
|
) as HTMLElement | null;
|
|
8
8
|
if (!targetElement) {
|
|
9
9
|
return undefined;
|
|
@@ -5,7 +5,7 @@ export const createAddFileButton = (
|
|
|
5
5
|
block: BlockFromConfig<FileBlockConfig, any, any>,
|
|
6
6
|
editor: BlockNoteEditor<any, any, any>,
|
|
7
7
|
buttonText?: string,
|
|
8
|
-
buttonIcon?: HTMLElement
|
|
8
|
+
buttonIcon?: HTMLElement,
|
|
9
9
|
) => {
|
|
10
10
|
const addFileButton = document.createElement("div");
|
|
11
11
|
addFileButton.className = "bn-add-file-button";
|
|
@@ -33,15 +33,15 @@ export const createAddFileButton = (
|
|
|
33
33
|
// Opens the file toolbar.
|
|
34
34
|
const addFileButtonClickHandler = () => {
|
|
35
35
|
editor.transact((tr) =>
|
|
36
|
-
tr.setMeta(editor.filePanel!.
|
|
36
|
+
tr.setMeta(editor.filePanel!.plugins[0], {
|
|
37
37
|
block: block,
|
|
38
|
-
})
|
|
38
|
+
}),
|
|
39
39
|
);
|
|
40
40
|
};
|
|
41
41
|
addFileButton.addEventListener(
|
|
42
42
|
"mousedown",
|
|
43
43
|
addFileButtonMouseDownHandler,
|
|
44
|
-
true
|
|
44
|
+
true,
|
|
45
45
|
);
|
|
46
46
|
addFileButton.addEventListener("click", addFileButtonClickHandler, true);
|
|
47
47
|
|
|
@@ -51,12 +51,12 @@ export const createAddFileButton = (
|
|
|
51
51
|
addFileButton.removeEventListener(
|
|
52
52
|
"mousedown",
|
|
53
53
|
addFileButtonMouseDownHandler,
|
|
54
|
-
true
|
|
54
|
+
true,
|
|
55
55
|
);
|
|
56
56
|
addFileButton.removeEventListener(
|
|
57
57
|
"click",
|
|
58
58
|
addFileButtonClickHandler,
|
|
59
|
-
true
|
|
59
|
+
true,
|
|
60
60
|
);
|
|
61
61
|
},
|
|
62
62
|
};
|
|
@@ -16,7 +16,7 @@ export const createFileBlockWrapper = (
|
|
|
16
16
|
>,
|
|
17
17
|
element?: { dom: HTMLElement; destroy?: () => void },
|
|
18
18
|
buttonText?: string,
|
|
19
|
-
buttonIcon?: HTMLElement
|
|
19
|
+
buttonIcon?: HTMLElement,
|
|
20
20
|
) => {
|
|
21
21
|
const wrapper = document.createElement("div");
|
|
22
22
|
wrapper.className = "bn-file-block-content-wrapper";
|
|
@@ -28,7 +28,7 @@ export const createFileBlockWrapper = (
|
|
|
28
28
|
block,
|
|
29
29
|
editor,
|
|
30
30
|
buttonText,
|
|
31
|
-
buttonIcon
|
|
31
|
+
buttonIcon,
|
|
32
32
|
);
|
|
33
33
|
wrapper.appendChild(addFileButton.dom);
|
|
34
34
|
|
|
@@ -3,7 +3,7 @@ import { BlockFromConfig, FileBlockConfig } from "../../../../schema/index.js";
|
|
|
3
3
|
export const FILE_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"></path></svg>`;
|
|
4
4
|
|
|
5
5
|
export const createFileNameWithIcon = (
|
|
6
|
-
block: BlockFromConfig<FileBlockConfig, any, any
|
|
6
|
+
block: BlockFromConfig<FileBlockConfig, any, any>,
|
|
7
7
|
): { dom: HTMLElement; destroy?: () => void } => {
|
|
8
8
|
const file = document.createElement("div");
|
|
9
9
|
file.className = "bn-file-name-with-icon";
|
|
@@ -8,14 +8,14 @@ export const createResizableFileBlockWrapper = (
|
|
|
8
8
|
element: { dom: HTMLElement; destroy?: () => void },
|
|
9
9
|
resizeHandlesContainerElement: HTMLElement,
|
|
10
10
|
buttonText: string,
|
|
11
|
-
buttonIcon: HTMLElement
|
|
11
|
+
buttonIcon: HTMLElement,
|
|
12
12
|
): { dom: HTMLElement; destroy: () => void } => {
|
|
13
13
|
const { dom, destroy } = createFileBlockWrapper(
|
|
14
14
|
block,
|
|
15
15
|
editor,
|
|
16
16
|
element,
|
|
17
17
|
buttonText,
|
|
18
|
-
buttonIcon
|
|
18
|
+
buttonIcon,
|
|
19
19
|
);
|
|
20
20
|
const wrapper = dom;
|
|
21
21
|
if (block.props.url && block.props.showPreview) {
|
|
@@ -93,7 +93,7 @@ export const createResizableFileBlockWrapper = (
|
|
|
93
93
|
// predetermined minimum width.
|
|
94
94
|
width = Math.min(
|
|
95
95
|
Math.max(newWidth, minWidth),
|
|
96
|
-
editor.domElement?.firstElementChild?.clientWidth || Number.MAX_VALUE
|
|
96
|
+
editor.domElement?.firstElementChild?.clientWidth || Number.MAX_VALUE,
|
|
97
97
|
);
|
|
98
98
|
wrapper.style.width = `${width}px`;
|
|
99
99
|
};
|
|
@@ -183,11 +183,11 @@ export const createResizableFileBlockWrapper = (
|
|
|
183
183
|
wrapper.addEventListener("mouseleave", wrapperMouseLeaveHandler);
|
|
184
184
|
leftResizeHandle.addEventListener(
|
|
185
185
|
"mousedown",
|
|
186
|
-
leftResizeHandleMouseDownHandler
|
|
186
|
+
leftResizeHandleMouseDownHandler,
|
|
187
187
|
);
|
|
188
188
|
rightResizeHandle.addEventListener(
|
|
189
189
|
"mousedown",
|
|
190
|
-
rightResizeHandleMouseDownHandler
|
|
190
|
+
rightResizeHandleMouseDownHandler,
|
|
191
191
|
);
|
|
192
192
|
|
|
193
193
|
return {
|
|
@@ -200,11 +200,11 @@ export const createResizableFileBlockWrapper = (
|
|
|
200
200
|
wrapper.removeEventListener("mouseleave", wrapperMouseLeaveHandler);
|
|
201
201
|
leftResizeHandle.removeEventListener(
|
|
202
202
|
"mousedown",
|
|
203
|
-
leftResizeHandleMouseDownHandler
|
|
203
|
+
leftResizeHandleMouseDownHandler,
|
|
204
204
|
);
|
|
205
205
|
rightResizeHandle.removeEventListener(
|
|
206
206
|
"mousedown",
|
|
207
|
-
rightResizeHandleMouseDownHandler
|
|
207
|
+
rightResizeHandleMouseDownHandler,
|
|
208
208
|
);
|
|
209
209
|
},
|
|
210
210
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @warning This function should only be used for development purposes, replace with your own backend!
|
|
5
5
|
*/
|
|
6
6
|
export const uploadToTmpFilesDotOrg_DEV_ONLY = async (
|
|
7
|
-
file: File
|
|
7
|
+
file: File,
|
|
8
8
|
): Promise<string> => {
|
|
9
9
|
const body = new FormData();
|
|
10
10
|
body.append("file", file);
|
|
@@ -15,6 +15,6 @@ export const uploadToTmpFilesDotOrg_DEV_ONLY = async (
|
|
|
15
15
|
});
|
|
16
16
|
return (await ret.json()).data.url.replace(
|
|
17
17
|
"tmpfiles.org/",
|
|
18
|
-
"tmpfiles.org/dl/"
|
|
18
|
+
"tmpfiles.org/dl/",
|
|
19
19
|
);
|
|
20
20
|
};
|
|
@@ -46,7 +46,7 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({
|
|
|
46
46
|
props: {
|
|
47
47
|
level: level as any,
|
|
48
48
|
},
|
|
49
|
-
})
|
|
49
|
+
}),
|
|
50
50
|
)
|
|
51
51
|
// Removes the "#" character(s) used to set the heading.
|
|
52
52
|
.deleteRange({ from: range.from, to: range.to })
|
|
@@ -75,7 +75,7 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({
|
|
|
75
75
|
props: {
|
|
76
76
|
level: 1 as any,
|
|
77
77
|
},
|
|
78
|
-
})
|
|
78
|
+
}),
|
|
79
79
|
);
|
|
80
80
|
},
|
|
81
81
|
"Mod-Alt-2": () => {
|
|
@@ -93,7 +93,7 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({
|
|
|
93
93
|
props: {
|
|
94
94
|
level: 2 as any,
|
|
95
95
|
},
|
|
96
|
-
})
|
|
96
|
+
}),
|
|
97
97
|
);
|
|
98
98
|
},
|
|
99
99
|
"Mod-Alt-3": () => {
|
|
@@ -111,7 +111,7 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({
|
|
|
111
111
|
props: {
|
|
112
112
|
level: 3 as any,
|
|
113
113
|
},
|
|
114
|
-
})
|
|
114
|
+
}),
|
|
115
115
|
);
|
|
116
116
|
},
|
|
117
117
|
};
|
|
@@ -150,12 +150,12 @@ const HeadingBlockContent = createStronglyTypedTiptapNode({
|
|
|
150
150
|
...(this.options.domAttributes?.blockContent || {}),
|
|
151
151
|
...HTMLAttributes,
|
|
152
152
|
},
|
|
153
|
-
this.options.domAttributes?.inlineContent || {}
|
|
153
|
+
this.options.domAttributes?.inlineContent || {},
|
|
154
154
|
);
|
|
155
155
|
},
|
|
156
156
|
});
|
|
157
157
|
|
|
158
158
|
export const Heading = createBlockSpecFromStronglyTypedTiptapNode(
|
|
159
159
|
HeadingBlockContent,
|
|
160
|
-
headingPropSchema
|
|
160
|
+
headingPropSchema,
|
|
161
161
|
);
|
|
@@ -52,7 +52,7 @@ export const imageBlockConfig = {
|
|
|
52
52
|
|
|
53
53
|
export const imageRender = (
|
|
54
54
|
block: BlockFromConfig<typeof imageBlockConfig, any, any>,
|
|
55
|
-
editor: BlockNoteEditor<any, any, any
|
|
55
|
+
editor: BlockNoteEditor<any, any, any>,
|
|
56
56
|
) => {
|
|
57
57
|
const icon = document.createElement("div");
|
|
58
58
|
icon.innerHTML = FILE_IMAGE_ICON_SVG;
|
|
@@ -81,12 +81,12 @@ export const imageRender = (
|
|
|
81
81
|
{ dom: imageWrapper },
|
|
82
82
|
imageWrapper,
|
|
83
83
|
editor.dictionary.file_blocks.image.add_button_text,
|
|
84
|
-
icon.firstElementChild as HTMLElement
|
|
84
|
+
icon.firstElementChild as HTMLElement,
|
|
85
85
|
);
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
export const imageParse = (
|
|
89
|
-
element: HTMLElement
|
|
89
|
+
element: HTMLElement,
|
|
90
90
|
): Partial<Props<typeof imageBlockConfig.propSchema>> | undefined => {
|
|
91
91
|
if (element.tagName === "IMG") {
|
|
92
92
|
// Ignore if parent figure has already been parsed.
|
|
@@ -115,7 +115,7 @@ export const imageParse = (
|
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
export const imageToExternalHTML = (
|
|
118
|
-
block: BlockFromConfig<typeof imageBlockConfig, any, any
|
|
118
|
+
block: BlockFromConfig<typeof imageBlockConfig, any, any>,
|
|
119
119
|
) => {
|
|
120
120
|
if (!block.props.url) {
|
|
121
121
|
const div = document.createElement("p");
|
package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts
CHANGED
|
@@ -41,7 +41,7 @@ const BulletListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
41
41
|
updateBlockCommand(blockInfo.bnBlock.beforePos, {
|
|
42
42
|
type: "bulletListItem",
|
|
43
43
|
props: {},
|
|
44
|
-
})
|
|
44
|
+
}),
|
|
45
45
|
)
|
|
46
46
|
// Removes the "-", "+", or "*" character used to set the list.
|
|
47
47
|
.deleteRange({ from: range.from, to: range.to });
|
|
@@ -66,7 +66,7 @@ const BulletListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
66
66
|
updateBlockCommand(blockInfo.bnBlock.beforePos, {
|
|
67
67
|
type: "bulletListItem",
|
|
68
68
|
props: {},
|
|
69
|
-
})
|
|
69
|
+
}),
|
|
70
70
|
);
|
|
71
71
|
},
|
|
72
72
|
};
|
|
@@ -122,12 +122,12 @@ const BulletListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
122
122
|
...(this.options.domAttributes?.blockContent || {}),
|
|
123
123
|
...HTMLAttributes,
|
|
124
124
|
},
|
|
125
|
-
this.options.domAttributes?.inlineContent || {}
|
|
125
|
+
this.options.domAttributes?.inlineContent || {},
|
|
126
126
|
);
|
|
127
127
|
},
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
export const BulletListItem = createBlockSpecFromStronglyTypedTiptapNode(
|
|
131
131
|
BulletListItemBlockContent,
|
|
132
|
-
bulletListItemPropSchema
|
|
132
|
+
bulletListItemPropSchema,
|
|
133
133
|
);
|
package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts
CHANGED
|
@@ -52,7 +52,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
52
52
|
props: {
|
|
53
53
|
checked: false as any,
|
|
54
54
|
},
|
|
55
|
-
})
|
|
55
|
+
}),
|
|
56
56
|
)
|
|
57
57
|
// Removes the characters used to set the list.
|
|
58
58
|
.deleteRange({ from: range.from, to: range.to });
|
|
@@ -77,7 +77,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
77
77
|
props: {
|
|
78
78
|
checked: true as any,
|
|
79
79
|
},
|
|
80
|
-
})
|
|
80
|
+
}),
|
|
81
81
|
)
|
|
82
82
|
// Removes the characters used to set the list.
|
|
83
83
|
.deleteRange({ from: range.from, to: range.to });
|
|
@@ -102,7 +102,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
102
102
|
updateBlockCommand(blockInfo.bnBlock.beforePos, {
|
|
103
103
|
type: "checkListItem",
|
|
104
104
|
props: {},
|
|
105
|
-
})
|
|
105
|
+
}),
|
|
106
106
|
);
|
|
107
107
|
},
|
|
108
108
|
};
|
|
@@ -155,7 +155,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
155
155
|
) {
|
|
156
156
|
const checkbox =
|
|
157
157
|
(element.querySelector(
|
|
158
|
-
"input[type=checkbox]"
|
|
158
|
+
"input[type=checkbox]",
|
|
159
159
|
) as HTMLInputElement) || null;
|
|
160
160
|
|
|
161
161
|
if (checkbox === null) {
|
|
@@ -196,7 +196,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
196
196
|
...(this.options.domAttributes?.blockContent || {}),
|
|
197
197
|
...HTMLAttributes,
|
|
198
198
|
},
|
|
199
|
-
this.options.domAttributes?.inlineContent || {}
|
|
199
|
+
this.options.domAttributes?.inlineContent || {},
|
|
200
200
|
);
|
|
201
201
|
|
|
202
202
|
dom.insertBefore(checkbox, contentDOM);
|
|
@@ -234,12 +234,12 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
234
234
|
if (typeof getPos !== "boolean") {
|
|
235
235
|
const beforeBlockContainerPos = getNearestBlockPos(
|
|
236
236
|
editor.state.doc,
|
|
237
|
-
getPos()
|
|
237
|
+
getPos(),
|
|
238
238
|
);
|
|
239
239
|
|
|
240
240
|
if (beforeBlockContainerPos.node.type.name !== "blockContainer") {
|
|
241
241
|
throw new Error(
|
|
242
|
-
`Expected blockContainer node, got ${beforeBlockContainerPos.node.type.name}
|
|
242
|
+
`Expected blockContainer node, got ${beforeBlockContainerPos.node.type.name}`,
|
|
243
243
|
);
|
|
244
244
|
}
|
|
245
245
|
|
|
@@ -249,7 +249,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
249
249
|
props: {
|
|
250
250
|
checked: checkbox.checked as any,
|
|
251
251
|
},
|
|
252
|
-
})
|
|
252
|
+
}),
|
|
253
253
|
);
|
|
254
254
|
}
|
|
255
255
|
};
|
|
@@ -262,7 +262,7 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
262
262
|
...(this.options.domAttributes?.blockContent || {}),
|
|
263
263
|
...HTMLAttributes,
|
|
264
264
|
},
|
|
265
|
-
this.options.domAttributes?.inlineContent || {}
|
|
265
|
+
this.options.domAttributes?.inlineContent || {},
|
|
266
266
|
);
|
|
267
267
|
|
|
268
268
|
if (typeof getPos !== "boolean") {
|
|
@@ -295,5 +295,5 @@ const checkListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
295
295
|
|
|
296
296
|
export const CheckListItem = createBlockSpecFromStronglyTypedTiptapNode(
|
|
297
297
|
checkListItemBlockContent,
|
|
298
|
-
checkListItemPropSchema
|
|
298
|
+
checkListItemPropSchema,
|
|
299
299
|
);
|
package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts
CHANGED
|
@@ -35,7 +35,7 @@ export const NumberedListIndexingPlugin = () => {
|
|
|
35
35
|
// first block in its nesting level, or the previous block is not an ordered list item.
|
|
36
36
|
|
|
37
37
|
const prevBlock = tr.doc.resolve(
|
|
38
|
-
blockInfo.bnBlock.beforePos
|
|
38
|
+
blockInfo.bnBlock.beforePos,
|
|
39
39
|
).nodeBefore;
|
|
40
40
|
|
|
41
41
|
if (prevBlock) {
|
package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts
CHANGED
|
@@ -65,7 +65,7 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
65
65
|
({
|
|
66
66
|
start: startIndex,
|
|
67
67
|
} as any),
|
|
68
|
-
})
|
|
68
|
+
}),
|
|
69
69
|
)
|
|
70
70
|
// Removes the "1." characters used to set the list.
|
|
71
71
|
.deleteRange({ from: range.from, to: range.to });
|
|
@@ -90,7 +90,7 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
90
90
|
updateBlockCommand(blockInfo.bnBlock.beforePos, {
|
|
91
91
|
type: "numberedListItem",
|
|
92
92
|
props: {},
|
|
93
|
-
})
|
|
93
|
+
}),
|
|
94
94
|
);
|
|
95
95
|
},
|
|
96
96
|
};
|
|
@@ -160,12 +160,12 @@ const NumberedListItemBlockContent = createStronglyTypedTiptapNode({
|
|
|
160
160
|
...(this.options.domAttributes?.blockContent || {}),
|
|
161
161
|
...HTMLAttributes,
|
|
162
162
|
},
|
|
163
|
-
this.options.domAttributes?.inlineContent || {}
|
|
163
|
+
this.options.domAttributes?.inlineContent || {},
|
|
164
164
|
);
|
|
165
165
|
},
|
|
166
166
|
});
|
|
167
167
|
|
|
168
168
|
export const NumberedListItem = createBlockSpecFromStronglyTypedTiptapNode(
|
|
169
169
|
NumberedListItemBlockContent,
|
|
170
|
-
numberedListItemPropSchema
|
|
170
|
+
numberedListItemPropSchema,
|
|
171
171
|
);
|