@flamingo-stack/openframe-frontend-core 0.0.612 → 0.0.613-2118.5994.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/{chunk-BG7TRGKP.cjs → chunk-276EROVV.cjs} +22 -22
- package/dist/{chunk-BG7TRGKP.cjs.map → chunk-276EROVV.cjs.map} +1 -1
- package/dist/{chunk-YXTAV2E3.cjs → chunk-2OREW4SL.cjs} +16 -2
- package/dist/chunk-2OREW4SL.cjs.map +1 -0
- package/dist/{chunk-PAC2VMWE.cjs → chunk-36GD5KOC.cjs} +9 -9
- package/dist/{chunk-PAC2VMWE.cjs.map → chunk-36GD5KOC.cjs.map} +1 -1
- package/dist/{chunk-NTUOX5QC.cjs → chunk-4H3JGIGZ.cjs} +3 -3
- package/dist/{chunk-NTUOX5QC.cjs.map → chunk-4H3JGIGZ.cjs.map} +1 -1
- package/dist/{chunk-UYT24TGS.js → chunk-4KMVXQJW.js} +5 -5
- package/dist/{chunk-2YQMBF2V.cjs → chunk-5OAU5YAO.cjs} +70 -70
- package/dist/{chunk-2YQMBF2V.cjs.map → chunk-5OAU5YAO.cjs.map} +1 -1
- package/dist/{chunk-M2QZI32A.cjs → chunk-5ZQWHR5K.cjs} +10 -10
- package/dist/{chunk-M2QZI32A.cjs.map → chunk-5ZQWHR5K.cjs.map} +1 -1
- package/dist/{chunk-F2C2U7CP.js → chunk-667WOI4D.js} +16 -2
- package/dist/chunk-667WOI4D.js.map +1 -0
- package/dist/{chunk-X4LTHAY5.js → chunk-7UI5DJSF.js} +2 -2
- package/dist/{chunk-44XMSKIY.js → chunk-ABY7UTVQ.js} +3 -3
- package/dist/{chunk-B4G3TQOP.cjs → chunk-BMM5VW4Y.cjs} +22 -22
- package/dist/{chunk-B4G3TQOP.cjs.map → chunk-BMM5VW4Y.cjs.map} +1 -1
- package/dist/{chunk-X2YX5HN5.js → chunk-C6UMRTEV.js} +3 -3
- package/dist/{chunk-Y775VLFS.cjs → chunk-DESNTW3L.cjs} +3 -3
- package/dist/{chunk-Y775VLFS.cjs.map → chunk-DESNTW3L.cjs.map} +1 -1
- package/dist/{chunk-IDVXWDYF.js → chunk-DONH7AHG.js} +3 -3
- package/dist/{chunk-FXP2J34I.cjs → chunk-EVBLEWLF.cjs} +25 -25
- package/dist/{chunk-FXP2J34I.cjs.map → chunk-EVBLEWLF.cjs.map} +1 -1
- package/dist/{chunk-XSDNHDSX.cjs → chunk-GWVH3RFQ.cjs} +10 -10
- package/dist/{chunk-XSDNHDSX.cjs.map → chunk-GWVH3RFQ.cjs.map} +1 -1
- package/dist/{chunk-EJTSKGAA.js → chunk-HMOBSK67.js} +5 -5
- package/dist/{chunk-2LSVHTRX.js → chunk-JEM7QP64.js} +2 -2
- package/dist/{chunk-2ARMWGMN.js → chunk-JHFYWBQL.js} +2 -2
- package/dist/{chunk-WYRBZJTT.js → chunk-JMSB5AUS.js} +6 -6
- package/dist/{chunk-CFFY6TT3.js → chunk-M7ZHKZMT.js} +2 -2
- package/dist/{chunk-DZMEAV47.js → chunk-MR22RVGZ.js} +50 -8
- package/dist/{chunk-DZMEAV47.js.map → chunk-MR22RVGZ.js.map} +1 -1
- package/dist/{chunk-J2RTUYK7.cjs → chunk-NFBTBZXA.cjs} +43 -43
- package/dist/{chunk-J2RTUYK7.cjs.map → chunk-NFBTBZXA.cjs.map} +1 -1
- package/dist/{chunk-LEKBOXVT.cjs → chunk-OAXOGKFD.cjs} +5 -5
- package/dist/{chunk-LEKBOXVT.cjs.map → chunk-OAXOGKFD.cjs.map} +1 -1
- package/dist/{chunk-3GICERNL.cjs → chunk-OGPFEPYR.cjs} +4 -4
- package/dist/{chunk-3GICERNL.cjs.map → chunk-OGPFEPYR.cjs.map} +1 -1
- package/dist/{chunk-TKRHBU7W.js → chunk-OLIEBXIS.js} +4 -4
- package/dist/{chunk-4QD4JCG3.cjs → chunk-QXLRO7ZT.cjs} +33 -33
- package/dist/{chunk-4QD4JCG3.cjs.map → chunk-QXLRO7ZT.cjs.map} +1 -1
- package/dist/{chunk-QMUFGSVF.cjs → chunk-RBA263EG.cjs} +207 -165
- package/dist/chunk-RBA263EG.cjs.map +1 -0
- package/dist/{chunk-LTYDKO22.js → chunk-W35UYD7W.js} +3 -3
- package/dist/{chunk-F7Y55UK5.js → chunk-Y2SCYKEX.js} +5 -5
- package/dist/{chunk-2XG3XBWA.cjs → chunk-YDCFOBF4.cjs} +15 -15
- package/dist/{chunk-2XG3XBWA.cjs.map → chunk-YDCFOBF4.cjs.map} +1 -1
- package/dist/{chunk-HBG6576N.js → chunk-ZQEG56IM.js} +3 -3
- package/dist/components/case-studies/index.cjs +9 -9
- package/dist/components/case-studies/index.js +3 -3
- package/dist/components/chat/index.cjs +2 -2
- package/dist/components/chat/index.js +1 -1
- package/dist/components/contact/index.cjs +4 -4
- package/dist/components/contact/index.js +3 -3
- package/dist/components/docs/index.cjs +7 -7
- package/dist/components/docs/index.js +6 -6
- package/dist/components/embeds/index.cjs +4 -4
- package/dist/components/embeds/index.js +3 -3
- package/dist/components/faq/index.cjs +4 -4
- package/dist/components/faq/index.js +3 -3
- package/dist/components/features/index.cjs +3 -3
- package/dist/components/features/index.js +2 -2
- package/dist/components/help-center-pages/index.cjs +23 -23
- package/dist/components/help-center-pages/index.js +14 -14
- package/dist/components/index.cjs +38 -38
- package/dist/components/index.js +13 -13
- package/dist/components/meeting-scheduler/index.cjs +24 -24
- package/dist/components/meeting-scheduler/index.js +2 -2
- package/dist/components/navigation/index.cjs +6 -6
- package/dist/components/navigation/index.js +5 -5
- package/dist/components/onboarding-guides/index.cjs +6 -6
- package/dist/components/onboarding-guides/index.js +5 -5
- package/dist/components/tickets/index.cjs +7 -7
- package/dist/components/tickets/index.js +6 -6
- package/dist/components/ui/index.cjs +3 -3
- package/dist/components/ui/index.js +2 -2
- package/dist/components/ui/markdown/base-components.d.ts.map +1 -1
- package/dist/components/ui/markdown-editor.d.ts.map +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.js +6 -6
- package/package.json +1 -1
- package/src/components/features/notifications/notification-drawer.tsx +2 -2
- package/src/components/ui/__tests__/__snapshots__/markdown-parity.test.tsx.snap +3 -3
- package/src/components/ui/markdown/base-components.tsx +16 -4
- package/src/components/ui/markdown-editor.tsx +46 -4
- package/src/stories/MarkdownEditor.stories.tsx +145 -0
- package/dist/chunk-F2C2U7CP.js.map +0 -1
- package/dist/chunk-QMUFGSVF.cjs.map +0 -1
- package/dist/chunk-YXTAV2E3.cjs.map +0 -1
- /package/dist/{chunk-UYT24TGS.js.map → chunk-4KMVXQJW.js.map} +0 -0
- /package/dist/{chunk-X4LTHAY5.js.map → chunk-7UI5DJSF.js.map} +0 -0
- /package/dist/{chunk-44XMSKIY.js.map → chunk-ABY7UTVQ.js.map} +0 -0
- /package/dist/{chunk-X2YX5HN5.js.map → chunk-C6UMRTEV.js.map} +0 -0
- /package/dist/{chunk-IDVXWDYF.js.map → chunk-DONH7AHG.js.map} +0 -0
- /package/dist/{chunk-EJTSKGAA.js.map → chunk-HMOBSK67.js.map} +0 -0
- /package/dist/{chunk-2LSVHTRX.js.map → chunk-JEM7QP64.js.map} +0 -0
- /package/dist/{chunk-2ARMWGMN.js.map → chunk-JHFYWBQL.js.map} +0 -0
- /package/dist/{chunk-WYRBZJTT.js.map → chunk-JMSB5AUS.js.map} +0 -0
- /package/dist/{chunk-CFFY6TT3.js.map → chunk-M7ZHKZMT.js.map} +0 -0
- /package/dist/{chunk-TKRHBU7W.js.map → chunk-OLIEBXIS.js.map} +0 -0
- /package/dist/{chunk-LTYDKO22.js.map → chunk-W35UYD7W.js.map} +0 -0
- /package/dist/{chunk-F7Y55UK5.js.map → chunk-Y2SCYKEX.js.map} +0 -0
- /package/dist/{chunk-HBG6576N.js.map → chunk-ZQEG56IM.js.map} +0 -0
|
@@ -373,11 +373,23 @@ export function buildBaseComponents({
|
|
|
373
373
|
li: ({ children }: MdRenderProps<'li'>) => <li className={cn('pl-2 leading-relaxed', textSizes.li)}>{children}</li>,
|
|
374
374
|
|
|
375
375
|
// --- tables ---
|
|
376
|
+
// The frame and the scroll container are ONE element, matching the sibling
|
|
377
|
+
// block embed (`mermaid-diagram.tsx`) and `users-grid-skeleton`. It used to
|
|
378
|
+
// be two — `overflow-x-auto` outside, `rounded-lg border` on an inner
|
|
379
|
+
// `min-w-full` div — so nothing clipped: the cells' own `border-r`/`border-b`
|
|
380
|
+
// ran straight through the rounded corners and out past the frame's edge.
|
|
381
|
+
// `overflow-x-auto` establishes clipping on both axes, which is what rounds
|
|
382
|
+
// the cell borders off with the frame; the inner div's `min-w-full` is
|
|
383
|
+
// redundant on a block-level scroll container.
|
|
384
|
+
//
|
|
385
|
+
// `[&_tr:last-child_td]:border-b-0` is on the table rather than in the `td`
|
|
386
|
+
// renderer because Tailwind's `last:` there means "last CELL in its row"
|
|
387
|
+
// (which is what `last:border-r-0` correctly uses), not "last row" — so the
|
|
388
|
+
// bottom row's `border-b` used to sit against the frame's own border as a
|
|
389
|
+
// doubled line.
|
|
376
390
|
table: ({ children }: MdRenderProps<'table'>) => (
|
|
377
|
-
<div className="table-container my-6 overflow-x-auto">
|
|
378
|
-
<
|
|
379
|
-
<table className="w-full table-fixed md:table-auto">{children}</table>
|
|
380
|
-
</div>
|
|
391
|
+
<div className="table-container my-6 overflow-x-auto rounded-lg border border-ods-border bg-ods-card">
|
|
392
|
+
<table className="w-full table-fixed md:table-auto [&_tr:last-child_td]:border-b-0">{children}</table>
|
|
381
393
|
</div>
|
|
382
394
|
),
|
|
383
395
|
thead: ({ children }: MdRenderProps<'thead'>) => <thead className="bg-ods-bg-surface">{children}</thead>,
|
|
@@ -13,7 +13,32 @@ const MARKDOWN_EDITOR_STYLE_ID = 'ods-markdown-editor-styles';
|
|
|
13
13
|
|
|
14
14
|
const mdEditorCSS = `
|
|
15
15
|
:root { --md-editor-text-color: var(--color-text-primary) !important; }
|
|
16
|
-
|
|
16
|
+
/* NAME COLLISION. --color-border-default is an ODS semantic alias AND a GitHub Primer
|
|
17
|
+
variable that @uiw/react-md-editor redeclares as #30363d on .wmde-markdown /
|
|
18
|
+
.wmde-markdown-var — and the editor root carries .wmde-markdown-var. The nearer
|
|
19
|
+
declaration wins, so every rule below that reads the alias inside the editor got the
|
|
20
|
+
vendor's blue-tinted grey, which is why the toolbar seam was drawn in a colour ODS
|
|
21
|
+
does not own.
|
|
22
|
+
inherit rather than a value: it makes the property take whatever the theme above
|
|
23
|
+
resolved, so the vendor's redeclaration is neutralised WITHOUT this file asserting a
|
|
24
|
+
colour of its own. That matters because ODS owns this name in more than one scope —
|
|
25
|
+
:root maps it to --ods-system-greys-soft-grey, and .theme-high-contrast to #ffffff.
|
|
26
|
+
Pinning the grey here would have quietly disabled the accessibility theme inside the
|
|
27
|
+
editor, which is the one place a hardcoded value cannot be checked against.
|
|
28
|
+
The .wmde-markdown half covers the vendor's own preview renderer, which a consumer
|
|
29
|
+
that does not pass renderPreview still gets. */
|
|
30
|
+
body .w-md-editor, body .w-md-editor .wmde-markdown { --color-border-default: inherit !important; }
|
|
31
|
+
/* padding-bottom is a vendor default (1px) and it is INSIDE the border box, so both
|
|
32
|
+
panes stop 1px short of the frame's inner edge and the frame's own background shows
|
|
33
|
+
through as a hairline across the entire bottom -- a shade lighter than the preview,
|
|
34
|
+
which paints --color-bg. Zeroing it also makes the panes' 5px bottom radius exact
|
|
35
|
+
(the frame's inner radius is its 6px minus the 1px border) instead of an arc floating
|
|
36
|
+
1px above the one it is meant to follow. The resize handle is positioned against the
|
|
37
|
+
PADDING box, whose bottom edge the padding never moved, so it stays where it was.
|
|
38
|
+
The frame's background is covered edge to edge now, but it stays the source-pane
|
|
39
|
+
surface rather than the body one so that a sub-pixel gap could never read as a dark
|
|
40
|
+
band across the lighter pane. The toolbar and the preview set their own. */
|
|
41
|
+
body .w-md-editor { background-color: var(--color-bg-card) !important; border: 1px solid var(--ods-system-greys-soft-grey) !important; border-radius: 6px !important; padding-bottom: 0 !important; --md-editor-text-color: var(--color-text-primary) !important; --md-editor-box-shadow-color: transparent !important; box-shadow: none !important; }
|
|
17
42
|
body .w-md-editor-area, body .w-md-editor-input, body .w-md-editor-text, body .w-md-editor-text-pre, body .w-md-editor-text-input, body .w-md-editor-text-textarea { background-color: var(--color-bg-card) !important; color: var(--color-text-primary) !important; font-family: var(--font-family-body) !important; font-size: 18px !important; font-weight: 500 !important; line-height: 24px !important; padding: 16px !important; }
|
|
18
43
|
body .w-md-editor-text-textarea::placeholder { color: var(--color-text-secondary) !important; font-family: var(--font-family-body) !important; font-size: 18px !important; font-weight: 500 !important; }
|
|
19
44
|
body .w-md-editor-text .token, body .w-md-editor-text-pre .token, body .w-md-editor-text-textarea, body .w-md-editor-text-input { color: var(--color-text-primary) !important; }
|
|
@@ -22,13 +47,30 @@ body .w-md-editor-text-pre .token.title, body .w-md-editor-text-pre .token.bold,
|
|
|
22
47
|
body .w-md-editor-text-textarea, body .w-md-editor-text-input, body .w-md-editor-text-pre { color: var(--color-text-primary) !important; -webkit-text-fill-color: var(--color-text-primary) !important; text-shadow: none !important; filter: brightness(1) contrast(1) !important; }
|
|
23
48
|
body .w-md-editor { color: var(--color-text-primary) !important; }
|
|
24
49
|
body .w-md-editor *:not(.w-md-editor-toolbar *, .w-md-editor-preview *, .custom-preview-wrapper *) { color: var(--color-text-primary) !important; -webkit-text-fill-color: var(--color-text-primary) !important; }
|
|
25
|
-
|
|
50
|
+
/* The toolbar's top corners follow the frame's own 6px radius. Rounding the toolbar
|
|
51
|
+
rather than clipping the whole editor with overflow:hidden on purpose: the toolbar's
|
|
52
|
+
dropdown commands render inside .w-md-editor and clipping would cut them off. */
|
|
53
|
+
.w-md-editor-toolbar { background-color: var(--color-bg) !important; border-bottom: 1px solid var(--color-border-default) !important; border-radius: 6px 6px 0 0 !important; padding: 12px 16px !important; }
|
|
26
54
|
.w-md-editor-toolbar ul li button { background: transparent !important; border: none !important; color: var(--color-text-primary) !important; padding: 8px 12px !important; border-radius: 6px !important; transition: all 0.2s ease !important; min-height: 36px !important; min-width: 36px !important; }
|
|
27
55
|
.w-md-editor-toolbar ul li button:hover { background-color: var(--color-border-default) !important; color: var(--ods-accent) !important; }
|
|
28
56
|
.w-md-editor-toolbar ul li button.active, .w-md-editor-toolbar ul li button[aria-pressed="true"] { background-color: var(--ods-accent) !important; color: var(--color-text-on-accent) !important; }
|
|
29
57
|
.w-md-editor-toolbar-divider { display: none !important; }
|
|
30
|
-
|
|
31
|
-
|
|
58
|
+
/* --color-border-muted / --color-fg-muted keep a literal ODS value on purpose: those are
|
|
59
|
+
Primer-only names with no ODS counterpart, so there is nothing above to inherit. */
|
|
60
|
+
.w-md-editor-preview { background-color: var(--color-bg) !important; color: var(--color-text-primary) !important; border-left: 1px solid var(--color-border-default) !important; --color-border-default: inherit !important; --color-border-muted: var(--ods-system-greys-soft-grey) !important; --color-fg-muted: var(--ods-system-greys-grey) !important; }
|
|
61
|
+
/* The seam under the toolbar. Two vendor defaults broke it, both visible as one artefact:
|
|
62
|
+
.w-md-editor-text drew its own border-top in the same colour as the toolbar's
|
|
63
|
+
border-bottom, so the two sat adjacent as a 2px line (no border-top here any more), and
|
|
64
|
+
the panes carry a 5px radius whose curve pulls their background off the frame's straight
|
|
65
|
+
inner edge, reading as a notch in the corner. Squaring the TOP corners is the fix, NOT
|
|
66
|
+
overflow:hidden on .w-md-editor: a parent's clip cannot square off a child's own rounded
|
|
67
|
+
corner, and it would cut the toolbar's title dropdown (~240px tall) on any editor shorter
|
|
68
|
+
than that. The BOTTOM corners keep 5px on purpose -- that is exactly the frame's inner
|
|
69
|
+
radius (6px border-box minus the 1px border), so with the vendor's padding-bottom zeroed
|
|
70
|
+
above, the panes' arc now sits on the frame's own arc instead of beside it. In the split
|
|
71
|
+
view the source pane's bottom-right curve falls in the middle of the frame, where the
|
|
72
|
+
frame's background matches it, so it is invisible there. */
|
|
73
|
+
.w-md-editor-area, .w-md-editor-input, .w-md-editor-text { border-radius: 0 0 5px 5px !important; }
|
|
32
74
|
.w-md-editor-focus { border-color: var(--ods-accent) !important; }
|
|
33
75
|
body .w-md-editor .w-md-editor-bar { width: 24px !important; height: 12px !important; margin-left: auto !important; margin-right: 8px !important; cursor: ns-resize !important; }
|
|
34
76
|
body .w-md-editor .w-md-editor-bar svg { display: none !important; }
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/nextjs-vite';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { MarkdownEditor } from '../components/ui/markdown-editor';
|
|
4
|
+
import { SimpleMarkdownRenderer } from '../components/ui/markdown/simple-markdown-renderer';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `MarkdownEditor` is controlled (`value` + `onChange`), so the stories hold the
|
|
8
|
+
* markdown here. `value`/`onChange` are hidden from the Controls table for the
|
|
9
|
+
* same reason: they are owned by this wrapper, and leaving them editable would
|
|
10
|
+
* offer a control that changes nothing.
|
|
11
|
+
*/
|
|
12
|
+
function ControlledEditor({
|
|
13
|
+
initialValue = '',
|
|
14
|
+
...props
|
|
15
|
+
}: { initialValue?: string } & Omit<React.ComponentProps<typeof MarkdownEditor>, 'value' | 'onChange'>) {
|
|
16
|
+
const [value, setValue] = useState(initialValue);
|
|
17
|
+
return <MarkdownEditor {...props} value={value} onChange={setValue} />;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The preview the Knowledge Base form passes: the vendor's own renderer is replaced
|
|
22
|
+
* by ours, so the pane shows what the article will actually look like. Copied from
|
|
23
|
+
* `article-form-fields.tsx` wrapper and all — the wrapper class is load-bearing, the
|
|
24
|
+
* editor's stylesheet excludes `.custom-preview-wrapper *` from its colour override.
|
|
25
|
+
*/
|
|
26
|
+
const renderPreview = (source: string) => (
|
|
27
|
+
<div className="custom-preview-wrapper" style={{ height: '100%', overflow: 'auto' }}>
|
|
28
|
+
<SimpleMarkdownRenderer content={source} />
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
/** Stand-in for the article-image upload the Knowledge Base form passes. */
|
|
33
|
+
const uploadStub = (file: File) =>
|
|
34
|
+
new Promise<string>(resolve => setTimeout(() => resolve(`https://example.com/uploads/${file.name}`), 600));
|
|
35
|
+
|
|
36
|
+
const SAMPLE = `## Restarting the print spooler
|
|
37
|
+
|
|
38
|
+
Run the following on the affected endpoint:
|
|
39
|
+
|
|
40
|
+
\`\`\`powershell
|
|
41
|
+
Restart-Service -Name Spooler -Force
|
|
42
|
+
\`\`\`
|
|
43
|
+
|
|
44
|
+
| Step | Command | Elevated |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| Stop | \`Stop-Service Spooler\` | yes |
|
|
47
|
+
| Clear | \`Remove-Item C:\\Windows\\System32\\spool\\PRINTERS\\*\` | yes |
|
|
48
|
+
| Start | \`Start-Service Spooler\` | yes |
|
|
49
|
+
|
|
50
|
+
> The queue is cleared for every user on the machine, not just the caller.
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
const meta = {
|
|
54
|
+
title: 'UI/MarkdownEditor',
|
|
55
|
+
component: MarkdownEditor,
|
|
56
|
+
parameters: {
|
|
57
|
+
layout: 'padded',
|
|
58
|
+
docs: {
|
|
59
|
+
description: {
|
|
60
|
+
component:
|
|
61
|
+
'Split markdown editor — toolbar, source pane and live preview. Wraps `@uiw/react-md-editor` and restyles it onto ODS tokens through an injected stylesheet, so its framing (border, radius, the toolbar/source seam) is owned here rather than by the vendor. Its one consumer is the Knowledge Base article form in `openframe-oss-frontend`, which is what `Default` reproduces.',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
tags: ['autodocs'],
|
|
66
|
+
argTypes: {
|
|
67
|
+
// Owned by `ControlledEditor` — see its note.
|
|
68
|
+
value: { table: { disable: true } },
|
|
69
|
+
onChange: { table: { disable: true } },
|
|
70
|
+
onUploadFile: { table: { disable: true } },
|
|
71
|
+
onFileUploaded: { table: { disable: true } },
|
|
72
|
+
renderPreview: { table: { disable: true } },
|
|
73
|
+
placeholder: { control: 'text', description: 'Placeholder shown while the editor is empty' },
|
|
74
|
+
disabled: { control: 'boolean', description: 'Disabled state' },
|
|
75
|
+
height: {
|
|
76
|
+
control: 'number',
|
|
77
|
+
description: 'Initial height in pixels (default 600). Resizable by the drag handle.',
|
|
78
|
+
},
|
|
79
|
+
minHeight: { control: 'number', description: 'Lower bound for the drag handle (default 100)' },
|
|
80
|
+
},
|
|
81
|
+
decorators: [
|
|
82
|
+
Story => (
|
|
83
|
+
<div style={{ padding: '2rem', backgroundColor: 'var(--ods-bg)' }}>
|
|
84
|
+
<Story />
|
|
85
|
+
</div>
|
|
86
|
+
),
|
|
87
|
+
],
|
|
88
|
+
} satisfies Meta<typeof MarkdownEditor>;
|
|
89
|
+
|
|
90
|
+
export default meta;
|
|
91
|
+
type Story = StoryObj<typeof meta>;
|
|
92
|
+
|
|
93
|
+
const base = { value: '', onChange: () => {} };
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* The Knowledge Base article form's own configuration: 400px tall and an upload
|
|
97
|
+
* handler, which is what puts the upload command at the end of the toolbar.
|
|
98
|
+
*/
|
|
99
|
+
export const Default: Story = {
|
|
100
|
+
args: { ...base, placeholder: 'Write the article content...', height: 400 },
|
|
101
|
+
render: args => <ControlledEditor {...args} onUploadFile={uploadStub} renderPreview={renderPreview} />,
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* With content, exercising the preview pane: headings, a fenced code block, a
|
|
106
|
+
* GFM table and a blockquote.
|
|
107
|
+
*/
|
|
108
|
+
export const WithContent: Story = {
|
|
109
|
+
args: { ...base, height: 400 },
|
|
110
|
+
render: args => (
|
|
111
|
+
<ControlledEditor {...args} initialValue={SAMPLE} onUploadFile={uploadStub} renderPreview={renderPreview} />
|
|
112
|
+
),
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Without an upload handler the component hides the upload command, leaving a
|
|
117
|
+
* toolbar one button shorter. Documented here because it is easy to reach by
|
|
118
|
+
* accident — a consumer that forgets the prop gets this silently.
|
|
119
|
+
*/
|
|
120
|
+
export const WithoutUpload: Story = {
|
|
121
|
+
args: { ...base, placeholder: 'No upload handler passed...', height: 400 },
|
|
122
|
+
render: args => <ControlledEditor {...args} />,
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Disabled — the toolbar stays visible but nothing is editable.
|
|
127
|
+
*/
|
|
128
|
+
export const Disabled: Story = {
|
|
129
|
+
args: { ...base, height: 300, disabled: true },
|
|
130
|
+
render: args => (
|
|
131
|
+
<ControlledEditor {...args} initialValue={SAMPLE} onUploadFile={uploadStub} renderPreview={renderPreview} />
|
|
132
|
+
),
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Short editor — the frame, the toolbar seam and the resize handle at the
|
|
137
|
+
* smallest size the component is used at. Note the toolbar's title dropdown is
|
|
138
|
+
* taller than this body, which is why the frame must not clip its children.
|
|
139
|
+
*/
|
|
140
|
+
export const Compact: Story = {
|
|
141
|
+
args: { ...base, height: 200, minHeight: 120 },
|
|
142
|
+
render: args => (
|
|
143
|
+
<ControlledEditor {...args} initialValue="Short note." onUploadFile={uploadStub} renderPreview={renderPreview} />
|
|
144
|
+
),
|
|
145
|
+
};
|