@turnix-co/konva-editor 2.0.44 → 2.0.46
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/dist/index.d.ts +70 -27
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -846,12 +846,10 @@ type PreparedPhotoFrameElement = Omit<PhotoFrameElement, 'capturedImageUrl' | 'a
|
|
|
846
846
|
/**
|
|
847
847
|
* Prepared slide data ready for publishing with buffers
|
|
848
848
|
*/
|
|
849
|
-
type PreparedSlide = Omit<Slide, 'images' | 'videos' | 'photoFrames'
|
|
849
|
+
type PreparedSlide = Omit<Slide, 'images' | 'videos' | 'photoFrames'> & {
|
|
850
850
|
images: PreparedImageElement[];
|
|
851
851
|
videos: PreparedVideoElement[];
|
|
852
852
|
photoFrames: PreparedPhotoFrameElement[];
|
|
853
|
-
thumbnailBuffer?: ArrayBuffer;
|
|
854
|
-
thumbnailMimeType?: string;
|
|
855
853
|
};
|
|
856
854
|
/**
|
|
857
855
|
* Result of preparing slides for publishing
|
|
@@ -868,8 +866,6 @@ declare const prepareSlidesForPublishing: (slides: Slide[], options?: {
|
|
|
868
866
|
maxImageWidth?: number;
|
|
869
867
|
maxImageHeight?: number;
|
|
870
868
|
imageQuality?: number;
|
|
871
|
-
/** Map of slideId to full-size thumbnail data URL for publishing */
|
|
872
|
-
fullSizeThumbnails?: Map<string, string>;
|
|
873
869
|
}) => Promise<PublishPayload>;
|
|
874
870
|
/**
|
|
875
871
|
* Convert ArrayBuffer to Base64 string (for JSON transmission)
|
|
@@ -880,27 +876,6 @@ declare const arrayBufferToBase64: (buffer: ArrayBuffer) => string;
|
|
|
880
876
|
* This is more efficient than base64 encoding
|
|
881
877
|
*/
|
|
882
878
|
declare const prepareFormData: (payload: PublishPayload) => FormData;
|
|
883
|
-
/**
|
|
884
|
-
* Generate a full-size thumbnail from a Konva stage
|
|
885
|
-
* Use this to create thumbnails at full resolution for publishing
|
|
886
|
-
* @param stageRef Reference to the Konva stage
|
|
887
|
-
* @param options Options for thumbnail generation
|
|
888
|
-
* @returns Data URL of the full-size thumbnail
|
|
889
|
-
*/
|
|
890
|
-
declare const generateFullSizeThumbnail: (stageRef: React$1.RefObject<Konva.Stage | null>, options?: {
|
|
891
|
-
pixelRatio?: number;
|
|
892
|
-
mimeType?: "image/jpeg" | "image/png";
|
|
893
|
-
quality?: number;
|
|
894
|
-
}) => string | null;
|
|
895
|
-
/**
|
|
896
|
-
* Generate full-size thumbnails for all slides
|
|
897
|
-
* This should be called before publishing to create high-resolution thumbnails
|
|
898
|
-
* @param slides Array of slides
|
|
899
|
-
* @param stageRef Reference to the Konva stage
|
|
900
|
-
* @param switchToSlide Function to switch to a specific slide and wait for render
|
|
901
|
-
* @returns Map of slideId to full-size thumbnail data URL
|
|
902
|
-
*/
|
|
903
|
-
declare const generateAllFullSizeThumbnails: (slides: Slide[], stageRef: React$1.RefObject<Konva.Stage | null>, switchToSlide: (slideId: string) => Promise<void>) => Promise<Map<string, string>>;
|
|
904
879
|
|
|
905
880
|
declare const useDispatch: () => redux_thunk.ThunkDispatch<{
|
|
906
881
|
toolbar: ToolbarState;
|
|
@@ -919,4 +894,72 @@ declare const useSelector: <T>(selector: (state: RootState) => T) => T;
|
|
|
919
894
|
|
|
920
895
|
declare const useSlidesPersistence: () => void;
|
|
921
896
|
|
|
922
|
-
|
|
897
|
+
/**
|
|
898
|
+
* Configuration options for loading initial slides
|
|
899
|
+
*/
|
|
900
|
+
type InitialSlidesConfig = {
|
|
901
|
+
/**
|
|
902
|
+
* Array of slides to load into the editor.
|
|
903
|
+
* These are typically slides previously published/saved and retrieved from your backend.
|
|
904
|
+
*/
|
|
905
|
+
slides: Slide[];
|
|
906
|
+
/**
|
|
907
|
+
* Optional: ID of the slide to set as current/active.
|
|
908
|
+
* If not provided or invalid, defaults to the first slide.
|
|
909
|
+
*/
|
|
910
|
+
currentSlideId?: string;
|
|
911
|
+
/**
|
|
912
|
+
* Optional: Skip loading from IndexedDB persistence.
|
|
913
|
+
* Set to true when you want to override any locally cached slides.
|
|
914
|
+
* Default: true (will skip local persistence when initial slides are provided)
|
|
915
|
+
*/
|
|
916
|
+
skipLocalPersistence?: boolean;
|
|
917
|
+
};
|
|
918
|
+
/**
|
|
919
|
+
* Loads slides into the editor.
|
|
920
|
+
* Use this when you want users to edit previously published/uploaded slides.
|
|
921
|
+
*
|
|
922
|
+
* @example
|
|
923
|
+
* ```tsx
|
|
924
|
+
* // In your component that wraps the editor
|
|
925
|
+
* const MyEditor = ({ savedSlides }) => {
|
|
926
|
+
* const { loadSlides } = useInitialSlides();
|
|
927
|
+
*
|
|
928
|
+
* useEffect(() => {
|
|
929
|
+
* if (savedSlides) {
|
|
930
|
+
* loadSlides({ slides: savedSlides, currentSlideId: savedSlides[0]?.id });
|
|
931
|
+
* }
|
|
932
|
+
* }, [savedSlides, loadSlides]);
|
|
933
|
+
*
|
|
934
|
+
* return (
|
|
935
|
+
* <div>
|
|
936
|
+
* <Canvas />
|
|
937
|
+
* <Toolbar />
|
|
938
|
+
* <SlideNavigation />
|
|
939
|
+
* </div>
|
|
940
|
+
* );
|
|
941
|
+
* };
|
|
942
|
+
* ```
|
|
943
|
+
*
|
|
944
|
+
* @returns Object with methods to load/reload slides
|
|
945
|
+
*/
|
|
946
|
+
declare const useInitialSlides: () => {
|
|
947
|
+
/**
|
|
948
|
+
* Load slides from config (only loads once per config object)
|
|
949
|
+
*/
|
|
950
|
+
loadSlides: (config: InitialSlidesConfig) => void;
|
|
951
|
+
/**
|
|
952
|
+
* Force reload slides (bypasses the duplicate load check)
|
|
953
|
+
*/
|
|
954
|
+
reloadSlides: (config: InitialSlidesConfig) => void;
|
|
955
|
+
};
|
|
956
|
+
/**
|
|
957
|
+
* Type for slides payload that can be sent from user's backend.
|
|
958
|
+
* This is the minimal structure needed to load slides.
|
|
959
|
+
*/
|
|
960
|
+
type SlidesPayload = {
|
|
961
|
+
slides: Slide[];
|
|
962
|
+
currentSlideId?: string;
|
|
963
|
+
};
|
|
964
|
+
|
|
965
|
+
export { type ActionType, type ActivityType, type AppDispatch, BASIC_EDITOR_TOOLBAR_CONFIG, BottomToolbar, type BottomToolbarProps, Canvas, type CanvasProps, type ContextMenuConfig, DEFAULT_CONTEXT_MENU_CONFIG, DEFAULT_TOOLBAR_CONFIG, EditorRoot, type EditorRootProps, type ExportOptions, type FillInTheBlanks, type FlashcardElement, type ImageElement, type InitialSlidesConfig, type Line$1 as Line, type LongAnswer, type MediaType, type MultipleChoice, type PhotoFrameElement, type PreparedImageElement, type PreparedPhotoFrameElement, type PreparedSlide, type PreparedVideoElement, PublishButton, type PublishButtonProps, type PublishPayload, type PublishProgress, type PublishResponse, type RootState, ScreenRecorder, type Shape, type ShapeType, type ShortAnswer, type Slide, SlideNavigation, type SlidesPayload, type TextElement, type ToolType, Toolbar, type ToolbarActionsConfig, type ToolbarConfig, type ToolbarProps, type ToolbarToolsConfig, TopNavBar, type TopNavBarProps, type TrueFalse, VIEWER_TOOLBAR_CONFIG, type VideoElement, addFillInTheBlanks, addFlashcard, addImage, addImageAnnotation, addLine, addLongAnswer, addMultipleChoice, addPhotoFrame, addPhotoFrameAnnotation, addShape, addShortAnswer, addSlide, addText, addTrueFalse, addVideo, arrayBufferToBase64, bringToFront, clearCanvas, clearImageAnnotations, clearPhotoFrameAnnotations, deleteFillInTheBlanks, deleteFlashcard, deleteImage, deleteLineById, deleteLongAnswer, deleteMultipleChoice, deletePhotoFrame, deleteShape, deleteShortAnswer, deleteSlide, deleteText, deleteTrueFalse, deleteVideo, duplicateFillInTheBlanks, duplicateFlashcard, duplicateImage, duplicateLine, duplicateLongAnswer, duplicateMultipleChoice, duplicatePhotoFrame, duplicateShape, duplicateShortAnswer, duplicateSlide, duplicateText, duplicateTrueFalse, duplicateVideo, editFlashcard, editMultipleChoice, exportSlideAsBlob, exportSlideAsImage, finalizeDrawing, getCompressionStats, getSlideDataURL, loadSlides, mergeToolbarConfig, nextFlashcard, prepareFormData, prepareSlidesForPublishing, previousFlashcard, redo, removeLine, reorderSlides, saveToHistory, selectAllSlides, selectCanAddSlide, selectCurrentSlide, selectCurrentSlideId, selectSlideById, sendToBack, setActivityType, setAltText, setAudioData, setBackgroundColor, setCurrentSlide, setEditingActivity, setEditingTextId, setLines, setLink, setPenColor, setShowFlashcardForm, setShowMcqForm, setSketchMode, setStrokeWidth, setTool, simplifyFlatPoints, simplifyLine, simplifyLines, store, toggleImageDrawingMode, toggleLock, togglePhotoFrameDrawingMode, toggleSketchMode, toggleVideoPlaying, undo, updateElementOrder, updateFillInTheBlanks, updateFlashcard, updateImage, updateImageAnnotation, updateLastLine, updateLinePosition, updateLineTransform, updateLongAnswer, updateMultipleChoice, updatePhotoFrame, updatePhotoFrameAnnotation, updateShape, updateShortAnswer, updateSlideThumbnail, updateText, updateTrueFalse, updateVideo, useDispatch, useInitialSlides, useSelector, useSlidesPersistence };
|