Skip to content

Commit f8fd37f

Browse files
authored
feat(YfmTable): rework table controls – add drag-n-drop, rows and columns insertion (#831)
1 parent 9c80b9d commit f8fd37f

File tree

67 files changed

+3619
-770
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3619
-770
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type {StoryObj} from '@storybook/react';
2+
3+
import {YfmTableDnDDemo as component} from './YfmTableDnD';
4+
5+
export const Story: StoryObj<typeof component> = {
6+
args: {
7+
mobile: false,
8+
dnd: true,
9+
},
10+
};
11+
Story.storyName = "YFM Table D'n'D";
12+
13+
export default {
14+
title: "Examples / YFM Table D'n'D",
15+
component,
16+
};
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import {memo} from 'react';
2+
3+
import {MarkdownEditorView, useMarkdownEditor} from 'src/index';
4+
5+
import {PlaygroundLayout} from '../../../components/PlaygroundLayout';
6+
7+
import {markup} from './markup';
8+
9+
export type YfmTableDnDDemoProps = {
10+
mobile: boolean;
11+
dnd: boolean;
12+
};
13+
14+
export const YfmTableDnDDemo = memo<YfmTableDnDDemoProps>(function YfmTableDnDDemo({mobile, dnd}) {
15+
const editor = useMarkdownEditor(
16+
{
17+
mobile,
18+
initial: {
19+
mode: 'wysiwyg',
20+
markup,
21+
},
22+
wysiwygConfig: {
23+
extensionOptions: {
24+
yfmTable: {
25+
dnd,
26+
},
27+
},
28+
},
29+
},
30+
[mobile, dnd],
31+
);
32+
33+
return (
34+
<PlaygroundLayout
35+
editor={editor}
36+
view={({className}) => (
37+
<MarkdownEditorView
38+
autofocus
39+
stickyToolbar
40+
settingsVisible
41+
editor={editor}
42+
className={className}
43+
/>
44+
)}
45+
/>
46+
);
47+
});

0 commit comments

Comments
 (0)