@bendyline/squisq-editor-react 1.3.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 +184 -4
- package/dist/EditorShell.d.ts.map +1 -1
- package/dist/EditorShell.js +184 -12
- 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/MediaBin.d.ts +12 -1
- package/dist/MediaBin.d.ts.map +1 -1
- package/dist/MediaBin.js +13 -3
- package/dist/MediaBin.js.map +1 -1
- 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__/mediaAttachmentFlow.test.d.ts +2 -0
- package/dist/__tests__/mediaAttachmentFlow.test.d.ts.map +1 -0
- package/dist/__tests__/mediaAttachmentFlow.test.js +99 -0
- package/dist/__tests__/mediaAttachmentFlow.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 +26 -0
- package/dist/__tests__/tiptapBridge.test.js.map +1 -1
- package/dist/__tests__/tiptapImageRoundTrip.test.d.ts +2 -0
- package/dist/__tests__/tiptapImageRoundTrip.test.d.ts.map +1 -0
- package/dist/__tests__/tiptapImageRoundTrip.test.js +68 -0
- package/dist/__tests__/tiptapImageRoundTrip.test.js.map +1 -0
- 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 +210 -16
- 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 +691 -63
- 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/MediaBin.tsx +22 -3
- 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__/mediaAttachmentFlow.test.ts +110 -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 +29 -0
- package/src/__tests__/tiptapImageRoundTrip.test.ts +73 -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 +227 -22
- 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
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image edit affordance + modal overlay.
|
|
3
|
+
*
|
|
4
|
+
* The affordance is the small floating "Edit" button that appears on
|
|
5
|
+
* hovered/selected images inside the WYSIWYG view. The modal hosts a
|
|
6
|
+
* full <ImageEditor> on top of the editor surface.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
.squisq-image-edit-affordance {
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: 8px;
|
|
12
|
+
right: 8px;
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 4px;
|
|
16
|
+
padding: 4px 10px;
|
|
17
|
+
font: 500 12px/1.2 var(--squisq-ux-font, system-ui, -apple-system, sans-serif);
|
|
18
|
+
/* Theme-tied colors. The shell sets `--squisq-editor-*` tokens (or
|
|
19
|
+
equivalents via [data-theme]) on the WYSIWYG root; we fall back to
|
|
20
|
+
a neutral light surface so the button is legible on photographic
|
|
21
|
+
content even when no theme variables are set. The dark-theme block
|
|
22
|
+
below overrides for [data-theme='dark']. */
|
|
23
|
+
color: var(--squisq-editor-text, #1f2937);
|
|
24
|
+
background: var(--squisq-editor-control-bg, rgba(255, 255, 255, 0.92));
|
|
25
|
+
border: 1px solid var(--squisq-editor-control-border, rgba(0, 0, 0, 0.18));
|
|
26
|
+
border-radius: 4px;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
z-index: 4;
|
|
29
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
|
|
30
|
+
user-select: none;
|
|
31
|
+
backdrop-filter: blur(4px);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.squisq-image-edit-affordance:hover {
|
|
35
|
+
background: var(--squisq-editor-control-bg-hover, rgba(245, 245, 247, 0.98));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.squisq-image-edit-affordance:focus-visible {
|
|
39
|
+
outline: 2px solid var(--squisq-editor-accent, #4a9eff);
|
|
40
|
+
outline-offset: 2px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[data-theme='dark'] .squisq-image-edit-affordance,
|
|
44
|
+
.squisq-editor-shell[data-theme='dark'] .squisq-image-edit-affordance {
|
|
45
|
+
color: var(--squisq-editor-text, #f3f4f6);
|
|
46
|
+
background: var(--squisq-editor-control-bg, rgba(20, 20, 20, 0.85));
|
|
47
|
+
border-color: var(--squisq-editor-control-border, rgba(255, 255, 255, 0.2));
|
|
48
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
[data-theme='dark'] .squisq-image-edit-affordance:hover,
|
|
52
|
+
.squisq-editor-shell[data-theme='dark'] .squisq-image-edit-affordance:hover {
|
|
53
|
+
background: var(--squisq-editor-control-bg-hover, rgba(45, 45, 45, 0.95));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* ── Resize handle ──────────────────────────────────────────────
|
|
57
|
+
Small grip at the bottom-right corner of a hovered/selected image.
|
|
58
|
+
Mousedown starts an aspect-locked resize; double-click clears the
|
|
59
|
+
width/height attrs (returns image to natural rendered size). */
|
|
60
|
+
.squisq-image-resize-handle {
|
|
61
|
+
position: absolute;
|
|
62
|
+
right: -4px;
|
|
63
|
+
bottom: -4px;
|
|
64
|
+
width: 14px;
|
|
65
|
+
height: 14px;
|
|
66
|
+
border: 1.5px solid var(--squisq-editor-accent, #4a9eff);
|
|
67
|
+
background: var(--squisq-editor-control-bg, rgba(255, 255, 255, 0.95));
|
|
68
|
+
border-radius: 2px;
|
|
69
|
+
cursor: nwse-resize;
|
|
70
|
+
z-index: 5;
|
|
71
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
|
|
72
|
+
user-select: none;
|
|
73
|
+
touch-action: none;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.squisq-image-resize-handle:hover {
|
|
77
|
+
background: var(--squisq-editor-accent, #4a9eff);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
[data-theme='dark'] .squisq-image-resize-handle,
|
|
81
|
+
.squisq-editor-shell[data-theme='dark'] .squisq-image-resize-handle {
|
|
82
|
+
background: var(--squisq-editor-control-bg, rgba(20, 20, 20, 0.9));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.squisq-image-resize-readout {
|
|
86
|
+
position: absolute;
|
|
87
|
+
left: 8px;
|
|
88
|
+
bottom: 8px;
|
|
89
|
+
padding: 2px 6px;
|
|
90
|
+
font: 500 11px/1.2 var(--squisq-ux-font, system-ui, -apple-system, sans-serif);
|
|
91
|
+
color: var(--squisq-editor-text, #fff);
|
|
92
|
+
background: rgba(0, 0, 0, 0.7);
|
|
93
|
+
border-radius: 3px;
|
|
94
|
+
pointer-events: none;
|
|
95
|
+
z-index: 5;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.squisq-image-edit-modal {
|
|
99
|
+
position: fixed;
|
|
100
|
+
inset: 0;
|
|
101
|
+
display: flex;
|
|
102
|
+
align-items: center;
|
|
103
|
+
justify-content: center;
|
|
104
|
+
background: rgba(0, 0, 0, 0.55);
|
|
105
|
+
z-index: 1000;
|
|
106
|
+
padding: 24px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.squisq-image-edit-modal__surface {
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
width: min(1200px, 100%);
|
|
113
|
+
height: min(800px, 100%);
|
|
114
|
+
background: #fff;
|
|
115
|
+
border-radius: 6px;
|
|
116
|
+
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
|
|
117
|
+
overflow: hidden;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
[data-theme='dark'] .squisq-image-edit-modal__surface,
|
|
121
|
+
.squisq-editor-shell[data-theme='dark'] .squisq-image-edit-modal__surface {
|
|
122
|
+
background: #1e1e1e;
|
|
123
|
+
color: #e4e4e4;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.squisq-image-edit-modal__header {
|
|
127
|
+
display: flex;
|
|
128
|
+
align-items: center;
|
|
129
|
+
gap: 12px;
|
|
130
|
+
padding: 8px 12px;
|
|
131
|
+
border-bottom: 1px solid #d4d4d4;
|
|
132
|
+
font: 500 13px/1.2 var(--squisq-ux-font, system-ui, -apple-system, sans-serif);
|
|
133
|
+
background: #f5f5f5;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
[data-theme='dark'] .squisq-image-edit-modal__header {
|
|
137
|
+
background: #2a2a2a;
|
|
138
|
+
border-bottom-color: #3a3a3a;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.squisq-image-edit-modal__title {
|
|
142
|
+
font-weight: 600;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.squisq-image-edit-modal__path {
|
|
146
|
+
flex: 1;
|
|
147
|
+
color: #666;
|
|
148
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
149
|
+
font-size: 12px;
|
|
150
|
+
overflow: hidden;
|
|
151
|
+
text-overflow: ellipsis;
|
|
152
|
+
white-space: nowrap;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
[data-theme='dark'] .squisq-image-edit-modal__path {
|
|
156
|
+
color: #aaa;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.squisq-image-edit-modal__close {
|
|
160
|
+
display: inline-flex;
|
|
161
|
+
align-items: center;
|
|
162
|
+
justify-content: center;
|
|
163
|
+
width: 28px;
|
|
164
|
+
height: 28px;
|
|
165
|
+
padding: 0;
|
|
166
|
+
font-size: 22px;
|
|
167
|
+
line-height: 1;
|
|
168
|
+
background: transparent;
|
|
169
|
+
border: 1px solid transparent;
|
|
170
|
+
border-radius: 4px;
|
|
171
|
+
cursor: pointer;
|
|
172
|
+
color: inherit;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.squisq-image-edit-modal__close:hover {
|
|
176
|
+
background: rgba(0, 0, 0, 0.07);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
[data-theme='dark'] .squisq-image-edit-modal__close:hover {
|
|
180
|
+
background: rgba(255, 255, 255, 0.08);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.squisq-image-edit-modal__body {
|
|
184
|
+
flex: 1;
|
|
185
|
+
min-height: 0;
|
|
186
|
+
display: flex;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.squisq-image-edit-modal__loading,
|
|
190
|
+
.squisq-image-edit-modal__error {
|
|
191
|
+
flex: 1;
|
|
192
|
+
display: flex;
|
|
193
|
+
align-items: center;
|
|
194
|
+
justify-content: center;
|
|
195
|
+
font: 500 13px var(--squisq-ux-font, system-ui, -apple-system, sans-serif);
|
|
196
|
+
color: #666;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.squisq-image-edit-modal__error {
|
|
200
|
+
color: #c0392b;
|
|
201
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @bendyline/squisq-editor-react — bundled stylesheet entry.
|
|
3
|
+
* Aggregates all CSS shipped with this package.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
@import '@fortawesome/fontawesome-free/css/all.min.css';
|
|
7
|
+
@import './editor.css';
|
|
8
|
+
@import '../jsonEditor/json-editor.css';
|
|
9
|
+
@import '../imageEditor/image-editor.css';
|
|
10
|
+
@import './image-edit-affordance.css';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TiptapAudio — inline atom Tiptap node for HTML5 `<audio>` elements.
|
|
3
|
+
*
|
|
4
|
+
* Lets the WYSIWYG editor preserve `<audio>` tags that the recorder
|
|
5
|
+
* drops into the markdown for narration / voice recordings, and render
|
|
6
|
+
* a native playback control inside the editor surface. The resolved src
|
|
7
|
+
* goes through the EditorContext's MediaProvider so a workspace-local
|
|
8
|
+
* `audio/foo.webm` returns a blob URL.
|
|
9
|
+
*/
|
|
10
|
+
import { Node, mergeAttributes } from '@tiptap/core';
|
|
11
|
+
import { NodeViewWrapper, ReactNodeViewRenderer } from '@tiptap/react';
|
|
12
|
+
import type { NodeViewProps } from '@tiptap/react';
|
|
13
|
+
import { useResolvedMediaSrc } from './useResolvedMediaSrc.js';
|
|
14
|
+
|
|
15
|
+
export interface TiptapAudioOptions {
|
|
16
|
+
HTMLAttributes: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
declare module '@tiptap/core' {
|
|
20
|
+
interface Commands<ReturnType> {
|
|
21
|
+
audio: {
|
|
22
|
+
setAudio: (attrs: { src: string; controls?: boolean }) => ReturnType;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function AudioNodeView({ node }: NodeViewProps) {
|
|
28
|
+
const { src, controls } = node.attrs as { src: string; controls: boolean };
|
|
29
|
+
const resolvedSrc = useResolvedMediaSrc(src ?? '');
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<NodeViewWrapper as="span" className="squisq-inline-audio-player" data-drag-handle draggable>
|
|
33
|
+
<audio src={resolvedSrc || undefined} controls={controls} preload="metadata" />
|
|
34
|
+
</NodeViewWrapper>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const TiptapAudio = Node.create<TiptapAudioOptions>({
|
|
39
|
+
name: 'audio',
|
|
40
|
+
// Block-level so each recording lives on its own line in the WYSIWYG —
|
|
41
|
+
// matches how the recorder inserts the tag (on a fresh line) and
|
|
42
|
+
// avoids odd inline-flow alignment when the native controls take more
|
|
43
|
+
// vertical space than a line of text.
|
|
44
|
+
group: 'block',
|
|
45
|
+
atom: true,
|
|
46
|
+
draggable: true,
|
|
47
|
+
selectable: true,
|
|
48
|
+
|
|
49
|
+
addOptions() {
|
|
50
|
+
return { HTMLAttributes: {} };
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
addAttributes() {
|
|
54
|
+
return {
|
|
55
|
+
src: { default: null },
|
|
56
|
+
controls: {
|
|
57
|
+
default: true,
|
|
58
|
+
parseHTML: (el) => el.hasAttribute('controls'),
|
|
59
|
+
renderHTML: (attrs) => (attrs.controls ? { controls: '' } : {}),
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
parseHTML() {
|
|
65
|
+
return [{ tag: 'audio' }];
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
renderHTML({ HTMLAttributes }) {
|
|
69
|
+
return ['audio', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
addNodeView() {
|
|
73
|
+
return ReactNodeViewRenderer(AudioNodeView);
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
addCommands() {
|
|
77
|
+
return {
|
|
78
|
+
setAudio:
|
|
79
|
+
(attrs) =>
|
|
80
|
+
({ commands }) =>
|
|
81
|
+
commands.insertContent({ type: this.name, attrs }),
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export default TiptapAudio;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TiptapVideo — block-level atom Tiptap node for HTML5 `<video>` elements.
|
|
3
|
+
*
|
|
4
|
+
* Without this extension, Tiptap's StarterKit strips unknown HTML tags
|
|
5
|
+
* when parsing the editor's content. By registering `<video>` as a known
|
|
6
|
+
* node, the editor can render a recording's inline player inside the
|
|
7
|
+
* WYSIWYG surface and round-trip the tag through markdown.
|
|
8
|
+
*
|
|
9
|
+
* The NodeView renders a real `<video controls>` whose src is resolved
|
|
10
|
+
* through the EditorContext's MediaProvider — same mechanism
|
|
11
|
+
* `ImageNodeView` uses for `<img>`.
|
|
12
|
+
*/
|
|
13
|
+
import { Node, mergeAttributes } from '@tiptap/core';
|
|
14
|
+
import { NodeViewWrapper, ReactNodeViewRenderer } from '@tiptap/react';
|
|
15
|
+
import type { NodeViewProps } from '@tiptap/react';
|
|
16
|
+
import { useResolvedMediaSrc } from './useResolvedMediaSrc.js';
|
|
17
|
+
|
|
18
|
+
export interface TiptapVideoOptions {
|
|
19
|
+
HTMLAttributes: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare module '@tiptap/core' {
|
|
23
|
+
interface Commands<ReturnType> {
|
|
24
|
+
video: {
|
|
25
|
+
setVideo: (attrs: {
|
|
26
|
+
src: string;
|
|
27
|
+
width?: number | string | null;
|
|
28
|
+
controls?: boolean;
|
|
29
|
+
}) => ReturnType;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function VideoNodeView({ node }: NodeViewProps) {
|
|
35
|
+
const { src, width, height, poster, controls } = node.attrs as {
|
|
36
|
+
src: string;
|
|
37
|
+
width: string | number | null;
|
|
38
|
+
height: string | number | null;
|
|
39
|
+
poster: string | null;
|
|
40
|
+
controls: boolean;
|
|
41
|
+
};
|
|
42
|
+
const resolvedSrc = useResolvedMediaSrc(src ?? '');
|
|
43
|
+
// Resolve poster through the same provider when present so a
|
|
44
|
+
// workspace-local frame thumbnail also renders inside the editor.
|
|
45
|
+
const resolvedPoster = useResolvedMediaSrc(poster ?? '');
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<NodeViewWrapper
|
|
49
|
+
as="span"
|
|
50
|
+
className="squisq-inline-video-player"
|
|
51
|
+
// Mark as a drag handle so ProseMirror moves the node when the user
|
|
52
|
+
// drags it, rather than the browser starting a native media-drag.
|
|
53
|
+
data-drag-handle
|
|
54
|
+
draggable
|
|
55
|
+
>
|
|
56
|
+
<video
|
|
57
|
+
src={resolvedSrc || undefined}
|
|
58
|
+
poster={poster ? resolvedPoster : undefined}
|
|
59
|
+
controls={controls}
|
|
60
|
+
playsInline
|
|
61
|
+
preload="metadata"
|
|
62
|
+
width={width ?? undefined}
|
|
63
|
+
height={height ?? undefined}
|
|
64
|
+
/>
|
|
65
|
+
</NodeViewWrapper>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const TiptapVideo = Node.create<TiptapVideoOptions>({
|
|
70
|
+
name: 'video',
|
|
71
|
+
group: 'block',
|
|
72
|
+
atom: true,
|
|
73
|
+
draggable: true,
|
|
74
|
+
selectable: true,
|
|
75
|
+
|
|
76
|
+
addOptions() {
|
|
77
|
+
return { HTMLAttributes: {} };
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
addAttributes() {
|
|
81
|
+
return {
|
|
82
|
+
src: { default: null },
|
|
83
|
+
width: { default: null },
|
|
84
|
+
height: { default: null },
|
|
85
|
+
poster: { default: null },
|
|
86
|
+
// The HTML5 `controls` attribute is boolean-presence; parse its
|
|
87
|
+
// existence (even with an empty string value) as `true`, otherwise
|
|
88
|
+
// default to true (we want recordings to be playable by default).
|
|
89
|
+
controls: {
|
|
90
|
+
default: true,
|
|
91
|
+
parseHTML: (el) => el.hasAttribute('controls'),
|
|
92
|
+
renderHTML: (attrs) => (attrs.controls ? { controls: '' } : {}),
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
parseHTML() {
|
|
98
|
+
return [{ tag: 'video' }];
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
renderHTML({ HTMLAttributes }) {
|
|
102
|
+
return ['video', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
addNodeView() {
|
|
106
|
+
return ReactNodeViewRenderer(VideoNodeView);
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
addCommands() {
|
|
110
|
+
return {
|
|
111
|
+
setVideo:
|
|
112
|
+
(attrs) =>
|
|
113
|
+
({ commands }) =>
|
|
114
|
+
commands.insertContent({ type: this.name, attrs }),
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
export default TiptapVideo;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useResolvedMediaSrc — resolve a relative media path through the
|
|
3
|
+
* EditorContext's MediaProvider, mirroring the pattern used by
|
|
4
|
+
* `ImageNodeView`. Returns the resolved URL (or the original `src`
|
|
5
|
+
* when no provider is available, the path is absolute, or resolution
|
|
6
|
+
* fails). Used by the Tiptap video / audio NodeViews so a relative
|
|
7
|
+
* `audio/foo.webm` plays from the workspace container instead of
|
|
8
|
+
* 404-ing against the dev server.
|
|
9
|
+
*/
|
|
10
|
+
import { useEffect, useState } from 'react';
|
|
11
|
+
import { useEditorContext } from '../EditorContext.js';
|
|
12
|
+
|
|
13
|
+
export function useResolvedMediaSrc(src: string): string {
|
|
14
|
+
const { mediaProvider, mediaRevision } = useEditorContext();
|
|
15
|
+
const [resolved, setResolved] = useState(src);
|
|
16
|
+
|
|
17
|
+
const isRelative =
|
|
18
|
+
!!src &&
|
|
19
|
+
!src.startsWith('blob:') &&
|
|
20
|
+
!src.startsWith('http:') &&
|
|
21
|
+
!src.startsWith('https:') &&
|
|
22
|
+
!src.startsWith('data:') &&
|
|
23
|
+
!src.startsWith('/');
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!mediaProvider || !isRelative) {
|
|
27
|
+
setResolved(src);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
let cancelled = false;
|
|
31
|
+
mediaProvider.resolveUrl(src).then(
|
|
32
|
+
(url) => {
|
|
33
|
+
if (!cancelled) setResolved(url);
|
|
34
|
+
},
|
|
35
|
+
() => {
|
|
36
|
+
if (!cancelled) setResolved(src);
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
return () => {
|
|
40
|
+
cancelled = true;
|
|
41
|
+
};
|
|
42
|
+
// `mediaRevision` bumps after writes — re-resolve so the player
|
|
43
|
+
// picks up the new blob URL after a re-record / edit.
|
|
44
|
+
}, [src, isRelative, mediaProvider, mediaRevision]);
|
|
45
|
+
|
|
46
|
+
return resolved;
|
|
47
|
+
}
|