@plone/volto 18.0.0-alpha.18 → 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 (92) hide show
  1. package/CHANGELOG.md +31 -1
  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 +10 -20
  32. package/src/components/index.js +0 -6
  33. package/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +8 -2
  34. package/src/components/manage/Blocks/Search/hocs/withSearch.jsx +2 -2
  35. package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +33 -5
  36. package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx +12 -0
  37. package/src/components/manage/Controlpanels/Groups/RenderGroups.jsx +22 -11
  38. package/src/components/manage/Controlpanels/Groups/RenderGroups.test.jsx +21 -0
  39. package/src/components/manage/Controlpanels/Users/RenderUsers.jsx +30 -21
  40. package/src/components/manage/Controlpanels/Users/RenderUsers.test.jsx +27 -1
  41. package/src/components/manage/Controlpanels/Users/UserGroupMembershipListing.jsx +29 -7
  42. package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +51 -3
  43. package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +8 -0
  44. package/src/config/Blocks.jsx +63 -67
  45. package/src/config/Loadables.jsx +0 -22
  46. package/src/config/Widgets.jsx +0 -2
  47. package/src/config/index.js +0 -13
  48. package/src/helpers/User/User.js +29 -0
  49. package/src/helpers/index.js +6 -1
  50. package/test-setup-config.js +0 -30
  51. package/types/components/index.d.ts +0 -6
  52. package/types/config/Blocks.d.ts +0 -51
  53. package/types/config/Loadables.d.ts +0 -10
  54. package/types/config/Widgets.d.ts +0 -2
  55. package/types/helpers/User/User.d.ts +18 -0
  56. package/types/helpers/index.d.ts +1 -1
  57. package/webpack-plugins/webpack-bundle-analyze-plugin.js +1 -1
  58. package/src/components/manage/AnchorPlugin/components/Link/index.jsx +0 -37
  59. package/src/components/manage/AnchorPlugin/components/LinkButton/index.jsx +0 -126
  60. package/src/components/manage/AnchorPlugin/index.jsx +0 -82
  61. package/src/components/manage/AnchorPlugin/linkStrategy.js +0 -21
  62. package/src/components/manage/AnchorPlugin/utils/EditorUtils.js +0 -47
  63. package/src/components/manage/Blocks/HeroImageLeft/Data.jsx +0 -29
  64. package/src/components/manage/Blocks/HeroImageLeft/Edit.jsx +0 -493
  65. package/src/components/manage/Blocks/HeroImageLeft/Edit.test.jsx +0 -58
  66. package/src/components/manage/Blocks/HeroImageLeft/View.jsx +0 -37
  67. package/src/components/manage/Blocks/HeroImageLeft/View.test.jsx +0 -9
  68. package/src/components/manage/Blocks/HeroImageLeft/schema.js +0 -43
  69. package/src/components/manage/Blocks/Table/Cell.jsx +0 -206
  70. package/src/components/manage/Blocks/Table/Cell.test.jsx +0 -19
  71. package/src/components/manage/Blocks/Table/Edit.jsx +0 -748
  72. package/src/components/manage/Blocks/Table/Edit.test.jsx +0 -44
  73. package/src/components/manage/Blocks/Table/Readme.md +0 -5
  74. package/src/components/manage/Blocks/Table/View.jsx +0 -51
  75. package/src/components/manage/Blocks/Table/View.test.jsx +0 -41
  76. package/src/components/manage/Blocks/Text/Edit.jsx +0 -372
  77. package/src/components/manage/Blocks/Text/Edit.test.jsx +0 -46
  78. package/src/components/manage/Blocks/Text/Readme.md +0 -5
  79. package/src/components/manage/Blocks/Text/Schema.jsx +0 -31
  80. package/src/components/manage/Blocks/Text/View.jsx +0 -26
  81. package/src/components/manage/Blocks/Text/View.test.jsx +0 -28
  82. package/src/components/manage/LinkDetectionPlugin/link-detection-plugin.jsx +0 -227
  83. package/src/components/manage/LinkDetectionPlugin/utils.js +0 -12
  84. package/src/components/manage/Widgets/WysiwygWidget.jsx +0 -350
  85. package/src/components/manage/Widgets/WysiwygWidget.stories.jsx +0 -24
  86. package/src/components/manage/Widgets/WysiwygWidget.test.jsx +0 -37
  87. package/src/config/RichTextEditor/Blocks.jsx +0 -29
  88. package/src/config/RichTextEditor/FromHTML.jsx +0 -8
  89. package/src/config/RichTextEditor/Plugins.jsx +0 -59
  90. package/src/config/RichTextEditor/Styles.jsx +0 -69
  91. package/src/config/RichTextEditor/ToHTML.jsx +0 -262
  92. package/src/config/RichTextEditor/index.js +0 -25
@@ -1,43 +0,0 @@
1
- import { defineMessages } from 'react-intl';
2
-
3
- const messages = defineMessages({
4
- more: {
5
- id: 'Link more',
6
- defaultMessage: 'Link more',
7
- },
8
- LinkTitle: {
9
- id: 'Link title',
10
- defaultMessage: 'Link Title',
11
- },
12
- LinkTo: {
13
- id: 'Link to',
14
- defaultMessage: 'Link to',
15
- },
16
- });
17
-
18
- const schemaHero = ({ intl }) => {
19
- return {
20
- title: 'Block settings',
21
- required: [],
22
- fieldsets: [
23
- {
24
- id: 'default',
25
- title: intl.formatMessage(messages.more),
26
- fields: ['linkTitle', 'linkHref'],
27
- },
28
- ],
29
- properties: {
30
- linkTitle: {
31
- title: intl.formatMessage(messages.LinkTitle),
32
- },
33
- linkHref: {
34
- title: intl.formatMessage(messages.LinkTo),
35
- widget: 'object_browser',
36
- mode: 'link',
37
- selectedItemAttrs: ['Title', 'Description'],
38
- allowExternals: true,
39
- },
40
- },
41
- };
42
- };
43
- export default schemaHero;
@@ -1,206 +0,0 @@
1
- /**
2
- * Edit text cell block.
3
- * @module components/manage/Blocks/Title/Cell
4
- */
5
-
6
- import React, { Component } from 'react';
7
- import PropTypes from 'prop-types';
8
- import { includes } from 'lodash';
9
- import config from '@plone/volto/registry';
10
-
11
- import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
12
- import loadable from '@loadable/component';
13
-
14
- const Editor = loadable(() => import('draft-js-plugins-editor'));
15
-
16
- /**
17
- * Edit text cell class.
18
- * @class Cell
19
- * @extends Component
20
- */
21
- class CellComponent extends Component {
22
- /**
23
- * Property types.
24
- * @property {Object} propTypes Property types.
25
- * @static
26
- */
27
- static propTypes = {
28
- onSelectCell: PropTypes.func.isRequired,
29
- row: PropTypes.number,
30
- cell: PropTypes.number,
31
- value: PropTypes.object,
32
- selected: PropTypes.bool,
33
- onChange: PropTypes.func.isRequired,
34
- isTableBlockSelected: PropTypes.bool,
35
- disableNewBlocks: PropTypes.bool,
36
- editable: PropTypes.bool,
37
- };
38
-
39
- /**
40
- * Default properties
41
- * @property {Object} defaultProps Default properties.
42
- * @static
43
- */
44
- static defaultProps = {
45
- detached: false,
46
- editable: true,
47
- };
48
-
49
- /**
50
- * Constructor
51
- * @method constructor
52
- * @param {Object} props Component properties
53
- * @constructs Cell
54
- */
55
- constructor(props) {
56
- super(props);
57
-
58
- const { EditorState, convertFromRaw } = props.draftJs;
59
- const createInlineToolbarPlugin = props.draftJsInlineToolbarPlugin.default;
60
-
61
- if (!__SERVER__) {
62
- this.draftConfig = config.settings.richtextEditorSettings(props);
63
- let editorState;
64
- editorState = EditorState.createWithContent(convertFromRaw(props.value));
65
-
66
- const inlineToolbarPlugin = createInlineToolbarPlugin({
67
- structure: this.draftConfig.richTextEditorInlineToolbarButtons,
68
- });
69
-
70
- this.state = {
71
- editorState,
72
- inlineToolbarPlugin,
73
- };
74
- }
75
-
76
- this.onChange = this.onChange.bind(this);
77
- }
78
-
79
- /**
80
- * Component did mount lifecycle method
81
- * @method componentDidMount
82
- * @returns {undefined}
83
- */
84
- componentDidMount() {
85
- if (this.node) {
86
- const onFocus = this.node.editor._onFocus;
87
- this.node.editor._onFocus = (event) => {
88
- onFocus(event);
89
- this.props.onSelectCell(this.props.row, this.props.cell);
90
- };
91
- }
92
- }
93
-
94
- /**
95
- * Component will receive props
96
- * @method componentWillReceiveProps
97
- * @param {Object} nextProps Next properties
98
- * @returns {undefined}
99
- */
100
- UNSAFE_componentWillReceiveProps(nextProps) {
101
- if (
102
- nextProps.isTableBlockSelected !== this.props.isTableBlockSelected &&
103
- this.props.cell === 0 &&
104
- this.props.row === 0
105
- ) {
106
- this.node.focus();
107
- }
108
- }
109
-
110
- /**
111
- * Change handler
112
- * @method onChange
113
- * @param {object} editorState Editor state.
114
- * @returns {undefined}
115
- */
116
- onChange(editorState) {
117
- this.setState({ editorState }, () => {
118
- this.props.onChange(this.props.row, this.props.cell, editorState);
119
- });
120
- }
121
-
122
- /**
123
- * Render method.
124
- * @method render
125
- * @returns {string} Markup for the component.
126
- */
127
- render() {
128
- if (__SERVER__) {
129
- return <div />;
130
- }
131
-
132
- const { InlineToolbar } = this.state.inlineToolbarPlugin;
133
- const isSoftNewlineEvent = this.props.draftJsLibIsSoftNewlineEvent.default;
134
- const { RichUtils } = this.props.draftJs;
135
-
136
- return (
137
- <div>
138
- <Editor
139
- readOnly={!this.props.editable}
140
- onChange={this.onChange}
141
- editorState={this.state.editorState}
142
- plugins={[
143
- this.state.inlineToolbarPlugin,
144
- ...this.draftConfig.richTextEditorPlugins,
145
- ]}
146
- blockRenderMap={this.draftConfig.extendedBlockRenderMap}
147
- blockStyleFn={this.draftConfig.blockStyleFn}
148
- customStyleMap={this.draftConfig.customStyleMap}
149
- handleReturn={(e) => {
150
- if (isSoftNewlineEvent(e)) {
151
- this.onChange(
152
- RichUtils.insertSoftNewline(this.state.editorState),
153
- );
154
- return 'handled';
155
- }
156
- if (!this.props.detached && !this.props.disableNewBlocks) {
157
- const selectionState = this.state.editorState.getSelection();
158
- const anchorKey = selectionState.getAnchorKey();
159
- const currentContent = this.state.editorState.getCurrentContent();
160
- const currentContentBlock =
161
- currentContent.getBlockForKey(anchorKey);
162
- const blockType = currentContentBlock.getType();
163
- if (!includes(this.draftConfig.listBlockTypes, blockType)) {
164
- this.props.onSelectBlock(
165
- this.props.onAddBlock(
166
- this.draftConfig.defaultBlockType,
167
- this.props.index + 1,
168
- ),
169
- );
170
- return 'handled';
171
- }
172
- return 'un-handled';
173
- }
174
- return {};
175
- }}
176
- ref={(node) => {
177
- this.node = node;
178
- }}
179
- />
180
- <InlineToolbar />
181
- </div>
182
- );
183
- }
184
- }
185
-
186
- export const Cell = injectLazyLibs([
187
- 'draftJs',
188
- 'draftJsBlockBreakoutPlugin',
189
- 'draftJsCreateBlockStyleButton',
190
- 'draftJsCreateInlineStyleButton',
191
- 'draftJsFilters',
192
- 'draftJsImportHtml',
193
- 'draftJsInlineToolbarPlugin',
194
- 'draftJsLibIsSoftNewlineEvent',
195
- 'immutableLib',
196
- ])(CellComponent);
197
-
198
- const Preloader = (props) => {
199
- const [loaded, setLoaded] = React.useState(false);
200
- React.useEffect(() => {
201
- Editor.load().then(() => setLoaded(true));
202
- }, []);
203
- return loaded ? <Cell {...props} /> : null;
204
- };
205
-
206
- export default Preloader;
@@ -1,19 +0,0 @@
1
- import React from 'react';
2
- import renderer from 'react-test-renderer';
3
- import { Cell } from './Cell';
4
-
5
- global.__SERVER__ = true; // eslint-disable-line no-underscore-dangle
6
-
7
- jest.mock('@plone/volto/helpers/Loadable/Loadable');
8
- beforeAll(
9
- async () =>
10
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(),
11
- );
12
-
13
- test('renders a cell component', () => {
14
- const component = renderer.create(
15
- <Cell onChange={() => {}} onSelectCell={() => {}} />,
16
- );
17
- const json = component.toJSON();
18
- expect(json).toMatchSnapshot();
19
- });