@turnix-co/konva-editor 2.0.9 → 2.0.11
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 +76 -10
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,9 +46,16 @@ import {
|
|
|
46
46
|
Canvas,
|
|
47
47
|
Toolbar,
|
|
48
48
|
SlideNavigation,
|
|
49
|
+
TopNavBar,
|
|
50
|
+
BottomToolbar,
|
|
51
|
+
PublishButton,
|
|
52
|
+
EditorRoot,
|
|
49
53
|
ReduxProvider,
|
|
50
54
|
store,
|
|
51
|
-
useSlidesPersistence
|
|
55
|
+
useSlidesPersistence,
|
|
56
|
+
type Slide,
|
|
57
|
+
type PublishProgress,
|
|
58
|
+
type PublishResponse,
|
|
52
59
|
} from '@turnix-co/konva-editor';
|
|
53
60
|
import '@turnix-co/konva-editor/styles.css';
|
|
54
61
|
import type Konva from 'konva';
|
|
@@ -62,24 +69,48 @@ function PersistenceLoader({ children }: { children: React.ReactNode }) {
|
|
|
62
69
|
export default function EditorPage() {
|
|
63
70
|
const stageRef = useRef<Konva.Stage | null>(null);
|
|
64
71
|
|
|
72
|
+
const handlePublish = async (
|
|
73
|
+
slides: Slide[],
|
|
74
|
+
onProgress?: (progress: PublishProgress) => void
|
|
75
|
+
): Promise<PublishResponse> => {
|
|
76
|
+
// Your publish logic here
|
|
77
|
+
return { success: true, message: 'Published!' };
|
|
78
|
+
};
|
|
79
|
+
|
|
65
80
|
return (
|
|
66
81
|
<ReduxProvider store={store}>
|
|
67
82
|
<PersistenceLoader>
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
<EditorRoot
|
|
84
|
+
style={{
|
|
85
|
+
width: '100vw',
|
|
86
|
+
height: '100vh',
|
|
87
|
+
display: 'flex',
|
|
88
|
+
flexDirection: 'column',
|
|
89
|
+
overflow: 'hidden',
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
{/* Header with title and publish button */}
|
|
93
|
+
<TopNavBar
|
|
94
|
+
title="My Lesson"
|
|
95
|
+
autoSaveMessage="Auto-saved just now"
|
|
96
|
+
onBack={() => window.history.back()}
|
|
97
|
+
onPublish={handlePublish}
|
|
98
|
+
/>
|
|
99
|
+
|
|
100
|
+
{/* Main toolbar */}
|
|
75
101
|
<Toolbar stageRef={stageRef} />
|
|
76
102
|
|
|
103
|
+
{/* Canvas area */}
|
|
77
104
|
<div style={{ flex: 1, position: 'relative' }}>
|
|
78
105
|
<Canvas onStageReady={(ref) => { stageRef.current = ref.current; }} />
|
|
106
|
+
|
|
107
|
+
{/* Bottom toolbar for pen size and colors (shows when drawing) */}
|
|
108
|
+
<BottomToolbar />
|
|
79
109
|
</div>
|
|
80
110
|
|
|
111
|
+
{/* Slide navigation */}
|
|
81
112
|
<SlideNavigation />
|
|
82
|
-
</
|
|
113
|
+
</EditorRoot>
|
|
83
114
|
</PersistenceLoader>
|
|
84
115
|
</ReduxProvider>
|
|
85
116
|
);
|
|
@@ -112,9 +143,12 @@ export default function EditorPage() {
|
|
|
112
143
|
| `Canvas` | Main canvas component with drawing, images, videos, and text |
|
|
113
144
|
| `Toolbar` | Toolbar with drawing tools, colors, and actions |
|
|
114
145
|
| `SlideNavigation` | Multi-slide navigation and management |
|
|
146
|
+
| `TopNavBar` | Header with title, auto-save status, and action buttons |
|
|
147
|
+
| `BottomToolbar` | Pen size and color picker toolbar |
|
|
148
|
+
| `LayersPanel` | Layer management panel for reordering elements |
|
|
115
149
|
| `ScreenRecorder` | Screen recording functionality |
|
|
116
150
|
| `PublishButton` | Customizable publish button with progress tracking |
|
|
117
|
-
| `EditorRoot` | Root wrapper that scopes styles (
|
|
151
|
+
| `EditorRoot` | Root wrapper that scopes styles (required for styling) |
|
|
118
152
|
|
|
119
153
|
### Redux Setup
|
|
120
154
|
|
|
@@ -311,6 +345,8 @@ import type {
|
|
|
311
345
|
CanvasProps,
|
|
312
346
|
ToolbarProps,
|
|
313
347
|
EditorRootProps,
|
|
348
|
+
TopNavBarProps,
|
|
349
|
+
BottomToolbarProps,
|
|
314
350
|
ExportOptions,
|
|
315
351
|
PublishProgress,
|
|
316
352
|
PublishResponse,
|
|
@@ -319,6 +355,36 @@ import type {
|
|
|
319
355
|
} from '@turnix-co/konva-editor';
|
|
320
356
|
```
|
|
321
357
|
|
|
358
|
+
## Component Props
|
|
359
|
+
|
|
360
|
+
### TopNavBar
|
|
361
|
+
|
|
362
|
+
| Prop | Type | Default | Description |
|
|
363
|
+
|------|------|---------|-------------|
|
|
364
|
+
| `title` | `string` | `'Untitled'` | Title displayed in the header |
|
|
365
|
+
| `autoSaveMessage` | `string` | `'Auto-saved just now'` | Auto-save status text |
|
|
366
|
+
| `onBack` | `() => void` | - | Callback when back button clicked |
|
|
367
|
+
| `onSettings` | `() => void` | - | Callback when settings button clicked |
|
|
368
|
+
| `onProfile` | `() => void` | - | Callback when profile button clicked |
|
|
369
|
+
| `onPublish` | `PublishButtonProps['onPublish']` | - | Publish function (shows publish button if provided) |
|
|
370
|
+
| `showBackButton` | `boolean` | `true` | Show/hide back button |
|
|
371
|
+
| `showSettingsButton` | `boolean` | `true` | Show/hide settings button |
|
|
372
|
+
| `showProfileButton` | `boolean` | `true` | Show/hide profile button |
|
|
373
|
+
| `showPublishButton` | `boolean` | `true` | Show/hide publish button |
|
|
374
|
+
| `leftContent` | `React.ReactNode` | - | Custom left side content |
|
|
375
|
+
| `rightContent` | `React.ReactNode` | - | Custom right side content |
|
|
376
|
+
| `className` | `string` | - | Additional CSS classes |
|
|
377
|
+
|
|
378
|
+
### BottomToolbar
|
|
379
|
+
|
|
380
|
+
| Prop | Type | Default | Description |
|
|
381
|
+
|------|------|---------|-------------|
|
|
382
|
+
| `colors` | `Array<{name: string, value: string}>` | Default colors | Custom color palette |
|
|
383
|
+
| `showSizeSlider` | `boolean` | `true` | Show/hide pen size slider |
|
|
384
|
+
| `showColorPicker` | `boolean` | `true` | Show/hide color picker |
|
|
385
|
+
| `showBackgroundPicker` | `boolean` | `true` | Show/hide background color picker |
|
|
386
|
+
| `className` | `string` | - | Additional CSS classes |
|
|
387
|
+
|
|
322
388
|
## Troubleshooting
|
|
323
389
|
|
|
324
390
|
### Recorded Video Not Displaying Full Screen
|