@bendyline/squisq-editor-react 1.6.0 → 1.6.2
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/README.md +57 -10
- package/dist/index.d.ts +476 -105
- package/dist/index.js +8703 -6741
- package/dist/index.js.map +1 -1
- package/dist/styles/fa-brands-400-AHOAZHCU.woff2 +0 -0
- package/dist/styles/fa-regular-400-VRZYIBIZ.woff2 +0 -0
- package/dist/styles/fa-solid-900-MDEYK55F.woff2 +0 -0
- package/dist/styles/fa-v4compatibility-ETEVP6IB.woff2 +0 -0
- package/dist/styles/index.css +14617 -0
- package/package.json +15 -7
- package/src/BlockPropertiesPopover.tsx +23 -7
- package/src/EditorContext.tsx +22 -16
- package/src/EditorShell.tsx +121 -35
- package/src/MediaBin.tsx +171 -28
- package/src/OutlinePanel.tsx +26 -4
- package/src/PreviewControls.tsx +475 -145
- package/src/PreviewPanel.tsx +17 -9
- package/src/RawEditor.tsx +10 -4
- package/src/TemplateAnnotation.ts +22 -7
- package/src/TemplateContentPreview.tsx +56 -0
- package/src/TemplatePicker.tsx +295 -128
- package/src/ThemeCustomizerPanel.tsx +22 -15
- package/src/Toolbar.tsx +547 -217
- package/src/TransitionPicker.tsx +8 -1
- package/src/VersionHistoryPanel.tsx +2 -2
- package/src/ViewSwitcher.tsx +4 -4
- package/src/WysiwygEditor.tsx +45 -3
- package/src/__tests__/buildPreviewDocTransition.test.ts +1 -2
- package/src/__tests__/codeContextSectionView.test.tsx +95 -0
- package/src/__tests__/codeContextZoneManager.test.ts +127 -0
- package/src/__tests__/diffContextSections.test.ts +39 -0
- package/src/__tests__/editorShellCodeContext.test.tsx +86 -0
- package/src/__tests__/editorShellProps.test.tsx +363 -0
- package/src/__tests__/headingTransition.test.ts +59 -9
- package/src/__tests__/imageEditorShell.test.tsx +23 -0
- package/src/__tests__/mediaReferences.test.ts +82 -0
- package/src/__tests__/previewControls.test.tsx +163 -0
- package/src/__tests__/templateAnnotationRoundTrip.test.ts +23 -2
- package/src/__tests__/templateContentPreview.test.ts +101 -0
- package/src/__tests__/tiptapBridge.test.ts +47 -0
- package/src/__tests__/useJsonEditorTokens.test.ts +59 -0
- package/src/__tests__/useMediaRecorder.test.ts +17 -0
- package/src/codeContext/CodeContextSectionView.tsx +124 -0
- package/src/codeContext/CodeContextZoneManager.ts +149 -0
- package/src/codeContext/CodeContextZones.tsx +121 -0
- package/src/codeContext/diffContextSections.ts +38 -0
- package/src/codeContext/types.ts +75 -0
- package/src/diagram/DiagramWidget.tsx +6 -4
- package/src/headingTransition.ts +96 -21
- package/src/index.ts +34 -2
- package/src/jsonEditor/useJsonEditorTokens.ts +13 -43
- package/src/mediaReferences.ts +299 -0
- package/src/recorder/hooks/useMediaRecorder.ts +9 -10
- package/src/scene/Scene.tsx +53 -7
- package/src/scene/SceneBlockWidget.tsx +6 -3
- package/src/scene/SceneSelection.tsx +19 -15
- package/src/scene/SceneSideToolbar.tsx +89 -0
- package/src/scene/layers/DiagramEdges.tsx +4 -3
- package/src/scene/layers/edgeGeometry.ts +23 -4
- package/src/scene/scene.css +142 -2
- package/src/scene/tools/ConnectTool.ts +113 -24
- package/src/scene/tools/DrawingConnectTool.ts +86 -16
- package/src/scene/tools/SceneTool.ts +2 -0
- package/src/styles/code-context.css +155 -0
- package/src/styles/editor.css +991 -84
- package/src/styles/index.css +1 -0
- package/src/templateContentPreviewResolver.ts +353 -0
- package/src/tiptapBridge.ts +60 -33
package/README.md
CHANGED
|
@@ -11,9 +11,14 @@ Part of the [Squisq](https://github.com/bendyline/squisq) monorepo.
|
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
13
|
npm install @bendyline/squisq-editor-react @bendyline/squisq @bendyline/squisq-react
|
|
14
|
+
# optional: add monaco-editor only if you use the Raw (Monaco) view
|
|
15
|
+
npm install monaco-editor
|
|
14
16
|
```
|
|
15
17
|
|
|
16
|
-
**Peer dependencies:** `react` and `react-dom` (v18 or v19).
|
|
18
|
+
**Peer dependencies:** `react` and `react-dom` (v18 or v19). `monaco-editor`
|
|
19
|
+
(^0.50.0) is an **optional** peer dependency (v1.5) — install it only if you use
|
|
20
|
+
the Raw view; the WYSIWYG and Preview views work without it. Tiptap is bundled as
|
|
21
|
+
a regular dependency — you don't need to install it yourself.
|
|
17
22
|
|
|
18
23
|
## Quick Start
|
|
19
24
|
|
|
@@ -36,22 +41,58 @@ function App() {
|
|
|
36
41
|
|
|
37
42
|
## Components
|
|
38
43
|
|
|
39
|
-
| Component
|
|
40
|
-
|
|
|
41
|
-
| `EditorShell`
|
|
42
|
-
| `EditorProvider`
|
|
44
|
+
| Component | Description |
|
|
45
|
+
| ---------------------------------------------------- | ---------------------------------------------------------------- |
|
|
46
|
+
| `EditorShell` | Top-level editor — combines all three views with a view switcher |
|
|
47
|
+
| `EditorProvider` | Context provider for editor state management |
|
|
48
|
+
| `RawEditor` / `WysiwygEditor` / `PreviewPanel` | The individual views, exported for custom layouts |
|
|
49
|
+
| `JsonEditor` | Editable form for JSON values bound to a Squisq-annotated schema |
|
|
50
|
+
| `ImageEditor` / `ImageViewer` | Layered raster authoring surface + read-only viewer |
|
|
51
|
+
| `RecorderPanel` / `RecorderButton` / `RecorderModal` | Browser audio/camera/screen recording (MediaRecorder) |
|
|
52
|
+
| `FolderView` | Standalone folder browser surface |
|
|
53
|
+
|
|
54
|
+
Beyond components, the package also exports Tiptap extensions (diagram editor,
|
|
55
|
+
heading template annotations), the markdown ↔ Tiptap bridge
|
|
56
|
+
(`markdownToTiptap` / `tiptapToMarkdown`), drag-and-drop helpers
|
|
57
|
+
(`useFileDrop`, `processMediaFiles`), file-kind detection (`resolveFileKind`),
|
|
58
|
+
and block-at-a-time / timeline editing primitives (`useBlockNavigator`,
|
|
59
|
+
`BlockCardView`, `TimelineTrack`).
|
|
60
|
+
|
|
61
|
+
## Notable `EditorShell` features
|
|
62
|
+
|
|
63
|
+
- **Versioning** — pass `allowVersioning` + `workspaceContainer` to auto-save
|
|
64
|
+
snapshots on idle (`versioningAutoSaveIdleMs`, default 5000ms) with pruning
|
|
65
|
+
(`versioningPrunePolicy`, default keep-last-50); a Version History panel
|
|
66
|
+
appears in the toolbar.
|
|
67
|
+
- **Recording** — with a `mediaProvider` wired, a record button appears in the
|
|
68
|
+
toolbar (`allowRecording`, default `true`).
|
|
69
|
+
- **Panels** — `outline` (heading outline pane) and `inlinePreview` (per-block
|
|
70
|
+
SVG preview gutter, `inlinePreviewWidth` default 320).
|
|
71
|
+
- **Code & image modes** — pass `fileName` / `language` to get a Monaco-only
|
|
72
|
+
code editor, or `imageSrc` (+ `imageMode: 'edit'`) for the image surface.
|
|
73
|
+
- **Embedding** — `readOnly`, `placeholder`, `submitOnEnter`, `fullWidth`,
|
|
74
|
+
`thinMargins`, `minHeight`/`maxHeight` auto-grow for chat-composer use.
|
|
75
|
+
- **Color scheme** — pass `colorScheme="light" | "dark"` for the editor chrome
|
|
76
|
+
(**v1.5:** renamed from the old `theme` prop; `RawEditor`'s own `theme` prop is
|
|
77
|
+
now `monacoTheme`).
|
|
78
|
+
|
|
79
|
+
Also exported (v1.5): `useMonacoLoader` (share the load-once Monaco bootstrap),
|
|
80
|
+
and the custom theme / template provider stacks — `CustomThemeProvider` /
|
|
81
|
+
`useCustomThemes` / `useDocCustomThemes` and `CustomTemplateProvider` /
|
|
82
|
+
`useCustomTemplates` / `useDocCustomTemplates`.
|
|
43
83
|
|
|
44
84
|
## Context API
|
|
45
85
|
|
|
46
|
-
Use `useEditorContext()` to access editor state and actions from child
|
|
86
|
+
Use `useEditorContext()` to access editor state and actions from child
|
|
87
|
+
components. The context value is flat — state fields and action methods live
|
|
88
|
+
side by side:
|
|
47
89
|
|
|
48
90
|
```tsx
|
|
49
|
-
import {
|
|
91
|
+
import { useEditorContext } from '@bendyline/squisq-editor-react';
|
|
50
92
|
|
|
51
93
|
function MyComponent() {
|
|
52
|
-
const {
|
|
53
|
-
//
|
|
54
|
-
// actions.setMarkdown(), actions.setView()
|
|
94
|
+
const { markdownSource, doc, activeView, setMarkdownSource, setActiveView } = useEditorContext();
|
|
95
|
+
// markdownSource: string, doc: Doc | null, activeView: 'raw' | 'wysiwyg' | 'preview'
|
|
55
96
|
}
|
|
56
97
|
```
|
|
57
98
|
|
|
@@ -63,6 +104,12 @@ Import the editor CSS:
|
|
|
63
104
|
import '@bendyline/squisq-editor-react/styles';
|
|
64
105
|
```
|
|
65
106
|
|
|
107
|
+
## Full API Reference
|
|
108
|
+
|
|
109
|
+
See [docs/API.md](https://github.com/bendyline/squisq/blob/main/docs/API.md)
|
|
110
|
+
for the complete `EditorShellProps` reference, context API, and every exported
|
|
111
|
+
component, hook, and helper.
|
|
112
|
+
|
|
66
113
|
## Related Packages
|
|
67
114
|
|
|
68
115
|
| Package | Description |
|