@soul-refiner/design-system 1.1.11 → 1.3.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/components/editor/constants.d.ts +8 -27
- package/dist/components/editor/constants.js +6 -94
- package/dist/components/editor/context.d.ts +10 -0
- package/dist/components/editor/context.js +6 -0
- package/dist/components/editor/editor.d.ts +9 -2
- package/dist/components/editor/editor.js +11 -5
- package/dist/components/editor/navbar/navbar.d.ts +1 -1
- package/dist/components/editor/navbar/navbar.js +1 -1
- package/dist/components/editor/plugins/index.js +7 -2
- package/dist/components/editor/plugins/qa.d.ts +4 -0
- package/dist/components/editor/plugins/qa.js +43 -0
- package/dist/components/editor/plugins/video.d.ts +4 -0
- package/dist/components/editor/plugins/video.js +40 -0
- package/package.json +1 -1
|
@@ -1,50 +1,31 @@
|
|
|
1
1
|
export { ELEMENT_BLOCKQUOTE, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_DEFAULT, ELEMENT_H1, ELEMENT_H2, ELEMENT_H3, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_HR, ELEMENT_IMAGE, ELEMENT_LI, ELEMENT_LIC, ELEMENT_LINK, ELEMENT_MEDIA, ELEMENT_MEDIA_EMBED, ELEMENT_MENTION, ELEMENT_MENTION_INPUT, ELEMENT_OL, ELEMENT_PARAGRAPH, ELEMENT_TABLE, ELEMENT_TD, ELEMENT_TH, ELEMENT_TODO_LI, ELEMENT_TR, ELEMENT_UL, MARK_BG_COLOR, MARK_BOLD, MARK_CODE, MARK_COLOR, MARK_FONT_FAMILY, MARK_FONT_SIZE, MARK_FONT_WEIGHT, MARK_HIGHLIGHT, MARK_ITALIC, MARK_KBD, MARK_SEARCH_HIGHLIGHT, MARK_STRIKETHROUGH, MARK_SUBSCRIPT, MARK_SUPERSCRIPT, MARK_UNDERLINE, } from '@udecode/plate';
|
|
2
|
-
export declare const ELEMENT_AUDIO = "audio";
|
|
3
|
-
export declare const ELEMENT_BIBLE_QUOTE = "bible-quote";
|
|
4
2
|
export declare const ELEMENT_BUTTON = "button";
|
|
5
|
-
export declare const ELEMENT_EXAMPLE = "example";
|
|
6
|
-
export declare const ELEMENT_FOOTNOTE = "footnote";
|
|
7
3
|
export declare const ELEMENT_PAYWALL = "paywall";
|
|
8
|
-
export declare const ELEMENT_POLL = "poll";
|
|
9
4
|
export declare const ELEMENT_QA = "q-n-a";
|
|
10
|
-
export declare const ELEMENT_RECIPE = "recipe";
|
|
11
5
|
export declare const ELEMENT_VIDEO = "video";
|
|
12
6
|
export declare const BUTTON_LINK = "button-link";
|
|
13
7
|
export declare const BUTTON_SUBSCRIBE = "button-subscribe";
|
|
14
8
|
export declare const COLORS: string[];
|
|
15
9
|
export declare const PLACEHOLDER = "This is a placeholder";
|
|
16
10
|
export declare const DEFAULT_CONTENT: ({
|
|
17
|
-
type: string;
|
|
18
11
|
children: {
|
|
19
12
|
text: string;
|
|
20
|
-
bold: boolean;
|
|
21
13
|
}[];
|
|
22
|
-
|
|
23
|
-
url?: undefined;
|
|
24
|
-
} | {
|
|
14
|
+
questionAnswerId: string;
|
|
25
15
|
type: string;
|
|
26
|
-
|
|
27
|
-
text: string;
|
|
28
|
-
italic?: undefined;
|
|
29
|
-
} | {
|
|
30
|
-
text: string;
|
|
31
|
-
italic: boolean;
|
|
32
|
-
})[];
|
|
33
|
-
align?: undefined;
|
|
34
|
-
url?: undefined;
|
|
16
|
+
thumbnail?: undefined;
|
|
35
17
|
} | {
|
|
36
|
-
type: string;
|
|
37
|
-
align: string;
|
|
38
18
|
children: {
|
|
39
19
|
text: string;
|
|
40
|
-
bold: boolean;
|
|
41
20
|
}[];
|
|
42
|
-
|
|
43
|
-
} | {
|
|
21
|
+
thumbnail: string;
|
|
44
22
|
type: string;
|
|
45
|
-
|
|
23
|
+
questionAnswerId?: undefined;
|
|
24
|
+
} | {
|
|
46
25
|
children: {
|
|
47
26
|
text: string;
|
|
48
27
|
}[];
|
|
49
|
-
|
|
28
|
+
type: string;
|
|
29
|
+
questionAnswerId?: undefined;
|
|
30
|
+
thumbnail?: undefined;
|
|
50
31
|
})[];
|
|
@@ -1,20 +1,8 @@
|
|
|
1
1
|
export { ELEMENT_BLOCKQUOTE, ELEMENT_CODE_LINE, ELEMENT_CODE_SYNTAX, ELEMENT_DEFAULT, ELEMENT_H1, ELEMENT_H2, ELEMENT_H3, ELEMENT_H4, ELEMENT_H5, ELEMENT_H6, ELEMENT_HR, ELEMENT_IMAGE, ELEMENT_LI, ELEMENT_LIC, ELEMENT_LINK, ELEMENT_MEDIA, ELEMENT_MEDIA_EMBED, ELEMENT_MENTION, ELEMENT_MENTION_INPUT, ELEMENT_OL, ELEMENT_PARAGRAPH, ELEMENT_TABLE, ELEMENT_TD, ELEMENT_TH, ELEMENT_TODO_LI, ELEMENT_TR, ELEMENT_UL, MARK_BG_COLOR, MARK_BOLD, MARK_CODE, MARK_COLOR, MARK_FONT_FAMILY, MARK_FONT_SIZE, MARK_FONT_WEIGHT, MARK_HIGHLIGHT, MARK_ITALIC, MARK_KBD, MARK_SEARCH_HIGHLIGHT, MARK_STRIKETHROUGH, MARK_SUBSCRIPT, MARK_SUPERSCRIPT, MARK_UNDERLINE, } from '@udecode/plate';
|
|
2
|
-
export const ELEMENT_AUDIO = 'audio';
|
|
3
|
-
export const ELEMENT_BIBLE_QUOTE = 'bible-quote';
|
|
4
2
|
export const ELEMENT_BUTTON = 'button';
|
|
5
|
-
export const ELEMENT_EXAMPLE = 'example';
|
|
6
|
-
export const ELEMENT_FOOTNOTE = 'footnote';
|
|
7
3
|
export const ELEMENT_PAYWALL = 'paywall';
|
|
8
|
-
export const ELEMENT_POLL = 'poll';
|
|
9
4
|
export const ELEMENT_QA = 'q-n-a';
|
|
10
|
-
export const ELEMENT_RECIPE = 'recipe';
|
|
11
5
|
export const ELEMENT_VIDEO = 'video';
|
|
12
|
-
// export const BUTTON_COMMENT = 'button-comment';
|
|
13
|
-
// export const BUTTON_GIFT_SUBSCRIPTION = 'button-gift-subscription';
|
|
14
|
-
// export const BUTTON_SHARE = 'button-share';
|
|
15
|
-
// export const BUTTON_SHARE_PAGE = 'button-share-page';
|
|
16
|
-
// export const BUTTON_SIGNUP = 'signup';
|
|
17
|
-
// export const BUTTON_SPECIAL_OFFER = 'button-special-offer';
|
|
18
6
|
export const BUTTON_LINK = 'button-link';
|
|
19
7
|
export const BUTTON_SUBSCRIBE = 'button-subscribe';
|
|
20
8
|
export const COLORS = [
|
|
@@ -29,105 +17,29 @@ export const COLORS = [
|
|
|
29
17
|
export const PLACEHOLDER = 'This is a placeholder';
|
|
30
18
|
export const DEFAULT_CONTENT = [
|
|
31
19
|
{
|
|
32
|
-
type: 'h1',
|
|
33
20
|
children: [
|
|
34
21
|
{
|
|
35
|
-
text: '
|
|
36
|
-
bold: true,
|
|
22
|
+
text: 'What are you struggling with today and how is it affecting the people you love? This is a longer sentence to see what it looks like.',
|
|
37
23
|
},
|
|
38
24
|
],
|
|
25
|
+
questionAnswerId: 'q-n-a-ac0396ed-62ed-4a30-ba12-98f4fa2d364c',
|
|
26
|
+
type: ELEMENT_QA,
|
|
39
27
|
},
|
|
40
28
|
{
|
|
41
|
-
type: 'p',
|
|
42
|
-
children: [
|
|
43
|
-
{
|
|
44
|
-
text: 'Welcome to Warpath. You’re about to embark on a journey towards lifelong healing, freedom and victory. This is a season of training. It’s sanctification on steroids, not for the faint-hearted, but for those who truly desire to live the rest of their lives for Jesus. No reserves, no retreats, no regrets.',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
text: ' What was once your deepest, darkest secret will now become the word of your testimony that heals and liberates others.',
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
type: 'p',
|
|
53
|
-
children: [
|
|
54
|
-
{
|
|
55
|
-
text: 'In this new season, God is calling you up. He’s calling you to a higher level, a place where you’re no longer part of the problem but are becoming a part of the solution.',
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
text: '',
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
type: 'blockquote',
|
|
64
|
-
children: [
|
|
65
|
-
{
|
|
66
|
-
text: '"Warpath isn’t about just winning for you; that’s the beginning. Warpath is about you taking the battle and winning for others so they can have their families, and their marriages, and their destinies." \n— ',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
text: 'Dr. Doug Weiss',
|
|
70
|
-
italic: true,
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
},
|
|
74
|
-
// {
|
|
75
|
-
// type: 'hr',
|
|
76
|
-
// children: [
|
|
77
|
-
// {
|
|
78
|
-
// text: '',
|
|
79
|
-
// },
|
|
80
|
-
// ],
|
|
81
|
-
// },
|
|
82
|
-
{
|
|
83
|
-
type: 'h3',
|
|
84
|
-
align: 'center',
|
|
85
29
|
children: [
|
|
86
30
|
{
|
|
87
|
-
text: '
|
|
88
|
-
bold: true,
|
|
31
|
+
text: 'Episode 2: A Warrior’s Roadmap',
|
|
89
32
|
},
|
|
90
33
|
],
|
|
34
|
+
thumbnail: 'https://f005.backblazeb2.com/file/sr-platform/f7a84d1f4e70a940b63d7d6d96beab68.jpg',
|
|
35
|
+
type: ELEMENT_VIDEO,
|
|
91
36
|
},
|
|
92
|
-
// {
|
|
93
|
-
// type: 'hr',
|
|
94
|
-
// children: [
|
|
95
|
-
// {
|
|
96
|
-
// text: '',
|
|
97
|
-
// },
|
|
98
|
-
// ],
|
|
99
|
-
// },
|
|
100
37
|
{
|
|
101
|
-
type: 'img',
|
|
102
|
-
url: 'https://source.unsplash.com/1600x900/?christian',
|
|
103
38
|
children: [
|
|
104
39
|
{
|
|
105
40
|
text: '',
|
|
106
41
|
},
|
|
107
42
|
],
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
type: 'p',
|
|
111
|
-
children: [
|
|
112
|
-
{
|
|
113
|
-
text: 'Identity: You will have to grasp your true identity in Christ. You cannot look at this as a “what”, but instead about a “who”. We must become more like Christ, because He is a warrior.',
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
type: 'p',
|
|
119
|
-
children: [
|
|
120
|
-
{
|
|
121
|
-
text: 'A different DNA: As a warrior, your spiritual genetic code will be different from those who haven’t tasted the victory and grace you’ve experienced from this battle. You’ve experienced truth as a person: Jesus; and it has forever changed you. You’ve been set apart as a “fighting man”, no longer a civilian idly consumed by the cares of this world, but a warrior who’s passionate about the Kingdom and craving some sweet revenge.',
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
43
|
type: 'p',
|
|
127
|
-
children: [
|
|
128
|
-
{
|
|
129
|
-
text: '',
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
44
|
},
|
|
133
45
|
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const EditorContext: React.Context<{
|
|
3
|
+
commentInputLoader: (props: {
|
|
4
|
+
questionAnswerId: string;
|
|
5
|
+
}) => React.ReactElement;
|
|
6
|
+
commentLoader: (props: {
|
|
7
|
+
questionAnswerId: string;
|
|
8
|
+
}) => React.ReactElement;
|
|
9
|
+
handleVideoClick?: ((id: number) => void) | undefined;
|
|
10
|
+
}>;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TElement } from '@udecode/plate';
|
|
3
3
|
export interface EditorProps {
|
|
4
|
+
commentInputLoader: (props: {
|
|
5
|
+
questionAnswerId: string;
|
|
6
|
+
}) => React.ReactElement;
|
|
7
|
+
commentLoader: (props: {
|
|
8
|
+
questionAnswerId: string;
|
|
9
|
+
}) => React.ReactElement;
|
|
4
10
|
communityName: string;
|
|
5
11
|
editable: boolean;
|
|
6
|
-
handleUploadImage
|
|
12
|
+
handleUploadImage?: (files: FileList) => Promise<string>;
|
|
13
|
+
handleVideoClick?: (id: number) => void;
|
|
7
14
|
onChange: (newNodes: TElement[]) => void;
|
|
8
15
|
previousContent?: TElement[];
|
|
9
16
|
}
|
|
10
17
|
export type EditorContent = TElement;
|
|
11
|
-
export declare const Editor: ({ editable, handleUploadImage, onChange, previousContent, }: EditorProps) => React.JSX.Element;
|
|
18
|
+
export declare const Editor: ({ commentInputLoader, commentLoader, editable, handleUploadImage, handleVideoClick, onChange, previousContent, }: EditorProps) => React.JSX.Element;
|
|
@@ -3,17 +3,23 @@ import React from 'react';
|
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { createPlugins, Plate, PlateContent } from '@udecode/plate';
|
|
5
5
|
import { DEFAULT_CONTENT, PLACEHOLDER } from './constants';
|
|
6
|
+
import { EditorContext } from './context';
|
|
6
7
|
import { EditorBar } from './navbar';
|
|
7
8
|
import { plateUI } from './plate';
|
|
8
9
|
import { blocks, inline, marks, utils } from './plugins';
|
|
9
10
|
const plugins = createPlugins([...blocks, ...inline, ...marks, ...utils], {
|
|
10
11
|
components: plateUI,
|
|
11
12
|
});
|
|
12
|
-
export const Editor = ({ editable, handleUploadImage, onChange, previousContent = DEFAULT_CONTENT, }) => {
|
|
13
|
-
return (React.createElement(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
export const Editor = ({ commentInputLoader, commentLoader, editable, handleUploadImage, handleVideoClick, onChange, previousContent = DEFAULT_CONTENT, }) => {
|
|
14
|
+
return (React.createElement(EditorContext.Provider, { value: {
|
|
15
|
+
commentInputLoader,
|
|
16
|
+
commentLoader,
|
|
17
|
+
handleVideoClick,
|
|
18
|
+
} },
|
|
19
|
+
React.createElement(Plate, { id: "main", initialValue: previousContent, onChange: onChange, plugins: plugins },
|
|
20
|
+
React.createElement(Wrapper, null,
|
|
21
|
+
editable && React.createElement(EditorBar, { handleUploadImage: handleUploadImage }),
|
|
22
|
+
React.createElement(PlateContent, { id: "main", autoFocus: true, placeholder: PLACEHOLDER, readOnly: !editable, spellCheck: true })))));
|
|
17
23
|
};
|
|
18
24
|
const Wrapper = styled.div `
|
|
19
25
|
* {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface EditorBarProps {
|
|
3
|
-
handleUploadImage
|
|
3
|
+
handleUploadImage?: (files: FileList) => Promise<string>;
|
|
4
4
|
}
|
|
5
5
|
export declare const EditorBar: ({ handleUploadImage }: EditorBarProps) => React.JSX.Element;
|
|
6
6
|
export declare const MenuButton: import("styled-components").IStyledComponent<"web", import("styled-components/dist/types").Substitute<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
@@ -61,7 +61,7 @@ export const EditorBar = ({ handleUploadImage }) => {
|
|
|
61
61
|
};
|
|
62
62
|
const handleImageChange = async () => {
|
|
63
63
|
const files = imageRef.current?.files;
|
|
64
|
-
if (!files)
|
|
64
|
+
if (!files || !handleUploadImage)
|
|
65
65
|
return;
|
|
66
66
|
const imageurl = await handleUploadImage(files);
|
|
67
67
|
if (imageurl) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* PLUGINS
|
|
3
3
|
*/
|
|
4
|
-
import { createBlockquotePlugin, createCodeBlockPlugin, createHeadingPlugin, createHorizontalRulePlugin, createIndentListPlugin, createImagePlugin, createTextIndentPlugin, createListPlugin, createMediaEmbedPlugin, createResetNodePlugin, createTablePlugin, createBoldPlugin, createCodePlugin, createFontBackgroundColorPlugin, createFontSizePlugin, createFontFamilyPlugin, createItalicPlugin, createStrikethroughPlugin, createSubscriptPlugin, createSuperscriptPlugin, createUnderlinePlugin, createAlignPlugin, createIndentPlugin, createLineHeightPlugin,
|
|
4
|
+
import { createBlockquotePlugin, createCodeBlockPlugin, createHeadingPlugin, createHorizontalRulePlugin, createIndentListPlugin, createImagePlugin, createTextIndentPlugin, createListPlugin, createMediaEmbedPlugin, createResetNodePlugin, createTablePlugin, createBoldPlugin, createCodePlugin, createFontBackgroundColorPlugin, createFontSizePlugin, createFontFamilyPlugin, createItalicPlugin, createStrikethroughPlugin, createSubscriptPlugin, createSuperscriptPlugin, createUnderlinePlugin, createAlignPlugin, createIndentPlugin, createLineHeightPlugin, createExitBreakPlugin, createHistoryPlugin, createSelectOnBackspacePlugin, createSoftBreakPlugin, } from '@udecode/plate';
|
|
5
|
+
import { createLinkPlugin } from '@udecode/plate-link';
|
|
5
6
|
import { createButtonsPlugin } from './buttons';
|
|
6
7
|
import { exitBreakPlugin } from './exitBreak';
|
|
7
8
|
import { resetBlockTypePlugin } from './resetBlockType';
|
|
@@ -9,6 +10,8 @@ import { selectOnBackspace } from './selectOnBackspace';
|
|
|
9
10
|
import { softBreakPlugin } from './softBreak';
|
|
10
11
|
import { createParagraphPlugin, createHOnePlugin, createHTwoPlugin, createHThreePlugin, createHFourPlugin, createHFivePlugin, createHSixPlugin, } from './text';
|
|
11
12
|
import { LinkFloatingMenu } from './link';
|
|
13
|
+
import { createQAPlugin } from './qa';
|
|
14
|
+
import { createVideoTitlePlugin } from './video';
|
|
12
15
|
/**
|
|
13
16
|
* ELEMENT TYPES
|
|
14
17
|
*/
|
|
@@ -28,6 +31,7 @@ export const blocks = [
|
|
|
28
31
|
disableEmbedInsert: true,
|
|
29
32
|
},
|
|
30
33
|
}),
|
|
34
|
+
createQAPlugin(),
|
|
31
35
|
createTextIndentPlugin(),
|
|
32
36
|
createIndentListPlugin({
|
|
33
37
|
inject: {
|
|
@@ -57,6 +61,7 @@ export const blocks = [
|
|
|
57
61
|
createHSixPlugin(),
|
|
58
62
|
createResetNodePlugin(),
|
|
59
63
|
createTablePlugin(),
|
|
64
|
+
createVideoTitlePlugin(),
|
|
60
65
|
];
|
|
61
66
|
export const marks = [
|
|
62
67
|
createBoldPlugin(),
|
|
@@ -95,7 +100,7 @@ export const inline = [
|
|
|
95
100
|
}),
|
|
96
101
|
createLineHeightPlugin(),
|
|
97
102
|
createLinkPlugin({
|
|
98
|
-
|
|
103
|
+
renderBeforeEditable: LinkFloatingMenu,
|
|
99
104
|
}),
|
|
100
105
|
];
|
|
101
106
|
export const utils = [
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PlateElementProps } from '@udecode/plate';
|
|
3
|
+
export declare const QuestionAnswerElement: React.ForwardRefExoticComponent<Omit<PlateElementProps, "ref"> & React.RefAttributes<any>>;
|
|
4
|
+
export declare const createQAPlugin: <OP = import("@udecode/utils").AnyObject, OV extends import("@udecode/slate").Value = import("@udecode/slate").Value, OE extends import("@udecode/plate-core").PlateEditor<OV> = import("@udecode/plate-core").PlateEditor<OV>>(override?: Partial<import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").NoInfer<OP>, OV, OE>> | undefined, overrideByKey?: import("@udecode/plate-core").OverrideByKey<OV, OE> | undefined) => import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").NoInfer<OP>, OV, OE>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createPluginFactory, PlateElement, } from '@udecode/plate';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { ELEMENT_QA } from '../constants';
|
|
5
|
+
import { EditorContext } from '../context';
|
|
6
|
+
import { Button } from '../../actions';
|
|
7
|
+
import { Box } from '../../atoms/box';
|
|
8
|
+
import { H } from '../../atoms/typography';
|
|
9
|
+
import { ChevronDown } from '../../../icons/arrow/chevron_down';
|
|
10
|
+
import { ChevronUp } from '../../../icons/arrow/chevron_up';
|
|
11
|
+
export const QuestionAnswerElement = React.forwardRef(({ children, element, ...props }, ref) => {
|
|
12
|
+
const { questionAnswerId } = element;
|
|
13
|
+
const { commentInputLoader: CommentInput, commentLoader: Comments } = React.useContext(EditorContext);
|
|
14
|
+
const [showAnswers, setShowAnswers] = React.useState(false);
|
|
15
|
+
return (React.createElement(PlateElement, { asChild: true, element: element, ref: ref, ...props },
|
|
16
|
+
React.createElement(React.Fragment, null,
|
|
17
|
+
React.createElement(Question, null,
|
|
18
|
+
React.createElement(H, { as: "p", "$fontSize": 18, "$lineHeight": 26, "$mediumBold": true }, children)),
|
|
19
|
+
React.createElement(Box, { "$dir": "column", "$gap": 24, "$padding": 24, ...{ contentEditable: false } },
|
|
20
|
+
React.createElement(Button, { as: "div", icon: showAnswers ? (React.createElement(ChevronUp, { color: "grey-3" })) : (React.createElement(ChevronDown, { color: "grey-3" })), onClick: () => setShowAnswers((prev) => !prev), size: "small", sx: `
|
|
21
|
+
width: fit-content;
|
|
22
|
+
flex-direction: row-reverse;
|
|
23
|
+
color: var(--color-grey-5);
|
|
24
|
+
&:not(:hover) svg {
|
|
25
|
+
fill: var(--color-grey-3);
|
|
26
|
+
}
|
|
27
|
+
`, type: "text", ...{ contentEditable: false } }, showAnswers ? 'Hide answers' : 'Show answers'),
|
|
28
|
+
showAnswers && React.createElement(Comments, { questionAnswerId: questionAnswerId }),
|
|
29
|
+
React.createElement(CommentInput, { questionAnswerId: questionAnswerId })))));
|
|
30
|
+
});
|
|
31
|
+
const Question = styled.div `
|
|
32
|
+
margin-bottom: 8px;
|
|
33
|
+
padding: 16px;
|
|
34
|
+
border-left: 8px solid var(--color-hue-blue-1);
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
background-color: var(--color-hue-blue-3);
|
|
37
|
+
`;
|
|
38
|
+
export const createQAPlugin = createPluginFactory({
|
|
39
|
+
key: ELEMENT_QA,
|
|
40
|
+
type: ELEMENT_QA,
|
|
41
|
+
isElement: true,
|
|
42
|
+
component: QuestionAnswerElement,
|
|
43
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PlateElementProps } from '@udecode/plate';
|
|
3
|
+
export declare const VideoTitleElement: React.ForwardRefExoticComponent<Omit<PlateElementProps, "ref"> & React.RefAttributes<any>>;
|
|
4
|
+
export declare const createVideoTitlePlugin: <OP = import("@udecode/utils").AnyObject, OV extends import("@udecode/slate").Value = import("@udecode/slate").Value, OE extends import("@udecode/plate-core").PlateEditor<OV> = import("@udecode/plate-core").PlateEditor<OV>>(override?: Partial<import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").NoInfer<OP>, OV, OE>> | undefined, overrideByKey?: import("@udecode/plate-core").OverrideByKey<OV, OE> | undefined) => import("@udecode/plate-core").PlatePlugin<import("@udecode/plate-core").NoInfer<OP>, OV, OE>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createPluginFactory, isEditorReadOnly, PlateElement, } from '@udecode/plate';
|
|
3
|
+
import Image from 'next/image';
|
|
4
|
+
import { ELEMENT_H2, ELEMENT_VIDEO } from '../constants';
|
|
5
|
+
import { EditorContext } from '../context';
|
|
6
|
+
import { Box } from '../../atoms/box';
|
|
7
|
+
import { H } from '../../atoms/typography';
|
|
8
|
+
import { PlaySolid } from '../../../icons/audio_video/play_solid';
|
|
9
|
+
export const VideoTitleElement = React.forwardRef(function VideoTitle({ children, editor, element, ...props }, ref) {
|
|
10
|
+
const editable = !isEditorReadOnly(editor);
|
|
11
|
+
const { thumbnail, id } = element;
|
|
12
|
+
const { handleVideoClick } = React.useContext(EditorContext);
|
|
13
|
+
const handleClick = () => {
|
|
14
|
+
if (handleVideoClick && !editable) {
|
|
15
|
+
handleVideoClick(id);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return (React.createElement(PlateElement, { asChild: true, editor: editor, element: element, ref: ref, ...props },
|
|
19
|
+
React.createElement(Box, { "$align": "center", "$gap": 24, onClick: handleClick, sx: editable ? '' : 'cursor: pointer;', ...{ contentEditable: false } },
|
|
20
|
+
React.createElement(Box, { "$align": "center", "$justify": "center", sx: "position: relative;" },
|
|
21
|
+
React.createElement(Image, { alt: "thumbnail", height: 96, src: thumbnail, style: {
|
|
22
|
+
borderRadius: '8px',
|
|
23
|
+
}, width: 171 }),
|
|
24
|
+
React.createElement(PlaySolid, { color: "white", size: 32, sx: "position: absolute;" })),
|
|
25
|
+
React.createElement(H, { as: "h2", "$bold": true, "$color": "grey-2", "$fontSize": 24, "$lineHeight": 36, "$textClampLines": 3 }, children))));
|
|
26
|
+
});
|
|
27
|
+
export const createVideoTitlePlugin = createPluginFactory({
|
|
28
|
+
key: ELEMENT_VIDEO,
|
|
29
|
+
type: ELEMENT_VIDEO,
|
|
30
|
+
isElement: true,
|
|
31
|
+
component: VideoTitleElement,
|
|
32
|
+
then: () => ({
|
|
33
|
+
inject: {
|
|
34
|
+
props: {
|
|
35
|
+
classNames: undefined,
|
|
36
|
+
validTypes: [ELEMENT_H2],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
}),
|
|
40
|
+
});
|