@bendyline/squisq-editor-react 0.1.1 → 1.0.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/index.js +41 -33
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/Toolbar.tsx +50 -45
- package/src/styles/editor.css +21 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bendyline/squisq-editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "React editor shell with raw/WYSIWYG/preview modes for Squisq documents",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Bendyline",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@bendyline/squisq": "
|
|
50
|
-
"@bendyline/squisq-react": "
|
|
49
|
+
"@bendyline/squisq": "1.0.0",
|
|
50
|
+
"@bendyline/squisq-react": "1.0.0",
|
|
51
51
|
"@monaco-editor/react": "^4.6.0",
|
|
52
52
|
"@tiptap/extension-placeholder": "^2.11.0",
|
|
53
53
|
"@tiptap/extension-table": "^2.11.0",
|
package/src/Toolbar.tsx
CHANGED
|
@@ -413,52 +413,57 @@ export function Toolbar({ className }: ToolbarProps) {
|
|
|
413
413
|
</div>
|
|
414
414
|
|
|
415
415
|
{/* Formatting buttons — hidden in preview mode */}
|
|
416
|
-
{!isPreview &&
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
416
|
+
{!isPreview && (
|
|
417
|
+
<div className="squisq-toolbar-actions">
|
|
418
|
+
{groups.map((group, gi) => (
|
|
419
|
+
<div key={group} className="squisq-toolbar-group">
|
|
420
|
+
{gi > 0 && <div className="squisq-toolbar-separator" />}
|
|
421
|
+
{BUTTONS.filter((b) => b.group === group).map((btn) => {
|
|
422
|
+
const active = isWysiwyg ? isTiptapActive(tiptapEditor, btn.id) : false;
|
|
423
|
+
return (
|
|
424
|
+
<button
|
|
425
|
+
key={btn.id}
|
|
426
|
+
className={`squisq-toolbar-button${active ? ' squisq-toolbar-button--active' : ''}`}
|
|
427
|
+
title={btn.title}
|
|
428
|
+
onClick={() => handleAction(btn.id)}
|
|
429
|
+
aria-label={btn.title}
|
|
430
|
+
aria-pressed={active}
|
|
431
|
+
style={btn.iconStyle}
|
|
432
|
+
>
|
|
433
|
+
{btn.icon}
|
|
434
|
+
</button>
|
|
435
|
+
);
|
|
436
|
+
})}
|
|
437
|
+
</div>
|
|
438
|
+
))}
|
|
439
439
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
440
|
+
{/* Template picker — visible when cursor is in a heading (WYSIWYG) */}
|
|
441
|
+
{currentTemplate !== null && (
|
|
442
|
+
<>
|
|
443
|
+
<div className="squisq-toolbar-separator" />
|
|
444
|
+
<div className="squisq-toolbar-group squisq-template-picker">
|
|
445
|
+
<label
|
|
446
|
+
className="squisq-template-picker-label"
|
|
447
|
+
title="Block template for this heading"
|
|
448
|
+
>
|
|
449
|
+
Template:
|
|
450
|
+
<select
|
|
451
|
+
className="squisq-template-picker-select"
|
|
452
|
+
value={currentTemplate}
|
|
453
|
+
onChange={(e) => handleTemplatePick(e.target.value)}
|
|
454
|
+
>
|
|
455
|
+
<option value="">— none —</option>
|
|
456
|
+
{templateNames.map((name) => (
|
|
457
|
+
<option key={name} value={name}>
|
|
458
|
+
{name}
|
|
459
|
+
</option>
|
|
460
|
+
))}
|
|
461
|
+
</select>
|
|
462
|
+
</label>
|
|
463
|
+
</div>
|
|
464
|
+
</>
|
|
465
|
+
)}
|
|
466
|
+
</div>
|
|
462
467
|
)}
|
|
463
468
|
</div>
|
|
464
469
|
);
|
package/src/styles/editor.css
CHANGED
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
.squisq-toolbar {
|
|
58
58
|
display: flex;
|
|
59
59
|
align-items: center;
|
|
60
|
+
flex-wrap: wrap;
|
|
60
61
|
padding: 4px 12px;
|
|
61
62
|
gap: 2px;
|
|
62
63
|
}
|
|
@@ -69,6 +70,12 @@
|
|
|
69
70
|
margin-right: 2px;
|
|
70
71
|
}
|
|
71
72
|
|
|
73
|
+
.squisq-toolbar-actions {
|
|
74
|
+
display: flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
gap: 2px;
|
|
77
|
+
}
|
|
78
|
+
|
|
72
79
|
.squisq-toolbar-view-tab {
|
|
73
80
|
padding: 4px 14px;
|
|
74
81
|
border: none;
|
|
@@ -592,3 +599,17 @@
|
|
|
592
599
|
background: #374151;
|
|
593
600
|
color: #e5e7eb;
|
|
594
601
|
}
|
|
602
|
+
|
|
603
|
+
/* ─── Responsive: toolbar wraps on narrow viewports ──── */
|
|
604
|
+
|
|
605
|
+
@media (max-width: 640px) {
|
|
606
|
+
.squisq-toolbar-view-tabs {
|
|
607
|
+
margin-right: 0;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
.squisq-toolbar-actions {
|
|
611
|
+
flex-basis: 100%;
|
|
612
|
+
flex-wrap: wrap;
|
|
613
|
+
padding-top: 2px;
|
|
614
|
+
}
|
|
615
|
+
}
|