@bendyline/squisq-editor-react 1.5.1 → 1.5.3
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 +1991 -90
- package/dist/index.js +17162 -82
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/RawEditor.tsx +49 -18
- package/src/VersionHistoryPanel.tsx +59 -17
- package/src/recorder/hooks/useMediaRecorder.ts +9 -1
- package/src/useMonacoLoader.ts +83 -0
- package/dist/DocumentSettingsDialog.d.ts +0 -26
- package/dist/DocumentSettingsDialog.d.ts.map +0 -1
- package/dist/DocumentSettingsDialog.js +0 -115
- package/dist/DocumentSettingsDialog.js.map +0 -1
- package/dist/DropZoneOverlay.d.ts +0 -24
- package/dist/DropZoneOverlay.d.ts.map +0 -1
- package/dist/DropZoneOverlay.js +0 -53
- package/dist/DropZoneOverlay.js.map +0 -1
- package/dist/EditorContext.d.ts +0 -391
- package/dist/EditorContext.d.ts.map +0 -1
- package/dist/EditorContext.js +0 -471
- package/dist/EditorContext.js.map +0 -1
- package/dist/EditorShell.d.ts +0 -328
- package/dist/EditorShell.d.ts.map +0 -1
- package/dist/EditorShell.js +0 -290
- package/dist/EditorShell.js.map +0 -1
- package/dist/EmojiPicker.d.ts +0 -50
- package/dist/EmojiPicker.d.ts.map +0 -1
- package/dist/EmojiPicker.js +0 -182
- package/dist/EmojiPicker.js.map +0 -1
- package/dist/ImageEditor.d.ts +0 -68
- package/dist/ImageEditor.d.ts.map +0 -1
- package/dist/ImageEditor.js +0 -166
- package/dist/ImageEditor.js.map +0 -1
- package/dist/ImageNodeView.d.ts +0 -27
- package/dist/ImageNodeView.d.ts.map +0 -1
- package/dist/ImageNodeView.js +0 -215
- package/dist/ImageNodeView.js.map +0 -1
- package/dist/ImageViewer.d.ts +0 -26
- package/dist/ImageViewer.d.ts.map +0 -1
- package/dist/ImageViewer.js +0 -119
- package/dist/ImageViewer.js.map +0 -1
- package/dist/InlineIcon.d.ts +0 -17
- package/dist/InlineIcon.d.ts.map +0 -1
- package/dist/InlineIcon.js +0 -72
- package/dist/InlineIcon.js.map +0 -1
- package/dist/InlinePreviewGutter.d.ts +0 -52
- package/dist/InlinePreviewGutter.d.ts.map +0 -1
- package/dist/InlinePreviewGutter.js +0 -397
- package/dist/InlinePreviewGutter.js.map +0 -1
- package/dist/LinkDialog.d.ts +0 -43
- package/dist/LinkDialog.d.ts.map +0 -1
- package/dist/LinkDialog.js +0 -102
- package/dist/LinkDialog.js.map +0 -1
- package/dist/MediaBin.d.ts +0 -29
- package/dist/MediaBin.d.ts.map +0 -1
- package/dist/MediaBin.js +0 -166
- package/dist/MediaBin.js.map +0 -1
- package/dist/MentionExtension.d.ts +0 -22
- package/dist/MentionExtension.d.ts.map +0 -1
- package/dist/MentionExtension.js +0 -245
- package/dist/MentionExtension.js.map +0 -1
- package/dist/OutlinePanel.d.ts +0 -17
- package/dist/OutlinePanel.d.ts.map +0 -1
- package/dist/OutlinePanel.js +0 -167
- package/dist/OutlinePanel.js.map +0 -1
- package/dist/PlainHtmlPreview.d.ts +0 -50
- package/dist/PlainHtmlPreview.d.ts.map +0 -1
- package/dist/PlainHtmlPreview.js +0 -155
- package/dist/PlainHtmlPreview.js.map +0 -1
- package/dist/PreviewControls.d.ts +0 -55
- package/dist/PreviewControls.d.ts.map +0 -1
- package/dist/PreviewControls.js +0 -277
- package/dist/PreviewControls.js.map +0 -1
- package/dist/PreviewPanel.d.ts +0 -29
- package/dist/PreviewPanel.d.ts.map +0 -1
- package/dist/PreviewPanel.js +0 -94
- package/dist/PreviewPanel.js.map +0 -1
- package/dist/RawEditor.d.ts +0 -32
- package/dist/RawEditor.d.ts.map +0 -1
- package/dist/RawEditor.js +0 -440
- package/dist/RawEditor.js.map +0 -1
- package/dist/RecorderEntry.d.ts +0 -24
- package/dist/RecorderEntry.d.ts.map +0 -1
- package/dist/RecorderEntry.js +0 -139
- package/dist/RecorderEntry.js.map +0 -1
- package/dist/StatusBar.d.ts +0 -15
- package/dist/StatusBar.d.ts.map +0 -1
- package/dist/StatusBar.js +0 -24
- package/dist/StatusBar.js.map +0 -1
- package/dist/TemplateAnnotation.d.ts +0 -20
- package/dist/TemplateAnnotation.d.ts.map +0 -1
- package/dist/TemplateAnnotation.js +0 -97
- package/dist/TemplateAnnotation.js.map +0 -1
- package/dist/TemplatePicker.d.ts +0 -53
- package/dist/TemplatePicker.d.ts.map +0 -1
- package/dist/TemplatePicker.js +0 -388
- package/dist/TemplatePicker.js.map +0 -1
- package/dist/ThemeCustomizerPanel.d.ts +0 -32
- package/dist/ThemeCustomizerPanel.d.ts.map +0 -1
- package/dist/ThemeCustomizerPanel.js +0 -256
- package/dist/ThemeCustomizerPanel.js.map +0 -1
- package/dist/ThemePicker.d.ts +0 -33
- package/dist/ThemePicker.d.ts.map +0 -1
- package/dist/ThemePicker.js +0 -148
- package/dist/ThemePicker.js.map +0 -1
- package/dist/Toolbar.d.ts +0 -36
- package/dist/Toolbar.d.ts.map +0 -1
- package/dist/Toolbar.js +0 -1001
- package/dist/Toolbar.js.map +0 -1
- package/dist/Tooltip.d.ts +0 -10
- package/dist/Tooltip.d.ts.map +0 -1
- package/dist/Tooltip.js +0 -104
- package/dist/Tooltip.js.map +0 -1
- package/dist/VersionHistoryPanel.d.ts +0 -14
- package/dist/VersionHistoryPanel.d.ts.map +0 -1
- package/dist/VersionHistoryPanel.js +0 -147
- package/dist/VersionHistoryPanel.js.map +0 -1
- package/dist/ViewMenuPanel.d.ts +0 -13
- package/dist/ViewMenuPanel.d.ts.map +0 -1
- package/dist/ViewMenuPanel.js +0 -58
- package/dist/ViewMenuPanel.js.map +0 -1
- package/dist/ViewSwitcher.d.ts +0 -14
- package/dist/ViewSwitcher.d.ts.map +0 -1
- package/dist/ViewSwitcher.js +0 -26
- package/dist/ViewSwitcher.js.map +0 -1
- package/dist/WysiwygEditor.d.ts +0 -39
- package/dist/WysiwygEditor.d.ts.map +0 -1
- package/dist/WysiwygEditor.js +0 -537
- package/dist/WysiwygEditor.js.map +0 -1
- package/dist/__tests__/detectMarkdown.test.d.ts +0 -2
- package/dist/__tests__/detectMarkdown.test.d.ts.map +0 -1
- package/dist/__tests__/detectMarkdown.test.js +0 -55
- package/dist/__tests__/detectMarkdown.test.js.map +0 -1
- package/dist/__tests__/documentSettingsDialog.test.d.ts +0 -2
- package/dist/__tests__/documentSettingsDialog.test.d.ts.map +0 -1
- package/dist/__tests__/documentSettingsDialog.test.js +0 -132
- package/dist/__tests__/documentSettingsDialog.test.js.map +0 -1
- package/dist/__tests__/emojiPicker.test.d.ts +0 -2
- package/dist/__tests__/emojiPicker.test.d.ts.map +0 -1
- package/dist/__tests__/emojiPicker.test.js +0 -111
- package/dist/__tests__/emojiPicker.test.js.map +0 -1
- package/dist/__tests__/fileKind.test.d.ts +0 -2
- package/dist/__tests__/fileKind.test.d.ts.map +0 -1
- package/dist/__tests__/fileKind.test.js +0 -94
- package/dist/__tests__/fileKind.test.js.map +0 -1
- package/dist/__tests__/imageEditAffordance.test.d.ts +0 -2
- package/dist/__tests__/imageEditAffordance.test.d.ts.map +0 -1
- package/dist/__tests__/imageEditAffordance.test.js +0 -188
- package/dist/__tests__/imageEditAffordance.test.js.map +0 -1
- package/dist/__tests__/imageEditorShell.test.d.ts +0 -2
- package/dist/__tests__/imageEditorShell.test.d.ts.map +0 -1
- package/dist/__tests__/imageEditorShell.test.js +0 -52
- package/dist/__tests__/imageEditorShell.test.js.map +0 -1
- package/dist/__tests__/imageEditorState.test.d.ts +0 -3
- package/dist/__tests__/imageEditorState.test.d.ts.map +0 -1
- package/dist/__tests__/imageEditorState.test.js +0 -148
- package/dist/__tests__/imageEditorState.test.js.map +0 -1
- package/dist/__tests__/inlinePreviewGutter.test.d.ts +0 -2
- package/dist/__tests__/inlinePreviewGutter.test.d.ts.map +0 -1
- package/dist/__tests__/inlinePreviewGutter.test.js +0 -51
- package/dist/__tests__/inlinePreviewGutter.test.js.map +0 -1
- package/dist/__tests__/inlinePreviewGutterAllBlocks.test.d.ts +0 -2
- package/dist/__tests__/inlinePreviewGutterAllBlocks.test.d.ts.map +0 -1
- package/dist/__tests__/inlinePreviewGutterAllBlocks.test.js +0 -63
- package/dist/__tests__/inlinePreviewGutterAllBlocks.test.js.map +0 -1
- package/dist/__tests__/jsonEditor.test.d.ts +0 -2
- package/dist/__tests__/jsonEditor.test.d.ts.map +0 -1
- package/dist/__tests__/jsonEditor.test.js +0 -134
- package/dist/__tests__/jsonEditor.test.js.map +0 -1
- package/dist/__tests__/layersPanel.test.d.ts +0 -2
- package/dist/__tests__/layersPanel.test.d.ts.map +0 -1
- package/dist/__tests__/layersPanel.test.js +0 -84
- package/dist/__tests__/layersPanel.test.js.map +0 -1
- package/dist/__tests__/linkDialogDocPicker.test.d.ts +0 -7
- package/dist/__tests__/linkDialogDocPicker.test.d.ts.map +0 -1
- package/dist/__tests__/linkDialogDocPicker.test.js +0 -75
- package/dist/__tests__/linkDialogDocPicker.test.js.map +0 -1
- package/dist/__tests__/mediaAttachmentFlow.test.d.ts +0 -2
- package/dist/__tests__/mediaAttachmentFlow.test.d.ts.map +0 -1
- package/dist/__tests__/mediaAttachmentFlow.test.js +0 -99
- package/dist/__tests__/mediaAttachmentFlow.test.js.map +0 -1
- package/dist/__tests__/outlinePanel.test.d.ts +0 -2
- package/dist/__tests__/outlinePanel.test.d.ts.map +0 -1
- package/dist/__tests__/outlinePanel.test.js +0 -68
- package/dist/__tests__/outlinePanel.test.js.map +0 -1
- package/dist/__tests__/plainHtmlPreview.test.d.ts +0 -2
- package/dist/__tests__/plainHtmlPreview.test.d.ts.map +0 -1
- package/dist/__tests__/plainHtmlPreview.test.js +0 -87
- package/dist/__tests__/plainHtmlPreview.test.js.map +0 -1
- package/dist/__tests__/propertiesPanel.test.d.ts +0 -2
- package/dist/__tests__/propertiesPanel.test.d.ts.map +0 -1
- package/dist/__tests__/propertiesPanel.test.js +0 -64
- package/dist/__tests__/propertiesPanel.test.js.map +0 -1
- package/dist/__tests__/recorderFormats.test.d.ts +0 -2
- package/dist/__tests__/recorderFormats.test.d.ts.map +0 -1
- package/dist/__tests__/recorderFormats.test.js +0 -121
- package/dist/__tests__/recorderFormats.test.js.map +0 -1
- package/dist/__tests__/recorderTimingJson.test.d.ts +0 -2
- package/dist/__tests__/recorderTimingJson.test.d.ts.map +0 -1
- package/dist/__tests__/recorderTimingJson.test.js +0 -37
- package/dist/__tests__/recorderTimingJson.test.js.map +0 -1
- package/dist/__tests__/templateAnnotationRoundTrip.test.d.ts +0 -2
- package/dist/__tests__/templateAnnotationRoundTrip.test.d.ts.map +0 -1
- package/dist/__tests__/templateAnnotationRoundTrip.test.js +0 -31
- package/dist/__tests__/templateAnnotationRoundTrip.test.js.map +0 -1
- package/dist/__tests__/tiptapBridge.test.d.ts +0 -2
- package/dist/__tests__/tiptapBridge.test.d.ts.map +0 -1
- package/dist/__tests__/tiptapBridge.test.js +0 -303
- package/dist/__tests__/tiptapBridge.test.js.map +0 -1
- package/dist/__tests__/tiptapImageRoundTrip.test.d.ts +0 -2
- package/dist/__tests__/tiptapImageRoundTrip.test.d.ts.map +0 -1
- package/dist/__tests__/tiptapImageRoundTrip.test.js +0 -68
- package/dist/__tests__/tiptapImageRoundTrip.test.js.map +0 -1
- package/dist/__tests__/useImageEditor.test.d.ts +0 -2
- package/dist/__tests__/useImageEditor.test.d.ts.map +0 -1
- package/dist/__tests__/useImageEditor.test.js +0 -131
- package/dist/__tests__/useImageEditor.test.js.map +0 -1
- package/dist/__tests__/useMediaRecorder.test.d.ts +0 -2
- package/dist/__tests__/useMediaRecorder.test.d.ts.map +0 -1
- package/dist/__tests__/useMediaRecorder.test.js +0 -153
- package/dist/__tests__/useMediaRecorder.test.js.map +0 -1
- package/dist/__tests__/versionHistory.test.d.ts +0 -2
- package/dist/__tests__/versionHistory.test.d.ts.map +0 -1
- package/dist/__tests__/versionHistory.test.js +0 -124
- package/dist/__tests__/versionHistory.test.js.map +0 -1
- package/dist/blockSlice.d.ts +0 -24
- package/dist/blockSlice.d.ts.map +0 -1
- package/dist/blockSlice.js +0 -63
- package/dist/blockSlice.js.map +0 -1
- package/dist/buildPreviewDoc.d.ts +0 -22
- package/dist/buildPreviewDoc.d.ts.map +0 -1
- package/dist/buildPreviewDoc.js +0 -262
- package/dist/buildPreviewDoc.js.map +0 -1
- package/dist/detectMarkdown.d.ts +0 -20
- package/dist/detectMarkdown.d.ts.map +0 -1
- package/dist/detectMarkdown.js +0 -61
- package/dist/detectMarkdown.js.map +0 -1
- package/dist/emojiData.d.ts +0 -81
- package/dist/emojiData.d.ts.map +0 -1
- package/dist/emojiData.js +0 -1283
- package/dist/emojiData.js.map +0 -1
- package/dist/fileKind.d.ts +0 -34
- package/dist/fileKind.d.ts.map +0 -1
- package/dist/fileKind.js +0 -144
- package/dist/fileKind.js.map +0 -1
- package/dist/hooks/useFileDrop.d.ts +0 -41
- package/dist/hooks/useFileDrop.d.ts.map +0 -1
- package/dist/hooks/useFileDrop.js +0 -205
- package/dist/hooks/useFileDrop.js.map +0 -1
- package/dist/imageEditor/CanvasSurface.d.ts +0 -31
- package/dist/imageEditor/CanvasSurface.d.ts.map +0 -1
- package/dist/imageEditor/CanvasSurface.js +0 -264
- package/dist/imageEditor/CanvasSurface.js.map +0 -1
- package/dist/imageEditor/ImageVersionHistoryDropdown.d.ts +0 -39
- package/dist/imageEditor/ImageVersionHistoryDropdown.d.ts.map +0 -1
- package/dist/imageEditor/ImageVersionHistoryDropdown.js +0 -283
- package/dist/imageEditor/ImageVersionHistoryDropdown.js.map +0 -1
- package/dist/imageEditor/LayersPanel.d.ts +0 -14
- package/dist/imageEditor/LayersPanel.d.ts.map +0 -1
- package/dist/imageEditor/LayersPanel.js +0 -43
- package/dist/imageEditor/LayersPanel.js.map +0 -1
- package/dist/imageEditor/PropertiesPanel.d.ts +0 -14
- package/dist/imageEditor/PropertiesPanel.d.ts.map +0 -1
- package/dist/imageEditor/PropertiesPanel.js +0 -97
- package/dist/imageEditor/PropertiesPanel.js.map +0 -1
- package/dist/imageEditor/Toolbar.d.ts +0 -30
- package/dist/imageEditor/Toolbar.d.ts.map +0 -1
- package/dist/imageEditor/Toolbar.js +0 -108
- package/dist/imageEditor/Toolbar.js.map +0 -1
- package/dist/imageEditor/icons.d.ts +0 -24
- package/dist/imageEditor/icons.d.ts.map +0 -1
- package/dist/imageEditor/icons.js +0 -45
- package/dist/imageEditor/icons.js.map +0 -1
- package/dist/imageEditor/layers/EditorImageLayer.d.ts +0 -16
- package/dist/imageEditor/layers/EditorImageLayer.d.ts.map +0 -1
- package/dist/imageEditor/layers/EditorImageLayer.js +0 -37
- package/dist/imageEditor/layers/EditorImageLayer.js.map +0 -1
- package/dist/imageEditor/layers/EditorShapeLayer.d.ts +0 -15
- package/dist/imageEditor/layers/EditorShapeLayer.d.ts.map +0 -1
- package/dist/imageEditor/layers/EditorShapeLayer.js +0 -20
- package/dist/imageEditor/layers/EditorShapeLayer.js.map +0 -1
- package/dist/imageEditor/layers/EditorTextLayer.d.ts +0 -18
- package/dist/imageEditor/layers/EditorTextLayer.d.ts.map +0 -1
- package/dist/imageEditor/layers/EditorTextLayer.js +0 -13
- package/dist/imageEditor/layers/EditorTextLayer.js.map +0 -1
- package/dist/imageEditor/layers/SelectionHandles.d.ts +0 -17
- package/dist/imageEditor/layers/SelectionHandles.d.ts.map +0 -1
- package/dist/imageEditor/layers/SelectionHandles.js +0 -19
- package/dist/imageEditor/layers/SelectionHandles.js.map +0 -1
- package/dist/imageEditor/state.d.ts +0 -76
- package/dist/imageEditor/state.d.ts.map +0 -1
- package/dist/imageEditor/state.js +0 -87
- package/dist/imageEditor/state.js.map +0 -1
- package/dist/imageEditor/useImageEditor.d.ts +0 -53
- package/dist/imageEditor/useImageEditor.d.ts.map +0 -1
- package/dist/imageEditor/useImageEditor.js +0 -244
- package/dist/imageEditor/useImageEditor.js.map +0 -1
- package/dist/imageEditor/useImageEditorTokens.d.ts +0 -16
- package/dist/imageEditor/useImageEditorTokens.d.ts.map +0 -1
- package/dist/imageEditor/useImageEditorTokens.js +0 -45
- package/dist/imageEditor/useImageEditorTokens.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/jsonEditor/EmbeddedRichTextField.d.ts +0 -15
- package/dist/jsonEditor/EmbeddedRichTextField.d.ts.map +0 -1
- package/dist/jsonEditor/EmbeddedRichTextField.js +0 -74
- package/dist/jsonEditor/EmbeddedRichTextField.js.map +0 -1
- package/dist/jsonEditor/JsonEditor.d.ts +0 -36
- package/dist/jsonEditor/JsonEditor.d.ts.map +0 -1
- package/dist/jsonEditor/JsonEditor.js +0 -15
- package/dist/jsonEditor/JsonEditor.js.map +0 -1
- package/dist/jsonEditor/JsonEditorContext.d.ts +0 -28
- package/dist/jsonEditor/JsonEditorContext.d.ts.map +0 -1
- package/dist/jsonEditor/JsonEditorContext.js +0 -41
- package/dist/jsonEditor/JsonEditorContext.js.map +0 -1
- package/dist/jsonEditor/RenderNode.d.ts +0 -16
- package/dist/jsonEditor/RenderNode.d.ts.map +0 -1
- package/dist/jsonEditor/RenderNode.js +0 -32
- package/dist/jsonEditor/RenderNode.js.map +0 -1
- package/dist/jsonEditor/editors.d.ts +0 -36
- package/dist/jsonEditor/editors.d.ts.map +0 -1
- package/dist/jsonEditor/editors.js +0 -347
- package/dist/jsonEditor/editors.js.map +0 -1
- package/dist/jsonEditor/index.d.ts +0 -3
- package/dist/jsonEditor/index.d.ts.map +0 -1
- package/dist/jsonEditor/index.js +0 -2
- package/dist/jsonEditor/index.js.map +0 -1
- package/dist/jsonEditor/useJsonEditorTokens.d.ts +0 -13
- package/dist/jsonEditor/useJsonEditorTokens.d.ts.map +0 -1
- package/dist/jsonEditor/useJsonEditorTokens.js +0 -38
- package/dist/jsonEditor/useJsonEditorTokens.js.map +0 -1
- package/dist/mediaDragMime.d.ts +0 -17
- package/dist/mediaDragMime.d.ts.map +0 -1
- package/dist/mediaDragMime.js +0 -22
- package/dist/mediaDragMime.js.map +0 -1
- package/dist/recorder/RecorderButton.d.ts +0 -31
- package/dist/recorder/RecorderButton.d.ts.map +0 -1
- package/dist/recorder/RecorderButton.js +0 -24
- package/dist/recorder/RecorderButton.js.map +0 -1
- package/dist/recorder/RecorderModal.d.ts +0 -59
- package/dist/recorder/RecorderModal.d.ts.map +0 -1
- package/dist/recorder/RecorderModal.js +0 -333
- package/dist/recorder/RecorderModal.js.map +0 -1
- package/dist/recorder/RecorderPanel.d.ts +0 -25
- package/dist/recorder/RecorderPanel.d.ts.map +0 -1
- package/dist/recorder/RecorderPanel.js +0 -30
- package/dist/recorder/RecorderPanel.js.map +0 -1
- package/dist/recorder/formats.d.ts +0 -51
- package/dist/recorder/formats.d.ts.map +0 -1
- package/dist/recorder/formats.js +0 -144
- package/dist/recorder/formats.js.map +0 -1
- package/dist/recorder/hooks/useMediaRecorder.d.ts +0 -90
- package/dist/recorder/hooks/useMediaRecorder.d.ts.map +0 -1
- package/dist/recorder/hooks/useMediaRecorder.js +0 -277
- package/dist/recorder/hooks/useMediaRecorder.js.map +0 -1
- package/dist/recorder/hooks/useStreamPreview.d.ts +0 -22
- package/dist/recorder/hooks/useStreamPreview.d.ts.map +0 -1
- package/dist/recorder/hooks/useStreamPreview.js +0 -44
- package/dist/recorder/hooks/useStreamPreview.js.map +0 -1
- package/dist/recorder/sources/cameraStream.d.ts +0 -22
- package/dist/recorder/sources/cameraStream.d.ts.map +0 -1
- package/dist/recorder/sources/cameraStream.js +0 -24
- package/dist/recorder/sources/cameraStream.js.map +0 -1
- package/dist/recorder/sources/micStream.d.ts +0 -15
- package/dist/recorder/sources/micStream.d.ts.map +0 -1
- package/dist/recorder/sources/micStream.js +0 -24
- package/dist/recorder/sources/micStream.js.map +0 -1
- package/dist/recorder/sources/screenStream.d.ts +0 -53
- package/dist/recorder/sources/screenStream.d.ts.map +0 -1
- package/dist/recorder/sources/screenStream.js +0 -114
- package/dist/recorder/sources/screenStream.js.map +0 -1
- package/dist/recorder/timingJson.d.ts +0 -51
- package/dist/recorder/timingJson.d.ts.map +0 -1
- package/dist/recorder/timingJson.js +0 -42
- package/dist/recorder/timingJson.js.map +0 -1
- package/dist/tiptap/TiptapAudio.d.ts +0 -26
- package/dist/tiptap/TiptapAudio.d.ts.map +0 -1
- package/dist/tiptap/TiptapAudio.js +0 -58
- package/dist/tiptap/TiptapAudio.js.map +0 -1
- package/dist/tiptap/TiptapVideo.d.ts +0 -30
- package/dist/tiptap/TiptapVideo.d.ts.map +0 -1
- package/dist/tiptap/TiptapVideo.js +0 -66
- package/dist/tiptap/TiptapVideo.js.map +0 -1
- package/dist/tiptap/useResolvedMediaSrc.d.ts +0 -2
- package/dist/tiptap/useResolvedMediaSrc.d.ts.map +0 -1
- package/dist/tiptap/useResolvedMediaSrc.js +0 -42
- package/dist/tiptap/useResolvedMediaSrc.js.map +0 -1
- package/dist/tiptapBridge.d.ts +0 -24
- package/dist/tiptapBridge.d.ts.map +0 -1
- package/dist/tiptapBridge.js +0 -749
- package/dist/tiptapBridge.js.map +0 -1
- package/dist/useHeadingLayout.d.ts +0 -54
- package/dist/useHeadingLayout.d.ts.map +0 -1
- package/dist/useHeadingLayout.js +0 -260
- package/dist/useHeadingLayout.js.map +0 -1
- package/dist/utils/collectInlineFontAwesomeCss.d.ts +0 -21
- package/dist/utils/collectInlineFontAwesomeCss.d.ts.map +0 -1
- package/dist/utils/collectInlineFontAwesomeCss.js +0 -68
- package/dist/utils/collectInlineFontAwesomeCss.js.map +0 -1
- package/dist/utils/dropUtils.d.ts +0 -55
- package/dist/utils/dropUtils.d.ts.map +0 -1
- package/dist/utils/dropUtils.js +0 -110
- package/dist/utils/dropUtils.js.map +0 -1
- package/dist/utils/normalizeMalformedAssetUrl.d.ts +0 -15
- package/dist/utils/normalizeMalformedAssetUrl.d.ts.map +0 -1
- package/dist/utils/normalizeMalformedAssetUrl.js +0 -27
- package/dist/utils/normalizeMalformedAssetUrl.js.map +0 -1
package/dist/EditorShell.d.ts
DELETED
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EditorShell
|
|
3
|
-
*
|
|
4
|
-
* Top-level shell component that composes the Toolbar, ViewSwitcher, editor
|
|
5
|
-
* views, and StatusBar into a complete editing experience. Wraps everything
|
|
6
|
-
* in an EditorProvider for shared state.
|
|
7
|
-
*/
|
|
8
|
-
import { type EditorView, type ImageDisplayMode, type MentionProvider, type DocumentLinkProvider, type ViewPreferences, type ThemeInheritance } from './EditorContext';
|
|
9
|
-
import type { MediaProvider, Theme } from '@bendyline/squisq/schemas';
|
|
10
|
-
import type { ContentContainer } from '@bendyline/squisq/storage';
|
|
11
|
-
import type { PrunePolicy, SaveVersionResult } from '@bendyline/squisq/versions';
|
|
12
|
-
import type { ReactNode } from 'react';
|
|
13
|
-
export type { EditorTheme } from './EditorContext';
|
|
14
|
-
export interface EditorShellProps {
|
|
15
|
-
/** Initial markdown content */
|
|
16
|
-
initialMarkdown?: string;
|
|
17
|
-
/** Initial active view */
|
|
18
|
-
/** Initial active view (default: 'wysiwyg') */
|
|
19
|
-
initialView?: EditorView;
|
|
20
|
-
/** Article ID for Doc generation */
|
|
21
|
-
articleId?: string;
|
|
22
|
-
/** Base path for media URLs in preview */
|
|
23
|
-
basePath?: string;
|
|
24
|
-
/** Called when markdown source changes */
|
|
25
|
-
onChange?: (source: string) => void;
|
|
26
|
-
/** Color theme: 'light' or 'dark' (default: 'light') */
|
|
27
|
-
theme?: 'light' | 'dark';
|
|
28
|
-
/** Additional class name */
|
|
29
|
-
className?: string;
|
|
30
|
-
/** CSS height for the shell container (default: '100vh') */
|
|
31
|
-
height?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Minimum CSS height for the shell. When either `minHeight` or
|
|
34
|
-
* `maxHeight` is set, the shell switches to **auto-grow mode**:
|
|
35
|
-
* `height` is ignored, the root becomes `height: auto` between the
|
|
36
|
-
* bounds, and the content area scrolls internally when content
|
|
37
|
-
* exceeds `maxHeight`. Useful for chat composers that should grow
|
|
38
|
-
* with content up to some cap.
|
|
39
|
-
*/
|
|
40
|
-
minHeight?: string;
|
|
41
|
-
/** See `minHeight`. Upper bound of the auto-grow range. */
|
|
42
|
-
maxHeight?: string;
|
|
43
|
-
/** Optional MediaProvider for the Files panel. When set (even to null), a Files toggle appears in the toolbar. */
|
|
44
|
-
mediaProvider?: MediaProvider | null;
|
|
45
|
-
/**
|
|
46
|
-
* The workspace-scoped `ContentContainer` for this document — the
|
|
47
|
-
* folder that contains the doc, its `_files/` sidecar, sibling
|
|
48
|
-
* documents, and any version snapshots. Used for:
|
|
49
|
-
* - audio mapping (MP3 discovery + timing.json reading);
|
|
50
|
-
* - version history snapshots (when `allowVersioning` is true);
|
|
51
|
-
* - reading sibling `.md` files for the recursive HTML export;
|
|
52
|
-
* - resolving per-document scoped views (e.g. the image-edit
|
|
53
|
-
* sidecar derived via `scopeContainer`).
|
|
54
|
-
* Doc-scoped concerns (per-doc media URLs, per-doc asset writes)
|
|
55
|
-
* flow through `mediaProvider` instead — typically derived from
|
|
56
|
-
* this container via `createMediaProviderFromContainer`.
|
|
57
|
-
*/
|
|
58
|
-
workspaceContainer?: ContentContainer | null;
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated Renamed to `workspaceContainer` to make the workspace-
|
|
61
|
-
* vs. doc-scoped distinction explicit. Still accepted as a fallback
|
|
62
|
-
* for now; remove in the next breaking release.
|
|
63
|
-
*/
|
|
64
|
-
container?: ContentContainer | null;
|
|
65
|
-
/**
|
|
66
|
-
* Enable version history. Snapshots are stored at
|
|
67
|
-
* `.versions/<basename>.<timestamp>.md` inside the same
|
|
68
|
-
* `workspaceContainer`, so they ride along with the document when
|
|
69
|
-
* the host serializes.
|
|
70
|
-
*
|
|
71
|
-
* Snapshots fire on idle (controlled by `versioningAutoSaveIdleMs`)
|
|
72
|
-
* and can also be triggered host-side via the manager exposed in the
|
|
73
|
-
* context (`useEditorContext().versioning`). Has no effect without a
|
|
74
|
-
* `workspaceContainer` — a `console.warn` flags the misconfiguration
|
|
75
|
-
* in dev.
|
|
76
|
-
*/
|
|
77
|
-
allowVersioning?: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Override the document basename used in version filenames. Defaults
|
|
80
|
-
* to the basename of the container's primary document path.
|
|
81
|
-
*/
|
|
82
|
-
versionBasename?: string;
|
|
83
|
-
/**
|
|
84
|
-
* Prune policy applied after each successful save. Defaults to
|
|
85
|
-
* `{ type: 'keep-last-n', n: 50 }` so the snapshot count stays bounded.
|
|
86
|
-
*/
|
|
87
|
-
versioningPrunePolicy?: PrunePolicy;
|
|
88
|
-
/**
|
|
89
|
-
* Idle delay (ms) before the editor auto-saves a version. `0` disables
|
|
90
|
-
* auto-save entirely (snapshots are then only saved when the host
|
|
91
|
-
* calls `versioning.saveVersion()` from the context). Default: 5000.
|
|
92
|
-
*/
|
|
93
|
-
versioningAutoSaveIdleMs?: number;
|
|
94
|
-
/**
|
|
95
|
-
* Notified after each `saveVersion` attempt. Fires for both successful
|
|
96
|
-
* saves (`reason: 'saved'`) and skips (`'unchanged'`, `'no-document'`,
|
|
97
|
-
* `'empty'`). Useful for hosts that want a "Last saved" indicator.
|
|
98
|
-
*/
|
|
99
|
-
onSaveVersion?: (result: SaveVersionResult) => void;
|
|
100
|
-
/** Show the Files toggle in the toolbar. Defaults to true when mediaProvider is passed. */
|
|
101
|
-
showFilesToggle?: boolean;
|
|
102
|
-
/** Content rendered at the left edge of the toolbar, before the view tabs. */
|
|
103
|
-
toolbarSlotLeft?: ReactNode;
|
|
104
|
-
/** Content rendered after the formatting controls (in the middle area of the toolbar). */
|
|
105
|
-
toolbarSlotAfterActions?: ReactNode;
|
|
106
|
-
/** Content rendered at the rightmost end of the toolbar, after all other elements. */
|
|
107
|
-
toolbarSlotRight?: ReactNode;
|
|
108
|
-
/**
|
|
109
|
-
* Whether to show the "Play" (preview) tab in the toolbar. When false, the
|
|
110
|
-
* tab and its preview panel are hidden, and ⌘3 becomes a no-op. Use this
|
|
111
|
-
* when embedding the editor somewhere the slideshow preview doesn't make
|
|
112
|
-
* sense (e.g. editing free-form prompt documents). Defaults to true.
|
|
113
|
-
*/
|
|
114
|
-
showPlayTab?: boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Optional "submit on Enter" callback. When provided, a plain Enter
|
|
117
|
-
* keypress fires this callback instead of inserting a newline, and
|
|
118
|
-
* Cmd/Ctrl+Enter inserts a newline instead. Matches chat-composer UX
|
|
119
|
-
* (Slack, Discord). When omitted, the editor behaves normally.
|
|
120
|
-
*/
|
|
121
|
-
submitOnEnter?: () => void;
|
|
122
|
-
/**
|
|
123
|
-
* Let the WYSIWYG editing surface fill its container instead of rendering
|
|
124
|
-
* as a centered 800px "page" column. Useful when embedding in chat
|
|
125
|
-
* composers, side panels, or any layout where the page metaphor doesn't
|
|
126
|
-
* fit. Defaults to false (page mode).
|
|
127
|
-
*/
|
|
128
|
-
fullWidth?: boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Font-family stack applied to the editor **chrome** — toolbar buttons,
|
|
131
|
-
* tabs, status bar, and control surfaces. The actual editing areas
|
|
132
|
-
* (Tiptap / Monaco) keep their own fonts so document editing isn't
|
|
133
|
-
* affected. Use this when the editor is embedded in a larger product
|
|
134
|
-
* that has its own UX type system and you want the controls to blend in.
|
|
135
|
-
*
|
|
136
|
-
* @example
|
|
137
|
-
* ```tsx
|
|
138
|
-
* <EditorShell uxFont="'Hanken Grotesk', system-ui, sans-serif" ... />
|
|
139
|
-
* ```
|
|
140
|
-
*/
|
|
141
|
-
uxFont?: string;
|
|
142
|
-
/**
|
|
143
|
-
* Drop the editor's generous page-style padding in favor of a tight
|
|
144
|
-
* layout that hugs its container. The default WYSIWYG surface uses
|
|
145
|
-
* 16×24px padding suitable for editing long-form documents; chat
|
|
146
|
-
* composers want much less. Applies to the editing area only — the
|
|
147
|
-
* toolbar, tabs, and status bar keep their normal sizing.
|
|
148
|
-
*/
|
|
149
|
-
thinMargins?: boolean;
|
|
150
|
-
/**
|
|
151
|
-
* Render the bottom status bar (word / character / line / block counts
|
|
152
|
-
* and parse-state indicator). Defaults to `true`. Set to `false` in
|
|
153
|
-
* embedded surfaces — chat composers and other short-form inputs —
|
|
154
|
-
* where the stats are noise.
|
|
155
|
-
*/
|
|
156
|
-
showStatusBar?: boolean;
|
|
157
|
-
/**
|
|
158
|
-
* How images should be displayed in the WYSIWYG view. `'inline'`
|
|
159
|
-
* (default) flows them at natural size up to the container width;
|
|
160
|
-
* `'thumbnail'` constrains each image to a 100×100 box with
|
|
161
|
-
* aspect-preserving containment — useful for chat composers and other
|
|
162
|
-
* dense surfaces where a full-resolution paste would dominate the
|
|
163
|
-
* layout. Storage bytes are unchanged either way.
|
|
164
|
-
*/
|
|
165
|
-
imageDisplayMode?: ImageDisplayMode;
|
|
166
|
-
/**
|
|
167
|
-
* File name (e.g. `foo.ts`) or bare extension that the content
|
|
168
|
-
* represents. When set to a non-markdown/text extension, the shell
|
|
169
|
-
* enters **code mode**: Monaco picks the right language based on the
|
|
170
|
-
* extension, the WYSIWYG and Preview tabs disappear, and the toolbar
|
|
171
|
-
* drops its markdown-specific formatting buttons. Markdown-ish
|
|
172
|
-
* extensions (`.md`, `.markdown`, `.mdown`, `.txt`) keep the full
|
|
173
|
-
* experience. Omit to get today's markdown behavior unchanged.
|
|
174
|
-
*/
|
|
175
|
-
fileName?: string;
|
|
176
|
-
/**
|
|
177
|
-
* Explicit Monaco language ID override (e.g. `'typescript'`,
|
|
178
|
-
* `'python'`, `'json'`). Wins over the language derived from
|
|
179
|
-
* `fileName`. Anything other than `'markdown'` or `'plaintext'`
|
|
180
|
-
* switches the shell into code mode.
|
|
181
|
-
*/
|
|
182
|
-
language?: string;
|
|
183
|
-
/**
|
|
184
|
-
* Optional async provider for `@`-mention suggestions. When supplied,
|
|
185
|
-
* typing `@` inside the editor opens a popover of candidates; selecting
|
|
186
|
-
* one inserts a `@[Label](scheme:id)` mention token. Used by chat
|
|
187
|
-
* composers and any other surface that wants to address named entities
|
|
188
|
-
* inline. Omit to disable mentions entirely.
|
|
189
|
-
*/
|
|
190
|
-
mentionProvider?: MentionProvider | null;
|
|
191
|
-
/**
|
|
192
|
-
* Optional async provider for sibling-document suggestions in the
|
|
193
|
-
* link insert dialog. When supplied, the dialog gains a "Browse
|
|
194
|
-
* documents" picker so authors can pick a neighbor `.md` by name and
|
|
195
|
-
* insert a relative-path link without typing the URL by hand. Hosts
|
|
196
|
-
* that organize docs in a workspace (file-system, IndexedDB slot,
|
|
197
|
-
* remote API, …) implement this; the editor stays agnostic.
|
|
198
|
-
*/
|
|
199
|
-
documentLinkProvider?: DocumentLinkProvider | null;
|
|
200
|
-
/**
|
|
201
|
-
* Whether the in-editor media recorder is surfaced in the toolbar.
|
|
202
|
-
* Defaults to true — when a `mediaProvider` is wired, a record
|
|
203
|
-
* button appears next to the version history. Pass `false` to
|
|
204
|
-
* suppress it (read-only embeds, surfaces where camera/screen
|
|
205
|
-
* permission prompts would be jarring). Without a `mediaProvider`,
|
|
206
|
-
* the button is hidden regardless of this prop.
|
|
207
|
-
*/
|
|
208
|
-
allowRecording?: boolean;
|
|
209
|
-
/**
|
|
210
|
-
* Placeholder text shown in the WYSIWYG editor while the document is
|
|
211
|
-
* empty. When omitted, the editor rotates through its own generic
|
|
212
|
-
* "start typing…" prompts; pass a value here to override with copy
|
|
213
|
-
* that fits the embedding surface (e.g. a chat composer knows who
|
|
214
|
-
* the message is going to and can say so).
|
|
215
|
-
*/
|
|
216
|
-
placeholder?: string;
|
|
217
|
-
/**
|
|
218
|
-
* When true, both editing surfaces become non-editable: Monaco runs in
|
|
219
|
-
* `readOnly` mode and Tiptap is set to `editable: false`. The toolbar
|
|
220
|
-
* still renders — hide it from the host side if you want a pure preview.
|
|
221
|
-
* Useful for reference panels that show file content without inviting
|
|
222
|
-
* accidental edits.
|
|
223
|
-
*/
|
|
224
|
-
readOnly?: boolean;
|
|
225
|
-
/**
|
|
226
|
-
* Image source URL used when the resolved file mode is `image` (PNG,
|
|
227
|
-
* JPEG, GIF, WebP, BMP, ICO, AVIF). When this prop is set, the shell
|
|
228
|
-
* replaces its text-editing surfaces with a dedicated `ImageViewer`.
|
|
229
|
-
*
|
|
230
|
-
* Lifecycle of the URL is the caller's responsibility — when fed a
|
|
231
|
-
* `blob:` URL, the host should `URL.revokeObjectURL` on unmount or
|
|
232
|
-
* src change.
|
|
233
|
-
*/
|
|
234
|
-
imageSrc?: string;
|
|
235
|
-
/** Alt text passed through to the underlying ImageViewer. */
|
|
236
|
-
imageAlt?: string;
|
|
237
|
-
/**
|
|
238
|
-
* Whether the image surface should render as a read-only viewer
|
|
239
|
-
* (`'view'`, default) or as the editable {@link ImageEditor}
|
|
240
|
-
* (`'edit'`). Editing requires {@link EditorShellProps.imageEditorContainer}
|
|
241
|
-
* — without it the shell falls back to view mode and logs a warning.
|
|
242
|
-
*/
|
|
243
|
-
imageMode?: 'view' | 'edit';
|
|
244
|
-
/**
|
|
245
|
-
* Sidecar `ContentContainer` for the image being edited. Conventionally
|
|
246
|
-
* scoped to `<basename>_files/` via
|
|
247
|
-
* `scopeContainer(parentContainer, basename + '_files')`. The image
|
|
248
|
-
* editor persists `state.json`, layer assets in `assets/`, and (when
|
|
249
|
-
* `allowVersioning` is true) snapshots in `.versions/` inside it.
|
|
250
|
-
*/
|
|
251
|
-
imageEditorContainer?: ContentContainer;
|
|
252
|
-
/**
|
|
253
|
-
* Called after the user clicks Export in the image editor and the
|
|
254
|
-
* raster blob is produced. When omitted, the editor triggers a
|
|
255
|
-
* default browser download.
|
|
256
|
-
*/
|
|
257
|
-
onImageExport?: (blob: Blob, format: 'png' | 'jpeg' | 'webp') => void;
|
|
258
|
-
/**
|
|
259
|
-
* Show an inline preview gutter to the right of the WYSIWYG editor.
|
|
260
|
-
* The gutter renders one small SVG card per template-annotated block in
|
|
261
|
-
* the document, letting authors see their rendered output without
|
|
262
|
-
* leaving Edit mode. Auto-hidden via container query when the editor
|
|
263
|
-
* body is narrower than ~720px. Defaults to `false`.
|
|
264
|
-
*/
|
|
265
|
-
inlinePreview?: boolean;
|
|
266
|
-
/**
|
|
267
|
-
* Width in pixels for the inline preview gutter. Defaults to 320.
|
|
268
|
-
* Only takes effect when {@link EditorShellProps.inlinePreview} is true.
|
|
269
|
-
*/
|
|
270
|
-
inlinePreviewWidth?: number;
|
|
271
|
-
/**
|
|
272
|
-
* Show an outline pane on the left of the WYSIWYG editor — a
|
|
273
|
-
* hierarchical tree of the document's headings (h1 → h2 → h3) with
|
|
274
|
-
* click-to-scroll. Auto-hidden via container query on narrow editors.
|
|
275
|
-
* Defaults to `false`. The toolbar's View menu can toggle this at
|
|
276
|
-
* runtime regardless of the initial value.
|
|
277
|
-
*/
|
|
278
|
-
outline?: boolean;
|
|
279
|
-
/**
|
|
280
|
-
* Width in pixels for the outline pane. Defaults to 240. Only takes
|
|
281
|
-
* effect when {@link EditorShellProps.outline} is true (or the View
|
|
282
|
-
* menu has toggled it on).
|
|
283
|
-
*/
|
|
284
|
-
outlineWidth?: number;
|
|
285
|
-
/**
|
|
286
|
-
* Initial visibility of inline block-template tags on headings — the
|
|
287
|
-
* chip rendered next to each heading in the WYSIWYG view that opens
|
|
288
|
-
* the block-template picker. Defaults to true; the View menu can
|
|
289
|
-
* toggle it at runtime regardless of the initial value.
|
|
290
|
-
*/
|
|
291
|
-
blockTags?: boolean;
|
|
292
|
-
/**
|
|
293
|
-
* How much of the active Squisq theme the WYSIWYG editing surface
|
|
294
|
-
* mirrors. Defaults to `'fonts'` — the historical behavior of
|
|
295
|
-
* inheriting body / heading fonts only. The View menu can change it
|
|
296
|
-
* at runtime.
|
|
297
|
-
*/
|
|
298
|
-
themeInheritance?: ThemeInheritance;
|
|
299
|
-
/**
|
|
300
|
-
* Bundled view preferences — a serializable JSON blob covering the
|
|
301
|
-
* runtime-toggleable view options surfaced in the View menu. When
|
|
302
|
-
* provided, fields here override the corresponding individual props
|
|
303
|
-
* (`outline`, `inlinePreview`, `showStatusBar`). Pair with
|
|
304
|
-
* {@link onViewPreferencesChange} to externalize storage of these
|
|
305
|
-
* preferences in the host.
|
|
306
|
-
*/
|
|
307
|
-
viewPreferences?: ViewPreferences;
|
|
308
|
-
/**
|
|
309
|
-
* Notified after each user-driven toggle in the View menu. The
|
|
310
|
-
* argument is a full snapshot of all view preferences — hosts can
|
|
311
|
-
* persist it as-is. Not called when {@link viewPreferences} is
|
|
312
|
-
* changed externally.
|
|
313
|
-
*/
|
|
314
|
-
onViewPreferencesChange?: (prefs: ViewPreferences) => void;
|
|
315
|
-
/**
|
|
316
|
-
* Override the preview theme with an explicit `Theme` object. When set,
|
|
317
|
-
* `Doc.themeId` and the user's theme dropdown selection are ignored for
|
|
318
|
-
* the preview surface. Used by the theme customizer to live-preview an
|
|
319
|
-
* in-progress theme without mutating the document.
|
|
320
|
-
*/
|
|
321
|
-
themeOverride?: Theme | null;
|
|
322
|
-
}
|
|
323
|
-
/**
|
|
324
|
-
* Complete markdown editor shell with toolbar, view switcher, and three
|
|
325
|
-
* editing modes: Raw (Monaco), WYSIWYG (Tiptap), and Preview.
|
|
326
|
-
*/
|
|
327
|
-
export declare function EditorShell({ initialMarkdown, initialView, articleId, basePath, onChange, theme, className, height, minHeight, maxHeight, mediaProvider, workspaceContainer, container, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, showFilesToggle, toolbarSlotLeft, toolbarSlotAfterActions, toolbarSlotRight, showPlayTab, submitOnEnter, fullWidth, uxFont, thinMargins, showStatusBar, imageDisplayMode, fileName, language, mentionProvider, documentLinkProvider, allowRecording, placeholder, readOnly, imageSrc, imageAlt, imageMode, imageEditorContainer, onImageExport, inlinePreview, inlinePreviewWidth, outline, outlineWidth, blockTags, themeInheritance, viewPreferences, onViewPreferencesChange, themeOverride, }: EditorShellProps): import("react/jsx-runtime").JSX.Element;
|
|
328
|
-
//# sourceMappingURL=EditorShell.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EditorShell.d.ts","sourceRoot":"","sources":["../src/EditorShell.tsx"],"names":[],"mappings":"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"}
|
package/dist/EditorShell.js
DELETED
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* EditorShell
|
|
4
|
-
*
|
|
5
|
-
* Top-level shell component that composes the Toolbar, ViewSwitcher, editor
|
|
6
|
-
* views, and StatusBar into a complete editing experience. Wraps everything
|
|
7
|
-
* in an EditorProvider for shared state.
|
|
8
|
-
*/
|
|
9
|
-
import { useEffect, useRef, useState, useCallback, useMemo } from 'react';
|
|
10
|
-
import { EditorProvider, useEditorContext, } from './EditorContext';
|
|
11
|
-
import { Toolbar } from './Toolbar';
|
|
12
|
-
import { StatusBar } from './StatusBar';
|
|
13
|
-
import { RawEditor } from './RawEditor';
|
|
14
|
-
import { WysiwygEditor } from './WysiwygEditor';
|
|
15
|
-
import { InlinePreviewGutter } from './InlinePreviewGutter';
|
|
16
|
-
import { OutlinePanel } from './OutlinePanel';
|
|
17
|
-
import { PreviewPanel } from './PreviewPanel';
|
|
18
|
-
import { ImageViewer } from './ImageViewer';
|
|
19
|
-
import { ImageEditor } from './ImageEditor';
|
|
20
|
-
import { PreviewSettingsProvider, PreviewToolbarControls } from './PreviewControls';
|
|
21
|
-
import { MediaBin } from './MediaBin';
|
|
22
|
-
import { DropZoneOverlay } from './DropZoneOverlay';
|
|
23
|
-
import { TooltipLayer } from './Tooltip';
|
|
24
|
-
import { useFileDrop } from './hooks/useFileDrop';
|
|
25
|
-
import { partitionFiles, processMediaFiles, processTextFile, processTextFiles, } from './utils/dropUtils';
|
|
26
|
-
import { DARK_SURFACE, LIGHT_SURFACE } from '@bendyline/squisq/schemas';
|
|
27
|
-
import { MemoryContentContainer, scopeContainer, createMediaProviderFromContainer, } from '@bendyline/squisq/storage';
|
|
28
|
-
/**
|
|
29
|
-
* Complete markdown editor shell with toolbar, view switcher, and three
|
|
30
|
-
* editing modes: Raw (Monaco), WYSIWYG (Tiptap), and Preview.
|
|
31
|
-
*/
|
|
32
|
-
export function EditorShell({ initialMarkdown = '', initialView = 'wysiwyg', articleId = 'untitled', basePath = '/', onChange, theme = 'light', className, height = '100vh', minHeight, maxHeight, mediaProvider, workspaceContainer, container, allowVersioning = false, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, showFilesToggle, toolbarSlotLeft, toolbarSlotAfterActions, toolbarSlotRight, showPlayTab = true, submitOnEnter, fullWidth = false, uxFont, thinMargins = false, showStatusBar = true, imageDisplayMode = 'inline', fileName, language, mentionProvider, documentLinkProvider, allowRecording = true, placeholder, readOnly = false, imageSrc, imageAlt, imageMode = 'view', imageEditorContainer, onImageExport, inlinePreview = false, inlinePreviewWidth = 320, outline = false, outlineWidth = 240, blockTags = true, themeInheritance = 'fonts', viewPreferences, onViewPreferencesChange, themeOverride = null, }) {
|
|
33
|
-
const effectiveContainer = workspaceContainer ?? container ?? null;
|
|
34
|
-
// If the host gave us a `workspaceContainer` but no explicit `mediaProvider`,
|
|
35
|
-
// derive one automatically. Without this, drag-and-drop of an image
|
|
36
|
-
// into the editor silently failed (no provider \u2192 nothing to upload to)
|
|
37
|
-
// even though we had a perfectly good ContentContainer to write into.
|
|
38
|
-
const effectiveMediaProvider = useMemo(() => {
|
|
39
|
-
if (mediaProvider !== undefined)
|
|
40
|
-
return mediaProvider;
|
|
41
|
-
if (effectiveContainer)
|
|
42
|
-
return createMediaProviderFromContainer(effectiveContainer);
|
|
43
|
-
return undefined;
|
|
44
|
-
}, [mediaProvider, effectiveContainer]);
|
|
45
|
-
// Show the toggle when explicitly opted in, or when mediaProvider prop was passed at all
|
|
46
|
-
const filesToggleEnabled = showFilesToggle ?? effectiveMediaProvider !== undefined;
|
|
47
|
-
// If the host hides the Play tab but asked for it as the initial view,
|
|
48
|
-
// fall back to wysiwyg so we don't boot into a tab the user can't leave.
|
|
49
|
-
const effectiveInitialView = !showPlayTab && initialView === 'preview' ? 'wysiwyg' : initialView;
|
|
50
|
-
return (_jsx(EditorProvider, { initialMarkdown: initialMarkdown, initialView: effectiveInitialView, articleId: articleId, theme: theme, workspaceContainer: effectiveContainer, allowVersioning: allowVersioning, versionBasename: versionBasename, versioningPrunePolicy: versioningPrunePolicy, versioningAutoSaveIdleMs: versioningAutoSaveIdleMs, onSaveVersion: onSaveVersion, mediaProvider: effectiveMediaProvider, imageDisplayMode: imageDisplayMode, mentionProvider: mentionProvider, documentLinkProvider: documentLinkProvider, allowRecording: allowRecording, fileName: fileName, language: language, inlinePreview: inlinePreview, showStatusBar: showStatusBar, outline: outline, blockTags: blockTags, themeInheritance: themeInheritance, viewPreferences: viewPreferences, onViewPreferencesChange: onViewPreferencesChange, children: _jsx(EditorShellInner, { basePath: basePath, onChange: onChange, className: className, height: height, minHeight: minHeight, maxHeight: maxHeight, placeholder: placeholder, mediaProvider: effectiveMediaProvider ?? null, workspaceContainer: effectiveContainer, filesToggleEnabled: filesToggleEnabled, toolbarSlotLeft: toolbarSlotLeft, toolbarSlotAfterActions: toolbarSlotAfterActions, toolbarSlotRight: toolbarSlotRight, showPlayTab: showPlayTab, submitOnEnter: submitOnEnter, fullWidth: fullWidth, uxFont: uxFont, thinMargins: thinMargins, readOnly: readOnly, imageSrc: imageSrc, imageAlt: imageAlt, imageMode: imageMode, imageEditorContainer: imageEditorContainer, onImageExport: onImageExport, allowVersioning: allowVersioning, versioningAutoSaveIdleMs: versioningAutoSaveIdleMs, inlinePreviewWidth: inlinePreviewWidth, outlineWidth: outlineWidth, themeOverride: themeOverride }) }));
|
|
51
|
-
}
|
|
52
|
-
function EditorShellInner({ basePath, onChange, className, height, minHeight, maxHeight, placeholder, mediaProvider, workspaceContainer, filesToggleEnabled, toolbarSlotLeft, toolbarSlotAfterActions, toolbarSlotRight, showPlayTab, submitOnEnter, fullWidth, uxFont, thinMargins, readOnly, imageSrc, imageAlt, imageMode, imageEditorContainer, onImageExport, allowVersioning, versioningAutoSaveIdleMs, inlinePreviewWidth, outlineWidth, themeOverride, }) {
|
|
53
|
-
const { activeView, markdownSource, doc, theme, editorMode, insertAtCursor, replaceAll, tiptapEditor, monacoEditor, setMarkdownSource, inlinePreviewVisible, statusBarVisible, outlineVisible, imageEditTarget, closeImageEdit, bumpMediaRevision, } = useEditorContext();
|
|
54
|
-
const isPreview = activeView === 'preview';
|
|
55
|
-
const isCodeMode = editorMode === 'code';
|
|
56
|
-
const isImageMode = editorMode === 'image';
|
|
57
|
-
const isMarkdownMode = editorMode === 'markdown';
|
|
58
|
-
const [showFiles, setShowFiles] = useState(false);
|
|
59
|
-
const [mediaRefreshKey, setMediaRefreshKey] = useState(0);
|
|
60
|
-
// Persistent fallback container for image-edit sidecars when the host
|
|
61
|
-
// didn't supply one. Lifted to shell scope so opening the same image
|
|
62
|
-
// multiple times sees the same `.imageEdits/<sanitized>/.versions/...`
|
|
63
|
-
// snapshots — otherwise each modal mount would start from an empty
|
|
64
|
-
// in-memory container and history would vanish on close.
|
|
65
|
-
const imageEditFallbackContainerRef = useRef(null);
|
|
66
|
-
if (imageEditFallbackContainerRef.current === null) {
|
|
67
|
-
imageEditFallbackContainerRef.current = new MemoryContentContainer();
|
|
68
|
-
}
|
|
69
|
-
const imageEditFallbackContainer = imageEditFallbackContainerRef.current;
|
|
70
|
-
const isDark = theme === 'dark';
|
|
71
|
-
const handleToggleFiles = useCallback(() => {
|
|
72
|
-
setShowFiles((prev) => !prev);
|
|
73
|
-
}, []);
|
|
74
|
-
// ── Drag-and-drop file handling ──
|
|
75
|
-
/**
|
|
76
|
-
* Insert an uploaded media file at the editor's current cursor.
|
|
77
|
-
*
|
|
78
|
-
* - In **WYSIWYG** mode, insert an actual tiptap image node via
|
|
79
|
-
* `setImage({src, alt})` (images) or a link mark (non-images).
|
|
80
|
-
* Going through `setImage` directly mirrors the Toolbar's image
|
|
81
|
-
* button and avoids the round-trip through `markdownToTiptap`
|
|
82
|
-
* that historically lost `<img>` tags to tag-strip passes.
|
|
83
|
-
* - In **raw (Monaco)** or **preview** mode, fall back to
|
|
84
|
-
* `insertAtCursor` which emits the markdown snippet.
|
|
85
|
-
*
|
|
86
|
-
* Without this, upload-via-MediaBin and upload-via-drop both
|
|
87
|
-
* added the file to the bin and nowhere else — the composer sent
|
|
88
|
-
* an empty body and the downstream gezel reported "nothing came
|
|
89
|
-
* through."
|
|
90
|
-
*/
|
|
91
|
-
const insertMediaRef = useCallback((relativePath, name, mimeType) => {
|
|
92
|
-
const alt = name.replace(/\.[^.]+$/, '').replace(/[-_]/g, ' ');
|
|
93
|
-
const isImage = mimeType.startsWith('image/');
|
|
94
|
-
const snippet = isImage ? `` : `[${alt}](${relativePath})`;
|
|
95
|
-
if (activeView === 'wysiwyg' && tiptapEditor) {
|
|
96
|
-
if (isImage) {
|
|
97
|
-
tiptapEditor.chain().focus().setImage({ src: relativePath, alt }).run();
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
tiptapEditor
|
|
101
|
-
.chain()
|
|
102
|
-
.focus()
|
|
103
|
-
.insertContent([
|
|
104
|
-
{
|
|
105
|
-
type: 'text',
|
|
106
|
-
marks: [{ type: 'link', attrs: { href: relativePath } }],
|
|
107
|
-
text: alt,
|
|
108
|
-
},
|
|
109
|
-
])
|
|
110
|
-
.run();
|
|
111
|
-
}
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
if (activeView === 'raw' && monacoEditor) {
|
|
115
|
-
insertAtCursor(snippet);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
// Preview mode — no interactive editor to insert into. Append
|
|
119
|
-
// to markdown source so the ref is still in the buffer.
|
|
120
|
-
setMarkdownSource(markdownSource ? `${markdownSource}\n\n${snippet}` : snippet);
|
|
121
|
-
}, [activeView, tiptapEditor, monacoEditor, insertAtCursor, markdownSource, setMarkdownSource]);
|
|
122
|
-
const handleFileDrop = useCallback(async (files, target) => {
|
|
123
|
-
try {
|
|
124
|
-
const { media, text } = partitionFiles(files);
|
|
125
|
-
// Process media files
|
|
126
|
-
if (media.length > 0 && mediaProvider) {
|
|
127
|
-
const paths = await processMediaFiles(media, mediaProvider);
|
|
128
|
-
setMediaRefreshKey((k) => k + 1);
|
|
129
|
-
// Auto-open the media bin so the user sees the new files
|
|
130
|
-
if (!showFiles)
|
|
131
|
-
setShowFiles(true);
|
|
132
|
-
// Insert each uploaded file as a markdown ref at the cursor so
|
|
133
|
-
// the body actually contains the attachment. Without this the
|
|
134
|
-
// bin holds the file but the serialized markdown stays empty,
|
|
135
|
-
// and anything downstream (chat send, document save) sees no
|
|
136
|
-
// reference to the upload.
|
|
137
|
-
for (let i = 0; i < media.length; i++) {
|
|
138
|
-
const file = media[i];
|
|
139
|
-
const path = paths[i];
|
|
140
|
-
if (!file || !path)
|
|
141
|
-
continue;
|
|
142
|
-
insertMediaRef(path, file.name, file.type || 'application/octet-stream');
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
// Process text files
|
|
146
|
-
if (text.length > 0) {
|
|
147
|
-
if (target === 'replace') {
|
|
148
|
-
// Replace with first text file
|
|
149
|
-
const content = await processTextFile(text[0]);
|
|
150
|
-
replaceAll(content);
|
|
151
|
-
}
|
|
152
|
-
else {
|
|
153
|
-
// Insert all text files concatenated
|
|
154
|
-
const content = await processTextFiles(text);
|
|
155
|
-
insertAtCursor(content);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
catch (err) {
|
|
160
|
-
console.error('Failed to process dropped files:', err instanceof Error ? err.message : err);
|
|
161
|
-
}
|
|
162
|
-
}, [mediaProvider, showFiles, replaceAll, insertAtCursor, insertMediaRef]);
|
|
163
|
-
const { isDragging, dragContentType, containerProps, zoneProps } = useFileDrop({
|
|
164
|
-
onDrop: handleFileDrop,
|
|
165
|
-
});
|
|
166
|
-
// Notify parent of changes
|
|
167
|
-
useEffect(() => {
|
|
168
|
-
onChange?.(markdownSource);
|
|
169
|
-
}, [markdownSource, onChange]);
|
|
170
|
-
// Keyboard shortcuts for view switching
|
|
171
|
-
useEffect(() => {
|
|
172
|
-
const handler = (e) => {
|
|
173
|
-
if (e.ctrlKey || e.metaKey) {
|
|
174
|
-
switch (e.key) {
|
|
175
|
-
case '1':
|
|
176
|
-
e.preventDefault();
|
|
177
|
-
document.querySelector('[data-view="wysiwyg"]')?.click();
|
|
178
|
-
break;
|
|
179
|
-
case '2':
|
|
180
|
-
e.preventDefault();
|
|
181
|
-
document.querySelector('[data-view="raw"]')?.click();
|
|
182
|
-
break;
|
|
183
|
-
case '3':
|
|
184
|
-
if (!showPlayTab)
|
|
185
|
-
return;
|
|
186
|
-
e.preventDefault();
|
|
187
|
-
document.querySelector('[data-view="preview"]')?.click();
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
window.addEventListener('keydown', handler);
|
|
193
|
-
return () => window.removeEventListener('keydown', handler);
|
|
194
|
-
}, [showPlayTab]);
|
|
195
|
-
const autoGrow = minHeight !== undefined || maxHeight !== undefined;
|
|
196
|
-
return (_jsxs("div", { className: `squisq-editor-shell ${className || ''}`, "data-theme": theme, "data-full-width": fullWidth ? 'true' : undefined, "data-thin-margins": thinMargins ? 'true' : undefined, "data-outline-visible": isMarkdownMode && outlineVisible ? 'true' : undefined, style: {
|
|
197
|
-
display: 'flex',
|
|
198
|
-
flexDirection: 'column',
|
|
199
|
-
overflow: 'hidden',
|
|
200
|
-
...(autoGrow ? { minHeight, maxHeight } : { height }),
|
|
201
|
-
// When a consumer supplies a UX font stack, expose it to the
|
|
202
|
-
// editor CSS via this custom property. Chrome elements (toolbar,
|
|
203
|
-
// tabs, status bar) consume `--squisq-ux-font` as their
|
|
204
|
-
// `font-family`, falling back to the system stack when unset.
|
|
205
|
-
...(uxFont ? { '--squisq-ux-font': uxFont } : {}),
|
|
206
|
-
// Exposed so the toolbar's view-tabs section can match the outline
|
|
207
|
-
// pane's width, lining up its right-edge separator with the
|
|
208
|
-
// outline's right edge. The variable is set unconditionally so the
|
|
209
|
-
// outline pane itself can also read it if needed; the
|
|
210
|
-
// `data-outline-visible` gate above keeps the toolbar override
|
|
211
|
-
// scoped to the case where alignment matters.
|
|
212
|
-
...{ '--squisq-outline-width': `${outlineWidth}px` },
|
|
213
|
-
}, ...containerProps, children: [_jsxs(PreviewSettingsProvider, { doc: doc, themeOverride: themeOverride, children: [isImageMode ? ((toolbarSlotLeft || toolbarSlotRight) && (_jsxs("div", { className: "squisq-editor-header squisq-editor-header--image", children: [toolbarSlotLeft, _jsx("div", { style: { flex: 1 } }), toolbarSlotRight] }))) : (_jsx("div", { className: "squisq-editor-header", children: _jsx(Toolbar, { showFiles: showFiles, onToggleFiles: !isCodeMode && filesToggleEnabled ? handleToggleFiles : undefined, slotLeft: toolbarSlotLeft, slotAfterActions: _jsxs(_Fragment, { children: [toolbarSlotAfterActions, !isCodeMode && isPreview && _jsx(PreviewToolbarControls, {})] }), slotRight: toolbarSlotRight, showPlayTab: showPlayTab }) })), _jsxs("div", { className: "squisq-editor-content", style: {
|
|
214
|
-
flex: autoGrow ? '1 1 auto' : 1,
|
|
215
|
-
overflowY: autoGrow ? 'auto' : 'hidden',
|
|
216
|
-
overflowX: 'hidden',
|
|
217
|
-
minHeight: 0,
|
|
218
|
-
position: 'relative',
|
|
219
|
-
display: 'flex',
|
|
220
|
-
}, children: [_jsxs("div", { style: {
|
|
221
|
-
flex: autoGrow ? '1 1 auto' : 1,
|
|
222
|
-
overflow: autoGrow ? 'visible' : 'hidden',
|
|
223
|
-
minHeight: 0,
|
|
224
|
-
position: 'relative',
|
|
225
|
-
}, children: [isImageMode &&
|
|
226
|
-
imageSrc &&
|
|
227
|
-
(imageMode === 'edit' && imageEditorContainer ? (_jsx(ImageEditor, { filesContainer: imageEditorContainer, initialSrc: imageSrc, allowVersioning: allowVersioning, versioningAutoSaveIdleMs: versioningAutoSaveIdleMs, onExport: onImageExport })) : (_jsx(ImageViewer, { src: imageSrc, alt: imageAlt, theme: theme }))), !isImageMode && activeView === 'raw' && (_jsxs("div", { className: "squisq-editor-with-gutter", children: [isMarkdownMode && outlineVisible && (_jsx(OutlinePanel, { width: outlineWidth }, "outline")), _jsx("div", { className: "squisq-raw-editor-container", children: _jsx(RawEditor, { theme: theme === 'dark' ? 'vs-dark' : 'vs', submitOnEnter: submitOnEnter, readOnly: readOnly }) }, "raw-editor"), isMarkdownMode && inlinePreviewVisible && (_jsx(InlinePreviewGutter, { width: inlinePreviewWidth, basePath: basePath, mediaProvider: mediaProvider }, "inline"))] }, "raw-shell")), isMarkdownMode && activeView === 'wysiwyg' && (_jsxs("div", { className: "squisq-editor-with-gutter", children: [outlineVisible && _jsx(OutlinePanel, { width: outlineWidth }, "outline"), _jsx(WysiwygEditor, { submitOnEnter: submitOnEnter, placeholder: placeholder, readOnly: readOnly }, "wysiwyg-editor"), inlinePreviewVisible && (_jsx(InlinePreviewGutter, { width: inlinePreviewWidth, basePath: basePath, mediaProvider: mediaProvider }, "inline"))] }, "wysiwyg-shell")), isMarkdownMode && isPreview && (_jsx(PreviewPanel, { basePath: basePath, workspaceContainer: workspaceContainer }))] }), isMarkdownMode && showFiles && (_jsx(MediaBin, { mediaProvider: mediaProvider, isDark: isDark, refreshKey: mediaRefreshKey, onMediaUploaded: insertMediaRef })), isMarkdownMode &&
|
|
228
|
-
isDragging &&
|
|
229
|
-
!(activeView === 'wysiwyg' && dragContentType === 'media') && (_jsx(DropZoneOverlay, { dragContentType: dragContentType, zoneProps: zoneProps, hasMediaProvider: mediaProvider !== null }))] }), statusBarVisible && !isImageMode && _jsx(StatusBar, {})] }), _jsx(TooltipLayer, {}), imageEditTarget !== null && mediaProvider && (_jsx(ImageEditModal, { relativePath: imageEditTarget, container: workspaceContainer ?? imageEditFallbackContainer, mediaProvider: mediaProvider, onClose: closeImageEdit, onSaved: () => {
|
|
230
|
-
bumpMediaRevision();
|
|
231
|
-
closeImageEdit();
|
|
232
|
-
}, allowVersioning: allowVersioning, versioningAutoSaveIdleMs: versioningAutoSaveIdleMs, shellTheme: theme }))] }));
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Modal overlay that mounts a full `<ImageEditor>` against a sidecar
|
|
236
|
-
* container scoped under `.imageEdits/<sanitized-path>/` of the document's
|
|
237
|
-
* `ContentContainer`. Opens when a user clicks the "Edit" affordance on an
|
|
238
|
-
* image in the WYSIWYG view; on Export, rewrites the original image bytes
|
|
239
|
-
* via `mediaProvider.addMedia(relativePath, blob, mime)` and bumps
|
|
240
|
-
* `mediaRevision` so live `<img>` nodes pick up the new content.
|
|
241
|
-
*/
|
|
242
|
-
function ImageEditModal({ relativePath, container, mediaProvider, onClose, onSaved, allowVersioning, versioningAutoSaveIdleMs, shellTheme, }) {
|
|
243
|
-
// Each unique image path gets its own sidecar so multiple images in the
|
|
244
|
-
// same doc can be edited independently without colliding state. When the
|
|
245
|
-
// host didn't supply a `container`, fall back to a fresh in-memory one
|
|
246
|
-
// — the edit session is transient anyway and the final raster is what
|
|
247
|
-
// gets written back through `mediaProvider`.
|
|
248
|
-
const sidecar = useMemo(() => {
|
|
249
|
-
const sanitized = relativePath.replace(/[^a-zA-Z0-9._-]+/g, '_');
|
|
250
|
-
const parent = container ?? new MemoryContentContainer();
|
|
251
|
-
return scopeContainer(parent, `.imageEdits/${sanitized}`);
|
|
252
|
-
}, [container, relativePath]);
|
|
253
|
-
const [initialSrc, setInitialSrc] = useState(null);
|
|
254
|
-
const [resolveError, setResolveError] = useState(null);
|
|
255
|
-
useEffect(() => {
|
|
256
|
-
let cancelled = false;
|
|
257
|
-
mediaProvider.resolveUrl(relativePath).then((url) => {
|
|
258
|
-
if (!cancelled)
|
|
259
|
-
setInitialSrc(url);
|
|
260
|
-
}, (err) => {
|
|
261
|
-
if (!cancelled) {
|
|
262
|
-
setResolveError(err instanceof Error ? err.message : String(err));
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
return () => {
|
|
266
|
-
cancelled = true;
|
|
267
|
-
};
|
|
268
|
-
}, [mediaProvider, relativePath]);
|
|
269
|
-
const handleExport = useCallback((blob, format) => {
|
|
270
|
-
const mime = `image/${format}`;
|
|
271
|
-
mediaProvider.addMedia(relativePath, blob, mime).then(() => onSaved(), (err) => {
|
|
272
|
-
console.error('Failed to write image back:', err instanceof Error ? err.message : err);
|
|
273
|
-
});
|
|
274
|
-
}, [mediaProvider, relativePath, onSaved]);
|
|
275
|
-
// Close on Escape — global listener so it works regardless of focus.
|
|
276
|
-
useEffect(() => {
|
|
277
|
-
const handler = (e) => {
|
|
278
|
-
if (e.key === 'Escape')
|
|
279
|
-
onClose();
|
|
280
|
-
};
|
|
281
|
-
window.addEventListener('keydown', handler);
|
|
282
|
-
return () => window.removeEventListener('keydown', handler);
|
|
283
|
-
}, [onClose]);
|
|
284
|
-
return (_jsx("div", { className: "squisq-image-edit-modal", "data-testid": "image-edit-modal", role: "dialog", "aria-modal": "true", "aria-label": `Edit ${relativePath}`, onClick: (e) => {
|
|
285
|
-
// Click on the dim backdrop (but not on the surface) → close.
|
|
286
|
-
if (e.target === e.currentTarget)
|
|
287
|
-
onClose();
|
|
288
|
-
}, children: _jsxs("div", { className: "squisq-image-edit-modal__surface", children: [_jsxs("header", { className: "squisq-image-edit-modal__header", children: [_jsx("span", { className: "squisq-image-edit-modal__title", children: "Edit image" }), _jsx("span", { className: "squisq-image-edit-modal__path", children: relativePath }), _jsx("button", { type: "button", className: "squisq-image-edit-modal__close", "data-testid": "image-edit-modal-close", onClick: onClose, "aria-label": "Close image editor", children: "\u00D7" })] }), _jsx("div", { className: "squisq-image-edit-modal__body", children: resolveError ? (_jsxs("div", { className: "squisq-image-edit-modal__error", children: ["Failed to load image: ", resolveError] })) : !initialSrc ? (_jsx("div", { className: "squisq-image-edit-modal__loading", children: "Loading image\u2026" })) : (_jsx(ImageEditor, { filesContainer: sidecar, initialSrc: initialSrc, allowVersioning: allowVersioning, versioningAutoSaveIdleMs: versioningAutoSaveIdleMs, onExport: handleExport, saveBehavior: "export", saveFormat: "png", saveLabel: "Save and close", saveTitle: "Save changes back to the image and close", surface: shellTheme === 'dark' ? DARK_SURFACE : LIGHT_SURFACE })) })] }) }));
|
|
289
|
-
}
|
|
290
|
-
//# sourceMappingURL=EditorShell.js.map
|