@octanejs/blocknote 0.1.5 → 0.1.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.
package/package.json CHANGED
@@ -2,14 +2,14 @@
2
2
  "name": "@octanejs/blocknote",
3
3
  "devDependencies": {
4
4
  "@blocknote/react": "0.53.0",
5
- "@tsrx/react": "^0.3.7",
5
+ "@tsrx/react": "^0.4.5",
6
6
  "esbuild": "^0.28.1",
7
- "octane": "0.10.0",
7
+ "octane": "0.11.0",
8
8
  "react": "19.2.7",
9
9
  "react-dom": "19.2.7",
10
10
  "vitest": "^4.1.10"
11
11
  },
12
- "version": "0.1.5",
12
+ "version": "0.1.7",
13
13
  "license": "MIT",
14
14
  "type": "module",
15
15
  "engines": {
@@ -46,7 +46,7 @@
46
46
  "@blocknote/core": "0.53.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "octane": "^0.10.0"
49
+ "octane": "^0.11.0"
50
50
  },
51
51
  "octane": {
52
52
  "hookSlots": {
@@ -35,29 +35,28 @@ export type BlockNoteViewProps<
35
35
  B extends BlockSchema = DefaultBlockSchema,
36
36
  I extends InlineContentSchema = DefaultInlineContentSchema,
37
37
  S extends StyleSchema = DefaultStyleSchema,
38
- > =
39
- {
40
- editor: BlockNoteEditor<B, I, S>;
41
- theme?: 'light' | 'dark';
42
- /** @default true */
43
- editable?: boolean;
44
- onChange?: Parameters<BlockNoteEditor<B, I, S>['onChange']>[0];
45
- onSelectionChange?: () => void;
46
- /**
47
- * Render the editable surface as the container's first child. Set to
48
- * `false` to place `BlockNoteViewEditor` among `children` yourself.
49
- * @default true
50
- */
51
- renderEditor?: boolean;
52
- autoFocus?: boolean;
53
- portalElements?: PortalElementsMap;
54
- className?: string;
55
- children?: OctaneNode;
56
- ref?: React.Ref<HTMLDivElement>;
57
- } & Omit<
58
- Octane.HTMLAttributes<HTMLDivElement>,
59
- 'onChange' | 'onSelectionChange' | 'children' | 'class' | 'className'
60
- >;
38
+ > = {
39
+ editor: BlockNoteEditor<B, I, S>;
40
+ theme?: 'light' | 'dark';
41
+ /** @default true */
42
+ editable?: boolean;
43
+ onChange?: Parameters<BlockNoteEditor<B, I, S>['onChange']>[0];
44
+ onSelectionChange?: () => void;
45
+ /**
46
+ * Render the editable surface as the container's first child. Set to
47
+ * `false` to place `BlockNoteViewEditor` among `children` yourself.
48
+ * @default true
49
+ */
50
+ renderEditor?: boolean;
51
+ autoFocus?: boolean;
52
+ portalElements?: PortalElementsMap;
53
+ className?: string;
54
+ children?: OctaneNode;
55
+ ref?: React.Ref<HTMLDivElement>;
56
+ } & Omit<
57
+ Octane.HTMLAttributes<HTMLDivElement>,
58
+ 'onChange' | 'onSelectionChange' | 'children' | 'class' | 'className'
59
+ >;
61
60
 
62
61
  /** What `BlockNoteViewRaw` hands to the `BlockNoteViewEditor` it contains. */
63
62
  type ViewEditorSettings = {
@@ -94,8 +93,9 @@ export function BlockNoteViewRaw<
94
93
  const outerContext = useBlockNoteContext();
95
94
  const systemColorScheme = usePrefersColorScheme();
96
95
  const scheme: 'light' | 'dark' =
97
- theme ?? outerContext?.colorSchemePreference ??
98
- (systemColorScheme === 'dark' ? 'dark' : 'light');
96
+ theme ??
97
+ outerContext?.colorSchemePreference ??
98
+ (systemColorScheme === 'dark' ? 'dark' : 'light');
99
99
 
100
100
  const [contentEditableProps, setContentEditableProps] = useState<Record<string, any> | undefined>(
101
101
  undefined,
@@ -143,9 +143,7 @@ export function BlockNoteViewRaw<
143
143
  @if (renderEditor !== false) {
144
144
  <BlockNoteViewEditor>{children}</BlockNoteViewEditor>
145
145
  } @else {
146
- <>
147
- {children}
148
- </>
146
+ <>{children}</>
149
147
  }
150
148
  </div>
151
149
  </ViewEditorContext>
@@ -166,14 +164,17 @@ export function BlockNoteViewEditor(props: { children?: OctaneNode }) @{
166
164
  // A new callback identity detaches the old ref (unmount) and attaches the new
167
165
  // one (mount). Remounting on `editable` changes is deliberate: TipTap drops the
168
166
  // host's tabIndex when editability flips on a mounted view.
169
- const mountEditor = useCallback((element: HTMLDivElement | null) => {
170
- editor.isEditable = editable !== false;
171
- if (element) {
172
- editor.mount(element, { portalTarget });
173
- } else {
174
- editor.unmount();
175
- }
176
- }, [editable, editor, portalTarget]);
167
+ const mountEditor = useCallback(
168
+ (element: HTMLDivElement | null) => {
169
+ editor.isEditable = editable !== false;
170
+ if (element) {
171
+ editor.mount(element, { portalTarget });
172
+ } else {
173
+ editor.unmount();
174
+ }
175
+ },
176
+ [editable, editor, portalTarget],
177
+ );
177
178
 
178
179
  <>
179
180
  <div