@blocknote/core 0.15.6 → 0.15.7

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.
@@ -1 +1 @@
1
- {"builtAt":1724890687204,"assets":[{"name":"blocknote.umd.cjs","size":196895},{"name":"blocknote.umd.cjs.map","size":710888}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/i18n/locales/ar.ts","size":6582,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/de.ts","size":7183,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/en.ts","size":6664,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/es.ts","size":6796,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/fr.ts","size":7294,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/is.ts","size":6876,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ja.ts","size":6323,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ko.ts","size":6146,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/nl.ts","size":7079,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pl.ts","size":6768,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pt.ts","size":6965,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ru.ts","size":7638,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/vi.ts","size":6927,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/zh.ts","size":6093,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/index.ts","size":0,"chunks":["a1ee98a"]},{"name":"./src/util/esmDependencies.ts","size":820,"chunks":["a1ee98a"]},{"name":"./src/extensions/UniqueID/UniqueID.ts","size":8518,"chunks":["a1ee98a"]},{"name":"./src/api/getBlockInfoFromPos.ts","size":1691,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/types.ts","size":302,"chunks":["a1ee98a"]},{"name":"./src/util/typescript.ts","size":331,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/nodeConversions.ts","size":11998,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/sharedHTMLConversion.ts","size":2311,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts","size":3283,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/externalHTMLExporter.ts","size":1320,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/internalHTMLSerializer.ts","size":758,"chunks":["a1ee98a"]},{"name":"./src/api/getCurrentBlockContentType.ts","size":192,"chunks":["a1ee98a"]},{"name":"./src/util/browser.ts","size":536,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockHelpers.ts","size":1691,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultProps.ts","size":269,"chunks":["a1ee98a"]},{"name":"./src/util/string.ts","size":299,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/internal.ts","size":3877,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/createSpec.ts","size":2814,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/internal.ts","size":1357,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/createSpec.ts","size":1627,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/internal.ts","size":1162,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/createSpec.ts","size":1263,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/fileBlockHelpers.ts","size":8574,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/audioBlockHelpers.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/AudioBlockContent.ts","size":3741,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/FileBlockContent.ts","size":1939,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts","size":316,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/imageBlockHelpers.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/ImageBlockContent.ts","size":3959,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/videoBlockHelpers.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/VideoBlockContent.ts","size":3763,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorMark.ts","size":946,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorMark.ts","size":866,"chunks":["a1ee98a"]},{"name":"./src/blocks/HeadingBlockContent/HeadingBlockContent.ts","size":3439,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts","size":1201,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts","size":3122,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts","size":1862,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts","size":3437,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts","size":6423,"chunks":["a1ee98a"]},{"name":"./src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts","size":1307,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableExtension.ts","size":1462,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableBlockContent.ts","size":1624,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlocks.ts","size":1123,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockTypeGuards.ts","size":1580,"chunks":["a1ee98a"]},{"name":"./src/api/nodeUtil.ts","size":548,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/blockManipulation.ts","size":5664,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/removeUnderlinesRehypePlugin.ts","size":752,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts","size":962,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/markdownExporter.ts","size":837,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/util/nestedLists.ts","size":2174,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/parseHTML.ts","size":503,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/markdown/parseMarkdown.ts","size":1104,"chunks":["a1ee98a"]},{"name":"./src/util/EventEmitter.ts","size":744,"chunks":["a1ee98a"]},{"name":"./src/extensions/FilePanel/FilePanelPlugin.ts","size":3480,"chunks":["a1ee98a"]},{"name":"./src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","size":5062,"chunks":["a1ee98a"]},{"name":"./src/extensions/LinkToolbar/LinkToolbarPlugin.ts","size":7365,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/MultipleNodeSelection.ts","size":1616,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/SideMenuPlugin.ts","size":17152,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/SuggestionPlugin.ts","size":7719,"chunks":["a1ee98a"]},{"name":"./src/extensions/TableHandles/TableHandlesPlugin.ts","size":15235,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/copyExtension.ts","size":3132,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts","size":6319,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/acceptedMIMETypes.ts","size":91,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/handleFileInsertion.ts","size":1983,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/pasteExtension.ts","size":1244,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/fileDropExtension.ts","size":884,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorExtension.ts","size":791,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextAlignment/TextAlignmentExtension.ts","size":928,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorExtension.ts","size":725,"chunks":["a1ee98a"]},{"name":"./src/extensions/TrailingNode/TrailingNodeExtension.ts","size":1594,"chunks":["a1ee98a"]},{"name":"./src/extensions/NonEditableBlocks/NonEditableBlockPlugin.ts","size":1086,"chunks":["a1ee98a"]},{"name":"./src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts","size":4578,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockContainer.ts","size":18112,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockGroup.ts","size":1097,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/Doc.ts","size":90,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteExtensions.ts","size":4243,"chunks":["a1ee98a"]},{"name":"./src/editor/transformPasted.ts","size":1062,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteSchema.ts","size":1044,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteTipTapEditor.ts","size":2823,"chunks":["a1ee98a"]},{"name":"./src/extensions/Placeholder/PlaceholderPlugin.ts","size":2758,"chunks":["a1ee98a"]},{"name":"./src/style.css","size":0,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteEditor.ts","size":26591,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts","size":700,"chunks":["a1ee98a"]},{"name":"./src/api/testUtil/partialBlockTestUtil.ts","size":2166,"chunks":["a1ee98a"]},{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]}]}
1
+ {"builtAt":1725633213742,"assets":[{"name":"blocknote.umd.cjs","size":197756},{"name":"blocknote.umd.cjs.map","size":714141}],"chunks":[{"id":"a1ee98a","entry":true,"initial":true,"files":["blocknote.umd.cjs"],"names":["index"]}],"modules":[{"name":"./src/i18n/locales/ar.ts","size":6582,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/de.ts","size":7183,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/en.ts","size":6664,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/es.ts","size":6796,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/fr.ts","size":7294,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/is.ts","size":6876,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ja.ts","size":6323,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ko.ts","size":6146,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/nl.ts","size":7079,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pl.ts","size":6768,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/pt.ts","size":6965,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/ru.ts","size":7638,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/vi.ts","size":6927,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/zh.ts","size":6093,"chunks":["a1ee98a"]},{"name":"./src/i18n/locales/index.ts","size":0,"chunks":["a1ee98a"]},{"name":"./src/util/esmDependencies.ts","size":820,"chunks":["a1ee98a"]},{"name":"./src/extensions/UniqueID/UniqueID.ts","size":8518,"chunks":["a1ee98a"]},{"name":"./src/api/getBlockInfoFromPos.ts","size":1691,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/types.ts","size":302,"chunks":["a1ee98a"]},{"name":"./src/util/typescript.ts","size":331,"chunks":["a1ee98a"]},{"name":"./src/api/nodeConversions/nodeConversions.ts","size":11998,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/sharedHTMLConversion.ts","size":2311,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/util/simplifyBlocksRehypePlugin.ts","size":3283,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/externalHTMLExporter.ts","size":1320,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/html/internalHTMLSerializer.ts","size":758,"chunks":["a1ee98a"]},{"name":"./src/api/getCurrentBlockContentType.ts","size":192,"chunks":["a1ee98a"]},{"name":"./src/util/browser.ts","size":536,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockHelpers.ts","size":1691,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultProps.ts","size":269,"chunks":["a1ee98a"]},{"name":"./src/util/string.ts","size":299,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/internal.ts","size":3877,"chunks":["a1ee98a"]},{"name":"./src/schema/blocks/createSpec.ts","size":2814,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/internal.ts","size":1357,"chunks":["a1ee98a"]},{"name":"./src/schema/inlineContent/createSpec.ts","size":1627,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/internal.ts","size":1162,"chunks":["a1ee98a"]},{"name":"./src/schema/styles/createSpec.ts","size":1263,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/fileBlockHelpers.ts","size":8574,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/audioBlockHelpers.ts","size":108,"chunks":["a1ee98a"]},{"name":"./src/blocks/AudioBlockContent/AudioBlockContent.ts","size":3732,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/FileBlockContent.ts","size":1939,"chunks":["a1ee98a"]},{"name":"./src/blocks/FileBlockContent/uploadToTmpFilesDotOrg_DEV_ONLY.ts","size":316,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/imageBlockHelpers.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/ImageBlockContent/ImageBlockContent.ts","size":3950,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/videoBlockHelpers.ts","size":175,"chunks":["a1ee98a"]},{"name":"./src/blocks/VideoBlockContent/VideoBlockContent.ts","size":3754,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorMark.ts","size":946,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorMark.ts","size":866,"chunks":["a1ee98a"]},{"name":"./src/blocks/HeadingBlockContent/HeadingBlockContent.ts","size":3439,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/ListItemKeyboardShortcuts.ts","size":1201,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/BulletListItemBlockContent/BulletListItemBlockContent.ts","size":3122,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListIndexingPlugin.ts","size":1862,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/NumberedListItemBlockContent/NumberedListItemBlockContent.ts","size":3437,"chunks":["a1ee98a"]},{"name":"./src/blocks/ListItemBlockContent/CheckListItemBlockContent/CheckListItemBlockContent.ts","size":6423,"chunks":["a1ee98a"]},{"name":"./src/blocks/ParagraphBlockContent/ParagraphBlockContent.ts","size":1307,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableExtension.ts","size":1462,"chunks":["a1ee98a"]},{"name":"./src/blocks/TableBlockContent/TableBlockContent.ts","size":1624,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlocks.ts","size":1123,"chunks":["a1ee98a"]},{"name":"./src/blocks/defaultBlockTypeGuards.ts","size":1580,"chunks":["a1ee98a"]},{"name":"./src/api/nodeUtil.ts","size":548,"chunks":["a1ee98a"]},{"name":"./src/api/blockManipulation/blockManipulation.ts","size":5664,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/removeUnderlinesRehypePlugin.ts","size":752,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/util/addSpacesToCheckboxesRehypePlugin.ts","size":962,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/markdown/markdownExporter.ts","size":837,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/util/nestedLists.ts","size":2174,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/html/parseHTML.ts","size":503,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/markdown/parseMarkdown.ts","size":1104,"chunks":["a1ee98a"]},{"name":"./src/util/EventEmitter.ts","size":744,"chunks":["a1ee98a"]},{"name":"./src/extensions/FilePanel/FilePanelPlugin.ts","size":3480,"chunks":["a1ee98a"]},{"name":"./src/extensions/FormattingToolbar/FormattingToolbarPlugin.ts","size":5062,"chunks":["a1ee98a"]},{"name":"./src/extensions/LinkToolbar/LinkToolbarPlugin.ts","size":7365,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/MultipleNodeSelection.ts","size":1616,"chunks":["a1ee98a"]},{"name":"./src/extensions/SideMenu/SideMenuPlugin.ts","size":17153,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/SuggestionPlugin.ts","size":7925,"chunks":["a1ee98a"]},{"name":"./src/extensions/TableHandles/TableHandlesPlugin.ts","size":15235,"chunks":["a1ee98a"]},{"name":"./src/api/exporters/copyExtension.ts","size":3132,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/acceptedMIMETypes.ts","size":91,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/handleFileInsertion.ts","size":3117,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/pasteExtension.ts","size":1244,"chunks":["a1ee98a"]},{"name":"./src/api/parsers/fileDropExtension.ts","size":884,"chunks":["a1ee98a"]},{"name":"./src/extensions/BackgroundColor/BackgroundColorExtension.ts","size":791,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextAlignment/TextAlignmentExtension.ts","size":928,"chunks":["a1ee98a"]},{"name":"./src/extensions/TextColor/TextColorExtension.ts","size":725,"chunks":["a1ee98a"]},{"name":"./src/extensions/TrailingNode/TrailingNodeExtension.ts","size":1594,"chunks":["a1ee98a"]},{"name":"./src/extensions/NonEditableBlocks/NonEditableBlockPlugin.ts","size":1086,"chunks":["a1ee98a"]},{"name":"./src/extensions/PreviousBlockType/PreviousBlockTypePlugin.ts","size":4578,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockContainer.ts","size":18112,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/BlockGroup.ts","size":1097,"chunks":["a1ee98a"]},{"name":"./src/pm-nodes/Doc.ts","size":90,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteExtensions.ts","size":4243,"chunks":["a1ee98a"]},{"name":"./src/editor/transformPasted.ts","size":1062,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteSchema.ts","size":1044,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteTipTapEditor.ts","size":2823,"chunks":["a1ee98a"]},{"name":"./src/extensions/Placeholder/PlaceholderPlugin.ts","size":2758,"chunks":["a1ee98a"]},{"name":"./src/style.css","size":0,"chunks":["a1ee98a"]},{"name":"./src/editor/BlockNoteEditor.ts","size":26863,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultEmojiPickerItems.ts","size":700,"chunks":["a1ee98a"]},{"name":"./src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts","size":6416,"chunks":["a1ee98a"]},{"name":"./src/api/testUtil/partialBlockTestUtil.ts","size":2166,"chunks":["a1ee98a"]},{"name":"./src/index.ts","size":0,"chunks":["a1ee98a"]}]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "homepage": "https://github.com/TypeCellOS/BlockNote",
4
4
  "private": false,
5
5
  "license": "MPL-2.0",
6
- "version": "0.15.6",
6
+ "version": "0.15.7",
7
7
  "files": [
8
8
  "dist",
9
9
  "types",
@@ -119,5 +119,5 @@
119
119
  "access": "public",
120
120
  "registry": "https://registry.npmjs.org/"
121
121
  },
122
- "gitHead": "570cdb49eb6111c74f3698898dd2278b16e90d9c"
122
+ "gitHead": "0e7f52f14217880a1b36ce1c31e9f9de5640c82d"
123
123
  }
@@ -1,14 +1,25 @@
1
1
  import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
2
2
  import { PartialBlock } from "../../blocks/defaultBlocks";
3
- import { insertOrUpdateBlock } from "../../extensions/SuggestionMenu/getDefaultSlashMenuItems";
4
3
  import {
5
4
  BlockSchema,
6
5
  FileBlockConfig,
7
6
  InlineContentSchema,
8
7
  StyleSchema,
9
8
  } from "../../schema";
9
+ import { getBlockInfoFromPos } from "../getBlockInfoFromPos";
10
10
  import { acceptedMIMETypes } from "./acceptedMIMETypes";
11
11
 
12
+ function checkFileExtensionsMatch(
13
+ fileExtension1: string,
14
+ fileExtension2: string
15
+ ) {
16
+ if (!fileExtension1.startsWith(".") || !fileExtension2.startsWith(".")) {
17
+ throw new Error(`The strings provided are not valid file extensions.`);
18
+ }
19
+
20
+ return fileExtension1 === fileExtension2;
21
+ }
22
+
12
23
  function checkMIMETypesMatch(mimeType1: string, mimeType2: string) {
13
24
  const types1 = mimeType1.split("/");
14
25
  const types2 = mimeType2.split("/");
@@ -71,10 +82,24 @@ export async function handleFileInsertion<
71
82
  // Gets file block corresponding to MIME type.
72
83
  let fileBlockType = "file";
73
84
  for (const fileBlockConfig of fileBlockConfigs) {
74
- for (const mimeType of fileBlockConfig.fileBlockAcceptMimeTypes || []) {
75
- if (checkMIMETypesMatch(items[i].type, mimeType)) {
76
- fileBlockType = fileBlockConfig.type;
77
- break;
85
+ for (const mimeType of fileBlockConfig.fileBlockAccept || []) {
86
+ const isFileExtension = mimeType.startsWith(".");
87
+ const file = items[i].getAsFile();
88
+
89
+ if (file) {
90
+ if (
91
+ (!isFileExtension &&
92
+ file.type &&
93
+ checkMIMETypesMatch(items[i].type, mimeType)) ||
94
+ (isFileExtension &&
95
+ checkFileExtensionsMatch(
96
+ "." + file.name.split(".").pop(),
97
+ mimeType
98
+ ))
99
+ ) {
100
+ fileBlockType = fileBlockConfig.type;
101
+ break;
102
+ }
78
103
  }
79
104
  }
80
105
  }
@@ -83,16 +108,42 @@ export async function handleFileInsertion<
83
108
  if (file) {
84
109
  const updateData = await editor.uploadFile(file);
85
110
 
86
- if (typeof updateData === "string") {
87
- const fileBlock = {
88
- type: fileBlockType,
89
- props: {
90
- name: file.name,
91
- url: updateData,
92
- },
93
- } as PartialBlock<BSchema, I, S>;
111
+ const fileBlock =
112
+ typeof updateData === "string"
113
+ ? ({
114
+ type: fileBlockType,
115
+ props: {
116
+ name: file.name,
117
+ url: updateData,
118
+ },
119
+ } as PartialBlock<BSchema, I, S>)
120
+ : { type: fileBlockType, ...updateData };
121
+
122
+ if (event.type === "paste") {
123
+ editor.insertBlocks(
124
+ [fileBlock],
125
+ editor.getTextCursorPosition().block,
126
+ "after"
127
+ );
128
+ }
129
+
130
+ if (event.type === "drop") {
131
+ const coords = {
132
+ left: (event as DragEvent).clientX,
133
+ top: (event as DragEvent).clientY,
134
+ };
135
+
136
+ const pos = editor._tiptapEditor.view.posAtCoords(coords);
137
+ if (!pos) {
138
+ return;
139
+ }
140
+
141
+ const blockInfo = getBlockInfoFromPos(
142
+ editor._tiptapEditor.state.doc,
143
+ pos.pos
144
+ );
94
145
 
95
- insertOrUpdateBlock(editor, fileBlock);
146
+ editor.insertBlocks([fileBlock], blockInfo.id, "after");
96
147
  }
97
148
  }
98
149
  }
@@ -43,7 +43,7 @@ export const audioBlockConfig = {
43
43
  propSchema: audioPropSchema,
44
44
  content: "none",
45
45
  isFileBlock: true,
46
- fileBlockAcceptMimeTypes: ["audio/*"],
46
+ fileBlockAccept: ["audio/*"],
47
47
  } satisfies FileBlockConfig;
48
48
 
49
49
  export const audioRender = (
@@ -49,7 +49,7 @@ export const imageBlockConfig = {
49
49
  propSchema: imagePropSchema,
50
50
  content: "none",
51
51
  isFileBlock: true,
52
- fileBlockAcceptMimeTypes: ["image/*"],
52
+ fileBlockAccept: ["image/*"],
53
53
  } satisfies FileBlockConfig;
54
54
 
55
55
  export const imageRender = (
@@ -49,7 +49,7 @@ export const videoBlockConfig = {
49
49
  propSchema: videoPropSchema,
50
50
  content: "none",
51
51
  isFileBlock: true,
52
- fileBlockAcceptMimeTypes: ["video/*"],
52
+ fileBlockAccept: ["video/*"],
53
53
  } satisfies FileBlockConfig;
54
54
 
55
55
  export const videoRender = (
@@ -1159,15 +1159,26 @@ export class BlockNoteEditor<
1159
1159
  };
1160
1160
  }
1161
1161
 
1162
- public openSelectionMenu(triggerCharacter: string) {
1162
+ public openSuggestionMenu(
1163
+ triggerCharacter: string,
1164
+ pluginState?: {
1165
+ deleteTriggerCharacter?: boolean;
1166
+ ignoreQueryLength?: boolean;
1167
+ }
1168
+ ) {
1169
+ const tr = this.prosemirrorView.state.tr;
1170
+ const transaction =
1171
+ pluginState && pluginState.deleteTriggerCharacter
1172
+ ? tr.insertText(triggerCharacter)
1173
+ : tr;
1174
+
1163
1175
  this.prosemirrorView.focus();
1164
1176
  this.prosemirrorView.dispatch(
1165
- this.prosemirrorView.state.tr
1166
- .scrollIntoView()
1167
- .setMeta(this.suggestionMenus.plugin, {
1168
- triggerCharacter: triggerCharacter,
1169
- fromUserInput: false,
1170
- })
1177
+ transaction.scrollIntoView().setMeta(this.suggestionMenus.plugin, {
1178
+ triggerCharacter: triggerCharacter,
1179
+ deleteTriggerCharacter: pluginState?.deleteTriggerCharacter || false,
1180
+ ignoreQueryLength: pluginState?.ignoreQueryLength || false,
1181
+ })
1171
1182
  );
1172
1183
  }
1173
1184
  }
@@ -664,7 +664,7 @@ export class SideMenuView<
664
664
  }
665
665
 
666
666
  // Focuses and activates the slash menu.
667
- this.editor.openSelectionMenu("/");
667
+ this.editor.openSuggestionMenu("/");
668
668
  }
669
669
  }
670
670
 
@@ -11,6 +11,7 @@ const findBlock = findParentNode((node) => node.type.name === "blockContainer");
11
11
 
12
12
  export type SuggestionMenuState = UiElementPosition & {
13
13
  query: string;
14
+ ignoreQueryLength?: boolean;
14
15
  };
15
16
 
16
17
  class SuggestionMenuView<
@@ -34,7 +35,10 @@ class SuggestionMenuView<
34
35
  throw new Error("Attempting to update uninitialized suggestions menu");
35
36
  }
36
37
 
37
- emitUpdate(menuName, this.state);
38
+ emitUpdate(menuName, {
39
+ ...this.state,
40
+ ignoreQueryLength: this.pluginState?.ignoreQueryLength,
41
+ });
38
42
  };
39
43
 
40
44
  this.rootEl = this.editor._tiptapEditor.view.root;
@@ -120,7 +124,7 @@ class SuggestionMenuView<
120
124
  .deleteRange({
121
125
  from:
122
126
  this.pluginState.queryStartPos! -
123
- (this.pluginState.fromUserInput
127
+ (this.pluginState.deleteTriggerCharacter
124
128
  ? this.pluginState.triggerCharacter!.length
125
129
  : 0),
126
130
  to: this.editor._tiptapEditor.state.selection.from,
@@ -132,10 +136,11 @@ class SuggestionMenuView<
132
136
  type SuggestionPluginState =
133
137
  | {
134
138
  triggerCharacter: string;
135
- fromUserInput: boolean;
139
+ deleteTriggerCharacter: boolean;
136
140
  queryStartPos: number;
137
141
  query: string;
138
142
  decorationId: string;
143
+ ignoreQueryLength?: boolean;
139
144
  }
140
145
  | undefined;
141
146
 
@@ -194,7 +199,8 @@ export class SuggestionMenuProseMirrorPlugin<
194
199
  // or null if it should be hidden.
195
200
  const suggestionPluginTransactionMeta: {
196
201
  triggerCharacter: string;
197
- fromUserInput?: boolean;
202
+ deleteTriggerCharacter?: boolean;
203
+ ignoreQueryLength?: boolean;
198
204
  } | null = transaction.getMeta(suggestionMenuPluginKey);
199
205
 
200
206
  // Only opens a menu of no menu is already open
@@ -206,11 +212,14 @@ export class SuggestionMenuProseMirrorPlugin<
206
212
  return {
207
213
  triggerCharacter:
208
214
  suggestionPluginTransactionMeta.triggerCharacter,
209
- fromUserInput:
210
- suggestionPluginTransactionMeta.fromUserInput !== false,
215
+ deleteTriggerCharacter:
216
+ suggestionPluginTransactionMeta.deleteTriggerCharacter !==
217
+ false,
211
218
  queryStartPos: newState.selection.from,
212
219
  query: "",
213
220
  decorationId: `id_${Math.floor(Math.random() * 0xffffffff)}`,
221
+ ignoreQueryLength:
222
+ suggestionPluginTransactionMeta?.ignoreQueryLength,
214
223
  };
215
224
  }
216
225
 
@@ -285,7 +294,7 @@ export class SuggestionMenuProseMirrorPlugin<
285
294
 
286
295
  // If the menu was opened programmatically by another extension, it may not use a trigger character. In this
287
296
  // case, the decoration is set on the whole block instead, as the decoration range would otherwise be empty.
288
- if (!suggestionPluginState.fromUserInput) {
297
+ if (!suggestionPluginState.deleteTriggerCharacter) {
289
298
  const blockNode = findBlock(state.selection);
290
299
  if (blockNode) {
291
300
  return DecorationSet.create(state.doc, [
@@ -272,7 +272,12 @@ export function getDefaultSlashMenuItems<
272
272
  }
273
273
 
274
274
  items.push({
275
- onItemClick: () => editor.openSelectionMenu(":"),
275
+ onItemClick: () => {
276
+ editor.openSuggestionMenu(":", {
277
+ deleteTriggerCharacter: true,
278
+ ignoreQueryLength: true,
279
+ });
280
+ },
276
281
  key: "emoji",
277
282
  ...editor.dictionary.slash_menu.emoji,
278
283
  });
@@ -50,7 +50,7 @@ export type FileBlockConfig = {
50
50
  };
51
51
  content: "none";
52
52
  isFileBlock: true;
53
- fileBlockAcceptMimeTypes?: string[];
53
+ fileBlockAccept?: string[];
54
54
  };
55
55
 
56
56
  // BlockConfig contains the "schema" info about a Block type
@@ -415,7 +415,7 @@ declare const schema: BlockNoteSchema<import("../../../schema").BlockSchemaFromS
415
415
  };
416
416
  content: "none";
417
417
  isFileBlock: true;
418
- fileBlockAcceptMimeTypes: string[];
418
+ fileBlockAccept: string[];
419
419
  };
420
420
  implementation: import("../../../schema").TiptapBlockImplementation<{
421
421
  type: "image";
@@ -445,7 +445,7 @@ declare const schema: BlockNoteSchema<import("../../../schema").BlockSchemaFromS
445
445
  };
446
446
  content: "none";
447
447
  isFileBlock: true;
448
- fileBlockAcceptMimeTypes: string[];
448
+ fileBlockAccept: string[];
449
449
  }, any, import("../../../schema").InlineContentSchema, import("../../../schema").StyleSchema>;
450
450
  };
451
451
  video: {
@@ -477,7 +477,7 @@ declare const schema: BlockNoteSchema<import("../../../schema").BlockSchemaFromS
477
477
  };
478
478
  content: "none";
479
479
  isFileBlock: true;
480
- fileBlockAcceptMimeTypes: string[];
480
+ fileBlockAccept: string[];
481
481
  };
482
482
  implementation: import("../../../schema").TiptapBlockImplementation<{
483
483
  type: "video";
@@ -507,7 +507,7 @@ declare const schema: BlockNoteSchema<import("../../../schema").BlockSchemaFromS
507
507
  };
508
508
  content: "none";
509
509
  isFileBlock: true;
510
- fileBlockAcceptMimeTypes: string[];
510
+ fileBlockAccept: string[];
511
511
  }, any, import("../../../schema").InlineContentSchema, import("../../../schema").StyleSchema>;
512
512
  };
513
513
  audio: {
@@ -532,7 +532,7 @@ declare const schema: BlockNoteSchema<import("../../../schema").BlockSchemaFromS
532
532
  };
533
533
  content: "none";
534
534
  isFileBlock: true;
535
- fileBlockAcceptMimeTypes: string[];
535
+ fileBlockAccept: string[];
536
536
  };
537
537
  implementation: import("../../../schema").TiptapBlockImplementation<{
538
538
  type: "audio";
@@ -555,7 +555,7 @@ declare const schema: BlockNoteSchema<import("../../../schema").BlockSchemaFromS
555
555
  };
556
556
  content: "none";
557
557
  isFileBlock: true;
558
- fileBlockAcceptMimeTypes: string[];
558
+ fileBlockAccept: string[];
559
559
  }, any, import("../../../schema").InlineContentSchema, import("../../../schema").StyleSchema>;
560
560
  };
561
561
  }>, import("../../../schema").InlineContentSchemaFromSpecs<{
@@ -289,7 +289,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
289
289
  };
290
290
  content: "none";
291
291
  isFileBlock: true;
292
- fileBlockAcceptMimeTypes: string[];
292
+ fileBlockAccept: string[];
293
293
  };
294
294
  implementation: import("../../..").TiptapBlockImplementation<{
295
295
  type: "image";
@@ -319,7 +319,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
319
319
  };
320
320
  content: "none";
321
321
  isFileBlock: true;
322
- fileBlockAcceptMimeTypes: string[];
322
+ fileBlockAccept: string[];
323
323
  }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
324
324
  };
325
325
  video: {
@@ -351,7 +351,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
351
351
  };
352
352
  content: "none";
353
353
  isFileBlock: true;
354
- fileBlockAcceptMimeTypes: string[];
354
+ fileBlockAccept: string[];
355
355
  };
356
356
  implementation: import("../../..").TiptapBlockImplementation<{
357
357
  type: "video";
@@ -381,7 +381,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
381
381
  };
382
382
  content: "none";
383
383
  isFileBlock: true;
384
- fileBlockAcceptMimeTypes: string[];
384
+ fileBlockAccept: string[];
385
385
  }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
386
386
  };
387
387
  audio: {
@@ -406,7 +406,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
406
406
  };
407
407
  content: "none";
408
408
  isFileBlock: true;
409
- fileBlockAcceptMimeTypes: string[];
409
+ fileBlockAccept: string[];
410
410
  };
411
411
  implementation: import("../../..").TiptapBlockImplementation<{
412
412
  type: "audio";
@@ -429,7 +429,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
429
429
  };
430
430
  content: "none";
431
431
  isFileBlock: true;
432
- fileBlockAcceptMimeTypes: string[];
432
+ fileBlockAccept: string[];
433
433
  }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
434
434
  };
435
435
  }>, import("../../..").InlineContentSchemaFromSpecs<{
@@ -289,7 +289,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
289
289
  };
290
290
  content: "none";
291
291
  isFileBlock: true;
292
- fileBlockAcceptMimeTypes: string[];
292
+ fileBlockAccept: string[];
293
293
  };
294
294
  implementation: import("../../..").TiptapBlockImplementation<{
295
295
  type: "image";
@@ -319,7 +319,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
319
319
  };
320
320
  content: "none";
321
321
  isFileBlock: true;
322
- fileBlockAcceptMimeTypes: string[];
322
+ fileBlockAccept: string[];
323
323
  }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
324
324
  };
325
325
  video: {
@@ -351,7 +351,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
351
351
  };
352
352
  content: "none";
353
353
  isFileBlock: true;
354
- fileBlockAcceptMimeTypes: string[];
354
+ fileBlockAccept: string[];
355
355
  };
356
356
  implementation: import("../../..").TiptapBlockImplementation<{
357
357
  type: "video";
@@ -381,7 +381,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
381
381
  };
382
382
  content: "none";
383
383
  isFileBlock: true;
384
- fileBlockAcceptMimeTypes: string[];
384
+ fileBlockAccept: string[];
385
385
  }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
386
386
  };
387
387
  audio: {
@@ -406,7 +406,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
406
406
  };
407
407
  content: "none";
408
408
  isFileBlock: true;
409
- fileBlockAcceptMimeTypes: string[];
409
+ fileBlockAccept: string[];
410
410
  };
411
411
  implementation: import("../../..").TiptapBlockImplementation<{
412
412
  type: "audio";
@@ -429,7 +429,7 @@ declare const schema: BlockNoteSchema<import("../../..").BlockSchemaFromSpecs<{
429
429
  };
430
430
  content: "none";
431
431
  isFileBlock: true;
432
- fileBlockAcceptMimeTypes: string[];
432
+ fileBlockAccept: string[];
433
433
  }, any, import("../../..").InlineContentSchema, import("../../..").StyleSchema>;
434
434
  };
435
435
  }>, import("../../..").InlineContentSchemaFromSpecs<{
@@ -38,7 +38,7 @@ export declare const audioBlockConfig: {
38
38
  };
39
39
  content: "none";
40
40
  isFileBlock: true;
41
- fileBlockAcceptMimeTypes: string[];
41
+ fileBlockAccept: string[];
42
42
  };
43
43
  export declare const audioRender: (block: BlockFromConfig<typeof audioBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>) => {
44
44
  dom: HTMLDivElement;
@@ -73,7 +73,7 @@ export declare const AudioBlock: {
73
73
  };
74
74
  content: "none";
75
75
  isFileBlock: true;
76
- fileBlockAcceptMimeTypes: string[];
76
+ fileBlockAccept: string[];
77
77
  };
78
78
  implementation: import("../../schema").TiptapBlockImplementation<{
79
79
  type: "audio";
@@ -96,6 +96,6 @@ export declare const AudioBlock: {
96
96
  };
97
97
  content: "none";
98
98
  isFileBlock: true;
99
- fileBlockAcceptMimeTypes: string[];
99
+ fileBlockAccept: string[];
100
100
  }, any, import("../../schema").InlineContentSchema, import("../../schema").StyleSchema>;
101
101
  };
@@ -52,7 +52,7 @@ export declare const imageBlockConfig: {
52
52
  };
53
53
  content: "none";
54
54
  isFileBlock: true;
55
- fileBlockAcceptMimeTypes: string[];
55
+ fileBlockAccept: string[];
56
56
  };
57
57
  export declare const imageRender: (block: BlockFromConfig<typeof imageBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>) => {
58
58
  dom: HTMLDivElement;
@@ -94,7 +94,7 @@ export declare const ImageBlock: {
94
94
  };
95
95
  content: "none";
96
96
  isFileBlock: true;
97
- fileBlockAcceptMimeTypes: string[];
97
+ fileBlockAccept: string[];
98
98
  };
99
99
  implementation: import("../../schema").TiptapBlockImplementation<{
100
100
  type: "image";
@@ -124,6 +124,6 @@ export declare const ImageBlock: {
124
124
  };
125
125
  content: "none";
126
126
  isFileBlock: true;
127
- fileBlockAcceptMimeTypes: string[];
127
+ fileBlockAccept: string[];
128
128
  }, any, import("../../schema").InlineContentSchema, import("../../schema").StyleSchema>;
129
129
  };
@@ -52,7 +52,7 @@ export declare const videoBlockConfig: {
52
52
  };
53
53
  content: "none";
54
54
  isFileBlock: true;
55
- fileBlockAcceptMimeTypes: string[];
55
+ fileBlockAccept: string[];
56
56
  };
57
57
  export declare const videoRender: (block: BlockFromConfig<typeof videoBlockConfig, any, any>, editor: BlockNoteEditor<any, any, any>) => {
58
58
  dom: HTMLDivElement;
@@ -94,7 +94,7 @@ export declare const VideoBlock: {
94
94
  };
95
95
  content: "none";
96
96
  isFileBlock: true;
97
- fileBlockAcceptMimeTypes: string[];
97
+ fileBlockAccept: string[];
98
98
  };
99
99
  implementation: import("../../schema").TiptapBlockImplementation<{
100
100
  type: "video";
@@ -124,6 +124,6 @@ export declare const VideoBlock: {
124
124
  };
125
125
  content: "none";
126
126
  isFileBlock: true;
127
- fileBlockAcceptMimeTypes: string[];
127
+ fileBlockAccept: string[];
128
128
  }, any, import("../../schema").InlineContentSchema, import("../../schema").StyleSchema>;
129
129
  };