@plone/volto 19.0.0-alpha.26 → 19.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.
- package/.eslintignore +1 -0
- package/.eslintrc +0 -3
- package/CHANGELOG.md +69 -0
- package/README.md +0 -1
- package/babel.js +0 -6
- package/locales/af/LC_MESSAGES/volto.po +5455 -0
- package/locales/af.json +1 -1
- package/locales/ar/LC_MESSAGES/volto.po +5455 -0
- package/locales/ar.json +1 -1
- package/locales/bg/LC_MESSAGES/volto.po +5455 -0
- package/locales/bg.json +1 -1
- package/locales/bn/LC_MESSAGES/volto.po +5455 -0
- package/locales/bn.json +1 -1
- package/locales/ca/LC_MESSAGES/volto.po +406 -345
- package/locales/ca.json +1 -1
- package/locales/cs/LC_MESSAGES/volto.po +5455 -0
- package/locales/cs.json +1 -1
- package/locales/cy/LC_MESSAGES/volto.po +5455 -0
- package/locales/cy.json +1 -1
- package/locales/da/LC_MESSAGES/volto.po +5455 -0
- package/locales/da.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +70 -8
- package/locales/de.json +1 -1
- package/locales/el/LC_MESSAGES/volto.po +5455 -0
- package/locales/el.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +66 -0
- package/locales/en.json +1 -1
- package/locales/en_AU/LC_MESSAGES/volto.po +5455 -0
- package/locales/en_AU.json +1 -1
- package/locales/en_GB/LC_MESSAGES/volto.po +5455 -0
- package/locales/en_GB.json +1 -1
- package/locales/eo/LC_MESSAGES/volto.po +5455 -0
- package/locales/eo.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +173 -112
- package/locales/es.json +1 -1
- package/locales/et/LC_MESSAGES/volto.po +5455 -0
- package/locales/et.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +256 -195
- package/locales/eu.json +1 -1
- package/locales/fa/LC_MESSAGES/volto.po +5455 -0
- package/locales/fa.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +62 -1
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +61 -0
- package/locales/fr.json +1 -1
- package/locales/fu/LC_MESSAGES/volto.po +5455 -0
- package/locales/fu.json +1 -1
- package/locales/gl/LC_MESSAGES/volto.po +5456 -0
- package/locales/gl.json +1 -1
- package/locales/he/LC_MESSAGES/volto.po +5455 -0
- package/locales/he.json +1 -1
- package/locales/hi/LC_MESSAGES/volto.po +66 -0
- package/locales/hi.json +1 -1
- package/locales/hr/LC_MESSAGES/volto.po +5455 -0
- package/locales/hr.json +1 -1
- package/locales/hu/LC_MESSAGES/volto.po +5455 -0
- package/locales/hu.json +1 -1
- package/locales/hy/LC_MESSAGES/volto.po +5455 -0
- package/locales/hy.json +1 -1
- package/locales/id/LC_MESSAGES/volto.po +5455 -0
- package/locales/id.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +90 -24
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +105 -43
- package/locales/ja.json +1 -1
- package/locales/ka/LC_MESSAGES/volto.po +5455 -0
- package/locales/ka.json +1 -1
- package/locales/kn/LC_MESSAGES/volto.po +5455 -0
- package/locales/kn.json +1 -1
- package/locales/ko/LC_MESSAGES/volto.po +5455 -0
- package/locales/ko.json +1 -1
- package/locales/lt/LC_MESSAGES/volto.po +5455 -0
- package/locales/lt.json +1 -1
- package/locales/lv/LC_MESSAGES/volto.po +5455 -0
- package/locales/lv.json +1 -1
- package/locales/mi/LC_MESSAGES/volto.po +5455 -0
- package/locales/mi.json +1 -1
- package/locales/mk/LC_MESSAGES/volto.po +5455 -0
- package/locales/mk.json +1 -1
- package/locales/my/LC_MESSAGES/volto.po +5455 -0
- package/locales/my.json +1 -1
- package/locales/nb_NO/LC_MESSAGES/volto.po +5455 -0
- package/locales/nb_NO.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +93 -31
- package/locales/nl.json +1 -1
- package/locales/nn/LC_MESSAGES/volto.po +5455 -0
- package/locales/nn.json +1 -1
- package/locales/pl/LC_MESSAGES/volto.po +5455 -0
- package/locales/pl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +723 -662
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +61 -0
- package/locales/pt_BR.json +1 -1
- package/locales/rm/LC_MESSAGES/volto.po +5455 -0
- package/locales/rm.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +61 -0
- package/locales/ro.json +1 -1
- package/locales/ru/LC_MESSAGES/volto.po +61 -0
- package/locales/ru.json +1 -1
- package/locales/sk/LC_MESSAGES/volto.po +5455 -0
- package/locales/sk.json +1 -1
- package/locales/sl/LC_MESSAGES/volto.po +5455 -0
- package/locales/sl.json +1 -1
- package/locales/sm/LC_MESSAGES/volto.po +5455 -0
- package/locales/sm.json +1 -1
- package/locales/sq/LC_MESSAGES/volto.po +5455 -0
- package/locales/sq.json +1 -1
- package/locales/sr/LC_MESSAGES/volto.po +5455 -0
- package/locales/sr.json +1 -1
- package/locales/sr@cyrl/LC_MESSAGES/volto.po +5455 -0
- package/locales/sr@cyrl.json +1 -1
- package/locales/sr@latn/LC_MESSAGES/volto.po +5455 -0
- package/locales/sr@latn.json +1 -1
- package/locales/sv/LC_MESSAGES/volto.po +5455 -0
- package/locales/sv.json +1 -1
- package/locales/ta/LC_MESSAGES/volto.po +5456 -0
- package/locales/ta.json +1 -1
- package/locales/te/LC_MESSAGES/volto.po +5455 -0
- package/locales/te.json +1 -1
- package/locales/th/LC_MESSAGES/volto.po +5455 -0
- package/locales/th.json +1 -1
- package/locales/to/LC_MESSAGES/volto.po +5455 -0
- package/locales/to.json +1 -1
- package/locales/tr/LC_MESSAGES/volto.po +5456 -0
- package/locales/tr.json +1 -1
- package/locales/uk/LC_MESSAGES/volto.po +5455 -0
- package/locales/uk.json +1 -1
- package/locales/vi/LC_MESSAGES/volto.po +5455 -0
- package/locales/vi.json +1 -1
- package/locales/volto.pot +62 -1
- package/locales/zh_CN/LC_MESSAGES/volto.po +62 -0
- package/locales/zh_CN.json +1 -1
- package/locales/zh_Hant/LC_MESSAGES/volto.po +5455 -0
- package/locales/zh_Hant.json +1 -1
- package/locales/zh_Hant_HK/LC_MESSAGES/volto.po +5455 -0
- package/locales/zh_Hant_HK.json +1 -1
- package/package.json +19 -35
- package/razzle.config.js +12 -5
- package/src/actions/blockTypes/blockTypes.ts +24 -0
- package/src/components/manage/Add/Add.jsx +7 -6
- package/src/components/manage/Blocks/Block/Order/Item.jsx +9 -3
- package/src/components/manage/Blocks/Block/Order/Order.jsx +116 -67
- package/src/components/manage/Blocks/Block/Order/utilities.js +28 -11
- package/src/components/manage/Blocks/Listing/Edit.jsx +1 -0
- package/src/components/manage/Blocks/Title/Edit.jsx +5 -0
- package/src/components/manage/Controlpanels/AddonsControlpanel.jsx +7 -0
- package/src/components/manage/Controlpanels/BlockType.tsx +166 -0
- package/src/components/manage/Controlpanels/BlockTypes.tsx +145 -0
- package/src/components/manage/Controlpanels/Controlpanels.jsx +28 -5
- package/src/components/manage/Controlpanels/Controlpanels.test.jsx +10 -0
- package/src/components/manage/Controlpanels/DatabaseInformation.jsx +9 -0
- package/src/components/manage/Controlpanels/ModerateComments.jsx +8 -0
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +4 -5
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +57 -11
- package/src/components/manage/Diff/Diff.jsx +201 -298
- package/src/components/manage/Multilingual/CreateTranslation.jsx +8 -5
- package/src/components/manage/Multilingual/ManageTranslations.jsx +1 -1
- package/src/components/manage/Multilingual/TranslationObject.jsx +9 -6
- package/src/components/manage/Preferences/PersonalPreferences.jsx +8 -5
- package/src/components/manage/Sidebar/ObjectBrowserBody.jsx +5 -1
- package/src/components/manage/Toolbar/Types.crash.test.jsx +48 -0
- package/src/components/manage/Widgets/FileWidget.jsx +7 -0
- package/src/components/manage/Widgets/RegistryImageWidget.jsx +1 -1
- package/src/components/theme/PasswordReset/PasswordReset.jsx +108 -191
- package/src/config/ControlPanels.js +2 -0
- package/src/config/index.js +1 -1
- package/src/config/validation.ts +8 -0
- package/src/constants/ActionTypes.js +1 -0
- package/src/express-middleware/devproxy.js +3 -1
- package/src/helpers/Blocks/Blocks.js +81 -18
- package/src/helpers/FormValidation/FormValidation.test.js +31 -0
- package/src/helpers/FormValidation/validators.ts +21 -0
- package/src/helpers/MessageLabels/MessageLabels.js +5 -0
- package/src/helpers/Utils/Utils.jsx +17 -0
- package/src/helpers/Utils/Utils.test.jsx +39 -0
- package/src/middleware/api.js +7 -3
- package/src/reducers/blockTypes/blockTypes.js +38 -0
- package/src/reducers/index.js +2 -0
- package/src/reducers/users/users.js +1 -1
- package/src/routes.js +10 -0
- package/src/server.jsx +7 -5
- package/test-setup-globals.js +26 -0
- package/theme/themes/pastanaga/extras/block-types.less +17 -0
- package/theme/themes/pastanaga/extras/main.less +1 -2
- package/types/actions/blockTypes/blockTypes.d.ts +7 -0
- package/types/components/index.d.ts +1 -1
- package/types/components/manage/Blocks/Block/Order/utilities.d.ts +2 -1
- package/types/components/manage/Controlpanels/BlockType.d.ts +7 -0
- package/types/components/manage/Controlpanels/BlockTypes.d.ts +7 -0
- package/types/components/manage/Diff/Diff.d.ts +7 -2
- package/types/components/manage/Toolbar/Types.crash.test.d.ts +1 -0
- package/types/components/theme/PasswordReset/PasswordReset.d.ts +6 -2
- package/types/config/ControlPanels.d.ts +1 -0
- package/types/constants/ActionTypes.d.ts +1 -0
- package/types/helpers/Blocks/Blocks.d.ts +3 -0
- package/types/helpers/FormValidation/validators.d.ts +7 -0
- package/types/helpers/MessageLabels/MessageLabels.d.ts +100 -94
- package/types/helpers/Utils/Utils.d.ts +1 -0
- package/types/reducers/blockTypes/blockTypes.d.ts +16 -0
- package/types/reducers/index.d.ts +2 -0
- package/types/routes.d.ts +7 -5
- package/vitest.config.mjs +84 -42
- package/webpack-plugins/webpack-less-plugin.js +1 -1
|
@@ -8,6 +8,12 @@ const schema = {
|
|
|
8
8
|
username: { title: 'Username', type: 'string', description: '' },
|
|
9
9
|
email: { title: 'Email', type: 'string', widget: 'email', description: '' },
|
|
10
10
|
url: { title: 'url', type: 'string', widget: 'url', description: '' },
|
|
11
|
+
file: {
|
|
12
|
+
title: 'file',
|
|
13
|
+
type: 'object',
|
|
14
|
+
description: '',
|
|
15
|
+
size: 5,
|
|
16
|
+
},
|
|
11
17
|
},
|
|
12
18
|
fieldsets: [
|
|
13
19
|
{ id: 'default', title: 'FIXME: User Data', fields: ['username'] },
|
|
@@ -181,6 +187,31 @@ describe('FormValidation', () => {
|
|
|
181
187
|
).toEqual({});
|
|
182
188
|
});
|
|
183
189
|
|
|
190
|
+
it('file - validates invalid size', () => {
|
|
191
|
+
const validationErrorMessages = [messages.maxSize.defaultMessage];
|
|
192
|
+
validationErrorMessages.title = 'file';
|
|
193
|
+
|
|
194
|
+
expect(
|
|
195
|
+
FormValidation.validateFieldsPerFieldset({
|
|
196
|
+
schema,
|
|
197
|
+
formData: { ...formData, file: { size: 10 } },
|
|
198
|
+
formatMessage,
|
|
199
|
+
}),
|
|
200
|
+
).toEqual({
|
|
201
|
+
file: validationErrorMessages,
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it('file - validates size', () => {
|
|
206
|
+
expect(
|
|
207
|
+
FormValidation.validateFieldsPerFieldset({
|
|
208
|
+
schema,
|
|
209
|
+
formData: { ...formData, file: { size: 1 } },
|
|
210
|
+
formatMessage,
|
|
211
|
+
}),
|
|
212
|
+
).toEqual({});
|
|
213
|
+
});
|
|
214
|
+
|
|
184
215
|
it('widget - validator from block - Fails', () => {
|
|
185
216
|
let newSchema = {
|
|
186
217
|
properties: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { validationMessage } from '@plone/volto/helpers/FormValidation/FormValidation';
|
|
2
2
|
import { messages } from '@plone/volto/helpers/MessageLabels/MessageLabels';
|
|
3
|
+
import config from '@plone/volto/registry';
|
|
3
4
|
|
|
4
5
|
type MinMaxValidator = {
|
|
5
6
|
value: string | number;
|
|
@@ -26,6 +27,13 @@ type ChoiceValidator = {
|
|
|
26
27
|
formatMessage: Function;
|
|
27
28
|
};
|
|
28
29
|
|
|
30
|
+
type FileValidator = {
|
|
31
|
+
value: Record<string, any>;
|
|
32
|
+
field: Record<string, any>;
|
|
33
|
+
formData: any;
|
|
34
|
+
formatMessage: Function;
|
|
35
|
+
};
|
|
36
|
+
|
|
29
37
|
export const isMaxPropertyValid = ({
|
|
30
38
|
value,
|
|
31
39
|
fieldSpec,
|
|
@@ -232,3 +240,16 @@ export const defaultLanguageControlPanelValidator = ({
|
|
|
232
240
|
formData.available_languages.includes(token));
|
|
233
241
|
return !isValid ? formatMessage(messages.defaultLanguage) : null;
|
|
234
242
|
};
|
|
243
|
+
|
|
244
|
+
export const sizeValidator = ({
|
|
245
|
+
value,
|
|
246
|
+
field,
|
|
247
|
+
formatMessage,
|
|
248
|
+
}: FileValidator) => {
|
|
249
|
+
const maxSize = field.size
|
|
250
|
+
? parseInt(field.size, 10)
|
|
251
|
+
: config.settings.maxFileUploadSize;
|
|
252
|
+
return maxSize && value.size > maxSize
|
|
253
|
+
? formatMessage(messages.maxSize, { maxSize, size: value.size })
|
|
254
|
+
: null;
|
|
255
|
+
};
|
|
@@ -25,6 +25,11 @@ export const messages = defineMessages({
|
|
|
25
25
|
id: 'Maximum value is {len}.',
|
|
26
26
|
defaultMessage: 'Maximum value is {len}.',
|
|
27
27
|
},
|
|
28
|
+
maxSize: {
|
|
29
|
+
id: 'Maximum file size is {maxSize} bytes, but the uploaded file is {size} bytes.',
|
|
30
|
+
defaultMessage:
|
|
31
|
+
'Maximum file size is {maxSize} bytes, but the uploaded file is {size} bytes.',
|
|
32
|
+
},
|
|
28
33
|
uniqueItems: {
|
|
29
34
|
id: 'Items must be unique.',
|
|
30
35
|
defaultMessage: 'Items must be unique.',
|
|
@@ -37,6 +37,23 @@ export const safeWrapper = (func) => (config) => {
|
|
|
37
37
|
return res;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Extract a readable error message from several possible error shapes
|
|
42
|
+
* @param {object} error
|
|
43
|
+
* @returns {string} message
|
|
44
|
+
*/
|
|
45
|
+
export const getErrorMessage = (error) => {
|
|
46
|
+
const respBody = error?.response?.body;
|
|
47
|
+
if (respBody?.error?.message) return respBody.error.message;
|
|
48
|
+
if (respBody?.message) return respBody.message;
|
|
49
|
+
if (error?.message) return error.message;
|
|
50
|
+
try {
|
|
51
|
+
return JSON.stringify(error);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
return String(error);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
40
57
|
/**
|
|
41
58
|
* A helper to pipe a configuration object through configuration loaders
|
|
42
59
|
*
|
|
@@ -3,6 +3,7 @@ import config from '@plone/volto/registry';
|
|
|
3
3
|
import {
|
|
4
4
|
applyConfig,
|
|
5
5
|
difference,
|
|
6
|
+
getErrorMessage,
|
|
6
7
|
getColor,
|
|
7
8
|
getInitials,
|
|
8
9
|
hasApiExpander,
|
|
@@ -246,6 +247,44 @@ describe('Utils tests', () => {
|
|
|
246
247
|
});
|
|
247
248
|
});
|
|
248
249
|
|
|
250
|
+
describe('getErrorMessage', () => {
|
|
251
|
+
it('returns nested backend error message', () => {
|
|
252
|
+
const error = {
|
|
253
|
+
response: {
|
|
254
|
+
body: {
|
|
255
|
+
error: {
|
|
256
|
+
message: 'Backend nested message',
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
expect(getErrorMessage(error)).toEqual('Backend nested message');
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it('returns body message when present', () => {
|
|
266
|
+
const error = {
|
|
267
|
+
response: {
|
|
268
|
+
body: {
|
|
269
|
+
message: 'Backend body message',
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
expect(getErrorMessage(error)).toEqual('Backend body message');
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it('returns generic error.message fallback', () => {
|
|
278
|
+
expect(getErrorMessage(new Error('Generic message'))).toEqual(
|
|
279
|
+
'Generic message',
|
|
280
|
+
);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
it('returns stringified object as final fallback', () => {
|
|
284
|
+
expect(getErrorMessage({ foo: 'bar' })).toEqual('{"foo":"bar"}');
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
|
|
249
288
|
describe('safeWrapper', () => {
|
|
250
289
|
it('calls the function with config', () => {
|
|
251
290
|
expect(
|
package/src/middleware/api.js
CHANGED
|
@@ -287,9 +287,13 @@ const apiMiddlewareFactory =
|
|
|
287
287
|
const langFileName = toGettextLang(lang);
|
|
288
288
|
import(
|
|
289
289
|
/* @vite-ignore */ '@root/../locales/' + langFileName + '.json'
|
|
290
|
-
)
|
|
291
|
-
|
|
292
|
-
|
|
290
|
+
)
|
|
291
|
+
.then((locale) => {
|
|
292
|
+
dispatch(changeLanguage(lang, locale.default));
|
|
293
|
+
})
|
|
294
|
+
.catch(() => {
|
|
295
|
+
dispatch(changeLanguage(lang, {}));
|
|
296
|
+
});
|
|
293
297
|
}
|
|
294
298
|
}
|
|
295
299
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { GET_BLOCKTYPES_INDEX } from '@plone/volto/constants/ActionTypes';
|
|
2
|
+
|
|
3
|
+
const initialState = {
|
|
4
|
+
error: null,
|
|
5
|
+
items: {},
|
|
6
|
+
loaded: false,
|
|
7
|
+
loading: false,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default function blockTypes(state = initialState, action = {}) {
|
|
11
|
+
switch (action.type) {
|
|
12
|
+
case `${GET_BLOCKTYPES_INDEX}_PENDING`:
|
|
13
|
+
return {
|
|
14
|
+
...state,
|
|
15
|
+
error: null,
|
|
16
|
+
loaded: false,
|
|
17
|
+
loading: true,
|
|
18
|
+
};
|
|
19
|
+
case `${GET_BLOCKTYPES_INDEX}_SUCCESS`:
|
|
20
|
+
return {
|
|
21
|
+
...state,
|
|
22
|
+
error: null,
|
|
23
|
+
items: action.result,
|
|
24
|
+
loaded: true,
|
|
25
|
+
loading: false,
|
|
26
|
+
};
|
|
27
|
+
case `${GET_BLOCKTYPES_INDEX}_FAIL`:
|
|
28
|
+
return {
|
|
29
|
+
...state,
|
|
30
|
+
error: action.error,
|
|
31
|
+
items: {},
|
|
32
|
+
loaded: false,
|
|
33
|
+
loading: false,
|
|
34
|
+
};
|
|
35
|
+
default:
|
|
36
|
+
return state;
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/reducers/index.js
CHANGED
|
@@ -53,6 +53,7 @@ import upgrade from './upgrade/upgrade';
|
|
|
53
53
|
import userschema from './userschema/userschema';
|
|
54
54
|
import site from './site/site';
|
|
55
55
|
import navroot from './navroot/navroot';
|
|
56
|
+
import blockTypes from './blockTypes/blockTypes';
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
59
|
* Root reducer.
|
|
@@ -111,6 +112,7 @@ const reducers = {
|
|
|
111
112
|
userschema,
|
|
112
113
|
site,
|
|
113
114
|
navroot,
|
|
115
|
+
blockTypes,
|
|
114
116
|
};
|
|
115
117
|
|
|
116
118
|
export default reducers;
|
|
@@ -117,7 +117,7 @@ export default function users(state = initialState, action = {}) {
|
|
|
117
117
|
case `${LIST_USERS}_SUCCESS`:
|
|
118
118
|
return {
|
|
119
119
|
...state,
|
|
120
|
-
users: action.result,
|
|
120
|
+
users: action.result.items ? action.result.items : action.result,
|
|
121
121
|
[getRequestKey(action.type)]: {
|
|
122
122
|
loading: false,
|
|
123
123
|
loaded: true,
|
package/src/routes.js
CHANGED
|
@@ -51,6 +51,8 @@ import {
|
|
|
51
51
|
UndoControlpanel,
|
|
52
52
|
UpgradeControlPanel,
|
|
53
53
|
} from '@plone/volto/components/manage/Controlpanels';
|
|
54
|
+
import BlockTypesControlpanel from './components/manage/Controlpanels/BlockTypes';
|
|
55
|
+
import BlockTypeControlpanel from './components/manage/Controlpanels/BlockType';
|
|
54
56
|
|
|
55
57
|
import withClientSideContent from '@plone/volto/helpers/Content/withClientSideContent';
|
|
56
58
|
|
|
@@ -232,6 +234,14 @@ export const defaultRoutes = [
|
|
|
232
234
|
path: '/controlpanel/relations',
|
|
233
235
|
component: RelationsControlpanel,
|
|
234
236
|
},
|
|
237
|
+
{
|
|
238
|
+
path: '/controlpanel/block-types/:id',
|
|
239
|
+
component: BlockTypeControlpanel,
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
path: '/controlpanel/block-types',
|
|
243
|
+
component: BlockTypesControlpanel,
|
|
244
|
+
},
|
|
235
245
|
{
|
|
236
246
|
path: '/controlpanel/:id',
|
|
237
247
|
component: Controlpanel,
|
package/src/server.jsx
CHANGED
|
@@ -51,11 +51,13 @@ let locales = {};
|
|
|
51
51
|
if (config.settings) {
|
|
52
52
|
config.settings.supportedLanguages.forEach((lang) => {
|
|
53
53
|
const langFileName = toGettextLang(lang);
|
|
54
|
-
import(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
import(/* @vite-ignore */ '@root/../locales/' + langFileName + '.json')
|
|
55
|
+
.then((locale) => {
|
|
56
|
+
locales = { ...locales, [toReactIntlLang(lang)]: locale.default };
|
|
57
|
+
})
|
|
58
|
+
.catch((error) => {
|
|
59
|
+
// Error loading locale file
|
|
60
|
+
});
|
|
59
61
|
});
|
|
60
62
|
}
|
|
61
63
|
|
package/test-setup-globals.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { vi } from 'vitest';
|
|
1
2
|
import '@testing-library/jest-dom';
|
|
2
3
|
|
|
3
4
|
global.__CLIENT__ = true;
|
|
@@ -38,3 +39,28 @@ vi.stubGlobal('sessionStorage', {
|
|
|
38
39
|
removeItem: vi.fn(),
|
|
39
40
|
clear: vi.fn(),
|
|
40
41
|
});
|
|
42
|
+
|
|
43
|
+
global.jest = {
|
|
44
|
+
fn: vi.fn.bind(vi),
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Mock IntersectionObserver for Vitest
|
|
48
|
+
const IntersectionObserverMock = vi.fn((callback, options = {}) => {
|
|
49
|
+
const instance = {
|
|
50
|
+
thresholds: Array.isArray(options.threshold)
|
|
51
|
+
? options.threshold
|
|
52
|
+
: [options.threshold ?? 0],
|
|
53
|
+
root: options.root ?? null,
|
|
54
|
+
rootMargin: options.rootMargin ?? '',
|
|
55
|
+
observe: vi.fn(),
|
|
56
|
+
unobserve: vi.fn(),
|
|
57
|
+
disconnect: vi.fn(),
|
|
58
|
+
takeRecords: vi.fn(() => []),
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return instance;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
vi.stubGlobal('IntersectionObserver', IntersectionObserverMock);
|
|
65
|
+
global.IntersectionObserver = IntersectionObserverMock;
|
|
66
|
+
window.IntersectionObserver = IntersectionObserverMock;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.react-aria-Table.cmsui-table {
|
|
2
|
+
--plone-table-cell-border-bottom: 1px solid var(--quanta-smoke);
|
|
3
|
+
--plone-table-header-border-bottom: 2px solid var(--quanta-silver);
|
|
4
|
+
width: 100%;
|
|
5
|
+
border-radius: 0;
|
|
6
|
+
|
|
7
|
+
.react-aria-Row {
|
|
8
|
+
--radius-top: 0px;
|
|
9
|
+
--radius-bottom: 0px;
|
|
10
|
+
border-bottom: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.react-aria-Column[data-key$='occurrences'],
|
|
14
|
+
.react-aria-Cell[data-key$=':occurrences'] {
|
|
15
|
+
text-align: right;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -394,8 +394,6 @@ button {
|
|
|
394
394
|
}
|
|
395
395
|
|
|
396
396
|
.users-control-panel .table {
|
|
397
|
-
overflow-x: scroll;
|
|
398
|
-
|
|
399
397
|
&::-webkit-scrollbar {
|
|
400
398
|
width: 3px;
|
|
401
399
|
height: 3px; /* scrollbar height */
|
|
@@ -713,5 +711,6 @@ img.responsive {
|
|
|
713
711
|
@import 'views';
|
|
714
712
|
@import 'toc';
|
|
715
713
|
@import 'grid.less';
|
|
714
|
+
@import 'block-types.less';
|
|
716
715
|
@import 'videoembed.less';
|
|
717
716
|
.loadUIOverrides();
|
|
@@ -54,7 +54,7 @@ export { default as Actions } from "@plone/volto/components/manage/Actions/Actio
|
|
|
54
54
|
export { default as Add } from "@plone/volto/components/manage/Add/Add";
|
|
55
55
|
export { default as Circle } from "@plone/volto/components/manage/Contents/circle";
|
|
56
56
|
export { default as Delete } from "@plone/volto/components/manage/Delete/Delete";
|
|
57
|
-
export const Diff: import("@loadable/component").
|
|
57
|
+
export const Diff: import("@loadable/component").LoadableComponent<any>;
|
|
58
58
|
export const DiffField: import("@loadable/component").LoadableClassComponent<any>;
|
|
59
59
|
export { default as Display } from "@plone/volto/components/manage/Display/Display";
|
|
60
60
|
export { default as Edit } from "@plone/volto/components/manage/Edit/Edit";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export function getProjection(items: any, activeId: any, overId: any, dragOffset: any, indentationWidth: any, arrayMove: any): {
|
|
2
|
+
parentId: any;
|
|
3
|
+
parentType: any;
|
|
2
4
|
depth: any;
|
|
3
5
|
maxDepth: any;
|
|
4
6
|
minDepth: any;
|
|
5
|
-
parentId: any;
|
|
6
7
|
};
|
|
7
8
|
export function flattenTree(items: any): any;
|
|
8
9
|
export function findItem(items: any, itemId: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -194,3 +194,6 @@ export function getBlocksHierarchy(properties: any): any;
|
|
|
194
194
|
export function findContainer(formData: object, { containerId }: {
|
|
195
195
|
containerId: string;
|
|
196
196
|
}): object | undefined;
|
|
197
|
+
export function findParent(formData: object, { blockId }: {
|
|
198
|
+
blockId: string;
|
|
199
|
+
}): object | undefined;
|
|
@@ -20,6 +20,12 @@ type ChoiceValidator = {
|
|
|
20
20
|
formData: any;
|
|
21
21
|
formatMessage: Function;
|
|
22
22
|
};
|
|
23
|
+
type FileValidator = {
|
|
24
|
+
value: Record<string, any>;
|
|
25
|
+
field: Record<string, any>;
|
|
26
|
+
formData: any;
|
|
27
|
+
formatMessage: Function;
|
|
28
|
+
};
|
|
23
29
|
export declare const isMaxPropertyValid: ({ value, fieldSpec, criterion, formatMessage, }: MinMaxValidator) => any;
|
|
24
30
|
export declare const isMinPropertyValid: ({ value, fieldSpec, criterion, formatMessage, }: MinMaxValidator) => any;
|
|
25
31
|
export declare const minLengthValidator: ({ value, field, formatMessage, }: Validator) => any;
|
|
@@ -37,4 +43,5 @@ export declare const patternValidator: ({ value, field, formatMessage, }: Valida
|
|
|
37
43
|
export declare const maxItemsValidator: ({ value, field, formatMessage, }: Validator) => any;
|
|
38
44
|
export declare const minItemsValidator: ({ value, field, formatMessage, }: Validator) => any;
|
|
39
45
|
export declare const defaultLanguageControlPanelValidator: ({ value, formData, formatMessage, }: ChoiceValidator) => any;
|
|
46
|
+
export declare const sizeValidator: ({ value, field, formatMessage, }: FileValidator) => any;
|
|
40
47
|
export {};
|