@akemona-org/strapi-plugin-content-manager 3.7.0 → 3.7.2
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/admin/src/InjectedComponents/ContentTypeBuilder/ConfigureViewButton/index.js +2 -5
- package/admin/src/components/AddDropdown/index.js +5 -12
- package/admin/src/components/Block/index.js +2 -4
- package/admin/src/components/ComponentInitializer/index.js +1 -1
- package/admin/src/components/CustomTable/ActionCollapse/index.js +2 -2
- package/admin/src/components/CustomTable/Row/Cell.js +1 -1
- package/admin/src/components/CustomTable/Row/index.js +6 -6
- package/admin/src/components/CustomTable/index.js +5 -5
- package/admin/src/components/CustomTable/styledComponents.js +2 -2
- package/admin/src/components/DragLayer/index.js +1 -1
- package/admin/src/components/DraggedField/Wrapper.js +2 -7
- package/admin/src/components/DraggedField/index.js +3 -3
- package/admin/src/components/DraggedField/utils/getHeight.js +1 -1
- package/admin/src/components/DraggedFieldWithPreview/DynamicComponent.js +2 -2
- package/admin/src/components/DraggedFieldWithPreview/Wrapper.js +1 -2
- package/admin/src/components/DraggedFieldWithPreview/index.js +4 -4
- package/admin/src/components/DynamicComponentCard/index.js +2 -8
- package/admin/src/components/DynamicZone/Picker/index.js +3 -3
- package/admin/src/components/DynamicZone/index.js +4 -4
- package/admin/src/components/DynamicZone/utils/select.js +1 -1
- package/admin/src/components/FieldComponent/index.js +1 -1
- package/admin/src/components/FieldComponent/utils/select.js +6 -6
- package/admin/src/components/FieldsReorder/Item.js +6 -9
- package/admin/src/components/FieldsReorder/index.js +6 -17
- package/admin/src/components/FilterOptionsCTA/index.js +1 -1
- package/admin/src/components/FilterPicker/components.js +2 -2
- package/admin/src/components/FilterPicker/index.js +7 -7
- package/admin/src/components/FilterPicker/reducer.js +2 -2
- package/admin/src/components/FilterPickerOption/Input.js +1 -1
- package/admin/src/components/FilterPickerOption/Option.js +1 -3
- package/admin/src/components/FilterPickerOption/components.js +2 -2
- package/admin/src/components/FilterPickerOption/index.js +4 -4
- package/admin/src/components/FormTitle/index.js +1 -5
- package/admin/src/components/InputJSON/index.js +3 -3
- package/admin/src/components/InputJSON/jsonlint.js +639 -383
- package/admin/src/components/InputJSONWithErrors/index.js +2 -2
- package/admin/src/components/InputUID/Options/index.js +2 -2
- package/admin/src/components/InputUID/Options/wrapper.js +1 -1
- package/admin/src/components/InputUID/index.js +2 -2
- package/admin/src/components/Inputs/index.js +4 -4
- package/admin/src/components/Inputs/utils/generateOptions.js +2 -2
- package/admin/src/components/Inputs/utils/getStep.js +1 -1
- package/admin/src/components/MediaPreviewList/index.js +5 -5
- package/admin/src/components/NonRepeatableComponent/index.js +4 -4
- package/admin/src/components/PreviewWysiwyg/Wrapper.js +1 -1
- package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.js +1 -1
- package/admin/src/components/RelationPreviewList/RelationPreviewTooltip.js +3 -3
- package/admin/src/components/RelationPreviewList/index.js +1 -1
- package/admin/src/components/RepeatableComponent/Banner.js +2 -2
- package/admin/src/components/RepeatableComponent/BannerWrapper.js +1 -2
- package/admin/src/components/RepeatableComponent/DraggedItem/index.js +3 -9
- package/admin/src/components/RepeatableComponent/index.js +8 -8
- package/admin/src/components/RepeatableComponent/reducer.js +9 -9
- package/admin/src/components/Search/index.js +2 -2
- package/admin/src/components/SectionTitle/index.js +1 -3
- package/admin/src/components/SelectMany/ListItem.js +2 -2
- package/admin/src/components/SelectMany/index.js +3 -3
- package/admin/src/components/SelectOne/SingleValue.js +1 -1
- package/admin/src/components/SelectWrapper/ClearIndicator.js +1 -1
- package/admin/src/components/SelectWrapper/Option.js +1 -1
- package/admin/src/components/SelectWrapper/index.js +17 -27
- package/admin/src/components/SelectWrapper/utils/styles.js +6 -6
- package/admin/src/components/SettingsViewWrapper/index.js +9 -9
- package/admin/src/components/SortableList/Item.js +5 -11
- package/admin/src/components/Wysiwyg/MediaLib.js +1 -1
- package/admin/src/components/Wysiwyg/index.js +17 -25
- package/admin/src/components/Wysiwyg/toggleMode.js +3 -7
- package/admin/src/components/Wysiwyg/utils.js +2 -10
- package/admin/src/components/WysiwygDropUpload/index.js +1 -1
- package/admin/src/components/WysiwygInlineControls/Button.js +1 -1
- package/admin/src/components/WysiwygInlineControls/index.js +1 -1
- package/admin/src/components/WysiwygWithErrors/index.js +1 -1
- package/admin/src/containers/CollectionTypeFormWrapper/index.js +7 -12
- package/admin/src/containers/CollectionTypeFormWrapper/utils/getRequestUrl.js +1 -1
- package/admin/src/containers/CollectionTypeRecursivePath/index.js +1 -1
- package/admin/src/containers/ComponentSetttingsView/index.js +2 -2
- package/admin/src/containers/EditSettingsView/index.js +17 -17
- package/admin/src/containers/EditSettingsView/reducer.js +10 -10
- package/admin/src/containers/EditSettingsView/utils/createPossibleMainFieldsForModelsAndComponents.js +2 -2
- package/admin/src/containers/EditSettingsView/utils/getInputProps.js +1 -1
- package/admin/src/containers/EditSettingsView/utils/layout.js +9 -9
- package/admin/src/containers/EditView/DeleteLink/index.js +1 -1
- package/admin/src/containers/EditView/Header/index.js +10 -9
- package/admin/src/containers/EditView/Header/utils/getDraftRelations.js +3 -3
- package/admin/src/containers/EditView/index.js +7 -10
- package/admin/src/containers/EditView/utils/createAttributesLayout.js +4 -9
- package/admin/src/containers/EditView/utils/getFieldsActionMatchingPermissions.js +1 -1
- package/admin/src/containers/EditViewDataManagerProvider/index.js +7 -12
- package/admin/src/containers/EditViewDataManagerProvider/reducer.js +14 -14
- package/admin/src/containers/EditViewDataManagerProvider/utils/cleanData.js +4 -4
- package/admin/src/containers/EditViewDataManagerProvider/utils/getYupInnerErrors.js +2 -8
- package/admin/src/containers/EditViewDataManagerProvider/utils/schema.js +12 -12
- package/admin/src/containers/EditViewLayoutManager/Permissions.js +1 -1
- package/admin/src/containers/EditViewLayoutManager/reducer.js +1 -1
- package/admin/src/containers/EditViewLayoutManager/selectors.js +1 -1
- package/admin/src/containers/ListSettingsView/Label.js +2 -11
- package/admin/src/containers/ListSettingsView/index.js +9 -9
- package/admin/src/containers/ListSettingsView/reducer.js +2 -2
- package/admin/src/containers/ListView/FieldPicker/Fields/Wrapper.js +1 -1
- package/admin/src/containers/ListView/FieldPicker/Fields/index.js +2 -2
- package/admin/src/containers/ListView/FieldPicker/index.js +2 -2
- package/admin/src/containers/ListView/Filter.js +1 -4
- package/admin/src/containers/ListView/actions.js +2 -2
- package/admin/src/containers/ListView/index.js +8 -7
- package/admin/src/containers/ListView/reducer.js +5 -5
- package/admin/src/containers/ListView/selectors.js +2 -2
- package/admin/src/containers/ListView/utils/createPluginsFilter.js +1 -1
- package/admin/src/containers/ListView/utils/getAllAllowedHeaders.js +1 -1
- package/admin/src/containers/ListView/utils/getFirstSortableHeader.js +2 -2
- package/admin/src/containers/ListViewLayoutManager/Permissions.js +1 -1
- package/admin/src/containers/ListViewProvider/index.js +1 -3
- package/admin/src/containers/Main/index.js +2 -2
- package/admin/src/containers/Main/reducer.js +1 -1
- package/admin/src/containers/Main/selectors.js +2 -2
- package/admin/src/containers/RBACManager/reducer.js +1 -1
- package/admin/src/containers/SingleTypeFormWrapper/index.js +6 -11
- package/admin/src/containers/SingleTypeFormWrapper/utils/getRequestUrl.js +1 -1
- package/admin/src/containers/WysiwygProvider/index.js +1 -3
- package/admin/src/hooks/useContentTypeLayout/index.js +1 -1
- package/admin/src/hooks/useFetchContentTypeLayout/index.js +3 -3
- package/admin/src/hooks/useFetchContentTypeLayout/reducer.js +1 -1
- package/admin/src/hooks/useFetchContentTypeLayout/utils/formatLayouts.js +8 -8
- package/admin/src/hooks/useFindRedirectionLink/index.js +1 -1
- package/admin/src/hooks/useFindRedirectionLink/selectors.js +1 -1
- package/admin/src/icons/Cross/index.js +1 -6
- package/admin/src/icons/Na/index.js +3 -22
- package/admin/src/index.js +1 -1
- package/admin/src/pluginId.js +1 -1
- package/admin/src/selectors.js +2 -2
- package/admin/src/sharedReducers/crudReducer/actions.js +3 -3
- package/admin/src/sharedReducers/crudReducer/reducer.js +1 -1
- package/admin/src/sharedReducers/crudReducer/selectors.js +1 -1
- package/admin/src/utils/checkIfAttributeIsDisplayable.js +1 -1
- package/admin/src/utils/formatFiltersFromQuery.js +2 -2
- package/admin/src/utils/formatLayoutToApi.js +2 -2
- package/admin/src/utils/generatePermissionsObject.js +3 -2
- package/admin/src/utils/getComponents.js +3 -5
- package/admin/src/utils/getFieldName.js +2 -2
- package/admin/src/utils/getMaxTempKey.js +2 -2
- package/admin/src/utils/getRequestUrl.js +1 -1
- package/admin/src/utils/getTrad.js +1 -1
- package/admin/src/utils/mergeMetasWithSchema.js +2 -2
- package/admin/src/utils/removeKeyInObject.js +1 -1
- package/admin/src/utils/removePasswordFieldsFromData.js +2 -2
- package/controllers/content-types.js +4 -4
- package/package.json +4 -4
- package/services/components.js +1 -1
- package/services/configuration.js +9 -9
- package/services/permission-checker.js +6 -6
- package/services/uid.js +1 -1
- package/services/utils/configuration/layouts.js +14 -35
- package/services/utils/configuration/metadatas.js +1 -1
- package/services/utils/store.js +9 -9
- package/utils/index.js +1 -1
- package/utils/wrap-bad-request.js +14 -12
|
@@ -41,8 +41,8 @@ const SettingsViewWrapper = ({
|
|
|
41
41
|
return get(modifiedData, ['attributes'], {});
|
|
42
42
|
}, [modifiedData]);
|
|
43
43
|
|
|
44
|
-
const toggleWarningCancel = () => setWarningCancel(prevState => !prevState);
|
|
45
|
-
const toggleWarningSubmit = () => setWarningSubmit(prevState => !prevState);
|
|
44
|
+
const toggleWarningCancel = () => setWarningCancel((prevState) => !prevState);
|
|
45
|
+
const toggleWarningSubmit = () => setWarningSubmit((prevState) => !prevState);
|
|
46
46
|
|
|
47
47
|
const getPluginHeaderActions = () => {
|
|
48
48
|
return [
|
|
@@ -92,11 +92,11 @@ const SettingsViewWrapper = ({
|
|
|
92
92
|
}),
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
const getSelectOptions = input => {
|
|
95
|
+
const getSelectOptions = (input) => {
|
|
96
96
|
if (input.name === 'settings.defaultSortBy') {
|
|
97
97
|
return [
|
|
98
98
|
'id',
|
|
99
|
-
...displayedFields.filter(name => {
|
|
99
|
+
...displayedFields.filter((name) => {
|
|
100
100
|
const type = get(attributes, [name, 'type']);
|
|
101
101
|
|
|
102
102
|
return !['media', 'richtext', 'dynamiczone', 'relation'].includes(type) && name !== 'id';
|
|
@@ -105,7 +105,7 @@ const SettingsViewWrapper = ({
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
if (input.name === 'settings.mainField') {
|
|
108
|
-
const options = Object.keys(attributes).filter(attr => {
|
|
108
|
+
const options = Object.keys(attributes).filter((attr) => {
|
|
109
109
|
const type = get(attributes, [attr, 'type'], '');
|
|
110
110
|
|
|
111
111
|
return (
|
|
@@ -130,7 +130,7 @@ const SettingsViewWrapper = ({
|
|
|
130
130
|
return input.options;
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
const handleSubmit = e => {
|
|
133
|
+
const handleSubmit = (e) => {
|
|
134
134
|
e.preventDefault();
|
|
135
135
|
toggleWarningSubmit();
|
|
136
136
|
emitEvent('willSaveContentTypeLayout');
|
|
@@ -161,15 +161,15 @@ const SettingsViewWrapper = ({
|
|
|
161
161
|
>
|
|
162
162
|
<SectionTitle isSettings />
|
|
163
163
|
<div className="row">
|
|
164
|
-
{inputs.map(input => {
|
|
164
|
+
{inputs.map((input) => {
|
|
165
165
|
return (
|
|
166
166
|
<FormattedMessage key={input.name} id={input.label.id}>
|
|
167
|
-
{label => (
|
|
167
|
+
{(label) => (
|
|
168
168
|
<div className={input.customBootstrapClass}>
|
|
169
169
|
<FormattedMessage
|
|
170
170
|
id={get(input, 'description.id', 'app.utils.defaultMessage')}
|
|
171
171
|
>
|
|
172
|
-
{description => (
|
|
172
|
+
{(description) => (
|
|
173
173
|
<Input
|
|
174
174
|
{...input}
|
|
175
175
|
description={description}
|
|
@@ -10,13 +10,8 @@ import DraggedFieldWithPreview from '../DraggedFieldWithPreview';
|
|
|
10
10
|
import ItemTypes from '../../utils/ItemTypes';
|
|
11
11
|
|
|
12
12
|
const Item = ({ index, move, name, removeItem }) => {
|
|
13
|
-
const {
|
|
14
|
-
|
|
15
|
-
metadatas,
|
|
16
|
-
selectedItemName,
|
|
17
|
-
setEditFieldToSelect,
|
|
18
|
-
setIsDraggingSibling,
|
|
19
|
-
} = useLayoutDnd();
|
|
13
|
+
const { goTo, metadatas, selectedItemName, setEditFieldToSelect, setIsDraggingSibling } =
|
|
14
|
+
useLayoutDnd();
|
|
20
15
|
const dragRef = useRef(null);
|
|
21
16
|
const dropRef = useRef(null);
|
|
22
17
|
|
|
@@ -37,8 +32,7 @@ const Item = ({ index, move, name, removeItem }) => {
|
|
|
37
32
|
// Determine rectangle on screen
|
|
38
33
|
const hoverBoundingRect = dropRef.current.getBoundingClientRect();
|
|
39
34
|
// Get vertical middle
|
|
40
|
-
const hoverMiddleY =
|
|
41
|
-
(hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
|
|
35
|
+
const hoverMiddleY = (hoverBoundingRect.bottom - hoverBoundingRect.top) / 2;
|
|
42
36
|
// Determine mouse position
|
|
43
37
|
const clientOffset = monitor.getClientOffset();
|
|
44
38
|
// Get pixels to the top
|
|
@@ -74,7 +68,7 @@ const Item = ({ index, move, name, removeItem }) => {
|
|
|
74
68
|
end: () => {
|
|
75
69
|
setIsDraggingSibling(false);
|
|
76
70
|
},
|
|
77
|
-
collect: monitor => ({
|
|
71
|
+
collect: (monitor) => ({
|
|
78
72
|
isDragging: monitor.isDragging(),
|
|
79
73
|
}),
|
|
80
74
|
});
|
|
@@ -97,7 +91,7 @@ const Item = ({ index, move, name, removeItem }) => {
|
|
|
97
91
|
label={get(metadatas, [name, 'edit', 'label'], '')}
|
|
98
92
|
name={name}
|
|
99
93
|
onClickEdit={() => setEditFieldToSelect(name)}
|
|
100
|
-
onClickRemove={e => {
|
|
94
|
+
onClickRemove={(e) => {
|
|
101
95
|
e.stopPropagation();
|
|
102
96
|
removeItem(index);
|
|
103
97
|
}}
|
|
@@ -19,7 +19,7 @@ const MediaLib = ({ isOpen, onChange, onToggle }) => {
|
|
|
19
19
|
|
|
20
20
|
const Component = getComponent('media-library').Component;
|
|
21
21
|
|
|
22
|
-
const handleInputChange = data => {
|
|
22
|
+
const handleInputChange = (data) => {
|
|
23
23
|
if (data) {
|
|
24
24
|
const formattedData = data.map(({ name, alternativeText, url }) => {
|
|
25
25
|
const alt = alternativeText || name;
|
|
@@ -149,7 +149,7 @@ class Wysiwyg extends React.Component {
|
|
|
149
149
|
* Init the editor with data from
|
|
150
150
|
* @param {[type]} props [description]
|
|
151
151
|
*/
|
|
152
|
-
setInitialValue = props => {
|
|
152
|
+
setInitialValue = (props) => {
|
|
153
153
|
if (isEmpty(props.value)) {
|
|
154
154
|
return this.setState({ editorState: EditorState.createEmpty() });
|
|
155
155
|
}
|
|
@@ -246,9 +246,7 @@ class Wysiwyg extends React.Component {
|
|
|
246
246
|
nextBlocks.map((block, index) => {
|
|
247
247
|
const previousContent =
|
|
248
248
|
index === 0
|
|
249
|
-
? this.getEditorState()
|
|
250
|
-
.getCurrentContent()
|
|
251
|
-
.getBlockForKey(this.getCurrentAnchorKey())
|
|
249
|
+
? this.getEditorState().getCurrentContent().getBlockForKey(this.getCurrentAnchorKey())
|
|
252
250
|
: newEditorState.getCurrentContent().getBlockBefore(block.getKey());
|
|
253
251
|
// Check if there was an li before the position so we update the entire list bullets
|
|
254
252
|
const number = previousContent ? parseInt(previousContent.getText().split('.')[0], 10) : 0;
|
|
@@ -325,7 +323,7 @@ class Wysiwyg extends React.Component {
|
|
|
325
323
|
});
|
|
326
324
|
}
|
|
327
325
|
|
|
328
|
-
selectedBlocksList.map(block => {
|
|
326
|
+
selectedBlocksList.map((block) => {
|
|
329
327
|
const selectedText = block.getText();
|
|
330
328
|
const li = selectedText === '' ? '- ' : `- ${selectedText}`;
|
|
331
329
|
const newBlock = createNewBlock(li, 'block-list', block.getKey());
|
|
@@ -345,7 +343,7 @@ class Wysiwyg extends React.Component {
|
|
|
345
343
|
* Handler to create header
|
|
346
344
|
* @param {String} text header content
|
|
347
345
|
*/
|
|
348
|
-
addBlock = text => {
|
|
346
|
+
addBlock = (text) => {
|
|
349
347
|
const nextBlockKey = this.getNextBlockKey(this.getCurrentAnchorKey()) || genKey();
|
|
350
348
|
const newBlock = createNewBlock(text, 'header', nextBlockKey);
|
|
351
349
|
const newContentState = this.createNewContentStateFromBlock(newBlock);
|
|
@@ -363,7 +361,7 @@ class Wysiwyg extends React.Component {
|
|
|
363
361
|
);
|
|
364
362
|
};
|
|
365
363
|
|
|
366
|
-
addLinks = data => {
|
|
364
|
+
addLinks = (data) => {
|
|
367
365
|
const links = data.reduce((acc, { alt, url }) => `${acc}\n`, '');
|
|
368
366
|
const { selection } = this.state;
|
|
369
367
|
const newBlock = createNewBlock(links);
|
|
@@ -501,9 +499,7 @@ class Wysiwyg extends React.Component {
|
|
|
501
499
|
* @return {Map} ContentBlock
|
|
502
500
|
*/
|
|
503
501
|
getCurrentContentBlock = () =>
|
|
504
|
-
this.getEditorState()
|
|
505
|
-
.getCurrentContent()
|
|
506
|
-
.getBlockForKey(this.getSelection().getAnchorKey());
|
|
502
|
+
this.getEditorState().getCurrentContent().getBlockForKey(this.getSelection().getAnchorKey());
|
|
507
503
|
|
|
508
504
|
/**
|
|
509
505
|
* Retrieve the block key after a specific one
|
|
@@ -515,17 +511,13 @@ class Wysiwyg extends React.Component {
|
|
|
515
511
|
editorState.getCurrentContent().getKeyAfter(currentBlockKey);
|
|
516
512
|
|
|
517
513
|
getSelectedText = ({ start, end } = getOffSets(this.getSelection())) =>
|
|
518
|
-
this.getCurrentContentBlock()
|
|
519
|
-
.getText()
|
|
520
|
-
.slice(start, end);
|
|
514
|
+
this.getCurrentContentBlock().getText().slice(start, end);
|
|
521
515
|
|
|
522
516
|
handleBlur = () => {
|
|
523
517
|
const target = {
|
|
524
518
|
name: this.props.name,
|
|
525
519
|
type: 'textarea',
|
|
526
|
-
value: this.getEditorState()
|
|
527
|
-
.getCurrentContent()
|
|
528
|
-
.getPlainText(),
|
|
520
|
+
value: this.getEditorState().getCurrentContent().getPlainText(),
|
|
529
521
|
};
|
|
530
522
|
this.props.onBlur({ target });
|
|
531
523
|
this.blur();
|
|
@@ -593,7 +585,7 @@ class Wysiwyg extends React.Component {
|
|
|
593
585
|
return false;
|
|
594
586
|
};
|
|
595
587
|
|
|
596
|
-
mapKeyToEditorCommand = e => {
|
|
588
|
+
mapKeyToEditorCommand = (e) => {
|
|
597
589
|
if (e.keyCode === 9 /* TAB */) {
|
|
598
590
|
const newEditorState = RichUtils.onTab(e, this.state.editorState, 4 /* maxDepth */);
|
|
599
591
|
if (newEditorState !== this.state.editorState) {
|
|
@@ -614,7 +606,7 @@ class Wysiwyg extends React.Component {
|
|
|
614
606
|
modifyBlockContent = (text, contentState = this.getEditorState().getCurrentContent()) =>
|
|
615
607
|
Modifier.replaceText(contentState, this.getSelection(), text);
|
|
616
608
|
|
|
617
|
-
onChange = editorState => {
|
|
609
|
+
onChange = (editorState) => {
|
|
618
610
|
const { disabled } = this.props;
|
|
619
611
|
|
|
620
612
|
if (!disabled) {
|
|
@@ -623,7 +615,7 @@ class Wysiwyg extends React.Component {
|
|
|
623
615
|
}
|
|
624
616
|
};
|
|
625
617
|
|
|
626
|
-
handleTab = e => {
|
|
618
|
+
handleTab = (e) => {
|
|
627
619
|
e.preventDefault();
|
|
628
620
|
const newEditorState = onTab(this.getEditorState());
|
|
629
621
|
|
|
@@ -635,7 +627,7 @@ class Wysiwyg extends React.Component {
|
|
|
635
627
|
*/
|
|
636
628
|
|
|
637
629
|
handleToggle = () => {
|
|
638
|
-
this.setState(prevState => ({
|
|
630
|
+
this.setState((prevState) => ({
|
|
639
631
|
...prevState,
|
|
640
632
|
isMediaLibraryOpened: !prevState.isMediaLibraryOpened,
|
|
641
633
|
}));
|
|
@@ -645,7 +637,7 @@ class Wysiwyg extends React.Component {
|
|
|
645
637
|
* Update the parent reducer
|
|
646
638
|
* @param {Map} editorState [description]
|
|
647
639
|
*/
|
|
648
|
-
sendData = editorState => {
|
|
640
|
+
sendData = (editorState) => {
|
|
649
641
|
if (
|
|
650
642
|
this.getEditorState().getCurrentContent() !== editorState.getCurrentContent() ||
|
|
651
643
|
editorState.getLastChangeType() === 'remove-range'
|
|
@@ -660,7 +652,7 @@ class Wysiwyg extends React.Component {
|
|
|
660
652
|
} else return;
|
|
661
653
|
};
|
|
662
654
|
|
|
663
|
-
toggleFullScreen = e => {
|
|
655
|
+
toggleFullScreen = (e) => {
|
|
664
656
|
e.preventDefault();
|
|
665
657
|
this.setState({
|
|
666
658
|
isFullscreen: !this.state.isFullscreen,
|
|
@@ -690,7 +682,7 @@ class Wysiwyg extends React.Component {
|
|
|
690
682
|
!this.props.deactivateErrorHighlight && this.props.error && 'editorError',
|
|
691
683
|
!isEmpty(this.props.className) && this.props.className
|
|
692
684
|
)}
|
|
693
|
-
onClick={e => {
|
|
685
|
+
onClick={(e) => {
|
|
694
686
|
if (isFullscreen) {
|
|
695
687
|
e.preventDefault();
|
|
696
688
|
e.stopPropagation();
|
|
@@ -741,7 +733,7 @@ class Wysiwyg extends React.Component {
|
|
|
741
733
|
onChange={this.onChange}
|
|
742
734
|
onTab={this.handleTab}
|
|
743
735
|
placeholder={this.props.placeholder}
|
|
744
|
-
setRef={editor => (this.domEditor = editor)}
|
|
736
|
+
setRef={(editor) => (this.domEditor = editor)}
|
|
745
737
|
stripPastedStyles
|
|
746
738
|
tabIndex={this.props.tabIndex}
|
|
747
739
|
spellCheck
|
|
@@ -761,7 +753,7 @@ class Wysiwyg extends React.Component {
|
|
|
761
753
|
{isFullscreen && (
|
|
762
754
|
<div
|
|
763
755
|
className={cn('editorWrapper')}
|
|
764
|
-
onClick={e => {
|
|
756
|
+
onClick={(e) => {
|
|
765
757
|
e.preventDefault();
|
|
766
758
|
e.stopPropagation();
|
|
767
759
|
}}
|
|
@@ -9,7 +9,7 @@ import { FormattedMessage } from 'react-intl';
|
|
|
9
9
|
import PropTypes from 'prop-types';
|
|
10
10
|
import ToggleModeWrapper from './ToggleModeWrapper';
|
|
11
11
|
|
|
12
|
-
const ToggleMode = props => {
|
|
12
|
+
const ToggleMode = (props) => {
|
|
13
13
|
const label = props.isPreviewMode
|
|
14
14
|
? 'components.Wysiwyg.ToggleMode.markdown'
|
|
15
15
|
: 'components.Wysiwyg.ToggleMode.preview';
|
|
@@ -17,12 +17,8 @@ const ToggleMode = props => {
|
|
|
17
17
|
return (
|
|
18
18
|
<ToggleModeWrapper>
|
|
19
19
|
<FormattedMessage id={label}>
|
|
20
|
-
{msg => (
|
|
21
|
-
<button
|
|
22
|
-
type="button"
|
|
23
|
-
className="toggleModeButton"
|
|
24
|
-
onClick={props.onClick}
|
|
25
|
-
>
|
|
20
|
+
{(msg) => (
|
|
21
|
+
<button type="button" className="toggleModeButton" onClick={props.onClick}>
|
|
26
22
|
{msg}
|
|
27
23
|
</button>
|
|
28
24
|
)}
|
|
@@ -53,17 +53,9 @@ export function onTab(editorState) {
|
|
|
53
53
|
let newContentState;
|
|
54
54
|
|
|
55
55
|
if (selection.isCollapsed()) {
|
|
56
|
-
newContentState = Modifier.insertText(
|
|
57
|
-
contentState,
|
|
58
|
-
selection,
|
|
59
|
-
DEFAULT_INDENTATION
|
|
60
|
-
);
|
|
56
|
+
newContentState = Modifier.insertText(contentState, selection, DEFAULT_INDENTATION);
|
|
61
57
|
} else {
|
|
62
|
-
newContentState = Modifier.replaceText(
|
|
63
|
-
contentState,
|
|
64
|
-
selection,
|
|
65
|
-
DEFAULT_INDENTATION
|
|
66
|
-
);
|
|
58
|
+
newContentState = Modifier.replaceText(contentState, selection, DEFAULT_INDENTATION);
|
|
67
59
|
}
|
|
68
60
|
|
|
69
61
|
return EditorState.push(editorState, newContentState, 'insert-characters');
|
|
@@ -32,13 +32,8 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
32
32
|
const { push, replace } = useHistory();
|
|
33
33
|
const [{ rawQuery }] = useQueryParams();
|
|
34
34
|
const dispatch = useDispatch();
|
|
35
|
-
const {
|
|
36
|
-
|
|
37
|
-
contentTypeDataStructure,
|
|
38
|
-
data,
|
|
39
|
-
isLoading,
|
|
40
|
-
status,
|
|
41
|
-
} = useSelector(selectCrudReducer);
|
|
35
|
+
const { componentsDataStructure, contentTypeDataStructure, data, isLoading, status } =
|
|
36
|
+
useSelector(selectCrudReducer);
|
|
42
37
|
const redirectionLink = useFindRedirectionLink(slug);
|
|
43
38
|
|
|
44
39
|
const isMounted = useRef(true);
|
|
@@ -57,7 +52,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
57
52
|
}, [slug, id, isCreatingEntry, origin]);
|
|
58
53
|
|
|
59
54
|
const cleanClonedData = useCallback(
|
|
60
|
-
data => {
|
|
55
|
+
(data) => {
|
|
61
56
|
if (!origin) {
|
|
62
57
|
return data;
|
|
63
58
|
}
|
|
@@ -73,7 +68,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
73
68
|
[origin]
|
|
74
69
|
);
|
|
75
70
|
|
|
76
|
-
const cleanReceivedData = useCallback(data => {
|
|
71
|
+
const cleanReceivedData = useCallback((data) => {
|
|
77
72
|
const cleaned = removePasswordFieldsFromData(
|
|
78
73
|
data,
|
|
79
74
|
allLayoutDataRef.current.contentType,
|
|
@@ -128,7 +123,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
128
123
|
const abortController = new AbortController();
|
|
129
124
|
const { signal } = abortController;
|
|
130
125
|
|
|
131
|
-
const fetchData = async signal => {
|
|
126
|
+
const fetchData = async (signal) => {
|
|
132
127
|
dispatch(getData());
|
|
133
128
|
|
|
134
129
|
try {
|
|
@@ -180,7 +175,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
180
175
|
};
|
|
181
176
|
}, [cleanClonedData, cleanReceivedData, push, requestURL, dispatch, rawQuery, redirectionLink]);
|
|
182
177
|
|
|
183
|
-
const displayErrors = useCallback(err => {
|
|
178
|
+
const displayErrors = useCallback((err) => {
|
|
184
179
|
const errorPayload = err.response.payload;
|
|
185
180
|
console.error(errorPayload);
|
|
186
181
|
|
|
@@ -197,7 +192,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|
|
197
192
|
}, []);
|
|
198
193
|
|
|
199
194
|
const onDelete = useCallback(
|
|
200
|
-
async trackerProperty => {
|
|
195
|
+
async (trackerProperty) => {
|
|
201
196
|
try {
|
|
202
197
|
emitEventRef.current('willDeleteEntry', trackerProperty);
|
|
203
198
|
|
|
@@ -79,7 +79,7 @@ const CollectionTypeRecursivePath = ({
|
|
|
79
79
|
{ path: ':id', comp: EditViewLayoutManager },
|
|
80
80
|
{ path: '', comp: ListViewLayout },
|
|
81
81
|
].map(({ path, comp }) => (
|
|
82
|
-
<Route key={path} path={`${url}/${path}`} render={props => renderRoute(props, comp)} />
|
|
82
|
+
<Route key={path} path={`${url}/${path}`} render={(props) => renderRoute(props, comp)} />
|
|
83
83
|
));
|
|
84
84
|
|
|
85
85
|
return (
|
|
@@ -12,14 +12,14 @@ import EditSettingsView from '../EditSettingsView';
|
|
|
12
12
|
const ComponentSettingsView = () => {
|
|
13
13
|
const [{ isLoading, data: layout }, dispatch] = useReducer(crudReducer, crudInitialState);
|
|
14
14
|
const schemasSelector = useMemo(makeSelectModelAndComponentSchemas, []);
|
|
15
|
-
const { schemas } = useSelector(state => schemasSelector(state), shallowEqual);
|
|
15
|
+
const { schemas } = useSelector((state) => schemasSelector(state), shallowEqual);
|
|
16
16
|
const { uid } = useParams();
|
|
17
17
|
|
|
18
18
|
useEffect(() => {
|
|
19
19
|
const abortController = new AbortController();
|
|
20
20
|
const { signal } = abortController;
|
|
21
21
|
|
|
22
|
-
const fetchData = async signal => {
|
|
22
|
+
const fetchData = async (signal) => {
|
|
23
23
|
try {
|
|
24
24
|
dispatch(getData());
|
|
25
25
|
|
|
@@ -32,7 +32,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
|
|
|
32
32
|
const [isDraggingSibling, setIsDraggingSibling] = useState(false);
|
|
33
33
|
|
|
34
34
|
const schemasSelector = useMemo(makeSelectModelAndComponentSchemas, []);
|
|
35
|
-
const { schemas } = useSelector(state => schemasSelector(state), shallowEqual);
|
|
35
|
+
const { schemas } = useSelector((state) => schemasSelector(state), shallowEqual);
|
|
36
36
|
|
|
37
37
|
const { componentLayouts, initialData, metaToEdit, modifiedData, metaForm } = reducerState.toJS();
|
|
38
38
|
|
|
@@ -47,8 +47,8 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
|
|
|
47
47
|
const relationsLayout = modifiedData.layouts.editRelations;
|
|
48
48
|
const editRelationsLayoutRemainingFields = useMemo(() => {
|
|
49
49
|
return Object.keys(attributes)
|
|
50
|
-
.filter(attr => attributes[attr].type === 'relation')
|
|
51
|
-
.filter(attr => relationsLayout.indexOf(attr) === -1);
|
|
50
|
+
.filter((attr) => attributes[attr].type === 'relation')
|
|
51
|
+
.filter((attr) => relationsLayout.indexOf(attr) === -1);
|
|
52
52
|
}, [attributes, relationsLayout]);
|
|
53
53
|
|
|
54
54
|
const formToDisplay = useMemo(() => {
|
|
@@ -58,29 +58,29 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
|
|
|
58
58
|
|
|
59
59
|
const associatedMetas = get(modifiedData, ['metadatas', metaToEdit, 'edit'], {});
|
|
60
60
|
|
|
61
|
-
return Object.keys(associatedMetas).filter(meta => meta !== 'visible');
|
|
61
|
+
return Object.keys(associatedMetas).filter((meta) => meta !== 'visible');
|
|
62
62
|
}, [metaToEdit, modifiedData]);
|
|
63
63
|
|
|
64
64
|
const editLayoutRemainingFields = useMemo(() => {
|
|
65
65
|
const displayedFields = flatMap(modifiedData.layouts.edit, 'rowContent');
|
|
66
66
|
|
|
67
67
|
return Object.keys(modifiedData.attributes)
|
|
68
|
-
.filter(attr => {
|
|
68
|
+
.filter((attr) => {
|
|
69
69
|
if (!isContentTypeView) {
|
|
70
70
|
return true;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
return get(modifiedData, ['attributes', attr, 'type'], '') !== 'relation';
|
|
74
74
|
})
|
|
75
|
-
.filter(attr => get(modifiedData, ['metadatas', attr, 'edit', 'visible'], false) === true)
|
|
76
|
-
.filter(attr => {
|
|
77
|
-
return displayedFields.findIndex(el => el.name === attr) === -1;
|
|
75
|
+
.filter((attr) => get(modifiedData, ['metadatas', attr, 'edit', 'visible'], false) === true)
|
|
76
|
+
.filter((attr) => {
|
|
77
|
+
return displayedFields.findIndex((el) => el.name === attr) === -1;
|
|
78
78
|
})
|
|
79
79
|
.sort();
|
|
80
80
|
}, [isContentTypeView, modifiedData]);
|
|
81
81
|
|
|
82
82
|
const getSelectedItemSelectOptions = useCallback(
|
|
83
|
-
formType => {
|
|
83
|
+
(formType) => {
|
|
84
84
|
if (formType !== 'relation' && formType !== 'component') {
|
|
85
85
|
return [];
|
|
86
86
|
}
|
|
@@ -137,7 +137,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
|
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
-
const handleSubmitMetaForm = e => {
|
|
140
|
+
const handleSubmitMetaForm = (e) => {
|
|
141
141
|
e.preventDefault();
|
|
142
142
|
dispatch({
|
|
143
143
|
type: 'SUBMIT_META_FORM',
|
|
@@ -174,7 +174,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
|
|
|
174
174
|
};
|
|
175
175
|
|
|
176
176
|
const toggleModalForm = () => {
|
|
177
|
-
setIsModalFormOpen(prevState => !prevState);
|
|
177
|
+
setIsModalFormOpen((prevState) => !prevState);
|
|
178
178
|
};
|
|
179
179
|
|
|
180
180
|
const renderForm = () =>
|
|
@@ -202,11 +202,11 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
|
|
|
202
202
|
<FormattedMessage
|
|
203
203
|
id={`${pluginId}.containers.SettingPage.editSettings.relation-field.description`}
|
|
204
204
|
>
|
|
205
|
-
{description => (
|
|
205
|
+
{(description) => (
|
|
206
206
|
<FormattedMessage
|
|
207
207
|
id={get(getInputProps(meta), 'label.id', 'app.utils.defaultMessage')}
|
|
208
208
|
>
|
|
209
|
-
{label => (
|
|
209
|
+
{(label) => (
|
|
210
210
|
<Input
|
|
211
211
|
autoFocus={index === 0}
|
|
212
212
|
description={meta === 'mainField' ? description : ''}
|
|
@@ -236,7 +236,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
|
|
|
236
236
|
metadatas={get(modifiedData, ['metadatas'], {})}
|
|
237
237
|
moveItem={moveItem}
|
|
238
238
|
moveRow={moveRow}
|
|
239
|
-
onAddData={name => {
|
|
239
|
+
onAddData={(name) => {
|
|
240
240
|
dispatch({
|
|
241
241
|
type: 'ON_ADD_DATA',
|
|
242
242
|
name,
|
|
@@ -250,7 +250,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
|
|
|
250
250
|
fieldIndex,
|
|
251
251
|
});
|
|
252
252
|
}}
|
|
253
|
-
setEditFieldToSelect={name => {
|
|
253
|
+
setEditFieldToSelect={(name) => {
|
|
254
254
|
dispatch({
|
|
255
255
|
type: 'SET_FIELD_TO_EDIT',
|
|
256
256
|
name,
|
|
@@ -338,7 +338,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
|
|
|
338
338
|
<FieldsReorder className={fieldsReorderClassName} />
|
|
339
339
|
{isContentTypeView && (
|
|
340
340
|
<SortableList
|
|
341
|
-
addItem={name => {
|
|
341
|
+
addItem={(name) => {
|
|
342
342
|
dispatch({
|
|
343
343
|
type: 'ADD_RELATION',
|
|
344
344
|
name,
|
|
@@ -352,7 +352,7 @@ const EditSettingsView = ({ components, mainLayout, isContentTypeView, slug, upd
|
|
|
352
352
|
hoverIndex,
|
|
353
353
|
});
|
|
354
354
|
}}
|
|
355
|
-
removeItem={index => {
|
|
355
|
+
removeItem={(index) => {
|
|
356
356
|
dispatch({
|
|
357
357
|
type: 'REMOVE_RELATION',
|
|
358
358
|
index,
|
|
@@ -16,16 +16,16 @@ const reducer = (state, action) => {
|
|
|
16
16
|
|
|
17
17
|
switch (action.type) {
|
|
18
18
|
case 'ADD_RELATION':
|
|
19
|
-
return state.updateIn(layoutPathRelations, list => list.push(action.name));
|
|
19
|
+
return state.updateIn(layoutPathRelations, (list) => list.push(action.name));
|
|
20
20
|
case 'MOVE_RELATION': {
|
|
21
|
-
return state.updateIn(layoutPathRelations, list => {
|
|
21
|
+
return state.updateIn(layoutPathRelations, (list) => {
|
|
22
22
|
return list
|
|
23
23
|
.delete(action.dragIndex)
|
|
24
24
|
.insert(action.hoverIndex, state.getIn([...layoutPathRelations, action.dragIndex]));
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
case 'MOVE_ROW':
|
|
28
|
-
return state.updateIn(layoutPathEdit, list => {
|
|
28
|
+
return state.updateIn(layoutPathEdit, (list) => {
|
|
29
29
|
return list
|
|
30
30
|
.delete(action.dragRowIndex)
|
|
31
31
|
.insert(action.hoverRowIndex, state.getIn([...layoutPathEdit, action.dragRowIndex]));
|
|
@@ -34,7 +34,7 @@ const reducer = (state, action) => {
|
|
|
34
34
|
const size = getInputSize(state.getIn(['modifiedData', 'attributes', action.name, 'type']));
|
|
35
35
|
|
|
36
36
|
const listSize = state.getIn(layoutPathEdit).size;
|
|
37
|
-
const newList = state.getIn(layoutPathEdit).updateIn([listSize - 1, 'rowContent'], list => {
|
|
37
|
+
const newList = state.getIn(layoutPathEdit).updateIn([listSize - 1, 'rowContent'], (list) => {
|
|
38
38
|
if (list) {
|
|
39
39
|
return list.push({
|
|
40
40
|
name: action.name,
|
|
@@ -60,9 +60,9 @@ const reducer = (state, action) => {
|
|
|
60
60
|
|
|
61
61
|
// Delete the entire row if length is one or if lenght is equal to 2 and the second element is the hidden div used to make the dnd exp smoother
|
|
62
62
|
if (row.size === 1 || (row.size === 2 && row.getIn([1, 'name']) === '_TEMP_')) {
|
|
63
|
-
newState = state.updateIn(layoutPathEdit, list => list.delete(action.rowIndex));
|
|
63
|
+
newState = state.updateIn(layoutPathEdit, (list) => list.delete(action.rowIndex));
|
|
64
64
|
} else {
|
|
65
|
-
newState = state.updateIn([...layoutPathEdit, action.rowIndex, 'rowContent'], list =>
|
|
65
|
+
newState = state.updateIn([...layoutPathEdit, action.rowIndex, 'rowContent'], (list) =>
|
|
66
66
|
list.delete(action.fieldIndex)
|
|
67
67
|
);
|
|
68
68
|
}
|
|
@@ -71,13 +71,13 @@ const reducer = (state, action) => {
|
|
|
71
71
|
return state.updateIn(layoutPathEdit, () => updatedList);
|
|
72
72
|
}
|
|
73
73
|
case 'REMOVE_RELATION':
|
|
74
|
-
return state.updateIn(layoutPathRelations, list => list.delete(action.index));
|
|
74
|
+
return state.updateIn(layoutPathRelations, (list) => list.delete(action.index));
|
|
75
75
|
case 'REORDER_DIFF_ROW': {
|
|
76
76
|
const newState = state
|
|
77
|
-
.updateIn([...layoutPathEdit, action.dragRowIndex, 'rowContent'], list => {
|
|
77
|
+
.updateIn([...layoutPathEdit, action.dragRowIndex, 'rowContent'], (list) => {
|
|
78
78
|
return list.remove(action.dragIndex);
|
|
79
79
|
})
|
|
80
|
-
.updateIn([...layoutPathEdit, action.hoverRowIndex, 'rowContent'], list => {
|
|
80
|
+
.updateIn([...layoutPathEdit, action.hoverRowIndex, 'rowContent'], (list) => {
|
|
81
81
|
return list.insert(
|
|
82
82
|
action.hoverIndex,
|
|
83
83
|
state.getIn([...layoutPathEdit, action.dragRowIndex, 'rowContent', action.dragIndex])
|
|
@@ -91,7 +91,7 @@ const reducer = (state, action) => {
|
|
|
91
91
|
case 'REORDER_ROW': {
|
|
92
92
|
const newState = state.updateIn(
|
|
93
93
|
[...layoutPathEdit, action.dragRowIndex, 'rowContent'],
|
|
94
|
-
list => {
|
|
94
|
+
(list) => {
|
|
95
95
|
return list
|
|
96
96
|
.delete(action.dragIndex)
|
|
97
97
|
.insert(action.hoverIndex, list.get(action.dragIndex));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { get } from 'lodash';
|
|
2
2
|
|
|
3
|
-
const createPossibleMainFieldsForModelsAndComponents = array => {
|
|
3
|
+
const createPossibleMainFieldsForModelsAndComponents = (array) => {
|
|
4
4
|
return array.reduce((acc, current) => {
|
|
5
5
|
const attributes = get(current, ['attributes'], {});
|
|
6
|
-
const possibleMainFields = Object.keys(attributes).filter(attr => {
|
|
6
|
+
const possibleMainFields = Object.keys(attributes).filter((attr) => {
|
|
7
7
|
return ![
|
|
8
8
|
'boolean',
|
|
9
9
|
'component',
|