@plone/volto 16.28.0 → 16.29.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 (66) hide show
  1. package/.changelog.draft +2 -7
  2. package/.gitignore~ +71 -0
  3. package/.yarn/install-state.gz +0 -0
  4. package/.yarn/releases/yarn-3.3.1.cjs +823 -0
  5. package/CHANGELOG.md +13 -0
  6. package/Makefile~ +399 -0
  7. package/apps/plone/node_modules/.bin/addon +17 -0
  8. package/apps/plone/node_modules/.bin/autoprefixer +17 -0
  9. package/apps/plone/node_modules/.bin/build-storybook +17 -0
  10. package/apps/plone/node_modules/.bin/changelogupdater +17 -0
  11. package/apps/plone/node_modules/.bin/eslint +17 -0
  12. package/apps/plone/node_modules/.bin/eslint-config-prettier +17 -0
  13. package/apps/plone/node_modules/.bin/i18n +17 -0
  14. package/apps/plone/node_modules/.bin/lessc +17 -0
  15. package/apps/plone/node_modules/.bin/missdev +17 -0
  16. package/apps/plone/node_modules/.bin/prettier +17 -0
  17. package/apps/plone/node_modules/.bin/razzle +17 -0
  18. package/apps/plone/node_modules/.bin/server-test +17 -0
  19. package/apps/plone/node_modules/.bin/start-server-and-test +17 -0
  20. package/apps/plone/node_modules/.bin/start-storybook +17 -0
  21. package/apps/plone/node_modules/.bin/start-test +17 -0
  22. package/apps/plone/node_modules/.bin/storybook-server +17 -0
  23. package/apps/plone/node_modules/.bin/stylelint +17 -0
  24. package/apps/plone/node_modules/.bin/tlds +17 -0
  25. package/apps/plone/node_modules/.bin/ts-jest +17 -0
  26. package/apps/plone/node_modules/.bin/tsc +17 -0
  27. package/apps/plone/node_modules/.bin/tsserver +17 -0
  28. package/apps/plone/node_modules/.bin/uuid +17 -0
  29. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/addon +17 -0
  30. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/changelogupdater +17 -0
  31. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/eslint +17 -0
  32. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/eslint-config-prettier +17 -0
  33. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/i18n +17 -0
  34. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/prettier +17 -0
  35. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/release-it +17 -0
  36. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/stylelint +17 -0
  37. package/locales/volto.pot~ +4705 -0
  38. package/news/4547.breaking~ +1 -0
  39. package/news/5135.documentation~ +1 -0
  40. package/package.json +1 -1
  41. package/packages/volto-slate/news/5347.bugfix +1 -0
  42. package/packages/volto-slate/node_modules/.bin/release-it +17 -0
  43. package/packages/volto-slate/package.json +1 -1
  44. package/packages/volto-slate/src/editor/extensions/insertData.js +3 -1
  45. package/packages/volto-slate/src/editor/extensions/normalizeExternalData.js +1 -1
  46. package/packages/volto-slate/src/utils/blocks.js +6 -2
  47. package/pyvenv.cfg +5 -0
  48. package/share/man/man1/ttx.1 +225 -0
  49. package/src/components/manage/Add/Add.jsx +3 -0
  50. package/src/components/manage/Blocks/Block/BlocksForm.jsx +4 -0
  51. package/src/components/manage/Blocks/Block/DefaultEdit.jsx +3 -1
  52. package/src/components/manage/Blocks/Block/Settings.jsx +10 -1
  53. package/src/components/manage/Blocks/HeroImageLeft/Data.jsx +3 -1
  54. package/src/components/manage/Blocks/Image/ImageSidebar.jsx +3 -1
  55. package/src/components/manage/Blocks/Listing/ListingData.jsx +10 -1
  56. package/src/components/manage/Blocks/Maps/MapsSidebar.jsx +3 -1
  57. package/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +4 -0
  58. package/src/components/manage/Blocks/Teaser/Data.jsx +10 -1
  59. package/src/components/manage/Blocks/ToC/Edit.jsx +2 -0
  60. package/src/components/manage/Blocks/Video/VideoSidebar.jsx +3 -1
  61. package/src/components/manage/Edit/Edit.jsx +1 -0
  62. package/src/components/manage/Form/Form.jsx +9 -1
  63. package/src/config/index.js~ +223 -0
  64. package/src/helpers/Blocks/Blocks.js +11 -2
  65. package/src/helpers/Extensions/withBlockSchemaEnhancer.js +20 -9
  66. package/src/start-server.js +4 -0
@@ -0,0 +1,223 @@
1
+ /**
2
+ * Config.
3
+ * @module config
4
+ */
5
+ import { parse as parseUrl } from 'url';
6
+ import { defaultWidget, widgetMapping } from './Widgets';
7
+ import {
8
+ layoutViews,
9
+ contentTypesViews,
10
+ defaultView,
11
+ errorViews,
12
+ layoutViewsNamesMapping,
13
+ } from './Views';
14
+ import { nonContentRoutes } from './NonContentRoutes';
15
+ import {
16
+ groupBlocksOrder,
17
+ requiredBlocks,
18
+ blocksConfig,
19
+ initialBlocks,
20
+ initialBlocksFocus,
21
+ } from './Blocks';
22
+ import { components } from './Components';
23
+ import { loadables } from './Loadables';
24
+ import { workflowMapping } from './Workflows';
25
+
26
+ import { contentIcons } from './ContentIcons';
27
+ import { styleClassNameConverters, styleClassNameExtenders } from './Style';
28
+ import {
29
+ controlPanelsIcons,
30
+ filterControlPanels,
31
+ filterControlPanelsSchema,
32
+ } from './ControlPanels';
33
+
34
+ import { richtextEditorSettings, richtextViewSettings } from './RichTextEditor';
35
+
36
+ import applyAddonConfiguration, { addonsInfo } from 'load-volto-addons';
37
+
38
+ import ConfigRegistry from '@plone/volto/registry';
39
+
40
+ const host = process.env.HOST || 'localhost';
41
+ const port = process.env.PORT || '3000';
42
+
43
+ const apiPath =
44
+ process.env.RAZZLE_API_PATH ||
45
+ (__DEVELOPMENT__ ? `http://${host}:${port}` : '');
46
+
47
+ const getServerURL = (url) => {
48
+ if (!url) return;
49
+ const apiPathURL = parseUrl(url);
50
+ return `${apiPathURL.protocol}//${apiPathURL.hostname}${
51
+ apiPathURL.port ? `:${apiPathURL.port}` : ''
52
+ }`;
53
+ };
54
+
55
+ // Sensible defaults for publicURL
56
+ // if RAZZLE_PUBLIC_URL is present, use it
57
+ // if in DEV, use the host/port combination by default
58
+ // if in PROD, assume it's RAZZLE_API_PATH server name (no /api or alikes) or fallback
59
+ // to DEV settings if RAZZLE_API_PATH is not present
60
+ const publicURL =
61
+ process.env.RAZZLE_PUBLIC_URL ||
62
+ (__DEVELOPMENT__
63
+ ? `http://${host}:${port}`
64
+ : getServerURL(process.env.RAZZLE_API_PATH) || `http://${host}:${port}`);
65
+
66
+ const serverConfig =
67
+ typeof __SERVER__ !== 'undefined' && __SERVER__
68
+ ? require('./server').default
69
+ : {};
70
+
71
+ let config = {
72
+ settings: {
73
+ host,
74
+ port,
75
+ // The URL Volto is going to be served (see sensible defaults above)
76
+ publicURL,
77
+ apiPath,
78
+ apiExpanders: [
79
+ // Add the following expanders for only issuing a single request.
80
+ // https://6.docs.plone.org/volto/configuration/settings-reference.html#term-apiExpanders
81
+ // {
82
+ // match: '',
83
+ // GET_CONTENT: ['breadcrumbs', 'navigation', 'actions', 'types'],
84
+ // },
85
+ ],
86
+ // Internal proxy to bypass CORS *while developing*. NOT intended for production use.
87
+ // In production is recommended you use a Seamless mode deployment using a web server in
88
+ // front of both the frontend and the backend so you can bypass CORS safely.
89
+ // https://6.docs.plone.org/volto/deploying/seamless-mode.html
90
+ devProxyToApiPath:
91
+ process.env.RAZZLE_DEV_PROXY_API_PATH ||
92
+ process.env.RAZZLE_INTERNAL_API_PATH ||
93
+ process.env.RAZZLE_API_PATH ||
94
+ 'http://localhost:8080/Plone', // Set it to '' for disabling the proxy
95
+ // proxyRewriteTarget Set it for set a custom target for the proxy or overide the internal VHM rewrite
96
+ // proxyRewriteTarget: '/VirtualHostBase/http/localhost:8080/Plone/VirtualHostRoot/_vh_api'
97
+ // proxyRewriteTarget: 'https://myvoltositeinproduction.com'
98
+ proxyRewriteTarget: process.env.RAZZLE_PROXY_REWRITE_TARGET || undefined,
99
+ // apiPath: process.env.RAZZLE_API_PATH || 'http://localhost:8000', // for Volto reference
100
+ // apiPath: process.env.RAZZLE_API_PATH || 'http://localhost:8081/db/web', // for guillotina
101
+ actions_raising_api_errors: ['GET_CONTENT', 'UPDATE_CONTENT'],
102
+ internalApiPath: process.env.RAZZLE_INTERNAL_API_PATH || undefined,
103
+ websockets: process.env.RAZZLE_WEBSOCKETS || false,
104
+ // TODO: legacyTraverse to be removed when the use of the legacy traverse is deprecated.
105
+ legacyTraverse: process.env.RAZZLE_LEGACY_TRAVERSE || false,
106
+ cookieExpires: 15552000, //in seconds. Default is 6 month (15552000)
107
+ nonContentRoutes,
108
+ richtextEditorSettings, // Part of draftjs support, to be removed
109
+ richtextViewSettings, // Part of draftjs support, to be removed
110
+ imageObjects: ['Image'],
111
+ reservedIds: ['login', 'layout', 'plone', 'zip', 'properties'],
112
+ downloadableObjects: ['File'], //list of content-types for which the direct download of the file will be carried out if the user is not authenticated
113
+ viewableInBrowserObjects: [], //ex: ['File']. List of content-types for which the file will be displayed in browser if the user is not authenticated
114
+ listingPreviewImageField: 'image', // deprecated from Volto 14 onwards
115
+ openExternalLinkInNewTab: false,
116
+ notSupportedBrowsers: ['ie'],
117
+ defaultPageSize: 25,
118
+ isMultilingual: false,
119
+ supportedLanguages: ['en'],
120
+ defaultLanguage: 'en',
121
+ navDepth: 1,
122
+ expressMiddleware: serverConfig.expressMiddleware, // BBB
123
+ defaultBlockType: 'slate',
124
+ verticalFormTabs: false,
125
+ useEmailAsLogin: false,
126
+ persistentReducers: ['blocksClipboard'],
127
+ initialReducersBlacklist: [], // reducers in this list won't be hydrated in windows.__data
128
+ asyncPropsExtenders: [], // per route asyncConnect customizers
129
+ contentIcons: contentIcons,
130
+ loadables,
131
+ lazyBundles: {
132
+ cms: [
133
+ 'prettierStandalone',
134
+ 'prettierParserHtml',
135
+ 'prismCore',
136
+ 'toastify',
137
+ 'reactSelect',
138
+ 'reactBeautifulDnd',
139
+ // 'diffLib',
140
+ ],
141
+ draftEditor: [
142
+ 'immutableLib',
143
+ 'draftJs',
144
+ 'draftJsLibIsSoftNewlineEvent',
145
+ 'draftJsFilters',
146
+ 'draftJsInlineToolbarPlugin',
147
+ 'draftJsImportHtml',
148
+ 'draftJsBlockBreakoutPlugin',
149
+ ],
150
+ },
151
+ appExtras: [],
152
+ maxResponseSize: 2000000000, // This is superagent default (200 mb)
153
+ serverConfig,
154
+ storeExtenders: [],
155
+ showTags: true,
156
+ controlpanels: [],
157
+ controlPanelsIcons,
158
+ filterControlPanels,
159
+ filterControlPanelsSchema,
160
+ externalRoutes: [
161
+ // URL to be considered as external
162
+ // {
163
+ // match: {
164
+ // path: '/news',
165
+ // exact: false,
166
+ // strict: false,
167
+ // },
168
+ // url(payload) {
169
+ // return payload.location.pathname;
170
+ // },
171
+ // },
172
+ ],
173
+ showSelfRegistration: false,
174
+ contentMetadataTagsImageField: 'image',
175
+ hasWorkingCopySupport: false,
176
+ maxUndoLevels: 200, // undo history size for the main form
177
+ addonsInfo: addonsInfo,
178
+ workflowMapping,
179
+ errorHandlers: [], // callables for unhandled errors
180
+ styleClassNameConverters,
181
+ hashLinkSmoothScroll: false,
182
+ styleClassNameExtenders,
183
+ querystringSearchGet: false,
184
+ },
185
+ experimental: {
186
+ addBlockButton: {
187
+ enabled: false,
188
+ },
189
+ },
190
+ widgets: {
191
+ ...widgetMapping,
192
+ default: defaultWidget,
193
+ },
194
+ views: {
195
+ layoutViews,
196
+ contentTypesViews,
197
+ defaultView,
198
+ errorViews,
199
+ layoutViewsNamesMapping,
200
+ },
201
+ blocks: {
202
+ requiredBlocks,
203
+ blocksConfig,
204
+ groupBlocksOrder,
205
+ initialBlocks,
206
+ initialBlocksFocus,
207
+ showEditBlocksInBabelView: false,
208
+ },
209
+ addonRoutes: [],
210
+ addonReducers: {},
211
+ components,
212
+ };
213
+
214
+ ConfigRegistry.settings = config.settings;
215
+ ConfigRegistry.experimental = config.experimental;
216
+ ConfigRegistry.blocks = config.blocks;
217
+ ConfigRegistry.views = config.views;
218
+ ConfigRegistry.widgets = config.widgets;
219
+ ConfigRegistry.addonRoutes = config.addonRoutes;
220
+ ConfigRegistry.addonReducers = config.addonReducers;
221
+ ConfigRegistry.components = config.components;
222
+
223
+ applyAddonConfiguration(ConfigRegistry);
@@ -425,7 +425,10 @@ export function applySchemaDefaults({ data = {}, schema, intl }) {
425
425
  * @param {Object} params An object with data, intl and anything else
426
426
  * @return {Object} Derived data, with the defaults extracted from the schema
427
427
  */
428
- export function applyBlockDefaults({ data, intl, ...rest }, blocksConfig) {
428
+ export function applyBlockDefaults(
429
+ { data, intl, navRoot, contentType, ...rest },
430
+ blocksConfig,
431
+ ) {
429
432
  // We pay attention to not break on a missing (invalid) block.
430
433
  const block_type = data?.['@type'];
431
434
  const { blockSchema } =
@@ -436,7 +439,13 @@ export function applyBlockDefaults({ data, intl, ...rest }, blocksConfig) {
436
439
  typeof blockSchema === 'function'
437
440
  ? blockSchema({ data, intl, ...rest })
438
441
  : blockSchema;
439
- schema = applySchemaEnhancer({ schema, formData: data, intl });
442
+ schema = applySchemaEnhancer({
443
+ schema,
444
+ formData: data,
445
+ intl,
446
+ navRoot,
447
+ contentType,
448
+ });
440
449
 
441
450
  return applySchemaDefaults({ data, schema, intl });
442
451
  }
@@ -201,6 +201,8 @@ export const applySchemaEnhancer = ({
201
201
  formData,
202
202
  intl,
203
203
  blocksConfig = config.blocks.blocksConfig,
204
+ navRoot,
205
+ contentType,
204
206
  }) => {
205
207
  let schema, schemaEnhancer;
206
208
 
@@ -217,6 +219,8 @@ export const applySchemaEnhancer = ({
217
219
  schema: cloneDeepSchema(originalSchema),
218
220
  formData,
219
221
  intl,
222
+ navRoot,
223
+ contentType,
220
224
  });
221
225
  return schema || originalSchema;
222
226
  }
@@ -232,12 +236,15 @@ export const applySchemaEnhancer = ({
232
236
  schema: cloneDeepSchema(originalSchema),
233
237
  formData,
234
238
  intl,
239
+ navRoot,
240
+ contentType,
235
241
  })
236
242
  : cloneDeepSchema(originalSchema);
237
243
 
238
244
  // Finalize the schema with a schemaEnhancer in the block config;
239
245
  schemaEnhancer = blocksConfig?.[blockType]?.schemaEnhancer;
240
- if (schemaEnhancer) schema = schemaEnhancer({ schema, formData, intl });
246
+ if (schemaEnhancer)
247
+ schema = schemaEnhancer({ schema, formData, intl, navRoot, contentType });
241
248
 
242
249
  return schema || originalSchema;
243
250
  };
@@ -250,7 +257,7 @@ export const applySchemaEnhancer = ({
250
257
  * - adds the variation selection input (as a choice widget)
251
258
  */
252
259
  export const withVariationSchemaEnhancer = (FormComponent) => (props) => {
253
- const { formData, schema: originalSchema } = props;
260
+ const { formData, schema: originalSchema, navRoot, contentType } = props;
254
261
  const intl = useIntl();
255
262
 
256
263
  const blocksConfig = getBlocksConfig(props);
@@ -258,15 +265,10 @@ export const withVariationSchemaEnhancer = (FormComponent) => (props) => {
258
265
  const blockType = formData['@type'];
259
266
  const variations = blocksConfig[blockType]?.variations || [];
260
267
 
261
- let schema = applySchemaEnhancer({
262
- schema: originalSchema,
263
- formData,
264
- intl,
265
- blocksConfig,
266
- });
268
+ let schema = cloneDeepSchema(originalSchema);
267
269
 
268
270
  if (variations.length > 1) {
269
- addExtensionFieldToSchema({
271
+ schema = addExtensionFieldToSchema({
270
272
  schema,
271
273
  name: 'variation',
272
274
  items: variations,
@@ -276,6 +278,15 @@ export const withVariationSchemaEnhancer = (FormComponent) => (props) => {
276
278
  });
277
279
  }
278
280
 
281
+ schema = applySchemaEnhancer({
282
+ schema,
283
+ formData,
284
+ intl,
285
+ blocksConfig,
286
+ navRoot,
287
+ contentType,
288
+ });
289
+
279
290
  return <FormComponent {...props} schema={schema} />;
280
291
  };
281
292
 
@@ -1,10 +1,14 @@
1
1
  /* eslint no-console: 0 */
2
+ import dns from 'dns';
2
3
  import http from 'http';
3
4
 
4
5
  import app from './server';
5
6
  import debug from 'debug';
6
7
 
7
8
  export default function server() {
9
+ // If DNS returns both ipv4 and ipv6 addresses, prefer ipv4
10
+ dns.setDefaultResultOrder('ipv4first');
11
+
8
12
  const server = http.createServer(app);
9
13
  // const host = process.env.HOST || 'localhost';
10
14
  const port = process.env.PORT || 3000;