@blocknote/core 0.54.1 → 0.55.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 (107) hide show
  1. package/dist/BlockNoteExtension-BJCLnwrE.cjs.map +1 -1
  2. package/dist/BlockNoteExtension-CbvDA0F7.js.map +1 -1
  3. package/dist/blocknote.cjs +1 -1
  4. package/dist/blocknote.js +6 -6
  5. package/dist/blocks-DLgTreVu.cjs +12 -0
  6. package/dist/blocks-DLgTreVu.cjs.map +1 -0
  7. package/dist/{blocks-Dol85hpH.js → blocks-DaEUT0O1.js} +346 -340
  8. package/dist/blocks-DaEUT0O1.js.map +1 -0
  9. package/dist/blocks.cjs +1 -1
  10. package/dist/blocks.js +1 -1
  11. package/dist/comments.cjs +1 -1
  12. package/dist/comments.cjs.map +1 -1
  13. package/dist/comments.js +62 -36
  14. package/dist/comments.js.map +1 -1
  15. package/dist/{en-uzHzj6eH.js → en-BAn9gxr-.js} +5 -2
  16. package/dist/{en-uzHzj6eH.js.map → en-BAn9gxr-.js.map} +1 -1
  17. package/dist/{en-BuzSuuTq.cjs → en-CHnrV5l8.cjs} +2 -2
  18. package/dist/{en-BuzSuuTq.cjs.map → en-CHnrV5l8.cjs.map} +1 -1
  19. package/dist/{extensions-D6JcJCwd.js → extensions-B1JQURVF.js} +221 -221
  20. package/dist/extensions-B1JQURVF.js.map +1 -0
  21. package/dist/{extensions-B7Rsp_Ft.cjs → extensions-CZkqKzJO.cjs} +3 -3
  22. package/dist/extensions-CZkqKzJO.cjs.map +1 -0
  23. package/dist/extensions.cjs +1 -1
  24. package/dist/extensions.js +2 -2
  25. package/dist/locales.cjs +1 -1
  26. package/dist/locales.cjs.map +1 -1
  27. package/dist/locales.js +89 -23
  28. package/dist/locales.js.map +1 -1
  29. package/dist/{src-Buuo5l7X.js → src-D5w0XAHX.js} +702 -640
  30. package/dist/src-D5w0XAHX.js.map +1 -0
  31. package/dist/{src-C54Ok9E0.cjs → src-th5uZEvx.cjs} +8 -8
  32. package/dist/src-th5uZEvx.cjs.map +1 -0
  33. package/dist/webpack-stats.json +1 -1
  34. package/dist/y.cjs +1 -1
  35. package/dist/y.js +3 -3
  36. package/dist/yjs.cjs +1 -1
  37. package/dist/yjs.js +1 -1
  38. package/package.json +12 -12
  39. package/src/comments/CommentEditorSubmitExtension.test.ts +141 -0
  40. package/src/comments/CommentEditorSubmitExtension.ts +56 -0
  41. package/src/comments/extension.ts +8 -0
  42. package/src/comments/index.ts +1 -0
  43. package/src/editor/BlockNoteEditor.ts +94 -41
  44. package/src/editor/BlockNoteExtension.ts +6 -1
  45. package/src/editor/managers/EventManager.browser.test.ts +334 -0
  46. package/src/editor/managers/EventManager.ts +128 -31
  47. package/src/editor/managers/ExtensionManager/ExtensionManager.test.ts +88 -1
  48. package/src/editor/managers/ExtensionManager/index.ts +30 -7
  49. package/src/editor/managers/StyleManager.browser.test.ts +122 -0
  50. package/src/editor/managers/StyleManager.test.ts +98 -0
  51. package/src/editor/managers/StyleManager.ts +31 -15
  52. package/src/editor/managers/index.ts +1 -0
  53. package/src/extensions/FormattingToolbar/FormattingToolbar.ts +23 -0
  54. package/src/extensions/SideMenu/SideMenu.ts +15 -0
  55. package/src/extensions/TableHandles/TableHandles.browser.test.ts +3 -1
  56. package/src/i18n/locales/ar.ts +1 -0
  57. package/src/i18n/locales/de.ts +1 -0
  58. package/src/i18n/locales/en.ts +1 -0
  59. package/src/i18n/locales/es.ts +1 -0
  60. package/src/i18n/locales/fa.ts +1 -0
  61. package/src/i18n/locales/fr.ts +1 -0
  62. package/src/i18n/locales/he.ts +1 -0
  63. package/src/i18n/locales/hr.ts +1 -0
  64. package/src/i18n/locales/is.ts +1 -0
  65. package/src/i18n/locales/it.ts +1 -0
  66. package/src/i18n/locales/ja.ts +1 -0
  67. package/src/i18n/locales/ko.ts +1 -0
  68. package/src/i18n/locales/nl.ts +1 -0
  69. package/src/i18n/locales/no.ts +1 -0
  70. package/src/i18n/locales/pl.ts +1 -0
  71. package/src/i18n/locales/pt.ts +1 -0
  72. package/src/i18n/locales/ru.ts +1 -0
  73. package/src/i18n/locales/sk.ts +1 -0
  74. package/src/i18n/locales/uk.ts +1 -0
  75. package/src/i18n/locales/uz.ts +1 -0
  76. package/src/i18n/locales/vi.ts +1 -0
  77. package/src/i18n/locales/zh-tw.ts +1 -0
  78. package/src/i18n/locales/zh.ts +1 -0
  79. package/src/index.ts +1 -0
  80. package/src/util/browser.ts +24 -0
  81. package/types/src/blocks/Code/helpers/extensions/CodeKeyboardShortcutsExtension.d.ts +4 -0
  82. package/types/src/comments/CommentEditorSubmitExtension.d.ts +19 -0
  83. package/types/src/comments/CommentEditorSubmitExtension.test.d.ts +1 -0
  84. package/types/src/comments/extension.d.ts +7 -0
  85. package/types/src/comments/index.d.ts +1 -0
  86. package/types/src/editor/BlockNoteEditor.d.ts +52 -19
  87. package/types/src/editor/BlockNoteExtension.d.ts +3 -0
  88. package/types/src/editor/managers/EventManager.browser.test.d.ts +1 -0
  89. package/types/src/editor/managers/EventManager.d.ts +55 -0
  90. package/types/src/editor/managers/StyleManager.browser.test.d.ts +1 -0
  91. package/types/src/editor/managers/StyleManager.d.ts +4 -2
  92. package/types/src/editor/managers/StyleManager.test.d.ts +1 -0
  93. package/types/src/editor/managers/index.d.ts +1 -0
  94. package/types/src/extensions/SourceBlockWithPreview/SourceBlockWithPreview.d.ts +3 -0
  95. package/types/src/extensions/SourceInlineContentWithPreview/SourceInlineContentWithPreview.d.ts +1 -0
  96. package/types/src/i18n/locales/en.d.ts +1 -0
  97. package/types/src/i18n/locales/fa.d.ts +1 -0
  98. package/types/src/i18n/locales/sk.d.ts +1 -0
  99. package/types/src/index.d.ts +1 -0
  100. package/types/src/util/browser.d.ts +2 -0
  101. package/dist/blocks-CTB_5Vyj.cjs +0 -12
  102. package/dist/blocks-CTB_5Vyj.cjs.map +0 -1
  103. package/dist/blocks-Dol85hpH.js.map +0 -1
  104. package/dist/extensions-B7Rsp_Ft.cjs.map +0 -1
  105. package/dist/extensions-D6JcJCwd.js.map +0 -1
  106. package/dist/src-Buuo5l7X.js.map +0 -1
  107. package/dist/src-C54Ok9E0.cjs.map +0 -1
@@ -6,7 +6,7 @@ import {
6
6
  AnyExtension as AnyTiptapExtension,
7
7
  Extension as TiptapExtension,
8
8
  } from "@tiptap/core";
9
- import { keymap } from "@tiptap/pm/keymap";
9
+ import { keydownHandler } from "@tiptap/pm/keymap";
10
10
  import { Plugin, TextSelection } from "prosemirror-state";
11
11
  import { updateBlockTr } from "../../../api/blockManipulation/commands/updateBlock/updateBlock.js";
12
12
  import { setTextCursorPosition } from "../../../api/blockManipulation/selections/textCursorPosition.js";
@@ -592,16 +592,39 @@ export class ExtensionManager {
592
592
  }
593
593
 
594
594
  if (Object.keys(extension.keyboardShortcuts || {}).length) {
595
- plugins.push(
596
- keymap(
597
- Object.fromEntries(
598
- Object.entries(extension.keyboardShortcuts!).map(([key, value]) => [
595
+ let currentEvent: KeyboardEvent | undefined;
596
+ const handleKeyDown = keydownHandler(
597
+ Object.fromEntries(
598
+ Object.entries(extension.keyboardShortcuts!).map(
599
+ ([key, callback]) => [
599
600
  key,
600
- () => value({ editor: this.editor }),
601
- ]),
601
+ () => {
602
+ if (!currentEvent) {
603
+ throw new Error(
604
+ "Keyboard shortcut called outside handleKeyDown",
605
+ );
606
+ }
607
+ return callback({ editor: this.editor, event: currentEvent });
608
+ },
609
+ ],
602
610
  ),
603
611
  ),
604
612
  );
613
+ plugins.push(
614
+ new Plugin({
615
+ props: {
616
+ handleKeyDown: (view, event) => {
617
+ const previousEvent = currentEvent;
618
+ currentEvent = event;
619
+ try {
620
+ return handleKeyDown(view, event);
621
+ } finally {
622
+ currentEvent = previousEvent;
623
+ }
624
+ },
625
+ },
626
+ }),
627
+ );
605
628
  }
606
629
 
607
630
  return { plugins, inputRules };
@@ -0,0 +1,122 @@
1
+ import { TextSelection } from "prosemirror-state";
2
+ import { afterEach, beforeEach, describe, expect, it } from "vite-plus/test";
3
+
4
+ import { BlockNoteEditor } from "../BlockNoteEditor.js";
5
+
6
+ // `editLink` focuses the view when done, so it needs a mounted editor; the
7
+ // lookup itself is covered headless in StyleManager.test.ts.
8
+ describe.each(["link", "x"])("link editing (%s)", (text) => {
9
+ let editor: BlockNoteEditor;
10
+ let container: HTMLElement;
11
+
12
+ beforeEach(() => {
13
+ container = document.createElement("div");
14
+ const mountPoint = document.createElement("div");
15
+ container.append(mountPoint);
16
+ document.body.append(container);
17
+ editor = BlockNoteEditor.create({
18
+ initialContent: [
19
+ {
20
+ type: "paragraph",
21
+ content: [
22
+ { type: "text", text: "before ", styles: {} },
23
+ { type: "link", href: "https://example.com", content: text },
24
+ { type: "text", text: " after", styles: {} },
25
+ ],
26
+ },
27
+ ],
28
+ });
29
+ editor.mount(mountPoint);
30
+ });
31
+
32
+ afterEach(() => {
33
+ editor.unmount();
34
+ container.remove();
35
+ });
36
+
37
+ /** Text nodes carrying a link mark, in document order, with positions. */
38
+ function links() {
39
+ const found: { href: string; text: string; from: number; to: number }[] =
40
+ [];
41
+ editor.prosemirrorState.doc.descendants((node, pos) => {
42
+ const link = node.marks.find((mark) => mark.type.name === "link");
43
+ if (node.isText && link) {
44
+ found.push({
45
+ href: link.attrs.href,
46
+ text: node.text ?? "",
47
+ from: pos,
48
+ to: pos + node.nodeSize,
49
+ });
50
+ }
51
+ });
52
+ return found;
53
+ }
54
+
55
+ // The edit path has the same edge as `getSelectedLinkUrl`: a lookup at
56
+ // `position + 1` is outside the link at its end, so with only the last
57
+ // character selected the form pre-filled the URL and then re-linked that
58
+ // one character, splitting the link. Fails without `getMarkRange` in
59
+ // `getLinkMarkAtPos`.
60
+ it("edits the whole link with only its last character selected", () => {
61
+ const [link] = links();
62
+ expect(link).toMatchObject({ href: "https://example.com", text });
63
+ editor.transact((tr) =>
64
+ tr.setSelection(TextSelection.create(tr.doc, link.to - 1, link.to)),
65
+ );
66
+
67
+ editor.editLink("https://changed.example", text);
68
+
69
+ expect(links()).toEqual([
70
+ {
71
+ href: "https://changed.example",
72
+ text,
73
+ from: link.from,
74
+ to: link.to,
75
+ },
76
+ ]);
77
+ });
78
+
79
+ it("replaces the whole link at its end", () => {
80
+ const [link] = links();
81
+ editor.transact((tr) =>
82
+ tr.setSelection(TextSelection.create(tr.doc, link.to)),
83
+ );
84
+ editor.editLink("https://changed.example", "updated");
85
+ expect(links()).toEqual([
86
+ {
87
+ href: "https://changed.example",
88
+ text: "updated",
89
+ from: link.from,
90
+ to: link.from + 7,
91
+ },
92
+ ]);
93
+ expect(editor.prosemirrorState.doc.textContent).toBe(
94
+ "before updated after",
95
+ );
96
+ });
97
+
98
+ it("unlinks at the end without removing text", () => {
99
+ const [link] = links();
100
+ editor.transact((tr) =>
101
+ tr.setSelection(TextSelection.create(tr.doc, link.to)),
102
+ );
103
+ editor.deleteLink();
104
+ expect(links()).toEqual([]);
105
+ expect(editor.prosemirrorState.doc.textContent).toBe(
106
+ `before ${text} after`,
107
+ );
108
+ });
109
+
110
+ it("does not throw at the document end", () => {
111
+ expect(() =>
112
+ editor.editLink(
113
+ "https://changed.example",
114
+ "updated",
115
+ editor.prosemirrorState.doc.content.size,
116
+ ),
117
+ ).not.toThrow();
118
+ expect(() =>
119
+ editor.deleteLink(editor.prosemirrorState.doc.content.size),
120
+ ).not.toThrow();
121
+ });
122
+ });
@@ -0,0 +1,98 @@
1
+ import { TextSelection } from "prosemirror-state";
2
+ import { beforeEach, describe, expect, it } from "vite-plus/test";
3
+
4
+ import { BlockNoteEditor } from "../BlockNoteEditor.js";
5
+
6
+ // The "last character" and "one-character link" cases fail with a lookup at
7
+ // `from + 1`: that lands on the link's end boundary, where the non-inclusive
8
+ // link mark is not reported.
9
+ describe("getSelectedLinkUrl", () => {
10
+ let editor: BlockNoteEditor;
11
+
12
+ beforeEach(() => {
13
+ editor = BlockNoteEditor.create({
14
+ initialContent: [
15
+ {
16
+ type: "paragraph",
17
+ content: [
18
+ { type: "text", text: "before ", styles: {} },
19
+ { type: "link", href: "https://example.com", content: "link" },
20
+ { type: "text", text: " after ", styles: {} },
21
+ { type: "link", href: "https://one.example", content: "x" },
22
+ ],
23
+ },
24
+ ],
25
+ });
26
+ });
27
+
28
+ /** Start and end positions of the text node carrying `href`. */
29
+ function linkRange(href: string) {
30
+ let range: { from: number; to: number } | undefined;
31
+ editor.prosemirrorState.doc.descendants((node, pos) => {
32
+ if (
33
+ node.isText &&
34
+ node.marks.some(
35
+ (mark) => mark.type.name === "link" && mark.attrs.href === href,
36
+ )
37
+ ) {
38
+ range = { from: pos, to: pos + node.nodeSize };
39
+ }
40
+ return range === undefined;
41
+ });
42
+ if (!range) {
43
+ throw new Error(`no link ${href} in the document`);
44
+ }
45
+ return range;
46
+ }
47
+
48
+ function select(from: number, to = from) {
49
+ editor.transact((tr) =>
50
+ tr.setSelection(TextSelection.create(tr.doc, from, to)),
51
+ );
52
+ }
53
+
54
+ it("reads the URL for the whole link", () => {
55
+ const { from, to } = linkRange("https://example.com");
56
+ select(from, to);
57
+ expect(editor.getSelectedLinkUrl()).toBe("https://example.com");
58
+ });
59
+
60
+ it("reads the URL for the link's last character", () => {
61
+ const { to } = linkRange("https://example.com");
62
+ select(to - 1, to);
63
+ expect(editor.getSelectedLinkUrl()).toBe("https://example.com");
64
+ });
65
+
66
+ it("reads the URL for a one-character link", () => {
67
+ const { from, to } = linkRange("https://one.example");
68
+ select(from, to);
69
+ expect(editor.getSelectedLinkUrl()).toBe("https://one.example");
70
+ });
71
+
72
+ it("reads the URL for a caret inside the link", () => {
73
+ const { from } = linkRange("https://example.com");
74
+ select(from + 2);
75
+ expect(editor.getSelectedLinkUrl()).toBe("https://example.com");
76
+ });
77
+
78
+ it("reads no URL outside links", () => {
79
+ const { from } = linkRange("https://example.com");
80
+ select(from - 3, from - 1);
81
+ expect(editor.getSelectedLinkUrl()).toBeUndefined();
82
+ });
83
+
84
+ it("reads no URL for a selection starting right after a link", () => {
85
+ const { to } = linkRange("https://example.com");
86
+ select(to, to + 3);
87
+ expect(editor.getSelectedLinkUrl()).toBeUndefined();
88
+ });
89
+
90
+ // The edit path is covered in StyleManager.browser.test.ts (it needs a
91
+ // mounted view); the lookup it relies on is pinned here.
92
+ it("finds the link at either edge for editing", () => {
93
+ const { from, to } = linkRange("https://example.com");
94
+ expect(editor.getLinkMarkAtPos(from)?.href).toBe("https://example.com");
95
+ expect(editor.getLinkMarkAtPos(to)?.href).toBe("https://example.com");
96
+ expect(editor.getLinkMarkAtPos(from - 2)).toBeUndefined();
97
+ });
98
+ });
@@ -55,7 +55,10 @@ export class StyleManager<
55
55
  public getActiveStyles() {
56
56
  return this.editor.transact((tr) => {
57
57
  const styles: Styles<SSchema> = {};
58
- const marks = tr.selection.$to.marks();
58
+ const marks =
59
+ // Also track active marks that are not in the document. E.g. the bold mark can be selected
60
+ // so that typing applies bold text, even if the text cursor isn't already within bold text.
61
+ (tr.selection.empty && tr.storedMarks) || tr.selection.$to.marks();
59
62
 
60
63
  for (const mark of marks) {
61
64
  const config = this.editor.schema.styleSchema[mark.type.name];
@@ -147,22 +150,26 @@ export class StyleManager<
147
150
  }
148
151
 
149
152
  /**
150
- * Find the link mark and its range at the given position.
153
+ * Find the link mark and its range at the given position, including at
154
+ * either edge of the link.
151
155
  * Returns undefined if there is no link at that position.
152
156
  */
153
157
  public getLinkMarkAtPos(pos: number) {
154
158
  return this.editor.transact((tr) => {
155
- const resolvedPos = tr.doc.resolve(pos);
156
- const linkMark = resolvedPos
157
- .marks()
158
- .find((mark) => mark.type.name === "link");
159
-
160
- if (!linkMark) {
159
+ // The link mark is not inclusive, so `$pos.marks()` leaves it out at
160
+ // both ends of a link, and callers compensated with `pos + 1`, which
161
+ // covers the left end only. tiptap's `getMarkRange` looks at the node
162
+ // after `pos` and then the one before, so it finds the link at both
163
+ // ends; the mark itself is read off the node the range starts with.
164
+ const linkType = this.editor.pmSchema.marks["link"];
165
+ const range = getMarkRange(tr.doc.resolve(pos), linkType);
166
+ if (!range) {
161
167
  return undefined;
162
168
  }
163
-
164
- const range = getMarkRange(resolvedPos, linkMark.type);
165
- if (!range) {
169
+ const linkMark = tr.doc
170
+ .nodeAt(range.from)
171
+ ?.marks.find((mark) => mark.type === linkType);
172
+ if (!linkMark) {
166
173
  return undefined;
167
174
  }
168
175
 
@@ -176,11 +183,20 @@ export class StyleManager<
176
183
  }
177
184
 
178
185
  /**
179
- * Gets the URL of the last link in the current selection, or `undefined` if there are no links in the selection.
186
+ * Gets the URL of the link the current selection starts in, or `undefined`
187
+ * if it does not start in one.
180
188
  */
181
189
  public getSelectedLinkUrl() {
182
190
  return this.editor.transact((tr) => {
183
- return this.getLinkMarkAtPos(tr.selection.from)?.href;
191
+ // The node the selection starts in, on purpose not `getLinkMarkAtPos`
192
+ // (which also looks at the node before `from`): a selection starting
193
+ // right after a link must not pre-fill the link form with that link's
194
+ // URL. A `from + 1` lookup would miss the right end of a link (a
195
+ // selection of its last character, or a one-character link, reads as
196
+ // no link).
197
+ const node = tr.doc.nodeAt(tr.selection.from);
198
+ const linkMark = node?.marks.find((mark) => mark.type.name === "link");
199
+ return linkMark?.attrs.href as string | undefined;
184
200
  });
185
201
  }
186
202
 
@@ -222,7 +238,7 @@ export class StyleManager<
222
238
  position = this.editor.transact((tr) => tr.selection.anchor),
223
239
  ) {
224
240
  this.editor.transact((tr) => {
225
- const linkData = this.getLinkMarkAtPos(position + 1);
241
+ const linkData = this.getLinkMarkAtPos(position);
226
242
  const { from, to } = linkData || {
227
243
  from: tr.selection.from,
228
244
  to: tr.selection.to,
@@ -246,7 +262,7 @@ export class StyleManager<
246
262
  position = this.editor.transact((tr) => tr.selection.anchor),
247
263
  ) {
248
264
  this.editor.transact((tr) => {
249
- const linkData = this.getLinkMarkAtPos(position + 1);
265
+ const linkData = this.getLinkMarkAtPos(position);
250
266
  const { from, to } = linkData || {
251
267
  from: tr.selection.from,
252
268
  to: tr.selection.to,
@@ -1,5 +1,6 @@
1
1
  export { BlockManager } from "./BlockManager.js";
2
2
  export { EventManager } from "./EventManager.js";
3
+ export type { EditorFocusOptions } from "./EventManager.js";
3
4
  export { ExportManager } from "./ExportManager.js";
4
5
  export { ExtensionManager } from "./ExtensionManager/index.js";
5
6
  export { SelectionManager } from "./SelectionManager.js";
@@ -70,6 +70,28 @@ export const FormattingToolbarExtension = createExtension(({ editor }) => {
70
70
  // re-evaluate whether the toolbar should be shown
71
71
  store.setState(shouldShow());
72
72
  });
73
+ // The selection survives a blur, so without this the state would too:
74
+ // on a phone, tapping the page away from the editor closes the
75
+ // keyboard, and a controller mounting after that showed the toolbar over
76
+ // a blurred editor. Focus within the editor's own UI (a toolbar button,
77
+ // a popover's input) still counts as focused, and the event only fires
78
+ // once a focus handoff has settled. Known edge: with focus inside the
79
+ // toolbar (a menu open), scrolling the selection out of view hides the
80
+ // toolbar and the browser drops that focus, so the toolbar is gone until
81
+ // the next selection change.
82
+ const unsubscribeOnFocusChange = editor.onFocusChange(
83
+ (_editor, { focused }) => {
84
+ if (!focused) {
85
+ store.setState(false);
86
+ return;
87
+ }
88
+ if (preventShowWhileMouseDown || preventShowWhileDragging) {
89
+ return;
90
+ }
91
+ store.setState(shouldShow());
92
+ },
93
+ { includeEditorUI: true },
94
+ );
73
95
 
74
96
  // To mimic Notion's behavior, we listen to the mouse down event to set the `preventShowWhileMouseDown` flag
75
97
  dom.addEventListener(
@@ -122,6 +144,7 @@ export const FormattingToolbarExtension = createExtension(({ editor }) => {
122
144
  signal.addEventListener("abort", () => {
123
145
  unsubscribeOnChange();
124
146
  unsubscribeOnSelectionChange();
147
+ unsubscribeOnFocusChange();
125
148
  });
126
149
  },
127
150
  } as const;
@@ -617,6 +617,21 @@ export class SideMenuView<
617
617
  return;
618
618
  }
619
619
 
620
+ // Leaves the menu as it is while the pointer is over this editor's own UI
621
+ // (a toolbar, a menu, the side menu itself) rather than its content: the
622
+ // block under that UI is not what the pointer is about. It also keeps taps
623
+ // on the UI working on iOS Safari, which delivers a tap as a hover first
624
+ // and drops the click when that hover changes the page (WebKit's
625
+ // ContentChangeObserver); with the mobile toolbar far below the blocks,
626
+ // the hover would hide a shown side menu and every button needed two taps.
627
+ if (
628
+ event.target instanceof Node &&
629
+ !this.pmView.dom.contains(event.target) &&
630
+ this.editor.isWithinEditor(event.target as Element)
631
+ ) {
632
+ return;
633
+ }
634
+
620
635
  this.mousePos = { x: event.clientX, y: event.clientY };
621
636
 
622
637
  // We want the full area of the editor to check if the cursor is hovering
@@ -60,7 +60,9 @@ const nestedEditorBlock = createBlockSpec(
60
60
  },
61
61
  ],
62
62
  });
63
- nestedEditor.mount(dom, { portalTarget: document.body });
63
+ nestedEditor.mount(dom);
64
+ // The nested editor's UI renders at the body, outside its own DOM tree.
65
+ nestedEditor.registerPortalElement(document.body);
64
66
 
65
67
  return { dom, destroy: () => nestedEditor.unmount() };
66
68
  },
@@ -406,5 +406,6 @@ export const ar: Dictionary = {
406
406
  },
407
407
  generic: {
408
408
  ctrl_shortcut: "Ctrl",
409
+ form_submit: "موافق",
409
410
  },
410
411
  };
@@ -440,5 +440,6 @@ export const de: Dictionary = {
440
440
  },
441
441
  generic: {
442
442
  ctrl_shortcut: "Strg",
443
+ form_submit: "OK",
443
444
  },
444
445
  };
@@ -421,5 +421,6 @@ export const en = {
421
421
  },
422
422
  generic: {
423
423
  ctrl_shortcut: "Ctrl",
424
+ form_submit: "OK",
424
425
  },
425
426
  };
@@ -419,5 +419,6 @@ export const es: Dictionary = {
419
419
  },
420
420
  generic: {
421
421
  ctrl_shortcut: "Ctrl",
422
+ form_submit: "Aceptar",
422
423
  },
423
424
  };
@@ -390,5 +390,6 @@ export const fa = {
390
390
  },
391
391
  generic: {
392
392
  ctrl_shortcut: "Ctrl",
393
+ form_submit: "تأیید",
393
394
  },
394
395
  };
@@ -467,5 +467,6 @@ export const fr: Dictionary = {
467
467
  },
468
468
  generic: {
469
469
  ctrl_shortcut: "Ctrl",
470
+ form_submit: "OK",
470
471
  },
471
472
  };
@@ -421,5 +421,6 @@ export const he: Dictionary = {
421
421
  },
422
422
  generic: {
423
423
  ctrl_shortcut: "Ctrl",
424
+ form_submit: "אישור",
424
425
  },
425
426
  };
@@ -435,5 +435,6 @@ export const hr: Dictionary = {
435
435
  },
436
436
  generic: {
437
437
  ctrl_shortcut: "Ctrl",
438
+ form_submit: "U redu",
438
439
  },
439
440
  };
@@ -435,5 +435,6 @@ export const is: Dictionary = {
435
435
  },
436
436
  generic: {
437
437
  ctrl_shortcut: "Ctrl",
438
+ form_submit: "Í lagi",
438
439
  },
439
440
  };
@@ -443,5 +443,6 @@ export const it: Dictionary = {
443
443
  },
444
444
  generic: {
445
445
  ctrl_shortcut: "Ctrl",
446
+ form_submit: "OK",
446
447
  },
447
448
  };
@@ -461,5 +461,6 @@ export const ja: Dictionary = {
461
461
  },
462
462
  generic: {
463
463
  ctrl_shortcut: "Ctrl",
464
+ form_submit: "OK",
464
465
  },
465
466
  };
@@ -434,5 +434,6 @@ export const ko: Dictionary = {
434
434
  },
435
435
  generic: {
436
436
  ctrl_shortcut: "Ctrl",
437
+ form_submit: "확인",
437
438
  },
438
439
  };
@@ -422,5 +422,6 @@ export const nl: Dictionary = {
422
422
  },
423
423
  generic: {
424
424
  ctrl_shortcut: "Ctrl",
425
+ form_submit: "OK",
425
426
  },
426
427
  };
@@ -439,5 +439,6 @@ export const no: Dictionary = {
439
439
  },
440
440
  generic: {
441
441
  ctrl_shortcut: "Ctrl",
442
+ form_submit: "OK",
442
443
  },
443
444
  };
@@ -412,5 +412,6 @@ export const pl: Dictionary = {
412
412
  },
413
413
  generic: {
414
414
  ctrl_shortcut: "Ctrl",
415
+ form_submit: "OK",
415
416
  },
416
417
  };
@@ -414,5 +414,6 @@ export const pt: Dictionary = {
414
414
  },
415
415
  generic: {
416
416
  ctrl_shortcut: "Ctrl",
417
+ form_submit: "OK",
417
418
  },
418
419
  };
@@ -465,5 +465,6 @@ export const ru: Dictionary = {
465
465
  },
466
466
  generic: {
467
467
  ctrl_shortcut: "Ctrl",
468
+ form_submit: "ОК",
468
469
  },
469
470
  };
@@ -419,5 +419,6 @@ export const sk = {
419
419
  },
420
420
  generic: {
421
421
  ctrl_shortcut: "Ctrl",
422
+ form_submit: "OK",
422
423
  },
423
424
  };
@@ -445,5 +445,6 @@ export const uk: Dictionary = {
445
445
  },
446
446
  generic: {
447
447
  ctrl_shortcut: "Ctrl",
448
+ form_submit: "ОК",
448
449
  },
449
450
  };
@@ -455,5 +455,6 @@ export const uz: Dictionary = {
455
455
  },
456
456
  generic: {
457
457
  ctrl_shortcut: "Ctrl",
458
+ form_submit: "OK",
458
459
  },
459
460
  };
@@ -420,5 +420,6 @@ export const vi: Dictionary = {
420
420
  },
421
421
  generic: {
422
422
  ctrl_shortcut: "Ctrl",
423
+ form_submit: "OK",
423
424
  },
424
425
  };
@@ -462,5 +462,6 @@ export const zhTW: Dictionary = {
462
462
  },
463
463
  generic: {
464
464
  ctrl_shortcut: "Ctrl",
465
+ form_submit: "確定",
465
466
  },
466
467
  };
@@ -462,5 +462,6 @@ export const zh: Dictionary = {
462
462
  },
463
463
  generic: {
464
464
  ctrl_shortcut: "Ctrl",
465
+ form_submit: "确定",
465
466
  },
466
467
  };
package/src/index.ts CHANGED
@@ -11,6 +11,7 @@ export * from "./api/nodeUtil.js";
11
11
  export * from "./api/pmUtil.js";
12
12
  export * from "./blocks/index.js";
13
13
  export * from "./editor/BlockNoteEditor.js";
14
+ export type { EditorFocusOptions } from "./editor/managers/EventManager.js";
14
15
  export * from "./editor/BlockNoteExtension.js";
15
16
  export * from "./editor/defaultColors.js";
16
17
  export * from "./editor/selectionTypes.js";