@bendyline/squisq-editor-react 1.4.0 → 1.5.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/dist/DocumentSettingsDialog.d.ts +26 -0
- package/dist/DocumentSettingsDialog.d.ts.map +1 -0
- package/dist/DocumentSettingsDialog.js +115 -0
- package/dist/DocumentSettingsDialog.js.map +1 -0
- package/dist/EditorContext.d.ts +248 -4
- package/dist/EditorContext.d.ts.map +1 -1
- package/dist/EditorContext.js +248 -10
- package/dist/EditorContext.js.map +1 -1
- package/dist/EditorShell.d.ts +173 -4
- package/dist/EditorShell.d.ts.map +1 -1
- package/dist/EditorShell.js +110 -10
- package/dist/EditorShell.js.map +1 -1
- package/dist/EmojiPicker.d.ts +50 -0
- package/dist/EmojiPicker.d.ts.map +1 -0
- package/dist/EmojiPicker.js +182 -0
- package/dist/EmojiPicker.js.map +1 -0
- package/dist/ImageEditor.d.ts +68 -0
- package/dist/ImageEditor.d.ts.map +1 -0
- package/dist/ImageEditor.js +166 -0
- package/dist/ImageEditor.js.map +1 -0
- package/dist/ImageNodeView.d.ts +13 -1
- package/dist/ImageNodeView.d.ts.map +1 -1
- package/dist/ImageNodeView.js +172 -19
- package/dist/ImageNodeView.js.map +1 -1
- package/dist/ImageViewer.d.ts +26 -0
- package/dist/ImageViewer.d.ts.map +1 -0
- package/dist/ImageViewer.js +119 -0
- package/dist/ImageViewer.js.map +1 -0
- package/dist/InlineIcon.d.ts +17 -0
- package/dist/InlineIcon.d.ts.map +1 -0
- package/dist/InlineIcon.js +72 -0
- package/dist/InlineIcon.js.map +1 -0
- package/dist/InlinePreviewGutter.d.ts +52 -0
- package/dist/InlinePreviewGutter.d.ts.map +1 -0
- package/dist/InlinePreviewGutter.js +397 -0
- package/dist/InlinePreviewGutter.js.map +1 -0
- package/dist/LinkDialog.d.ts +43 -0
- package/dist/LinkDialog.d.ts.map +1 -0
- package/dist/LinkDialog.js +102 -0
- package/dist/LinkDialog.js.map +1 -0
- package/dist/MentionExtension.js +10 -7
- package/dist/MentionExtension.js.map +1 -1
- package/dist/OutlinePanel.d.ts +17 -0
- package/dist/OutlinePanel.d.ts.map +1 -0
- package/dist/OutlinePanel.js +167 -0
- package/dist/OutlinePanel.js.map +1 -0
- package/dist/PlainHtmlPreview.d.ts +50 -0
- package/dist/PlainHtmlPreview.d.ts.map +1 -0
- package/dist/PlainHtmlPreview.js +155 -0
- package/dist/PlainHtmlPreview.js.map +1 -0
- package/dist/PreviewControls.d.ts +15 -1
- package/dist/PreviewControls.d.ts.map +1 -1
- package/dist/PreviewControls.js +75 -18
- package/dist/PreviewControls.js.map +1 -1
- package/dist/PreviewPanel.d.ts +11 -10
- package/dist/PreviewPanel.d.ts.map +1 -1
- package/dist/PreviewPanel.js +20 -17
- package/dist/PreviewPanel.js.map +1 -1
- package/dist/RawEditor.d.ts.map +1 -1
- package/dist/RawEditor.js +198 -4
- package/dist/RawEditor.js.map +1 -1
- package/dist/RecorderEntry.d.ts +24 -0
- package/dist/RecorderEntry.d.ts.map +1 -0
- package/dist/RecorderEntry.js +139 -0
- package/dist/RecorderEntry.js.map +1 -0
- package/dist/TemplateAnnotation.d.ts.map +1 -1
- package/dist/TemplateAnnotation.js +32 -6
- package/dist/TemplateAnnotation.js.map +1 -1
- package/dist/TemplatePicker.d.ts +53 -0
- package/dist/TemplatePicker.d.ts.map +1 -0
- package/dist/TemplatePicker.js +388 -0
- package/dist/TemplatePicker.js.map +1 -0
- package/dist/ThemeCustomizerPanel.d.ts +32 -0
- package/dist/ThemeCustomizerPanel.d.ts.map +1 -0
- package/dist/ThemeCustomizerPanel.js +256 -0
- package/dist/ThemeCustomizerPanel.js.map +1 -0
- package/dist/ThemePicker.d.ts +33 -0
- package/dist/ThemePicker.d.ts.map +1 -0
- package/dist/ThemePicker.js +148 -0
- package/dist/ThemePicker.js.map +1 -0
- package/dist/Toolbar.d.ts.map +1 -1
- package/dist/Toolbar.js +508 -33
- package/dist/Toolbar.js.map +1 -1
- package/dist/VersionHistoryPanel.d.ts +14 -0
- package/dist/VersionHistoryPanel.d.ts.map +1 -0
- package/dist/VersionHistoryPanel.js +147 -0
- package/dist/VersionHistoryPanel.js.map +1 -0
- package/dist/ViewMenuPanel.d.ts +13 -0
- package/dist/ViewMenuPanel.d.ts.map +1 -0
- package/dist/ViewMenuPanel.js +58 -0
- package/dist/ViewMenuPanel.js.map +1 -0
- package/dist/WysiwygEditor.d.ts.map +1 -1
- package/dist/WysiwygEditor.js +198 -9
- package/dist/WysiwygEditor.js.map +1 -1
- package/dist/__tests__/detectMarkdown.test.js +0 -14
- package/dist/__tests__/detectMarkdown.test.js.map +1 -1
- package/dist/__tests__/documentSettingsDialog.test.d.ts +2 -0
- package/dist/__tests__/documentSettingsDialog.test.d.ts.map +1 -0
- package/dist/__tests__/documentSettingsDialog.test.js +132 -0
- package/dist/__tests__/documentSettingsDialog.test.js.map +1 -0
- package/dist/__tests__/emojiPicker.test.d.ts +2 -0
- package/dist/__tests__/emojiPicker.test.d.ts.map +1 -0
- package/dist/__tests__/emojiPicker.test.js +111 -0
- package/dist/__tests__/emojiPicker.test.js.map +1 -0
- package/dist/__tests__/fileKind.test.js +13 -0
- package/dist/__tests__/fileKind.test.js.map +1 -1
- package/dist/__tests__/imageEditAffordance.test.d.ts +2 -0
- package/dist/__tests__/imageEditAffordance.test.d.ts.map +1 -0
- package/dist/__tests__/imageEditAffordance.test.js +188 -0
- package/dist/__tests__/imageEditAffordance.test.js.map +1 -0
- package/dist/__tests__/imageEditorShell.test.d.ts +2 -0
- package/dist/__tests__/imageEditorShell.test.d.ts.map +1 -0
- package/dist/__tests__/imageEditorShell.test.js +52 -0
- package/dist/__tests__/imageEditorShell.test.js.map +1 -0
- package/dist/__tests__/imageEditorState.test.d.ts +3 -0
- package/dist/__tests__/imageEditorState.test.d.ts.map +1 -0
- package/dist/__tests__/imageEditorState.test.js +148 -0
- package/dist/__tests__/imageEditorState.test.js.map +1 -0
- package/dist/__tests__/inlinePreviewGutter.test.d.ts +2 -0
- package/dist/__tests__/inlinePreviewGutter.test.d.ts.map +1 -0
- package/dist/__tests__/inlinePreviewGutter.test.js +51 -0
- package/dist/__tests__/inlinePreviewGutter.test.js.map +1 -0
- package/dist/__tests__/inlinePreviewGutterAllBlocks.test.d.ts +2 -0
- package/dist/__tests__/inlinePreviewGutterAllBlocks.test.d.ts.map +1 -0
- package/dist/__tests__/inlinePreviewGutterAllBlocks.test.js +63 -0
- package/dist/__tests__/inlinePreviewGutterAllBlocks.test.js.map +1 -0
- package/dist/__tests__/jsonEditor.test.d.ts +2 -0
- package/dist/__tests__/jsonEditor.test.d.ts.map +1 -0
- package/dist/__tests__/jsonEditor.test.js +134 -0
- package/dist/__tests__/jsonEditor.test.js.map +1 -0
- package/dist/__tests__/layersPanel.test.d.ts +2 -0
- package/dist/__tests__/layersPanel.test.d.ts.map +1 -0
- package/dist/__tests__/layersPanel.test.js +84 -0
- package/dist/__tests__/layersPanel.test.js.map +1 -0
- package/dist/__tests__/linkDialogDocPicker.test.d.ts +7 -0
- package/dist/__tests__/linkDialogDocPicker.test.d.ts.map +1 -0
- package/dist/__tests__/linkDialogDocPicker.test.js +75 -0
- package/dist/__tests__/linkDialogDocPicker.test.js.map +1 -0
- package/dist/__tests__/outlinePanel.test.d.ts +2 -0
- package/dist/__tests__/outlinePanel.test.d.ts.map +1 -0
- package/dist/__tests__/outlinePanel.test.js +68 -0
- package/dist/__tests__/outlinePanel.test.js.map +1 -0
- package/dist/__tests__/plainHtmlPreview.test.d.ts +2 -0
- package/dist/__tests__/plainHtmlPreview.test.d.ts.map +1 -0
- package/dist/__tests__/plainHtmlPreview.test.js +87 -0
- package/dist/__tests__/plainHtmlPreview.test.js.map +1 -0
- package/dist/__tests__/propertiesPanel.test.d.ts +2 -0
- package/dist/__tests__/propertiesPanel.test.d.ts.map +1 -0
- package/dist/__tests__/propertiesPanel.test.js +64 -0
- package/dist/__tests__/propertiesPanel.test.js.map +1 -0
- package/dist/__tests__/recorderFormats.test.d.ts +2 -0
- package/dist/__tests__/recorderFormats.test.d.ts.map +1 -0
- package/dist/__tests__/recorderFormats.test.js +121 -0
- package/dist/__tests__/recorderFormats.test.js.map +1 -0
- package/dist/__tests__/recorderTimingJson.test.d.ts +2 -0
- package/dist/__tests__/recorderTimingJson.test.d.ts.map +1 -0
- package/dist/__tests__/recorderTimingJson.test.js +37 -0
- package/dist/__tests__/recorderTimingJson.test.js.map +1 -0
- package/dist/__tests__/templateAnnotationRoundTrip.test.d.ts +2 -0
- package/dist/__tests__/templateAnnotationRoundTrip.test.d.ts.map +1 -0
- package/dist/__tests__/templateAnnotationRoundTrip.test.js +31 -0
- package/dist/__tests__/templateAnnotationRoundTrip.test.js.map +1 -0
- package/dist/__tests__/tiptapBridge.test.js +13 -0
- package/dist/__tests__/tiptapBridge.test.js.map +1 -1
- package/dist/__tests__/useImageEditor.test.d.ts +2 -0
- package/dist/__tests__/useImageEditor.test.d.ts.map +1 -0
- package/dist/__tests__/useImageEditor.test.js +131 -0
- package/dist/__tests__/useImageEditor.test.js.map +1 -0
- package/dist/__tests__/useMediaRecorder.test.d.ts +2 -0
- package/dist/__tests__/useMediaRecorder.test.d.ts.map +1 -0
- package/dist/__tests__/useMediaRecorder.test.js +153 -0
- package/dist/__tests__/useMediaRecorder.test.js.map +1 -0
- package/dist/__tests__/versionHistory.test.d.ts +2 -0
- package/dist/__tests__/versionHistory.test.d.ts.map +1 -0
- package/dist/__tests__/versionHistory.test.js +124 -0
- package/dist/__tests__/versionHistory.test.js.map +1 -0
- package/dist/blockSlice.d.ts +24 -0
- package/dist/blockSlice.d.ts.map +1 -0
- package/dist/blockSlice.js +63 -0
- package/dist/blockSlice.js.map +1 -0
- package/dist/buildPreviewDoc.d.ts.map +1 -1
- package/dist/buildPreviewDoc.js +52 -2
- package/dist/buildPreviewDoc.js.map +1 -1
- package/dist/emojiData.d.ts +81 -0
- package/dist/emojiData.d.ts.map +1 -0
- package/dist/emojiData.js +1283 -0
- package/dist/emojiData.js.map +1 -0
- package/dist/fileKind.d.ts +6 -2
- package/dist/fileKind.d.ts.map +1 -1
- package/dist/fileKind.js +25 -4
- package/dist/fileKind.js.map +1 -1
- package/dist/hooks/useFileDrop.d.ts.map +1 -1
- package/dist/hooks/useFileDrop.js +40 -4
- package/dist/hooks/useFileDrop.js.map +1 -1
- package/dist/imageEditor/CanvasSurface.d.ts +31 -0
- package/dist/imageEditor/CanvasSurface.d.ts.map +1 -0
- package/dist/imageEditor/CanvasSurface.js +264 -0
- package/dist/imageEditor/CanvasSurface.js.map +1 -0
- package/dist/imageEditor/ImageVersionHistoryDropdown.d.ts +39 -0
- package/dist/imageEditor/ImageVersionHistoryDropdown.d.ts.map +1 -0
- package/dist/imageEditor/ImageVersionHistoryDropdown.js +283 -0
- package/dist/imageEditor/ImageVersionHistoryDropdown.js.map +1 -0
- package/dist/imageEditor/LayersPanel.d.ts +14 -0
- package/dist/imageEditor/LayersPanel.d.ts.map +1 -0
- package/dist/imageEditor/LayersPanel.js +43 -0
- package/dist/imageEditor/LayersPanel.js.map +1 -0
- package/dist/imageEditor/PropertiesPanel.d.ts +14 -0
- package/dist/imageEditor/PropertiesPanel.d.ts.map +1 -0
- package/dist/imageEditor/PropertiesPanel.js +97 -0
- package/dist/imageEditor/PropertiesPanel.js.map +1 -0
- package/dist/imageEditor/Toolbar.d.ts +30 -0
- package/dist/imageEditor/Toolbar.d.ts.map +1 -0
- package/dist/imageEditor/Toolbar.js +108 -0
- package/dist/imageEditor/Toolbar.js.map +1 -0
- package/dist/imageEditor/icons.d.ts +24 -0
- package/dist/imageEditor/icons.d.ts.map +1 -0
- package/dist/imageEditor/icons.js +45 -0
- package/dist/imageEditor/icons.js.map +1 -0
- package/dist/imageEditor/layers/EditorImageLayer.d.ts +16 -0
- package/dist/imageEditor/layers/EditorImageLayer.d.ts.map +1 -0
- package/dist/imageEditor/layers/EditorImageLayer.js +37 -0
- package/dist/imageEditor/layers/EditorImageLayer.js.map +1 -0
- package/dist/imageEditor/layers/EditorShapeLayer.d.ts +15 -0
- package/dist/imageEditor/layers/EditorShapeLayer.d.ts.map +1 -0
- package/dist/imageEditor/layers/EditorShapeLayer.js +20 -0
- package/dist/imageEditor/layers/EditorShapeLayer.js.map +1 -0
- package/dist/imageEditor/layers/EditorTextLayer.d.ts +18 -0
- package/dist/imageEditor/layers/EditorTextLayer.d.ts.map +1 -0
- package/dist/imageEditor/layers/EditorTextLayer.js +13 -0
- package/dist/imageEditor/layers/EditorTextLayer.js.map +1 -0
- package/dist/imageEditor/layers/SelectionHandles.d.ts +17 -0
- package/dist/imageEditor/layers/SelectionHandles.d.ts.map +1 -0
- package/dist/imageEditor/layers/SelectionHandles.js +19 -0
- package/dist/imageEditor/layers/SelectionHandles.js.map +1 -0
- package/dist/imageEditor/state.d.ts +76 -0
- package/dist/imageEditor/state.d.ts.map +1 -0
- package/dist/imageEditor/state.js +87 -0
- package/dist/imageEditor/state.js.map +1 -0
- package/dist/imageEditor/useImageEditor.d.ts +53 -0
- package/dist/imageEditor/useImageEditor.d.ts.map +1 -0
- package/dist/imageEditor/useImageEditor.js +244 -0
- package/dist/imageEditor/useImageEditor.js.map +1 -0
- package/dist/imageEditor/useImageEditorTokens.d.ts +16 -0
- package/dist/imageEditor/useImageEditorTokens.d.ts.map +1 -0
- package/dist/imageEditor/useImageEditorTokens.js +45 -0
- package/dist/imageEditor/useImageEditorTokens.js.map +1 -0
- package/dist/index.d.ts +48 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -1
- package/dist/jsonEditor/EmbeddedRichTextField.d.ts +15 -0
- package/dist/jsonEditor/EmbeddedRichTextField.d.ts.map +1 -0
- package/dist/jsonEditor/EmbeddedRichTextField.js +74 -0
- package/dist/jsonEditor/EmbeddedRichTextField.js.map +1 -0
- package/dist/jsonEditor/JsonEditor.d.ts +36 -0
- package/dist/jsonEditor/JsonEditor.d.ts.map +1 -0
- package/dist/jsonEditor/JsonEditor.js +15 -0
- package/dist/jsonEditor/JsonEditor.js.map +1 -0
- package/dist/jsonEditor/JsonEditorContext.d.ts +28 -0
- package/dist/jsonEditor/JsonEditorContext.d.ts.map +1 -0
- package/dist/jsonEditor/JsonEditorContext.js +41 -0
- package/dist/jsonEditor/JsonEditorContext.js.map +1 -0
- package/dist/jsonEditor/RenderNode.d.ts +16 -0
- package/dist/jsonEditor/RenderNode.d.ts.map +1 -0
- package/dist/jsonEditor/RenderNode.js +32 -0
- package/dist/jsonEditor/RenderNode.js.map +1 -0
- package/dist/jsonEditor/editors.d.ts +36 -0
- package/dist/jsonEditor/editors.d.ts.map +1 -0
- package/dist/jsonEditor/editors.js +347 -0
- package/dist/jsonEditor/editors.js.map +1 -0
- package/dist/jsonEditor/index.d.ts +3 -0
- package/dist/jsonEditor/index.d.ts.map +1 -0
- package/dist/jsonEditor/index.js +2 -0
- package/dist/jsonEditor/index.js.map +1 -0
- package/dist/jsonEditor/useJsonEditorTokens.d.ts +13 -0
- package/dist/jsonEditor/useJsonEditorTokens.d.ts.map +1 -0
- package/dist/jsonEditor/useJsonEditorTokens.js +38 -0
- package/dist/jsonEditor/useJsonEditorTokens.js.map +1 -0
- package/dist/recorder/RecorderButton.d.ts +31 -0
- package/dist/recorder/RecorderButton.d.ts.map +1 -0
- package/dist/recorder/RecorderButton.js +24 -0
- package/dist/recorder/RecorderButton.js.map +1 -0
- package/dist/recorder/RecorderModal.d.ts +59 -0
- package/dist/recorder/RecorderModal.d.ts.map +1 -0
- package/dist/recorder/RecorderModal.js +333 -0
- package/dist/recorder/RecorderModal.js.map +1 -0
- package/dist/recorder/RecorderPanel.d.ts +25 -0
- package/dist/recorder/RecorderPanel.d.ts.map +1 -0
- package/dist/recorder/RecorderPanel.js +30 -0
- package/dist/recorder/RecorderPanel.js.map +1 -0
- package/dist/recorder/formats.d.ts +51 -0
- package/dist/recorder/formats.d.ts.map +1 -0
- package/dist/recorder/formats.js +144 -0
- package/dist/recorder/formats.js.map +1 -0
- package/dist/recorder/hooks/useMediaRecorder.d.ts +90 -0
- package/dist/recorder/hooks/useMediaRecorder.d.ts.map +1 -0
- package/dist/recorder/hooks/useMediaRecorder.js +277 -0
- package/dist/recorder/hooks/useMediaRecorder.js.map +1 -0
- package/dist/recorder/hooks/useStreamPreview.d.ts +22 -0
- package/dist/recorder/hooks/useStreamPreview.d.ts.map +1 -0
- package/dist/recorder/hooks/useStreamPreview.js +44 -0
- package/dist/recorder/hooks/useStreamPreview.js.map +1 -0
- package/dist/recorder/sources/cameraStream.d.ts +22 -0
- package/dist/recorder/sources/cameraStream.d.ts.map +1 -0
- package/dist/recorder/sources/cameraStream.js +24 -0
- package/dist/recorder/sources/cameraStream.js.map +1 -0
- package/dist/recorder/sources/micStream.d.ts +15 -0
- package/dist/recorder/sources/micStream.d.ts.map +1 -0
- package/dist/recorder/sources/micStream.js +24 -0
- package/dist/recorder/sources/micStream.js.map +1 -0
- package/dist/recorder/sources/screenStream.d.ts +53 -0
- package/dist/recorder/sources/screenStream.d.ts.map +1 -0
- package/dist/recorder/sources/screenStream.js +114 -0
- package/dist/recorder/sources/screenStream.js.map +1 -0
- package/dist/recorder/timingJson.d.ts +51 -0
- package/dist/recorder/timingJson.d.ts.map +1 -0
- package/dist/recorder/timingJson.js +42 -0
- package/dist/recorder/timingJson.js.map +1 -0
- package/dist/tiptap/TiptapAudio.d.ts +26 -0
- package/dist/tiptap/TiptapAudio.d.ts.map +1 -0
- package/dist/tiptap/TiptapAudio.js +58 -0
- package/dist/tiptap/TiptapAudio.js.map +1 -0
- package/dist/tiptap/TiptapVideo.d.ts +30 -0
- package/dist/tiptap/TiptapVideo.d.ts.map +1 -0
- package/dist/tiptap/TiptapVideo.js +66 -0
- package/dist/tiptap/TiptapVideo.js.map +1 -0
- package/dist/tiptap/useResolvedMediaSrc.d.ts +2 -0
- package/dist/tiptap/useResolvedMediaSrc.d.ts.map +1 -0
- package/dist/tiptap/useResolvedMediaSrc.js +42 -0
- package/dist/tiptap/useResolvedMediaSrc.js.map +1 -0
- package/dist/tiptapBridge.d.ts.map +1 -1
- package/dist/tiptapBridge.js +171 -14
- package/dist/tiptapBridge.js.map +1 -1
- package/dist/useHeadingLayout.d.ts +54 -0
- package/dist/useHeadingLayout.d.ts.map +1 -0
- package/dist/useHeadingLayout.js +260 -0
- package/dist/useHeadingLayout.js.map +1 -0
- package/dist/utils/collectInlineFontAwesomeCss.d.ts +21 -0
- package/dist/utils/collectInlineFontAwesomeCss.d.ts.map +1 -0
- package/dist/utils/collectInlineFontAwesomeCss.js +68 -0
- package/dist/utils/collectInlineFontAwesomeCss.js.map +1 -0
- package/dist/utils/dropUtils.d.ts +21 -2
- package/dist/utils/dropUtils.d.ts.map +1 -1
- package/dist/utils/dropUtils.js +43 -4
- package/dist/utils/dropUtils.js.map +1 -1
- package/dist/utils/normalizeMalformedAssetUrl.d.ts +15 -0
- package/dist/utils/normalizeMalformedAssetUrl.d.ts.map +1 -0
- package/dist/utils/normalizeMalformedAssetUrl.js +27 -0
- package/dist/utils/normalizeMalformedAssetUrl.js.map +1 -0
- package/package.json +8 -5
- package/src/DocumentSettingsDialog.tsx +266 -0
- package/src/EditorContext.tsx +534 -10
- package/src/EditorShell.tsx +571 -55
- package/src/EmojiPicker.tsx +332 -0
- package/src/ImageEditor.tsx +327 -0
- package/src/ImageNodeView.tsx +222 -21
- package/src/ImageViewer.tsx +221 -0
- package/src/InlineIcon.ts +84 -0
- package/src/InlinePreviewGutter.tsx +582 -0
- package/src/LinkDialog.tsx +276 -0
- package/src/MentionExtension.tsx +10 -7
- package/src/OutlinePanel.tsx +295 -0
- package/src/PlainHtmlPreview.tsx +211 -0
- package/src/PreviewControls.tsx +130 -24
- package/src/PreviewPanel.tsx +38 -21
- package/src/RawEditor.tsx +215 -4
- package/src/RecorderEntry.tsx +164 -0
- package/src/TemplateAnnotation.ts +32 -6
- package/src/TemplatePicker.tsx +818 -0
- package/src/ThemeCustomizerPanel.tsx +595 -0
- package/src/ThemePicker.tsx +319 -0
- package/src/Toolbar.tsx +708 -111
- package/src/VersionHistoryPanel.tsx +329 -0
- package/src/ViewMenuPanel.tsx +188 -0
- package/src/WysiwygEditor.tsx +229 -9
- package/src/__tests__/detectMarkdown.test.ts +0 -15
- package/src/__tests__/documentSettingsDialog.test.tsx +147 -0
- package/src/__tests__/emojiPicker.test.tsx +133 -0
- package/src/__tests__/fileKind.test.ts +16 -0
- package/src/__tests__/imageEditAffordance.test.tsx +268 -0
- package/src/__tests__/imageEditorShell.test.tsx +57 -0
- package/src/__tests__/imageEditorState.test.ts +171 -0
- package/src/__tests__/inlinePreviewGutter.test.tsx +62 -0
- package/src/__tests__/inlinePreviewGutterAllBlocks.test.tsx +103 -0
- package/src/__tests__/jsonEditor.test.tsx +168 -0
- package/src/__tests__/layersPanel.test.tsx +97 -0
- package/src/__tests__/linkDialogDocPicker.test.tsx +137 -0
- package/src/__tests__/outlinePanel.test.tsx +79 -0
- package/src/__tests__/plainHtmlPreview.test.tsx +107 -0
- package/src/__tests__/propertiesPanel.test.tsx +69 -0
- package/src/__tests__/recorderFormats.test.ts +146 -0
- package/src/__tests__/recorderTimingJson.test.ts +41 -0
- package/src/__tests__/templateAnnotationRoundTrip.test.ts +34 -0
- package/src/__tests__/tiptapBridge.test.ts +15 -0
- package/src/__tests__/useImageEditor.test.tsx +159 -0
- package/src/__tests__/useMediaRecorder.test.ts +186 -0
- package/src/__tests__/versionHistory.test.tsx +197 -0
- package/src/blockSlice.ts +75 -0
- package/src/buildPreviewDoc.ts +61 -6
- package/src/emojiData.ts +1337 -0
- package/src/fileKind.ts +30 -6
- package/src/hooks/useFileDrop.ts +40 -4
- package/src/imageEditor/CanvasSurface.tsx +402 -0
- package/src/imageEditor/ImageVersionHistoryDropdown.tsx +396 -0
- package/src/imageEditor/LayersPanel.tsx +143 -0
- package/src/imageEditor/PropertiesPanel.tsx +428 -0
- package/src/imageEditor/Toolbar.tsx +242 -0
- package/src/imageEditor/icons.tsx +144 -0
- package/src/imageEditor/image-editor.css +450 -0
- package/src/imageEditor/layers/EditorImageLayer.tsx +45 -0
- package/src/imageEditor/layers/EditorShapeLayer.tsx +62 -0
- package/src/imageEditor/layers/EditorTextLayer.tsx +45 -0
- package/src/imageEditor/layers/SelectionHandles.tsx +86 -0
- package/src/imageEditor/state.ts +153 -0
- package/src/imageEditor/useImageEditor.ts +328 -0
- package/src/imageEditor/useImageEditorTokens.ts +70 -0
- package/src/index.ts +82 -0
- package/src/jsonEditor/EmbeddedRichTextField.tsx +81 -0
- package/src/jsonEditor/JsonEditor.tsx +81 -0
- package/src/jsonEditor/JsonEditorContext.tsx +75 -0
- package/src/jsonEditor/RenderNode.tsx +66 -0
- package/src/jsonEditor/editors.tsx +678 -0
- package/src/jsonEditor/index.ts +2 -0
- package/src/jsonEditor/json-editor.css +463 -0
- package/src/jsonEditor/useJsonEditorTokens.ts +63 -0
- package/src/recorder/RecorderButton.tsx +72 -0
- package/src/recorder/RecorderModal.tsx +596 -0
- package/src/recorder/RecorderPanel.tsx +93 -0
- package/src/recorder/formats.ts +159 -0
- package/src/recorder/hooks/useMediaRecorder.ts +378 -0
- package/src/recorder/hooks/useStreamPreview.ts +47 -0
- package/src/recorder/sources/cameraStream.ts +32 -0
- package/src/recorder/sources/micStream.ts +25 -0
- package/src/recorder/sources/screenStream.ts +162 -0
- package/src/recorder/timingJson.ts +66 -0
- package/src/styles/editor.css +2490 -51
- package/src/styles/image-edit-affordance.css +201 -0
- package/src/styles/index.css +10 -0
- package/src/tiptap/TiptapAudio.tsx +86 -0
- package/src/tiptap/TiptapVideo.tsx +119 -0
- package/src/tiptap/useResolvedMediaSrc.ts +47 -0
- package/src/tiptapBridge.ts +188 -20
- package/src/useHeadingLayout.ts +294 -0
- package/src/utils/collectInlineFontAwesomeCss.ts +69 -0
- package/src/utils/dropUtils.ts +54 -6
- package/src/utils/normalizeMalformedAssetUrl.ts +22 -0
package/src/EditorShell.tsx
CHANGED
|
@@ -6,19 +6,26 @@
|
|
|
6
6
|
* in an EditorProvider for shared state.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { useEffect, useState, useCallback } from 'react';
|
|
9
|
+
import { useEffect, useRef, useState, useCallback, useMemo } from 'react';
|
|
10
10
|
import {
|
|
11
11
|
EditorProvider,
|
|
12
12
|
useEditorContext,
|
|
13
13
|
type EditorView,
|
|
14
14
|
type ImageDisplayMode,
|
|
15
15
|
type MentionProvider,
|
|
16
|
+
type DocumentLinkProvider,
|
|
17
|
+
type ViewPreferences,
|
|
18
|
+
type ThemeInheritance,
|
|
16
19
|
} from './EditorContext';
|
|
17
20
|
import { Toolbar } from './Toolbar';
|
|
18
21
|
import { StatusBar } from './StatusBar';
|
|
19
22
|
import { RawEditor } from './RawEditor';
|
|
20
23
|
import { WysiwygEditor } from './WysiwygEditor';
|
|
24
|
+
import { InlinePreviewGutter } from './InlinePreviewGutter';
|
|
25
|
+
import { OutlinePanel } from './OutlinePanel';
|
|
21
26
|
import { PreviewPanel } from './PreviewPanel';
|
|
27
|
+
import { ImageViewer } from './ImageViewer';
|
|
28
|
+
import { ImageEditor } from './ImageEditor';
|
|
22
29
|
import { PreviewSettingsProvider, PreviewToolbarControls } from './PreviewControls';
|
|
23
30
|
import { MediaBin } from './MediaBin';
|
|
24
31
|
import { DropZoneOverlay } from './DropZoneOverlay';
|
|
@@ -30,8 +37,15 @@ import {
|
|
|
30
37
|
processTextFile,
|
|
31
38
|
processTextFiles,
|
|
32
39
|
} from './utils/dropUtils';
|
|
33
|
-
import type { MediaProvider } from '@bendyline/squisq/schemas';
|
|
40
|
+
import type { MediaProvider, Theme } from '@bendyline/squisq/schemas';
|
|
41
|
+
import { DARK_SURFACE, LIGHT_SURFACE } from '@bendyline/squisq/schemas';
|
|
34
42
|
import type { ContentContainer } from '@bendyline/squisq/storage';
|
|
43
|
+
import {
|
|
44
|
+
MemoryContentContainer,
|
|
45
|
+
scopeContainer,
|
|
46
|
+
createMediaProviderFromContainer,
|
|
47
|
+
} from '@bendyline/squisq/storage';
|
|
48
|
+
import type { PrunePolicy, SaveVersionResult } from '@bendyline/squisq/versions';
|
|
35
49
|
import type { CSSProperties, ReactNode } from 'react';
|
|
36
50
|
|
|
37
51
|
export type { EditorTheme } from './EditorContext';
|
|
@@ -67,8 +81,61 @@ export interface EditorShellProps {
|
|
|
67
81
|
maxHeight?: string;
|
|
68
82
|
/** Optional MediaProvider for the Files panel. When set (even to null), a Files toggle appears in the toolbar. */
|
|
69
83
|
mediaProvider?: MediaProvider | null;
|
|
70
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* The workspace-scoped `ContentContainer` for this document — the
|
|
86
|
+
* folder that contains the doc, its `_files/` sidecar, sibling
|
|
87
|
+
* documents, and any version snapshots. Used for:
|
|
88
|
+
* - audio mapping (MP3 discovery + timing.json reading);
|
|
89
|
+
* - version history snapshots (when `allowVersioning` is true);
|
|
90
|
+
* - reading sibling `.md` files for the recursive HTML export;
|
|
91
|
+
* - resolving per-document scoped views (e.g. the image-edit
|
|
92
|
+
* sidecar derived via `scopeContainer`).
|
|
93
|
+
* Doc-scoped concerns (per-doc media URLs, per-doc asset writes)
|
|
94
|
+
* flow through `mediaProvider` instead — typically derived from
|
|
95
|
+
* this container via `createMediaProviderFromContainer`.
|
|
96
|
+
*/
|
|
97
|
+
workspaceContainer?: ContentContainer | null;
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated Renamed to `workspaceContainer` to make the workspace-
|
|
100
|
+
* vs. doc-scoped distinction explicit. Still accepted as a fallback
|
|
101
|
+
* for now; remove in the next breaking release.
|
|
102
|
+
*/
|
|
71
103
|
container?: ContentContainer | null;
|
|
104
|
+
/**
|
|
105
|
+
* Enable version history. Snapshots are stored at
|
|
106
|
+
* `.versions/<basename>.<timestamp>.md` inside the same
|
|
107
|
+
* `workspaceContainer`, so they ride along with the document when
|
|
108
|
+
* the host serializes.
|
|
109
|
+
*
|
|
110
|
+
* Snapshots fire on idle (controlled by `versioningAutoSaveIdleMs`)
|
|
111
|
+
* and can also be triggered host-side via the manager exposed in the
|
|
112
|
+
* context (`useEditorContext().versioning`). Has no effect without a
|
|
113
|
+
* `workspaceContainer` — a `console.warn` flags the misconfiguration
|
|
114
|
+
* in dev.
|
|
115
|
+
*/
|
|
116
|
+
allowVersioning?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Override the document basename used in version filenames. Defaults
|
|
119
|
+
* to the basename of the container's primary document path.
|
|
120
|
+
*/
|
|
121
|
+
versionBasename?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Prune policy applied after each successful save. Defaults to
|
|
124
|
+
* `{ type: 'keep-last-n', n: 50 }` so the snapshot count stays bounded.
|
|
125
|
+
*/
|
|
126
|
+
versioningPrunePolicy?: PrunePolicy;
|
|
127
|
+
/**
|
|
128
|
+
* Idle delay (ms) before the editor auto-saves a version. `0` disables
|
|
129
|
+
* auto-save entirely (snapshots are then only saved when the host
|
|
130
|
+
* calls `versioning.saveVersion()` from the context). Default: 5000.
|
|
131
|
+
*/
|
|
132
|
+
versioningAutoSaveIdleMs?: number;
|
|
133
|
+
/**
|
|
134
|
+
* Notified after each `saveVersion` attempt. Fires for both successful
|
|
135
|
+
* saves (`reason: 'saved'`) and skips (`'unchanged'`, `'no-document'`,
|
|
136
|
+
* `'empty'`). Useful for hosts that want a "Last saved" indicator.
|
|
137
|
+
*/
|
|
138
|
+
onSaveVersion?: (result: SaveVersionResult) => void;
|
|
72
139
|
/** Show the Files toggle in the toolbar. Defaults to true when mediaProvider is passed. */
|
|
73
140
|
showFilesToggle?: boolean;
|
|
74
141
|
/** Content rendered at the left edge of the toolbar, before the view tabs. */
|
|
@@ -160,6 +227,24 @@ export interface EditorShellProps {
|
|
|
160
227
|
* inline. Omit to disable mentions entirely.
|
|
161
228
|
*/
|
|
162
229
|
mentionProvider?: MentionProvider | null;
|
|
230
|
+
/**
|
|
231
|
+
* Optional async provider for sibling-document suggestions in the
|
|
232
|
+
* link insert dialog. When supplied, the dialog gains a "Browse
|
|
233
|
+
* documents" picker so authors can pick a neighbor `.md` by name and
|
|
234
|
+
* insert a relative-path link without typing the URL by hand. Hosts
|
|
235
|
+
* that organize docs in a workspace (file-system, IndexedDB slot,
|
|
236
|
+
* remote API, …) implement this; the editor stays agnostic.
|
|
237
|
+
*/
|
|
238
|
+
documentLinkProvider?: DocumentLinkProvider | null;
|
|
239
|
+
/**
|
|
240
|
+
* Whether the in-editor media recorder is surfaced in the toolbar.
|
|
241
|
+
* Defaults to true — when a `mediaProvider` is wired, a record
|
|
242
|
+
* button appears next to the version history. Pass `false` to
|
|
243
|
+
* suppress it (read-only embeds, surfaces where camera/screen
|
|
244
|
+
* permission prompts would be jarring). Without a `mediaProvider`,
|
|
245
|
+
* the button is hidden regardless of this prop.
|
|
246
|
+
*/
|
|
247
|
+
allowRecording?: boolean;
|
|
163
248
|
/**
|
|
164
249
|
* Placeholder text shown in the WYSIWYG editor while the document is
|
|
165
250
|
* empty. When omitted, the editor rotates through its own generic
|
|
@@ -176,6 +261,103 @@ export interface EditorShellProps {
|
|
|
176
261
|
* accidental edits.
|
|
177
262
|
*/
|
|
178
263
|
readOnly?: boolean;
|
|
264
|
+
/**
|
|
265
|
+
* Image source URL used when the resolved file mode is `image` (PNG,
|
|
266
|
+
* JPEG, GIF, WebP, BMP, ICO, AVIF). When this prop is set, the shell
|
|
267
|
+
* replaces its text-editing surfaces with a dedicated `ImageViewer`.
|
|
268
|
+
*
|
|
269
|
+
* Lifecycle of the URL is the caller's responsibility — when fed a
|
|
270
|
+
* `blob:` URL, the host should `URL.revokeObjectURL` on unmount or
|
|
271
|
+
* src change.
|
|
272
|
+
*/
|
|
273
|
+
imageSrc?: string;
|
|
274
|
+
/** Alt text passed through to the underlying ImageViewer. */
|
|
275
|
+
imageAlt?: string;
|
|
276
|
+
/**
|
|
277
|
+
* Whether the image surface should render as a read-only viewer
|
|
278
|
+
* (`'view'`, default) or as the editable {@link ImageEditor}
|
|
279
|
+
* (`'edit'`). Editing requires {@link EditorShellProps.imageEditorContainer}
|
|
280
|
+
* — without it the shell falls back to view mode and logs a warning.
|
|
281
|
+
*/
|
|
282
|
+
imageMode?: 'view' | 'edit';
|
|
283
|
+
/**
|
|
284
|
+
* Sidecar `ContentContainer` for the image being edited. Conventionally
|
|
285
|
+
* scoped to `<basename>_files/` via
|
|
286
|
+
* `scopeContainer(parentContainer, basename + '_files')`. The image
|
|
287
|
+
* editor persists `state.json`, layer assets in `assets/`, and (when
|
|
288
|
+
* `allowVersioning` is true) snapshots in `.versions/` inside it.
|
|
289
|
+
*/
|
|
290
|
+
imageEditorContainer?: ContentContainer;
|
|
291
|
+
/**
|
|
292
|
+
* Called after the user clicks Export in the image editor and the
|
|
293
|
+
* raster blob is produced. When omitted, the editor triggers a
|
|
294
|
+
* default browser download.
|
|
295
|
+
*/
|
|
296
|
+
onImageExport?: (blob: Blob, format: 'png' | 'jpeg' | 'webp') => void;
|
|
297
|
+
/**
|
|
298
|
+
* Show an inline preview gutter to the right of the WYSIWYG editor.
|
|
299
|
+
* The gutter renders one small SVG card per template-annotated block in
|
|
300
|
+
* the document, letting authors see their rendered output without
|
|
301
|
+
* leaving Edit mode. Auto-hidden via container query when the editor
|
|
302
|
+
* body is narrower than ~720px. Defaults to `false`.
|
|
303
|
+
*/
|
|
304
|
+
inlinePreview?: boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Width in pixels for the inline preview gutter. Defaults to 320.
|
|
307
|
+
* Only takes effect when {@link EditorShellProps.inlinePreview} is true.
|
|
308
|
+
*/
|
|
309
|
+
inlinePreviewWidth?: number;
|
|
310
|
+
/**
|
|
311
|
+
* Show an outline pane on the left of the WYSIWYG editor — a
|
|
312
|
+
* hierarchical tree of the document's headings (h1 → h2 → h3) with
|
|
313
|
+
* click-to-scroll. Auto-hidden via container query on narrow editors.
|
|
314
|
+
* Defaults to `false`. The toolbar's View menu can toggle this at
|
|
315
|
+
* runtime regardless of the initial value.
|
|
316
|
+
*/
|
|
317
|
+
outline?: boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Width in pixels for the outline pane. Defaults to 240. Only takes
|
|
320
|
+
* effect when {@link EditorShellProps.outline} is true (or the View
|
|
321
|
+
* menu has toggled it on).
|
|
322
|
+
*/
|
|
323
|
+
outlineWidth?: number;
|
|
324
|
+
/**
|
|
325
|
+
* Initial visibility of inline block-template tags on headings — the
|
|
326
|
+
* chip rendered next to each heading in the WYSIWYG view that opens
|
|
327
|
+
* the block-template picker. Defaults to true; the View menu can
|
|
328
|
+
* toggle it at runtime regardless of the initial value.
|
|
329
|
+
*/
|
|
330
|
+
blockTags?: boolean;
|
|
331
|
+
/**
|
|
332
|
+
* How much of the active Squisq theme the WYSIWYG editing surface
|
|
333
|
+
* mirrors. Defaults to `'fonts'` — the historical behavior of
|
|
334
|
+
* inheriting body / heading fonts only. The View menu can change it
|
|
335
|
+
* at runtime.
|
|
336
|
+
*/
|
|
337
|
+
themeInheritance?: ThemeInheritance;
|
|
338
|
+
/**
|
|
339
|
+
* Bundled view preferences — a serializable JSON blob covering the
|
|
340
|
+
* runtime-toggleable view options surfaced in the View menu. When
|
|
341
|
+
* provided, fields here override the corresponding individual props
|
|
342
|
+
* (`outline`, `inlinePreview`, `showStatusBar`). Pair with
|
|
343
|
+
* {@link onViewPreferencesChange} to externalize storage of these
|
|
344
|
+
* preferences in the host.
|
|
345
|
+
*/
|
|
346
|
+
viewPreferences?: ViewPreferences;
|
|
347
|
+
/**
|
|
348
|
+
* Notified after each user-driven toggle in the View menu. The
|
|
349
|
+
* argument is a full snapshot of all view preferences — hosts can
|
|
350
|
+
* persist it as-is. Not called when {@link viewPreferences} is
|
|
351
|
+
* changed externally.
|
|
352
|
+
*/
|
|
353
|
+
onViewPreferencesChange?: (prefs: ViewPreferences) => void;
|
|
354
|
+
/**
|
|
355
|
+
* Override the preview theme with an explicit `Theme` object. When set,
|
|
356
|
+
* `Doc.themeId` and the user's theme dropdown selection are ignored for
|
|
357
|
+
* the preview surface. Used by the theme customizer to live-preview an
|
|
358
|
+
* in-progress theme without mutating the document.
|
|
359
|
+
*/
|
|
360
|
+
themeOverride?: Theme | null;
|
|
179
361
|
}
|
|
180
362
|
|
|
181
363
|
/**
|
|
@@ -194,7 +376,13 @@ export function EditorShell({
|
|
|
194
376
|
minHeight,
|
|
195
377
|
maxHeight,
|
|
196
378
|
mediaProvider,
|
|
379
|
+
workspaceContainer,
|
|
197
380
|
container,
|
|
381
|
+
allowVersioning = false,
|
|
382
|
+
versionBasename,
|
|
383
|
+
versioningPrunePolicy,
|
|
384
|
+
versioningAutoSaveIdleMs,
|
|
385
|
+
onSaveVersion,
|
|
198
386
|
showFilesToggle,
|
|
199
387
|
toolbarSlotLeft,
|
|
200
388
|
toolbarSlotAfterActions,
|
|
@@ -209,11 +397,39 @@ export function EditorShell({
|
|
|
209
397
|
fileName,
|
|
210
398
|
language,
|
|
211
399
|
mentionProvider,
|
|
400
|
+
documentLinkProvider,
|
|
401
|
+
allowRecording = true,
|
|
212
402
|
placeholder,
|
|
213
403
|
readOnly = false,
|
|
404
|
+
imageSrc,
|
|
405
|
+
imageAlt,
|
|
406
|
+
imageMode = 'view',
|
|
407
|
+
imageEditorContainer,
|
|
408
|
+
onImageExport,
|
|
409
|
+
inlinePreview = false,
|
|
410
|
+
inlinePreviewWidth = 320,
|
|
411
|
+
outline = false,
|
|
412
|
+
outlineWidth = 240,
|
|
413
|
+
blockTags = true,
|
|
414
|
+
themeInheritance = 'fonts',
|
|
415
|
+
viewPreferences,
|
|
416
|
+
onViewPreferencesChange,
|
|
417
|
+
themeOverride = null,
|
|
214
418
|
}: EditorShellProps) {
|
|
419
|
+
const effectiveContainer = workspaceContainer ?? container ?? null;
|
|
420
|
+
|
|
421
|
+
// If the host gave us a `workspaceContainer` but no explicit `mediaProvider`,
|
|
422
|
+
// derive one automatically. Without this, drag-and-drop of an image
|
|
423
|
+
// into the editor silently failed (no provider \u2192 nothing to upload to)
|
|
424
|
+
// even though we had a perfectly good ContentContainer to write into.
|
|
425
|
+
const effectiveMediaProvider = useMemo<MediaProvider | null | undefined>(() => {
|
|
426
|
+
if (mediaProvider !== undefined) return mediaProvider;
|
|
427
|
+
if (effectiveContainer) return createMediaProviderFromContainer(effectiveContainer);
|
|
428
|
+
return undefined;
|
|
429
|
+
}, [mediaProvider, effectiveContainer]);
|
|
430
|
+
|
|
215
431
|
// Show the toggle when explicitly opted in, or when mediaProvider prop was passed at all
|
|
216
|
-
const filesToggleEnabled = showFilesToggle ??
|
|
432
|
+
const filesToggleEnabled = showFilesToggle ?? effectiveMediaProvider !== undefined;
|
|
217
433
|
|
|
218
434
|
// If the host hides the Play tab but asked for it as the initial view,
|
|
219
435
|
// fall back to wysiwyg so we don't boot into a tab the user can't leave.
|
|
@@ -226,11 +442,26 @@ export function EditorShell({
|
|
|
226
442
|
initialView={effectiveInitialView}
|
|
227
443
|
articleId={articleId}
|
|
228
444
|
theme={theme}
|
|
229
|
-
|
|
445
|
+
workspaceContainer={effectiveContainer}
|
|
446
|
+
allowVersioning={allowVersioning}
|
|
447
|
+
versionBasename={versionBasename}
|
|
448
|
+
versioningPrunePolicy={versioningPrunePolicy}
|
|
449
|
+
versioningAutoSaveIdleMs={versioningAutoSaveIdleMs}
|
|
450
|
+
onSaveVersion={onSaveVersion}
|
|
451
|
+
mediaProvider={effectiveMediaProvider}
|
|
230
452
|
imageDisplayMode={imageDisplayMode}
|
|
231
453
|
mentionProvider={mentionProvider}
|
|
454
|
+
documentLinkProvider={documentLinkProvider}
|
|
455
|
+
allowRecording={allowRecording}
|
|
232
456
|
fileName={fileName}
|
|
233
457
|
language={language}
|
|
458
|
+
inlinePreview={inlinePreview}
|
|
459
|
+
showStatusBar={showStatusBar}
|
|
460
|
+
outline={outline}
|
|
461
|
+
blockTags={blockTags}
|
|
462
|
+
themeInheritance={themeInheritance}
|
|
463
|
+
viewPreferences={viewPreferences}
|
|
464
|
+
onViewPreferencesChange={onViewPreferencesChange}
|
|
234
465
|
>
|
|
235
466
|
<EditorShellInner
|
|
236
467
|
basePath={basePath}
|
|
@@ -240,8 +471,8 @@ export function EditorShell({
|
|
|
240
471
|
minHeight={minHeight}
|
|
241
472
|
maxHeight={maxHeight}
|
|
242
473
|
placeholder={placeholder}
|
|
243
|
-
mediaProvider={
|
|
244
|
-
|
|
474
|
+
mediaProvider={effectiveMediaProvider ?? null}
|
|
475
|
+
workspaceContainer={effectiveContainer}
|
|
245
476
|
filesToggleEnabled={filesToggleEnabled}
|
|
246
477
|
toolbarSlotLeft={toolbarSlotLeft}
|
|
247
478
|
toolbarSlotAfterActions={toolbarSlotAfterActions}
|
|
@@ -251,8 +482,17 @@ export function EditorShell({
|
|
|
251
482
|
fullWidth={fullWidth}
|
|
252
483
|
uxFont={uxFont}
|
|
253
484
|
thinMargins={thinMargins}
|
|
254
|
-
showStatusBar={showStatusBar}
|
|
255
485
|
readOnly={readOnly}
|
|
486
|
+
imageSrc={imageSrc}
|
|
487
|
+
imageAlt={imageAlt}
|
|
488
|
+
imageMode={imageMode}
|
|
489
|
+
imageEditorContainer={imageEditorContainer}
|
|
490
|
+
onImageExport={onImageExport}
|
|
491
|
+
allowVersioning={allowVersioning}
|
|
492
|
+
versioningAutoSaveIdleMs={versioningAutoSaveIdleMs}
|
|
493
|
+
inlinePreviewWidth={inlinePreviewWidth}
|
|
494
|
+
outlineWidth={outlineWidth}
|
|
495
|
+
themeOverride={themeOverride}
|
|
256
496
|
/>
|
|
257
497
|
</EditorProvider>
|
|
258
498
|
);
|
|
@@ -267,7 +507,7 @@ interface EditorShellInnerProps {
|
|
|
267
507
|
maxHeight?: string;
|
|
268
508
|
placeholder?: string;
|
|
269
509
|
mediaProvider: MediaProvider | null;
|
|
270
|
-
|
|
510
|
+
workspaceContainer?: ContentContainer | null;
|
|
271
511
|
filesToggleEnabled: boolean;
|
|
272
512
|
toolbarSlotLeft?: ReactNode;
|
|
273
513
|
toolbarSlotAfterActions?: ReactNode;
|
|
@@ -277,8 +517,17 @@ interface EditorShellInnerProps {
|
|
|
277
517
|
fullWidth: boolean;
|
|
278
518
|
uxFont?: string;
|
|
279
519
|
thinMargins: boolean;
|
|
280
|
-
showStatusBar: boolean;
|
|
281
520
|
readOnly: boolean;
|
|
521
|
+
imageSrc?: string;
|
|
522
|
+
imageAlt?: string;
|
|
523
|
+
imageMode: 'view' | 'edit';
|
|
524
|
+
imageEditorContainer?: ContentContainer;
|
|
525
|
+
onImageExport?: (blob: Blob, format: 'png' | 'jpeg' | 'webp') => void;
|
|
526
|
+
allowVersioning: boolean;
|
|
527
|
+
versioningAutoSaveIdleMs?: number;
|
|
528
|
+
inlinePreviewWidth: number;
|
|
529
|
+
outlineWidth: number;
|
|
530
|
+
themeOverride: Theme | null;
|
|
282
531
|
}
|
|
283
532
|
|
|
284
533
|
function EditorShellInner({
|
|
@@ -290,7 +539,7 @@ function EditorShellInner({
|
|
|
290
539
|
maxHeight,
|
|
291
540
|
placeholder,
|
|
292
541
|
mediaProvider,
|
|
293
|
-
|
|
542
|
+
workspaceContainer,
|
|
294
543
|
filesToggleEnabled,
|
|
295
544
|
toolbarSlotLeft,
|
|
296
545
|
toolbarSlotAfterActions,
|
|
@@ -300,8 +549,17 @@ function EditorShellInner({
|
|
|
300
549
|
fullWidth,
|
|
301
550
|
uxFont,
|
|
302
551
|
thinMargins,
|
|
303
|
-
showStatusBar,
|
|
304
552
|
readOnly,
|
|
553
|
+
imageSrc,
|
|
554
|
+
imageAlt,
|
|
555
|
+
imageMode,
|
|
556
|
+
imageEditorContainer,
|
|
557
|
+
onImageExport,
|
|
558
|
+
allowVersioning,
|
|
559
|
+
versioningAutoSaveIdleMs,
|
|
560
|
+
inlinePreviewWidth,
|
|
561
|
+
outlineWidth,
|
|
562
|
+
themeOverride,
|
|
305
563
|
}: EditorShellInnerProps) {
|
|
306
564
|
const {
|
|
307
565
|
activeView,
|
|
@@ -314,11 +572,29 @@ function EditorShellInner({
|
|
|
314
572
|
tiptapEditor,
|
|
315
573
|
monacoEditor,
|
|
316
574
|
setMarkdownSource,
|
|
575
|
+
inlinePreviewVisible,
|
|
576
|
+
statusBarVisible,
|
|
577
|
+
outlineVisible,
|
|
578
|
+
imageEditTarget,
|
|
579
|
+
closeImageEdit,
|
|
580
|
+
bumpMediaRevision,
|
|
317
581
|
} = useEditorContext();
|
|
318
582
|
const isPreview = activeView === 'preview';
|
|
319
583
|
const isCodeMode = editorMode === 'code';
|
|
584
|
+
const isImageMode = editorMode === 'image';
|
|
585
|
+
const isMarkdownMode = editorMode === 'markdown';
|
|
320
586
|
const [showFiles, setShowFiles] = useState(false);
|
|
321
587
|
const [mediaRefreshKey, setMediaRefreshKey] = useState(0);
|
|
588
|
+
// Persistent fallback container for image-edit sidecars when the host
|
|
589
|
+
// didn't supply one. Lifted to shell scope so opening the same image
|
|
590
|
+
// multiple times sees the same `.imageEdits/<sanitized>/.versions/...`
|
|
591
|
+
// snapshots — otherwise each modal mount would start from an empty
|
|
592
|
+
// in-memory container and history would vanish on close.
|
|
593
|
+
const imageEditFallbackContainerRef = useRef<MemoryContentContainer | null>(null);
|
|
594
|
+
if (imageEditFallbackContainerRef.current === null) {
|
|
595
|
+
imageEditFallbackContainerRef.current = new MemoryContentContainer();
|
|
596
|
+
}
|
|
597
|
+
const imageEditFallbackContainer = imageEditFallbackContainerRef.current;
|
|
322
598
|
const isDark = theme === 'dark';
|
|
323
599
|
|
|
324
600
|
const handleToggleFiles = useCallback(() => {
|
|
@@ -463,6 +739,7 @@ function EditorShellInner({
|
|
|
463
739
|
data-theme={theme}
|
|
464
740
|
data-full-width={fullWidth ? 'true' : undefined}
|
|
465
741
|
data-thin-margins={thinMargins ? 'true' : undefined}
|
|
742
|
+
data-outline-visible={isMarkdownMode && outlineVisible ? 'true' : undefined}
|
|
466
743
|
style={{
|
|
467
744
|
display: 'flex',
|
|
468
745
|
flexDirection: 'column',
|
|
@@ -473,26 +750,45 @@ function EditorShellInner({
|
|
|
473
750
|
// tabs, status bar) consume `--squisq-ux-font` as their
|
|
474
751
|
// `font-family`, falling back to the system stack when unset.
|
|
475
752
|
...(uxFont ? ({ '--squisq-ux-font': uxFont } as CSSProperties) : {}),
|
|
753
|
+
// Exposed so the toolbar's view-tabs section can match the outline
|
|
754
|
+
// pane's width, lining up its right-edge separator with the
|
|
755
|
+
// outline's right edge. The variable is set unconditionally so the
|
|
756
|
+
// outline pane itself can also read it if needed; the
|
|
757
|
+
// `data-outline-visible` gate above keeps the toolbar override
|
|
758
|
+
// scoped to the case where alignment matters.
|
|
759
|
+
...({ '--squisq-outline-width': `${outlineWidth}px` } as CSSProperties),
|
|
476
760
|
}}
|
|
477
761
|
{...containerProps}
|
|
478
762
|
>
|
|
479
|
-
<PreviewSettingsProvider doc={doc}>
|
|
480
|
-
{/* Header
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
763
|
+
<PreviewSettingsProvider doc={doc} themeOverride={themeOverride}>
|
|
764
|
+
{/* Header. In image mode the full markdown/code Toolbar is replaced
|
|
765
|
+
with a minimal slot bar — view tabs, formatting, and preview
|
|
766
|
+
controls don't apply to a binary asset. */}
|
|
767
|
+
{isImageMode ? (
|
|
768
|
+
(toolbarSlotLeft || toolbarSlotRight) && (
|
|
769
|
+
<div className="squisq-editor-header squisq-editor-header--image">
|
|
770
|
+
{toolbarSlotLeft}
|
|
771
|
+
<div style={{ flex: 1 }} />
|
|
772
|
+
{toolbarSlotRight}
|
|
773
|
+
</div>
|
|
774
|
+
)
|
|
775
|
+
) : (
|
|
776
|
+
<div className="squisq-editor-header">
|
|
777
|
+
<Toolbar
|
|
778
|
+
showFiles={showFiles}
|
|
779
|
+
onToggleFiles={!isCodeMode && filesToggleEnabled ? handleToggleFiles : undefined}
|
|
780
|
+
slotLeft={toolbarSlotLeft}
|
|
781
|
+
slotAfterActions={
|
|
782
|
+
<>
|
|
783
|
+
{toolbarSlotAfterActions}
|
|
784
|
+
{!isCodeMode && isPreview && <PreviewToolbarControls />}
|
|
785
|
+
</>
|
|
786
|
+
}
|
|
787
|
+
slotRight={toolbarSlotRight}
|
|
788
|
+
showPlayTab={showPlayTab}
|
|
789
|
+
/>
|
|
790
|
+
</div>
|
|
791
|
+
)}
|
|
496
792
|
|
|
497
793
|
{/* Main content area */}
|
|
498
794
|
<div
|
|
@@ -514,27 +810,76 @@ function EditorShellInner({
|
|
|
514
810
|
position: 'relative',
|
|
515
811
|
}}
|
|
516
812
|
>
|
|
517
|
-
{
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
813
|
+
{isImageMode &&
|
|
814
|
+
imageSrc &&
|
|
815
|
+
(imageMode === 'edit' && imageEditorContainer ? (
|
|
816
|
+
<ImageEditor
|
|
817
|
+
filesContainer={imageEditorContainer}
|
|
818
|
+
initialSrc={imageSrc}
|
|
819
|
+
allowVersioning={allowVersioning}
|
|
820
|
+
versioningAutoSaveIdleMs={versioningAutoSaveIdleMs}
|
|
821
|
+
onExport={onImageExport}
|
|
822
|
+
/>
|
|
823
|
+
) : (
|
|
824
|
+
<ImageViewer src={imageSrc} alt={imageAlt} theme={theme} />
|
|
825
|
+
))}
|
|
826
|
+
{/* Raw (Monaco) view. Always wrapped in `.squisq-editor-with-gutter`
|
|
827
|
+
so toggling a pane on/off doesn't change the editor's tree
|
|
828
|
+
position — Monaco stays mounted and `monacoEditor` in
|
|
829
|
+
context stays stable, which is what `useHeadingLayout` needs
|
|
830
|
+
to compute positions. */}
|
|
831
|
+
{!isImageMode && activeView === 'raw' && (
|
|
832
|
+
<div className="squisq-editor-with-gutter" key="raw-shell">
|
|
833
|
+
{isMarkdownMode && outlineVisible && (
|
|
834
|
+
<OutlinePanel key="outline" width={outlineWidth} />
|
|
835
|
+
)}
|
|
836
|
+
<div key="raw-editor" className="squisq-raw-editor-container">
|
|
837
|
+
<RawEditor
|
|
838
|
+
theme={theme === 'dark' ? 'vs-dark' : 'vs'}
|
|
839
|
+
submitOnEnter={submitOnEnter}
|
|
840
|
+
readOnly={readOnly}
|
|
841
|
+
/>
|
|
842
|
+
</div>
|
|
843
|
+
{isMarkdownMode && inlinePreviewVisible && (
|
|
844
|
+
<InlinePreviewGutter
|
|
845
|
+
key="inline"
|
|
846
|
+
width={inlinePreviewWidth}
|
|
847
|
+
basePath={basePath}
|
|
848
|
+
mediaProvider={mediaProvider}
|
|
849
|
+
/>
|
|
850
|
+
)}
|
|
851
|
+
</div>
|
|
523
852
|
)}
|
|
524
853
|
{/* WYSIWYG + Preview are markdown-only surfaces — skip them
|
|
525
|
-
entirely in code mode so Tiptap never initializes
|
|
526
|
-
preview pipeline stays idle.
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
854
|
+
entirely in code or image mode so Tiptap never initializes
|
|
855
|
+
and the preview pipeline stays idle. Same always-wrapped
|
|
856
|
+
pattern as the Raw branch above so pane toggles don't
|
|
857
|
+
remount Tiptap. */}
|
|
858
|
+
{isMarkdownMode && activeView === 'wysiwyg' && (
|
|
859
|
+
<div className="squisq-editor-with-gutter" key="wysiwyg-shell">
|
|
860
|
+
{outlineVisible && <OutlinePanel key="outline" width={outlineWidth} />}
|
|
861
|
+
<WysiwygEditor
|
|
862
|
+
key="wysiwyg-editor"
|
|
863
|
+
submitOnEnter={submitOnEnter}
|
|
864
|
+
placeholder={placeholder}
|
|
865
|
+
readOnly={readOnly}
|
|
866
|
+
/>
|
|
867
|
+
{inlinePreviewVisible && (
|
|
868
|
+
<InlinePreviewGutter
|
|
869
|
+
key="inline"
|
|
870
|
+
width={inlinePreviewWidth}
|
|
871
|
+
basePath={basePath}
|
|
872
|
+
mediaProvider={mediaProvider}
|
|
873
|
+
/>
|
|
874
|
+
)}
|
|
875
|
+
</div>
|
|
876
|
+
)}
|
|
877
|
+
{isMarkdownMode && isPreview && (
|
|
878
|
+
<PreviewPanel basePath={basePath} workspaceContainer={workspaceContainer} />
|
|
533
879
|
)}
|
|
534
|
-
{!isCodeMode && isPreview && <PreviewPanel basePath={basePath} container={container} />}
|
|
535
880
|
</div>
|
|
536
881
|
|
|
537
|
-
{
|
|
882
|
+
{isMarkdownMode && showFiles && (
|
|
538
883
|
<MediaBin
|
|
539
884
|
mediaProvider={mediaProvider}
|
|
540
885
|
isDark={isDark}
|
|
@@ -543,22 +888,193 @@ function EditorShellInner({
|
|
|
543
888
|
/>
|
|
544
889
|
)}
|
|
545
890
|
|
|
546
|
-
{/* Drop zone overlay — image / text drop UX is markdown-specific.
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
891
|
+
{/* Drop zone overlay — image / text drop UX is markdown-specific.
|
|
892
|
+
In WYSIWYG, image drops are handled directly by Tiptap's
|
|
893
|
+
`handleDrop` (uploads to the MediaProvider and inserts an
|
|
894
|
+
image node at the mouse position). The overlay would sit on
|
|
895
|
+
top with z-index: 50 and intercept the drop, so we skip it
|
|
896
|
+
when the dragged content is media-only on the WYSIWYG view —
|
|
897
|
+
the user gets a one-step "drop where you want it" flow
|
|
898
|
+
instead of a two-step "drop in bin, then insert" flow. */}
|
|
899
|
+
{isMarkdownMode &&
|
|
900
|
+
isDragging &&
|
|
901
|
+
!(activeView === 'wysiwyg' && dragContentType === 'media') && (
|
|
902
|
+
<DropZoneOverlay
|
|
903
|
+
dragContentType={dragContentType}
|
|
904
|
+
zoneProps={zoneProps}
|
|
905
|
+
hasMediaProvider={mediaProvider !== null}
|
|
906
|
+
/>
|
|
907
|
+
)}
|
|
554
908
|
</div>
|
|
555
909
|
|
|
556
910
|
{/* Status bar — word / char / line / block counts. Host can
|
|
557
911
|
suppress via `showStatusBar={false}` for embedded chat-style
|
|
558
|
-
composers where the stats are noise.
|
|
559
|
-
|
|
912
|
+
composers where the stats are noise. The image viewer has its
|
|
913
|
+
own dimension/zoom status row, so suppress here too. */}
|
|
914
|
+
{statusBarVisible && !isImageMode && <StatusBar />}
|
|
560
915
|
</PreviewSettingsProvider>
|
|
561
916
|
<TooltipLayer />
|
|
917
|
+
{imageEditTarget !== null && mediaProvider && (
|
|
918
|
+
<ImageEditModal
|
|
919
|
+
relativePath={imageEditTarget}
|
|
920
|
+
container={workspaceContainer ?? imageEditFallbackContainer}
|
|
921
|
+
mediaProvider={mediaProvider}
|
|
922
|
+
onClose={closeImageEdit}
|
|
923
|
+
onSaved={() => {
|
|
924
|
+
bumpMediaRevision();
|
|
925
|
+
closeImageEdit();
|
|
926
|
+
}}
|
|
927
|
+
allowVersioning={allowVersioning}
|
|
928
|
+
versioningAutoSaveIdleMs={versioningAutoSaveIdleMs}
|
|
929
|
+
shellTheme={theme}
|
|
930
|
+
/>
|
|
931
|
+
)}
|
|
932
|
+
</div>
|
|
933
|
+
);
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
// ─── ImageEditModal ────────────────────────────────────────
|
|
937
|
+
|
|
938
|
+
interface ImageEditModalProps {
|
|
939
|
+
relativePath: string;
|
|
940
|
+
/**
|
|
941
|
+
* Host's `ContentContainer`. When non-null the editor's per-image
|
|
942
|
+
* sidecar is scoped underneath it as `.imageEdits/<sanitized>/` so
|
|
943
|
+
* version snapshots travel with the doc. When null (host wired only a
|
|
944
|
+
* `mediaProvider`) the modal creates a fresh in-memory container for
|
|
945
|
+
* the edit session — export still writes the result back through
|
|
946
|
+
* `mediaProvider`.
|
|
947
|
+
*/
|
|
948
|
+
container: ContentContainer | null;
|
|
949
|
+
mediaProvider: MediaProvider;
|
|
950
|
+
onClose: () => void;
|
|
951
|
+
onSaved: () => void;
|
|
952
|
+
allowVersioning: boolean;
|
|
953
|
+
versioningAutoSaveIdleMs?: number;
|
|
954
|
+
/** EditorShell's `theme` prop — 'light' or 'dark'. Threaded through so
|
|
955
|
+
* the image editor chrome matches the host shell. */
|
|
956
|
+
shellTheme?: 'light' | 'dark';
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
/**
|
|
960
|
+
* Modal overlay that mounts a full `<ImageEditor>` against a sidecar
|
|
961
|
+
* container scoped under `.imageEdits/<sanitized-path>/` of the document's
|
|
962
|
+
* `ContentContainer`. Opens when a user clicks the "Edit" affordance on an
|
|
963
|
+
* image in the WYSIWYG view; on Export, rewrites the original image bytes
|
|
964
|
+
* via `mediaProvider.addMedia(relativePath, blob, mime)` and bumps
|
|
965
|
+
* `mediaRevision` so live `<img>` nodes pick up the new content.
|
|
966
|
+
*/
|
|
967
|
+
function ImageEditModal({
|
|
968
|
+
relativePath,
|
|
969
|
+
container,
|
|
970
|
+
mediaProvider,
|
|
971
|
+
onClose,
|
|
972
|
+
onSaved,
|
|
973
|
+
allowVersioning,
|
|
974
|
+
versioningAutoSaveIdleMs,
|
|
975
|
+
shellTheme,
|
|
976
|
+
}: ImageEditModalProps) {
|
|
977
|
+
// Each unique image path gets its own sidecar so multiple images in the
|
|
978
|
+
// same doc can be edited independently without colliding state. When the
|
|
979
|
+
// host didn't supply a `container`, fall back to a fresh in-memory one
|
|
980
|
+
// — the edit session is transient anyway and the final raster is what
|
|
981
|
+
// gets written back through `mediaProvider`.
|
|
982
|
+
const sidecar = useMemo(() => {
|
|
983
|
+
const sanitized = relativePath.replace(/[^a-zA-Z0-9._-]+/g, '_');
|
|
984
|
+
const parent: ContentContainer = container ?? new MemoryContentContainer();
|
|
985
|
+
return scopeContainer(parent, `.imageEdits/${sanitized}`);
|
|
986
|
+
}, [container, relativePath]);
|
|
987
|
+
|
|
988
|
+
const [initialSrc, setInitialSrc] = useState<string | null>(null);
|
|
989
|
+
const [resolveError, setResolveError] = useState<string | null>(null);
|
|
990
|
+
useEffect(() => {
|
|
991
|
+
let cancelled = false;
|
|
992
|
+
mediaProvider.resolveUrl(relativePath).then(
|
|
993
|
+
(url) => {
|
|
994
|
+
if (!cancelled) setInitialSrc(url);
|
|
995
|
+
},
|
|
996
|
+
(err: unknown) => {
|
|
997
|
+
if (!cancelled) {
|
|
998
|
+
setResolveError(err instanceof Error ? err.message : String(err));
|
|
999
|
+
}
|
|
1000
|
+
},
|
|
1001
|
+
);
|
|
1002
|
+
return () => {
|
|
1003
|
+
cancelled = true;
|
|
1004
|
+
};
|
|
1005
|
+
}, [mediaProvider, relativePath]);
|
|
1006
|
+
|
|
1007
|
+
const handleExport = useCallback(
|
|
1008
|
+
(blob: Blob, format: 'png' | 'jpeg' | 'webp') => {
|
|
1009
|
+
const mime = `image/${format}`;
|
|
1010
|
+
mediaProvider.addMedia(relativePath, blob, mime).then(
|
|
1011
|
+
() => onSaved(),
|
|
1012
|
+
(err: unknown) => {
|
|
1013
|
+
console.error('Failed to write image back:', err instanceof Error ? err.message : err);
|
|
1014
|
+
},
|
|
1015
|
+
);
|
|
1016
|
+
},
|
|
1017
|
+
[mediaProvider, relativePath, onSaved],
|
|
1018
|
+
);
|
|
1019
|
+
|
|
1020
|
+
// Close on Escape — global listener so it works regardless of focus.
|
|
1021
|
+
useEffect(() => {
|
|
1022
|
+
const handler = (e: KeyboardEvent) => {
|
|
1023
|
+
if (e.key === 'Escape') onClose();
|
|
1024
|
+
};
|
|
1025
|
+
window.addEventListener('keydown', handler);
|
|
1026
|
+
return () => window.removeEventListener('keydown', handler);
|
|
1027
|
+
}, [onClose]);
|
|
1028
|
+
|
|
1029
|
+
return (
|
|
1030
|
+
<div
|
|
1031
|
+
className="squisq-image-edit-modal"
|
|
1032
|
+
data-testid="image-edit-modal"
|
|
1033
|
+
role="dialog"
|
|
1034
|
+
aria-modal="true"
|
|
1035
|
+
aria-label={`Edit ${relativePath}`}
|
|
1036
|
+
onClick={(e) => {
|
|
1037
|
+
// Click on the dim backdrop (but not on the surface) → close.
|
|
1038
|
+
if (e.target === e.currentTarget) onClose();
|
|
1039
|
+
}}
|
|
1040
|
+
>
|
|
1041
|
+
<div className="squisq-image-edit-modal__surface">
|
|
1042
|
+
<header className="squisq-image-edit-modal__header">
|
|
1043
|
+
<span className="squisq-image-edit-modal__title">Edit image</span>
|
|
1044
|
+
<span className="squisq-image-edit-modal__path">{relativePath}</span>
|
|
1045
|
+
<button
|
|
1046
|
+
type="button"
|
|
1047
|
+
className="squisq-image-edit-modal__close"
|
|
1048
|
+
data-testid="image-edit-modal-close"
|
|
1049
|
+
onClick={onClose}
|
|
1050
|
+
aria-label="Close image editor"
|
|
1051
|
+
>
|
|
1052
|
+
×
|
|
1053
|
+
</button>
|
|
1054
|
+
</header>
|
|
1055
|
+
<div className="squisq-image-edit-modal__body">
|
|
1056
|
+
{resolveError ? (
|
|
1057
|
+
<div className="squisq-image-edit-modal__error">
|
|
1058
|
+
Failed to load image: {resolveError}
|
|
1059
|
+
</div>
|
|
1060
|
+
) : !initialSrc ? (
|
|
1061
|
+
<div className="squisq-image-edit-modal__loading">Loading image…</div>
|
|
1062
|
+
) : (
|
|
1063
|
+
<ImageEditor
|
|
1064
|
+
filesContainer={sidecar}
|
|
1065
|
+
initialSrc={initialSrc}
|
|
1066
|
+
allowVersioning={allowVersioning}
|
|
1067
|
+
versioningAutoSaveIdleMs={versioningAutoSaveIdleMs}
|
|
1068
|
+
onExport={handleExport}
|
|
1069
|
+
saveBehavior="export"
|
|
1070
|
+
saveFormat="png"
|
|
1071
|
+
saveLabel="Save and close"
|
|
1072
|
+
saveTitle="Save changes back to the image and close"
|
|
1073
|
+
surface={shellTheme === 'dark' ? DARK_SURFACE : LIGHT_SURFACE}
|
|
1074
|
+
/>
|
|
1075
|
+
)}
|
|
1076
|
+
</div>
|
|
1077
|
+
</div>
|
|
562
1078
|
</div>
|
|
563
1079
|
);
|
|
564
1080
|
}
|