@yoopta/editor 6.0.0-beta.2 → 6.0.0-beta.20
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 +109 -173
- package/dist/components/Editor/render-blocks.d.ts +4 -2
- package/dist/components/Editor/render-blocks.d.ts.map +1 -1
- package/dist/components/Editor/render-editor.d.ts +3 -5
- package/dist/components/Editor/render-editor.d.ts.map +1 -1
- package/dist/editor/blocks/toggleBlock.d.ts.map +1 -1
- package/dist/editor/core/applyTransforms.d.ts.map +1 -1
- package/dist/editor/core/history.d.ts +2 -2
- package/dist/editor/core/history.d.ts.map +1 -1
- package/dist/editor/elements/create-element-structure.d.ts.map +1 -1
- package/dist/editor/elements/getElementRect.d.ts +28 -0
- package/dist/editor/elements/getElementRect.d.ts.map +1 -0
- package/dist/editor/elements/index.d.ts +4 -2
- package/dist/editor/elements/index.d.ts.map +1 -1
- package/dist/editor/index.d.ts +11 -2
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/editor/paths/isBlockSelected.d.ts.map +1 -1
- package/dist/editor/selection/index.d.ts +4 -1
- package/dist/editor/selection/index.d.ts.map +1 -1
- package/dist/editor/selection/toDOMRange.d.ts +33 -0
- package/dist/editor/selection/toDOMRange.d.ts.map +1 -0
- package/dist/editor/types.d.ts +18 -5
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/parsers/deserializeHTML.d.ts +9 -1
- package/dist/parsers/deserializeHTML.d.ts.map +1 -1
- package/dist/parsers/deserializeHTML.test.d.ts +2 -0
- package/dist/parsers/deserializeHTML.test.d.ts.map +1 -0
- package/dist/parsers/deserializeYooptaJSON.d.ts +16 -0
- package/dist/parsers/deserializeYooptaJSON.d.ts.map +1 -0
- package/dist/parsers/getHTML.d.ts.map +1 -1
- package/dist/parsers/getYooptaJSON.d.ts +20 -0
- package/dist/parsers/getYooptaJSON.d.ts.map +1 -0
- package/dist/plugins/hooks.d.ts.map +1 -1
- package/dist/plugins/slate-editor-component.d.ts.map +1 -1
- package/dist/utils/block-elements.d.ts.map +1 -1
- package/dist/utils/editor-builders.d.ts +0 -1
- package/dist/utils/editor-builders.d.ts.map +1 -1
- package/dist/utils/enter-action.d.ts.map +1 -1
- package/dist/utils/execute-backspace-action.d.ts.map +1 -1
- package/dist/utils/weakMaps.d.ts +2 -1
- package/dist/utils/weakMaps.d.ts.map +1 -1
- package/dist/yoopta-editor.d.ts +10 -12
- package/dist/yoopta-editor.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/components/SelectionBox/SelectionBox.d.ts +0 -19
- package/dist/components/SelectionBox/SelectionBox.d.ts.map +0 -1
- package/dist/components/SelectionBox/hooks.d.ts +0 -7
- package/dist/components/SelectionBox/hooks.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,200 +1,136 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @yoopta/editor
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Core headless package for Yoopta Editor. Provides the editor instance, block/element/mark logic, and React component. Plugins and marks are passed to `createYooptaEditor`; UI (toolbars, slash menu, block actions) is rendered as **children** of `<YooptaEditor>` from `@yoopta/ui`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
yarn add @yoopta/editor
|
|
8
|
+
yarn add slate slate-react slate-dom @yoopta/editor
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Peer dependencies: `slate`, `slate-react`, `slate-dom`.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
Plugins, marks, and optional initial value are passed to `createYooptaEditor`. The component receives only the `editor` instance and callbacks.
|
|
12
16
|
|
|
13
17
|
```tsx
|
|
14
|
-
import
|
|
15
|
-
|
|
18
|
+
import { useMemo } from 'react';
|
|
19
|
+
import YooptaEditor, { createYooptaEditor, type YooptaContentValue } from '@yoopta/editor';
|
|
16
20
|
import Paragraph from '@yoopta/paragraph';
|
|
21
|
+
import { Bold, Italic } from '@yoopta/marks';
|
|
17
22
|
|
|
18
23
|
const plugins = [Paragraph];
|
|
24
|
+
const marks = [Bold, Italic];
|
|
25
|
+
const initialValue = {} as YooptaContentValue;
|
|
26
|
+
|
|
27
|
+
export default function Editor() {
|
|
28
|
+
const editor = useMemo(
|
|
29
|
+
() => createYooptaEditor({ plugins, marks, value: initialValue }),
|
|
30
|
+
[],
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<YooptaEditor
|
|
35
|
+
editor={editor}
|
|
36
|
+
placeholder="Type / to open menu"
|
|
37
|
+
onChange={(value) => console.log(value)}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
19
42
|
|
|
20
|
-
|
|
21
|
-
// create instance
|
|
22
|
-
const editor: YooEditor = useMemo(() => createYooptaEditor(), []);
|
|
23
|
-
const [value, setValue] = useState();
|
|
43
|
+
To add toolbar and slash menu, install `@yoopta/ui` and render them as **children** of `<YooptaEditor>`:
|
|
24
44
|
|
|
25
|
-
|
|
45
|
+
```tsx
|
|
46
|
+
import { FloatingToolbar, FloatingBlockActions, SlashCommandMenu } from '@yoopta/ui';
|
|
26
47
|
|
|
27
|
-
|
|
28
|
-
|
|
48
|
+
<YooptaEditor editor={editor} onChange={onChange} placeholder="Type / to open menu">
|
|
49
|
+
<FloatingToolbar />
|
|
50
|
+
<FloatingBlockActions />
|
|
51
|
+
<SlashCommandMenu />
|
|
52
|
+
</YooptaEditor>
|
|
29
53
|
```
|
|
30
54
|
|
|
31
|
-
|
|
55
|
+
## YooptaEditor props
|
|
56
|
+
|
|
57
|
+
| Prop | Type | Description |
|
|
58
|
+
|------|------|-------------|
|
|
59
|
+
| `editor` | `YooEditor` | **Required.** Instance from `createYooptaEditor`. |
|
|
60
|
+
| `onChange` | `(value, options) => void` | Called when content changes. |
|
|
61
|
+
| `onPathChange` | `(path) => void` | Called when the current block path changes. |
|
|
62
|
+
| `autoFocus` | `boolean` | Focus editor on mount. Default: `true`. |
|
|
63
|
+
| `className` | `string` | Additional CSS class (default: `.yoopta-editor`). |
|
|
64
|
+
| `style` | `CSSProperties` | Inline styles (e.g. `{ width: 750, paddingBottom: 100 }`). |
|
|
65
|
+
| `placeholder` | `string` | Placeholder when the editor is empty. |
|
|
66
|
+
| `children` | `ReactNode` | UI components (toolbar, slash menu, block actions, etc.). |
|
|
67
|
+
| `renderBlock` | `(props) => ReactNode` | Custom wrapper per block (e.g. for drag-and-drop). |
|
|
68
|
+
|
|
69
|
+
Initial content is set via `createYooptaEditor({ value })` or later with `editor.setEditorValue(value)`. Do not pass `plugins`, `marks`, or `value` to `<YooptaEditor>`.
|
|
70
|
+
|
|
71
|
+
## createYooptaEditor options
|
|
32
72
|
|
|
33
73
|
```ts
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*/
|
|
38
|
-
editor: YooEditor;
|
|
39
|
-
/**
|
|
40
|
-
* Optional custom id. Useful for multiple instances
|
|
41
|
-
*/
|
|
42
|
-
id?: string;
|
|
43
|
-
/**
|
|
44
|
-
* List of plugins
|
|
45
|
-
*/
|
|
46
|
-
plugins: YooptaPlugin[];
|
|
47
|
-
/**
|
|
48
|
-
* List of marks from @yoopta/marks
|
|
49
|
-
*/
|
|
50
|
-
marks?: YooptaMark<any>[];
|
|
51
|
-
/**
|
|
52
|
-
* Optional value of editor. DEFAULT - [undefined]
|
|
53
|
-
*/
|
|
74
|
+
createYooptaEditor({
|
|
75
|
+
plugins: YooptaPlugin[]; // required
|
|
76
|
+
marks?: YooptaMark[]; // optional
|
|
54
77
|
value?: YooptaContentValue;
|
|
55
|
-
/**
|
|
56
|
-
* Autofocus when editor is ready. DEFAULT - [true]
|
|
57
|
-
*/
|
|
58
|
-
autoFocus?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Additional className for your needs. DEFAULT - [.yoopta-editor]
|
|
61
|
-
*/
|
|
62
|
-
className?: string;
|
|
63
|
-
/**
|
|
64
|
-
* Box for selection area to select by mouse several blocks. DEFAULT - [document]
|
|
65
|
-
*/
|
|
66
|
-
selectionBoxRoot?: HTMLElement | React.MutableRefObject<HTMLElement | null> | false;
|
|
67
|
-
children?: React.ReactNode;
|
|
68
|
-
tools?: Partial<Tools>;
|
|
69
|
-
placeholder?: string;
|
|
70
78
|
readOnly?: boolean;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
/* Style CSS Object. [Default] - { width: 400, paddingBottom: 100 }
|
|
74
|
-
*/
|
|
75
|
-
style?: number | string;
|
|
76
|
-
/* Change handler */
|
|
77
|
-
onChange?: (value: YooptaContentValue, options: YooptaOnChangeOptions) => void;
|
|
78
|
-
/* Path change handler */
|
|
79
|
-
onPathChange?: (path: YooptaPath) => void;
|
|
80
|
-
};
|
|
79
|
+
id?: string;
|
|
80
|
+
});
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
## Editor API (YooEditor)
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
duplicateBlock: WithoutFirstArg<typeof duplicateBlock>;
|
|
96
|
-
toggleBlock: WithoutFirstArg<typeof toggleBlock>;
|
|
97
|
-
increaseBlockDepth: WithoutFirstArg<typeof increaseBlockDepth>;
|
|
98
|
-
decreaseBlockDepth: WithoutFirstArg<typeof decreaseBlockDepth>;
|
|
99
|
-
moveBlock: WithoutFirstArg<typeof moveBlock>;
|
|
100
|
-
focusBlock: WithoutFirstArg<typeof focusBlock>;
|
|
101
|
-
mergeBlock: () => void;
|
|
102
|
-
splitBlock: (options?: SplitBlockOptions) => void;
|
|
103
|
-
getBlock: (options: GetBlockOptions) => YooptaBlockData | null;
|
|
104
|
-
|
|
105
|
-
// path handlers
|
|
106
|
-
path: YooptaPath;
|
|
107
|
-
setPath: (path: YooptaPath) => void;
|
|
108
|
-
|
|
109
|
-
children: YooptaContentValue;
|
|
110
|
-
getEditorValue: () => YooptaContentValue;
|
|
111
|
-
setEditorValue: WithoutFirstArg<typeof setEditorValue>;
|
|
112
|
-
blockEditorsMap: YooptaPluginsEditorMap;
|
|
113
|
-
blocks: YooptaBlocks;
|
|
114
|
-
formats: YooptaFormats;
|
|
115
|
-
shortcuts: Record<string, YooptaBlock>;
|
|
116
|
-
plugins: Record<string, Plugin<Record<string, SlateElement>, unknown>>;
|
|
117
|
-
commands: Record<string, (...args: any[]) => any>;
|
|
118
|
-
|
|
119
|
-
// core handlers
|
|
120
|
-
applyTransforms: WithoutFirstArg<typeof applyTransforms>;
|
|
121
|
-
batchOperations: (fn: () => void) => void;
|
|
122
|
-
|
|
123
|
-
// events handlers
|
|
124
|
-
on: <K extends keyof YooptaEventsMap>(
|
|
125
|
-
event: K,
|
|
126
|
-
fn: (payload: YooptaEventsMap[K]) => void,
|
|
127
|
-
) => void;
|
|
128
|
-
once: <K extends keyof YooptaEventsMap>(
|
|
129
|
-
event: K,
|
|
130
|
-
fn: (payload: YooptaEventsMap[K]) => void,
|
|
131
|
-
) => void;
|
|
132
|
-
off: <K extends keyof YooptaEventsMap>(
|
|
133
|
-
event: K,
|
|
134
|
-
fn: (payload: YooptaEventsMap[K]) => void,
|
|
135
|
-
) => void;
|
|
136
|
-
emit: <K extends keyof YooptaEventsMap>(event: K, payload: YooptaEventsMap[K]) => void;
|
|
137
|
-
|
|
138
|
-
// focus handlers
|
|
139
|
-
isFocused: () => boolean;
|
|
140
|
-
blur: (options?: EditorBlurOptions) => void;
|
|
141
|
-
focus: () => void;
|
|
142
|
-
|
|
143
|
-
// parser handlers
|
|
144
|
-
getHTML: (content: YooptaContentValue) => string;
|
|
145
|
-
getMarkdown: (content: YooptaContentValue) => string;
|
|
146
|
-
getPlainText: (content: YooptaContentValue) => string;
|
|
147
|
-
getEmail: (content: YooptaContentValue, templateOptions: EmailTemplateOptions) => string;
|
|
148
|
-
|
|
149
|
-
// history
|
|
150
|
-
historyStack: Record<HistoryStackName, HistoryStack[]>;
|
|
151
|
-
isSavingHistory: WithoutFirstArg<typeof YooptaHistory.isSavingHistory>;
|
|
152
|
-
isMergingHistory: WithoutFirstArg<typeof YooptaHistory.isMergingHistory>;
|
|
153
|
-
withoutSavingHistory: WithoutFirstArg<typeof YooptaHistory.withoutSavingHistory>;
|
|
154
|
-
withoutMergingHistory: WithoutFirstArg<typeof YooptaHistory.withoutMergingHistory>;
|
|
155
|
-
withMergingHistory: WithoutFirstArg<typeof YooptaHistory.withMergingHistory>;
|
|
156
|
-
withSavingHistory: WithoutFirstArg<typeof YooptaHistory.withSavingHistory>;
|
|
157
|
-
redo: WithoutFirstArg<typeof YooptaHistory.redo>;
|
|
158
|
-
undo: WithoutFirstArg<typeof YooptaHistory.undo>;
|
|
159
|
-
|
|
160
|
-
// ref to editor element
|
|
161
|
-
refElement: HTMLElement | null;
|
|
162
|
-
};
|
|
163
|
-
```
|
|
85
|
+
- **Content:** `getEditorValue()`, `setEditorValue(value)`
|
|
86
|
+
- **Blocks:** `insertBlock`, `updateBlock`, `deleteBlock`, `duplicateBlock`, `toggleBlock`, `moveBlock`, `focusBlock`, `mergeBlock`, `splitBlock`, `increaseBlockDepth`, `decreaseBlockDepth`, `getBlock`
|
|
87
|
+
- **Transforms:** `applyTransforms([{ type: 'validate_block_paths' }])`
|
|
88
|
+
- **History:** `undo()`, `redo()`, `batchOperations(fn)`
|
|
89
|
+
- **Events:** `on`, `off`, `once`, `emit` — events: `change`, `focus`, `blur`, `path-change`, `block:copy`
|
|
90
|
+
- **Parsers:** `getHTML(value)`, `getMarkdown(value)`, `getPlainText(value)`, `getEmail(value, options)`
|
|
91
|
+
- **Focus:** `focus()`, `blur()`, `isFocused()`
|
|
92
|
+
- **Element builder:** `editor.y` for building block/element structures programmatically
|
|
93
|
+
|
|
94
|
+
## Namespace APIs
|
|
164
95
|
|
|
165
|
-
|
|
96
|
+
Use these for programmatic control (e.g. inside toolbar or custom UI):
|
|
166
97
|
|
|
167
98
|
```ts
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
useYooptaFocused();
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Hook to get the data for a specific block by its ID.
|
|
188
|
-
* @param {string} blockId The ID of the block.
|
|
189
|
-
* @returns {YooptaBlockData | undefined} The data of the block, or undefined if not found.
|
|
190
|
-
*/
|
|
191
|
-
useBlockData(blockId);
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Hook to get the options for a plugin.
|
|
195
|
-
* @template TOptions The type of options expected.
|
|
196
|
-
* @param {string} blockType The block type associated with the plugin.
|
|
197
|
-
* @returns {PluginOptions<TOptions>} The options of the plugin.
|
|
198
|
-
*/
|
|
199
|
-
useYooptaPluginOptions<TOptions>(blockType);
|
|
99
|
+
import { Blocks, Elements, Marks, Selection } from '@yoopta/editor';
|
|
100
|
+
|
|
101
|
+
// Block operations
|
|
102
|
+
Blocks.insertBlock(editor, { ... });
|
|
103
|
+
Blocks.updateBlock(editor, { ... });
|
|
104
|
+
Blocks.deleteBlock(editor, { ... });
|
|
105
|
+
Blocks.getBlock(editor, { id: blockId });
|
|
106
|
+
|
|
107
|
+
// Element operations (within a block)
|
|
108
|
+
Elements.insertElement(editor, { ... });
|
|
109
|
+
Elements.updateElement(editor, { ... });
|
|
110
|
+
Elements.getElement(editor, { ... });
|
|
111
|
+
|
|
112
|
+
// Text formatting (marks)
|
|
113
|
+
Marks.toggle(editor, { type: 'bold' });
|
|
114
|
+
Marks.isActive(editor, { type: 'bold' });
|
|
200
115
|
```
|
|
116
|
+
|
|
117
|
+
## Hooks
|
|
118
|
+
|
|
119
|
+
Must be used inside a component that is a **child** of `<YooptaEditor>` (e.g. inside toolbar or block actions).
|
|
120
|
+
|
|
121
|
+
| Hook | Description |
|
|
122
|
+
|------|-------------|
|
|
123
|
+
| `useYooptaEditor()` | Returns the editor instance. |
|
|
124
|
+
| `useYooptaReadOnly()` | Returns whether the editor is read-only. |
|
|
125
|
+
| `useYooptaFocused()` | Returns whether the editor is focused. |
|
|
126
|
+
| `useBlockData(blockId)` | Returns block data for the given `blockId`. |
|
|
127
|
+
| `useYooptaPluginOptions(blockType)` | Returns options for the plugin of the given block type. |
|
|
128
|
+
|
|
129
|
+
## Related packages
|
|
130
|
+
|
|
131
|
+
- **@yoopta/ui** — FloatingToolbar, SlashCommandMenu, FloatingBlockActions, BlockOptions, SelectionBox, BlockDndContext, SortableBlock
|
|
132
|
+
- **@yoopta/themes-shadcn** — Styled block UI; use `applyTheme(plugins)` or extend a single plugin with theme elements
|
|
133
|
+
- **@yoopta/marks** — Bold, Italic, Underline, Strike, CodeMark, Highlight, etc.
|
|
134
|
+
- **@yoopta/paragraph**, **@yoopta/headings**, **@yoopta/code**, etc. — Block plugins
|
|
135
|
+
|
|
136
|
+
See the [main README](https://github.com/Darginec05/Yoopta-Editor) and [Quickstart](https://docs.yoopta.dev/quickstart) for full setup with themes and UI.
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import type { YooEditor } from '../../editor/types';
|
|
3
3
|
import type { YooptaMark } from '../../marks';
|
|
4
|
+
import type { RenderBlockProps } from '../../yoopta-editor';
|
|
4
5
|
type Props = {
|
|
5
6
|
editor: YooEditor;
|
|
6
7
|
marks?: YooptaMark<any>[];
|
|
7
8
|
placeholder?: string;
|
|
9
|
+
renderBlock?: (props: RenderBlockProps) => ReactNode;
|
|
8
10
|
};
|
|
9
|
-
declare const RenderBlocks: ({ editor, marks, placeholder }: Props) =>
|
|
11
|
+
declare const RenderBlocks: ({ editor, marks, placeholder, renderBlock }: Props) => ReactElement<any, any>;
|
|
10
12
|
export { RenderBlocks };
|
|
11
13
|
//# sourceMappingURL=render-blocks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-blocks.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/render-blocks.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"render-blocks.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/render-blocks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAK5D,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,SAAS,CAAC;CACtD,CAAC;AAEF,QAAA,MAAM,YAAY,gDAAiD,KAAK,KAAG,aAAa,GAAG,EAAE,GAAG,CA4D/F,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { RenderBlockProps } from '../../yoopta-editor';
|
|
3
3
|
type Props = {
|
|
4
|
-
marks?: YooptaMark<any>[];
|
|
5
|
-
selectionBoxRoot?: HTMLElement | React.MutableRefObject<HTMLElement | null> | false;
|
|
6
4
|
autoFocus?: boolean;
|
|
7
5
|
className?: string;
|
|
8
6
|
placeholder?: string;
|
|
9
|
-
width?: number | string;
|
|
10
7
|
children: ReactNode;
|
|
11
8
|
style?: CSSProperties;
|
|
9
|
+
renderBlock?: (props: RenderBlockProps) => ReactNode;
|
|
12
10
|
};
|
|
13
|
-
declare const Editor: ({ placeholder,
|
|
11
|
+
declare const Editor: ({ placeholder, className, style, children, autoFocus, renderBlock, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
12
|
export { Editor };
|
|
15
13
|
//# sourceMappingURL=render-editor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-editor.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/render-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAkB,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"render-editor.d.ts","sourceRoot":"","sources":["../../../src/components/Editor/render-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAkB,SAAS,EAAE,MAAM,OAAO,CAAC;AActE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,SAAS,CAAC;CACtD,CAAC;AAEF,QAAA,MAAM,MAAM,yEAOT,KAAK,4CAwSP,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleBlock.d.ts","sourceRoot":"","sources":["../../../src/editor/blocks/toggleBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"toggleBlock.d.ts","sourceRoot":"","sources":["../../../src/editor/blocks/toggleBlock.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAEV,YAAY,EACZ,SAAS,EAET,eAAe,EAChB,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,EAAE,CAAC,EAAE,eAAe,CAAC;IAErB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;IAErC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;;OAGG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB,CAAC;AAsOF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,kBAAuB,GAC/B,MAAM,CAkBR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyTransforms.d.ts","sourceRoot":"","sources":["../../../src/editor/core/applyTransforms.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAK9C,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,UAAU,EACX,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;AAEtD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE;QACV,QAAQ,EAAE,SAAS,EAAE,CAAC;QACtB,eAAe,EAAE,KAAK,GAAG,IAAI,CAAC;KAC/B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM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B,mBAAmB,GACnB,oBAAoB,GACpB,kBAAkB,GAClB,iBAAiB,GACjB,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"applyTransforms.d.ts","sourceRoot":"","sources":["../../../src/editor/core/applyTransforms.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAK9C,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,UAAU,EACX,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;AAEtD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,EAAE,WAAW,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE;QACV,QAAQ,EAAE,SAAS,EAAE,CAAC;QACtB,eAAe,EAAE,KAAK,GAAG,IAAI,CAAC;KAC/B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB,cAAc,EAAE;QACd,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,UAAU,EAAE;QACV,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,iBAAiB,CAAC;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MA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UAAU,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,UAAU,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,sBAAsB,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,kBAAkB,CAAC;IACzB,UAAU,EAAE;QACV,KAAK,EAAE,kBAAkB,CAAC;KAC3B,CAAC;IACF,cAAc,EAAE;QACd,KAAK,EAAE,kBAAkB,CAAC;KAC3B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,eAAe,GACvB,oBAAoB,GACpB,oBAAoB,GACpB,4BAA4B,GAC5B,0BAA0B,GAC1B,mBAAmB,GACnB,sBAAsB,GACtB,qBAAqB,GACrB,mBAAmB,GACnB,oBAAoB,GACpB,kBAAkB,GAClB,iBAAiB,GACjB,uBAAuB,CAAC;AAqR5B,MAAM,MAAM,sBAAsB,GAAG;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAgBF,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,EACjB,GAAG,EAAE,eAAe,EAAE,EACtB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,IAAI,CAmEN"}
|
|
@@ -9,8 +9,8 @@ export declare function inverseEditorOperation(editor: YooEditor, op: YooptaOper
|
|
|
9
9
|
export type UndoRedoOptions = {
|
|
10
10
|
scroll?: boolean;
|
|
11
11
|
};
|
|
12
|
-
export declare const SAVING: WeakMap<
|
|
13
|
-
export declare const MERGING: WeakMap<
|
|
12
|
+
export declare const SAVING: WeakMap<YooEditor, boolean | undefined>;
|
|
13
|
+
export declare const MERGING: WeakMap<YooEditor, boolean | undefined>;
|
|
14
14
|
export declare const YooptaHistory: {
|
|
15
15
|
isMergingHistory(editor: YooEditor): boolean | undefined;
|
|
16
16
|
isSavingHistory(editor: YooEditor): boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/editor/core/history.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAgB,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEpE,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,IAAI,EAAE,UAAU,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,EACjB,EAAE,EAAE,eAAe,GAClB,eAAe,GAAG,eAAe,EAAE,CAyGrC;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../../src/editor/core/history.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAgB,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEpE,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,IAAI,EAAE,UAAU,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,EACjB,EAAE,EAAE,eAAe,GAClB,eAAe,GAAG,eAAe,EAAE,CAyGrC;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,MAAM,yCAAgD,CAAC;AACpE,eAAO,MAAM,OAAO,yCAAgD,CAAC;AAErE,eAAO,MAAM,aAAa;6BACC,SAAS,GAAG,OAAO,GAAG,SAAS;4BAIhC,SAAS,GAAG,OAAO,GAAG,SAAS;+BAI5B,SAAS,MAAM,MAAM,IAAI,GAAG,IAAI;8BAOjC,SAAS,MAAM,MAAM,IAAI,GAAG,IAAI;kCAO5B,SAAS,MAAM,MAAM,IAAI,GAAG,IAAI;iCAOjC,SAAS,MAAM,MAAM,IAAI,GAAG,IAAI;mBAO9C,SAAS,YAAY,eAAe;mBA0BpC,SAAS,YAAY,eAAe;CA8BpD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-element-structure.d.ts","sourceRoot":"","sources":["../../../src/editor/elements/create-element-structure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAIxC,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE9E,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE;QACV,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH,CAAC;AA8BF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,eAAoB,GAAG,oBAAoB,CAKrF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,uBAA4B,GACpC,YAAY,
|
|
1
|
+
{"version":3,"file":"create-element-structure.d.ts","sourceRoot":"","sources":["../../../src/editor/elements/create-element-structure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAIxC,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE9E,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE;QACV,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH,CAAC;AA8BF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,GAAE,eAAoB,GAAG,oBAAoB,CAKrF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,uBAA4B,GACpC,YAAY,CA4Cd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,CAAC,CACf,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,uBAA4B,GACpC,YAAY,CAgDd;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,UAExC,MAAM,SACL,OAAO,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,eACxB,OAAO,EAAE,KACrB,YAAY,CAwBhB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { YooEditor } from '../types';
|
|
2
|
+
import type { GetElementRectOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Get the DOMRect of a Slate element
|
|
5
|
+
*
|
|
6
|
+
* @param editor - YooEditor instance
|
|
7
|
+
* @param options - Get options
|
|
8
|
+
* @returns DOMRect of the element or null if not found
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* // Get rect of element for positioning UI
|
|
13
|
+
* const rect = editor.getElementRect({
|
|
14
|
+
* blockId: 'image-1',
|
|
15
|
+
* element: imageElement
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* if (rect) {
|
|
19
|
+
* console.log('Element position:', rect.x, rect.y);
|
|
20
|
+
* console.log('Element size:', rect.width, rect.height);
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function getElementRect(editor: YooEditor, options: GetElementRectOptions): {
|
|
25
|
+
domRect: DOMRect;
|
|
26
|
+
clientRects: DOMRectList;
|
|
27
|
+
} | null;
|
|
28
|
+
//# sourceMappingURL=getElementRect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getElementRect.d.ts","sourceRoot":"","sources":["../../../src/editor/elements/getElementRect.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,qBAAqB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,WAAW,CAAA;CAAE,GAAG,IAAI,CA8BvI"}
|
|
@@ -3,6 +3,7 @@ import { getElement } from './getElement';
|
|
|
3
3
|
import { getElementChildren } from './getElementChildren';
|
|
4
4
|
import { getElementEntry } from './getElementEntry';
|
|
5
5
|
import { getElementPath } from './getElementPath';
|
|
6
|
+
import { getElementRect } from './getElementRect';
|
|
6
7
|
import { getElements } from './getElements';
|
|
7
8
|
import { getParentElementPath } from './getParentElementPath';
|
|
8
9
|
import { insertElement } from './insertElement';
|
|
@@ -16,10 +17,11 @@ export declare const Elements: {
|
|
|
16
17
|
getElements: typeof getElements;
|
|
17
18
|
getElementEntry: typeof getElementEntry;
|
|
18
19
|
getElementPath: typeof getElementPath;
|
|
20
|
+
getElementRect: typeof getElementRect;
|
|
19
21
|
getParentElementPath: typeof getParentElementPath;
|
|
20
22
|
getElementChildren: typeof getElementChildren;
|
|
21
23
|
isElementEmpty: typeof isElementEmpty;
|
|
22
24
|
};
|
|
23
|
-
export { deleteElement, getElement, getElementChildren, getElementEntry, getElementPath, getElements, getParentElementPath, insertElement, isElementEmpty, updateElement, };
|
|
24
|
-
export type { DeleteElementOptions, ElementMatcher, ElementPath, GetElementChildrenOptions, GetElementEntryOptions, GetElementOptions, GetElementPathOptions, GetElementsOptions, InsertElementOptions, IsElementEmptyOptions, UpdateElementOptions, } from './types';
|
|
25
|
+
export { deleteElement, getElement, getElementChildren, getElementEntry, getElementPath, getElementRect, getElements, getParentElementPath, insertElement, isElementEmpty, updateElement, };
|
|
26
|
+
export type { DeleteElementOptions, ElementMatcher, ElementPath, GetElementChildrenOptions, GetElementEntryOptions, GetElementOptions, GetElementPathOptions, GetElementRectOptions, GetElementsOptions, InsertElementOptions, IsElementEmptyOptions, UpdateElementOptions, } from './types';
|
|
25
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/elements/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/elements/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,eAAO,MAAM,QAAQ;;;;;;;;;;;;CAapB,CAAC;AAGF,OAAO,EACL,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,cAAc,EACd,WAAW,EACX,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,aAAa,GACd,CAAC;AAGF,YAAY,EACV,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,yBAAyB,EACzB,sBAAsB,EACtB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
|
package/dist/editor/index.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { YooptaMark } from '../marks';
|
|
2
|
+
import type { YooptaPlugin } from '../plugins';
|
|
3
|
+
import type { SlateElement, YooEditor, YooptaContentValue } from './types';
|
|
4
|
+
export type CreateYooptaEditorOptions = {
|
|
5
|
+
id?: string;
|
|
6
|
+
plugins: readonly YooptaPlugin<Record<string, SlateElement>>[];
|
|
7
|
+
marks?: YooptaMark<any>[];
|
|
8
|
+
value?: YooptaContentValue;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function createYooptaEditor(opts: CreateYooptaEditorOptions): YooEditor;
|
|
3
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/editor/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/editor/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAuB/C,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AA8B3E,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,SAAS,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC;IAC/D,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,kBAAkB,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,yBAAyB,GAAG,SAAS,CAuH7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isBlockSelected.d.ts","sourceRoot":"","sources":["../../../src/editor/paths/isBlockSelected.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"isBlockSelected.d.ts","sourceRoot":"","sources":["../../../src/editor/paths/isBlockSelected.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3D,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAQlF"}
|
|
@@ -17,6 +17,7 @@ import { isExpanded } from './isExpanded';
|
|
|
17
17
|
import { setCurrent } from './setCurrent';
|
|
18
18
|
import { setSelected } from './setSelected';
|
|
19
19
|
import { setSlateSelection } from './setSlateSelection';
|
|
20
|
+
import { toDOMRange } from './toDOMRange';
|
|
20
21
|
export declare const Selection: {
|
|
21
22
|
getCurrent: typeof getCurrent;
|
|
22
23
|
setCurrent: typeof setCurrent;
|
|
@@ -37,7 +38,9 @@ export declare const Selection: {
|
|
|
37
38
|
getEnd: typeof getEnd;
|
|
38
39
|
getFirstPoint: typeof getFirstPoint;
|
|
39
40
|
getLastPoint: typeof getLastPoint;
|
|
41
|
+
toDOMRange: typeof toDOMRange;
|
|
40
42
|
};
|
|
41
|
-
export { getAnchor, getCurrent, getEnd, getFirstPoint, getFocus, getLastPoint, getNext, getPrevious, getRange, getSelected, getSlateSelection, isBlockSelected, isCollapsed, isEmpty, isExpanded, setCurrent, setSelected, setSlateSelection, };
|
|
43
|
+
export { getAnchor, getCurrent, getEnd, getFirstPoint, getFocus, getLastPoint, getNext, getPrevious, getRange, getSelected, getSlateSelection, isBlockSelected, isCollapsed, isEmpty, isExpanded, setCurrent, setSelected, setSlateSelection, toDOMRange, };
|
|
42
44
|
export type { GetCurrentOptions, GetNextBlockOptions, GetPointOptions, GetRangeOptions, GetSelectedOptions, GetSlateSelectionOptions, IsBlockSelectedOptions, SetCurrentOptions, SetSelectedOptions, SetSlateSelectionOptions, } from './types';
|
|
45
|
+
export type { ToDOMRangeOptions } from './toDOMRange';
|
|
43
46
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/editor/selection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,C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'slate';
|
|
2
|
+
import type { YooEditor } from '../types';
|
|
3
|
+
export type ToDOMRangeOptions = {
|
|
4
|
+
/** Block ID containing the Slate selection */
|
|
5
|
+
blockId: string;
|
|
6
|
+
/** Slate Range to convert to a DOM Range */
|
|
7
|
+
slateRange: SlateRange;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Convert a Slate Range within a specific block to a native DOM Range.
|
|
11
|
+
*
|
|
12
|
+
* This method uses Slate's internal WeakMaps (via ReactEditor.toDOMRange)
|
|
13
|
+
* which are only available inside @yoopta/editor where the Slate editors
|
|
14
|
+
* are rendered.
|
|
15
|
+
*
|
|
16
|
+
* @param editor - YooEditor instance
|
|
17
|
+
* @param options - Block ID and Slate range
|
|
18
|
+
* @returns Native DOM Range or null if the range can't be resolved
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const domRange = Selection.toDOMRange(editor, {
|
|
23
|
+
* blockId: 'block-1',
|
|
24
|
+
* slateRange: { anchor: { path: [0, 0], offset: 0 }, focus: { path: [0, 0], offset: 5 } },
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* if (domRange) {
|
|
28
|
+
* const rect = domRange.getBoundingClientRect();
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function toDOMRange(editor: YooEditor, options: ToDOMRangeOptions): Range | null;
|
|
33
|
+
//# sourceMappingURL=toDOMRange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toDOMRange.d.ts","sourceRoot":"","sources":["../../../src/editor/selection/toDOMRange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,OAAO,CAAC;AAIjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,GAAG,KAAK,GAAG,IAAI,CAWtF"}
|