@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
|
@@ -35,7 +35,7 @@ function removeDuplicates(array: any, by = JSON.stringify) {
|
|
|
35
35
|
*/
|
|
36
36
|
function findDuplicates(items: any) {
|
|
37
37
|
const filtered = items.filter(
|
|
38
|
-
(el: any, index: number) => items.indexOf(el) !== index
|
|
38
|
+
(el: any, index: number) => items.indexOf(el) !== index,
|
|
39
39
|
);
|
|
40
40
|
const duplicates = removeDuplicates(filtered);
|
|
41
41
|
return duplicates;
|
|
@@ -154,7 +154,7 @@ const UniqueID = Extension.create({
|
|
|
154
154
|
const { types, attributeName, generateID } = this.options;
|
|
155
155
|
const transform = combineTransactionSteps(
|
|
156
156
|
oldState.doc,
|
|
157
|
-
transactions as any
|
|
157
|
+
transactions as any,
|
|
158
158
|
);
|
|
159
159
|
const { mapping } = transform;
|
|
160
160
|
// get changed ranges based on the old state
|
|
@@ -166,7 +166,7 @@ const UniqueID = Extension.create({
|
|
|
166
166
|
newRange,
|
|
167
167
|
(node) => {
|
|
168
168
|
return types.includes(node.type.name);
|
|
169
|
-
}
|
|
169
|
+
},
|
|
170
170
|
);
|
|
171
171
|
const newIds = newNodes
|
|
172
172
|
.map(({ node }) => node.attrs[attributeName])
|
|
@@ -193,7 +193,7 @@ const UniqueID = Extension.create({
|
|
|
193
193
|
if (wasInitial) {
|
|
194
194
|
// the old state was the "initial content"
|
|
195
195
|
const jsonNode = JSON.parse(
|
|
196
|
-
JSON.stringify(newState.doc.toJSON())
|
|
196
|
+
JSON.stringify(newState.doc.toJSON()),
|
|
197
197
|
);
|
|
198
198
|
jsonNode.content[0].content[0].attrs.id = "initialBlockId";
|
|
199
199
|
// would the new state with the fix also be the "initial content"?
|
|
@@ -308,7 +308,7 @@ const UniqueID = Extension.create({
|
|
|
308
308
|
[attributeName]: null,
|
|
309
309
|
},
|
|
310
310
|
removeId(node.content),
|
|
311
|
-
node.marks
|
|
311
|
+
node.marks,
|
|
312
312
|
);
|
|
313
313
|
list.push(nodeWithoutId);
|
|
314
314
|
});
|
|
@@ -319,7 +319,7 @@ const UniqueID = Extension.create({
|
|
|
319
319
|
return new Slice(
|
|
320
320
|
removeId(slice.content),
|
|
321
321
|
slice.openStart,
|
|
322
|
-
slice.openEnd
|
|
322
|
+
slice.openEnd,
|
|
323
323
|
);
|
|
324
324
|
},
|
|
325
325
|
},
|
package/src/fonts/inter.css
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
font-family: "Inter";
|
|
6
6
|
font-style: normal;
|
|
7
7
|
font-weight: 100;
|
|
8
|
-
src:
|
|
8
|
+
src:
|
|
9
|
+
local(""),
|
|
9
10
|
url("./inter-v12-latin/inter-v12-latin-100.woff2") format("woff2"),
|
|
10
11
|
/* Chrome 26+, Opera 23+, Firefox 39+ */
|
|
11
12
|
url("./inter-v12-latin/inter-v12-latin-100.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
@@ -15,7 +16,8 @@
|
|
|
15
16
|
font-family: "Inter";
|
|
16
17
|
font-style: normal;
|
|
17
18
|
font-weight: 200;
|
|
18
|
-
src:
|
|
19
|
+
src:
|
|
20
|
+
local(""),
|
|
19
21
|
url("./inter-v12-latin/inter-v12-latin-200.woff2") format("woff2"),
|
|
20
22
|
/* Chrome 26+, Opera 23+, Firefox 39+ */
|
|
21
23
|
url("./inter-v12-latin/inter-v12-latin-200.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
@@ -25,7 +27,8 @@
|
|
|
25
27
|
font-family: "Inter";
|
|
26
28
|
font-style: normal;
|
|
27
29
|
font-weight: 300;
|
|
28
|
-
src:
|
|
30
|
+
src:
|
|
31
|
+
local(""),
|
|
29
32
|
url("./inter-v12-latin/inter-v12-latin-300.woff2") format("woff2"),
|
|
30
33
|
/* Chrome 26+, Opera 23+, Firefox 39+ */
|
|
31
34
|
url("./inter-v12-latin/inter-v12-latin-300.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
@@ -35,7 +38,8 @@
|
|
|
35
38
|
font-family: "Inter";
|
|
36
39
|
font-style: normal;
|
|
37
40
|
font-weight: 400;
|
|
38
|
-
src:
|
|
41
|
+
src:
|
|
42
|
+
local(""),
|
|
39
43
|
url("./inter-v12-latin/inter-v12-latin-regular.woff2") format("woff2"),
|
|
40
44
|
/* Chrome 26+, Opera 23+, Firefox 39+ */
|
|
41
45
|
url("./inter-v12-latin/inter-v12-latin-regular.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
@@ -45,7 +49,8 @@
|
|
|
45
49
|
font-family: "Inter";
|
|
46
50
|
font-style: normal;
|
|
47
51
|
font-weight: 500;
|
|
48
|
-
src:
|
|
52
|
+
src:
|
|
53
|
+
local(""),
|
|
49
54
|
url("./inter-v12-latin/inter-v12-latin-500.woff2") format("woff2"),
|
|
50
55
|
/* Chrome 26+, Opera 23+, Firefox 39+ */
|
|
51
56
|
url("./inter-v12-latin/inter-v12-latin-500.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
@@ -55,7 +60,8 @@
|
|
|
55
60
|
font-family: "Inter";
|
|
56
61
|
font-style: normal;
|
|
57
62
|
font-weight: 600;
|
|
58
|
-
src:
|
|
63
|
+
src:
|
|
64
|
+
local(""),
|
|
59
65
|
url("./inter-v12-latin/inter-v12-latin-600.woff2") format("woff2"),
|
|
60
66
|
/* Chrome 26+, Opera 23+, Firefox 39+ */
|
|
61
67
|
url("./inter-v12-latin/inter-v12-latin-600.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
@@ -65,7 +71,8 @@
|
|
|
65
71
|
font-family: "Inter";
|
|
66
72
|
font-style: normal;
|
|
67
73
|
font-weight: 700;
|
|
68
|
-
src:
|
|
74
|
+
src:
|
|
75
|
+
local(""),
|
|
69
76
|
url("./inter-v12-latin/inter-v12-latin-700.woff2") format("woff2"),
|
|
70
77
|
/* Chrome 26+, Opera 23+, Firefox 39+ */
|
|
71
78
|
url("./inter-v12-latin/inter-v12-latin-700.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
@@ -75,7 +82,8 @@
|
|
|
75
82
|
font-family: "Inter";
|
|
76
83
|
font-style: normal;
|
|
77
84
|
font-weight: 800;
|
|
78
|
-
src:
|
|
85
|
+
src:
|
|
86
|
+
local(""),
|
|
79
87
|
url("./inter-v12-latin/inter-v12-latin-800.woff2") format("woff2"),
|
|
80
88
|
/* Chrome 26+, Opera 23+, Firefox 39+ */
|
|
81
89
|
url("./inter-v12-latin/inter-v12-latin-800.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
|
@@ -85,7 +93,8 @@
|
|
|
85
93
|
font-family: "Inter";
|
|
86
94
|
font-style: normal;
|
|
87
95
|
font-weight: 900;
|
|
88
|
-
src:
|
|
96
|
+
src:
|
|
97
|
+
local(""),
|
|
89
98
|
url("./inter-v12-latin/inter-v12-latin-900.woff2") format("woff2"),
|
|
90
99
|
/* Chrome 26+, Opera 23+, Firefox 39+ */
|
|
91
100
|
url("./inter-v12-latin/inter-v12-latin-900.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
|
package/src/i18n/locales/ar.ts
CHANGED
package/src/i18n/locales/de.ts
CHANGED
package/src/i18n/locales/en.ts
CHANGED
package/src/i18n/locales/es.ts
CHANGED
package/src/i18n/locales/fr.ts
CHANGED
package/src/i18n/locales/hr.ts
CHANGED
package/src/i18n/locales/is.ts
CHANGED
package/src/i18n/locales/it.ts
CHANGED
package/src/i18n/locales/ja.ts
CHANGED
package/src/i18n/locales/ko.ts
CHANGED
package/src/i18n/locales/nl.ts
CHANGED
package/src/i18n/locales/no.ts
CHANGED
package/src/i18n/locales/pl.ts
CHANGED
package/src/i18n/locales/pt.ts
CHANGED
package/src/i18n/locales/ru.ts
CHANGED
package/src/i18n/locales/sk.ts
CHANGED
package/src/i18n/locales/uk.ts
CHANGED
package/src/i18n/locales/vi.ts
CHANGED
package/src/i18n/locales/zh.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
+
export * from "./api/blockManipulation/commands/insertBlocks/insertBlocks.js";
|
|
2
|
+
export * from "./api/blockManipulation/commands/replaceBlocks/replaceBlocks.js";
|
|
1
3
|
export * from "./api/blockManipulation/commands/updateBlock/updateBlock.js";
|
|
2
4
|
export * from "./api/exporters/html/externalHTMLExporter.js";
|
|
3
5
|
export * from "./api/exporters/html/internalHTMLSerializer.js";
|
|
4
6
|
export * from "./api/getBlockInfoFromPos.js";
|
|
5
7
|
export * from "./api/nodeUtil.js";
|
|
8
|
+
export * from "./api/pmUtil.js";
|
|
6
9
|
export * from "./blocks/AudioBlockContent/AudioBlockContent.js";
|
|
7
10
|
export * from "./blocks/CodeBlockContent/CodeBlockContent.js";
|
|
11
|
+
export * from "./blocks/defaultBlockHelpers.js";
|
|
12
|
+
export * from "./blocks/defaultBlocks.js";
|
|
13
|
+
export * from "./blocks/defaultBlockTypeGuards.js";
|
|
14
|
+
export * from "./blocks/defaultProps.js";
|
|
8
15
|
export * from "./blocks/FileBlockContent/FileBlockContent.js";
|
|
9
16
|
export * from "./blocks/FileBlockContent/helpers/parse/parseEmbedElement.js";
|
|
10
17
|
export * from "./blocks/FileBlockContent/helpers/parse/parseFigureElement.js";
|
|
@@ -16,19 +23,16 @@ export * from "./blocks/FileBlockContent/helpers/toExternalHTML/createFigureWith
|
|
|
16
23
|
export * from "./blocks/FileBlockContent/helpers/toExternalHTML/createLinkWithCaption.js";
|
|
17
24
|
export * from "./blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.js";
|
|
18
25
|
export * from "./blocks/ImageBlockContent/ImageBlockContent.js";
|
|
19
|
-
export * from "./blocks/PageBreakBlockContent/PageBreakBlockContent.js";
|
|
20
26
|
export * from "./blocks/PageBreakBlockContent/getPageBreakSlashMenuItems.js";
|
|
27
|
+
export * from "./blocks/PageBreakBlockContent/PageBreakBlockContent.js";
|
|
21
28
|
export * from "./blocks/PageBreakBlockContent/schema.js";
|
|
22
29
|
export {
|
|
23
30
|
EMPTY_CELL_HEIGHT,
|
|
24
31
|
EMPTY_CELL_WIDTH,
|
|
25
32
|
} from "./blocks/TableBlockContent/TableExtension.js";
|
|
26
33
|
export * from "./blocks/VideoBlockContent/VideoBlockContent.js";
|
|
27
|
-
export * from "./blocks/defaultBlockHelpers.js";
|
|
28
|
-
export * from "./blocks/defaultBlockTypeGuards.js";
|
|
29
|
-
export * from "./blocks/defaultBlocks.js";
|
|
30
|
-
export * from "./blocks/defaultProps.js";
|
|
31
34
|
export * from "./editor/BlockNoteEditor.js";
|
|
35
|
+
export * from "./editor/BlockNoteExtension.js";
|
|
32
36
|
export * from "./editor/BlockNoteExtensions.js";
|
|
33
37
|
export * from "./editor/BlockNoteSchema.js";
|
|
34
38
|
export * from "./editor/defaultColors.js";
|
|
@@ -42,22 +46,24 @@ export * from "./extensions/LinkToolbar/protocols.js";
|
|
|
42
46
|
export * from "./extensions/SideMenu/SideMenuPlugin.js";
|
|
43
47
|
export * from "./extensions/SuggestionMenu/DefaultGridSuggestionItem.js";
|
|
44
48
|
export * from "./extensions/SuggestionMenu/DefaultSuggestionItem.js";
|
|
45
|
-
export * from "./extensions/SuggestionMenu/SuggestionPlugin.js";
|
|
46
49
|
export * from "./extensions/SuggestionMenu/getDefaultEmojiPickerItems.js";
|
|
47
50
|
export * from "./extensions/SuggestionMenu/getDefaultSlashMenuItems.js";
|
|
51
|
+
export * from "./extensions/SuggestionMenu/SuggestionPlugin.js";
|
|
48
52
|
export * from "./extensions/TableHandles/TableHandlesPlugin.js";
|
|
49
53
|
export * from "./i18n/dictionary.js";
|
|
50
54
|
export * from "./schema/index.js";
|
|
51
55
|
export * from "./util/browser.js";
|
|
52
56
|
export * from "./util/combineByGroup.js";
|
|
53
57
|
export * from "./util/esmDependencies.js";
|
|
54
|
-
export * from "./util/table.js";
|
|
55
58
|
export * from "./util/string.js";
|
|
59
|
+
export * from "./util/table.js";
|
|
56
60
|
export * from "./util/typescript.js";
|
|
57
61
|
|
|
58
62
|
export type { CodeBlockOptions } from "./blocks/CodeBlockContent/CodeBlockContent.js";
|
|
59
|
-
export {
|
|
63
|
+
export { assertEmpty, UnreachableCaseError } from "./util/typescript.js";
|
|
60
64
|
|
|
65
|
+
export * from "./util/EventEmitter.js";
|
|
66
|
+
// for testing from react (TODO: move):
|
|
61
67
|
// Unit testing
|
|
62
68
|
export { selectedFragmentToHTML } from "./api/clipboard/toClipboard/copyExtension.js";
|
|
63
69
|
|
|
@@ -70,3 +76,7 @@ export * from "./extensions/UniqueID/UniqueID.js";
|
|
|
70
76
|
export * from "./api/exporters/markdown/markdownExporter.js";
|
|
71
77
|
export * from "./api/parsers/html/parseHTML.js";
|
|
72
78
|
export * from "./api/parsers/markdown/parseMarkdown.js";
|
|
79
|
+
|
|
80
|
+
// TODO: for ai, remove?
|
|
81
|
+
export * from "./api/blockManipulation/getBlock/getBlock.js";
|
|
82
|
+
export * from "./api/positionMapping.js";
|
package/src/locales.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./i18n/index.js";
|
|
1
|
+
export * from "./i18n/index.js";
|
|
@@ -8,7 +8,7 @@ export const BlockGroup = Node.create<{
|
|
|
8
8
|
name: "blockGroup",
|
|
9
9
|
group: "childContainer",
|
|
10
10
|
content: "blockGroupChild+",
|
|
11
|
-
|
|
11
|
+
marks: "deletion insertion modification",
|
|
12
12
|
parseHTML() {
|
|
13
13
|
return [
|
|
14
14
|
{
|
|
@@ -37,7 +37,7 @@ export const BlockGroup = Node.create<{
|
|
|
37
37
|
const blockGroup = document.createElement("div");
|
|
38
38
|
blockGroup.className = mergeCSSClasses(
|
|
39
39
|
"bn-block-group",
|
|
40
|
-
blockGroupHTMLAttributes.class
|
|
40
|
+
blockGroupHTMLAttributes.class,
|
|
41
41
|
);
|
|
42
42
|
blockGroup.setAttribute("data-node-type", "blockGroup");
|
|
43
43
|
for (const [attribute, value] of Object.entries(blockGroupHTMLAttributes)) {
|
package/src/pm-nodes/Doc.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {Node} from "@tiptap/core";
|
|
1
|
+
import { Node } from "@tiptap/core";
|
|
2
2
|
|
|
3
3
|
export const Doc = Node.create({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
name: "doc",
|
|
5
|
+
topNode: true,
|
|
6
|
+
content: "blockGroup",
|
|
7
|
+
marks: "insertion modification deletion",
|
|
7
8
|
});
|
package/src/schema/README.md
CHANGED
|
@@ -26,7 +26,7 @@ export type CustomBlockConfig = BlockConfig & {
|
|
|
26
26
|
export type CustomBlockImplementation<
|
|
27
27
|
T extends CustomBlockConfig,
|
|
28
28
|
I extends InlineContentSchema,
|
|
29
|
-
S extends StyleSchema
|
|
29
|
+
S extends StyleSchema,
|
|
30
30
|
> = {
|
|
31
31
|
render: (
|
|
32
32
|
/**
|
|
@@ -38,7 +38,7 @@ export type CustomBlockImplementation<
|
|
|
38
38
|
* This is typed generically. If you want an editor with your custom schema, you need to
|
|
39
39
|
* cast it manually, e.g.: `const e = editor as BlockNoteEditor<typeof mySchema>;`
|
|
40
40
|
*/
|
|
41
|
-
editor: BlockNoteEditor<BlockSchemaWithBlock<T["type"], T>, I, S
|
|
41
|
+
editor: BlockNoteEditor<BlockSchemaWithBlock<T["type"], T>, I, S>,
|
|
42
42
|
// (note) if we want to fix the manual cast, we need to prevent circular references and separate block definition and render implementations
|
|
43
43
|
// or allow manually passing <BSchema>, but that's not possible without passing the other generics because Typescript doesn't support partial inferred generics
|
|
44
44
|
) => {
|
|
@@ -52,14 +52,14 @@ export type CustomBlockImplementation<
|
|
|
52
52
|
// TODO: Maybe can return undefined to ignore when serializing?
|
|
53
53
|
toExternalHTML?: (
|
|
54
54
|
block: BlockFromConfig<T, I, S>,
|
|
55
|
-
editor: BlockNoteEditor<BlockSchemaWithBlock<T["type"], T>, I, S
|
|
55
|
+
editor: BlockNoteEditor<BlockSchemaWithBlock<T["type"], T>, I, S>,
|
|
56
56
|
) => {
|
|
57
57
|
dom: HTMLElement;
|
|
58
58
|
contentDOM?: HTMLElement;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
parse?: (
|
|
62
|
-
el: HTMLElement
|
|
62
|
+
el: HTMLElement,
|
|
63
63
|
) => PartialBlockFromConfig<T, I, S>["props"] | undefined;
|
|
64
64
|
};
|
|
65
65
|
|
|
@@ -85,7 +85,7 @@ export function applyNonSelectableBlockFix(nodeView: NodeView, editor: Editor) {
|
|
|
85
85
|
// from the clipboard.
|
|
86
86
|
export function getParseRules(
|
|
87
87
|
config: BlockConfig,
|
|
88
|
-
customParseFunction: CustomBlockImplementation<any, any, any>["parse"]
|
|
88
|
+
customParseFunction: CustomBlockImplementation<any, any, any>["parse"],
|
|
89
89
|
) {
|
|
90
90
|
const rules: TagParseRule[] = [
|
|
91
91
|
{
|
|
@@ -136,10 +136,10 @@ export function getParseRules(
|
|
|
136
136
|
export function createBlockSpec<
|
|
137
137
|
T extends CustomBlockConfig,
|
|
138
138
|
I extends InlineContentSchema,
|
|
139
|
-
S extends StyleSchema
|
|
139
|
+
S extends StyleSchema,
|
|
140
140
|
>(
|
|
141
141
|
blockConfig: T,
|
|
142
|
-
blockImplementation: CustomBlockImplementation<NoInfer<T>, I, S
|
|
142
|
+
blockImplementation: CustomBlockImplementation<NoInfer<T>, I, S>,
|
|
143
143
|
) {
|
|
144
144
|
const node = createStronglyTypedTiptapNode({
|
|
145
145
|
name: blockConfig.type as T["type"],
|
|
@@ -173,7 +173,7 @@ export function createBlockSpec<
|
|
|
173
173
|
{},
|
|
174
174
|
blockConfig.propSchema,
|
|
175
175
|
blockConfig.isFileBlock,
|
|
176
|
-
HTMLAttributes
|
|
176
|
+
HTMLAttributes,
|
|
177
177
|
);
|
|
178
178
|
},
|
|
179
179
|
|
|
@@ -186,7 +186,7 @@ export function createBlockSpec<
|
|
|
186
186
|
getPos,
|
|
187
187
|
editor,
|
|
188
188
|
this.editor,
|
|
189
|
-
blockConfig.type
|
|
189
|
+
blockConfig.type,
|
|
190
190
|
);
|
|
191
191
|
// Gets the custom HTML attributes for `blockContent` nodes
|
|
192
192
|
const blockContentDOMAttributes =
|
|
@@ -199,7 +199,7 @@ export function createBlockSpec<
|
|
|
199
199
|
block.type,
|
|
200
200
|
block.props,
|
|
201
201
|
blockConfig.propSchema,
|
|
202
|
-
blockContentDOMAttributes
|
|
202
|
+
blockContentDOMAttributes,
|
|
203
203
|
);
|
|
204
204
|
|
|
205
205
|
if (blockConfig.isSelectable === false) {
|
|
@@ -213,7 +213,7 @@ export function createBlockSpec<
|
|
|
213
213
|
|
|
214
214
|
if (node.name !== blockConfig.type) {
|
|
215
215
|
throw new Error(
|
|
216
|
-
"Node name does not match block type. This is a bug in BlockNote."
|
|
216
|
+
"Node name does not match block type. This is a bug in BlockNote.",
|
|
217
217
|
);
|
|
218
218
|
}
|
|
219
219
|
|
|
@@ -231,7 +231,7 @@ export function createBlockSpec<
|
|
|
231
231
|
block.props,
|
|
232
232
|
blockConfig.propSchema,
|
|
233
233
|
blockConfig.isFileBlock,
|
|
234
|
-
blockContentDOMAttributes
|
|
234
|
+
blockContentDOMAttributes,
|
|
235
235
|
);
|
|
236
236
|
},
|
|
237
237
|
// TODO: this should not have wrapInBlockStructure and generally be a lot simpler
|
|
@@ -242,7 +242,7 @@ export function createBlockSpec<
|
|
|
242
242
|
|
|
243
243
|
let output = blockImplementation.toExternalHTML?.(
|
|
244
244
|
block as any,
|
|
245
|
-
editor as any
|
|
245
|
+
editor as any,
|
|
246
246
|
);
|
|
247
247
|
if (output === undefined) {
|
|
248
248
|
output = blockImplementation.render(block as any, editor as any);
|
|
@@ -252,7 +252,7 @@ export function createBlockSpec<
|
|
|
252
252
|
block.type,
|
|
253
253
|
block.props,
|
|
254
254
|
blockConfig.propSchema,
|
|
255
|
-
blockContentDOMAttributes
|
|
255
|
+
blockContentDOMAttributes,
|
|
256
256
|
);
|
|
257
257
|
},
|
|
258
258
|
});
|