@eeacms/volto-eea-website-theme 1.34.0 → 2.0.0

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 (54) hide show
  1. package/.eslintrc.js +7 -2
  2. package/CHANGELOG.md +44 -20
  3. package/docker-compose.yml +1 -1
  4. package/jest-addon.config.js +3 -0
  5. package/package.json +2 -1
  6. package/src/components/manage/Blocks/LayoutSettings/index.js +3 -1
  7. package/src/components/manage/Blocks/Title/index.js +3 -1
  8. package/src/components/manage/Blocks/Title/schema.js +3 -1
  9. package/src/components/theme/Banner/View.jsx +12 -5
  10. package/src/components/theme/DraftBackground/DraftBackground.jsx +1 -0
  11. package/src/components/theme/DraftBackground/DraftBackground.test.jsx +85 -0
  12. package/src/config.js +2 -0
  13. package/src/customizations/@plone/volto-slate/blocks/Text/TextBlockView.jsx +32 -0
  14. package/src/customizations/@plone/volto-slate/editor/render.jsx +75 -0
  15. package/src/customizations/@plone/volto-slate/elementEditor/utils.js +76 -75
  16. package/src/customizations/volto/components/manage/Blocks/Grid/Edit.jsx +70 -0
  17. package/src/customizations/volto/components/manage/Blocks/Grid/View.jsx +61 -0
  18. package/src/customizations/volto/components/manage/Blocks/Grid/readme.md +1 -0
  19. package/src/customizations/volto/components/manage/Blocks/Image/Edit.jsx +82 -23
  20. package/src/customizations/volto/components/manage/Blocks/Image/Edit.test.jsx +10 -3
  21. package/src/customizations/volto/components/manage/Blocks/Image/View.jsx +110 -111
  22. package/src/customizations/volto/components/manage/Blocks/Image/schema.js +17 -2
  23. package/src/customizations/volto/components/manage/Blocks/LeadImage/Edit.jsx +35 -14
  24. package/src/customizations/volto/components/manage/Blocks/LeadImage/View.jsx +65 -79
  25. package/src/customizations/volto/components/manage/Display/Display.jsx +306 -0
  26. package/src/customizations/volto/components/manage/Display/Readme.md +1 -0
  27. package/src/customizations/volto/components/manage/Sidebar/SidebarPopup copy.jsx +82 -0
  28. package/src/customizations/volto/components/manage/Toolbar/More.jsx +541 -0
  29. package/src/customizations/volto/components/manage/UniversalLink/UniversalLink.jsx +3 -1
  30. package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.jsx +24 -14
  31. package/src/customizations/volto/components/manage/Widgets/README.md +1 -0
  32. package/src/customizations/volto/components/manage/Workflow/README.txt +1 -0
  33. package/src/customizations/volto/components/manage/Workflow/Workflow.jsx +324 -0
  34. package/src/customizations/volto/components/manage/Workflow/Workflow.test.jsx +81 -0
  35. package/src/customizations/volto/components/theme/Comments/Comments.jsx +1 -2
  36. package/src/customizations/volto/components/theme/ContactForm/ContactForm.jsx +1 -1
  37. package/src/customizations/volto/components/theme/EventDetails/EventDetails.jsx +1 -0
  38. package/src/index.js +21 -16
  39. package/src/middleware/ok.js +4 -2
  40. package/src/middleware/voltoCustom.js +4 -2
  41. package/src/slate.js +10 -8
  42. package/src/customizations/@plone/volto-slate/editor/plugins/StyleMenu/README.txt +0 -1
  43. package/src/customizations/@plone/volto-slate/editor/plugins/StyleMenu/StyleMenu.jsx +0 -157
  44. package/src/customizations/@plone/volto-slate/editor/plugins/StyleMenu/utils.js +0 -168
  45. package/src/customizations/volto/components/manage/Add/Add.jsx +0 -498
  46. package/src/customizations/volto/components/manage/Add/readme.md +0 -1
  47. package/src/customizations/volto/components/manage/Contents/ContentsPropertiesModal.jsx +0 -232
  48. package/src/customizations/volto/components/manage/Form/Form.jsx +0 -810
  49. package/src/customizations/volto/components/manage/Form/Form.test.jsx +0 -1124
  50. package/src/customizations/volto/components/manage/Form/ModalForm.jsx +0 -326
  51. package/src/customizations/volto/components/manage/Sharing/Sharing.jsx +0 -528
  52. package/src/customizations/volto/components/manage/Sharing/Sharing.test.jsx +0 -72
  53. package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.test.jsx +0 -193
  54. package/src/customizations/volto/components/theme/AppExtras/AppExtras.jsx +0 -27
@@ -1,157 +0,0 @@
1
- import React from 'react';
2
- import { useSlate } from 'slate-react';
3
- import { Dropdown } from 'semantic-ui-react';
4
- import { useIntl, defineMessages } from 'react-intl';
5
- import cx from 'classnames';
6
- import { omit } from 'lodash';
7
- import { isBlockStyleActive, isInlineStyleActive, toggleStyle } from './utils';
8
- import config from '@plone/volto/registry';
9
- import { ToolbarButton } from '@plone/volto-slate/editor/ui';
10
- import paintSVG from '@plone/volto/icons/paint.svg';
11
-
12
- const messages = defineMessages({
13
- inlineStyle: {
14
- id: 'Inline Style',
15
- defaultMessage: 'Inline Style',
16
- },
17
- paragraphStyle: {
18
- id: 'Paragraph Style',
19
- defaultMessage: 'Paragraph Style',
20
- },
21
- additionalStyles: {
22
- id: 'Additional Styles',
23
- defaultMessage: 'Additional Styles',
24
- },
25
- });
26
-
27
- const StyleMenuButton = ({ icon, active, ...props }) => (
28
- <ToolbarButton {...props} icon={icon} active={active} />
29
- );
30
-
31
- const MenuOpts = ({ editor, toSelect, option, type }) => {
32
- const isActive = toSelect.includes(option);
33
- return (
34
- <Dropdown.Item
35
- as="span"
36
- active={isActive}
37
- className={cx(`${type}-${option.value}`, { active: isActive })}
38
- {...omit(option, ['isBlock'])}
39
- data-isblock={option.isBlock}
40
- onClick={(event, selItem) => {
41
- toggleStyle(editor, {
42
- cssClass: selItem.value,
43
- isBlock: selItem.isBlock,
44
- });
45
- }}
46
- />
47
- );
48
- };
49
-
50
- const StylingsButton = (props) => {
51
- const editor = useSlate();
52
- const intl = useIntl();
53
-
54
- // Converting the settings to a format that is required by dropdowns.
55
- const inlineOpts = [
56
- ...config.settings.slate.styleMenu.inlineStyles.map((def) => {
57
- return {
58
- value: def.cssClass,
59
- text: def.label,
60
- icon: def.icon,
61
- isBlock: false,
62
- };
63
- }),
64
- ];
65
- const blockOpts = [
66
- ...config.settings.slate.styleMenu.blockStyles.map((def) => {
67
- return {
68
- value: def.cssClass,
69
- text: def.label,
70
- icon: def.icon,
71
- isBlock: true,
72
- };
73
- }),
74
- ];
75
-
76
- // Calculating the initial selection.
77
- const toSelect = [];
78
- // block styles
79
- for (const val of blockOpts) {
80
- const ia = isBlockStyleActive(editor, val.value);
81
- if (ia) {
82
- toSelect.push(val);
83
- }
84
- }
85
- // inline styles
86
- for (const val of inlineOpts) {
87
- const ia = isInlineStyleActive(editor, val.value);
88
- if (ia) {
89
- toSelect.push(val);
90
- }
91
- }
92
-
93
- const menuItemProps = {
94
- toSelect,
95
- editor,
96
- };
97
- const showMenu = inlineOpts.length || blockOpts.length;
98
- return showMenu ? (
99
- <Dropdown
100
- id="style-menu"
101
- pointing="top left"
102
- multiple
103
- value={toSelect}
104
- disabled={config.settings.slate.styleMenu.disabled ?? false}
105
- additionLabel={intl.formatMessage(messages.additionalStyles)}
106
- trigger={
107
- <StyleMenuButton
108
- title={intl.formatMessage(messages.additionalStyles)}
109
- icon={paintSVG}
110
- active={toSelect.length > 0}
111
- />
112
- }
113
- >
114
- <Dropdown.Menu>
115
- {inlineOpts.length ? (
116
- <>
117
- <Dropdown.Header
118
- content={intl.formatMessage(messages.inlineStyle)}
119
- />
120
- {inlineOpts.map((option, index) => (
121
- <MenuOpts
122
- {...menuItemProps}
123
- type="inline-style"
124
- option={option}
125
- key={index}
126
- />
127
- ))}
128
- </>
129
- ) : (
130
- ''
131
- )}
132
-
133
- {blockOpts.length ? (
134
- <>
135
- <Dropdown.Header
136
- content={intl.formatMessage(messages.paragraphStyle)}
137
- />
138
- {blockOpts.map((option, index) => (
139
- <MenuOpts
140
- {...menuItemProps}
141
- type="block-style"
142
- option={option}
143
- key={index}
144
- />
145
- ))}
146
- </>
147
- ) : (
148
- ''
149
- )}
150
- </Dropdown.Menu>
151
- </Dropdown>
152
- ) : (
153
- ''
154
- );
155
- };
156
-
157
- export default StylingsButton;
@@ -1,168 +0,0 @@
1
- /* eslint no-console: ["error", { allow: ["warn", "error"] }] */
2
- import { Editor, Transforms } from 'slate';
3
- import { isBlockActive } from '@plone/volto-slate/utils';
4
- import config from '@plone/volto/registry';
5
-
6
- /**
7
- * Toggles a style (e.g. in the StyleMenu plugin).
8
- * @param {Editor} editor
9
- * @param {object} options
10
- * @param {boolean} options.isRequested Whether the given style is requested by
11
- * the user. The style is only applied if it is requested and only removed if it
12
- * is not requested.
13
- */
14
- export const toggleStyle = (editor, { cssClass, isBlock, isRequested }) => {
15
- if (isBlock) {
16
- toggleBlockStyle(editor, cssClass);
17
- } else {
18
- toggleInlineStyle(editor, cssClass);
19
- }
20
- };
21
-
22
- export const toggleBlockStyle = (editor, style) => {
23
- // We have 6 boolean variables which need to be accounted for.
24
- // See https://docs.google.com/spreadsheets/d/1mVeMuqSTMABV2BhoHPrPAFjn7zUksbNgZ9AQK_dcd3U/edit?usp=sharing
25
- const { slate } = config.settings;
26
-
27
- const isListItem = isBlockActive(editor, slate.listItemType);
28
- const isActive = isBlockStyleActive(editor, style);
29
- const wantsList = false;
30
-
31
- if (isListItem && !wantsList) {
32
- toggleBlockStyleAsListItem(editor, style);
33
- } else if (isListItem && wantsList && !isActive) {
34
- // switchListType(editor, format); // this will deconstruct to Volto blocks
35
- } else if (!isListItem && wantsList) {
36
- // changeBlockToList(editor, format);
37
- } else if (!isListItem && !wantsList) {
38
- internalToggleBlockStyle(editor, style);
39
- } else {
40
- console.warn('toggleBlockStyle case not covered, please examine:', {
41
- wantsList,
42
- isActive,
43
- isListItem,
44
- });
45
- }
46
- };
47
-
48
- export const toggleInlineStyle = (editor, style) => {
49
- // We have 6 boolean variables which need to be accounted for.
50
- // See https://docs.google.com/spreadsheets/d/1mVeMuqSTMABV2BhoHPrPAFjn7zUksbNgZ9AQK_dcd3U/edit?usp=sharing
51
- const { slate } = config.settings;
52
-
53
- const isListItem = isBlockActive(editor, slate.listItemType);
54
- const isActive = isInlineStyleActive(editor, style);
55
- const wantsList = false;
56
-
57
- if (isListItem && !wantsList) {
58
- toggleInlineStyleAsListItem(editor, style);
59
- } else if (isListItem && wantsList && !isActive) {
60
- // switchListType(editor, format); // this will deconstruct to Volto blocks
61
- } else if (!isListItem && wantsList) {
62
- // changeBlockToList(editor, format);
63
- } else if (!isListItem && !wantsList) {
64
- internalToggleInlineStyle(editor, style);
65
- } else {
66
- console.warn('toggleInlineStyle case not covered, please examine:', {
67
- wantsList,
68
- isActive,
69
- isListItem,
70
- });
71
- }
72
- };
73
-
74
- export const isBlockStyleActive = (editor, style) => {
75
- const keyName = `style-${style}`;
76
- const sn = Array.from(
77
- Editor.nodes(editor, {
78
- match: (n) => {
79
- const isStyle = typeof n.styleName === 'string' || n[keyName];
80
- return !Editor.isEditor(n) && isStyle;
81
- },
82
- mode: 'all',
83
- }),
84
- );
85
-
86
- for (const [n] of sn) {
87
- if (typeof n.styleName === 'string') {
88
- if (n.styleName.split(' ').filter((x) => x === style).length > 0) {
89
- return true;
90
- }
91
- } else if (
92
- n[keyName] &&
93
- keyName.split('-').filter((x) => x === style).length > 0
94
- )
95
- return true;
96
- }
97
- return false;
98
- };
99
-
100
- export const isInlineStyleActive = (editor, style) => {
101
- const m = Editor.marks(editor);
102
- const keyName = `style-${style}`;
103
- if (m && m[keyName]) {
104
- return true;
105
- }
106
- return false;
107
- };
108
-
109
- export const internalToggleBlockStyle = (editor, style) => {
110
- toggleBlockStyleInSelection(editor, style);
111
- };
112
-
113
- export const internalToggleInlineStyle = (editor, style) => {
114
- toggleInlineStyleInSelection(editor, style);
115
- };
116
-
117
- /*
118
- * Applies a block format unto a list item. Will split the list and deconstruct the
119
- * block
120
- */
121
- export const toggleBlockStyleAsListItem = (editor, style) => {
122
- toggleBlockStyleInSelection(editor, style);
123
- };
124
-
125
- /*
126
- * Applies an inline style unto a list item.
127
- */
128
- export const toggleInlineStyleAsListItem = (editor, style) => {
129
- toggleInlineStyleInSelection(editor, style);
130
- };
131
-
132
- function toggleInlineStyleInSelection(editor, style) {
133
- const m = Editor.marks(editor);
134
- const keyName = 'style-' + style;
135
-
136
- if (m && m[keyName]) {
137
- Editor.removeMark(editor, keyName);
138
- } else {
139
- Editor.addMark(editor, keyName, true);
140
- }
141
- }
142
-
143
- function toggleBlockStyleInSelection(editor, style) {
144
- const sn = Array.from(
145
- Editor.nodes(editor, {
146
- mode: 'highest',
147
- match: (n) => {
148
- return !Editor.isEditor(n);
149
- },
150
- }),
151
- );
152
-
153
- for (const [n, p] of sn) {
154
- let cn = n.styleName;
155
- if (typeof n.styleName !== 'string') {
156
- cn = style;
157
- } else if (n.styleName.split(' ').filter((x) => x === style).length > 0) {
158
- cn = cn
159
- .split(' ')
160
- .filter((x) => x !== style)
161
- .join(' ');
162
- } else {
163
- // the style is not set but other styles are set
164
- cn = cn.split(' ').concat(style).join(' ');
165
- }
166
- Transforms.setNodes(editor, { styleName: cn }, { at: p });
167
- }
168
- }