@pega/cosmos-react-demos 5.0.0-dev.8.3 → 5.0.0-dev.9.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/jsx/core/CheckboxGroup/CheckboxGroup.stories.d.ts.map +1 -1
- package/jsx/core/CheckboxGroup/CheckboxGroup.stories.jsx +4 -2
- package/jsx/core/CheckboxGroup/CheckboxGroup.stories.jsx.map +1 -1
- package/jsx/core/File/FileInput.stories.jsx +8 -1
- package/jsx/core/File/FileInput.stories.jsx.map +1 -1
- package/jsx/core/RadioButtonGroup/RadioButtonGroup.stories.d.ts.map +1 -1
- package/jsx/core/RadioButtonGroup/RadioButtonGroup.stories.jsx +4 -2
- package/jsx/core/RadioButtonGroup/RadioButtonGroup.stories.jsx.map +1 -1
- package/jsx/rte/Editor/Editor.mocks.d.ts +0 -1
- package/jsx/rte/Editor/Editor.mocks.d.ts.map +1 -1
- package/jsx/rte/Editor/Editor.mocks.jsx +0 -1
- package/jsx/rte/Editor/Editor.mocks.jsx.map +1 -1
- package/jsx/rte/Editor/Editor.stories.d.ts +3 -2
- package/jsx/rte/Editor/Editor.stories.d.ts.map +1 -1
- package/jsx/rte/Editor/Editor.stories.jsx +30 -9
- package/jsx/rte/Editor/Editor.stories.jsx.map +1 -1
- package/jsx/social/Email/Email.stories.d.ts +1 -0
- package/jsx/social/Email/Email.stories.d.ts.map +1 -1
- package/jsx/social/Email/Email.stories.jsx +11 -2
- package/jsx/social/Email/Email.stories.jsx.map +1 -1
- package/jsx/work/Article/Article.mocks.d.ts +1 -5
- package/jsx/work/Article/Article.mocks.d.ts.map +1 -1
- package/jsx/work/Article/Article.mocks.js +1 -5
- package/jsx/work/Article/Article.mocks.js.map +1 -1
- package/jsx/work/ArticleList/ArticleList.mocks.d.ts +5 -20
- package/jsx/work/ArticleList/ArticleList.mocks.d.ts.map +1 -1
- package/jsx/work/ArticleList/ArticleList.mocks.js +20 -20
- package/jsx/work/ArticleList/ArticleList.mocks.js.map +1 -1
- package/jsx/work/ArticleList/ArticleList.stories.d.ts.map +1 -1
- package/jsx/work/ArticleList/ArticleList.stories.jsx +8 -77
- package/jsx/work/ArticleList/ArticleList.stories.jsx.map +1 -1
- package/lib/core/CheckboxGroup/CheckboxGroup.stories.d.ts.map +1 -1
- package/lib/core/CheckboxGroup/CheckboxGroup.stories.js +4 -2
- package/lib/core/CheckboxGroup/CheckboxGroup.stories.js.map +1 -1
- package/lib/core/File/FileInput.stories.js +8 -1
- package/lib/core/File/FileInput.stories.js.map +1 -1
- package/lib/core/RadioButtonGroup/RadioButtonGroup.stories.d.ts.map +1 -1
- package/lib/core/RadioButtonGroup/RadioButtonGroup.stories.js +4 -2
- package/lib/core/RadioButtonGroup/RadioButtonGroup.stories.js.map +1 -1
- package/lib/rte/Editor/Editor.mocks.d.ts +0 -1
- package/lib/rte/Editor/Editor.mocks.d.ts.map +1 -1
- package/lib/rte/Editor/Editor.mocks.js +0 -1
- package/lib/rte/Editor/Editor.mocks.js.map +1 -1
- package/lib/rte/Editor/Editor.stories.d.ts +3 -2
- package/lib/rte/Editor/Editor.stories.d.ts.map +1 -1
- package/lib/rte/Editor/Editor.stories.js +30 -9
- package/lib/rte/Editor/Editor.stories.js.map +1 -1
- package/lib/social/Email/Email.stories.d.ts +1 -0
- package/lib/social/Email/Email.stories.d.ts.map +1 -1
- package/lib/social/Email/Email.stories.js +11 -2
- package/lib/social/Email/Email.stories.js.map +1 -1
- package/lib/work/Article/Article.mocks.d.ts +1 -5
- package/lib/work/Article/Article.mocks.d.ts.map +1 -1
- package/lib/work/Article/Article.mocks.js +1 -5
- package/lib/work/Article/Article.mocks.js.map +1 -1
- package/lib/work/ArticleList/ArticleList.mocks.d.ts +5 -20
- package/lib/work/ArticleList/ArticleList.mocks.d.ts.map +1 -1
- package/lib/work/ArticleList/ArticleList.mocks.js +20 -20
- package/lib/work/ArticleList/ArticleList.mocks.js.map +1 -1
- package/lib/work/ArticleList/ArticleList.stories.d.ts.map +1 -1
- package/lib/work/ArticleList/ArticleList.stories.js +8 -77
- package/lib/work/ArticleList/ArticleList.stories.js.map +1 -1
- package/package.json +8 -14
|
@@ -3,7 +3,7 @@ import { useState, useRef } from 'react';
|
|
|
3
3
|
import { action } from '@storybook/addon-actions';
|
|
4
4
|
import { Button, Card, CardContent, CardFooter, Flex, Link, Text, TextArea } from '@pega/cosmos-react-core';
|
|
5
5
|
import { Editor } from '@pega/cosmos-react-rte';
|
|
6
|
-
import { createPegaCustomElement
|
|
6
|
+
import { createPegaCustomElement } from './Editor.mocks';
|
|
7
7
|
export default {
|
|
8
8
|
title: 'RTE/Editor',
|
|
9
9
|
component: Editor
|
|
@@ -12,9 +12,13 @@ export const EditorDemo = (args) => {
|
|
|
12
12
|
const editorRef = useRef(null);
|
|
13
13
|
const onImageAdded = (image, id) => {
|
|
14
14
|
const src = URL.createObjectURL(image);
|
|
15
|
-
editorRef.current?.appendImage({
|
|
15
|
+
editorRef.current?.appendImage({
|
|
16
|
+
src,
|
|
17
|
+
alt: image.name,
|
|
18
|
+
attachmentId: 'sample-id'
|
|
19
|
+
}, id);
|
|
16
20
|
};
|
|
17
|
-
return (_jsx(Editor, { ref: editorRef, label: label, toolbar: ['inline-styling', 'lists', 'indentation', 'images', 'links'], onFocus: action('Editor focused'), onBlur: action('Editor blurred'), onChange: action('Editor changed'), onImageAdded: onImageAdded, defaultValue: '<body><p>Hi mom <a href="https://google.com">link</a></p><img alt="Example alt text" src="http://via.placeholder.com/640x360"/></body>', additionalInfo: args.showAdditionalInfo
|
|
21
|
+
return (_jsx(Editor, { ref: editorRef, label: args.label, labelHidden: args.labelHidden, info: args.info, status: args.status, required: args.required, disabled: args.disabled, readOnly: args.readOnly, toolbar: ['inline-styling', 'lists', 'indentation', 'images', 'links'], onFocus: action('Editor focused'), onBlur: action('Editor blurred'), onChange: action('Editor changed'), onImageAdded: onImageAdded, defaultValue: '<body><p>Hi mom <a href="https://google.com">link</a></p><img alt="Example alt text" src="http://via.placeholder.com/640x360"/></body>', additionalInfo: args.showAdditionalInfo
|
|
18
22
|
? {
|
|
19
23
|
heading: 'Additional Info',
|
|
20
24
|
content: (_jsxs(Flex, { container: { direction: 'column', alignItems: 'start', gap: 2 }, children: [_jsx("p", { children: "Lorem ipsum dolor sit amet, consectetur it, sed do tempor incididunt ut labore magna aliqua. Nibh praesent tristique magna sit amet. Nec tincidunt praesent semper feugiat nibh sed pulvinar proin gravida." }), _jsx("p", { children: "Pharetra pharetra massa massa ultricies mi quis hendrerit dolor. Est velit egestas dui id ornare arcu odio ut. Varius sit amet mattis vulputate enim nulla aliquet porttitor lacus." }), _jsx(Link, { href: '/', target: '_blank', children: "Neque vitae" })] }))
|
|
@@ -22,10 +26,27 @@ export const EditorDemo = (args) => {
|
|
|
22
26
|
: undefined }));
|
|
23
27
|
};
|
|
24
28
|
EditorDemo.args = {
|
|
25
|
-
showAdditionalInfo: false
|
|
29
|
+
showAdditionalInfo: false,
|
|
30
|
+
label: 'Form field label',
|
|
31
|
+
labelHidden: false,
|
|
32
|
+
info: 'Enter some value',
|
|
33
|
+
status: undefined,
|
|
34
|
+
required: false,
|
|
35
|
+
disabled: false,
|
|
36
|
+
readOnly: false
|
|
26
37
|
};
|
|
27
38
|
EditorDemo.argTypes = {
|
|
28
|
-
showAdditionalInfo: { control: { type: 'boolean' } }
|
|
39
|
+
showAdditionalInfo: { control: { type: 'boolean' } },
|
|
40
|
+
label: { control: { type: 'text' } },
|
|
41
|
+
labelHidden: { control: { type: 'boolean' } },
|
|
42
|
+
info: { control: { type: 'text', label: 'Helper text' } },
|
|
43
|
+
status: {
|
|
44
|
+
options: [undefined, 'success', 'warning', 'error', 'pending'],
|
|
45
|
+
control: { type: 'select' }
|
|
46
|
+
},
|
|
47
|
+
required: { control: { type: 'boolean' } },
|
|
48
|
+
disabled: { control: { type: 'boolean' } },
|
|
49
|
+
readOnly: { control: { type: 'boolean' } }
|
|
29
50
|
};
|
|
30
51
|
export const EmptyEditorDemo = () => {
|
|
31
52
|
const editorRef = useRef(null);
|
|
@@ -33,10 +54,10 @@ export const EmptyEditorDemo = () => {
|
|
|
33
54
|
const src = URL.createObjectURL(image);
|
|
34
55
|
editorRef.current?.appendImage({ src, alt: image.name }, id);
|
|
35
56
|
};
|
|
36
|
-
return (_jsx(Editor, { ref: editorRef, label: label, toolbar: ['inline-styling', 'lists', 'indentation', 'images', 'links'], onImageAdded: onImageAdded, onFocus: action('Editor has focus'), onBlur: action('Editor has blurred'), placeholder: 'Type some stuff in here' }));
|
|
57
|
+
return (_jsx(Editor, { ref: editorRef, label: 'Form field label', toolbar: ['inline-styling', 'lists', 'indentation', 'images', 'links'], onImageAdded: onImageAdded, onFocus: action('Editor has focus'), onBlur: action('Editor has blurred'), placeholder: 'Type some stuff in here' }));
|
|
37
58
|
};
|
|
38
59
|
export const ReadonlyFormField = () => {
|
|
39
|
-
return (_jsx(Editor, { label: label, readOnly: true, defaultValue: `<article class="main-page-content" lang="en-US"><h1>HTML: HyperText Markup Language</h1><div><p><strong>HTML</strong> (HyperText Markup Language) is the most basic building block of the Web. It defines the meaning and structure of web content. Other technologies besides HTML are generally used to describe a web page's appearance/presentation (<a href="/en-US/docs/Web/CSS">CSS</a>) or functionality/behavior (<a href="/en-US/docs/Web/JavaScript">JavaScript</a>).</p>
|
|
60
|
+
return (_jsx(Editor, { label: 'Form field label', readOnly: true, defaultValue: `<article class="main-page-content" lang="en-US"><h1>HTML: HyperText Markup Language</h1><div><p><strong>HTML</strong> (HyperText Markup Language) is the most basic building block of the Web. It defines the meaning and structure of web content. Other technologies besides HTML are generally used to describe a web page's appearance/presentation (<a href="/en-US/docs/Web/CSS">CSS</a>) or functionality/behavior (<a href="/en-US/docs/Web/JavaScript">JavaScript</a>).</p>
|
|
40
61
|
<p>"Hypertext" refers to links that connect web pages to one another, either within a single website or between websites. Links are a fundamental aspect of the Web. By uploading content to the Internet and linking it to pages created by other people, you become an active participant in the World Wide Web.</p>
|
|
41
62
|
<p>HTML uses "markup" to annotate text, images, and other content for display in a Web browser. HTML markup includes special "elements" such as <a href="/en-US/docs/Web/HTML/Element/head"><code><head></code></a>, <a href="/en-US/docs/Web/HTML/Element/title"><code><title></code></a>, <a href="/en-US/docs/Web/HTML/Element/body"><code><body></code></a>, <a href="/en-US/docs/Web/HTML/Element/header"><code><header></code></a>, <a href="/en-US/docs/Web/HTML/Element/footer"><code><footer></code></a>, <a href="/en-US/docs/Web/HTML/Element/article"><code><article></code></a>, <a href="/en-US/docs/Web/HTML/Element/section"><code><section></code></a>, <a href="/en-US/docs/Web/HTML/Element/p"><code><p></code></a>, <a href="/en-US/docs/Web/HTML/Element/div"><code><div></code></a>, <a href="/en-US/docs/Web/HTML/Element/span"><code><span></code></a>, <a href="/en-US/docs/Web/HTML/Element/img"><code><img></code></a>, <a href="/en-US/docs/Web/HTML/Element/aside"><code><aside></code></a>, <a href="/en-US/docs/Web/HTML/Element/audio"><code><audio></code></a>, <a href="/en-US/docs/Web/HTML/Element/canvas"><code><canvas></code></a>, <a href="/en-US/docs/Web/HTML/Element/datalist"><code><datalist></code></a>, <a href="/en-US/docs/Web/HTML/Element/details"><code><details></code></a>, <a href="/en-US/docs/Web/HTML/Element/embed"><code><embed></code></a>, <a href="/en-US/docs/Web/HTML/Element/nav"><code><nav></code></a>, <a href="/en-US/docs/Web/HTML/Element/output"><code><output></code></a>, <a href="/en-US/docs/Web/HTML/Element/progress"><code><progress></code></a>, <a href="/en-US/docs/Web/HTML/Element/video"><code><video></code></a>, <a href="/en-US/docs/Web/HTML/Element/ul"><code><ul></code></a>, <a href="/en-US/docs/Web/HTML/Element/ol"><code><ol></code></a>, <a href="/en-US/docs/Web/HTML/Element/li"><code><li></code></a> and many others.</p>
|
|
42
63
|
<p>An HTML element is set off from other text in a document by "tags", which consist of the element name surrounded by "<code><</code>" and "<code>></code>". The name of an element inside a tag is case insensitive. That is, it can be written in uppercase, lowercase, or a mixture. For example, the <code><title></code> tag can be written as <code><Title></code>, <code><TITLE></code>, or in any other way.</p>
|
|
@@ -50,7 +71,7 @@ export const CustomComponentDemo = () => {
|
|
|
50
71
|
const onCustomAction = () => {
|
|
51
72
|
editor.insertContent('<pega-custom>Inserted from toolbar</pega-custom>');
|
|
52
73
|
};
|
|
53
|
-
return (_jsx(Editor, { ref: editorRef, label: label, toolbar: ['inline-styling', 'lists', 'indentation', 'links', 'images'], defaultValue: '<body><p>Hi mom <a href="https://google.com">link</a></p><p>hi <pega-custom>Hello from custom element.</pega-custom></p></body>', customComponents: [{ createCustomElement: createPegaCustomElement, name: 'pega-custom' }], customActions: [
|
|
74
|
+
return (_jsx(Editor, { ref: editorRef, label: 'Form field label', toolbar: ['inline-styling', 'lists', 'indentation', 'links', 'images'], defaultValue: '<body><p>Hi mom <a href="https://google.com">link</a></p><p>hi <pega-custom>Hello from custom element.</pega-custom></p></body>', customComponents: [{ createCustomElement: createPegaCustomElement, name: 'pega-custom' }], customActions: [
|
|
54
75
|
{
|
|
55
76
|
icon: 'pega',
|
|
56
77
|
text: 'Insert a custom element',
|
|
@@ -86,6 +107,6 @@ export const RichTextEditorHtmlParsingDemo = () => {
|
|
|
86
107
|
const src = URL.createObjectURL(image);
|
|
87
108
|
rteRef.current?.appendImage({ src, alt: image.name }, id);
|
|
88
109
|
};
|
|
89
|
-
return (_jsxs(Flex, { container: { direction: 'column', gap: 2 }, children: [_jsxs(Card, { children: [_jsx(CardContent, { children: _jsx(TextArea, { value: html, onChange: e => setHtml(e.target.value) }) }), _jsx(CardFooter, { children: _jsx(Button, { onClick: () => rteRef.current?.insertHtml(html.trim(), true), children: "Overwrite RTE with new HTML" }) })] }), _jsx(Editor, { defaultValue: html, onImageAdded: onImageAdded, ref: rteRef, label: label, toolbar: ['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation'] })] }));
|
|
110
|
+
return (_jsxs(Flex, { container: { direction: 'column', gap: 2 }, children: [_jsxs(Card, { children: [_jsx(CardContent, { children: _jsx(TextArea, { value: html, onChange: e => setHtml(e.target.value) }) }), _jsx(CardFooter, { children: _jsx(Button, { onClick: () => rteRef.current?.insertHtml(html.trim(), true), children: "Overwrite RTE with new HTML" }) })] }), _jsx(Editor, { defaultValue: html, onImageAdded: onImageAdded, ref: rteRef, label: 'Form field label', toolbar: ['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation'] })] }));
|
|
90
111
|
};
|
|
91
112
|
//# sourceMappingURL=Editor.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.stories.js","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEhE,eAAe;IACb,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,MAAM;CACV,CAAC;AAMV,MAAM,CAAC,MAAM,UAAU,GAA8B,CAAC,IAAsB,EAAE,EAAE;IAC9E,MAAM,SAAS,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAE5C,MAAM,YAAY,GAAG,CAAC,KAAW,EAAE,EAAU,EAAE,EAAE;QAC/C,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QACvC,SAAS,CAAC,OAAO,EAAE,WAAW,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;IAC/D,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,MAAM,IACL,GAAG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AAC,UAAU,cACT,KAAC,MAAM,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,4CAE3D,GACE,IACR,EACP,KAAC,MAAM,IACL,YAAY,EAAE,IAAI,EAClB,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,GAC3F,IACG,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport { useState, useRef } from 'react';\nimport { action } from '@storybook/addon-actions';\nimport type { Editor as TinymceEditor } from 'tinymce';\n\nimport {\n Button,\n Card,\n CardContent,\n CardFooter,\n Flex,\n Link,\n Text,\n TextArea\n} from '@pega/cosmos-react-core';\nimport { Editor } from '@pega/cosmos-react-rte';\nimport type { EditorState } from '@pega/cosmos-react-rte';\n\nimport { createPegaCustomElement, label } from './Editor.mocks';\n\nexport default {\n title: 'RTE/Editor',\n component: Editor\n} as Meta;\n\ntype EditorStoryProps = {\n showAdditionalInfo?: boolean;\n};\n\nexport const EditorDemo: StoryFn<EditorStoryProps> = (args: EditorStoryProps) => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onFocus={action('Editor focused')}\n onBlur={action('Editor blurred')}\n onChange={action('Editor changed')}\n onImageAdded={onImageAdded}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><img alt=\"Example alt text\" src=\"http://via.placeholder.com/640x360\"/></body>'\n additionalInfo={\n args.showAdditionalInfo\n ? {\n heading: 'Additional Info',\n content: (\n <Flex container={{ direction: 'column', alignItems: 'start', gap: 2 }}>\n <p>\n Lorem ipsum dolor sit amet, consectetur it, sed do tempor incididunt ut labore\n magna aliqua. Nibh praesent tristique magna sit amet. Nec tincidunt praesent\n semper feugiat nibh sed pulvinar proin gravida.\n </p>\n <p>\n Pharetra pharetra massa massa ultricies mi quis hendrerit dolor. Est velit\n egestas dui id ornare arcu odio ut. Varius sit amet mattis vulputate enim nulla\n aliquet porttitor lacus.\n </p>\n <Link href='/' target='_blank'>\n Neque vitae\n </Link>\n </Flex>\n )\n }\n : undefined\n }\n />\n );\n};\n\nEditorDemo.args = {\n showAdditionalInfo: false\n};\n\nEditorDemo.argTypes = {\n showAdditionalInfo: { control: { type: 'boolean' } }\n};\n\nexport const EmptyEditorDemo: StoryFn = () => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onImageAdded={onImageAdded}\n onFocus={action('Editor has focus')}\n onBlur={action('Editor has blurred')}\n placeholder='Type some stuff in here'\n />\n );\n};\n\nexport const ReadonlyFormField: StoryFn = () => {\n return (\n <Editor\n label={label}\n readOnly\n defaultValue={`<article class=\"main-page-content\" lang=\"en-US\"><h1>HTML: HyperText Markup Language</h1><div><p><strong>HTML</strong> (HyperText Markup Language) is the most basic building block of the Web. It defines the meaning and structure of web content. Other technologies besides HTML are generally used to describe a web page's appearance/presentation (<a href=\"/en-US/docs/Web/CSS\">CSS</a>) or functionality/behavior (<a href=\"/en-US/docs/Web/JavaScript\">JavaScript</a>).</p>\n <p>\"Hypertext\" refers to links that connect web pages to one another, either within a single website or between websites. Links are a fundamental aspect of the Web. By uploading content to the Internet and linking it to pages created by other people, you become an active participant in the World Wide Web.</p>\n <p>HTML uses \"markup\" to annotate text, images, and other content for display in a Web browser. HTML markup includes special \"elements\" such as <a href=\"/en-US/docs/Web/HTML/Element/head\"><code><head></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/title\"><code><title></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/body\"><code><body></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/header\"><code><header></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/footer\"><code><footer></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/article\"><code><article></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/section\"><code><section></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/p\"><code><p></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/div\"><code><div></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/span\"><code><span></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/img\"><code><img></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/aside\"><code><aside></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/audio\"><code><audio></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/canvas\"><code><canvas></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/datalist\"><code><datalist></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/details\"><code><details></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/embed\"><code><embed></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/nav\"><code><nav></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/output\"><code><output></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/progress\"><code><progress></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/video\"><code><video></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ul\"><code><ul></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ol\"><code><ol></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/li\"><code><li></code></a> and many others.</p>\n <p>An HTML element is set off from other text in a document by \"tags\", which consist of the element name surrounded by \"<code><</code>\" and \"<code>></code>\". The name of an element inside a tag is case insensitive. That is, it can be written in uppercase, lowercase, or a mixture. For example, the <code><title></code> tag can be written as <code><Title></code>, <code><TITLE></code>, or in any other way.</p>\n\n <div id=\"on-github\" class=\"on-github\"><h3>Found a problem with this page?</h3><ul><li><a href=\"https://github.com/mdn/content/edit/main/files/en-us/web/html/index.md\" title=\"You're going to need to sign in to GitHub first (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Edit on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/blob/main/files/en-us/web/html/index.md\" title=\"Folder: en-us/web/html (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Source on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/issues/new?body=MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A%0A%23%23%23%23+What+information+was+incorrect%2C+unhelpful%2C+or+incomplete%3F%0A%0A%0A%23%23%23%23+Specific+section+or+headline%3F%0A%0A%0A%23%23%23%23+What+did+you+expect+to+see%3F%0A%0A%0A%23%23%23%23+Did+you+test+this%3F+If+so%2C+how%3F%0A%0A%0A%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EMDN+Content+page+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-us%2Fweb%2Fhtml%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-us%2Fweb%2Fhtml%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F775662998e66813a612e3ff27e02f2ada867bc17%0A*+Document+last+modified%3A+2021-10-03T00%3A01%3A51.000Z%0A%0A%3C%2Fdetails%3E&title=Issue+with+%22HTML%3A+HyperText+Markup+Language%22%3A+%28short+summary+here+please%29&labels=needs-triage%2CContent%3AHTML\" title=\"This will take you to https://github.com/mdn/content to file a new issue\" target=\"_blank\" rel=\"noopener noreferrer\">Report a problem with this content on <b>GitHub</b></a></li><li>Want to fix the problem yourself? See <a href=\"https://github.com/mdn/content/blob/main/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">our Contribution guide</a>.</li></ul></div>\n `}\n />\n );\n};\n\nexport const CustomComponentDemo: StoryFn = () => {\n const editorRef = useRef<EditorState>(null);\n const [editor, setEditor] = useState({} as TinymceEditor);\n\n const onCustomAction = () => {\n editor.insertContent('<pega-custom>Inserted from toolbar</pega-custom>');\n };\n\n return (\n <Editor\n ref={editorRef}\n label={label}\n toolbar={['inline-styling', 'lists', 'indentation', 'links', 'images']}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><p>hi <pega-custom>Hello from custom element.</pega-custom></p></body>'\n customComponents={[{ createCustomElement: createPegaCustomElement, name: 'pega-custom' }]}\n customActions={[\n {\n icon: 'pega',\n text: 'Insert a custom element',\n onMouseDown: () => {\n onCustomAction();\n }\n }\n ]}\n onInit={initializedEditor => {\n setEditor(initializedEditor);\n }}\n />\n );\n};\n\nexport const RichTextEditorWithLogs: StoryFn = () => {\n const editorRef = useRef<EditorState>(null);\n const [content, setContent] = useState<string | undefined>();\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n const showContent = (type: 'html' | 'plain_text' | 'rich_text') => {\n if (type === 'html') setContent(editorRef.current?.getHtml());\n else if (type === 'plain_text') setContent(editorRef.current?.getPlainText());\n else if (type === 'rich_text') setContent(editorRef.current?.getRichText());\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Editor\n ref={editorRef}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n onImageAdded={onImageAdded}\n label='Rich text editor with logs'\n info='Click on the buttons below to show the different formatted outputs of the RTE'\n />\n\n <Flex container={{ gap: 1 }}>\n <Button onClick={() => showContent('html')}>Show HTML</Button>\n <Button onClick={() => showContent('plain_text')}>Show plain text</Button>\n <Button onClick={() => showContent('rich_text')}>Show rich text</Button>\n </Flex>\n\n <Text>{content}</Text>\n </Flex>\n );\n};\n\nexport const RichTextEditorHtmlParsingDemo: StoryFn = () => {\n const [html, setHtml] = useState('<p>Hello world!</p>');\n const rteRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n rteRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Card>\n <CardContent>\n <TextArea value={html} onChange={e => setHtml(e.target.value)} />\n </CardContent>\n <CardFooter>\n <Button onClick={() => rteRef.current?.insertHtml(html.trim(), true)}>\n Overwrite RTE with new HTML\n </Button>\n </CardFooter>\n </Card>\n <Editor\n defaultValue={html}\n onImageAdded={onImageAdded}\n ref={rteRef}\n label={label}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n />\n </Flex>\n );\n};\n"]}
|
|
1
|
+
{"version":3,"file":"Editor.stories.js","sourceRoot":"","sources":["../../../src/rte/Editor/Editor.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAGlD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,eAAe;IACb,KAAK,EAAE,YAAY;IACnB,SAAS,EAAE,MAAM;CACV,CAAC;AAMV,MAAM,CAAC,M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,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aAC9C,MAAC,IAAI,eACH,KAAC,WAAW,cACV,KAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAAI,GACrD,EACd,KAAC,UAAU,cACT,KAAC,MAAM,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,4CAE3D,GACE,IACR,EACP,KAAC,MAAM,IACL,YAAY,EAAE,IAAI,EAClB,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,MAAM,EACX,KAAK,EAAC,kBAAkB,EACxB,OAAO,EAAE,CAAC,gBAAgB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,CAAC,GAC3F,IACG,CACR,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { Meta, StoryFn } from '@storybook/react';\nimport { useState, useRef } from 'react';\nimport { action } from '@storybook/addon-actions';\nimport type { Editor as TinymceEditor } from 'tinymce';\n\nimport {\n Button,\n Card,\n CardContent,\n CardFooter,\n Flex,\n Link,\n Text,\n TextArea\n} from '@pega/cosmos-react-core';\nimport { Editor } from '@pega/cosmos-react-rte';\nimport type { EditorProps, EditorState } from '@pega/cosmos-react-rte';\n\nimport { createPegaCustomElement } from './Editor.mocks';\n\nexport default {\n title: 'RTE/Editor',\n component: Editor\n} as Meta;\n\ninterface EditorStoryProps extends EditorProps {\n showAdditionalInfo?: boolean;\n}\n\nexport const EditorDemo: StoryFn<EditorStoryProps> = (args: EditorStoryProps) => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage(\n {\n src,\n alt: image.name,\n attachmentId: 'sample-id'\n },\n id\n );\n };\n\n return (\n <Editor\n ref={editorRef}\n label={args.label}\n labelHidden={args.labelHidden}\n info={args.info}\n status={args.status}\n required={args.required}\n disabled={args.disabled}\n readOnly={args.readOnly}\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onFocus={action('Editor focused')}\n onBlur={action('Editor blurred')}\n onChange={action('Editor changed')}\n onImageAdded={onImageAdded}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><img alt=\"Example alt text\" src=\"http://via.placeholder.com/640x360\"/></body>'\n additionalInfo={\n args.showAdditionalInfo\n ? {\n heading: 'Additional Info',\n content: (\n <Flex container={{ direction: 'column', alignItems: 'start', gap: 2 }}>\n <p>\n Lorem ipsum dolor sit amet, consectetur it, sed do tempor incididunt ut labore\n magna aliqua. Nibh praesent tristique magna sit amet. Nec tincidunt praesent\n semper feugiat nibh sed pulvinar proin gravida.\n </p>\n <p>\n Pharetra pharetra massa massa ultricies mi quis hendrerit dolor. Est velit\n egestas dui id ornare arcu odio ut. Varius sit amet mattis vulputate enim nulla\n aliquet porttitor lacus.\n </p>\n <Link href='/' target='_blank'>\n Neque vitae\n </Link>\n </Flex>\n )\n }\n : undefined\n }\n />\n );\n};\n\nEditorDemo.args = {\n showAdditionalInfo: false,\n label: 'Form field label',\n labelHidden: false,\n info: 'Enter some value',\n status: undefined,\n required: false,\n disabled: false,\n readOnly: false\n};\n\nEditorDemo.argTypes = {\n showAdditionalInfo: { control: { type: 'boolean' } },\n label: { control: { type: 'text' } },\n labelHidden: { control: { type: 'boolean' } },\n info: { control: { type: 'text', label: 'Helper text' } },\n status: {\n options: [undefined, 'success', 'warning', 'error', 'pending'],\n control: { type: 'select' }\n },\n required: { control: { type: 'boolean' } },\n disabled: { control: { type: 'boolean' } },\n readOnly: { control: { type: 'boolean' } }\n};\n\nexport const EmptyEditorDemo: StoryFn = () => {\n const editorRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Editor\n ref={editorRef}\n label='Form field label'\n toolbar={['inline-styling', 'lists', 'indentation', 'images', 'links']}\n onImageAdded={onImageAdded}\n onFocus={action('Editor has focus')}\n onBlur={action('Editor has blurred')}\n placeholder='Type some stuff in here'\n />\n );\n};\n\nexport const ReadonlyFormField: StoryFn = () => {\n return (\n <Editor\n label='Form field label'\n readOnly\n defaultValue={`<article class=\"main-page-content\" lang=\"en-US\"><h1>HTML: HyperText Markup Language</h1><div><p><strong>HTML</strong> (HyperText Markup Language) is the most basic building block of the Web. It defines the meaning and structure of web content. Other technologies besides HTML are generally used to describe a web page's appearance/presentation (<a href=\"/en-US/docs/Web/CSS\">CSS</a>) or functionality/behavior (<a href=\"/en-US/docs/Web/JavaScript\">JavaScript</a>).</p>\n <p>\"Hypertext\" refers to links that connect web pages to one another, either within a single website or between websites. Links are a fundamental aspect of the Web. By uploading content to the Internet and linking it to pages created by other people, you become an active participant in the World Wide Web.</p>\n <p>HTML uses \"markup\" to annotate text, images, and other content for display in a Web browser. HTML markup includes special \"elements\" such as <a href=\"/en-US/docs/Web/HTML/Element/head\"><code><head></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/title\"><code><title></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/body\"><code><body></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/header\"><code><header></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/footer\"><code><footer></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/article\"><code><article></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/section\"><code><section></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/p\"><code><p></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/div\"><code><div></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/span\"><code><span></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/img\"><code><img></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/aside\"><code><aside></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/audio\"><code><audio></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/canvas\"><code><canvas></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/datalist\"><code><datalist></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/details\"><code><details></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/embed\"><code><embed></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/nav\"><code><nav></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/output\"><code><output></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/progress\"><code><progress></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/video\"><code><video></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ul\"><code><ul></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/ol\"><code><ol></code></a>, <a href=\"/en-US/docs/Web/HTML/Element/li\"><code><li></code></a> and many others.</p>\n <p>An HTML element is set off from other text in a document by \"tags\", which consist of the element name surrounded by \"<code><</code>\" and \"<code>></code>\". The name of an element inside a tag is case insensitive. That is, it can be written in uppercase, lowercase, or a mixture. For example, the <code><title></code> tag can be written as <code><Title></code>, <code><TITLE></code>, or in any other way.</p>\n\n <div id=\"on-github\" class=\"on-github\"><h3>Found a problem with this page?</h3><ul><li><a href=\"https://github.com/mdn/content/edit/main/files/en-us/web/html/index.md\" title=\"You're going to need to sign in to GitHub first (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Edit on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/blob/main/files/en-us/web/html/index.md\" title=\"Folder: en-us/web/html (Opens in a new tab)\" target=\"_blank\" rel=\"noopener noreferrer\">Source on <b>GitHub</b></a></li><li><a href=\"https://github.com/mdn/content/issues/new?body=MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A%0A%23%23%23%23+What+information+was+incorrect%2C+unhelpful%2C+or+incomplete%3F%0A%0A%0A%23%23%23%23+Specific+section+or+headline%3F%0A%0A%0A%23%23%23%23+What+did+you+expect+to+see%3F%0A%0A%0A%23%23%23%23+Did+you+test+this%3F+If+so%2C+how%3F%0A%0A%0A%3C%21--+Do+not+make+changes+below+this+line+--%3E%0A%3Cdetails%3E%0A%3Csummary%3EMDN+Content+page+report+details%3C%2Fsummary%3E%0A%0A*+Folder%3A+%60en-us%2Fweb%2Fhtml%60%0A*+MDN+URL%3A+https%3A%2F%2Fdeveloper.mozilla.org%2Fen-US%2Fdocs%2FWeb%2FHTML%0A*+GitHub+URL%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fblob%2Fmain%2Ffiles%2Fen-us%2Fweb%2Fhtml%2Findex.md%0A*+Last+commit%3A+https%3A%2F%2Fgithub.com%2Fmdn%2Fcontent%2Fcommit%2F775662998e66813a612e3ff27e02f2ada867bc17%0A*+Document+last+modified%3A+2021-10-03T00%3A01%3A51.000Z%0A%0A%3C%2Fdetails%3E&title=Issue+with+%22HTML%3A+HyperText+Markup+Language%22%3A+%28short+summary+here+please%29&labels=needs-triage%2CContent%3AHTML\" title=\"This will take you to https://github.com/mdn/content to file a new issue\" target=\"_blank\" rel=\"noopener noreferrer\">Report a problem with this content on <b>GitHub</b></a></li><li>Want to fix the problem yourself? See <a href=\"https://github.com/mdn/content/blob/main/README.md\" target=\"_blank\" rel=\"noopener noreferrer\">our Contribution guide</a>.</li></ul></div>\n `}\n />\n );\n};\n\nexport const CustomComponentDemo: StoryFn = () => {\n const editorRef = useRef<EditorState>(null);\n const [editor, setEditor] = useState({} as TinymceEditor);\n\n const onCustomAction = () => {\n editor.insertContent('<pega-custom>Inserted from toolbar</pega-custom>');\n };\n\n return (\n <Editor\n ref={editorRef}\n label='Form field label'\n toolbar={['inline-styling', 'lists', 'indentation', 'links', 'images']}\n defaultValue='<body><p>Hi mom <a href=\"https://google.com\">link</a></p><p>hi <pega-custom>Hello from custom element.</pega-custom></p></body>'\n customComponents={[{ createCustomElement: createPegaCustomElement, name: 'pega-custom' }]}\n customActions={[\n {\n icon: 'pega',\n text: 'Insert a custom element',\n onMouseDown: () => {\n onCustomAction();\n }\n }\n ]}\n onInit={initializedEditor => {\n setEditor(initializedEditor);\n }}\n />\n );\n};\n\nexport const RichTextEditorWithLogs: StoryFn = () => {\n const editorRef = useRef<EditorState>(null);\n const [content, setContent] = useState<string | undefined>();\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n editorRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n const showContent = (type: 'html' | 'plain_text' | 'rich_text') => {\n if (type === 'html') setContent(editorRef.current?.getHtml());\n else if (type === 'plain_text') setContent(editorRef.current?.getPlainText());\n else if (type === 'rich_text') setContent(editorRef.current?.getRichText());\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Editor\n ref={editorRef}\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n onImageAdded={onImageAdded}\n label='Rich text editor with logs'\n info='Click on the buttons below to show the different formatted outputs of the RTE'\n />\n\n <Flex container={{ gap: 1 }}>\n <Button onClick={() => showContent('html')}>Show HTML</Button>\n <Button onClick={() => showContent('plain_text')}>Show plain text</Button>\n <Button onClick={() => showContent('rich_text')}>Show rich text</Button>\n </Flex>\n\n <Text>{content}</Text>\n </Flex>\n );\n};\n\nexport const RichTextEditorHtmlParsingDemo: StoryFn = () => {\n const [html, setHtml] = useState('<p>Hello world!</p>');\n const rteRef = useRef<EditorState>(null);\n\n const onImageAdded = (image: File, id: string) => {\n const src = URL.createObjectURL(image);\n rteRef.current?.appendImage({ src, alt: image.name }, id);\n };\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }}>\n <Card>\n <CardContent>\n <TextArea value={html} onChange={e => setHtml(e.target.value)} />\n </CardContent>\n <CardFooter>\n <Button onClick={() => rteRef.current?.insertHtml(html.trim(), true)}>\n Overwrite RTE with new HTML\n </Button>\n </CardFooter>\n </Card>\n <Editor\n defaultValue={html}\n onImageAdded={onImageAdded}\n ref={rteRef}\n label='Form field label'\n toolbar={['inline-styling', 'headers', 'tables', 'links', 'images', 'lists', 'indentation']}\n />\n </Flex>\n );\n};\n"]}
|
|
@@ -60,6 +60,7 @@ interface EmailSummaryListStoryProps {
|
|
|
60
60
|
loading?: EmailSummaryListProps['loading'];
|
|
61
61
|
currentItemId?: EmailSummaryListProps['currentItemId'];
|
|
62
62
|
searchQuery?: EmailSummaryListProps['searchQuery'];
|
|
63
|
+
count?: EmailSummaryListProps['count'];
|
|
63
64
|
}
|
|
64
65
|
export declare const EmailSummaryListDemo: StoryFn<EmailSummaryListStoryProps>;
|
|
65
66
|
interface EmailCaseViewStoryProps extends EmailCaseViewProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Email.stories.d.ts","sourceRoot":"","sources":["../../../src/social/Email/Email.stories.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAa,UAAU,EAAqB,MAAM,OAAO,CAAC;AAEtE,OAAO,KAAK,EAAQ,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAqCtD,OAAO,KAAK,EACV,UAAU,EACV,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EAErB,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAKV,eAAe,EAEhB,MAAM,4DAA4D,CAAC;;AA0CpE,wBAGU;AASV,UAAU,cAAe,SAAQ,UAAU;IACzC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,KAAK,EAAE,OAAO,CAAC,cAAc,CAmHzC,CAAC;AA2BF,UAAU,iBAAiB;IACzB,wB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AO,CAAC,0BAA0B,CAoFpE,CAAC;AAWF,UAAU,uBAAwB,SAAQ,kBAAkB;IAC1D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,uBAAuB,CAyE9D,CAAC;AAyBF,UAAU,yBAAyB;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,oBAAoB,EAAE,OAAO,CAAC,yBAAyB,CAsInE,CAAC"}
|
|
@@ -1021,7 +1021,11 @@ EmailSummaryItemDemo.argTypes = {
|
|
|
1021
1021
|
export const EmailSummaryListDemo = (args) => {
|
|
1022
1022
|
const INITIAL_CHUNK_SIZE = 9;
|
|
1023
1023
|
const APPEND_CHUNK_SIZE = 1;
|
|
1024
|
-
const [allEmailItems, setAllEmailItems] = useState(emailSummaryItems.slice(0, INITIAL_CHUNK_SIZE));
|
|
1024
|
+
const [allEmailItems, setAllEmailItems] = useState(args.items || emailSummaryItems.slice(0, INITIAL_CHUNK_SIZE));
|
|
1025
|
+
useEffect(() => {
|
|
1026
|
+
if (args.items)
|
|
1027
|
+
setAllEmailItems(args.items);
|
|
1028
|
+
}, [args.items]);
|
|
1025
1029
|
const [categories, setCategories] = useState(emailWorklistItemsMock);
|
|
1026
1030
|
const [currentItemId, setCurrentItemId] = useState(emailSummaryItems[0].id);
|
|
1027
1031
|
const handleItemClick = (id) => {
|
|
@@ -1054,7 +1058,12 @@ export const EmailSummaryListDemo = (args) => {
|
|
|
1054
1058
|
}, 1500);
|
|
1055
1059
|
}
|
|
1056
1060
|
}, [loading]);
|
|
1057
|
-
return (_jsx(EmailSummaryList, {
|
|
1061
|
+
return (_jsx(EmailSummaryList, { count: args.count
|
|
1062
|
+
? args.count
|
|
1063
|
+
: {
|
|
1064
|
+
total: emailSummaryItems.length,
|
|
1065
|
+
unread: allEmailItems.reduce((result, email) => email.unreadEmailCount ? result + email.unreadEmailCount : result, 0)
|
|
1066
|
+
}, categories: categories, searchQuery: args.searchQuery, items: args.items || allEmailItems, onItemClick: args.onItemClick || handleItemClick, onCategoryClick: onCategoryClick, onLoadMore: args.onLoadMore || (hasMore ? loadMore : undefined), loading: args.loading || loading, emptyMessage: 'No emails.', currentItemId: args.currentItemId || currentItemId }));
|
|
1058
1067
|
};
|
|
1059
1068
|
EmailSummaryListDemo.args = {
|
|
1060
1069
|
searchQuery: ''
|