@domternal/react 0.6.2 → 0.7.1
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 +12 -10
- package/dist/index.d.ts +121 -30
- package/dist/index.js +961 -77
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/dist/Domternal.d.ts +0 -79
- package/dist/Domternal.d.ts.map +0 -1
- package/dist/DomternalEditor.d.ts +0 -48
- package/dist/DomternalEditor.d.ts.map +0 -1
- package/dist/DomternalFloatingMenu.d.ts +0 -13
- package/dist/DomternalFloatingMenu.d.ts.map +0 -1
- package/dist/EditorContent.d.ts +0 -22
- package/dist/EditorContent.d.ts.map +0 -1
- package/dist/EditorContext.d.ts +0 -38
- package/dist/EditorContext.d.ts.map +0 -1
- package/dist/bubble-menu/DomternalBubbleMenu.d.ts +0 -21
- package/dist/bubble-menu/DomternalBubbleMenu.d.ts.map +0 -1
- package/dist/bubble-menu/useBubbleMenu.d.ts +0 -26
- package/dist/bubble-menu/useBubbleMenu.d.ts.map +0 -1
- package/dist/emoji-picker/DomternalEmojiPicker.d.ts +0 -10
- package/dist/emoji-picker/DomternalEmojiPicker.d.ts.map +0 -1
- package/dist/emoji-picker/useEmojiPicker.d.ts +0 -22
- package/dist/emoji-picker/useEmojiPicker.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/node-views/NodeViewContent.d.ts +0 -11
- package/dist/node-views/NodeViewContent.d.ts.map +0 -1
- package/dist/node-views/NodeViewWrapper.d.ts +0 -11
- package/dist/node-views/NodeViewWrapper.d.ts.map +0 -1
- package/dist/node-views/ReactNodeViewContext.d.ts +0 -12
- package/dist/node-views/ReactNodeViewContext.d.ts.map +0 -1
- package/dist/node-views/ReactNodeViewRenderer.d.ts +0 -101
- package/dist/node-views/ReactNodeViewRenderer.d.ts.map +0 -1
- package/dist/toolbar/DomternalToolbar.d.ts +0 -11
- package/dist/toolbar/DomternalToolbar.d.ts.map +0 -1
- package/dist/toolbar/ToolbarButton.d.ts +0 -14
- package/dist/toolbar/ToolbarButton.d.ts.map +0 -1
- package/dist/toolbar/ToolbarDropdown.d.ts +0 -16
- package/dist/toolbar/ToolbarDropdown.d.ts.map +0 -1
- package/dist/toolbar/ToolbarDropdownPanel.d.ts +0 -9
- package/dist/toolbar/ToolbarDropdownPanel.d.ts.map +0 -1
- package/dist/toolbar/useComputedStyle.d.ts +0 -12
- package/dist/toolbar/useComputedStyle.d.ts.map +0 -1
- package/dist/toolbar/useKeyboardNav.d.ts +0 -6
- package/dist/toolbar/useKeyboardNav.d.ts.map +0 -1
- package/dist/toolbar/useToolbarController.d.ts +0 -19
- package/dist/toolbar/useToolbarController.d.ts.map +0 -1
- package/dist/toolbar/useToolbarIcons.d.ts +0 -11
- package/dist/toolbar/useToolbarIcons.d.ts.map +0 -1
- package/dist/toolbar/useTooltip.d.ts +0 -5
- package/dist/toolbar/useTooltip.d.ts.map +0 -1
- package/dist/useEditor.d.ts +0 -79
- package/dist/useEditor.d.ts.map +0 -1
- package/dist/useEditorState.d.ts +0 -27
- package/dist/useEditorState.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domternal/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "React components for Domternal editor",
|
|
5
5
|
"author": "https://github.com/ThomasNowHere",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"react": ">=18",
|
|
23
23
|
"react-dom": ">=18",
|
|
24
|
-
"@domternal/core": ">=0.
|
|
24
|
+
"@domternal/core": ">=0.7.0",
|
|
25
|
+
"@domternal/extension-block-menu": ">=0.7.0"
|
|
25
26
|
},
|
|
26
27
|
"keywords": [
|
|
27
28
|
"react",
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
"scripts": {
|
|
43
44
|
"build": "tsup",
|
|
44
45
|
"dev": "tsup --watch",
|
|
46
|
+
"lint": "eslint src",
|
|
45
47
|
"typecheck": "tsc --noEmit"
|
|
46
48
|
}
|
|
47
49
|
}
|
package/dist/Domternal.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { type DependencyList, type ReactNode } from 'react';
|
|
2
|
-
import { type UseEditorOptions } from './useEditor.js';
|
|
3
|
-
import { type DomternalToolbarProps } from './toolbar/DomternalToolbar.js';
|
|
4
|
-
import { type DomternalBubbleMenuProps } from './bubble-menu/DomternalBubbleMenu.js';
|
|
5
|
-
import { type DomternalFloatingMenuProps } from './DomternalFloatingMenu.js';
|
|
6
|
-
import { type DomternalEmojiPickerProps } from './emoji-picker/DomternalEmojiPicker.js';
|
|
7
|
-
export interface DomternalProps extends UseEditorOptions {
|
|
8
|
-
/** Optional dependency array for forced editor recreation. */
|
|
9
|
-
deps?: DependencyList;
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Composable root component that creates an editor and provides it to all
|
|
14
|
-
* subcomponents via context. No need to pass `editor` prop to children.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```tsx
|
|
18
|
-
* <Domternal extensions={[Bold, Italic]} content="<p>Hello</p>">
|
|
19
|
-
* <Domternal.Toolbar />
|
|
20
|
-
* <Domternal.Content />
|
|
21
|
-
* <Domternal.BubbleMenu contexts={{ text: ['bold', 'italic'] }} />
|
|
22
|
-
* <Domternal.EmojiPicker emojis={emojis} />
|
|
23
|
-
* </Domternal>
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @example SSR-safe with loading state
|
|
27
|
-
* ```tsx
|
|
28
|
-
* <Domternal extensions={extensions} immediatelyRender={false}>
|
|
29
|
-
* <Domternal.Loading>Loading editor...</Domternal.Loading>
|
|
30
|
-
* <Domternal.Toolbar />
|
|
31
|
-
* <Domternal.Content />
|
|
32
|
-
* </Domternal>
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare function Domternal({ children, deps, ...options }: DomternalProps): import("react/jsx-runtime").JSX.Element;
|
|
36
|
-
export declare namespace Domternal {
|
|
37
|
-
var Content: typeof DomternalContent;
|
|
38
|
-
var Loading: typeof DomternalLoading;
|
|
39
|
-
var Toolbar: typeof DomternalToolbarSub;
|
|
40
|
-
var BubbleMenu: typeof DomternalBubbleMenuSub;
|
|
41
|
-
var FloatingMenu: typeof DomternalFloatingMenuSub;
|
|
42
|
-
var EmojiPicker: typeof DomternalEmojiPickerSub;
|
|
43
|
-
}
|
|
44
|
-
/** Renders the editor content area. Mounts the editor view DOM from context. */
|
|
45
|
-
declare function DomternalContent({ className }: {
|
|
46
|
-
className?: string;
|
|
47
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
48
|
-
declare namespace DomternalContent {
|
|
49
|
-
var displayName: string;
|
|
50
|
-
}
|
|
51
|
-
/** Renders children only while editor is not yet ready (SSR loading state). */
|
|
52
|
-
declare function DomternalLoading({ children }: {
|
|
53
|
-
children: ReactNode;
|
|
54
|
-
}): import("react/jsx-runtime").JSX.Element | null;
|
|
55
|
-
declare namespace DomternalLoading {
|
|
56
|
-
var displayName: string;
|
|
57
|
-
}
|
|
58
|
-
/** Toolbar subcomponent. Uses editor from context automatically. */
|
|
59
|
-
declare function DomternalToolbarSub(props: Omit<DomternalToolbarProps, 'editor'>): import("react/jsx-runtime").JSX.Element;
|
|
60
|
-
declare namespace DomternalToolbarSub {
|
|
61
|
-
var displayName: string;
|
|
62
|
-
}
|
|
63
|
-
/** BubbleMenu subcomponent. Uses editor from context automatically. */
|
|
64
|
-
declare function DomternalBubbleMenuSub(props: Omit<DomternalBubbleMenuProps, 'editor'>): import("react/jsx-runtime").JSX.Element;
|
|
65
|
-
declare namespace DomternalBubbleMenuSub {
|
|
66
|
-
var displayName: string;
|
|
67
|
-
}
|
|
68
|
-
/** FloatingMenu subcomponent. Uses editor from context automatically. */
|
|
69
|
-
declare function DomternalFloatingMenuSub(props: Omit<DomternalFloatingMenuProps, 'editor'>): import("react/jsx-runtime").JSX.Element;
|
|
70
|
-
declare namespace DomternalFloatingMenuSub {
|
|
71
|
-
var displayName: string;
|
|
72
|
-
}
|
|
73
|
-
/** EmojiPicker subcomponent. Uses editor from context automatically. */
|
|
74
|
-
declare function DomternalEmojiPickerSub(props: Omit<DomternalEmojiPickerProps, 'editor'>): import("react/jsx-runtime").JSX.Element;
|
|
75
|
-
declare namespace DomternalEmojiPickerSub {
|
|
76
|
-
var displayName: string;
|
|
77
|
-
}
|
|
78
|
-
export {};
|
|
79
|
-
//# sourceMappingURL=Domternal.d.ts.map
|
package/dist/Domternal.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Domternal.d.ts","sourceRoot":"","sources":["../src/Domternal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAoB,KAAK,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC7F,OAAO,EAAuB,KAAK,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAC1G,OAAO,EAAyB,KAAK,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACpG,OAAO,EAAwB,KAAK,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAI9G,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACtD,8DAA8D;IAC9D,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,cAAc,2CAQvE;yBARe,SAAS;;;;;;;;AAYzB,gFAAgF;AAChF,iBAAS,gBAAgB,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,2CAqB9D;kBArBQ,gBAAgB;;;AAuBzB,+EAA+E;AAC/E,iBAAS,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,kDAI9D;kBAJQ,gBAAgB;;;AAMzB,oEAAoE;AACpE,iBAAS,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,qBAAqB,EAAE,QAAQ,CAAC,2CAExE;kBAFQ,mBAAmB;;;AAI5B,uEAAuE;AACvE,iBAAS,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,wBAAwB,EAAE,QAAQ,CAAC,2CAE9E;kBAFQ,sBAAsB;;;AAI/B,yEAAyE;AACzE,iBAAS,wBAAwB,CAAC,KAAK,EAAE,IAAI,CAAC,0BAA0B,EAAE,QAAQ,CAAC,2CAElF;kBAFQ,wBAAwB;;;AAIjC,wEAAwE;AACxE,iBAAS,uBAAuB,CAAC,KAAK,EAAE,IAAI,CAAC,yBAAyB,EAAE,QAAQ,CAAC,2CAEhF;kBAFQ,uBAAuB"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Content, JSONContent, Editor } from '@domternal/core';
|
|
2
|
-
import { type UseEditorOptions } from './useEditor.js';
|
|
3
|
-
export interface DomternalEditorProps extends Omit<UseEditorOptions, 'outputFormat'> {
|
|
4
|
-
/** Additional CSS class for the .dm-editor wrapper. */
|
|
5
|
-
className?: string;
|
|
6
|
-
/** Output format for onChange. @default 'html' */
|
|
7
|
-
outputFormat?: 'html' | 'json';
|
|
8
|
-
/** Controlled value. When provided, editor content syncs to this value. */
|
|
9
|
-
value?: Content;
|
|
10
|
-
/** Called when content changes (controlled mode). */
|
|
11
|
-
onChange?: (value: string | JSONContent) => void;
|
|
12
|
-
/** Additional content rendered inside the dm-editor wrapper. */
|
|
13
|
-
children?: React.ReactNode;
|
|
14
|
-
}
|
|
15
|
-
export interface DomternalEditorRef {
|
|
16
|
-
editor: Editor | null;
|
|
17
|
-
htmlContent: string;
|
|
18
|
-
jsonContent: JSONContent | null;
|
|
19
|
-
isEmpty: boolean;
|
|
20
|
-
isFocused: boolean;
|
|
21
|
-
isEditable: boolean;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* All-in-one editor component with integrated state management and context.
|
|
25
|
-
*
|
|
26
|
-
* Wraps children with EditorProvider automatically, so toolbar, bubble menu,
|
|
27
|
-
* and emoji picker components can access the editor via context.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```tsx
|
|
31
|
-
* const editorRef = useRef<DomternalEditorRef>(null);
|
|
32
|
-
*
|
|
33
|
-
* <DomternalEditor
|
|
34
|
-
* ref={editorRef}
|
|
35
|
-
* extensions={[Bold, Italic, Heading]}
|
|
36
|
-
* content="<p>Hello</p>"
|
|
37
|
-
* onUpdate={({ editor }) => console.log(editor.getHTML())}
|
|
38
|
-
* />
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* @example Controlled mode
|
|
42
|
-
* ```tsx
|
|
43
|
-
* const [html, setHtml] = useState('<p>Hello</p>');
|
|
44
|
-
* <DomternalEditor value={html} onChange={setHtml} outputFormat="html" />
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export declare const DomternalEditor: import("react").ForwardRefExoticComponent<DomternalEditorProps & import("react").RefAttributes<DomternalEditorRef>>;
|
|
48
|
-
//# sourceMappingURL=DomternalEditor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DomternalEditor.d.ts","sourceRoot":"","sources":["../src/DomternalEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAa,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlE,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,cAAc,CAAC;IAClF,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,2EAA2E;IAC3E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,KAAK,IAAI,CAAC;IACjD,gEAAgE;IAChE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,eAAe,qHA4E3B,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Editor, FloatingMenuOptions } from '@domternal/core';
|
|
2
|
-
export interface DomternalFloatingMenuProps {
|
|
3
|
-
/** The editor instance. If omitted, uses EditorProvider context. */
|
|
4
|
-
editor?: Editor;
|
|
5
|
-
/** Custom visibility function. */
|
|
6
|
-
shouldShow?: FloatingMenuOptions['shouldShow'];
|
|
7
|
-
/** Pixel offset from trigger. @default 0 */
|
|
8
|
-
offset?: number;
|
|
9
|
-
/** Content to render inside the floating menu. */
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
}
|
|
12
|
-
export declare function DomternalFloatingMenu({ editor: editorProp, shouldShow, offset, children, }: DomternalFloatingMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
//# sourceMappingURL=DomternalFloatingMenu.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DomternalFloatingMenu.d.ts","sourceRoot":"","sources":["../src/DomternalFloatingMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGnE,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,UAAU,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAC/C,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EAAE,UAAU,EAClB,UAAU,EACV,MAAU,EACV,QAAQ,GACT,EAAE,0BAA0B,2CAsC5B"}
|
package/dist/EditorContent.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type HTMLAttributes, type Ref } from 'react';
|
|
2
|
-
import type { Editor } from '@domternal/core';
|
|
3
|
-
export interface EditorContentProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
/** The editor instance to render. */
|
|
5
|
-
editor: Editor | null;
|
|
6
|
-
/** Ref to the underlying div element. */
|
|
7
|
-
innerRef?: Ref<HTMLDivElement>;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Renders the ProseMirror editor view into a div element.
|
|
11
|
-
*
|
|
12
|
-
* Use this with `useEditor` for a flexible, decoupled pattern where the
|
|
13
|
-
* editor hook and rendering are separated:
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* const { editor } = useEditor({ extensions, content });
|
|
18
|
-
* return <EditorContent editor={editor} className="my-editor" />;
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare function EditorContent({ editor, innerRef, ...htmlProps }: EditorContentProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
//# sourceMappingURL=EditorContent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EditorContent.d.ts","sourceRoot":"","sources":["../src/EditorContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,WAAW,kBAAmB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACxE,qCAAqC;IACrC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAChC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EAAE,kBAAkB,2CA4BnF"}
|
package/dist/EditorContext.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
import type { Editor } from '@domternal/core';
|
|
3
|
-
interface EditorContextValue {
|
|
4
|
-
editor: Editor | null;
|
|
5
|
-
}
|
|
6
|
-
export interface EditorProviderProps {
|
|
7
|
-
/** The editor instance to provide to descendants. */
|
|
8
|
-
editor: Editor | null;
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Provides an editor instance to all descendant components via React Context.
|
|
13
|
-
*
|
|
14
|
-
* Components like DomternalToolbar, DomternalBubbleMenu, DomternalFloatingMenu,
|
|
15
|
-
* and DomternalEmojiPicker will automatically use this editor when no explicit
|
|
16
|
-
* `editor` prop is passed.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```tsx
|
|
20
|
-
* const { editor } = useEditor({ extensions, content });
|
|
21
|
-
*
|
|
22
|
-
* <EditorProvider editor={editor}>
|
|
23
|
-
* <DomternalToolbar />
|
|
24
|
-
* <EditorContent editor={editor} />
|
|
25
|
-
* <DomternalBubbleMenu contexts={{ text: ['bold', 'italic'] }} />
|
|
26
|
-
* </EditorProvider>
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export declare function EditorProvider({ editor, children }: EditorProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
-
/**
|
|
31
|
-
* Access the editor instance from the nearest EditorProvider.
|
|
32
|
-
*
|
|
33
|
-
* @returns `{ editor }` where editor may be null if the provider has no editor yet.
|
|
34
|
-
* @throws If used outside of an EditorProvider (optional - returns null editor instead).
|
|
35
|
-
*/
|
|
36
|
-
export declare function useCurrentEditor(): EditorContextValue;
|
|
37
|
-
export {};
|
|
38
|
-
//# sourceMappingURL=EditorContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EditorContext.d.ts","sourceRoot":"","sources":["../src/EditorContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,UAAU,kBAAkB;IAC1B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAID,MAAM,WAAW,mBAAmB;IAClC,qDAAqD;IACrD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CAGvE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CAErD"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Editor, BubbleMenuOptions } from '@domternal/core';
|
|
2
|
-
export interface DomternalBubbleMenuProps {
|
|
3
|
-
/** The editor instance. If omitted, uses EditorProvider context. */
|
|
4
|
-
editor?: Editor;
|
|
5
|
-
/** Custom visibility function. */
|
|
6
|
-
shouldShow?: BubbleMenuOptions['shouldShow'];
|
|
7
|
-
/** Position relative to selection. @default 'top' */
|
|
8
|
-
placement?: 'top' | 'bottom';
|
|
9
|
-
/** Pixel offset from selection. @default 8 */
|
|
10
|
-
offset?: number;
|
|
11
|
-
/** Debounce delay in ms. @default 0 */
|
|
12
|
-
updateDelay?: number;
|
|
13
|
-
/** Fixed item names, e.g. ['bold', 'italic', 'code']. */
|
|
14
|
-
items?: string[];
|
|
15
|
-
/** Context-aware: map context names to item arrays, true for all, or null to disable. */
|
|
16
|
-
contexts?: Record<string, string[] | true | null>;
|
|
17
|
-
/** Additional content rendered after buttons. */
|
|
18
|
-
children?: React.ReactNode;
|
|
19
|
-
}
|
|
20
|
-
export declare function DomternalBubbleMenu({ editor: editorProp, shouldShow, placement, offset, updateDelay, items, contexts, children, }: DomternalBubbleMenuProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
//# sourceMappingURL=DomternalBubbleMenu.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DomternalBubbleMenu.d.ts","sourceRoot":"","sources":["../../src/bubble-menu/DomternalBubbleMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAiB,MAAM,iBAAiB,CAAC;AAIhF,MAAM,WAAW,wBAAwB;IACvC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,UAAU,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAC7C,qDAAqD;IACrD,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC7B,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,yFAAyF;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;IAClD,iDAAiD;IACjD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EAAE,UAAU,EAClB,UAAU,EACV,SAAS,EACT,MAAM,EACN,WAAW,EACX,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,EAAE,wBAAwB,2CA8D1B"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Editor, ToolbarButton, BubbleMenuOptions } from '@domternal/core';
|
|
2
|
-
interface BubbleMenuSeparator {
|
|
3
|
-
type: 'separator';
|
|
4
|
-
name: string;
|
|
5
|
-
}
|
|
6
|
-
export type BubbleMenuItem = ToolbarButton | BubbleMenuSeparator;
|
|
7
|
-
export interface UseBubbleMenuOptions {
|
|
8
|
-
editor: Editor | null;
|
|
9
|
-
shouldShow?: BubbleMenuOptions['shouldShow'] | undefined;
|
|
10
|
-
placement?: 'top' | 'bottom' | undefined;
|
|
11
|
-
offset?: number | undefined;
|
|
12
|
-
updateDelay?: number | undefined;
|
|
13
|
-
items?: string[] | undefined;
|
|
14
|
-
contexts?: Record<string, string[] | true | null> | undefined;
|
|
15
|
-
}
|
|
16
|
-
export declare function useBubbleMenu(options: UseBubbleMenuOptions): {
|
|
17
|
-
menuRef: import("react").RefObject<HTMLDivElement | null>;
|
|
18
|
-
resolvedItems: BubbleMenuItem[];
|
|
19
|
-
isItemActive: (item: ToolbarButton) => boolean;
|
|
20
|
-
isItemDisabled: (item: ToolbarButton) => boolean;
|
|
21
|
-
executeCommand: (item: ToolbarButton) => void;
|
|
22
|
-
activeVersion: number;
|
|
23
|
-
getCachedIcon: (name: string) => string;
|
|
24
|
-
};
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=useBubbleMenu.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useBubbleMenu.d.ts","sourceRoot":"","sources":["../../src/bubble-menu/useBubbleMenu.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAsBhF,UAAU,mBAAmB;IAAG,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AACjE,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,mBAAmB,CAAC;AAoBjE,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,iBAAiB,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;IACzD,SAAS,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;CAC/D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB;;;yBA6O7B,aAAa,KAAG,OAAO;2BAIrB,aAAa,KAAG,OAAO;2BAIvB,aAAa;;0BAgBnB,MAAM;EAE/B"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Editor } from '@domternal/core';
|
|
2
|
-
import { type EmojiPickerItem } from './useEmojiPicker.js';
|
|
3
|
-
export interface DomternalEmojiPickerProps {
|
|
4
|
-
/** The editor instance. If omitted, uses EditorProvider context. */
|
|
5
|
-
editor?: Editor;
|
|
6
|
-
/** Array of emoji items with emoji, name, and group. */
|
|
7
|
-
emojis: EmojiPickerItem[];
|
|
8
|
-
}
|
|
9
|
-
export declare function DomternalEmojiPicker({ editor: editorProp, emojis }: DomternalEmojiPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
//# sourceMappingURL=DomternalEmojiPicker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DomternalEmojiPicker.d.ts","sourceRoot":"","sources":["../../src/emoji-picker/DomternalEmojiPicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAsB3E,MAAM,WAAW,yBAAyB;IACxC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,yBAAyB,2CAuJ7F"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Editor } from '@domternal/core';
|
|
2
|
-
export interface EmojiPickerItem {
|
|
3
|
-
emoji: string;
|
|
4
|
-
name: string;
|
|
5
|
-
group: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function useEmojiPicker(editor: Editor | null, emojis: EmojiPickerItem[]): {
|
|
8
|
-
isOpen: boolean;
|
|
9
|
-
searchQuery: string;
|
|
10
|
-
activeCategory: string;
|
|
11
|
-
categories: Map<string, EmojiPickerItem[]>;
|
|
12
|
-
categoryNames: string[];
|
|
13
|
-
filteredEmojis: EmojiPickerItem[];
|
|
14
|
-
frequentlyUsed: EmojiPickerItem[];
|
|
15
|
-
pickerRef: import("react").RefObject<HTMLDivElement | null>;
|
|
16
|
-
selectEmoji: (item: EmojiPickerItem) => void;
|
|
17
|
-
onSearch: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
18
|
-
scrollToCategory: (cat: string) => void;
|
|
19
|
-
onGridScroll: () => void;
|
|
20
|
-
close: () => void;
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=useEmojiPicker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useEmojiPicker.d.ts","sourceRoot":"","sources":["../../src/emoji-picker/useEmojiPicker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE;;;;;;;;;wBAgJtC,eAAe;sBASjB,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC;4BAI7B,MAAM;;;EAyDlD"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACtE,YAAY,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,YAAY,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAC9E,YAAY,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AACxF,YAAY,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAGxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,YAAY,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAC9G,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGzF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC3E,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type ElementType, type HTMLAttributes } from 'react';
|
|
2
|
-
export interface NodeViewContentProps extends HTMLAttributes<HTMLElement> {
|
|
3
|
-
/** The HTML element type to render. @default 'div' */
|
|
4
|
-
as?: ElementType;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Placeholder for editable nested content within a custom React node view.
|
|
8
|
-
* ProseMirror manages the content DOM inside this element.
|
|
9
|
-
*/
|
|
10
|
-
export declare function NodeViewContent({ as: Tag, style, ...props }: NodeViewContentProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
//# sourceMappingURL=NodeViewContent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeViewContent.d.ts","sourceRoot":"","sources":["../../src/node-views/NodeViewContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAG9D,MAAM,WAAW,oBAAqB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACvE,sDAAsD;IACtD,EAAE,CAAC,EAAE,WAAW,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,GAAW,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,2CAWzF"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type ElementType, type HTMLAttributes } from 'react';
|
|
2
|
-
export interface NodeViewWrapperProps extends HTMLAttributes<HTMLElement> {
|
|
3
|
-
/** The HTML element type to render. @default 'div' */
|
|
4
|
-
as?: ElementType;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Container component for custom React node views.
|
|
8
|
-
* Handles drag events and marks the element as a node view wrapper.
|
|
9
|
-
*/
|
|
10
|
-
export declare function NodeViewWrapper({ as: Tag, style, ...props }: NodeViewWrapperProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
//# sourceMappingURL=NodeViewWrapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeViewWrapper.d.ts","sourceRoot":"","sources":["../../src/node-views/NodeViewWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAG9D,MAAM,WAAW,oBAAqB,SAAQ,cAAc,CAAC,WAAW,CAAC;IACvE,sDAAsD;IACtD,EAAE,CAAC,EAAE,WAAW,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,EAAE,GAAW,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,2CAWzF"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type RefCallback } from 'react';
|
|
2
|
-
export interface ReactNodeViewContextValue {
|
|
3
|
-
onDragStart: (event: DragEvent) => void;
|
|
4
|
-
nodeViewContentRef: RefCallback<HTMLElement>;
|
|
5
|
-
}
|
|
6
|
-
export declare const ReactNodeViewProvider: import("react").Provider<ReactNodeViewContextValue | null>;
|
|
7
|
-
/**
|
|
8
|
-
* Access node view internals from within a custom React node view component.
|
|
9
|
-
* Used by NodeViewWrapper and NodeViewContent.
|
|
10
|
-
*/
|
|
11
|
-
export declare function useReactNodeView(): ReactNodeViewContextValue;
|
|
12
|
-
//# sourceMappingURL=ReactNodeViewContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNodeViewContext.d.ts","sourceRoot":"","sources":["../../src/node-views/ReactNodeViewContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpE,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACxC,kBAAkB,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;CAC9C;AAID,eAAO,MAAM,qBAAqB,4DAAgC,CAAC;AAEnE;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,yBAAyB,CAM5D"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import type { Editor } from '@domternal/core';
|
|
2
|
-
/** ProseMirror node shape passed to node views. */
|
|
3
|
-
interface PMNode {
|
|
4
|
-
type: {
|
|
5
|
-
name: string;
|
|
6
|
-
spec: {
|
|
7
|
-
group?: string;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
attrs: Record<string, unknown>;
|
|
11
|
-
textContent: string;
|
|
12
|
-
nodeSize: number;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Props passed to custom React node view components.
|
|
16
|
-
*/
|
|
17
|
-
export interface ReactNodeViewProps {
|
|
18
|
-
/** The editor instance. */
|
|
19
|
-
editor: Editor;
|
|
20
|
-
/** The ProseMirror node being rendered. */
|
|
21
|
-
node: PMNode;
|
|
22
|
-
/** Whether this node is selected via NodeSelection. */
|
|
23
|
-
selected: boolean;
|
|
24
|
-
/** Get the document position of this node. */
|
|
25
|
-
getPos: () => number;
|
|
26
|
-
/** Update the node's attributes. */
|
|
27
|
-
updateAttributes: (attrs: Record<string, unknown>) => void;
|
|
28
|
-
/** Delete this node from the document. */
|
|
29
|
-
deleteNode: () => void;
|
|
30
|
-
/** The extension that created this node view (name, options). Injected by core. */
|
|
31
|
-
extension: {
|
|
32
|
-
name: string;
|
|
33
|
-
options: Record<string, unknown>;
|
|
34
|
-
};
|
|
35
|
-
/** ProseMirror decorations applied to this node. */
|
|
36
|
-
decorations: unknown[];
|
|
37
|
-
}
|
|
38
|
-
export interface ReactNodeViewRendererOptions {
|
|
39
|
-
/** Wrapper element tag. @default 'div' for block, 'span' for inline */
|
|
40
|
-
as?: string;
|
|
41
|
-
/** Additional CSS class on the wrapper element. */
|
|
42
|
-
className?: string;
|
|
43
|
-
/** Tag for the content DOM element. Set to null for no editable content. @default 'div' */
|
|
44
|
-
contentDOMElement?: string | null;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Converts a React component into a ProseMirror NodeView constructor.
|
|
48
|
-
*
|
|
49
|
-
* Returns a function matching ProseMirror's native `(node, view, getPos, decorations)` signature.
|
|
50
|
-
* The editor and extension context are automatically injected by core via `__domternalContext`.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```ts
|
|
54
|
-
* const ImageExtension = Image.extend({
|
|
55
|
-
* addNodeView() {
|
|
56
|
-
* return ReactNodeViewRenderer(ImageComponent);
|
|
57
|
-
* }
|
|
58
|
-
* });
|
|
59
|
-
* ```
|
|
60
|
-
*
|
|
61
|
-
* @example Accessing extension options in the component
|
|
62
|
-
* ```tsx
|
|
63
|
-
* function ImageComponent({ node, extension, decorations }: ReactNodeViewProps) {
|
|
64
|
-
* const maxWidth = extension.options.maxWidth as number;
|
|
65
|
-
* return <NodeViewWrapper><img src={node.attrs.src} style={{ maxWidth }} /></NodeViewWrapper>;
|
|
66
|
-
* }
|
|
67
|
-
* ```
|
|
68
|
-
*/
|
|
69
|
-
export declare function ReactNodeViewRenderer(component: React.ComponentType<ReactNodeViewProps>, options?: ReactNodeViewRendererOptions): (node: PMNode, _view: unknown, getPos: () => number, decorations: unknown[]) => ReactNodeView;
|
|
70
|
-
interface ReactNodeViewInit {
|
|
71
|
-
editor: Editor;
|
|
72
|
-
node: PMNode;
|
|
73
|
-
getPos: () => number;
|
|
74
|
-
decorations: unknown[];
|
|
75
|
-
extension: {
|
|
76
|
-
name: string;
|
|
77
|
-
options: Record<string, unknown>;
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
declare class ReactNodeView {
|
|
81
|
-
dom: HTMLElement;
|
|
82
|
-
contentDOM: HTMLElement | null;
|
|
83
|
-
private root;
|
|
84
|
-
private component;
|
|
85
|
-
private editor;
|
|
86
|
-
private node;
|
|
87
|
-
private getPos;
|
|
88
|
-
private decorations;
|
|
89
|
-
private extension;
|
|
90
|
-
private selected;
|
|
91
|
-
constructor(component: React.ComponentType<ReactNodeViewProps>, init: ReactNodeViewInit, options: ReactNodeViewRendererOptions);
|
|
92
|
-
private render;
|
|
93
|
-
update(node: PMNode, decorations: unknown[]): boolean;
|
|
94
|
-
selectNode(): void;
|
|
95
|
-
deselectNode(): void;
|
|
96
|
-
destroy(): void;
|
|
97
|
-
ignoreMutation(mutation: MutationRecord): boolean;
|
|
98
|
-
stopEvent(): boolean;
|
|
99
|
-
}
|
|
100
|
-
export {};
|
|
101
|
-
//# sourceMappingURL=ReactNodeViewRenderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNodeViewRenderer.d.ts","sourceRoot":"","sources":["../../src/node-views/ReactNodeViewRenderer.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAmB,MAAM,iBAAiB,CAAC;AAE/D,mDAAmD;AACnD,UAAU,MAAM;IACd,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE;YAAE,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,QAAQ,EAAE,OAAO,CAAC;IAClB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,MAAM,CAAC;IACrB,oCAAoC;IACpC,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IAC3D,0CAA0C;IAC1C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,mFAAmF;IACnF,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAC9D,oDAAoD;IACpD,WAAW,EAAE,OAAO,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,4BAA4B;IAC3C,uEAAuE;IACvE,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2FAA2F;IAC3F,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,EAClD,OAAO,GAAE,4BAAiC,UAGf,MAAM,SAAS,OAAO,UAAU,MAAM,MAAM,eAAe,OAAO,EAAE,mBAgBhG;AAED,UAAU,iBAAiB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,MAAM,CAAC;IACrB,WAAW,EAAE,OAAO,EAAE,CAAC;IACvB,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;CAC/D;AAED,cAAM,aAAa;IACjB,GAAG,EAAE,WAAW,CAAC;IACjB,UAAU,EAAE,WAAW,GAAG,IAAI,CAAQ;IACtC,OAAO,CAAC,IAAI,CAAO;IACnB,OAAO,CAAC,SAAS,CAA0C;IAC3D,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,WAAW,CAAY;IAC/B,OAAO,CAAC,SAAS,CAAqD;IACtE,OAAO,CAAC,QAAQ,CAAS;gBAGvB,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,EAClD,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,4BAA4B;IA8BvC,OAAO,CAAC,MAAM;IA0Cd,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,OAAO;IAQrD,UAAU;IAKV,YAAY;IAKZ,OAAO;IAMP,cAAc,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO;IAKjD,SAAS,IAAI,OAAO;CAGrB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Editor, IconSet, ToolbarLayoutEntry } from '@domternal/core';
|
|
2
|
-
export interface DomternalToolbarProps {
|
|
3
|
-
/** The editor instance. If omitted, uses EditorProvider context. */
|
|
4
|
-
editor?: Editor;
|
|
5
|
-
/** Custom icon set. When provided, only these icons are used (no defaultIcons fallback). */
|
|
6
|
-
icons?: IconSet;
|
|
7
|
-
/** Custom toolbar layout. */
|
|
8
|
-
layout?: ToolbarLayoutEntry[];
|
|
9
|
-
}
|
|
10
|
-
export declare function DomternalToolbar({ editor: editorProp, icons, layout }: DomternalToolbarProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
-
//# sourceMappingURL=DomternalToolbar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DomternalToolbar.d.ts","sourceRoot":"","sources":["../../src/toolbar/DomternalToolbar.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,MAAM,EACN,OAAO,EAIP,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAUzB,MAAM,WAAW,qBAAqB;IACpC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4FAA4F;IAC5F,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC/B;AAED,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,qBAAqB,kDAiK5F"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ToolbarButton as ToolbarButtonType } from '@domternal/core';
|
|
2
|
-
export interface ToolbarButtonProps {
|
|
3
|
-
item: ToolbarButtonType;
|
|
4
|
-
isActive: boolean;
|
|
5
|
-
isDisabled: boolean;
|
|
6
|
-
tabIndex: number;
|
|
7
|
-
tooltip: string;
|
|
8
|
-
iconHtml: string;
|
|
9
|
-
ariaExpanded?: string | null;
|
|
10
|
-
onClick: (item: ToolbarButtonType, event: React.MouseEvent) => void;
|
|
11
|
-
onFocus: (name: string) => void;
|
|
12
|
-
}
|
|
13
|
-
export declare function ToolbarButton({ item, isActive, isDisabled, tabIndex, tooltip, iconHtml, ariaExpanded, onClick, onFocus, }: ToolbarButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
//# sourceMappingURL=ToolbarButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarButton.d.ts","sourceRoot":"","sources":["../../src/toolbar/ToolbarButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAE1E,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,iBAAiB,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACpE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,OAAO,GACR,EAAE,kBAAkB,2CAiBpB"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ToolbarButton, ToolbarDropdown as ToolbarDropdownType } from '@domternal/core';
|
|
2
|
-
export interface ToolbarDropdownProps {
|
|
3
|
-
dropdown: ToolbarDropdownType;
|
|
4
|
-
isOpen: boolean;
|
|
5
|
-
isActive: (name: string) => boolean;
|
|
6
|
-
isDropdownActive: boolean;
|
|
7
|
-
isDisabled: boolean;
|
|
8
|
-
tabIndex: number;
|
|
9
|
-
triggerHtml: string;
|
|
10
|
-
getCachedItemContent: (icon: string, label: string, mode?: 'icon-text' | 'text' | 'icon') => string;
|
|
11
|
-
onToggle: (dropdown: ToolbarDropdownType) => void;
|
|
12
|
-
onItemClick: (item: ToolbarButton, event: React.MouseEvent) => void;
|
|
13
|
-
onFocus: (name: string) => void;
|
|
14
|
-
}
|
|
15
|
-
export declare function ToolbarDropdown({ dropdown, isOpen, isActive, isDropdownActive, isDisabled, tabIndex, triggerHtml, getCachedItemContent, onToggle, onItemClick, onFocus, }: ToolbarDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
//# sourceMappingURL=ToolbarDropdown.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarDropdown.d.ts","sourceRoot":"","sources":["../../src/toolbar/ToolbarDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG7F,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACpC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IACpG,QAAQ,EAAE,CAAC,QAAQ,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAClD,WAAW,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IACpE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,WAAW,EACX,oBAAoB,EACpB,QAAQ,EACR,WAAW,EACX,OAAO,GACR,EAAE,oBAAoB,2CA4BtB"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ToolbarButton, ToolbarDropdown } from '@domternal/core';
|
|
2
|
-
export interface ToolbarDropdownPanelProps {
|
|
3
|
-
dropdown: ToolbarDropdown;
|
|
4
|
-
isActive: (name: string) => boolean;
|
|
5
|
-
getCachedItemContent: (icon: string, label: string, mode?: 'icon-text' | 'text' | 'icon') => string;
|
|
6
|
-
onItemClick: (item: ToolbarButton, event: React.MouseEvent) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare function ToolbarDropdownPanel({ dropdown, isActive, getCachedItemContent, onItemClick, }: ToolbarDropdownPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
//# sourceMappingURL=ToolbarDropdownPanel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToolbarDropdownPanel.d.ts","sourceRoot":"","sources":["../../src/toolbar/ToolbarDropdownPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEtE,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACpC,oBAAoB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IACpG,WAAW,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CACrE;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,QAAQ,EACR,oBAAoB,EACpB,WAAW,GACZ,EAAE,yBAAyB,2CA8D3B"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Editor } from '@domternal/core';
|
|
2
|
-
/**
|
|
3
|
-
* Read a CSS property value at the current cursor position.
|
|
4
|
-
* Prefers inline style (explicit mark) over computed style (inherited).
|
|
5
|
-
*/
|
|
6
|
-
export declare function getComputedStyleAtCursor(editor: Editor, prop: string): string | null;
|
|
7
|
-
/**
|
|
8
|
-
* Read only inline style at the current cursor position (no computed fallback).
|
|
9
|
-
* Used for font-family to avoid reading browser default inheritance.
|
|
10
|
-
*/
|
|
11
|
-
export declare function getInlineStyleAtCursor(editor: Editor, prop: string): string | null;
|
|
12
|
-
//# sourceMappingURL=useComputedStyle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useComputedStyle.d.ts","sourceRoot":"","sources":["../../src/toolbar/useComputedStyle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAcpF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYlF"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ToolbarController } from '@domternal/core';
|
|
2
|
-
export declare function useKeyboardNav(controllerRef: React.RefObject<ToolbarController | null>, toolbarRef: React.RefObject<HTMLDivElement | null>, closeDropdown: () => void): {
|
|
3
|
-
onKeyDown: (event: React.KeyboardEvent) => void;
|
|
4
|
-
focusCurrentButton: () => void;
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=useKeyboardNav.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboardNav.d.ts","sourceRoot":"","sources":["../../src/toolbar/useKeyboardNav.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,wBAAgB,cAAc,CAC5B,aAAa,EAAE,KAAK,CAAC,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,EACxD,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,EAClD,aAAa,EAAE,MAAM,IAAI;uBAsBa,KAAK,CAAC,aAAa;;EAwD1D"}
|