@plone/volto 17.0.0-alpha.26 → 17.0.0-alpha.28

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 (154) hide show
  1. package/.eslintrc +26 -3
  2. package/.yarn/install-state.gz +0 -0
  3. package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +541 -0
  4. package/.yarn/releases/yarn-3.6.3.cjs +874 -0
  5. package/CHANGELOG.md +60 -0
  6. package/addon-registry.js +10 -1
  7. package/create-addons-loader.js +1 -1
  8. package/locales/ca/LC_MESSAGES/volto.po +57 -31
  9. package/locales/ca.json +1 -1
  10. package/locales/de/LC_MESSAGES/volto.po +58 -32
  11. package/locales/de.json +1 -1
  12. package/locales/en/LC_MESSAGES/volto.po +57 -31
  13. package/locales/en.json +1 -1
  14. package/locales/es/LC_MESSAGES/volto.po +65 -39
  15. package/locales/es.json +1 -1
  16. package/locales/eu/LC_MESSAGES/volto.po +57 -31
  17. package/locales/eu.json +1 -1
  18. package/locales/fi/LC_MESSAGES/volto.po +57 -31
  19. package/locales/fi.json +1 -1
  20. package/locales/fr/LC_MESSAGES/volto.po +57 -31
  21. package/locales/fr.json +1 -1
  22. package/locales/it/LC_MESSAGES/volto.po +57 -31
  23. package/locales/it.json +1 -1
  24. package/locales/ja/LC_MESSAGES/volto.po +57 -31
  25. package/locales/ja.json +1 -1
  26. package/locales/nl/LC_MESSAGES/volto.po +57 -31
  27. package/locales/nl.json +1 -1
  28. package/locales/pt/LC_MESSAGES/volto.po +57 -31
  29. package/locales/pt.json +1 -1
  30. package/locales/pt_BR/LC_MESSAGES/volto.po +57 -31
  31. package/locales/pt_BR.json +1 -1
  32. package/locales/ro/LC_MESSAGES/volto.po +57 -31
  33. package/locales/ro.json +1 -1
  34. package/locales/volto.pot +62 -32
  35. package/locales/zh_CN/LC_MESSAGES/volto.po +57 -31
  36. package/locales/zh_CN.json +1 -1
  37. package/package.json +35 -26
  38. package/packages/volto-slate/package.json +1 -1
  39. package/packages/volto-slate/src/blocks/Text/TextBlockView.jsx +2 -1
  40. package/packages/volto-slate/src/blocks/Text/index.js +0 -5
  41. package/packages/volto-slate/src/editor/plugins/Link/render.jsx +5 -6
  42. package/packages/volto-slate/src/editor/render.jsx +11 -1
  43. package/razzle.config.js +4 -6
  44. package/src/components/index.js +194 -194
  45. package/src/components/manage/Add/Add.jsx +7 -8
  46. package/src/components/manage/Blocks/Block/Settings.test.jsx +17 -15
  47. package/src/components/manage/Blocks/HTML/Edit.jsx +8 -8
  48. package/src/components/manage/Blocks/HeroImageLeft/Edit.jsx +30 -25
  49. package/src/components/manage/Blocks/Listing/ListingBody.jsx +6 -4
  50. package/src/components/manage/Blocks/Maps/Edit.test.jsx +1 -2
  51. package/src/components/manage/Blocks/Maps/View.test.jsx +1 -2
  52. package/src/components/manage/Blocks/Search/components/Facets.jsx +2 -3
  53. package/src/components/manage/Blocks/Search/components/FilterList.jsx +4 -6
  54. package/src/components/manage/Blocks/Search/components/SelectFacet.jsx +2 -9
  55. package/src/components/manage/Blocks/Search/hocs/withQueryString.jsx +3 -0
  56. package/src/components/manage/Blocks/Search/hocs/withSearch.jsx +8 -6
  57. package/src/components/manage/Blocks/Search/schema.js +13 -13
  58. package/src/components/manage/Blocks/Table/Cell.jsx +2 -3
  59. package/src/components/manage/Blocks/Text/Edit.jsx +2 -3
  60. package/src/components/manage/Blocks/Title/View.jsx +4 -37
  61. package/src/components/manage/Blocks/ToC/View.jsx +1 -0
  62. package/src/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx +3 -2
  63. package/src/components/manage/Blocks/ToC/variations/HorizontalMenu.jsx +3 -2
  64. package/src/components/manage/Contents/Contents.jsx +252 -114
  65. package/src/components/manage/Contents/ContentsPropertiesModal.jsx +90 -154
  66. package/src/components/manage/Contents/ContentsRenameModal.jsx +88 -139
  67. package/src/components/manage/Contents/ContentsRenameModal.stories.jsx +61 -0
  68. package/src/components/manage/Contents/ContentsTagsModal.jsx +83 -130
  69. package/src/components/manage/Contents/ContentsTagsModal.stories.jsx +68 -0
  70. package/src/components/manage/Contents/ContentsUploadModal.jsx +1 -2
  71. package/src/components/manage/Contents/ContentsWorkflowModal.jsx +87 -154
  72. package/src/components/manage/Controlpanels/Aliases.jsx +4 -12
  73. package/src/components/manage/Controlpanels/Rules/AddRule.jsx +2 -9
  74. package/src/components/manage/Controlpanels/UndoControlpanel.jsx +6 -9
  75. package/src/components/manage/Form/BlockDataForm.test.jsx +17 -15
  76. package/src/components/manage/Form/Form.jsx +2 -3
  77. package/src/components/manage/Form/InlineForm.test.jsx +16 -14
  78. package/src/components/manage/LockingToastsFactory/LockingToastsFactory.jsx +1 -2
  79. package/src/components/manage/Sharing/Sharing.jsx +7 -0
  80. package/src/components/manage/Sidebar/Sidebar.jsx +139 -220
  81. package/src/components/manage/Toolbar/More.jsx +12 -12
  82. package/src/components/manage/Toolbar/PersonalTools.jsx +97 -155
  83. package/src/components/manage/Toolbar/Toolbar.jsx +2 -2
  84. package/src/components/manage/UniversalLink/UniversalLink.test.jsx +2 -1
  85. package/src/components/manage/Widgets/AlignWidget.jsx +2 -4
  86. package/src/components/manage/Widgets/ColorPickerWidget.test.jsx +9 -7
  87. package/src/components/manage/Widgets/DatetimeWidget.jsx +2 -8
  88. package/src/components/manage/Widgets/IdWidget.jsx +1 -2
  89. package/src/components/manage/Widgets/ObjectBrowserWidget.jsx +2 -9
  90. package/src/components/manage/Widgets/RecurrenceWidget/RecurrenceWidget.jsx +2 -9
  91. package/src/components/manage/Widgets/RecurrenceWidget/WeekdayOfTheMonthIndexField.jsx +4 -4
  92. package/src/components/manage/Widgets/SchemaWidget.jsx +6 -9
  93. package/src/components/manage/Widgets/WysiwygWidget.jsx +2 -9
  94. package/src/components/theme/Comments/Comments.jsx +3 -10
  95. package/src/components/theme/ContentMetadataTags/ContentMetadataTags.jsx +4 -0
  96. package/src/components/theme/Login/Login.jsx +1 -2
  97. package/src/components/theme/PasswordReset/PasswordReset.jsx +1 -2
  98. package/src/components/theme/PreviewImage/PreviewImage.jsx +10 -5
  99. package/src/components/theme/PreviewImage/PreviewImage.test.js +17 -0
  100. package/src/components/theme/Register/Register.jsx +2 -4
  101. package/src/components/theme/TsTest/TsTest.test.tsx +11 -0
  102. package/src/components/theme/TsTest/TsTest.tsx +15 -0
  103. package/src/components/theme/View/AlbumView.jsx +3 -2
  104. package/src/components/theme/Widgets/ImageWidget.stories.jsx +1 -2
  105. package/src/config/Loadables.jsx +1 -1
  106. package/src/config/RichTextEditor/Blocks.jsx +2 -3
  107. package/src/config/RichTextEditor/Plugins.jsx +2 -3
  108. package/src/config/RichTextEditor/ToHTML.jsx +12 -10
  109. package/src/config/RichTextEditor/index.js +2 -3
  110. package/src/config/Views.jsx +5 -5
  111. package/src/express-middleware/ok.js +1 -1
  112. package/src/helpers/Blocks/Blocks.js +4 -6
  113. package/src/helpers/Blocks/Blocks.test.js +35 -35
  114. package/src/helpers/Extensions/withBlockSchemaEnhancer.js +48 -50
  115. package/src/helpers/FormValidation/FormValidation.js +7 -6
  116. package/src/helpers/Html/Html.jsx +2 -8
  117. package/src/helpers/Loadable/__mocks__/Loadable.js +18 -18
  118. package/src/helpers/MessageLabels/MessageLabels.js +2 -3
  119. package/src/helpers/Utils/UseDetectClickOutside.stories.jsx +2 -3
  120. package/src/helpers/Utils/Utils.js +10 -0
  121. package/src/helpers/Utils/Utils.test.js +13 -0
  122. package/src/helpers/index.js +1 -0
  123. package/src/hooks/index.js +1 -1
  124. package/src/middleware/api.js +194 -190
  125. package/src/middleware/blacklistRoutes.js +25 -22
  126. package/src/middleware/storeProtectLoadUtils.js +61 -62
  127. package/src/middleware/storeProtectLoadUtils.test.js +47 -43
  128. package/src/reducers/content/content.test.js +4 -4
  129. package/src/reducers/navigation/navigation.js +5 -5
  130. package/src/reducers/navigation/navigation.test.js +30 -0
  131. package/src/registry.js +2 -2
  132. package/src/storybook.jsx +24 -38
  133. package/theme/themes/pastanaga/collections/menu.overrides +3 -2
  134. package/theme/themes/pastanaga/elements/container.overrides +5 -2
  135. package/theme/themes/pastanaga/elements/input.overrides +1 -1
  136. package/theme/themes/pastanaga/elements/step.overrides +2 -1
  137. package/theme/themes/pastanaga/extras/blocks.less +20 -14
  138. package/theme/themes/pastanaga/extras/color-picker-widget.less +1 -1
  139. package/theme/themes/pastanaga/extras/contents.less +5 -1
  140. package/theme/themes/pastanaga/extras/draftjs.less +4 -4
  141. package/theme/themes/pastanaga/extras/grid.less +5 -4
  142. package/theme/themes/pastanaga/extras/main.less +6 -6
  143. package/theme/themes/pastanaga/extras/react-dates-overrides.less +4 -2
  144. package/theme/themes/pastanaga/extras/search.less +2 -2
  145. package/theme/themes/pastanaga/extras/sidebar.less +5 -4
  146. package/theme/themes/pastanaga/extras/time-picker-overrides.less +5 -3
  147. package/theme/themes/pastanaga/extras/toolbar.less +6 -2
  148. package/theme/themes/pastanaga/extras/userscontrolpanel.less +17 -9
  149. package/theme/themes/pastanaga/extras/widgets.less +1 -1
  150. package/theme/themes/pastanaga/modules/rating.overrides +2 -1
  151. package/theme/themes/pastanaga-cms-ui/elements/container.overrides +2 -1
  152. package/theme/themes/pastanaga-cms-ui/extras/cms-ui.elements.container.less +6 -2
  153. package/theme/themes/pastanaga-cms-ui/extras/cms-ui.site.less +2 -2
  154. package/tsconfig.json +33 -0
@@ -8,23 +8,25 @@ import { Provider } from 'react-intl-redux';
8
8
 
9
9
  const mockStore = configureStore();
10
10
 
11
- const withStateManagement = (Component) => ({ ...props }) => {
12
- const [formData, onChangeFormData] = React.useState(props.formData || {});
13
- const onChangeField = (id, value) => {
14
- onChangeFormData({ ...formData, [id]: value });
15
- };
11
+ const withStateManagement =
12
+ (Component) =>
13
+ ({ ...props }) => {
14
+ const [formData, onChangeFormData] = React.useState(props.formData || {});
15
+ const onChangeField = (id, value) => {
16
+ onChangeFormData({ ...formData, [id]: value });
17
+ };
16
18
 
17
- // NOTE: onChangeBlock here is not "really" implemented
19
+ // NOTE: onChangeBlock here is not "really" implemented
18
20
 
19
- return (
20
- <Component
21
- {...props}
22
- onChangeField={onChangeField}
23
- onChangeBlock={(block, data) => onChangeFormData(data)}
24
- formData={formData}
25
- />
26
- );
27
- };
21
+ return (
22
+ <Component
23
+ {...props}
24
+ onChangeField={onChangeField}
25
+ onChangeBlock={(block, data) => onChangeFormData(data)}
26
+ formData={formData}
27
+ />
28
+ );
29
+ };
28
30
 
29
31
  beforeAll(() => {
30
32
  config.widgets = {
@@ -149,14 +149,14 @@ class Edit extends Component {
149
149
  * @method onPreview
150
150
  * @returns {undefined}
151
151
  */
152
- onPreview() {
152
+ async onPreview() {
153
153
  try {
154
- const code = this.props.prettierStandalone
155
- .format(this.getValue(), {
154
+ const code = (
155
+ await this.props.prettierStandalone.format(this.getValue(), {
156
156
  parser: 'html',
157
157
  plugins: [this.props.prettierParserHtml],
158
158
  })
159
- .trim();
159
+ ).trim();
160
160
  this.setState(
161
161
  {
162
162
  isPreview: !this.state.isPreview,
@@ -174,14 +174,14 @@ class Edit extends Component {
174
174
  * @method onPrettify
175
175
  * @returns {undefined}
176
176
  */
177
- onPrettify = () => {
177
+ onPrettify = async () => {
178
178
  try {
179
- const code = this.props.prettierStandalone
180
- .format(this.getValue(), {
179
+ const code = (
180
+ await this.props.prettierStandalone.format(this.getValue(), {
181
181
  parser: 'html',
182
182
  plugins: [this.props.prettierParserHtml],
183
183
  })
184
- .trim();
184
+ ).trim();
185
185
  this.onChangeCode(code);
186
186
  } catch (ex) {
187
187
  // error while parsing the user-typed HTML
@@ -126,9 +126,8 @@ class EditComponent extends Component {
126
126
  },
127
127
  });
128
128
 
129
- this.extendedBlockRenderMap = DefaultDraftBlockRenderMap.merge(
130
- blockTitleRenderMap,
131
- );
129
+ this.extendedBlockRenderMap =
130
+ DefaultDraftBlockRenderMap.merge(blockTitleRenderMap);
132
131
 
133
132
  this.extendedDescripBlockRenderMap = DefaultDraftBlockRenderMap.merge(
134
133
  blockDescriptionRenderMap,
@@ -321,24 +320,26 @@ class EditComponent extends Component {
321
320
  selected: this.props.selected,
322
321
  })}
323
322
  >
324
- {this.props.selected && this.props.editable && !!this.props.data.url && (
325
- <div className="toolbar">
326
- <Button.Group>
327
- <Button
328
- icon
329
- basic
330
- onClick={() =>
331
- this.props.onChangeBlock(this.props.block, {
332
- ...this.props.data,
333
- url: '',
334
- })
335
- }
336
- >
337
- <Icon name={clearSVG} size="24px" color="#e40166" />
338
- </Button>
339
- </Button.Group>
340
- </div>
341
- )}
323
+ {this.props.selected &&
324
+ this.props.editable &&
325
+ !!this.props.data.url && (
326
+ <div className="toolbar">
327
+ <Button.Group>
328
+ <Button
329
+ icon
330
+ basic
331
+ onClick={() =>
332
+ this.props.onChangeBlock(this.props.block, {
333
+ ...this.props.data,
334
+ url: '',
335
+ })
336
+ }
337
+ >
338
+ <Icon name={clearSVG} size="24px" color="#e40166" />
339
+ </Button>
340
+ </Button.Group>
341
+ </div>
342
+ )}
342
343
  <div className="block-inner-wrapper">
343
344
  {this.props.data.url ? (
344
345
  <img
@@ -391,7 +392,8 @@ class EditComponent extends Component {
391
392
  placeholder={this.props.intl.formatMessage(messages.title)}
392
393
  blockStyleFn={() => 'title-editor'}
393
394
  onUpArrow={() => {
394
- const selectionState = this.state.titleEditorState.getSelection();
395
+ const selectionState =
396
+ this.state.titleEditorState.getSelection();
395
397
  const { titleEditorState } = this.state;
396
398
  if (
397
399
  titleEditorState
@@ -407,7 +409,8 @@ class EditComponent extends Component {
407
409
  }
408
410
  }}
409
411
  onDownArrow={() => {
410
- const selectionState = this.state.titleEditorState.getSelection();
412
+ const selectionState =
413
+ this.state.titleEditorState.getSelection();
411
414
  const { titleEditorState } = this.state;
412
415
  if (
413
416
  titleEditorState
@@ -435,7 +438,8 @@ class EditComponent extends Component {
435
438
  )}
436
439
  blockStyleFn={() => 'description-editor'}
437
440
  onUpArrow={() => {
438
- const selectionState = this.state.descriptionEditorState.getSelection();
441
+ const selectionState =
442
+ this.state.descriptionEditorState.getSelection();
439
443
  const currentCursorPosition = selectionState.getStartOffset();
440
444
 
441
445
  if (currentCursorPosition === 0) {
@@ -444,7 +448,8 @@ class EditComponent extends Component {
444
448
  }
445
449
  }}
446
450
  onDownArrow={() => {
447
- const selectionState = this.state.descriptionEditorState.getSelection();
451
+ const selectionState =
452
+ this.state.descriptionEditorState.getSelection();
448
453
  const { descriptionEditorState } = this.state;
449
454
  const currentCursorPosition = selectionState.getStartOffset();
450
455
  const blockLength = descriptionEditorState
@@ -7,17 +7,19 @@ import { Icon } from '@plone/volto/components';
7
7
  import { renderLinkElement } from '@plone/volto-slate/editor/render';
8
8
  import config from '@plone/volto/registry';
9
9
  import withQuerystringResults from './withQuerystringResults';
10
+ import { normalizeString } from '@plone/volto/helpers';
10
11
 
11
12
  import paginationLeftSVG from '@plone/volto/icons/left-key.svg';
12
13
  import paginationRightSVG from '@plone/volto/icons/right-key.svg';
13
14
 
14
15
  const Headline = ({ headlineTag, id, data = {}, listingItems, isEditMode }) => {
15
16
  let attr = { id };
16
- const slug = Slugger.slug(data.headline);
17
+ const slug = Slugger.slug(normalizeString(data.headline));
17
18
  attr.id = slug || id;
18
- const LinkedHeadline = useMemo(() => renderLinkElement(headlineTag), [
19
- headlineTag,
20
- ]);
19
+ const LinkedHeadline = useMemo(
20
+ () => renderLinkElement(headlineTag),
21
+ [headlineTag],
22
+ );
21
23
  return (
22
24
  <LinkedHeadline
23
25
  mode={!isEditMode && 'view'}
@@ -40,8 +40,7 @@ test('renders an edit map block component', () => {
40
40
  <Edit
41
41
  data={{
42
42
  '@type': 'maps',
43
- url:
44
- 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
43
+ url: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
45
44
  }}
46
45
  selected={false}
47
46
  block="1234"
@@ -36,8 +36,7 @@ test('renders a view map component', () => {
36
36
  <View
37
37
  data={{
38
38
  '@type': 'maps',
39
- url:
40
- 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
39
+ url: 'https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3027.7835278268726!2d14.38842915203974!3d40.634655679238854!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x133b994881d943cb%3A0x6ab93db57d3272f0!2sHotel+Mediterraneo+Sorrento!5e0!3m2!1sen!2ses!4v1550168740166',
41
40
  }}
42
41
  />
43
42
  </Provider>,
@@ -103,9 +103,8 @@ const Facets = (props) => {
103
103
 
104
104
  let value = stateToValue({ facetSettings, index, selectedValue });
105
105
 
106
- const {
107
- rewriteOptions = (name, options) => options,
108
- } = search.extensions.facetWidgets;
106
+ const { rewriteOptions = (name, options) => options } =
107
+ search.extensions.facetWidgets;
109
108
 
110
109
  return FacetWrapper && (isEditMode || showFacet(index)) ? (
111
110
  <FacetWrapper
@@ -36,9 +36,8 @@ const FilterList = (props) => {
36
36
  !isEmpty(facets[field.value]),
37
37
  ).length;
38
38
 
39
- const {
40
- types: facetWidgetTypes,
41
- } = config.blocks.blocksConfig.search.extensions.facetWidgets;
39
+ const { types: facetWidgetTypes } =
40
+ config.blocks.blocksConfig.search.extensions.facetWidgets;
42
41
 
43
42
  const intl = useIntl();
44
43
 
@@ -70,9 +69,8 @@ const FilterList = (props) => {
70
69
  <Accordion.Content className="filter-list-content" active={isOpened}>
71
70
  <div className="filter-list">
72
71
  {data.facets?.map((facetSettings, i) => {
73
- const {
74
- filterListComponent: FilterListComponent,
75
- } = resolveExtension('type', facetWidgetTypes, facetSettings);
72
+ const { filterListComponent: FilterListComponent } =
73
+ resolveExtension('type', facetWidgetTypes, facetSettings);
76
74
  const facet = facetSettings?.field?.value;
77
75
  if (!facet) return null;
78
76
 
@@ -13,15 +13,8 @@ import {
13
13
  } from './base';
14
14
 
15
15
  const SelectFacet = (props) => {
16
- const {
17
- facet,
18
- choices,
19
- reactSelect,
20
- isMulti,
21
- onChange,
22
- value,
23
- isEditMode,
24
- } = props;
16
+ const { facet, choices, reactSelect, isMulti, onChange, value, isEditMode } =
17
+ props;
25
18
  const Select = reactSelect.default;
26
19
  const v = Array.isArray(value) && value.length === 0 ? null : value;
27
20
 
@@ -15,6 +15,9 @@ export default function withQueryString(WrappedComponent) {
15
15
  const dispatch = useDispatch();
16
16
 
17
17
  const qs = useSelector((state) => state.querystring);
18
+ // This showed up after updating eslint-plugin-react-hooks
19
+ // TODO: fix it properly
20
+ // eslint-disable-next-line react-hooks/exhaustive-deps
18
21
  const indexes = qs?.indexes || {};
19
22
 
20
23
  React.useEffect(() => {
@@ -29,9 +29,8 @@ const PAQO = 'plone.app.querystring.operation';
29
29
  *
30
30
  */
31
31
  function getInitialState(data, facets, urlSearchText, id) {
32
- const {
33
- types: facetWidgetTypes,
34
- } = config.blocks.blocksConfig.search.extensions.facetWidgets;
32
+ const { types: facetWidgetTypes } =
33
+ config.blocks.blocksConfig.search.extensions.facetWidgets;
35
34
  const facetSettings = data?.facets || [];
36
35
 
37
36
  return {
@@ -87,9 +86,8 @@ function normalizeState({
87
86
  sortOrder,
88
87
  facetSettings, // data.facets extracted from block data
89
88
  }) {
90
- const {
91
- types: facetWidgetTypes,
92
- } = config.blocks.blocksConfig.search.extensions.facetWidgets;
89
+ const { types: facetWidgetTypes } =
90
+ config.blocks.blocksConfig.search.extensions.facetWidgets;
93
91
 
94
92
  const params = {
95
93
  query: [
@@ -240,6 +238,8 @@ const withSearch = (options) => (WrappedComponent) => {
240
238
  editable,
241
239
  );
242
240
 
241
+ // TODO: Improve the hook dependencies out of the scope of https://github.com/plone/volto/pull/4662
242
+ // eslint-disable-next-line react-hooks/exhaustive-deps
243
243
  const urlQuery = locationSearchData.query
244
244
  ? deserializeQuery(locationSearchData.query)
245
245
  : [];
@@ -250,6 +250,8 @@ const withSearch = (options) => (WrappedComponent) => {
250
250
 
251
251
  // TODO: refactor, should use only useLocationStateManager()!!!
252
252
  const [searchText, setSearchText] = React.useState(urlSearchText);
253
+ // TODO: Improve the hook dependencies out of the scope of https://github.com/plone/volto/pull/4662
254
+ // eslint-disable-next-line react-hooks/exhaustive-deps
253
255
  const configuredFacets =
254
256
  data.facets?.map((facet) => facet?.field?.value) || [];
255
257
  const multiFacets = data.facets
@@ -37,8 +37,7 @@ const messages = defineMessages({
37
37
  defaultMessage: 'Show search button?',
38
38
  },
39
39
  showSearchButtonDescription: {
40
- id:
41
- 'The button presence disables the live search, the query is issued when you press ENTER',
40
+ id: 'The button presence disables the live search, the query is issued when you press ENTER',
42
41
  defaultMessage:
43
42
  'The button presence disables the live search, the query is issued when you press ENTER',
44
43
  },
@@ -83,8 +82,7 @@ const messages = defineMessages({
83
82
  defaultMessage: 'Hide facet?',
84
83
  },
85
84
  hideFacetDescription: {
86
- id:
87
- 'Hidden facets will still filter the results if proper parameters are passed in URLs',
85
+ id: 'Hidden facets will still filter the results if proper parameters are passed in URLs',
88
86
  defaultMessage:
89
87
  'Hidden facets will still filter the results if proper parameters are passed in URLs',
90
88
  },
@@ -187,15 +185,17 @@ const FacetSchema = ({ intl }) => ({
187
185
  },
188
186
  type: {
189
187
  title: intl.formatMessage(messages.facetWidget),
190
- choices: config.blocks.blocksConfig.search.extensions.facetWidgets.types.map(
191
- ({ id, title }) => [
192
- id,
193
- `${intl.formatMessage({ id: id, defaultMessage: title })}`,
194
- ],
195
- ),
196
- defaultValue: config.blocks.blocksConfig.search.extensions.facetWidgets.types.find(
197
- ({ isDefault }) => isDefault,
198
- ).id,
188
+ choices:
189
+ config.blocks.blocksConfig.search.extensions.facetWidgets.types.map(
190
+ ({ id, title }) => [
191
+ id,
192
+ `${intl.formatMessage({ id: id, defaultMessage: title })}`,
193
+ ],
194
+ ),
195
+ defaultValue:
196
+ config.blocks.blocksConfig.search.extensions.facetWidgets.types.find(
197
+ ({ isDefault }) => isDefault,
198
+ ).id,
199
199
  },
200
200
  },
201
201
  required: ['field'],
@@ -157,9 +157,8 @@ class CellComponent extends Component {
157
157
  const selectionState = this.state.editorState.getSelection();
158
158
  const anchorKey = selectionState.getAnchorKey();
159
159
  const currentContent = this.state.editorState.getCurrentContent();
160
- const currentContentBlock = currentContent.getBlockForKey(
161
- anchorKey,
162
- );
160
+ const currentContentBlock =
161
+ currentContent.getBlockForKey(anchorKey);
163
162
  const blockType = currentContentBlock.getType();
164
163
  if (!includes(this.draftConfig.listBlockTypes, blockType)) {
165
164
  this.props.onSelectBlock(
@@ -275,9 +275,8 @@ export class EditComponent extends Component {
275
275
  const selectionState = this.state.editorState.getSelection();
276
276
  const anchorKey = selectionState.getAnchorKey();
277
277
  const currentContent = this.state.editorState.getCurrentContent();
278
- const currentContentBlock = currentContent.getBlockForKey(
279
- anchorKey,
280
- );
278
+ const currentContentBlock =
279
+ currentContent.getBlockForKey(anchorKey);
281
280
  const blockType = currentContentBlock.getType();
282
281
  if (!includes(this.draftConfig.listBlockTypes, blockType)) {
283
282
  this.props.onSelectBlock(
@@ -1,42 +1,9 @@
1
- /**
2
- * View title/description block.
3
- * @module volto-slate/blocks/Title/TitleBlockView
4
- */
5
-
6
- import React, { useMemo } from 'react';
7
- import PropTypes from 'prop-types';
8
- import Slugger from 'github-slugger';
9
- import { renderLinkElement } from '@plone/volto-slate/editor/render';
10
-
11
- /**
12
- * View title block component.
13
- * @class View
14
- * @extends Component
15
- */
16
- const TitleBlockView = ({ properties, metadata, id, children }) => {
17
- let attr = { id };
18
- const title = (properties || metadata)['title'];
19
- const slug = Slugger.slug(title);
20
- attr.id = slug || id;
21
- const LinkedTitle = useMemo(() => renderLinkElement('h1'), []);
1
+ const TitleBlockView = ({ properties, metadata }) => {
22
2
  return (
23
- <LinkedTitle
24
- mode="view"
25
- children={title ?? children}
26
- attributes={attr}
27
- className={'documentFirstHeading'}
28
- />
3
+ <h1 className="documentFirstHeading">
4
+ {(metadata || properties)['title'] || ''}
5
+ </h1>
29
6
  );
30
7
  };
31
8
 
32
- /**
33
- * Property types.
34
- * @property {Object} propTypes Property types.
35
- * @static
36
- */
37
- TitleBlockView.propTypes = {
38
- properties: PropTypes.objectOf(PropTypes.any).isRequired,
39
- metadata: PropTypes.objectOf(PropTypes.any),
40
- };
41
-
42
9
  export default TitleBlockView;
@@ -119,6 +119,7 @@ const View = (props) => {
119
119
  const level = entry[0];
120
120
  const title = entry[1];
121
121
  const items = [];
122
+ if (!title?.trim() && !block.plaintext?.trim()) return;
122
123
  if (!level || !levels.includes(level)) return;
123
124
  tocEntriesLayout.push(id);
124
125
  tocEntries[id] = {
@@ -10,13 +10,14 @@ import { List } from 'semantic-ui-react';
10
10
  import { FormattedMessage, injectIntl } from 'react-intl';
11
11
  import Slugger from 'github-slugger';
12
12
  import { UniversalLink } from '@plone/volto/components';
13
+ import { normalizeString } from '@plone/volto/helpers';
13
14
 
14
15
  const RenderListItems = ({ items, data }) => {
15
16
  return map(items, (item) => {
16
17
  const { id, level, title, override_toc, plaintext } = item;
17
18
  const slug = override_toc
18
- ? Slugger.slug(plaintext)
19
- : Slugger.slug(title) || id;
19
+ ? Slugger.slug(normalizeString(plaintext))
20
+ : Slugger.slug(normalizeString(title)) || id;
20
21
  return (
21
22
  item && (
22
23
  <List.Item key={id} className={`item headline-${level}`} as="li">
@@ -5,13 +5,14 @@ import { Menu, Dropdown } from 'semantic-ui-react';
5
5
  import { FormattedMessage, injectIntl } from 'react-intl';
6
6
  import AnchorLink from 'react-anchor-link-smooth-scroll';
7
7
  import Slugger from 'github-slugger';
8
+ import { normalizeString } from '@plone/volto/helpers';
8
9
 
9
10
  const RenderMenuItems = ({ items }) => {
10
11
  return map(items, (item) => {
11
12
  const { id, level, title, override_toc, plaintext } = item;
12
13
  const slug = override_toc
13
- ? Slugger.slug(plaintext)
14
- : Slugger.slug(title) || id;
14
+ ? Slugger.slug(normalizeString(plaintext))
15
+ : Slugger.slug(normalizeString(title)) || id;
15
16
  return (
16
17
  item && (
17
18
  <React.Fragment key={id}>