@blocknote/core 0.29.1 → 0.30.1
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/README.md +125 -0
- package/dist/blocknote.cjs +9 -9
- package/dist/blocknote.cjs.map +1 -1
- package/dist/blocknote.js +1501 -1359
- package/dist/blocknote.js.map +1 -1
- package/dist/comments.cjs.map +1 -1
- package/dist/comments.js.map +1 -1
- package/dist/locales.cjs +1 -1
- package/dist/locales.cjs.map +1 -1
- package/dist/locales.js +751 -9
- package/dist/locales.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/webpack-stats.json +1 -1
- package/package.json +7 -8
- package/src/api/README.md +1 -1
- package/src/api/blockManipulation/commands/insertBlocks/__snapshots__/insertBlocks.test.ts.snap +0 -7
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.test.ts +19 -14
- package/src/api/blockManipulation/commands/insertBlocks/insertBlocks.ts +5 -5
- package/src/api/blockManipulation/commands/mergeBlocks/__snapshots__/mergeBlocks.test.ts.snap +0 -5
- 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/__snapshots__/moveBlocks.test.ts.snap +0 -20
- 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/__snapshots__/replaceBlocks.test.ts.snap +0 -12
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.test.ts +12 -12
- package/src/api/blockManipulation/commands/replaceBlocks/replaceBlocks.ts +7 -7
- package/src/api/blockManipulation/commands/splitBlock/__snapshots__/splitBlock.test.ts.snap +0 -6
- 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 +0 -17
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +42 -42
- package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +18 -18
- package/src/api/blockManipulation/getBlock/getBlock.ts +9 -9
- package/src/api/blockManipulation/insertContentAt.ts +1 -1
- package/src/api/blockManipulation/selections/selection.ts +11 -11
- package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.test.ts +7 -7
- package/src/api/blockManipulation/selections/textCursorPosition/textCursorPosition.ts +6 -6
- 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 +21 -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 +26 -26
- package/src/api/nodeConversions/fragmentToBlocks.ts +1 -1
- package/src/api/nodeConversions/nodeToBlock.ts +37 -33
- 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 +4 -4
- package/src/api/positionMapping.test.ts +3 -3
- package/src/api/positionMapping.ts +5 -5
- package/src/blocks/AudioBlockContent/AudioBlockContent.ts +9 -4
- package/src/blocks/CodeBlockContent/CodeBlockContent.ts +40 -26
- package/src/blocks/FileBlockContent/FileBlockContent.ts +7 -2
- package/src/blocks/FileBlockContent/helpers/parse/parseFigureElement.ts +2 -2
- package/src/blocks/FileBlockContent/helpers/render/createAddFileButton.ts +5 -5
- 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 +15 -8
- 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 +9 -6
- package/src/blocks/ImageBlockContent/ImageBlockContent.ts +14 -6
- package/src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts +13 -29
- package/src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts +24 -13
- package/src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts +1 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts +1 -1
- package/src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts +13 -30
- package/src/blocks/ListItemBlockContent/getListItemContent.ts +115 -0
- 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 +9 -5
- package/src/blocks/QuoteBlockContent/QuoteBlockContent.ts +10 -5
- package/src/blocks/README.md +1 -1
- package/src/blocks/TableBlockContent/TableBlockContent.ts +76 -19
- package/src/blocks/TableBlockContent/TableExtension.ts +3 -3
- package/src/blocks/VideoBlockContent/VideoBlockContent.ts +14 -6
- package/src/blocks/defaultBlockHelpers.ts +24 -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 +10 -1
- package/src/editor/BlockNoteEditor.test.ts +3 -3
- package/src/editor/BlockNoteEditor.ts +110 -61
- package/src/editor/BlockNoteExtensions.ts +24 -15
- package/src/editor/BlockNoteSchema.ts +4 -4
- package/src/editor/BlockNoteTipTapEditor.ts +10 -10
- 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 +152 -0
- package/src/extensions/Collaboration/SyncPlugin.ts +15 -0
- package/src/extensions/Collaboration/UndoPlugin.ts +14 -0
- package/src/extensions/Comments/CommentsPlugin.ts +9 -9
- package/src/extensions/Comments/userstore/UserStore.ts +2 -2
- package/src/extensions/FilePanel/FilePanelPlugin.ts +37 -28
- package/src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts +6 -8
- package/src/extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +29 -26
- package/src/extensions/LinkToolbar/LinkToolbarPlugin.ts +11 -11
- package/src/extensions/NodeSelectionKeyboard/NodeSelectionKeyboardPlugin.ts +4 -4
- package/src/extensions/Placeholder/PlaceholderPlugin.ts +10 -10
- package/src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts +2 -2
- package/src/extensions/README.md +1 -1
- package/src/extensions/SideMenu/MultipleNodeSelection.ts +1 -1
- package/src/extensions/SideMenu/SideMenuPlugin.ts +31 -31
- package/src/extensions/SideMenu/dragging.ts +8 -8
- package/src/extensions/SuggestionMenu/SuggestionPlugin.ts +17 -17
- package/src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts +2 -2
- package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +12 -12
- package/src/extensions/TableHandles/TableHandlesPlugin.ts +54 -53
- 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/index.ts +2 -0
- package/src/i18n/locales/ru.ts +2 -2
- package/src/i18n/locales/sk.ts +355 -0
- package/src/i18n/locales/zh-tw.ts +390 -0
- package/src/locales.ts +1 -1
- package/src/pm-nodes/BlockContainer.ts +7 -6
- package/src/pm-nodes/BlockGroup.ts +1 -1
- package/src/pm-nodes/Doc.ts +4 -4
- package/src/schema/README.md +1 -1
- package/src/schema/blocks/createSpec.ts +15 -15
- package/src/schema/blocks/internal.ts +17 -18
- package/src/schema/blocks/types.ts +27 -26
- 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/setupTestEnv.d.ts +8 -4
- package/types/src/blocks/ImageBlockContent/ImageBlockContent.d.ts +8 -4
- package/types/src/blocks/ListItemBlockContent/getListItemContent.d.ts +28 -0
- package/types/src/blocks/VideoBlockContent/VideoBlockContent.d.ts +8 -4
- package/types/src/blocks/defaultBlockHelpers.d.ts +1 -0
- package/types/src/blocks/defaultBlocks.d.ts +16 -8
- package/types/src/editor/BlockNoteEditor.d.ts +21 -2
- package/types/src/extensions/Collaboration/CursorPlugin.d.ts +31 -0
- package/types/src/extensions/Collaboration/SyncPlugin.d.ts +7 -0
- package/types/src/extensions/Collaboration/UndoPlugin.d.ts +6 -0
- package/types/src/extensions/FilePanel/FilePanelPlugin.d.ts +1 -1
- package/types/src/i18n/locales/index.d.ts +2 -0
- package/types/src/i18n/locales/sk.d.ts +313 -0
- package/types/src/i18n/locales/zh-tw.d.ts +2 -0
- package/types/src/schema/blocks/types.d.ts +2 -1
- package/src/extensions/Collaboration/createCollaborationExtensions.ts +0 -147
- package/types/src/extensions/Collaboration/createCollaborationExtensions.d.ts +0 -17
|
@@ -248,7 +248,6 @@ exports[`Test splitBlocks > Basic 1`] = `
|
|
|
248
248
|
"backgroundColor": "default",
|
|
249
249
|
"caption": "",
|
|
250
250
|
"name": "",
|
|
251
|
-
"previewWidth": 512,
|
|
252
251
|
"showPreview": true,
|
|
253
252
|
"textAlignment": "left",
|
|
254
253
|
"url": "https://via.placeholder.com/150",
|
|
@@ -832,7 +831,6 @@ exports[`Test splitBlocks > Block has children 1`] = `
|
|
|
832
831
|
"backgroundColor": "default",
|
|
833
832
|
"caption": "",
|
|
834
833
|
"name": "",
|
|
835
|
-
"previewWidth": 512,
|
|
836
834
|
"showPreview": true,
|
|
837
835
|
"textAlignment": "left",
|
|
838
836
|
"url": "https://via.placeholder.com/150",
|
|
@@ -1416,7 +1414,6 @@ exports[`Test splitBlocks > Don't keep props 1`] = `
|
|
|
1416
1414
|
"backgroundColor": "default",
|
|
1417
1415
|
"caption": "",
|
|
1418
1416
|
"name": "",
|
|
1419
|
-
"previewWidth": 512,
|
|
1420
1417
|
"showPreview": true,
|
|
1421
1418
|
"textAlignment": "left",
|
|
1422
1419
|
"url": "https://via.placeholder.com/150",
|
|
@@ -2000,7 +1997,6 @@ exports[`Test splitBlocks > Don't keep type 1`] = `
|
|
|
2000
1997
|
"backgroundColor": "default",
|
|
2001
1998
|
"caption": "",
|
|
2002
1999
|
"name": "",
|
|
2003
|
-
"previewWidth": 512,
|
|
2004
2000
|
"showPreview": true,
|
|
2005
2001
|
"textAlignment": "left",
|
|
2006
2002
|
"url": "https://via.placeholder.com/150",
|
|
@@ -2578,7 +2574,6 @@ exports[`Test splitBlocks > End of content 1`] = `
|
|
|
2578
2574
|
"backgroundColor": "default",
|
|
2579
2575
|
"caption": "",
|
|
2580
2576
|
"name": "",
|
|
2581
|
-
"previewWidth": 512,
|
|
2582
2577
|
"showPreview": true,
|
|
2583
2578
|
"textAlignment": "left",
|
|
2584
2579
|
"url": "https://via.placeholder.com/150",
|
|
@@ -3163,7 +3158,6 @@ exports[`Test splitBlocks > Keep type 1`] = `
|
|
|
3163
3158
|
"backgroundColor": "default",
|
|
3164
3159
|
"caption": "",
|
|
3165
3160
|
"name": "",
|
|
3166
|
-
"previewWidth": 512,
|
|
3167
3161
|
"showPreview": true,
|
|
3168
3162
|
"textAlignment": "left",
|
|
3169
3163
|
"url": "https://via.placeholder.com/150",
|
|
@@ -15,17 +15,17 @@ const getEditor = setupTestEnv();
|
|
|
15
15
|
function splitBlock(
|
|
16
16
|
posInBlock: number,
|
|
17
17
|
keepType?: boolean,
|
|
18
|
-
keepProps?: boolean
|
|
18
|
+
keepProps?: boolean,
|
|
19
19
|
) {
|
|
20
20
|
getEditor()._tiptapEditor.commands.command(
|
|
21
|
-
splitBlockCommand(posInBlock, keepType, keepProps)
|
|
21
|
+
splitBlockCommand(posInBlock, keepType, keepProps),
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
function setSelectionWithOffset(
|
|
26
26
|
doc: Node,
|
|
27
27
|
targetBlockId: string,
|
|
28
|
-
offset: number
|
|
28
|
+
offset: number,
|
|
29
29
|
) {
|
|
30
30
|
const posInfo = getNodeById(targetBlockId, doc);
|
|
31
31
|
if (!posInfo) {
|
|
@@ -40,8 +40,8 @@ function setSelectionWithOffset(
|
|
|
40
40
|
|
|
41
41
|
getEditor().transact((tr) =>
|
|
42
42
|
tr.setSelection(
|
|
43
|
-
TextSelection.create(doc, info.blockContent.beforePos + offset + 1)
|
|
44
|
-
)
|
|
43
|
+
TextSelection.create(doc, info.blockContent.beforePos + offset + 1),
|
|
44
|
+
),
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -83,7 +83,7 @@ describe("Test splitBlocks", () => {
|
|
|
83
83
|
|
|
84
84
|
splitBlock(
|
|
85
85
|
getEditor().transact((tr) => tr.selection.anchor),
|
|
86
|
-
true
|
|
86
|
+
true,
|
|
87
87
|
);
|
|
88
88
|
|
|
89
89
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -96,7 +96,7 @@ describe("Test splitBlocks", () => {
|
|
|
96
96
|
|
|
97
97
|
splitBlock(
|
|
98
98
|
getEditor().transact((tr) => tr.selection.anchor),
|
|
99
|
-
false
|
|
99
|
+
false,
|
|
100
100
|
);
|
|
101
101
|
|
|
102
102
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -110,7 +110,7 @@ describe("Test splitBlocks", () => {
|
|
|
110
110
|
splitBlock(
|
|
111
111
|
getEditor().transact((tr) => tr.selection.anchor),
|
|
112
112
|
false,
|
|
113
|
-
true
|
|
113
|
+
true,
|
|
114
114
|
);
|
|
115
115
|
|
|
116
116
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -124,7 +124,7 @@ describe("Test splitBlocks", () => {
|
|
|
124
124
|
splitBlock(
|
|
125
125
|
getEditor().transact((tr) => tr.selection.anchor),
|
|
126
126
|
false,
|
|
127
|
-
false
|
|
127
|
+
false,
|
|
128
128
|
);
|
|
129
129
|
|
|
130
130
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -138,7 +138,7 @@ describe("Test splitBlocks", () => {
|
|
|
138
138
|
splitBlock(getEditor().transact((tr) => tr.selection.anchor));
|
|
139
139
|
|
|
140
140
|
const bnBlock = getEditor().transact(
|
|
141
|
-
(tr) => getBlockInfoFromTransaction(tr).bnBlock
|
|
141
|
+
(tr) => getBlockInfoFromTransaction(tr).bnBlock,
|
|
142
142
|
);
|
|
143
143
|
|
|
144
144
|
const anchorIsAtStartOfNewBlock =
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
export const splitBlockCommand = (
|
|
9
9
|
posInBlock: number,
|
|
10
10
|
keepType?: boolean,
|
|
11
|
-
keepProps?: boolean
|
|
11
|
+
keepProps?: boolean,
|
|
12
12
|
) => {
|
|
13
13
|
return ({
|
|
14
14
|
state,
|
|
@@ -23,7 +23,7 @@ export const splitBlockCommand = (
|
|
|
23
23
|
|
|
24
24
|
if (!info.isBlockContainer) {
|
|
25
25
|
throw new Error(
|
|
26
|
-
`BlockContainer expected when calling splitBlock, position ${posInBlock}
|
|
26
|
+
`BlockContainer expected when calling splitBlock, position ${posInBlock}`,
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap
CHANGED
|
@@ -302,7 +302,6 @@ exports[`Test updateBlock > Revert all props 2`] = `
|
|
|
302
302
|
"backgroundColor": "default",
|
|
303
303
|
"caption": "",
|
|
304
304
|
"name": "",
|
|
305
|
-
"previewWidth": 512,
|
|
306
305
|
"showPreview": true,
|
|
307
306
|
"textAlignment": "left",
|
|
308
307
|
"url": "https://via.placeholder.com/150",
|
|
@@ -940,7 +939,6 @@ exports[`Test updateBlock > Revert single prop 2`] = `
|
|
|
940
939
|
"backgroundColor": "default",
|
|
941
940
|
"caption": "",
|
|
942
941
|
"name": "",
|
|
943
|
-
"previewWidth": 512,
|
|
944
942
|
"showPreview": true,
|
|
945
943
|
"textAlignment": "left",
|
|
946
944
|
"url": "https://via.placeholder.com/150",
|
|
@@ -1578,7 +1576,6 @@ exports[`Test updateBlock > Update all props 2`] = `
|
|
|
1578
1576
|
"backgroundColor": "default",
|
|
1579
1577
|
"caption": "",
|
|
1580
1578
|
"name": "",
|
|
1581
|
-
"previewWidth": 512,
|
|
1582
1579
|
"showPreview": true,
|
|
1583
1580
|
"textAlignment": "left",
|
|
1584
1581
|
"url": "https://via.placeholder.com/150",
|
|
@@ -2216,7 +2213,6 @@ exports[`Test updateBlock > Update children 2`] = `
|
|
|
2216
2213
|
"backgroundColor": "default",
|
|
2217
2214
|
"caption": "",
|
|
2218
2215
|
"name": "",
|
|
2219
|
-
"previewWidth": 512,
|
|
2220
2216
|
"showPreview": true,
|
|
2221
2217
|
"textAlignment": "left",
|
|
2222
2218
|
"url": "https://via.placeholder.com/150",
|
|
@@ -2561,7 +2557,6 @@ exports[`Test updateBlock > Update inline content to no content 1`] = `
|
|
|
2561
2557
|
"backgroundColor": "default",
|
|
2562
2558
|
"caption": "",
|
|
2563
2559
|
"name": "",
|
|
2564
|
-
"previewWidth": 512,
|
|
2565
2560
|
"showPreview": true,
|
|
2566
2561
|
"textAlignment": "left",
|
|
2567
2562
|
"url": "",
|
|
@@ -2580,7 +2575,6 @@ exports[`Test updateBlock > Update inline content to no content 2`] = `
|
|
|
2580
2575
|
"backgroundColor": "default",
|
|
2581
2576
|
"caption": "",
|
|
2582
2577
|
"name": "",
|
|
2583
|
-
"previewWidth": 512,
|
|
2584
2578
|
"showPreview": true,
|
|
2585
2579
|
"textAlignment": "left",
|
|
2586
2580
|
"url": "",
|
|
@@ -2799,7 +2793,6 @@ exports[`Test updateBlock > Update inline content to no content 2`] = `
|
|
|
2799
2793
|
"backgroundColor": "default",
|
|
2800
2794
|
"caption": "",
|
|
2801
2795
|
"name": "",
|
|
2802
|
-
"previewWidth": 512,
|
|
2803
2796
|
"showPreview": true,
|
|
2804
2797
|
"textAlignment": "left",
|
|
2805
2798
|
"url": "https://via.placeholder.com/150",
|
|
@@ -3722,7 +3715,6 @@ exports[`Test updateBlock > Update inline content to table content 2`] = `
|
|
|
3722
3715
|
"backgroundColor": "default",
|
|
3723
3716
|
"caption": "",
|
|
3724
3717
|
"name": "",
|
|
3725
|
-
"previewWidth": 512,
|
|
3726
3718
|
"showPreview": true,
|
|
3727
3719
|
"textAlignment": "left",
|
|
3728
3720
|
"url": "https://via.placeholder.com/150",
|
|
@@ -7032,7 +7024,6 @@ exports[`Test updateBlock > Update single prop 2`] = `
|
|
|
7032
7024
|
"backgroundColor": "default",
|
|
7033
7025
|
"caption": "",
|
|
7034
7026
|
"name": "",
|
|
7035
|
-
"previewWidth": 512,
|
|
7036
7027
|
"showPreview": true,
|
|
7037
7028
|
"textAlignment": "left",
|
|
7038
7029
|
"url": "https://via.placeholder.com/150",
|
|
@@ -7613,7 +7604,6 @@ exports[`Test updateBlock > Update table content to empty inline content 2`] = `
|
|
|
7613
7604
|
"backgroundColor": "default",
|
|
7614
7605
|
"caption": "",
|
|
7615
7606
|
"name": "",
|
|
7616
|
-
"previewWidth": 512,
|
|
7617
7607
|
"showPreview": true,
|
|
7618
7608
|
"textAlignment": "left",
|
|
7619
7609
|
"url": "https://via.placeholder.com/150",
|
|
@@ -8026,7 +8016,6 @@ exports[`Test updateBlock > Update table content to inline content 2`] = `
|
|
|
8026
8016
|
"backgroundColor": "default",
|
|
8027
8017
|
"caption": "",
|
|
8028
8018
|
"name": "",
|
|
8029
|
-
"previewWidth": 512,
|
|
8030
8019
|
"showPreview": true,
|
|
8031
8020
|
"textAlignment": "left",
|
|
8032
8021
|
"url": "https://via.placeholder.com/150",
|
|
@@ -8203,7 +8192,6 @@ exports[`Test updateBlock > Update table content to no content 1`] = `
|
|
|
8203
8192
|
"backgroundColor": "default",
|
|
8204
8193
|
"caption": "",
|
|
8205
8194
|
"name": "",
|
|
8206
|
-
"previewWidth": 512,
|
|
8207
8195
|
"showPreview": true,
|
|
8208
8196
|
"textAlignment": "left",
|
|
8209
8197
|
"url": "",
|
|
@@ -8443,7 +8431,6 @@ exports[`Test updateBlock > Update table content to no content 2`] = `
|
|
|
8443
8431
|
"backgroundColor": "default",
|
|
8444
8432
|
"caption": "",
|
|
8445
8433
|
"name": "",
|
|
8446
|
-
"previewWidth": 512,
|
|
8447
8434
|
"showPreview": true,
|
|
8448
8435
|
"textAlignment": "left",
|
|
8449
8436
|
"url": "https://via.placeholder.com/150",
|
|
@@ -8475,7 +8462,6 @@ exports[`Test updateBlock > Update table content to no content 2`] = `
|
|
|
8475
8462
|
"backgroundColor": "default",
|
|
8476
8463
|
"caption": "",
|
|
8477
8464
|
"name": "",
|
|
8478
|
-
"previewWidth": 512,
|
|
8479
8465
|
"showPreview": true,
|
|
8480
8466
|
"textAlignment": "left",
|
|
8481
8467
|
"url": "",
|
|
@@ -8910,7 +8896,6 @@ exports[`Test updateBlock > Update type 2`] = `
|
|
|
8910
8896
|
"backgroundColor": "default",
|
|
8911
8897
|
"caption": "",
|
|
8912
8898
|
"name": "",
|
|
8913
|
-
"previewWidth": 512,
|
|
8914
8899
|
"showPreview": true,
|
|
8915
8900
|
"textAlignment": "left",
|
|
8916
8901
|
"url": "https://via.placeholder.com/150",
|
|
@@ -9533,7 +9518,6 @@ exports[`Test updateBlock > Update with plain content 2`] = `
|
|
|
9533
9518
|
"backgroundColor": "default",
|
|
9534
9519
|
"caption": "",
|
|
9535
9520
|
"name": "",
|
|
9536
|
-
"previewWidth": 512,
|
|
9537
9521
|
"showPreview": true,
|
|
9538
9522
|
"textAlignment": "left",
|
|
9539
9523
|
"url": "https://via.placeholder.com/150",
|
|
@@ -10157,7 +10141,6 @@ exports[`Test updateBlock > Update with styled content 2`] = `
|
|
|
10157
10141
|
"backgroundColor": "default",
|
|
10158
10142
|
"caption": "",
|
|
10159
10143
|
"name": "",
|
|
10160
|
-
"previewWidth": 512,
|
|
10161
10144
|
"showPreview": true,
|
|
10162
10145
|
"textAlignment": "left",
|
|
10163
10146
|
"url": "https://via.placeholder.com/150",
|
|
@@ -13,7 +13,7 @@ describe("Test updateBlock typing", () => {
|
|
|
13
13
|
{
|
|
14
14
|
// @ts-expect-error invalid type
|
|
15
15
|
type: "non-existing",
|
|
16
|
-
}
|
|
16
|
+
},
|
|
17
17
|
);
|
|
18
18
|
} catch (e) {
|
|
19
19
|
// ID doesn't exist, which is fine - this is a compile-time check
|
|
@@ -30,7 +30,7 @@ describe("Test updateBlock typing", () => {
|
|
|
30
30
|
// @ts-expect-error invalid type
|
|
31
31
|
level: 1,
|
|
32
32
|
},
|
|
33
|
-
}
|
|
33
|
+
},
|
|
34
34
|
);
|
|
35
35
|
} catch (e) {
|
|
36
36
|
// ID doesn't exist, which is fine - this is a compile-time check
|
|
@@ -43,7 +43,7 @@ describe("Test updateBlock typing", () => {
|
|
|
43
43
|
props: {
|
|
44
44
|
level: 1,
|
|
45
45
|
},
|
|
46
|
-
}
|
|
46
|
+
},
|
|
47
47
|
);
|
|
48
48
|
} catch (e) {
|
|
49
49
|
// ID doesn't exist, which is fine - this is a compile-time check
|
|
@@ -57,8 +57,8 @@ describe("Test updateBlock", () => {
|
|
|
57
57
|
getEditor().transact((tr) =>
|
|
58
58
|
updateBlock(tr, "heading-with-everything", {
|
|
59
59
|
id: "new-id",
|
|
60
|
-
})
|
|
61
|
-
)
|
|
60
|
+
}),
|
|
61
|
+
),
|
|
62
62
|
).toMatchSnapshot();
|
|
63
63
|
expect(getEditor().document).toMatchSnapshot();
|
|
64
64
|
});
|
|
@@ -68,8 +68,8 @@ describe("Test updateBlock", () => {
|
|
|
68
68
|
getEditor().transact((tr) =>
|
|
69
69
|
updateBlock(tr, "heading-with-everything", {
|
|
70
70
|
type: "paragraph",
|
|
71
|
-
})
|
|
72
|
-
)
|
|
71
|
+
}),
|
|
72
|
+
),
|
|
73
73
|
).toMatchSnapshot();
|
|
74
74
|
|
|
75
75
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -82,8 +82,8 @@ describe("Test updateBlock", () => {
|
|
|
82
82
|
props: {
|
|
83
83
|
level: 3,
|
|
84
84
|
},
|
|
85
|
-
})
|
|
86
|
-
)
|
|
85
|
+
}),
|
|
86
|
+
),
|
|
87
87
|
).toMatchSnapshot();
|
|
88
88
|
|
|
89
89
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -99,8 +99,8 @@ describe("Test updateBlock", () => {
|
|
|
99
99
|
textAlignment: "right",
|
|
100
100
|
textColor: "blue",
|
|
101
101
|
},
|
|
102
|
-
})
|
|
103
|
-
)
|
|
102
|
+
}),
|
|
103
|
+
),
|
|
104
104
|
).toMatchSnapshot();
|
|
105
105
|
|
|
106
106
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -113,8 +113,8 @@ describe("Test updateBlock", () => {
|
|
|
113
113
|
props: {
|
|
114
114
|
level: undefined,
|
|
115
115
|
},
|
|
116
|
-
})
|
|
117
|
-
)
|
|
116
|
+
}),
|
|
117
|
+
),
|
|
118
118
|
).toMatchSnapshot();
|
|
119
119
|
|
|
120
120
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -130,8 +130,8 @@ describe("Test updateBlock", () => {
|
|
|
130
130
|
textAlignment: undefined,
|
|
131
131
|
textColor: undefined,
|
|
132
132
|
},
|
|
133
|
-
})
|
|
134
|
-
)
|
|
133
|
+
}),
|
|
134
|
+
),
|
|
135
135
|
).toMatchSnapshot();
|
|
136
136
|
|
|
137
137
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -142,8 +142,8 @@ describe("Test updateBlock", () => {
|
|
|
142
142
|
getEditor().transact((tr) =>
|
|
143
143
|
updateBlock(tr, "heading-with-everything", {
|
|
144
144
|
content: "New content",
|
|
145
|
-
})
|
|
146
|
-
)
|
|
145
|
+
}),
|
|
146
|
+
),
|
|
147
147
|
).toMatchSnapshot();
|
|
148
148
|
|
|
149
149
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -166,8 +166,8 @@ describe("Test updateBlock", () => {
|
|
|
166
166
|
styles: { backgroundColor: "blue" },
|
|
167
167
|
},
|
|
168
168
|
],
|
|
169
|
-
})
|
|
170
|
-
)
|
|
169
|
+
}),
|
|
170
|
+
),
|
|
171
171
|
).toMatchSnapshot();
|
|
172
172
|
|
|
173
173
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -191,8 +191,8 @@ describe("Test updateBlock", () => {
|
|
|
191
191
|
],
|
|
192
192
|
},
|
|
193
193
|
],
|
|
194
|
-
})
|
|
195
|
-
)
|
|
194
|
+
}),
|
|
195
|
+
),
|
|
196
196
|
).toMatchSnapshot();
|
|
197
197
|
|
|
198
198
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -236,8 +236,8 @@ describe("Test updateBlock", () => {
|
|
|
236
236
|
],
|
|
237
237
|
},
|
|
238
238
|
],
|
|
239
|
-
})
|
|
240
|
-
)
|
|
239
|
+
}),
|
|
240
|
+
),
|
|
241
241
|
).toMatchSnapshot();
|
|
242
242
|
|
|
243
243
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -248,7 +248,7 @@ describe("Test updateBlock", () => {
|
|
|
248
248
|
getEditor().transact((tr) =>
|
|
249
249
|
updateBlock(tr, "paragraph-0", {
|
|
250
250
|
type: "table",
|
|
251
|
-
})
|
|
251
|
+
}),
|
|
252
252
|
);
|
|
253
253
|
}).toThrow();
|
|
254
254
|
});
|
|
@@ -258,8 +258,8 @@ describe("Test updateBlock", () => {
|
|
|
258
258
|
getEditor().transact((tr) =>
|
|
259
259
|
updateBlock(tr, "table-0", {
|
|
260
260
|
type: "paragraph",
|
|
261
|
-
})
|
|
262
|
-
)
|
|
261
|
+
}),
|
|
262
|
+
),
|
|
263
263
|
).toMatchSnapshot();
|
|
264
264
|
|
|
265
265
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -284,8 +284,8 @@ describe("Test updateBlock", () => {
|
|
|
284
284
|
},
|
|
285
285
|
],
|
|
286
286
|
},
|
|
287
|
-
})
|
|
288
|
-
)
|
|
287
|
+
}),
|
|
288
|
+
),
|
|
289
289
|
).toMatchSnapshot();
|
|
290
290
|
|
|
291
291
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -297,8 +297,8 @@ describe("Test updateBlock", () => {
|
|
|
297
297
|
updateBlock(tr, "table-0", {
|
|
298
298
|
type: "paragraph",
|
|
299
299
|
content: "Paragraph",
|
|
300
|
-
})
|
|
301
|
-
)
|
|
300
|
+
}),
|
|
301
|
+
),
|
|
302
302
|
).toMatchSnapshot();
|
|
303
303
|
|
|
304
304
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -309,8 +309,8 @@ describe("Test updateBlock", () => {
|
|
|
309
309
|
getEditor().transact((tr) =>
|
|
310
310
|
updateBlock(tr, "paragraph-0", {
|
|
311
311
|
type: "image",
|
|
312
|
-
})
|
|
313
|
-
)
|
|
312
|
+
}),
|
|
313
|
+
),
|
|
314
314
|
).toMatchSnapshot();
|
|
315
315
|
|
|
316
316
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -321,8 +321,8 @@ describe("Test updateBlock", () => {
|
|
|
321
321
|
getEditor().transact((tr) =>
|
|
322
322
|
updateBlock(tr, "image-0", {
|
|
323
323
|
type: "paragraph",
|
|
324
|
-
})
|
|
325
|
-
)
|
|
324
|
+
}),
|
|
325
|
+
),
|
|
326
326
|
).toMatchSnapshot();
|
|
327
327
|
|
|
328
328
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -334,8 +334,8 @@ describe("Test updateBlock", () => {
|
|
|
334
334
|
updateBlock(tr, "image-0", {
|
|
335
335
|
type: "paragraph",
|
|
336
336
|
content: "Paragraph",
|
|
337
|
-
})
|
|
338
|
-
)
|
|
337
|
+
}),
|
|
338
|
+
),
|
|
339
339
|
).toMatchSnapshot();
|
|
340
340
|
|
|
341
341
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -346,8 +346,8 @@ describe("Test updateBlock", () => {
|
|
|
346
346
|
getEditor().transact((tr) =>
|
|
347
347
|
updateBlock(tr, "image-0", {
|
|
348
348
|
type: "table",
|
|
349
|
-
})
|
|
350
|
-
)
|
|
349
|
+
}),
|
|
350
|
+
),
|
|
351
351
|
).toMatchSnapshot();
|
|
352
352
|
|
|
353
353
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -399,8 +399,8 @@ describe("Test updateBlock", () => {
|
|
|
399
399
|
},
|
|
400
400
|
],
|
|
401
401
|
},
|
|
402
|
-
})
|
|
403
|
-
)
|
|
402
|
+
}),
|
|
403
|
+
),
|
|
404
404
|
).toMatchSnapshot();
|
|
405
405
|
|
|
406
406
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -411,8 +411,8 @@ describe("Test updateBlock", () => {
|
|
|
411
411
|
getEditor().transact((tr) =>
|
|
412
412
|
updateBlock(tr, "table-0", {
|
|
413
413
|
type: "image",
|
|
414
|
-
})
|
|
415
|
-
)
|
|
414
|
+
}),
|
|
415
|
+
),
|
|
416
416
|
).toMatchSnapshot();
|
|
417
417
|
|
|
418
418
|
expect(getEditor().document).toMatchSnapshot();
|
|
@@ -31,10 +31,10 @@ import { getPmSchema } from "../../../pmUtil.js";
|
|
|
31
31
|
export const updateBlockCommand = <
|
|
32
32
|
BSchema extends BlockSchema,
|
|
33
33
|
I extends InlineContentSchema,
|
|
34
|
-
S extends StyleSchema
|
|
34
|
+
S extends StyleSchema,
|
|
35
35
|
>(
|
|
36
36
|
posBeforeBlock: number,
|
|
37
|
-
block: PartialBlock<BSchema, I, S
|
|
37
|
+
block: PartialBlock<BSchema, I, S>,
|
|
38
38
|
) => {
|
|
39
39
|
return ({
|
|
40
40
|
tr,
|
|
@@ -53,11 +53,11 @@ export const updateBlockCommand = <
|
|
|
53
53
|
const updateBlockTr = <
|
|
54
54
|
BSchema extends BlockSchema,
|
|
55
55
|
I extends InlineContentSchema,
|
|
56
|
-
S extends StyleSchema
|
|
56
|
+
S extends StyleSchema,
|
|
57
57
|
>(
|
|
58
58
|
tr: Transaction,
|
|
59
59
|
posBeforeBlock: number,
|
|
60
|
-
block: PartialBlock<BSchema, I, S
|
|
60
|
+
block: PartialBlock<BSchema, I, S>,
|
|
61
61
|
) => {
|
|
62
62
|
const blockInfo = getBlockInfoFromResolvedPos(tr.doc.resolve(posBeforeBlock));
|
|
63
63
|
|
|
@@ -96,8 +96,8 @@ const updateBlockTr = <
|
|
|
96
96
|
children: existingBlock.children, // if no children are passed in, use existing children
|
|
97
97
|
...block,
|
|
98
98
|
},
|
|
99
|
-
pmSchema
|
|
100
|
-
)
|
|
99
|
+
pmSchema,
|
|
100
|
+
),
|
|
101
101
|
);
|
|
102
102
|
|
|
103
103
|
return;
|
|
@@ -114,7 +114,7 @@ const updateBlockTr = <
|
|
|
114
114
|
function updateBlockContentNode<
|
|
115
115
|
BSchema extends BlockSchema,
|
|
116
116
|
I extends InlineContentSchema,
|
|
117
|
-
S extends StyleSchema
|
|
117
|
+
S extends StyleSchema,
|
|
118
118
|
>(
|
|
119
119
|
block: PartialBlock<BSchema, I, S>,
|
|
120
120
|
tr: Transaction,
|
|
@@ -125,7 +125,7 @@ function updateBlockContentNode<
|
|
|
125
125
|
| { node: PMNode; beforePos: number; afterPos: number }
|
|
126
126
|
| undefined;
|
|
127
127
|
blockContent: { node: PMNode; beforePos: number; afterPos: number };
|
|
128
|
-
}
|
|
128
|
+
},
|
|
129
129
|
) {
|
|
130
130
|
const pmSchema = getPmSchema(tr);
|
|
131
131
|
let content: PMNode[] | "keep" = "keep";
|
|
@@ -137,7 +137,7 @@ function updateBlockContentNode<
|
|
|
137
137
|
content = inlineContentToNodes(
|
|
138
138
|
[block.content],
|
|
139
139
|
pmSchema,
|
|
140
|
-
newNodeType.name
|
|
140
|
+
newNodeType.name,
|
|
141
141
|
);
|
|
142
142
|
} else if (Array.isArray(block.content)) {
|
|
143
143
|
// Adds a text node with the provided styles converted into marks to the content,
|
|
@@ -178,7 +178,7 @@ function updateBlockContentNode<
|
|
|
178
178
|
{
|
|
179
179
|
...blockInfo.blockContent.node.attrs,
|
|
180
180
|
...block.props,
|
|
181
|
-
}
|
|
181
|
+
},
|
|
182
182
|
);
|
|
183
183
|
} else {
|
|
184
184
|
// use replaceWith to replace the content and the block itself
|
|
@@ -192,8 +192,8 @@ function updateBlockContentNode<
|
|
|
192
192
|
...blockInfo.blockContent.node.attrs,
|
|
193
193
|
...block.props,
|
|
194
194
|
},
|
|
195
|
-
content
|
|
196
|
-
)
|
|
195
|
+
content,
|
|
196
|
+
),
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
199
|
}
|
|
@@ -201,7 +201,7 @@ function updateBlockContentNode<
|
|
|
201
201
|
function updateChildren<
|
|
202
202
|
BSchema extends BlockSchema,
|
|
203
203
|
I extends InlineContentSchema,
|
|
204
|
-
S extends StyleSchema
|
|
204
|
+
S extends StyleSchema,
|
|
205
205
|
>(block: PartialBlock<BSchema, I, S>, tr: Transaction, blockInfo: BlockInfo) {
|
|
206
206
|
const pmSchema = getPmSchema(tr);
|
|
207
207
|
if (block.children !== undefined && block.children.length > 0) {
|
|
@@ -218,8 +218,8 @@ function updateChildren<
|
|
|
218
218
|
new ReplaceStep(
|
|
219
219
|
blockInfo.childContainer.beforePos + 1,
|
|
220
220
|
blockInfo.childContainer.afterPos - 1,
|
|
221
|
-
new Slice(Fragment.from(childNodes), 0, 0)
|
|
222
|
-
)
|
|
221
|
+
new Slice(Fragment.from(childNodes), 0, 0),
|
|
222
|
+
),
|
|
223
223
|
);
|
|
224
224
|
} else {
|
|
225
225
|
if (!blockInfo.isBlockContainer) {
|
|
@@ -228,7 +228,7 @@ function updateChildren<
|
|
|
228
228
|
// Inserts a new blockGroup containing the child nodes created earlier.
|
|
229
229
|
tr.insert(
|
|
230
230
|
blockInfo.blockContent.afterPos,
|
|
231
|
-
pmSchema.nodes["blockGroup"].createChecked({}, childNodes)
|
|
231
|
+
pmSchema.nodes["blockGroup"].createChecked({}, childNodes),
|
|
232
232
|
);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
@@ -237,11 +237,11 @@ function updateChildren<
|
|
|
237
237
|
export function updateBlock<
|
|
238
238
|
BSchema extends BlockSchema = any,
|
|
239
239
|
I extends InlineContentSchema = any,
|
|
240
|
-
S extends StyleSchema = any
|
|
240
|
+
S extends StyleSchema = any,
|
|
241
241
|
>(
|
|
242
242
|
tr: Transaction,
|
|
243
243
|
blockToUpdate: BlockIdentifier,
|
|
244
|
-
update: PartialBlock<BSchema, I, S
|
|
244
|
+
update: PartialBlock<BSchema, I, S>,
|
|
245
245
|
): Block<BSchema, I, S> {
|
|
246
246
|
const id =
|
|
247
247
|
typeof blockToUpdate === "string" ? blockToUpdate : blockToUpdate.id;
|
|
@@ -13,10 +13,10 @@ import { getPmSchema } from "../../pmUtil.js";
|
|
|
13
13
|
export function getBlock<
|
|
14
14
|
BSchema extends BlockSchema,
|
|
15
15
|
I extends InlineContentSchema,
|
|
16
|
-
S extends StyleSchema
|
|
16
|
+
S extends StyleSchema,
|
|
17
17
|
>(
|
|
18
18
|
doc: Node,
|
|
19
|
-
blockIdentifier: BlockIdentifier
|
|
19
|
+
blockIdentifier: BlockIdentifier,
|
|
20
20
|
): Block<BSchema, I, S> | undefined {
|
|
21
21
|
const id =
|
|
22
22
|
typeof blockIdentifier === "string" ? blockIdentifier : blockIdentifier.id;
|
|
@@ -33,10 +33,10 @@ export function getBlock<
|
|
|
33
33
|
export function getPrevBlock<
|
|
34
34
|
BSchema extends BlockSchema,
|
|
35
35
|
I extends InlineContentSchema,
|
|
36
|
-
S extends StyleSchema
|
|
36
|
+
S extends StyleSchema,
|
|
37
37
|
>(
|
|
38
38
|
doc: Node,
|
|
39
|
-
blockIdentifier: BlockIdentifier
|
|
39
|
+
blockIdentifier: BlockIdentifier,
|
|
40
40
|
): Block<BSchema, I, S> | undefined {
|
|
41
41
|
const id =
|
|
42
42
|
typeof blockIdentifier === "string" ? blockIdentifier : blockIdentifier.id;
|
|
@@ -59,10 +59,10 @@ export function getPrevBlock<
|
|
|
59
59
|
export function getNextBlock<
|
|
60
60
|
BSchema extends BlockSchema,
|
|
61
61
|
I extends InlineContentSchema,
|
|
62
|
-
S extends StyleSchema
|
|
62
|
+
S extends StyleSchema,
|
|
63
63
|
>(
|
|
64
64
|
doc: Node,
|
|
65
|
-
blockIdentifier: BlockIdentifier
|
|
65
|
+
blockIdentifier: BlockIdentifier,
|
|
66
66
|
): Block<BSchema, I, S> | undefined {
|
|
67
67
|
const id =
|
|
68
68
|
typeof blockIdentifier === "string" ? blockIdentifier : blockIdentifier.id;
|
|
@@ -73,7 +73,7 @@ export function getNextBlock<
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
const $posAfterNode = doc.resolve(
|
|
76
|
-
posInfo.posBeforeNode + posInfo.node.nodeSize
|
|
76
|
+
posInfo.posBeforeNode + posInfo.node.nodeSize,
|
|
77
77
|
);
|
|
78
78
|
const nodeToConvert = $posAfterNode.nodeAfter;
|
|
79
79
|
if (!nodeToConvert) {
|
|
@@ -86,10 +86,10 @@ export function getNextBlock<
|
|
|
86
86
|
export function getParentBlock<
|
|
87
87
|
BSchema extends BlockSchema,
|
|
88
88
|
I extends InlineContentSchema,
|
|
89
|
-
S extends StyleSchema
|
|
89
|
+
S extends StyleSchema,
|
|
90
90
|
>(
|
|
91
91
|
doc: Node,
|
|
92
|
-
blockIdentifier: BlockIdentifier
|
|
92
|
+
blockIdentifier: BlockIdentifier,
|
|
93
93
|
): Block<BSchema, I, S> | undefined {
|
|
94
94
|
const id =
|
|
95
95
|
typeof blockIdentifier === "string" ? blockIdentifier : blockIdentifier.id;
|