@blocknote/core 0.52.1 → 0.54.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.
Files changed (221) hide show
  1. package/dist/BlockNoteExtension-BJCLnwrE.cjs +2 -0
  2. package/dist/BlockNoteExtension-BJCLnwrE.cjs.map +1 -0
  3. package/dist/BlockNoteExtension-CbvDA0F7.js +80 -0
  4. package/dist/BlockNoteExtension-CbvDA0F7.js.map +1 -0
  5. package/dist/{UserStore-QbbPFj0z.js → UserStore-C4TzkGEn.js} +3 -3
  6. package/dist/{UserStore-DCG6lsla.cjs.map → UserStore-C4TzkGEn.js.map} +1 -1
  7. package/dist/{UserStore-DCG6lsla.cjs → UserStore-mj3fXW4D.cjs} +2 -2
  8. package/dist/UserStore-mj3fXW4D.cjs.map +1 -0
  9. package/dist/blocknote.cjs +1 -1
  10. package/dist/blocknote.js +6 -6
  11. package/dist/{blocks-CiuUGa1E.js → blocks-CzQLehlc.js} +695 -652
  12. package/dist/blocks-CzQLehlc.js.map +1 -0
  13. package/dist/blocks-CzkqclGj.cjs +12 -0
  14. package/dist/blocks-CzkqclGj.cjs.map +1 -0
  15. package/dist/blocks.cjs +1 -1
  16. package/dist/blocks.js +2 -2
  17. package/dist/comments.cjs +1 -1
  18. package/dist/comments.cjs.map +1 -1
  19. package/dist/comments.js +7 -7
  20. package/dist/comments.js.map +1 -1
  21. package/dist/en-BuzSuuTq.cjs +2 -0
  22. package/dist/en-BuzSuuTq.cjs.map +1 -0
  23. package/dist/{en-CGKXfWma.js → en-uzHzj6eH.js} +10 -1
  24. package/dist/en-uzHzj6eH.js.map +1 -0
  25. package/dist/extensions-CSB9ZvuL.cjs +58 -0
  26. package/dist/extensions-CSB9ZvuL.cjs.map +1 -0
  27. package/dist/{extensions-CrUGDOks.js → extensions-DGuhtOgB.js} +717 -452
  28. package/dist/extensions-DGuhtOgB.js.map +1 -0
  29. package/dist/extensions.cjs +1 -1
  30. package/dist/extensions.js +4 -4
  31. package/dist/locales.cjs +1 -1
  32. package/dist/locales.cjs.map +1 -1
  33. package/dist/locales.js +199 -1
  34. package/dist/locales.js.map +1 -1
  35. package/dist/{src-DTF83Cl9.js → src-BkfZVfaO.js} +921 -835
  36. package/dist/src-BkfZVfaO.js.map +1 -0
  37. package/dist/src-DM3syMdf.cjs +23 -0
  38. package/dist/src-DM3syMdf.cjs.map +1 -0
  39. package/dist/style.css +1 -1
  40. package/dist/webpack-stats.json +1 -1
  41. package/dist/y.cjs +1 -1
  42. package/dist/y.cjs.map +1 -1
  43. package/dist/y.js +65 -62
  44. package/dist/y.js.map +1 -1
  45. package/dist/yjs.cjs +1 -1
  46. package/dist/yjs.cjs.map +1 -1
  47. package/dist/yjs.js +88 -76
  48. package/dist/yjs.js.map +1 -1
  49. package/package.json +29 -30
  50. package/src/api/blockManipulation/commands/updateBlock/__snapshots__/updateBlock.test.ts.snap +2505 -763
  51. package/src/api/blockManipulation/commands/updateBlock/updateBlock.test.ts +42 -0
  52. package/src/api/blockManipulation/commands/updateBlock/updateBlock.ts +16 -4
  53. package/src/api/clipboard/fromClipboard/handleFileInsertion.ts +10 -1
  54. package/src/api/exporters/html/util/serializeBlocksExternalHTML.ts +42 -8
  55. package/src/api/exporters/markdown/htmlToMarkdown.ts +45 -10
  56. package/src/api/exporters/markdown/markdownExporter.ts +10 -1
  57. package/src/api/nodeConversions/blockToNode.ts +5 -1
  58. package/src/api/nodeConversions/nodeToBlock.ts +3 -0
  59. package/src/api/parsers/html/parseHTML.ts +43 -0
  60. package/src/api/pmUtil.ts +16 -8
  61. package/src/blocks/Code/CodeBlockOptions.ts +83 -0
  62. package/src/blocks/Code/block.test.ts +1 -1
  63. package/src/blocks/Code/block.ts +29 -281
  64. package/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.ts +120 -0
  65. package/src/blocks/Code/helpers/parse/parsePreCode.ts +45 -0
  66. package/src/blocks/Code/helpers/render/createCodeBlock.ts +98 -0
  67. package/src/blocks/Code/helpers/toExternalHTML/createPreCode.ts +14 -0
  68. package/src/blocks/Table/TableExtension.test.ts +102 -0
  69. package/src/blocks/ToggleWrapper/createToggleWrapper.ts +16 -5
  70. package/src/blocks/defaultBlockTypeGuards.ts +6 -0
  71. package/src/blocks/index.ts +3 -0
  72. package/src/comments/extension.ts +2 -4
  73. package/src/editor/Block.css +324 -3
  74. package/src/editor/BlockNoteEditor.ts +25 -4
  75. package/src/editor/BlockNoteExtension.ts +1 -1
  76. package/src/editor/managers/ExtensionManager/extensions.ts +6 -0
  77. package/src/exporter/ExportImage.ts +50 -0
  78. package/src/exporter/Exporter.test.ts +48 -0
  79. package/src/exporter/Exporter.ts +46 -12
  80. package/src/exporter/index.ts +1 -0
  81. package/src/exporter/mapping.ts +4 -1
  82. package/src/extensions/FormattingToolbar/FormattingToolbar.ts +10 -8
  83. package/src/extensions/InlineContentBoundaryEdit/InlineContentBoundaryEdit.ts +109 -0
  84. package/src/extensions/SideMenu/SideMenu.ts +20 -3
  85. package/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.ts +192 -0
  86. package/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.ts +142 -0
  87. package/src/extensions/SuggestionMenu/SuggestionMenu.test.ts +118 -0
  88. package/src/extensions/SuggestionMenu/SuggestionMenu.ts +40 -27
  89. package/src/extensions/SuggestionMenu/getDefaultSlashMenuItems.ts +13 -3
  90. package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.ts +120 -0
  91. package/src/extensions/SyntaxHighlighting/SyntaxHighlighting.ts +89 -0
  92. package/src/extensions/SyntaxHighlighting/inlineHighlight.test.ts +135 -0
  93. package/src/extensions/SyntaxHighlighting/shiki.ts +116 -0
  94. package/src/extensions/TableHandles/TableHandles.ts +25 -12
  95. package/src/extensions/TrailingNode/TrailingNode.ts +98 -32
  96. package/src/extensions/Versioning/inMemoryVersioning.ts +13 -3
  97. package/src/extensions/index.ts +4 -0
  98. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.test.ts +51 -2
  99. package/src/extensions/tiptap-extensions/KeyboardShortcuts/KeyboardShortcutsExtension.ts +22 -2
  100. package/src/i18n/locales/ar.ts +9 -0
  101. package/src/i18n/locales/de.ts +9 -0
  102. package/src/i18n/locales/en.ts +9 -0
  103. package/src/i18n/locales/es.ts +9 -0
  104. package/src/i18n/locales/fa.ts +9 -0
  105. package/src/i18n/locales/fr.ts +9 -0
  106. package/src/i18n/locales/he.ts +9 -0
  107. package/src/i18n/locales/hr.ts +9 -0
  108. package/src/i18n/locales/is.ts +9 -0
  109. package/src/i18n/locales/it.ts +9 -0
  110. package/src/i18n/locales/ja.ts +9 -0
  111. package/src/i18n/locales/ko.ts +9 -0
  112. package/src/i18n/locales/nl.ts +9 -0
  113. package/src/i18n/locales/no.ts +9 -0
  114. package/src/i18n/locales/pl.ts +9 -0
  115. package/src/i18n/locales/pt.ts +9 -0
  116. package/src/i18n/locales/ru.ts +9 -0
  117. package/src/i18n/locales/sk.ts +9 -0
  118. package/src/i18n/locales/uk.ts +9 -0
  119. package/src/i18n/locales/uz.ts +9 -0
  120. package/src/i18n/locales/vi.ts +9 -0
  121. package/src/i18n/locales/zh-tw.ts +9 -0
  122. package/src/i18n/locales/zh.ts +9 -0
  123. package/src/index.ts +6 -1
  124. package/src/schema/blocks/createSpec.ts +17 -5
  125. package/src/schema/blocks/internal.test.ts +86 -0
  126. package/src/schema/blocks/internal.ts +64 -0
  127. package/src/schema/blocks/types.ts +53 -3
  128. package/src/schema/contentTypePropagation.test.ts +1 -1
  129. package/src/schema/inlineContent/createSpec.test.ts +161 -0
  130. package/src/schema/inlineContent/createSpec.ts +180 -13
  131. package/src/schema/inlineContent/internal.ts +21 -2
  132. package/src/schema/inlineContent/types.ts +35 -5
  133. package/src/schema/nodeViewMutations.test.ts +121 -0
  134. package/src/schema/nodeViewMutations.ts +46 -0
  135. package/src/user/UserStore.ts +1 -1
  136. package/src/util/Store.test.ts +132 -0
  137. package/src/util/Store.ts +135 -0
  138. package/src/y/extensions/AttributionExtension.test.ts +10 -0
  139. package/src/y/extensions/Versioning.test.ts +20 -7
  140. package/src/yjs/comments/RESTYjsThreadStore.test.ts +85 -0
  141. package/src/yjs/comments/RESTYjsThreadStore.ts +7 -1
  142. package/src/yjs/extensions/ForkYDoc.test.ts +37 -0
  143. package/src/yjs/extensions/ForkYDoc.ts +26 -1
  144. package/src/yjs/extensions/RelativePositionMapping.ts +8 -2
  145. package/src/yjs/extensions/Versioning.test.ts +17 -5
  146. package/types/src/api/exporters/html/util/serializeBlocksExternalHTML.d.ts +13 -0
  147. package/types/src/api/pmUtil.d.ts +7 -7
  148. package/types/src/blocks/Code/CodeBlockOptions.d.ts +61 -0
  149. package/types/src/blocks/Code/block.d.ts +3 -53
  150. package/types/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.d.ts +35 -0
  151. package/types/src/blocks/Code/helpers/parse/parsePreCode.d.ts +8 -0
  152. package/types/src/blocks/Code/helpers/render/createCodeBlock.d.ts +18 -0
  153. package/types/src/blocks/Code/helpers/toExternalHTML/createPreCode.d.ts +5 -0
  154. package/types/src/blocks/defaultBlockTypeGuards.d.ts +2 -0
  155. package/types/src/blocks/index.d.ts +3 -0
  156. package/types/src/comments/extension.d.ts +1 -15
  157. package/types/src/editor/BlockNoteEditor.d.ts +3 -3
  158. package/types/src/editor/BlockNoteExtension.d.ts +1 -1
  159. package/types/src/exporter/ExportImage.d.ts +36 -0
  160. package/types/src/exporter/Exporter.d.ts +21 -0
  161. package/types/src/exporter/Exporter.test.d.ts +1 -0
  162. package/types/src/exporter/index.d.ts +1 -0
  163. package/types/src/exporter/mapping.d.ts +1 -1
  164. package/types/src/extensions/FilePanel/FilePanel.d.ts +1 -1
  165. package/types/src/extensions/FormattingToolbar/FormattingToolbar.d.ts +1 -1
  166. package/types/src/extensions/InlineContentBoundaryEdit/InlineContentBoundaryEdit.d.ts +5 -0
  167. package/types/src/extensions/ShowSelection/ShowSelection.d.ts +1 -5
  168. package/types/src/extensions/SideMenu/SideMenu.d.ts +6 -1
  169. package/types/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.d.ts +45 -0
  170. package/types/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.d.ts +49 -0
  171. package/types/src/extensions/SuggestionMenu/SuggestionMenu.d.ts +7 -11
  172. package/types/src/extensions/SyntaxHighlighting/SyntaxHighlighting.d.ts +44 -0
  173. package/types/src/extensions/SyntaxHighlighting/SyntaxHighlighting.test.d.ts +1 -0
  174. package/types/src/extensions/SyntaxHighlighting/inlineHighlight.test.d.ts +1 -0
  175. package/types/src/extensions/SyntaxHighlighting/shiki.d.ts +13 -0
  176. package/types/src/extensions/TableHandles/TableHandles.d.ts +1 -1
  177. package/types/src/extensions/TrailingNode/TrailingNode.d.ts +5 -4
  178. package/types/src/extensions/Versioning/Versioning.d.ts +1 -35
  179. package/types/src/extensions/index.d.ts +4 -0
  180. package/types/src/i18n/locales/en.d.ts +9 -0
  181. package/types/src/i18n/locales/fa.d.ts +9 -0
  182. package/types/src/i18n/locales/sk.d.ts +9 -0
  183. package/types/src/index.d.ts +3 -1
  184. package/types/src/schema/blocks/internal.d.ts +21 -0
  185. package/types/src/schema/blocks/internal.test.d.ts +1 -0
  186. package/types/src/schema/blocks/types.d.ts +36 -3
  187. package/types/src/schema/inlineContent/createSpec.d.ts +35 -3
  188. package/types/src/schema/inlineContent/createSpec.test.d.ts +1 -0
  189. package/types/src/schema/inlineContent/internal.d.ts +3 -2
  190. package/types/src/schema/inlineContent/types.d.ts +22 -3
  191. package/types/src/schema/nodeViewMutations.d.ts +3 -0
  192. package/types/src/schema/nodeViewMutations.test.d.ts +1 -0
  193. package/types/src/user/UserStore.d.ts +1 -1
  194. package/types/src/util/Store.d.ts +45 -0
  195. package/types/src/util/Store.test.d.ts +1 -0
  196. package/types/src/y/extensions/AttributionExtension.d.ts +1 -1
  197. package/types/src/y/extensions/DiffVersioningExtension.d.ts +1 -1
  198. package/types/src/y/extensions/ForkYDoc.d.ts +1 -5
  199. package/types/src/y/extensions/index.d.ts +2 -10
  200. package/types/src/yjs/comments/RESTYjsThreadStore.test.d.ts +1 -0
  201. package/types/src/yjs/extensions/ForkYDoc.d.ts +1 -5
  202. package/types/src/yjs/extensions/index.d.ts +1 -5
  203. package/dist/BlockNoteExtension-B_IEJHS8.js +0 -38
  204. package/dist/BlockNoteExtension-B_IEJHS8.js.map +0 -1
  205. package/dist/BlockNoteExtension-M0znTzxP.cjs +0 -2
  206. package/dist/BlockNoteExtension-M0znTzxP.cjs.map +0 -1
  207. package/dist/UserStore-QbbPFj0z.js.map +0 -1
  208. package/dist/blocks-BqHv0xhc.cjs +0 -12
  209. package/dist/blocks-BqHv0xhc.cjs.map +0 -1
  210. package/dist/blocks-CiuUGa1E.js.map +0 -1
  211. package/dist/en-C5Z4Ag9_.cjs +0 -2
  212. package/dist/en-C5Z4Ag9_.cjs.map +0 -1
  213. package/dist/en-CGKXfWma.js.map +0 -1
  214. package/dist/extensions-CrUGDOks.js.map +0 -1
  215. package/dist/extensions-Ghr9QqqR.cjs +0 -52
  216. package/dist/extensions-Ghr9QqqR.cjs.map +0 -1
  217. package/dist/src-DTF83Cl9.js.map +0 -1
  218. package/dist/src-OfbaVbMw.cjs +0 -21
  219. package/dist/src-OfbaVbMw.cjs.map +0 -1
  220. package/src/blocks/Code/shiki.ts +0 -73
  221. package/types/src/blocks/Code/shiki.d.ts +0 -4
@@ -0,0 +1,45 @@
1
+ import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
2
+ /**
3
+ * A single editor-wide extension that drives the source popup for blocks that
4
+ * render a preview. Which blocks it activates on is decided by each spec's
5
+ * `meta.hasPreview` flag, so individual blocks opt in rather than the extension
6
+ * being configured with a block type.
7
+ *
8
+ * The extension is registered once (it's a default extension) and is a no-op
9
+ * when no block declares `meta.hasPreview`.
10
+ */
11
+ export declare const SourceBlockWithPreviewExtension: () => import("../..").ExtensionFactoryInstance<{
12
+ key: string;
13
+ store: import("../..").Store<{
14
+ popupOpen: string | undefined;
15
+ selected: string | undefined;
16
+ }>;
17
+ keyboardShortcuts: {
18
+ Enter: ({ editor }: {
19
+ editor: BlockNoteEditor<any, any, any>;
20
+ }) => boolean;
21
+ Escape: ({ editor }: {
22
+ editor: BlockNoteEditor<any, any, any>;
23
+ }) => boolean;
24
+ "Mod-a": ({ editor }: {
25
+ editor: BlockNoteEditor<any, any, any>;
26
+ }) => boolean;
27
+ ArrowUp: ({ editor }: {
28
+ editor: BlockNoteEditor<any>;
29
+ }) => boolean;
30
+ ArrowLeft: ({ editor }: {
31
+ editor: BlockNoteEditor<any>;
32
+ }) => boolean;
33
+ ArrowDown: ({ editor }: {
34
+ editor: BlockNoteEditor<any>;
35
+ }) => boolean;
36
+ ArrowRight: ({ editor }: {
37
+ editor: BlockNoteEditor<any>;
38
+ }) => boolean;
39
+ };
40
+ mount: ({ dom, signal }: {
41
+ dom: HTMLElement;
42
+ root: Document | ShadowRoot;
43
+ signal: AbortSignal;
44
+ }) => void;
45
+ }>;
@@ -0,0 +1,49 @@
1
+ import type { BlockNoteEditor } from "../../editor/BlockNoteEditor";
2
+ /**
3
+ * Inline-content counterpart of {@link SourceBlockWithPreviewExtension}. A
4
+ * single editor-wide extension that drives the source popup for inline content
5
+ * that renders a preview. Which inline content it activates on is decided by
6
+ * each spec's `meta.hasPreview` flag, so individual inline content opts in
7
+ * rather than the extension being configured with a type.
8
+ *
9
+ * Unlike the block version, the popup isn't toggled with a separate state flag:
10
+ * it's open exactly when the selection is inside the inline content's source.
11
+ * The store therefore only tracks which inline content (by its position) holds
12
+ * the selection - moving the selection in opens its popup, moving it out closes
13
+ * it. Since the source popup is always laid out (just hidden via opacity), the
14
+ * cursor can navigate into and out of it with the arrow keys as usual.
15
+ *
16
+ * The extension is registered once (it's a default extension) and is a no-op
17
+ * when no inline content declares `meta.hasPreview`.
18
+ */
19
+ export declare const SourceInlineContentWithPreviewExtension: () => import("../..").ExtensionFactoryInstance<{
20
+ key: string;
21
+ store: import("../..").Store<{
22
+ selected: number | undefined;
23
+ }>;
24
+ keyboardShortcuts: {
25
+ Enter: ({ editor }: {
26
+ editor: BlockNoteEditor<any, any, any>;
27
+ }) => boolean;
28
+ "Shift-Enter": ({ editor }: {
29
+ editor: BlockNoteEditor<any, any, any>;
30
+ }) => boolean;
31
+ Escape: ({ editor }: {
32
+ editor: BlockNoteEditor<any, any, any>;
33
+ }) => boolean;
34
+ ArrowUp: ({ editor }: {
35
+ editor: BlockNoteEditor<any, any, any>;
36
+ }) => boolean;
37
+ ArrowDown: ({ editor }: {
38
+ editor: BlockNoteEditor<any, any, any>;
39
+ }) => boolean;
40
+ "Mod-a": ({ editor }: {
41
+ editor: BlockNoteEditor<any, any, any>;
42
+ }) => boolean;
43
+ };
44
+ mount: ({ dom, signal }: {
45
+ dom: HTMLElement;
46
+ root: Document | ShadowRoot;
47
+ signal: AbortSignal;
48
+ }) => void;
49
+ }>;
@@ -13,6 +13,12 @@ type SuggestionPluginState = {
13
13
  ignoreQueryLength?: boolean;
14
14
  } | undefined;
15
15
  export type SuggestionMenuOptions = {
16
+ /**
17
+ * The string that opens the suggestion menu when typed. Usually a single
18
+ * character (e.g. `"/"` or `"@"`), but multi-character strings such as
19
+ * `"img:"` are also supported. When multiple triggers could match the typed
20
+ * text, the longest one takes precedence.
21
+ */
16
22
  triggerCharacter: string;
17
23
  /**
18
24
  * Optional callback to determine whether the suggestion menu should be
@@ -33,17 +39,7 @@ export type SuggestionMenuOptions = {
33
39
  */
34
40
  export declare const SuggestionMenu: (options?: any) => import("../../index.js").ExtensionFactoryInstance<{
35
41
  readonly key: "suggestionMenu";
36
- readonly store: import("@tanstack/store").Store<(UiElementPosition & {
37
- query: string;
38
- ignoreQueryLength?: boolean;
39
- } & {
40
- triggerCharacter: string;
41
- }) | undefined, (cb: (UiElementPosition & {
42
- query: string;
43
- ignoreQueryLength?: boolean;
44
- } & {
45
- triggerCharacter: string;
46
- }) | undefined) => (UiElementPosition & {
42
+ readonly store: import("../../index.js").Store<(UiElementPosition & {
47
43
  query: string;
48
44
  ignoreQueryLength?: boolean;
49
45
  } & {
@@ -0,0 +1,44 @@
1
+ import type { HighlighterGeneric } from "@shikijs/types";
2
+ export type SyntaxHighlightingOptions = {
3
+ /**
4
+ * Creates the Shiki highlighter used for syntax highlighting. Can be
5
+ * asynchronous, so the highlighter is only loaded once it's first needed.
6
+ *
7
+ * When omitted, content renders without syntax highlighting.
8
+ */
9
+ createHighlighter: () => Promise<HighlighterGeneric<any, any>>;
10
+ };
11
+ /**
12
+ * Collects the node type names that should be syntax-highlighted from a schema's
13
+ * block and inline-content specs.
14
+ *
15
+ * A spec is a candidate when it has a `meta.highlight` callback (which decides
16
+ * the language) AND the node actually holds editable text. Block and
17
+ * inline-content specs use different `content` value spaces, so "editable text"
18
+ * means `content === "plain"` for both blocks (code/math blocks) and inline
19
+ * content (inline math) - both hold plain text - hence the two are filtered
20
+ * separately.
21
+ *
22
+ * Inline content (e.g. inline math) is highlighted too: `prosemirror-highlight`
23
+ * collects nodes by `node.inlineContent` since v0.15.3
24
+ * (https://github.com/ocavue/prosemirror-highlight/pull/137), so inline nodes
25
+ * holding inline content are visited alongside text blocks.
26
+ */
27
+ export declare function collectHighlightNodeTypes(schema: {
28
+ blockSpecs: Record<string, unknown>;
29
+ inlineContentSpecs: Record<string, unknown>;
30
+ }): string[];
31
+ /**
32
+ * A single editor-wide extension that syntax-highlights block and inline-content
33
+ * content. Which nodes get highlighted (and as which language) is decided by
34
+ * each spec's `meta.highlight` callback, so individual specs declare their own
35
+ * language rather than the extension configuring them.
36
+ *
37
+ * Highlighting is opt-in: the user adds this extension to the editor's
38
+ * `extensions` (configured with a `createHighlighter`) to enable it. When it's
39
+ * absent, content renders as plain text.
40
+ */
41
+ export declare const SyntaxHighlightingExtension: (options: SyntaxHighlightingOptions) => import("../../index.js").ExtensionFactoryInstance<{
42
+ key: string;
43
+ prosemirrorPlugins: import("prosemirror-state").Plugin<import("prosemirror-highlight").HighlightPluginState>[];
44
+ }>;
@@ -0,0 +1,13 @@
1
+ import type { SyntaxHighlightingOptions } from "./SyntaxHighlighting.js";
2
+ import { CustomBlockNoteSchema } from "../../schema/schema.js";
3
+ export declare const shikiParserSymbol: unique symbol;
4
+ export declare const shikiHighlighterPromiseSymbol: unique symbol;
5
+ /**
6
+ * Creates the syntax highlighting plugin for the given block types, lazily
7
+ * loading the highlighter on first use.
8
+ *
9
+ * Each spec's `meta.highlight` callback resolves a node to a language, which is
10
+ * passed straight to Shiki - it resolves aliases and loads the grammar from its
11
+ * bundle, so any language the provided highlighter bundles can be highlighted.
12
+ */
13
+ export declare function lazyShikiPlugin(options: SyntaxHighlightingOptions, nodeTypes: string[], schema: CustomBlockNoteSchema<any, any, any>): import("prosemirror-state").Plugin<import("prosemirror-highlight").HighlightPluginState>;
@@ -43,7 +43,7 @@ export declare class TableHandlesView implements PluginView {
43
43
  export declare const tableHandlesPluginKey: PluginKey<any>;
44
44
  export declare const TableHandlesExtension: (options?: any) => import("../../index.js").ExtensionFactoryInstance<{
45
45
  readonly key: "tableHandles";
46
- readonly store: import("@tanstack/store").Store<TableHandlesState | undefined, (cb: TableHandlesState | undefined) => TableHandlesState | undefined>;
46
+ readonly store: import("../../index.js").Store<TableHandlesState | undefined>;
47
47
  readonly prosemirrorPlugins: readonly [Plugin<any>];
48
48
  /**
49
49
  * Callback that should be set on the `dragStart` event for whichever element
@@ -2,10 +2,11 @@ import { Plugin } from "prosemirror-state";
2
2
  import { DecorationSet } from "prosemirror-view";
3
3
  /**
4
4
  * Renders a fake trailing block as a widget decoration after the last block of
5
- * the document. Clicking it inserts a real trailing block and moves the
6
- * selection into it. This way the trailing block is not part of the document
7
- * content, so it doesn't appear when the editor is read-only or when the
8
- * content is exported.
5
+ * the document, as well as of any other container that blocks can be appended
6
+ * to (e.g. columns). Clicking it inserts a real trailing block in the
7
+ * container and moves the selection into it. This way the trailing block is
8
+ * not part of the document content, so it doesn't appear when the editor is
9
+ * read-only or when the content is exported.
9
10
  */
10
11
  export declare const TrailingNodeExtension: (options?: Record<string, any> | undefined) => import("../../index.js").ExtensionFactoryInstance<{
11
12
  readonly key: "trailingNode";
@@ -261,41 +261,7 @@ export type VersioningExtensionOptions<Input = any, Output = any, Attributions =
261
261
  };
262
262
  export declare const VersioningExtension: (options: VersioningExtensionOptions<any, any, any> | ((editor: BlockNoteEditor<any, any, any>) => VersioningExtensionOptions)) => import("../../index.js").ExtensionFactoryInstance<{
263
263
  readonly key: "versioning";
264
- readonly store: import("@tanstack/store").Store<{
265
- snapshots: VersionSnapshot[];
266
- /**
267
- * The id of the version currently shown in the editor (the "new" side of
268
- * a diff). `undefined` means the live, editable document. Is the
269
- * {@link CURRENT_VERSION_ID} symbol when previewing the live document as a
270
- * read-only diff against a snapshot.
271
- */
272
- previewedSnapshotId?: string | typeof CURRENT_VERSION_ID;
273
- /**
274
- * The id of the snapshot the preview is being diffed against (the
275
- * "baseline" / old side). `undefined` when not showing a diff. Always a
276
- * real snapshot id (never the current entry), but typed as the same union
277
- * as {@link VersionSnapshot.id} since it's copied from one. Used to render
278
- * the "Comparing to" indicator in the sidebar.
279
- */
280
- compareToSnapshotId?: string | typeof CURRENT_VERSION_ID;
281
- }, (cb: {
282
- snapshots: VersionSnapshot[];
283
- /**
284
- * The id of the version currently shown in the editor (the "new" side of
285
- * a diff). `undefined` means the live, editable document. Is the
286
- * {@link CURRENT_VERSION_ID} symbol when previewing the live document as a
287
- * read-only diff against a snapshot.
288
- */
289
- previewedSnapshotId?: string | typeof CURRENT_VERSION_ID;
290
- /**
291
- * The id of the snapshot the preview is being diffed against (the
292
- * "baseline" / old side). `undefined` when not showing a diff. Always a
293
- * real snapshot id (never the current entry), but typed as the same union
294
- * as {@link VersionSnapshot.id} since it's copied from one. Used to render
295
- * the "Comparing to" indicator in the sidebar.
296
- */
297
- compareToSnapshotId?: string | typeof CURRENT_VERSION_ID;
298
- }) => {
264
+ readonly store: import("../../index.js").Store<{
299
265
  snapshots: VersionSnapshot[];
300
266
  /**
301
267
  * The id of the version currently shown in the editor (the "new" side of
@@ -3,6 +3,7 @@ export * from "./DropCursor/DropCursor.js";
3
3
  export * from "./FilePanel/FilePanel.js";
4
4
  export * from "./FormattingToolbar/FormattingToolbar.js";
5
5
  export * from "./History/History.js";
6
+ export * from "./InlineContentBoundaryEdit/InlineContentBoundaryEdit.js";
6
7
  export * from "./LinkToolbar/LinkToolbar.js";
7
8
  export * from "./LinkToolbar/protocols.js";
8
9
  export * from "./NodeSelectionKeyboard/NodeSelectionKeyboard.js";
@@ -11,7 +12,10 @@ export * from "./PositionMapping/PositionMapping.js";
11
12
  export * from "./PreviousBlockType/PreviousBlockType.js";
12
13
  export * from "./ShowSelection/ShowSelection.js";
13
14
  export * from "./SideMenu/SideMenu.js";
15
+ export * from "./SourceBlockWithPreview/SourceBlockWithPreview.js";
16
+ export * from "./SourceInlineContentWithPreview/SourceInlineContentWithPreview.js";
14
17
  export * from "./SuggestionMenu/DefaultGridSuggestionItem.js";
18
+ export * from "./SyntaxHighlighting/SyntaxHighlighting.js";
15
19
  export * from "./SuggestionMenu/DefaultSuggestionItem.js";
16
20
  export * from "./SuggestionMenu/getDefaultEmojiPickerItems.js";
17
21
  export * from "./SuggestionMenu/getDefaultSlashMenuItems.js";
@@ -152,6 +152,10 @@ export declare const en: {
152
152
  toggle_blocks: {
153
153
  add_block_button: string;
154
154
  };
155
+ code_block: {
156
+ add_source_button_text: string;
157
+ ok_button_text: string;
158
+ };
155
159
  side_menu: {
156
160
  add_block_label: string;
157
161
  drag_handle_label: string;
@@ -324,6 +328,11 @@ export declare const en: {
324
328
  deleted_by: (users: string) => string;
325
329
  formatting_change_by: (formats: string, users: string) => string;
326
330
  };
331
+ exporter: {
332
+ open_file: string;
333
+ open_video_file: string;
334
+ open_audio_file: string;
335
+ };
327
336
  generic: {
328
337
  ctrl_shortcut: string;
329
338
  };
@@ -152,6 +152,10 @@ export declare const fa: {
152
152
  toggle_blocks: {
153
153
  add_block_button: string;
154
154
  };
155
+ code_block: {
156
+ add_source_button_text: string;
157
+ ok_button_text: string;
158
+ };
155
159
  side_menu: {
156
160
  add_block_label: string;
157
161
  drag_handle_label: string;
@@ -324,6 +328,11 @@ export declare const fa: {
324
328
  deleted_by: (users: string) => string;
325
329
  formatting_change_by: (formats: string, users: string) => string;
326
330
  };
331
+ exporter: {
332
+ open_file: string;
333
+ open_video_file: string;
334
+ open_audio_file: string;
335
+ };
327
336
  generic: {
328
337
  ctrl_shortcut: string;
329
338
  };
@@ -152,6 +152,10 @@ export declare const sk: {
152
152
  toggle_blocks: {
153
153
  add_block_button: string;
154
154
  };
155
+ code_block: {
156
+ add_source_button_text: string;
157
+ ok_button_text: string;
158
+ };
155
159
  side_menu: {
156
160
  add_block_label: string;
157
161
  drag_handle_label: string;
@@ -359,6 +363,11 @@ export declare const sk: {
359
363
  deleted_by: (users: string) => string;
360
364
  formatting_change_by: (formats: string, users: string) => string;
361
365
  };
366
+ exporter: {
367
+ open_file: string;
368
+ open_video_file: string;
369
+ open_audio_file: string;
370
+ };
362
371
  generic: {
363
372
  ctrl_shortcut: string;
364
373
  };
@@ -23,14 +23,16 @@ export * from "./user/index.js";
23
23
  export * from "./util/browser.js";
24
24
  export * from "./util/combineByGroup.js";
25
25
  export * from "./util/expandToWords.js";
26
+ export * from "./util/Store.js";
26
27
  export * from "./util/string.js";
27
28
  export * from "./util/table.js";
28
29
  export * from "./util/typescript.js";
29
- export type { CodeBlockOptions } from "./blocks/Code/block.js";
30
+ export type { CodeBlockOptions, CodeBlockPreview, } from "./blocks/Code/CodeBlockOptions.js";
30
31
  export { assertEmpty, UnreachableCaseError } from "./util/typescript.js";
31
32
  export * from "./util/EventEmitter.js";
32
33
  export { selectedFragmentToHTML } from "./api/clipboard/toClipboard/copyExtension.js";
33
34
  export * from "./api/nodeConversions/blockToNode.js";
35
+ export * from "./api/nodeConversions/fragmentToBlocks.js";
34
36
  export * from "./api/nodeConversions/nodeToBlock.js";
35
37
  export * from "./extensions/tiptap-extensions/UniqueID/UniqueID.js";
36
38
  export * from "./api/exporters/markdown/markdownExporter.js";
@@ -5,6 +5,27 @@ import { PropSchema, Props } from "../propTypes.js";
5
5
  import { LooseBlockSpec } from "./types.js";
6
6
  export declare function propsToAttributes(propSchema: PropSchema): Attributes;
7
7
  export declare function getBlockFromPos(getPos: () => number | undefined, doc: PMNode): import("../../index.js").Block<Record<string, import("./types.js").BlockConfig<string, PropSchema, "inline" | "none" | "plain" | "table">>, import("../index.js").InlineContentSchema, import("../index.js").StyleSchema>;
8
+ /**
9
+ * Resolves the block a node view should render, tolerating a `getPos()` that
10
+ * can't be trusted.
11
+ *
12
+ * ProseMirror derives `getPos()` from its view-desc tree, but
13
+ * `EditorView.updateStateInner` assigns the new state *before* it reconciles
14
+ * that tree. Anything that runs partway through reconciliation - a re-entrant
15
+ * dispatch from a node view's effect, TipTap's `flushSync` while mounting a
16
+ * node view - therefore sees positions that no longer line up with
17
+ * `view.state.doc`. The position then either lands out of range or, just as
18
+ * bad, in range but pointing at the wrong node.
19
+ *
20
+ * Node views are constructed inside that same window, so this applies at
21
+ * construction just as much as on re-render. The state is always transient:
22
+ * ProseMirror finishes reconciling and rebuilds the node view against the
23
+ * current document immediately after. So we degrade instead of throwing,
24
+ * because a stale frame is invisible where a throw is not.
25
+ *
26
+ * See issues #2937, #2682 and #2621.
27
+ */
28
+ export declare function getBlockFromNodeView(getPos: () => number | undefined, node: PMNode, doc: PMNode): import("../../index.js").Block<Record<string, import("./types.js").BlockConfig<string, PropSchema, "inline" | "none" | "plain" | "table">>, import("../index.js").InlineContentSchema, import("../index.js").StyleSchema>;
8
29
  export declare function wrapInBlockStructure<BType extends string, PSchema extends PropSchema>(element: {
9
30
  dom: HTMLElement | DocumentFragment;
10
31
  contentDOM?: HTMLElement;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,6 @@
1
1
  /** Define the main block types **/
2
2
  import type { Node, NodeViewRendererProps } from "@tiptap/core";
3
- import type { Fragment, Schema } from "prosemirror-model";
3
+ import type { Fragment, Node as ProsemirrorNode, Schema } from "prosemirror-model";
4
4
  import type { ViewMutationRecord } from "prosemirror-view";
5
5
  import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
6
6
  import type { Extension, ExtensionFactoryInstance } from "../../editor/BlockNoteExtension.js";
@@ -11,7 +11,7 @@ export type BlockNoteDOMElement = "editor" | "block" | "blockGroup" | "blockCont
11
11
  export type BlockNoteDOMAttributes = Partial<{
12
12
  [DOMElement in BlockNoteDOMElement]: Record<string, string>;
13
13
  }>;
14
- export interface BlockConfigMeta {
14
+ export interface BlockConfigMeta<TName extends string = string, TProps extends PropSchema = PropSchema> {
15
15
  /**
16
16
  * Defines which keyboard shortcut should be used to insert a hard break into the block's inline content.
17
17
  * @default "shift+enter"
@@ -37,6 +37,19 @@ export interface BlockConfigMeta {
37
37
  * Whether the block is a {@link https://prosemirror.net/docs/ref/#model.NodeSpec.isolating} block
38
38
  */
39
39
  isolating?: boolean;
40
+ /**
41
+ * Enables syntax highlighting of the contents of the block with the result of this callback
42
+ */
43
+ highlight?(block: {
44
+ type: TName;
45
+ props: Props<TProps>;
46
+ }): string | undefined;
47
+ /**
48
+ * Marks the block as rendering a preview with an editable source popup, driven
49
+ * by the editor-wide `SourceBlockWithPreviewExtension`. When `true`, the
50
+ * block's source is hidden behind its preview and edited via the popup.
51
+ */
52
+ hasPreview?: boolean;
40
53
  }
41
54
  /**
42
55
  * BlockConfig contains the "schema" info about a Block type
@@ -102,6 +115,7 @@ export type LooseBlockSpec<T extends string = string, PS extends PropSchema = Pr
102
115
  dom: HTMLElement | DocumentFragment;
103
116
  contentDOM?: HTMLElement;
104
117
  ignoreMutation?: (mutation: ViewMutationRecord) => boolean;
118
+ update?: (node: ProsemirrorNode) => boolean;
105
119
  destroy?: () => void;
106
120
  };
107
121
  toExternalHTML?: (block: any, editor: BlockNoteEditor<any>, context: {
@@ -137,6 +151,7 @@ export type BlockSpecs = {
137
151
  dom: HTMLElement | DocumentFragment;
138
152
  contentDOM?: HTMLElement;
139
153
  ignoreMutation?: (mutation: ViewMutationRecord) => boolean;
154
+ update?: (node: ProsemirrorNode) => boolean;
140
155
  destroy?: () => void;
141
156
  };
142
157
  toExternalHTML?: (block: any, editor: BlockNoteEditor<any>, context: {
@@ -191,6 +206,13 @@ export type PlainContent = (StyledText<{}> & {
191
206
  export type PartialPlainContent = string | (string | (StyledText<{}> & {
192
207
  styles: Record<string, never>;
193
208
  }))[];
209
+ /**
210
+ * The text of a block's `"plain"` content (e.g. a code block's source code).
211
+ * Accepts the partial form too: block render/export paths can receive
212
+ * `PartialBlock`s (e.g. the HTML serializers take them directly), where
213
+ * plain content may still be the bare-string sugar.
214
+ */
215
+ export declare function plainContentToString(content: PlainContent | PartialPlainContent): string;
194
216
  export type BlockFromConfigNoChildren<B extends BlockConfig, I extends InlineContentSchema, S extends StyleSchema> = {
195
217
  id: string;
196
218
  type: B["type"];
@@ -254,7 +276,7 @@ export type BlockImplementation<TName extends string = string, TProps extends Pr
254
276
  /**
255
277
  * Metadata
256
278
  */
257
- meta?: BlockConfigMeta;
279
+ meta?: BlockConfigMeta<TName, TProps>;
258
280
  /**
259
281
  * A function that converts the block into a DOM element
260
282
  */
@@ -279,6 +301,17 @@ export type BlockImplementation<TName extends string = string, TProps extends Pr
279
301
  dom: HTMLElement | DocumentFragment;
280
302
  contentDOM?: HTMLElement;
281
303
  ignoreMutation?: (mutation: ViewMutationRecord) => boolean;
304
+ /**
305
+ * Called by ProseMirror when this block's node is updated (e.g. its content
306
+ * or props change). Return `true` to handle the update in place - keeping
307
+ * the existing DOM - or `false` to have the node view recreated via
308
+ * `render`. When omitted, ProseMirror keeps the node view and reconciles its
309
+ * `contentDOM` in place as long as the node type stays the same.
310
+ *
311
+ * Useful for blocks whose `render` builds custom DOM that needs to stay in
312
+ * sync with the node (e.g. a code block rendering a preview of its content).
313
+ */
314
+ update?: (node: ProsemirrorNode) => boolean;
282
315
  destroy?: () => void;
283
316
  };
284
317
  /**
@@ -1,4 +1,4 @@
1
- import { TagParseRule } from "@tiptap/pm/model";
1
+ import { Fragment, Node as ProsemirrorNode, Schema, TagParseRule } from "@tiptap/pm/model";
2
2
  import type { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
3
3
  import { Props } from "../propTypes.js";
4
4
  import { StyleSchema } from "../styles/types.js";
@@ -6,11 +6,33 @@ import { CustomInlineContentConfig, InlineContentFromConfig, InlineContentSpec,
6
6
  export type CustomInlineContentImplementation<T extends CustomInlineContentConfig, S extends StyleSchema> = {
7
7
  meta?: {
8
8
  draggable?: boolean;
9
+ code?: boolean;
10
+ /**
11
+ * When {@link code} is `true`, this can syntax highlight the contents of the
12
+ * inline content with the result of this callback.
13
+ */
14
+ highlight?(inlineContent: Pick<InlineContentFromConfig<T, S>, "type" | "props">): string | undefined;
15
+ /**
16
+ * Marks the inline content as rendering a preview with an editable source
17
+ * popup, driven by the editor-wide
18
+ * `SourceInlineContentWithPreviewExtension`.
19
+ */
20
+ hasPreview?: boolean;
9
21
  };
10
22
  /**
11
23
  * Parses an external HTML element into a inline content of this type when it returns the block props object, otherwise undefined
12
24
  */
13
25
  parse?: (el: HTMLElement) => Partial<Props<T["propSchema"]>> | undefined;
26
+ /**
27
+ * Advanced parsing function that controls how the content within the inline
28
+ * content is parsed. This is not recommended to use, and is only useful for
29
+ * advanced use cases. Only applies to inline content with `content: "styled"`.
30
+ * Return `undefined` to fall through to the default inline content parsing.
31
+ */
32
+ parseContent?: (options: {
33
+ el: HTMLElement;
34
+ schema: Schema;
35
+ }) => Fragment | undefined;
14
36
  /**
15
37
  * Renders an inline content to DOM elements
16
38
  */
@@ -28,7 +50,17 @@ export type CustomInlineContentImplementation<T extends CustomInlineContentConfi
28
50
  * This is typed generically. If you want an editor with your custom schema, you need to
29
51
  * cast it manually, e.g.: `const e = editor as BlockNoteEditor<typeof mySchema>;`
30
52
  */
31
- editor: BlockNoteEditor<any, any, S>) => {
53
+ editor: BlockNoteEditor<any, any, S>,
54
+ /**
55
+ * The ProseMirror node backing this inline content.
56
+ */
57
+ node: ProsemirrorNode,
58
+ /**
59
+ * Returns this inline content's position in the document. When rendered
60
+ * outside the editor (i.e. serialized to HTML), this is a no-op that returns
61
+ * `undefined`.
62
+ */
63
+ getPos: () => number | undefined) => {
32
64
  dom: HTMLElement;
33
65
  contentDOM?: HTMLElement;
34
66
  destroy?: () => void;
@@ -53,5 +85,5 @@ export type CustomInlineContentImplementation<T extends CustomInlineContentConfi
53
85
  } | undefined;
54
86
  runsBefore?: string[];
55
87
  };
56
- export declare function getInlineContentParseRules<C extends CustomInlineContentConfig>(config: C, customParseFunction?: CustomInlineContentImplementation<C, any>["parse"]): TagParseRule[];
88
+ export declare function getInlineContentParseRules<C extends CustomInlineContentConfig>(config: C, customParseFunction?: CustomInlineContentImplementation<C, any>["parse"], customParseContentFunction?: CustomInlineContentImplementation<C, any>["parseContent"]): TagParseRule[];
57
89
  export declare function createInlineContentSpec<T extends CustomInlineContentConfig, S extends StyleSchema>(inlineContentConfig: T, inlineContentImplementation: CustomInlineContentImplementation<T, S>): InlineContentSpec<T>;
@@ -1,4 +1,5 @@
1
1
  import { KeyboardShortcutCommand, Node } from "@tiptap/core";
2
+ import { Extension, ExtensionFactoryInstance } from "../../editor/BlockNoteExtension.js";
2
3
  import { PropSchema, Props } from "../propTypes.js";
3
4
  import { CustomInlineContentConfig, InlineContentImplementation, InlineContentSchemaFromSpecs, InlineContentSpec, InlineContentSpecs } from "./types.js";
4
5
  export declare function addInlineContentAttributes<IType extends string, PSchema extends PropSchema>(element: {
@@ -11,10 +12,10 @@ export declare function addInlineContentAttributes<IType extends string, PSchema
11
12
  export declare function addInlineContentKeyboardShortcuts<T extends CustomInlineContentConfig>(config: T): {
12
13
  [p: string]: KeyboardShortcutCommand;
13
14
  };
14
- export declare function createInternalInlineContentSpec<const T extends CustomInlineContentConfig>(config: T, implementation: InlineContentImplementation<NoInfer<T>>): InlineContentSpec<T>;
15
+ export declare function createInternalInlineContentSpec<const T extends CustomInlineContentConfig>(config: T, implementation: InlineContentImplementation<NoInfer<T>>, extensions?: (Extension | ExtensionFactoryInstance)[]): InlineContentSpec<T>;
15
16
  export declare function createInlineContentSpecFromTipTapNode<T extends Node, P extends PropSchema>(node: T, propSchema: P, implementation: Omit<InlineContentImplementation<CustomInlineContentConfig>, "node">): InlineContentSpec<{
16
17
  readonly type: T["name"];
17
18
  readonly propSchema: P;
18
- readonly content: "none" | "styled";
19
+ readonly content: "none" | "plain" | "styled";
19
20
  }>;
20
21
  export declare function getInlineContentSchemaFromSpecs<T extends InlineContentSpecs>(specs: T): InlineContentSchemaFromSpecs<T>;
@@ -1,17 +1,35 @@
1
1
  import { Node } from "@tiptap/core";
2
2
  import { ViewMutationRecord } from "prosemirror-view";
3
- import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
4
3
  import { PropSchema, Props } from "../propTypes.js";
5
4
  import { StyleSchema, Styles } from "../styles/types.js";
5
+ import { BlockNoteEditor } from "../../editor/BlockNoteEditor.js";
6
+ import { Extension, ExtensionFactoryInstance } from "../../editor/BlockNoteExtension.js";
6
7
  export type CustomInlineContentConfig = {
7
8
  type: string;
8
9
  content: "styled" | "none" | "plain";
9
10
  readonly propSchema: PropSchema;
10
11
  };
11
12
  export type InlineContentConfig = CustomInlineContentConfig | "text" | "link";
12
- export type InlineContentImplementation<T extends InlineContentConfig> = T extends "link" | "text" ? undefined : {
13
+ export type InlineContentImplementation<T extends InlineContentConfig> = T extends CustomInlineContentConfig ? {
13
14
  meta?: {
15
+ /**
16
+ * Whether the inline content is a {@link https://prosemirror.net/docs/ref/#model.NodeSpec.code} block
17
+ */
18
+ code?: boolean;
19
+ /**
20
+ * When {@link code} is `true`, this can syntax highlight the contents of the block with the result of this callback
21
+ */
22
+ highlight?(inlineContent: Pick<CustomInlineContentFromConfig<T, any>, "type" | "props">): string | undefined;
23
+ /**
24
+ * Whether the inline content is draggable
25
+ */
14
26
  draggable?: boolean;
27
+ /**
28
+ * Marks the inline content as rendering a preview with an editable
29
+ * source popup, driven by the editor-wide
30
+ * `SourceInlineContentWithPreviewExtension`.
31
+ */
32
+ hasPreview?: boolean;
15
33
  };
16
34
  node: Node;
17
35
  toExternalHTML?: (inlineContent: any, editor: BlockNoteEditor<any, any, any>) => {
@@ -25,13 +43,14 @@ export type InlineContentImplementation<T extends InlineContentConfig> = T exten
25
43
  destroy?: () => void;
26
44
  };
27
45
  runsBefore?: string[];
28
- };
46
+ } : undefined;
29
47
  export type InlineContentSchemaWithInlineContent<IType extends string, C extends InlineContentConfig> = {
30
48
  [k in IType]: C;
31
49
  };
32
50
  export type InlineContentSpec<T extends InlineContentConfig> = {
33
51
  config: T;
34
52
  implementation: InlineContentImplementation<T>;
53
+ extensions?: (Extension | ExtensionFactoryInstance)[];
35
54
  };
36
55
  export type InlineContentSchema = Record<string, InlineContentConfig>;
37
56
  export type InlineContentSpecs = {
@@ -0,0 +1,3 @@
1
+ import { NodeView, ViewMutationRecord } from "@tiptap/pm/view";
2
+ export declare function isNonContentMutation(mutation: ViewMutationRecord, contentDOM: HTMLElement | null | undefined): boolean;
3
+ export declare function ignoreNonContentMutations(nodeView: NodeView): void;