@plone/volto 18.0.0-alpha.17 → 18.0.0-alpha.19

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +48 -2
  2. package/locales/ca/LC_MESSAGES/volto.po +17 -42
  3. package/locales/ca.json +1 -1
  4. package/locales/de/LC_MESSAGES/volto.po +15 -40
  5. package/locales/de.json +1 -1
  6. package/locales/en/LC_MESSAGES/volto.po +14 -39
  7. package/locales/en.json +1 -1
  8. package/locales/es/LC_MESSAGES/volto.po +15 -40
  9. package/locales/es.json +1 -1
  10. package/locales/eu/LC_MESSAGES/volto.po +15 -40
  11. package/locales/eu.json +1 -1
  12. package/locales/fi/LC_MESSAGES/volto.po +15 -40
  13. package/locales/fi.json +1 -1
  14. package/locales/fr/LC_MESSAGES/volto.po +15 -40
  15. package/locales/fr.json +1 -1
  16. package/locales/it/LC_MESSAGES/volto.po +15 -40
  17. package/locales/it.json +1 -1
  18. package/locales/ja/LC_MESSAGES/volto.po +15 -40
  19. package/locales/ja.json +1 -1
  20. package/locales/nl/LC_MESSAGES/volto.po +14 -39
  21. package/locales/nl.json +1 -1
  22. package/locales/pt/LC_MESSAGES/volto.po +15 -40
  23. package/locales/pt.json +1 -1
  24. package/locales/pt_BR/LC_MESSAGES/volto.po +15 -40
  25. package/locales/pt_BR.json +1 -1
  26. package/locales/ro/LC_MESSAGES/volto.po +15 -40
  27. package/locales/ro.json +1 -1
  28. package/locales/volto.pot +15 -40
  29. package/locales/zh_CN/LC_MESSAGES/volto.po +15 -40
  30. package/locales/zh_CN.json +1 -1
  31. package/package.json +11 -21
  32. package/src/components/index.js +0 -6
  33. package/src/components/manage/Add/Add.jsx +1 -1
  34. package/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +8 -2
  35. package/src/components/manage/Blocks/Search/hocs/withSearch.jsx +2 -2
  36. package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +33 -5
  37. package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx +12 -0
  38. package/src/components/manage/Controlpanels/Groups/RenderGroups.jsx +22 -11
  39. package/src/components/manage/Controlpanels/Groups/RenderGroups.test.jsx +21 -0
  40. package/src/components/manage/Controlpanels/Users/RenderUsers.jsx +30 -21
  41. package/src/components/manage/Controlpanels/Users/RenderUsers.test.jsx +27 -1
  42. package/src/components/manage/Controlpanels/Users/UserGroupMembershipListing.jsx +29 -7
  43. package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +51 -3
  44. package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +8 -0
  45. package/src/components/manage/Form/Form.jsx +1 -1
  46. package/src/components/theme/SlotRenderer/SlotRenderer.tsx +8 -1
  47. package/src/config/Blocks.jsx +63 -67
  48. package/src/config/Loadables.jsx +0 -22
  49. package/src/config/Widgets.jsx +0 -2
  50. package/src/config/index.js +0 -13
  51. package/src/helpers/User/User.js +29 -0
  52. package/src/helpers/index.js +6 -1
  53. package/test-setup-config.js +0 -30
  54. package/types/components/index.d.ts +0 -6
  55. package/types/config/Blocks.d.ts +0 -51
  56. package/types/config/Loadables.d.ts +0 -10
  57. package/types/config/Widgets.d.ts +0 -2
  58. package/types/helpers/User/User.d.ts +18 -0
  59. package/types/helpers/index.d.ts +1 -1
  60. package/webpack-plugins/webpack-bundle-analyze-plugin.js +1 -1
  61. package/src/components/manage/AnchorPlugin/components/Link/index.jsx +0 -37
  62. package/src/components/manage/AnchorPlugin/components/LinkButton/index.jsx +0 -126
  63. package/src/components/manage/AnchorPlugin/index.jsx +0 -82
  64. package/src/components/manage/AnchorPlugin/linkStrategy.js +0 -21
  65. package/src/components/manage/AnchorPlugin/utils/EditorUtils.js +0 -47
  66. package/src/components/manage/Blocks/HeroImageLeft/Data.jsx +0 -29
  67. package/src/components/manage/Blocks/HeroImageLeft/Edit.jsx +0 -493
  68. package/src/components/manage/Blocks/HeroImageLeft/Edit.test.jsx +0 -58
  69. package/src/components/manage/Blocks/HeroImageLeft/View.jsx +0 -37
  70. package/src/components/manage/Blocks/HeroImageLeft/View.test.jsx +0 -9
  71. package/src/components/manage/Blocks/HeroImageLeft/schema.js +0 -43
  72. package/src/components/manage/Blocks/Table/Cell.jsx +0 -206
  73. package/src/components/manage/Blocks/Table/Cell.test.jsx +0 -19
  74. package/src/components/manage/Blocks/Table/Edit.jsx +0 -748
  75. package/src/components/manage/Blocks/Table/Edit.test.jsx +0 -44
  76. package/src/components/manage/Blocks/Table/Readme.md +0 -5
  77. package/src/components/manage/Blocks/Table/View.jsx +0 -51
  78. package/src/components/manage/Blocks/Table/View.test.jsx +0 -41
  79. package/src/components/manage/Blocks/Text/Edit.jsx +0 -372
  80. package/src/components/manage/Blocks/Text/Edit.test.jsx +0 -46
  81. package/src/components/manage/Blocks/Text/Readme.md +0 -5
  82. package/src/components/manage/Blocks/Text/Schema.jsx +0 -31
  83. package/src/components/manage/Blocks/Text/View.jsx +0 -26
  84. package/src/components/manage/Blocks/Text/View.test.jsx +0 -28
  85. package/src/components/manage/LinkDetectionPlugin/link-detection-plugin.jsx +0 -227
  86. package/src/components/manage/LinkDetectionPlugin/utils.js +0 -12
  87. package/src/components/manage/Widgets/WysiwygWidget.jsx +0 -350
  88. package/src/components/manage/Widgets/WysiwygWidget.stories.jsx +0 -24
  89. package/src/components/manage/Widgets/WysiwygWidget.test.jsx +0 -37
  90. package/src/config/RichTextEditor/Blocks.jsx +0 -29
  91. package/src/config/RichTextEditor/FromHTML.jsx +0 -8
  92. package/src/config/RichTextEditor/Plugins.jsx +0 -59
  93. package/src/config/RichTextEditor/Styles.jsx +0 -69
  94. package/src/config/RichTextEditor/ToHTML.jsx +0 -262
  95. package/src/config/RichTextEditor/index.js +0 -25
@@ -1,59 +0,0 @@
1
- import createLinkPlugin from '@plone/volto/components/manage/AnchorPlugin';
2
-
3
- import Styles from './Styles';
4
-
5
- const breakOutOptions = {
6
- doubleBreakoutBlocks: [
7
- 'unordered-list-item',
8
- 'ordered-list-item',
9
- 'code-block',
10
- ],
11
- breakoutBlocks: [
12
- 'header-one',
13
- 'header-two',
14
- 'header-three',
15
- 'highlight',
16
- 'blockquote',
17
- 'callout',
18
- ],
19
- };
20
-
21
- //const linkDetectionPlugin = createLinkDetectionPlugin();
22
-
23
- const plugins = (props) => {
24
- const { draftJsInlineToolbarPlugin, draftJsBlockBreakoutPlugin } = props;
25
- const { Separator } = draftJsInlineToolbarPlugin;
26
- const blockBreakoutPlugin =
27
- draftJsBlockBreakoutPlugin.default(breakOutOptions);
28
-
29
- const linkPlugin = createLinkPlugin({ libraries: props });
30
-
31
- const buttons = Styles(props);
32
- const {
33
- BoldButton,
34
- ItalicButton,
35
- HeadlineTwoButton,
36
- HeadlineThreeButton,
37
- UnorderedListButton,
38
- OrderedListButton,
39
- BlockquoteButton,
40
- CalloutButton,
41
- } = buttons;
42
-
43
- const inlineToolbarButtons = [
44
- BoldButton,
45
- ItalicButton,
46
- linkPlugin.LinkButton,
47
- Separator,
48
- HeadlineTwoButton,
49
- HeadlineThreeButton,
50
- UnorderedListButton,
51
- OrderedListButton,
52
- BlockquoteButton,
53
- CalloutButton,
54
- ];
55
-
56
- return { inlineToolbarButtons, plugins: [linkPlugin, blockBreakoutPlugin] }; //linkDetectionPlugin
57
- };
58
-
59
- export default plugins;
@@ -1,69 +0,0 @@
1
- import React from 'react';
2
- // import createInlineStyleButton from 'draft-js-buttons/lib/utils/createInlineStyleButton';
3
- // import createBlockStyleButton from 'draft-js-buttons/lib/utils/createBlockStyleButton';
4
-
5
- import Icon from '@plone/volto/components/theme/Icon/Icon';
6
-
7
- import boldSVG from '@plone/volto/icons/bold.svg';
8
- import italicSVG from '@plone/volto/icons/italic.svg';
9
- import textSVG from '@plone/volto/icons/text.svg';
10
- import subtextSVG from '@plone/volto/icons/subtext.svg';
11
- import unorderedListSVG from '@plone/volto/icons/list-bullet.svg';
12
- import orderedListSVG from '@plone/volto/icons/list-numbered.svg';
13
- import blockquoteSVG from '@plone/volto/icons/quote.svg';
14
- import calloutSVG from '@plone/volto/icons/megaphone.svg';
15
-
16
- export default function Styles(props) {
17
- const createInlineStyleButton = props.draftJsCreateInlineStyleButton.default;
18
- const createBlockStyleButton = props.draftJsCreateBlockStyleButton.default;
19
-
20
- const BoldButton = createInlineStyleButton({
21
- style: 'BOLD',
22
- children: <Icon name={boldSVG} size="24px" />,
23
- });
24
-
25
- const ItalicButton = createInlineStyleButton({
26
- style: 'ITALIC',
27
- children: <Icon name={italicSVG} size="24px" />,
28
- });
29
-
30
- const HeadlineTwoButton = createBlockStyleButton({
31
- blockType: 'header-two',
32
- children: <Icon name={textSVG} size="24px" />,
33
- });
34
-
35
- const HeadlineThreeButton = createBlockStyleButton({
36
- blockType: 'header-three',
37
- children: <Icon name={subtextSVG} size="24px" />,
38
- });
39
-
40
- const UnorderedListButton = createBlockStyleButton({
41
- blockType: 'unordered-list-item',
42
- children: <Icon name={unorderedListSVG} size="24px" />,
43
- });
44
-
45
- const OrderedListButton = createBlockStyleButton({
46
- blockType: 'ordered-list-item',
47
- children: <Icon name={orderedListSVG} size="24px" />,
48
- });
49
-
50
- const BlockquoteButton = createBlockStyleButton({
51
- blockType: 'blockquote',
52
- children: <Icon name={blockquoteSVG} size="24px" />,
53
- });
54
-
55
- const CalloutButton = createBlockStyleButton({
56
- blockType: 'callout',
57
- children: <Icon name={calloutSVG} size="24px" />,
58
- });
59
- return {
60
- BlockquoteButton,
61
- BoldButton,
62
- CalloutButton,
63
- ItalicButton,
64
- HeadlineTwoButton,
65
- HeadlineThreeButton,
66
- OrderedListButton,
67
- UnorderedListButton,
68
- };
69
- }
@@ -1,262 +0,0 @@
1
- import React from 'react';
2
- import { connect } from 'react-redux';
3
- import { isEmpty } from 'lodash';
4
- import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
5
-
6
- const styles = {
7
- code: {
8
- backgroundColor: 'rgba(0, 0, 0, 0.05)',
9
- fontFamily: '"Inconsolata", "Menlo", "Consolas", monospace',
10
- fontSize: 16,
11
- padding: 2,
12
- },
13
- codeBlock: {
14
- backgroundColor: 'rgba(0, 0, 0, 0.05)',
15
- fontFamily: '"Inconsolata", "Menlo", "Consolas", monospace',
16
- fontSize: 16,
17
- padding: 20,
18
- },
19
- };
20
-
21
- const addBreaklinesInline = (children) => {
22
- if (typeof children[0] == 'string') {
23
- const s = children[0];
24
-
25
- if (s.split('\n').length > 1) {
26
- return s.split('\n').map((child, index) => (
27
- <React.Fragment key={child + index}>
28
- {child}
29
- {child?.length > 0 && <br />}
30
- </React.Fragment>
31
- ));
32
- }
33
- }
34
- return children;
35
- };
36
-
37
- // Inline (not block) styles
38
- const inline = {
39
- BOLD: (children, { key }) => (
40
- <strong key={key}>{addBreaklinesInline(children)}</strong>
41
- ),
42
- ITALIC: (children, { key }) => (
43
- <em key={key}>{addBreaklinesInline(children)}</em>
44
- ),
45
- UNDERLINE: (children, { key }) => (
46
- <u key={key}>{addBreaklinesInline(children)}</u>
47
- ),
48
- CODE: (children, { key }) => (
49
- <span key={key} style={styles.code}>
50
- {children}
51
- </span>
52
- ),
53
- };
54
-
55
- const addBreaklines = (children) =>
56
- children.map((child) => {
57
- return child[1].map((child) => [
58
- <React.Fragment key={child}>
59
- {child}
60
- <br />
61
- </React.Fragment>,
62
- ]);
63
- });
64
-
65
- const splitBySoftLines = (children) =>
66
- children.map((child) => {
67
- return child.map((item) => {
68
- if (Array.isArray(item)) {
69
- return item[0].split('\n');
70
- }
71
- return item;
72
- });
73
- });
74
-
75
- // splitSoftLines for <li> tag
76
- const splitSoftLinesOfLists = (children) =>
77
- children.map((child, index) => {
78
- return (
79
- <li key={index}>
80
- {child.map((subchild) => {
81
- if (Array.isArray(subchild)) {
82
- return subchild.map((subchildren) => {
83
- if (typeof subchildren === 'string') {
84
- const last = subchildren.split('\n').length - 1;
85
- return subchildren.split('\n').map((item, index) => (
86
- <React.Fragment key={index}>
87
- {item}
88
- {index !== last && <br />}
89
- </React.Fragment>
90
- ));
91
- } else {
92
- return subchildren;
93
- }
94
- });
95
- } else {
96
- return subchild;
97
- }
98
- })}
99
- </li>
100
- );
101
- });
102
-
103
- // Returns how the default lists should be rendered
104
- const getList =
105
- (ordered) =>
106
- (children, { depth, keys }) =>
107
- ordered ? (
108
- <ol key={keys[0]} keys={keys} depth={depth}>
109
- {splitSoftLinesOfLists(children)}
110
- </ol>
111
- ) : (
112
- <ul key={keys[0]} keys={keys} depth={depth}>
113
- {splitSoftLinesOfLists(children)}
114
- </ul>
115
- );
116
-
117
- // Special function to deal with list clones
118
- /*const getSpecialList = type => (children, { depth, keys }) => (
119
- <ul key={keys[0]} keys={keys} depth={depth} className={type}>
120
- {children.map((child, i) => (
121
- <li key={keys[i]} className={`${type}-item`}>
122
- {child}
123
- </li>
124
- ))}
125
- </ul>
126
- );
127
- */
128
-
129
- // Original recommended way to deal with atomics, this does not work with IMAGE
130
- // const getAtomic = (children, { data, keys }) =>
131
- // data.map((item, i) => <div key={keys[i]} {...data[i]} />);
132
-
133
- const processChildren = (children, keys) => {
134
- const processedChildren = children.map((chunks) =>
135
- chunks.map((child, index) => {
136
- if (Array.isArray(child)) {
137
- // If it's empty is a blank paragraph, we want to add a <br /> in it
138
- if (isEmpty(child)) {
139
- return <br key={index} />;
140
- }
141
- return child.map((subchild, index) => {
142
- if (typeof subchild === 'string') {
143
- const last = subchild.split('\n').length - 1;
144
- return subchild.split('\n').map((item, index) => (
145
- <React.Fragment key={index}>
146
- {item}
147
- {index !== last && <br />}
148
- </React.Fragment>
149
- ));
150
- } else {
151
- return subchild;
152
- }
153
- });
154
- } else {
155
- return child;
156
- }
157
- }),
158
- );
159
- return processedChildren.map(
160
- (chunk, index) => chunk && <p key={keys[index]}>{chunk}</p>,
161
- );
162
- };
163
- /**
164
- * Note that children can be maped to render a list or do other cool stuff
165
- */
166
- const blocks = {
167
- unstyled: (children, { keys }) => {
168
- return processChildren(children, keys);
169
- },
170
- atomic: (children) => children[0],
171
- blockquote: (children, { keys }) => (
172
- <blockquote key={keys[0]}>
173
- {addBreaklines(splitBySoftLines(children))}
174
- </blockquote>
175
- ),
176
- 'header-one': (children, { keys }) =>
177
- children.map((child, i) => <h1 key={keys[i]}>{child}</h1>),
178
- 'header-two': (children, { keys }) =>
179
- children.map((child, i) => (
180
- <h2 id={keys[i]} key={keys[i]}>
181
- {child}
182
- </h2>
183
- )),
184
- 'header-three': (children, { keys }) =>
185
- children.map((child, i) => (
186
- <h3 id={keys[i]} key={keys[i]}>
187
- {child}
188
- </h3>
189
- )),
190
- 'header-four': (children, { keys }) =>
191
- children.map((child, i) => (
192
- <h4 id={keys[i]} key={keys[i]}>
193
- {child}
194
- </h4>
195
- )),
196
- 'header-five': (children, { keys }) =>
197
- children.map((child, i) => (
198
- <h5 id={keys[i]} key={keys[i]}>
199
- {child}
200
- </h5>
201
- )),
202
- 'header-six': (children, { keys }) =>
203
- children.map((child, i) => (
204
- <h6 id={keys[i]} key={keys[i]}>
205
- {child}
206
- </h6>
207
- )),
208
- 'code-block': (children, { keys }) => (
209
- <pre key={keys[0]} style={styles.codeBlock}>
210
- {addBreaklines(children)}
211
- </pre>
212
- ),
213
- 'unordered-list-item': getList(),
214
- 'ordered-list-item': getList(true),
215
- callout: (children, { keys }) =>
216
- children.map((child, i) => (
217
- <p key={keys[i]} className="callout">
218
- {child}
219
- </p>
220
- )),
221
- };
222
-
223
- const LinkEntity = connect((state) => ({
224
- token: state.userSession.token,
225
- }))(({ token, key, url, target, targetUrl, download, children }) => {
226
- const to = token ? url : targetUrl || url;
227
-
228
- return (
229
- <UniversalLink
230
- href={to}
231
- openLinkInNewTab={target === '_blank' || undefined}
232
- download={download}
233
- >
234
- {children}
235
- </UniversalLink>
236
- );
237
- });
238
-
239
- const entities = {
240
- LINK: (children, props, { key }) => (
241
- <LinkEntity key={key} {...props}>
242
- {children}
243
- </LinkEntity>
244
- ),
245
-
246
- IMAGE: (children, entity, { key }) => (
247
- <img key={key} src={entity.src} alt={entity.alt} />
248
- ),
249
- };
250
-
251
- export const options = {
252
- cleanup: false,
253
- // joinOutput: true,
254
- };
255
-
256
- const renderers = {
257
- inline,
258
- blocks,
259
- entities,
260
- };
261
-
262
- export default renderers;
@@ -1,25 +0,0 @@
1
- import ToHTMLRenderers, { options as ToHTMLOptions } from './ToHTML';
2
- import Blocks from './Blocks';
3
- import Plugins from './Plugins';
4
- import FromHTMLCustomBlockFn from './FromHTML';
5
-
6
- export const richtextEditorSettings = (props) => {
7
- const { plugins, inlineToolbarButtons } = Plugins(props);
8
- const { extendedBlockRenderMap, blockStyleFn, listBlockTypes } =
9
- Blocks(props);
10
-
11
- return {
12
- extendedBlockRenderMap,
13
- blockStyleFn: blockStyleFn,
14
- listBlockTypes: listBlockTypes,
15
- richTextEditorPlugins: plugins,
16
- richTextEditorInlineToolbarButtons: inlineToolbarButtons,
17
- FromHTMLCustomBlockFn,
18
- customStyleMap: null,
19
- };
20
- };
21
-
22
- export const richtextViewSettings = {
23
- ToHTMLRenderers,
24
- ToHTMLOptions,
25
- };