@openeditor/react 0.0.29 → 0.0.30
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/README.md +2 -0
- package/dist/index.d.ts +47 -8
- package/dist/index.js +2845 -675
- package/dist/index.js.map +1 -1
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -8,11 +8,13 @@ Pass `attachmentRuntime` to `useOpenEditorController` for editable attachments a
|
|
|
8
8
|
|
|
9
9
|
- `useOpenEditorController` for editor state, commands, document exports, and selection state
|
|
10
10
|
- `OpenEditorContent` for the editable Tiptap-backed content surface
|
|
11
|
+
- `OpenEditorBubbleMenu` for Tiptap-owned selection visibility and positioning
|
|
11
12
|
- `OpenEditorViewer` for read-only React rendering
|
|
12
13
|
- `OpenEditorPageHeader` for host-backed page title and icon editing
|
|
13
14
|
- `getDefaultBlockPickerItems` for host-owned block rails, pickers, and command palettes
|
|
14
15
|
- `getDefaultSlashMenuItems` for UI packages that want the built-in insert actions
|
|
15
16
|
- stable-identity block targeting and transaction-backed copy, duplicate, move, and delete commands
|
|
17
|
+
- a first-class `controller.table` domain API for selection-aware row, column, header, cell, and table commands
|
|
16
18
|
- `OpenEditorBlockDragHandle` and `useOpenEditorBlockInteraction` for headless block-handle UIs
|
|
17
19
|
- `defineOpenEditorReactNode` for consumer-owned React blocks
|
|
18
20
|
- `defineOpenEditorReactExtension` for advanced integrations that contribute multiple Tiptap extensions
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { OpenEditorBlockRef, OpenEditorDocument, BlockSpec, ProseMirrorNode, Ope
|
|
|
4
4
|
export { OpenEditorBlockRef, OpenEditorPageRuntime, OpenEditorPageSnapshot, OpenEditorUrlContext, OpenEditorUrlPolicy, openEditorPublicUrlPolicy, openEditorUnsafeUrlPolicy } from '@openeditor/core';
|
|
5
5
|
import { ExportFormat, OpenEditorExporters } from '@openeditor/exporters';
|
|
6
6
|
export { seedDocument } from '@openeditor/extensions';
|
|
7
|
-
import { AnyExtension, NodeConfig } from '@tiptap/core';
|
|
7
|
+
import { Editor, AnyExtension, NodeConfig } from '@tiptap/core';
|
|
8
8
|
import { ReactNodeViewProps } from '@tiptap/react';
|
|
9
9
|
export { NodeViewContent, NodeViewWrapper, ReactNodeViewProps as OpenEditorNodeViewProps } from '@tiptap/react';
|
|
10
10
|
|
|
@@ -29,6 +29,27 @@ declare function OpenEditorThemeProvider({ children, className, theme }: {
|
|
|
29
29
|
theme: OpenEditorTheme;
|
|
30
30
|
}): react.JSX.Element;
|
|
31
31
|
|
|
32
|
+
declare const openEditorTableCommands: readonly ["addRowBefore", "addRowAfter", "deleteRow", "addColumnBefore", "addColumnAfter", "deleteColumn", "toggleHeaderRow", "toggleHeaderColumn", "mergeCells", "splitCell", "deleteTable"];
|
|
33
|
+
type OpenEditorTableCommand = (typeof openEditorTableCommands)[number];
|
|
34
|
+
type OpenEditorTableState = {
|
|
35
|
+
active: boolean;
|
|
36
|
+
rows: number;
|
|
37
|
+
columns: number;
|
|
38
|
+
headerRow: boolean;
|
|
39
|
+
headerColumn: boolean;
|
|
40
|
+
cellSelection: boolean;
|
|
41
|
+
canMergeCells: boolean;
|
|
42
|
+
canSplitCell: boolean;
|
|
43
|
+
};
|
|
44
|
+
type OpenEditorTableController = {
|
|
45
|
+
getState: () => OpenEditorTableState;
|
|
46
|
+
can: (command: OpenEditorTableCommand) => boolean;
|
|
47
|
+
run: (command: OpenEditorTableCommand) => boolean;
|
|
48
|
+
};
|
|
49
|
+
declare const getOpenEditorTableState: (editor: Editor | null) => OpenEditorTableState;
|
|
50
|
+
declare const canRunOpenEditorTableCommand: (editor: Editor | null, command: OpenEditorTableCommand) => boolean;
|
|
51
|
+
declare const runOpenEditorTableCommand: (editor: Editor | null, command: OpenEditorTableCommand) => boolean;
|
|
52
|
+
|
|
32
53
|
type OpenEditorReactProps = OpenEditorAuthoringCapabilities & {
|
|
33
54
|
initialDocument?: OpenEditorDocument;
|
|
34
55
|
editable?: boolean;
|
|
@@ -65,6 +86,8 @@ type OpenEditorController = {
|
|
|
65
86
|
setSelectedBlock: (blockName: string) => void;
|
|
66
87
|
getContent: () => OpenEditorDocument;
|
|
67
88
|
setContent: (document: OpenEditorDocument) => void;
|
|
89
|
+
focus: () => void;
|
|
90
|
+
getPositionRect: (position: number) => OpenEditorOverlayRect | null;
|
|
68
91
|
setParagraph: () => void;
|
|
69
92
|
toggleHeading: (level: 1 | 2 | 3 | 4 | 5 | 6) => void;
|
|
70
93
|
toggleBold: () => void;
|
|
@@ -77,6 +100,7 @@ type OpenEditorController = {
|
|
|
77
100
|
toggleTaskList: () => void;
|
|
78
101
|
toggleBlockquote: () => void;
|
|
79
102
|
toggleCodeBlock: () => void;
|
|
103
|
+
table: OpenEditorTableController;
|
|
80
104
|
undo: () => void;
|
|
81
105
|
redo: () => void;
|
|
82
106
|
insertBlock: (blockName?: string, range?: InsertRange) => boolean;
|
|
@@ -100,7 +124,8 @@ type OpenEditorController = {
|
|
|
100
124
|
attachmentRuntime?: OpenEditorAttachmentRuntime<any>;
|
|
101
125
|
enabledBlocks?: readonly string[];
|
|
102
126
|
slashState: SlashState | null;
|
|
103
|
-
|
|
127
|
+
dismissSlashMenu: () => void;
|
|
128
|
+
registerSlashMenuKeyboardHandler: (handler: (event: globalThis.KeyboardEvent) => boolean) => () => void;
|
|
104
129
|
};
|
|
105
130
|
type OpenEditorContentProps = {
|
|
106
131
|
controller: OpenEditorController;
|
|
@@ -126,11 +151,6 @@ type SlashState = {
|
|
|
126
151
|
top: number;
|
|
127
152
|
anchorRect?: OpenEditorOverlayRect;
|
|
128
153
|
};
|
|
129
|
-
type SelectionBubbleState = {
|
|
130
|
-
left: number;
|
|
131
|
-
top: number;
|
|
132
|
-
anchorRect?: OpenEditorOverlayRect;
|
|
133
|
-
};
|
|
134
154
|
type OpenEditorSlashMenuIconProps = {
|
|
135
155
|
"aria-hidden"?: boolean;
|
|
136
156
|
className?: string;
|
|
@@ -232,6 +252,25 @@ type OpenEditorPageHeaderProps = {
|
|
|
232
252
|
/** Canonical Notion-style page metadata editor shared by host page surfaces. */
|
|
233
253
|
declare const OpenEditorPageHeader: ({ page, runtime, className, onPageChange, }: OpenEditorPageHeaderProps) => react.JSX.Element;
|
|
234
254
|
declare const useOpenEditorController: ({ initialDocument, editable, placeholder, onChange, onFilePasteDrop, pageRuntime, attachmentRuntime, enabledBlocks, slashMenuItems, extensions, blockActions, }?: OpenEditorReactProps) => OpenEditorController;
|
|
255
|
+
type OpenEditorBubbleMenuProps = {
|
|
256
|
+
controller: OpenEditorController;
|
|
257
|
+
children: ReactNode;
|
|
258
|
+
className?: string;
|
|
259
|
+
container?: HTMLElement | null;
|
|
260
|
+
scrollTarget?: HTMLElement | Window | null;
|
|
261
|
+
style?: CSSProperties;
|
|
262
|
+
};
|
|
263
|
+
type OpenEditorTableBubbleMenuProps = {
|
|
264
|
+
controller: OpenEditorController;
|
|
265
|
+
children: (state: OpenEditorTableState) => ReactNode;
|
|
266
|
+
className?: string;
|
|
267
|
+
container?: HTMLElement | null;
|
|
268
|
+
style?: CSSProperties;
|
|
269
|
+
};
|
|
270
|
+
/** Selection-aware positioning and lifecycle owned by Tiptap's BubbleMenu plugin. */
|
|
271
|
+
declare const OpenEditorBubbleMenu: ({ controller, children, className, container, scrollTarget, style, }: OpenEditorBubbleMenuProps) => react.JSX.Element | null;
|
|
272
|
+
/** A table-owned contextual surface, anchored to the complete selected table. */
|
|
273
|
+
declare const OpenEditorTableBubbleMenu: ({ controller, children, className, container, style, }: OpenEditorTableBubbleMenuProps) => react.JSX.Element | null;
|
|
235
274
|
declare const useOpenEditorBlockInteraction: (controller: OpenEditorController) => OpenEditorBlockInteractionSnapshot;
|
|
236
275
|
type OpenEditorBlockDragHandleProps = {
|
|
237
276
|
controller: OpenEditorController;
|
|
@@ -257,4 +296,4 @@ declare const OpenEditorContent: ({ controller, className, }: OpenEditorContentP
|
|
|
257
296
|
declare const OpenEditorViewer: ({ document, className, renderers, extensions, pageRuntime, attachmentRuntime, urlPolicy, }: OpenEditorViewerProps) => react.JSX.Element;
|
|
258
297
|
declare const useOpenEditor: ({ initialDocument, editable, placeholder, onChange, onFilePasteDrop, pageRuntime, attachmentRuntime, enabledBlocks, slashMenuItems, extensions, blockActions, }?: OpenEditorReactProps) => OpenEditorController;
|
|
259
298
|
|
|
260
|
-
export { type InsertRange, type OpenEditorBlockAction, type OpenEditorBlockActionContext, OpenEditorBlockDragHandle, type OpenEditorBlockDragHandleProps, type OpenEditorBlockPickerItem, OpenEditorContent, type OpenEditorContentProps, type OpenEditorController, type OpenEditorExtensionMenu, type OpenEditorOverlayRect, OpenEditorPageHeader, type OpenEditorPageHeaderProps, type OpenEditorReactConfig, type OpenEditorReactExtension, type OpenEditorReactNodeExtension, type OpenEditorReactProps, type OpenEditorSlashMenuIcon, type OpenEditorSlashMenuIconProps, type OpenEditorSlashMenuItem, type OpenEditorTheme, OpenEditorThemeProvider, type OpenEditorThemeStyle, type OpenEditorThemeToken, OpenEditorViewer, type OpenEditorViewerProps, type OpenEditorViewerRenderer, type
|
|
299
|
+
export { type InsertRange, type OpenEditorBlockAction, type OpenEditorBlockActionContext, OpenEditorBlockDragHandle, type OpenEditorBlockDragHandleProps, type OpenEditorBlockPickerItem, OpenEditorBubbleMenu, type OpenEditorBubbleMenuProps, OpenEditorContent, type OpenEditorContentProps, type OpenEditorController, type OpenEditorExtensionMenu, type OpenEditorOverlayRect, OpenEditorPageHeader, type OpenEditorPageHeaderProps, type OpenEditorReactConfig, type OpenEditorReactExtension, type OpenEditorReactNodeExtension, type OpenEditorReactProps, type OpenEditorSlashMenuIcon, type OpenEditorSlashMenuIconProps, type OpenEditorSlashMenuItem, OpenEditorTableBubbleMenu, type OpenEditorTableBubbleMenuProps, type OpenEditorTableCommand, type OpenEditorTableController, type OpenEditorTableState, type OpenEditorTheme, OpenEditorThemeProvider, type OpenEditorThemeStyle, type OpenEditorThemeToken, OpenEditorViewer, type OpenEditorViewerProps, type OpenEditorViewerRenderer, type SlashState, canRunOpenEditorTableCommand, createOpenEditorThemeStyle, defineOpenEditorReactExtension, defineOpenEditorReactNode, formatAttachmentSize, getDefaultBlockPickerItems, getDefaultSlashMenuItems, getOpenEditorTableState, openEditorTableCommands, openEditorThemeTokenNames, runOpenEditorTableCommand, sortBlockPickerItems, sortSlashMenuItems, useOpenEditor, useOpenEditorBlockInteraction, useOpenEditorController, useOpenEditorThemeStyle };
|