@bendyline/squisq-editor-react 1.4.0 → 1.5.1
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
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VersionHistoryPanel
|
|
3
|
+
*
|
|
4
|
+
* Toolbar-anchored popover that lists prior version snapshots and lets
|
|
5
|
+
* the user revert to one. When a snapshot is selected, a Monaco diff
|
|
6
|
+
* view appears to the left of the list comparing the snapshot (original,
|
|
7
|
+
* left) with the current editor content (modified, right).
|
|
8
|
+
*
|
|
9
|
+
* Wraps the toolbar trigger button + popover surface. Versioning state
|
|
10
|
+
* is read from the EditorContext — render this component anywhere inside
|
|
11
|
+
* a provider that has `allowVersioning` and a `container`.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
15
|
+
import { DiffEditor } from '@monaco-editor/react';
|
|
16
|
+
import type { Version } from '@bendyline/squisq/versions';
|
|
17
|
+
import { useEditorContext } from './EditorContext';
|
|
18
|
+
|
|
19
|
+
interface PanelState {
|
|
20
|
+
loading: boolean;
|
|
21
|
+
versions: Version[];
|
|
22
|
+
/** The snapshot currently shown in the diff view, with its content. */
|
|
23
|
+
selected: { version: Version; content: string } | null;
|
|
24
|
+
pendingRevert: Version | null;
|
|
25
|
+
error: string | null;
|
|
26
|
+
/** Stamp captured each time the popover opens — labels the synthetic
|
|
27
|
+
* "Current" row so it reads as a moment in time alongside the
|
|
28
|
+
* snapshots. */
|
|
29
|
+
currentStamp: Date;
|
|
30
|
+
/** Cached content of the most recent snapshot, used to detect (and
|
|
31
|
+
* hide) a snapshot that's byte-identical to the current draft so the
|
|
32
|
+
* synthetic Current row alone represents that state. Compared against
|
|
33
|
+
* the live `markdownSource` on every render, so the suppressed row
|
|
34
|
+
* re-appears as soon as the user types. */
|
|
35
|
+
latestSnapshotContent: string | null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const initialState: PanelState = {
|
|
39
|
+
loading: false,
|
|
40
|
+
versions: [],
|
|
41
|
+
selected: null,
|
|
42
|
+
pendingRevert: null,
|
|
43
|
+
error: null,
|
|
44
|
+
currentStamp: new Date(),
|
|
45
|
+
latestSnapshotContent: null,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const dateFormatter = new Intl.DateTimeFormat(undefined, {
|
|
49
|
+
dateStyle: 'medium',
|
|
50
|
+
timeStyle: 'short',
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
function formatBytes(n: number): string {
|
|
54
|
+
if (n < 1024) return `${n} B`;
|
|
55
|
+
if (n < 1024 * 1024) return `${(n / 1024).toFixed(1)} KB`;
|
|
56
|
+
return `${(n / (1024 * 1024)).toFixed(1)} MB`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function VersionHistoryPanel() {
|
|
60
|
+
const { versioning, replaceAll, markdownSource, theme } = useEditorContext();
|
|
61
|
+
const [open, setOpen] = useState(false);
|
|
62
|
+
const [state, setState] = useState<PanelState>(initialState);
|
|
63
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
64
|
+
|
|
65
|
+
const refresh = useCallback(async () => {
|
|
66
|
+
if (!versioning) return;
|
|
67
|
+
setState((s) => ({ ...s, loading: true, error: null }));
|
|
68
|
+
try {
|
|
69
|
+
const versions = await versioning.listVersions();
|
|
70
|
+
// Cache the latest snapshot's content so we can hide it when it
|
|
71
|
+
// matches the live draft (the Current row already represents it).
|
|
72
|
+
const latest = versions[0];
|
|
73
|
+
const latestSnapshotContent = latest ? await versioning.readVersion(latest) : null;
|
|
74
|
+
setState((s) => ({ ...s, loading: false, versions, latestSnapshotContent }));
|
|
75
|
+
} catch (err: unknown) {
|
|
76
|
+
const message = err instanceof Error ? err.message : 'Failed to list versions';
|
|
77
|
+
setState((s) => ({ ...s, loading: false, error: message }));
|
|
78
|
+
}
|
|
79
|
+
}, [versioning]);
|
|
80
|
+
|
|
81
|
+
// Refresh the list whenever the popover opens.
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
if (open) {
|
|
84
|
+
setState((s) => ({ ...s, currentStamp: new Date() }));
|
|
85
|
+
void refresh();
|
|
86
|
+
} else {
|
|
87
|
+
// Reset transient UI when closing so the next open is clean.
|
|
88
|
+
setState((s) => ({ ...s, selected: null, pendingRevert: null }));
|
|
89
|
+
}
|
|
90
|
+
}, [open, refresh]);
|
|
91
|
+
|
|
92
|
+
// Click-outside to close, mirroring the toolbar overflow menu.
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
if (!open) return;
|
|
95
|
+
const handler = (e: MouseEvent) => {
|
|
96
|
+
if (containerRef.current && !containerRef.current.contains(e.target as Node)) {
|
|
97
|
+
setOpen(false);
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
document.addEventListener('mousedown', handler);
|
|
101
|
+
return () => document.removeEventListener('mousedown', handler);
|
|
102
|
+
}, [open]);
|
|
103
|
+
|
|
104
|
+
const handleSelect = useCallback(
|
|
105
|
+
async (version: Version) => {
|
|
106
|
+
if (!versioning) return;
|
|
107
|
+
// Toggle off if this version is already selected.
|
|
108
|
+
if (state.selected?.version.path === version.path) {
|
|
109
|
+
setState((s) => ({ ...s, selected: null }));
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const content = await versioning.readVersion(version);
|
|
113
|
+
if (content === null) {
|
|
114
|
+
setState((s) => ({ ...s, error: 'Snapshot is no longer available.' }));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
setState((s) => ({ ...s, selected: { version, content }, error: null }));
|
|
118
|
+
},
|
|
119
|
+
[versioning, state.selected],
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const handleRevertConfirm = useCallback(
|
|
123
|
+
async (version: Version) => {
|
|
124
|
+
if (!versioning) return;
|
|
125
|
+
try {
|
|
126
|
+
const result = await versioning.revertToVersion(version, { snapshotCurrent: true });
|
|
127
|
+
if (!result.reverted) {
|
|
128
|
+
setState((s) => ({ ...s, error: 'Revert failed — snapshot missing.' }));
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const reverted = await versioning.readVersion(version);
|
|
132
|
+
if (reverted !== null) {
|
|
133
|
+
replaceAll(reverted);
|
|
134
|
+
}
|
|
135
|
+
setState((s) => ({ ...s, pendingRevert: null, selected: null }));
|
|
136
|
+
await refresh();
|
|
137
|
+
} catch (err: unknown) {
|
|
138
|
+
const message = err instanceof Error ? err.message : 'Revert failed';
|
|
139
|
+
setState((s) => ({ ...s, error: message }));
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
[versioning, replaceAll, refresh],
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
// Hide the most recent snapshot when its content is byte-identical to
|
|
146
|
+
// the live draft — the Current row already represents that state, and
|
|
147
|
+
// the diff against it would be empty anyway.
|
|
148
|
+
const latestMatchesCurrent =
|
|
149
|
+
state.latestSnapshotContent !== null && state.latestSnapshotContent === markdownSource;
|
|
150
|
+
const visibleVersions = useMemo(
|
|
151
|
+
() => (latestMatchesCurrent ? state.versions.slice(1) : state.versions),
|
|
152
|
+
[state.versions, latestMatchesCurrent],
|
|
153
|
+
);
|
|
154
|
+
const currentSize = useMemo(
|
|
155
|
+
() => new TextEncoder().encode(markdownSource).byteLength,
|
|
156
|
+
[markdownSource],
|
|
157
|
+
);
|
|
158
|
+
const hasDiff = state.selected !== null;
|
|
159
|
+
const diffTheme = theme === 'dark' ? 'vs-dark' : 'vs';
|
|
160
|
+
|
|
161
|
+
if (!versioning) return null;
|
|
162
|
+
|
|
163
|
+
return (
|
|
164
|
+
<div className="squisq-version-history" ref={containerRef}>
|
|
165
|
+
<button
|
|
166
|
+
type="button"
|
|
167
|
+
className={`squisq-toolbar-button squisq-version-history-trigger${
|
|
168
|
+
open ? ' squisq-toolbar-button--active' : ''
|
|
169
|
+
}`}
|
|
170
|
+
data-tooltip="Version history"
|
|
171
|
+
aria-label="Version history"
|
|
172
|
+
aria-expanded={open}
|
|
173
|
+
onClick={() => setOpen((v) => !v)}
|
|
174
|
+
>
|
|
175
|
+
<svg
|
|
176
|
+
width="16"
|
|
177
|
+
height="16"
|
|
178
|
+
viewBox="0 0 16 16"
|
|
179
|
+
fill="none"
|
|
180
|
+
stroke="currentColor"
|
|
181
|
+
strokeWidth="1.5"
|
|
182
|
+
strokeLinecap="round"
|
|
183
|
+
strokeLinejoin="round"
|
|
184
|
+
>
|
|
185
|
+
<path d="M2.5 8a5.5 5.5 0 1 0 1.6-3.9" />
|
|
186
|
+
<polyline points="2.5,2.5 2.5,4.5 4.5,4.5" />
|
|
187
|
+
<polyline points="8,4.5 8,8 11,9.5" />
|
|
188
|
+
</svg>
|
|
189
|
+
</button>
|
|
190
|
+
{open && (
|
|
191
|
+
<div
|
|
192
|
+
className={`squisq-version-history-popover${
|
|
193
|
+
hasDiff ? ' squisq-version-history-popover--with-diff' : ''
|
|
194
|
+
}`}
|
|
195
|
+
role="dialog"
|
|
196
|
+
aria-label="Version history"
|
|
197
|
+
>
|
|
198
|
+
{hasDiff && state.selected && (
|
|
199
|
+
<div className="squisq-version-history-diff">
|
|
200
|
+
<div className="squisq-version-history-diff-header">
|
|
201
|
+
<span className="squisq-version-history-diff-label">
|
|
202
|
+
<strong>Snapshot</strong> {dateFormatter.format(state.selected.version.timestamp)}
|
|
203
|
+
</span>
|
|
204
|
+
<span className="squisq-version-history-diff-label">
|
|
205
|
+
<strong>Current</strong>
|
|
206
|
+
</span>
|
|
207
|
+
</div>
|
|
208
|
+
<div className="squisq-version-history-diff-body">
|
|
209
|
+
<DiffEditor
|
|
210
|
+
original={state.selected.content}
|
|
211
|
+
modified={markdownSource}
|
|
212
|
+
language="markdown"
|
|
213
|
+
theme={diffTheme}
|
|
214
|
+
options={{
|
|
215
|
+
readOnly: true,
|
|
216
|
+
renderSideBySide: true,
|
|
217
|
+
minimap: { enabled: false },
|
|
218
|
+
scrollBeyondLastLine: false,
|
|
219
|
+
wordWrap: 'on',
|
|
220
|
+
automaticLayout: true,
|
|
221
|
+
fontSize: 12,
|
|
222
|
+
lineNumbers: 'off',
|
|
223
|
+
glyphMargin: false,
|
|
224
|
+
folding: false,
|
|
225
|
+
overviewRulerLanes: 0,
|
|
226
|
+
renderOverviewRuler: false,
|
|
227
|
+
}}
|
|
228
|
+
/>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
)}
|
|
232
|
+
<div className="squisq-version-history-list-pane">
|
|
233
|
+
<div className="squisq-version-history-header">
|
|
234
|
+
<span className="squisq-version-history-title">Version history</span>
|
|
235
|
+
</div>
|
|
236
|
+
{state.error && <div className="squisq-version-history-error">{state.error}</div>}
|
|
237
|
+
{state.loading ? (
|
|
238
|
+
<div className="squisq-version-history-empty">Loading…</div>
|
|
239
|
+
) : visibleVersions.length === 0 ? (
|
|
240
|
+
<div className="squisq-version-history-empty">
|
|
241
|
+
No versions yet. Versions are saved automatically as you edit.
|
|
242
|
+
</div>
|
|
243
|
+
) : (
|
|
244
|
+
<ul className="squisq-version-history-list">
|
|
245
|
+
<li
|
|
246
|
+
className={`squisq-version-history-row squisq-version-history-row--current${
|
|
247
|
+
state.selected === null ? ' squisq-version-history-row--selected' : ''
|
|
248
|
+
}`}
|
|
249
|
+
>
|
|
250
|
+
<button
|
|
251
|
+
type="button"
|
|
252
|
+
className="squisq-version-history-row-select"
|
|
253
|
+
onClick={() => setState((s) => ({ ...s, selected: null }))}
|
|
254
|
+
>
|
|
255
|
+
<span className="squisq-version-history-row__time">
|
|
256
|
+
<strong>Current</strong> · {dateFormatter.format(state.currentStamp)}
|
|
257
|
+
</span>
|
|
258
|
+
<span className="squisq-version-history-row__size">
|
|
259
|
+
{formatBytes(currentSize)}
|
|
260
|
+
</span>
|
|
261
|
+
</button>
|
|
262
|
+
</li>
|
|
263
|
+
{visibleVersions.map((v) => {
|
|
264
|
+
const pending =
|
|
265
|
+
state.pendingRevert !== null && state.pendingRevert.path === v.path;
|
|
266
|
+
const selected = state.selected?.version.path === v.path;
|
|
267
|
+
return (
|
|
268
|
+
<li
|
|
269
|
+
key={v.path}
|
|
270
|
+
className={`squisq-version-history-row${
|
|
271
|
+
selected ? ' squisq-version-history-row--selected' : ''
|
|
272
|
+
}`}
|
|
273
|
+
>
|
|
274
|
+
<button
|
|
275
|
+
type="button"
|
|
276
|
+
className="squisq-version-history-row-select"
|
|
277
|
+
onClick={() => void handleSelect(v)}
|
|
278
|
+
>
|
|
279
|
+
<span className="squisq-version-history-row__time">
|
|
280
|
+
{dateFormatter.format(v.timestamp)}
|
|
281
|
+
</span>
|
|
282
|
+
<span className="squisq-version-history-row__size">
|
|
283
|
+
{formatBytes(v.size)}
|
|
284
|
+
</span>
|
|
285
|
+
</button>
|
|
286
|
+
<span className="squisq-version-history-row__actions">
|
|
287
|
+
<button
|
|
288
|
+
type="button"
|
|
289
|
+
className="squisq-version-history-link"
|
|
290
|
+
onClick={() => setState((s) => ({ ...s, pendingRevert: v }))}
|
|
291
|
+
>
|
|
292
|
+
Revert
|
|
293
|
+
</button>
|
|
294
|
+
</span>
|
|
295
|
+
{pending && (
|
|
296
|
+
<div className="squisq-version-history-confirm">
|
|
297
|
+
<span>
|
|
298
|
+
Revert to this version? Your current draft will be saved as a new
|
|
299
|
+
snapshot first. Reverting will reset your editor undo state.
|
|
300
|
+
</span>
|
|
301
|
+
<span className="squisq-version-history-confirm-actions">
|
|
302
|
+
<button
|
|
303
|
+
type="button"
|
|
304
|
+
className="squisq-version-history-link"
|
|
305
|
+
onClick={() => setState((s) => ({ ...s, pendingRevert: null }))}
|
|
306
|
+
>
|
|
307
|
+
Cancel
|
|
308
|
+
</button>
|
|
309
|
+
<button
|
|
310
|
+
type="button"
|
|
311
|
+
className="squisq-version-history-link squisq-version-history-link--primary"
|
|
312
|
+
onClick={() => handleRevertConfirm(v)}
|
|
313
|
+
>
|
|
314
|
+
Revert
|
|
315
|
+
</button>
|
|
316
|
+
</span>
|
|
317
|
+
</div>
|
|
318
|
+
)}
|
|
319
|
+
</li>
|
|
320
|
+
);
|
|
321
|
+
})}
|
|
322
|
+
</ul>
|
|
323
|
+
)}
|
|
324
|
+
</div>
|
|
325
|
+
</div>
|
|
326
|
+
)}
|
|
327
|
+
</div>
|
|
328
|
+
);
|
|
329
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ViewMenuPanel
|
|
3
|
+
*
|
|
4
|
+
* Toolbar overflow menu (`…` button) for view-related toggles. Currently
|
|
5
|
+
* houses the inline preview gutter toggle; new view options can be added
|
|
6
|
+
* as additional `<MenuToggle>` rows without restructuring.
|
|
7
|
+
*
|
|
8
|
+
* State lives in EditorContext so the toggle survives view switches and
|
|
9
|
+
* the host doesn't need to manage it. The initial value comes from the
|
|
10
|
+
* EditorShell `inlinePreview` prop.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
14
|
+
import { useEditorContext, type ThemeInheritance } from './EditorContext';
|
|
15
|
+
|
|
16
|
+
export function ViewMenuPanel() {
|
|
17
|
+
const {
|
|
18
|
+
inlinePreviewVisible,
|
|
19
|
+
setInlinePreviewVisible,
|
|
20
|
+
statusBarVisible,
|
|
21
|
+
setStatusBarVisible,
|
|
22
|
+
outlineVisible,
|
|
23
|
+
setOutlineVisible,
|
|
24
|
+
blockTagsVisible,
|
|
25
|
+
setBlockTagsVisible,
|
|
26
|
+
themeInheritance,
|
|
27
|
+
setThemeInheritance,
|
|
28
|
+
} = useEditorContext();
|
|
29
|
+
const [open, setOpen] = useState(false);
|
|
30
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
31
|
+
|
|
32
|
+
// Click-outside to close, mirroring VersionHistoryPanel.
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!open) return;
|
|
35
|
+
const handler = (e: MouseEvent) => {
|
|
36
|
+
if (containerRef.current && !containerRef.current.contains(e.target as Node)) {
|
|
37
|
+
setOpen(false);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
document.addEventListener('mousedown', handler);
|
|
41
|
+
return () => document.removeEventListener('mousedown', handler);
|
|
42
|
+
}, [open]);
|
|
43
|
+
|
|
44
|
+
const toggleInlinePreview = useCallback(() => {
|
|
45
|
+
setInlinePreviewVisible(!inlinePreviewVisible);
|
|
46
|
+
}, [inlinePreviewVisible, setInlinePreviewVisible]);
|
|
47
|
+
|
|
48
|
+
const toggleStatusBar = useCallback(() => {
|
|
49
|
+
setStatusBarVisible(!statusBarVisible);
|
|
50
|
+
}, [statusBarVisible, setStatusBarVisible]);
|
|
51
|
+
|
|
52
|
+
const toggleOutline = useCallback(() => {
|
|
53
|
+
setOutlineVisible(!outlineVisible);
|
|
54
|
+
}, [outlineVisible, setOutlineVisible]);
|
|
55
|
+
|
|
56
|
+
const toggleBlockTags = useCallback(() => {
|
|
57
|
+
setBlockTagsVisible(!blockTagsVisible);
|
|
58
|
+
}, [blockTagsVisible, setBlockTagsVisible]);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div className="squisq-view-menu" ref={containerRef}>
|
|
62
|
+
<button
|
|
63
|
+
type="button"
|
|
64
|
+
className={`squisq-toolbar-button squisq-view-menu-trigger${
|
|
65
|
+
open ? ' squisq-toolbar-button--active' : ''
|
|
66
|
+
}`}
|
|
67
|
+
data-tooltip="View options"
|
|
68
|
+
aria-label="View options"
|
|
69
|
+
aria-expanded={open}
|
|
70
|
+
aria-haspopup="menu"
|
|
71
|
+
onClick={() => setOpen((v) => !v)}
|
|
72
|
+
>
|
|
73
|
+
<svg
|
|
74
|
+
width="16"
|
|
75
|
+
height="16"
|
|
76
|
+
viewBox="0 0 16 16"
|
|
77
|
+
fill="none"
|
|
78
|
+
stroke="currentColor"
|
|
79
|
+
strokeWidth="1.4"
|
|
80
|
+
strokeLinecap="round"
|
|
81
|
+
strokeLinejoin="round"
|
|
82
|
+
>
|
|
83
|
+
<path d="M1.5 8 C 3 4.5 5.5 3 8 3 S 13 4.5 14.5 8 C 13 11.5 10.5 13 8 13 S 3 11.5 1.5 8 Z" />
|
|
84
|
+
<circle cx="8" cy="8" r="2.2" />
|
|
85
|
+
</svg>
|
|
86
|
+
</button>
|
|
87
|
+
{open && (
|
|
88
|
+
<div className="squisq-view-menu-popover" role="menu" aria-label="View options">
|
|
89
|
+
<MenuToggle label="Show outline" checked={outlineVisible} onChange={toggleOutline} />
|
|
90
|
+
<MenuToggle
|
|
91
|
+
label="Show block previews"
|
|
92
|
+
checked={inlinePreviewVisible}
|
|
93
|
+
onChange={toggleInlinePreview}
|
|
94
|
+
/>
|
|
95
|
+
<MenuToggle
|
|
96
|
+
label="Show block tags"
|
|
97
|
+
checked={blockTagsVisible}
|
|
98
|
+
onChange={toggleBlockTags}
|
|
99
|
+
/>
|
|
100
|
+
<MenuToggle
|
|
101
|
+
label="Show status bar"
|
|
102
|
+
checked={statusBarVisible}
|
|
103
|
+
onChange={toggleStatusBar}
|
|
104
|
+
/>
|
|
105
|
+
<div className="squisq-view-menu-separator" role="separator" />
|
|
106
|
+
<MenuRadioGroup
|
|
107
|
+
label="Editor styling from theme"
|
|
108
|
+
name="theme-inheritance"
|
|
109
|
+
value={themeInheritance}
|
|
110
|
+
onChange={(v) => setThemeInheritance(v as ThemeInheritance)}
|
|
111
|
+
options={[
|
|
112
|
+
{ value: 'none', label: "Don't inherit" },
|
|
113
|
+
{ value: 'fonts', label: 'Fonts only' },
|
|
114
|
+
{ value: 'fonts-colors', label: 'Fonts & colors' },
|
|
115
|
+
]}
|
|
116
|
+
/>
|
|
117
|
+
</div>
|
|
118
|
+
)}
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function MenuToggle({
|
|
124
|
+
label,
|
|
125
|
+
checked,
|
|
126
|
+
onChange,
|
|
127
|
+
}: {
|
|
128
|
+
label: string;
|
|
129
|
+
checked: boolean;
|
|
130
|
+
onChange: () => void;
|
|
131
|
+
}) {
|
|
132
|
+
return (
|
|
133
|
+
<label className="squisq-view-menu-row" role="menuitemcheckbox" aria-checked={checked}>
|
|
134
|
+
<input
|
|
135
|
+
type="checkbox"
|
|
136
|
+
className="squisq-view-menu-checkbox"
|
|
137
|
+
checked={checked}
|
|
138
|
+
onChange={onChange}
|
|
139
|
+
/>
|
|
140
|
+
<span className="squisq-view-menu-label">{label}</span>
|
|
141
|
+
</label>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function MenuRadioGroup({
|
|
146
|
+
label,
|
|
147
|
+
name,
|
|
148
|
+
value,
|
|
149
|
+
onChange,
|
|
150
|
+
options,
|
|
151
|
+
}: {
|
|
152
|
+
label: string;
|
|
153
|
+
name: string;
|
|
154
|
+
value: string;
|
|
155
|
+
onChange: (next: string) => void;
|
|
156
|
+
options: readonly { value: string; label: string }[];
|
|
157
|
+
}) {
|
|
158
|
+
return (
|
|
159
|
+
<div
|
|
160
|
+
className="squisq-view-menu-row squisq-view-menu-row--radios"
|
|
161
|
+
role="radiogroup"
|
|
162
|
+
aria-label={label}
|
|
163
|
+
>
|
|
164
|
+
<span className="squisq-view-menu-label">{label}</span>
|
|
165
|
+
{options.map((o) => {
|
|
166
|
+
const checked = o.value === value;
|
|
167
|
+
return (
|
|
168
|
+
<label
|
|
169
|
+
key={o.value}
|
|
170
|
+
className="squisq-view-menu-radio-row"
|
|
171
|
+
role="menuitemradio"
|
|
172
|
+
aria-checked={checked}
|
|
173
|
+
>
|
|
174
|
+
<input
|
|
175
|
+
type="radio"
|
|
176
|
+
className="squisq-view-menu-radio"
|
|
177
|
+
name={name}
|
|
178
|
+
value={o.value}
|
|
179
|
+
checked={checked}
|
|
180
|
+
onChange={() => onChange(o.value)}
|
|
181
|
+
/>
|
|
182
|
+
<span className="squisq-view-menu-radio-label">{o.label}</span>
|
|
183
|
+
</label>
|
|
184
|
+
);
|
|
185
|
+
})}
|
|
186
|
+
</div>
|
|
187
|
+
);
|
|
188
|
+
}
|