@bendyline/squisq-editor-react 1.1.0 → 1.1.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.
Files changed (45) hide show
  1. package/dist/EditorContext.d.ts +6 -2
  2. package/dist/EditorContext.d.ts.map +1 -1
  3. package/dist/EditorContext.js +3 -1
  4. package/dist/EditorContext.js.map +1 -1
  5. package/dist/EditorShell.d.ts +11 -1
  6. package/dist/EditorShell.d.ts.map +1 -1
  7. package/dist/EditorShell.js +9 -7
  8. package/dist/EditorShell.js.map +1 -1
  9. package/dist/ImageNodeView.d.ts +15 -0
  10. package/dist/ImageNodeView.d.ts.map +1 -0
  11. package/dist/ImageNodeView.js +52 -0
  12. package/dist/ImageNodeView.js.map +1 -0
  13. package/dist/PreviewControls.d.ts +41 -0
  14. package/dist/PreviewControls.d.ts.map +1 -0
  15. package/dist/PreviewControls.js +201 -0
  16. package/dist/PreviewControls.js.map +1 -0
  17. package/dist/PreviewPanel.d.ts +7 -7
  18. package/dist/PreviewPanel.d.ts.map +1 -1
  19. package/dist/PreviewPanel.js +183 -199
  20. package/dist/PreviewPanel.js.map +1 -1
  21. package/dist/Toolbar.d.ts +8 -1
  22. package/dist/Toolbar.d.ts.map +1 -1
  23. package/dist/Toolbar.js +4 -12
  24. package/dist/Toolbar.js.map +1 -1
  25. package/dist/WysiwygEditor.d.ts.map +1 -1
  26. package/dist/WysiwygEditor.js +3 -1
  27. package/dist/WysiwygEditor.js.map +1 -1
  28. package/dist/index.d.ts +2 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +1 -0
  31. package/dist/index.js.map +1 -1
  32. package/dist/tiptapBridge.d.ts.map +1 -1
  33. package/dist/tiptapBridge.js +4 -5
  34. package/dist/tiptapBridge.js.map +1 -1
  35. package/package.json +5 -4
  36. package/src/EditorContext.tsx +8 -1
  37. package/src/EditorShell.tsx +71 -32
  38. package/src/ImageNodeView.tsx +70 -0
  39. package/src/PreviewControls.tsx +340 -0
  40. package/src/PreviewPanel.tsx +216 -287
  41. package/src/Toolbar.tsx +23 -6
  42. package/src/WysiwygEditor.tsx +3 -1
  43. package/src/index.ts +6 -0
  44. package/src/styles/editor.css +31 -8
  45. package/src/tiptapBridge.ts +5 -6
@@ -21,6 +21,7 @@ import TaskList from '@tiptap/extension-task-list';
21
21
  import TaskItem from '@tiptap/extension-task-item';
22
22
  import Placeholder from '@tiptap/extension-placeholder';
23
23
  import { HeadingWithTemplate } from './TemplateAnnotation';
24
+ import { ImageWithMediaProvider } from './ImageNodeView';
24
25
  import { useEditorContext } from './EditorContext';
25
26
  import { markdownToTiptap, tiptapToMarkdown } from './tiptapBridge';
26
27
 
@@ -73,6 +74,7 @@ export function WysiwygEditor({
73
74
  TableHeader,
74
75
  TaskList,
75
76
  TaskItem.configure({ nested: true }),
77
+ ImageWithMediaProvider.configure({ inline: false }),
76
78
  Placeholder.configure({ placeholder }),
77
79
  ],
78
80
  content: markdownToTiptap(stripFrontmatter(markdownSource).body),
@@ -117,7 +119,7 @@ export function WysiwygEditor({
117
119
 
118
120
  return (
119
121
  <div
120
- className={className}
122
+ className={`squisq-wysiwyg-container${className ? ` ${className}` : ''}`}
121
123
  style={{ width: '100%', height: '100%', overflow: 'auto' }}
122
124
  data-testid="wysiwyg-container"
123
125
  >
package/src/index.ts CHANGED
@@ -40,6 +40,12 @@ export type { WysiwygEditorProps } from './WysiwygEditor.js';
40
40
 
41
41
  export { PreviewPanel } from './PreviewPanel.js';
42
42
  export type { PreviewPanelProps } from './PreviewPanel.js';
43
+ export {
44
+ PreviewSettingsProvider,
45
+ PreviewToolbarControls,
46
+ usePreviewSettings,
47
+ } from './PreviewControls.js';
48
+ export type { PreviewSettings } from './PreviewControls.js';
43
49
 
44
50
  // Chrome (for custom layouts)
45
51
  export { ViewSwitcher } from './ViewSwitcher.js';
@@ -58,7 +58,7 @@
58
58
  display: flex;
59
59
  align-items: center;
60
60
  flex-wrap: wrap;
61
- padding: 4px 12px;
61
+ padding: 0 12px 0 0;
62
62
  gap: 2px;
63
63
  }
64
64
 
@@ -67,7 +67,12 @@
67
67
  .squisq-toolbar-view-tabs {
68
68
  display: flex;
69
69
  gap: 0;
70
- margin-right: 2px;
70
+ margin-right: 12px;
71
+ padding: 0 16px 0 12px;
72
+ background: rgba(0, 0, 0, 0.07);
73
+ border-right: 1px solid rgba(0, 0, 0, 0.12);
74
+ align-self: stretch;
75
+ align-items: center;
71
76
  }
72
77
 
73
78
  .squisq-toolbar-actions {
@@ -80,7 +85,7 @@
80
85
  padding: 4px 14px;
81
86
  border: none;
82
87
  background: transparent;
83
- color: #6b7280;
88
+ color: #4b5563;
84
89
  cursor: pointer;
85
90
  font-size: 13px;
86
91
  font-weight: 500;
@@ -91,11 +96,12 @@
91
96
  }
92
97
 
93
98
  .squisq-toolbar-view-tab:hover {
94
- color: #1f2937;
99
+ color: #111827;
95
100
  }
96
101
 
97
102
  .squisq-toolbar-view-tab--active {
98
- color: #2563eb;
103
+ color: #1d4ed8;
104
+ font-weight: 600;
99
105
  border-bottom-color: #2563eb;
100
106
  }
101
107
 
@@ -237,12 +243,18 @@
237
243
 
238
244
  /* ─── WYSIWYG Editor ─────────────────────────────────── */
239
245
 
246
+ .squisq-wysiwyg-container {
247
+ background: #eeecea;
248
+ }
249
+
240
250
  .squisq-wysiwyg-editor {
241
251
  padding: 16px 24px;
242
252
  max-width: 800px;
243
253
  margin: 0 auto;
244
254
  outline: none;
245
255
  min-height: 100%;
256
+ background: #fff;
257
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.06);
246
258
  }
247
259
 
248
260
  .squisq-wysiwyg-editor h1 {
@@ -437,17 +449,22 @@
437
449
  /* no border-top — sits directly in header */
438
450
  }
439
451
 
452
+ .squisq-editor-shell[data-theme='dark'] .squisq-toolbar-view-tabs {
453
+ background: rgba(255, 255, 255, 0.08);
454
+ border-right-color: rgba(255, 255, 255, 0.15);
455
+ }
456
+
440
457
  /* View tabs (dark) */
441
458
  .squisq-editor-shell[data-theme='dark'] .squisq-toolbar-view-tab {
442
- color: #9ca3af;
459
+ color: #d1d5db;
443
460
  }
444
461
 
445
462
  .squisq-editor-shell[data-theme='dark'] .squisq-toolbar-view-tab:hover {
446
- color: #e5e7eb;
463
+ color: #f9fafb;
447
464
  }
448
465
 
449
466
  .squisq-editor-shell[data-theme='dark'] .squisq-toolbar-view-tab--active {
450
- color: #60a5fa;
467
+ color: #93c5fd;
451
468
  border-bottom-color: #60a5fa;
452
469
  }
453
470
 
@@ -516,8 +533,14 @@
516
533
  }
517
534
 
518
535
  /* WYSIWYG Editor */
536
+ .squisq-editor-shell[data-theme='dark'] .squisq-wysiwyg-container {
537
+ background: #0f1219;
538
+ }
539
+
519
540
  .squisq-editor-shell[data-theme='dark'] .squisq-wysiwyg-editor {
520
541
  color: #e5e7eb;
542
+ background: #111827;
543
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
521
544
  }
522
545
 
523
546
  .squisq-editor-shell[data-theme='dark'] .squisq-wysiwyg-editor blockquote {
@@ -39,9 +39,8 @@ const RE_STRIP_TAGS = /<[^>]+>/g;
39
39
  export function markdownToTiptap(markdown: string): string {
40
40
  if (!markdown.trim()) return '<p></p>';
41
41
 
42
- // Simple conversion of markdown constructs to HTML that Tiptap understands.
43
- // This is intentionally straightforward — Tiptap's parser handles the HTML.
44
- const html = markdown;
42
+ // Normalize line endings content from zip archives may use \r\n
43
+ const html = markdown.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
45
44
 
46
45
  // Process blocks line by line for accurate conversion
47
46
  const lines = html.split('\n');
@@ -384,12 +383,12 @@ function inlineToHtml(text: string): string {
384
383
  // Inline code: `text`
385
384
  result = result.replace(RE_INLINE_CODE, '<code>$1</code>');
386
385
 
386
+ // Images first: ![alt](src) — must be before links so the `!` prefix is consumed
387
+ result = result.replace(RE_IMAGE, '<img alt="$1" src="$2">');
388
+
387
389
  // Links: [text](url)
388
390
  result = result.replace(RE_LINK, '<a href="$2">$1</a>');
389
391
 
390
- // Images: ![alt](src)
391
- result = result.replace(RE_IMAGE, '<img alt="$1" src="$2">');
392
-
393
392
  return result;
394
393
  }
395
394