@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.
- package/CHANGELOG.md +48 -2
- package/locales/ca/LC_MESSAGES/volto.po +17 -42
- package/locales/ca.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +15 -40
- package/locales/de.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +14 -39
- package/locales/en.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +15 -40
- package/locales/es.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +15 -40
- package/locales/eu.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +15 -40
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +15 -40
- package/locales/fr.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +15 -40
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +15 -40
- package/locales/ja.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +14 -39
- package/locales/nl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +15 -40
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +15 -40
- package/locales/pt_BR.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +15 -40
- package/locales/ro.json +1 -1
- package/locales/volto.pot +15 -40
- package/locales/zh_CN/LC_MESSAGES/volto.po +15 -40
- package/locales/zh_CN.json +1 -1
- package/package.json +11 -21
- package/src/components/index.js +0 -6
- package/src/components/manage/Add/Add.jsx +1 -1
- package/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +8 -2
- package/src/components/manage/Blocks/Search/hocs/withSearch.jsx +2 -2
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +33 -5
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx +12 -0
- package/src/components/manage/Controlpanels/Groups/RenderGroups.jsx +22 -11
- package/src/components/manage/Controlpanels/Groups/RenderGroups.test.jsx +21 -0
- package/src/components/manage/Controlpanels/Users/RenderUsers.jsx +30 -21
- package/src/components/manage/Controlpanels/Users/RenderUsers.test.jsx +27 -1
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipListing.jsx +29 -7
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +51 -3
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +8 -0
- package/src/components/manage/Form/Form.jsx +1 -1
- package/src/components/theme/SlotRenderer/SlotRenderer.tsx +8 -1
- package/src/config/Blocks.jsx +63 -67
- package/src/config/Loadables.jsx +0 -22
- package/src/config/Widgets.jsx +0 -2
- package/src/config/index.js +0 -13
- package/src/helpers/User/User.js +29 -0
- package/src/helpers/index.js +6 -1
- package/test-setup-config.js +0 -30
- package/types/components/index.d.ts +0 -6
- package/types/config/Blocks.d.ts +0 -51
- package/types/config/Loadables.d.ts +0 -10
- package/types/config/Widgets.d.ts +0 -2
- package/types/helpers/User/User.d.ts +18 -0
- package/types/helpers/index.d.ts +1 -1
- package/webpack-plugins/webpack-bundle-analyze-plugin.js +1 -1
- package/src/components/manage/AnchorPlugin/components/Link/index.jsx +0 -37
- package/src/components/manage/AnchorPlugin/components/LinkButton/index.jsx +0 -126
- package/src/components/manage/AnchorPlugin/index.jsx +0 -82
- package/src/components/manage/AnchorPlugin/linkStrategy.js +0 -21
- package/src/components/manage/AnchorPlugin/utils/EditorUtils.js +0 -47
- package/src/components/manage/Blocks/HeroImageLeft/Data.jsx +0 -29
- package/src/components/manage/Blocks/HeroImageLeft/Edit.jsx +0 -493
- package/src/components/manage/Blocks/HeroImageLeft/Edit.test.jsx +0 -58
- package/src/components/manage/Blocks/HeroImageLeft/View.jsx +0 -37
- package/src/components/manage/Blocks/HeroImageLeft/View.test.jsx +0 -9
- package/src/components/manage/Blocks/HeroImageLeft/schema.js +0 -43
- package/src/components/manage/Blocks/Table/Cell.jsx +0 -206
- package/src/components/manage/Blocks/Table/Cell.test.jsx +0 -19
- package/src/components/manage/Blocks/Table/Edit.jsx +0 -748
- package/src/components/manage/Blocks/Table/Edit.test.jsx +0 -44
- package/src/components/manage/Blocks/Table/Readme.md +0 -5
- package/src/components/manage/Blocks/Table/View.jsx +0 -51
- package/src/components/manage/Blocks/Table/View.test.jsx +0 -41
- package/src/components/manage/Blocks/Text/Edit.jsx +0 -372
- package/src/components/manage/Blocks/Text/Edit.test.jsx +0 -46
- package/src/components/manage/Blocks/Text/Readme.md +0 -5
- package/src/components/manage/Blocks/Text/Schema.jsx +0 -31
- package/src/components/manage/Blocks/Text/View.jsx +0 -26
- package/src/components/manage/Blocks/Text/View.test.jsx +0 -28
- package/src/components/manage/LinkDetectionPlugin/link-detection-plugin.jsx +0 -227
- package/src/components/manage/LinkDetectionPlugin/utils.js +0 -12
- package/src/components/manage/Widgets/WysiwygWidget.jsx +0 -350
- package/src/components/manage/Widgets/WysiwygWidget.stories.jsx +0 -24
- package/src/components/manage/Widgets/WysiwygWidget.test.jsx +0 -37
- package/src/config/RichTextEditor/Blocks.jsx +0 -29
- package/src/config/RichTextEditor/FromHTML.jsx +0 -8
- package/src/config/RichTextEditor/Plugins.jsx +0 -59
- package/src/config/RichTextEditor/Styles.jsx +0 -69
- package/src/config/RichTextEditor/ToHTML.jsx +0 -262
- package/src/config/RichTextEditor/index.js +0 -25
|
@@ -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
|
-
});
|