tiptop-editor 1.6.5 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -0
- package/dist/components/editor/TiptopDragHandle.d.ts +2 -1
- package/dist/components/editor/TiptopEditor.stories.d.ts +2 -0
- package/dist/components/ui/EditorButton.d.ts +1 -1
- package/dist/helpers.d.ts +1 -1
- package/dist/tiptop-editor.css +1 -1
- package/dist/tiptop-editor.es.js +15281 -25539
- package/dist/tiptop-editor.umd.js +26 -29
- package/dist/types.d.ts +12 -2
- package/package.json +3 -3
- package/dist/hero.d.ts +0 -2
- package/dist/index-SfZMAM5z.js +0 -5
package/README.md
CHANGED
|
@@ -25,6 +25,32 @@ https://tiptap.dev/docs/ui-components/templates/notion-like-editor
|
|
|
25
25
|
npm install tiptop-editor
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
## Setup
|
|
29
|
+
|
|
30
|
+
This package requires HeroUI v3. Add its styles import to your CSS entry file:
|
|
31
|
+
|
|
32
|
+
```css
|
|
33
|
+
@import "tailwindcss";
|
|
34
|
+
@import "@heroui/styles";
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
No `HeroUIProvider` wrapper is needed in your app — HeroUI v3 works without a root provider.
|
|
38
|
+
|
|
39
|
+
If you use the toast notifications, render `Toast.Provider` once near the root of your app:
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { Toast } from '@heroui/react'
|
|
43
|
+
|
|
44
|
+
export function App() {
|
|
45
|
+
return (
|
|
46
|
+
<>
|
|
47
|
+
<YourApp />
|
|
48
|
+
<Toast.Provider placement="top end" />
|
|
49
|
+
</>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
28
54
|
## Basic Usage
|
|
29
55
|
|
|
30
56
|
```tsx
|
|
@@ -122,6 +148,7 @@ Supported slots:
|
|
|
122
148
|
- `selectionMenuAppend`
|
|
123
149
|
- `tableMenuPrepend`
|
|
124
150
|
- `tableMenuAppend`
|
|
151
|
+
- `dragHandleDropdown`
|
|
125
152
|
|
|
126
153
|
Each slot accepts either:
|
|
127
154
|
|
|
@@ -140,6 +167,24 @@ Each slot accepts either:
|
|
|
140
167
|
/>
|
|
141
168
|
```
|
|
142
169
|
|
|
170
|
+
The `dragHandleDropdown` slot injects additional items into the block drag-handle dropdown. The slot content must be wrapped in a `<Dropdown.Section>`:
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
import { Dropdown, Label } from '@heroui/react'
|
|
174
|
+
|
|
175
|
+
<TiptopEditor
|
|
176
|
+
slots={{
|
|
177
|
+
dragHandleDropdown: ({ editor }) => (
|
|
178
|
+
<Dropdown.Section>
|
|
179
|
+
<Dropdown.Item id="ai_rewrite" textValue="AI Rewrite" onPress={() => console.log('AI rewrite', editor)}>
|
|
180
|
+
<Label>AI Rewrite</Label>
|
|
181
|
+
</Dropdown.Item>
|
|
182
|
+
</Dropdown.Section>
|
|
183
|
+
),
|
|
184
|
+
}}
|
|
185
|
+
/>
|
|
186
|
+
```
|
|
187
|
+
|
|
143
188
|
### Use the editor context hook
|
|
144
189
|
|
|
145
190
|
For slotted components, you can consume the current editor instance through `useTiptopEditor()` instead of passing `editor` down manually.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/react';
|
|
2
|
-
declare const TiptopDragHandle: ({ editor }: {
|
|
2
|
+
declare const TiptopDragHandle: ({ editor, dragHandleSlot }: {
|
|
3
3
|
editor: Editor;
|
|
4
|
+
dragHandleSlot?: React.ReactNode;
|
|
4
5
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
5
6
|
export default TiptopDragHandle;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { EditorButtonProps } from '../../types';
|
|
2
2
|
import { default as React } from 'react';
|
|
3
|
-
declare const _default: React.MemoExoticComponent<({ editor, buttonKey, tooltipText, isIconOnly,
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ editor, buttonKey, tooltipText, isIconOnly, variant, isDisabled, icon, iconClass, text, withActive, onPressed, }: EditorButtonProps) => import("react/jsx-runtime").JSX.Element>;
|
|
4
4
|
export default _default;
|
package/dist/helpers.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare const updateNodeByPos: (editor: Editor, find: {
|
|
|
31
31
|
id?: string;
|
|
32
32
|
pos?: number;
|
|
33
33
|
}, attrs: Record<string, string | boolean | number | File | null>) => void;
|
|
34
|
-
export declare const showToast: (title?: string, color?: "
|
|
34
|
+
export declare const showToast: (title?: string, color?: "accent" | "default" | "success" | "warning" | "danger" | undefined, description?: string) => void;
|
|
35
35
|
export declare const getUploaderAtPos: (state: Editor["state"], pos: number) => {
|
|
36
36
|
pos: number;
|
|
37
37
|
start: number;
|