@plone/volto 18.0.0-alpha.18 → 18.0.0-alpha.19
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/CHANGELOG.md +31 -1
- package/locales/ca/LC_MESSAGES/volto.po +17 -42
- package/locales/ca.json +1 -1
- package/locales/de/LC_MESSAGES/volto.po +15 -40
- package/locales/de.json +1 -1
- package/locales/en/LC_MESSAGES/volto.po +14 -39
- package/locales/en.json +1 -1
- package/locales/es/LC_MESSAGES/volto.po +15 -40
- package/locales/es.json +1 -1
- package/locales/eu/LC_MESSAGES/volto.po +15 -40
- package/locales/eu.json +1 -1
- package/locales/fi/LC_MESSAGES/volto.po +15 -40
- package/locales/fi.json +1 -1
- package/locales/fr/LC_MESSAGES/volto.po +15 -40
- package/locales/fr.json +1 -1
- package/locales/it/LC_MESSAGES/volto.po +15 -40
- package/locales/it.json +1 -1
- package/locales/ja/LC_MESSAGES/volto.po +15 -40
- package/locales/ja.json +1 -1
- package/locales/nl/LC_MESSAGES/volto.po +14 -39
- package/locales/nl.json +1 -1
- package/locales/pt/LC_MESSAGES/volto.po +15 -40
- package/locales/pt.json +1 -1
- package/locales/pt_BR/LC_MESSAGES/volto.po +15 -40
- package/locales/pt_BR.json +1 -1
- package/locales/ro/LC_MESSAGES/volto.po +15 -40
- package/locales/ro.json +1 -1
- package/locales/volto.pot +15 -40
- package/locales/zh_CN/LC_MESSAGES/volto.po +15 -40
- package/locales/zh_CN.json +1 -1
- package/package.json +10 -20
- package/src/components/index.js +0 -6
- package/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +8 -2
- package/src/components/manage/Blocks/Search/hocs/withSearch.jsx +2 -2
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.jsx +33 -5
- package/src/components/manage/Controlpanels/Groups/GroupsControlpanel.test.jsx +12 -0
- package/src/components/manage/Controlpanels/Groups/RenderGroups.jsx +22 -11
- package/src/components/manage/Controlpanels/Groups/RenderGroups.test.jsx +21 -0
- package/src/components/manage/Controlpanels/Users/RenderUsers.jsx +30 -21
- package/src/components/manage/Controlpanels/Users/RenderUsers.test.jsx +27 -1
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipListing.jsx +29 -7
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.jsx +51 -3
- package/src/components/manage/Controlpanels/Users/UsersControlpanel.test.jsx +8 -0
- package/src/config/Blocks.jsx +63 -67
- package/src/config/Loadables.jsx +0 -22
- package/src/config/Widgets.jsx +0 -2
- package/src/config/index.js +0 -13
- package/src/helpers/User/User.js +29 -0
- package/src/helpers/index.js +6 -1
- package/test-setup-config.js +0 -30
- package/types/components/index.d.ts +0 -6
- package/types/config/Blocks.d.ts +0 -51
- package/types/config/Loadables.d.ts +0 -10
- package/types/config/Widgets.d.ts +0 -2
- package/types/helpers/User/User.d.ts +18 -0
- package/types/helpers/index.d.ts +1 -1
- package/webpack-plugins/webpack-bundle-analyze-plugin.js +1 -1
- package/src/components/manage/AnchorPlugin/components/Link/index.jsx +0 -37
- package/src/components/manage/AnchorPlugin/components/LinkButton/index.jsx +0 -126
- package/src/components/manage/AnchorPlugin/index.jsx +0 -82
- package/src/components/manage/AnchorPlugin/linkStrategy.js +0 -21
- package/src/components/manage/AnchorPlugin/utils/EditorUtils.js +0 -47
- package/src/components/manage/Blocks/HeroImageLeft/Data.jsx +0 -29
- package/src/components/manage/Blocks/HeroImageLeft/Edit.jsx +0 -493
- package/src/components/manage/Blocks/HeroImageLeft/Edit.test.jsx +0 -58
- package/src/components/manage/Blocks/HeroImageLeft/View.jsx +0 -37
- package/src/components/manage/Blocks/HeroImageLeft/View.test.jsx +0 -9
- package/src/components/manage/Blocks/HeroImageLeft/schema.js +0 -43
- package/src/components/manage/Blocks/Table/Cell.jsx +0 -206
- package/src/components/manage/Blocks/Table/Cell.test.jsx +0 -19
- package/src/components/manage/Blocks/Table/Edit.jsx +0 -748
- package/src/components/manage/Blocks/Table/Edit.test.jsx +0 -44
- package/src/components/manage/Blocks/Table/Readme.md +0 -5
- package/src/components/manage/Blocks/Table/View.jsx +0 -51
- package/src/components/manage/Blocks/Table/View.test.jsx +0 -41
- package/src/components/manage/Blocks/Text/Edit.jsx +0 -372
- package/src/components/manage/Blocks/Text/Edit.test.jsx +0 -46
- package/src/components/manage/Blocks/Text/Readme.md +0 -5
- package/src/components/manage/Blocks/Text/Schema.jsx +0 -31
- package/src/components/manage/Blocks/Text/View.jsx +0 -26
- package/src/components/manage/Blocks/Text/View.test.jsx +0 -28
- package/src/components/manage/LinkDetectionPlugin/link-detection-plugin.jsx +0 -227
- package/src/components/manage/LinkDetectionPlugin/utils.js +0 -12
- package/src/components/manage/Widgets/WysiwygWidget.jsx +0 -350
- package/src/components/manage/Widgets/WysiwygWidget.stories.jsx +0 -24
- package/src/components/manage/Widgets/WysiwygWidget.test.jsx +0 -37
- package/src/config/RichTextEditor/Blocks.jsx +0 -29
- package/src/config/RichTextEditor/FromHTML.jsx +0 -8
- package/src/config/RichTextEditor/Plugins.jsx +0 -59
- package/src/config/RichTextEditor/Styles.jsx +0 -69
- package/src/config/RichTextEditor/ToHTML.jsx +0 -262
- package/src/config/RichTextEditor/index.js +0 -25
package/src/config/Loadables.jsx
CHANGED
|
@@ -35,26 +35,4 @@ export const loadables = {
|
|
|
35
35
|
reactDndHtml5Backend: loadable.lib(() => import('react-dnd-html5-backend')),
|
|
36
36
|
reactBeautifulDnd: loadable.lib(() => import('react-beautiful-dnd')),
|
|
37
37
|
rrule: loadable.lib(() => import('rrule')),
|
|
38
|
-
|
|
39
|
-
// draftjs libs
|
|
40
|
-
immutableLib: loadable.lib(() => import('immutable')),
|
|
41
|
-
draftJs: loadable.lib(() => import('draft-js')),
|
|
42
|
-
draftJsLibIsSoftNewlineEvent: loadable.lib(
|
|
43
|
-
() => import('draft-js/lib/isSoftNewlineEvent'),
|
|
44
|
-
),
|
|
45
|
-
draftJsFilters: loadable.lib(() => import('draftjs-filters')),
|
|
46
|
-
draftJsInlineToolbarPlugin: loadable.lib(
|
|
47
|
-
() => import('draft-js-inline-toolbar-plugin'),
|
|
48
|
-
),
|
|
49
|
-
draftJsImportHtml: loadable.lib(() => import('draft-js-import-html')),
|
|
50
|
-
draftJsBlockBreakoutPlugin: loadable.lib(
|
|
51
|
-
() => import('draft-js-block-breakout-plugin'),
|
|
52
|
-
),
|
|
53
|
-
draftJsCreateInlineStyleButton: loadable.lib(
|
|
54
|
-
() => import('draft-js-buttons/lib/utils/createInlineStyleButton'),
|
|
55
|
-
),
|
|
56
|
-
draftJsCreateBlockStyleButton: loadable.lib(
|
|
57
|
-
() => import('draft-js-buttons/lib/utils/createBlockStyleButton'),
|
|
58
|
-
),
|
|
59
|
-
draftJsPluginsUtils: loadable.lib(() => import('draft-js-plugins-utils')),
|
|
60
38
|
};
|
package/src/config/Widgets.jsx
CHANGED
|
@@ -18,7 +18,6 @@ import SelectWidget from '@plone/volto/components/manage/Widgets/SelectWidget';
|
|
|
18
18
|
import TextareaWidget from '@plone/volto/components/manage/Widgets/TextareaWidget';
|
|
19
19
|
import TextWidget from '@plone/volto/components/manage/Widgets/TextWidget';
|
|
20
20
|
import TokenWidget from '@plone/volto/components/manage/Widgets/TokenWidget';
|
|
21
|
-
import WysiwygWidget from '@plone/volto/components/manage/Widgets/WysiwygWidget';
|
|
22
21
|
import UrlWidget from '@plone/volto/components/manage/Widgets/UrlWidget';
|
|
23
22
|
import InternalUrlWidget from '@plone/volto/components/manage/Widgets/InternalUrlWidget';
|
|
24
23
|
import EmailWidget from '@plone/volto/components/manage/Widgets/EmailWidget';
|
|
@@ -77,7 +76,6 @@ export const widgetMapping = {
|
|
|
77
76
|
site_logo: RegistryImageWidget,
|
|
78
77
|
},
|
|
79
78
|
widget: {
|
|
80
|
-
richtext: WysiwygWidget,
|
|
81
79
|
textarea: TextareaWidget,
|
|
82
80
|
datetime: DatetimeWidget,
|
|
83
81
|
date: DatetimeWidget,
|
package/src/config/index.js
CHANGED
|
@@ -27,8 +27,6 @@ import {
|
|
|
27
27
|
filterControlPanelsSchema,
|
|
28
28
|
} from './ControlPanels';
|
|
29
29
|
|
|
30
|
-
import { richtextEditorSettings, richtextViewSettings } from './RichTextEditor';
|
|
31
|
-
|
|
32
30
|
import applyAddonConfiguration, { addonsInfo } from 'load-volto-addons';
|
|
33
31
|
|
|
34
32
|
import ConfigRegistry from '@plone/volto/registry';
|
|
@@ -112,8 +110,6 @@ let config = {
|
|
|
112
110
|
legacyTraverse: process.env.RAZZLE_LEGACY_TRAVERSE || false,
|
|
113
111
|
cookieExpires: 15552000, //in seconds. Default is 6 month (15552000)
|
|
114
112
|
nonContentRoutes,
|
|
115
|
-
richtextEditorSettings, // Part of draftjs support, to be removed
|
|
116
|
-
richtextViewSettings, // Part of draftjs support, to be removed
|
|
117
113
|
imageObjects: ['Image'],
|
|
118
114
|
reservedIds: ['login', 'layout', 'plone', 'zip', 'properties'],
|
|
119
115
|
downloadableObjects: ['File'], //list of content-types for which the direct download of the file will be carried out if the user is not authenticated
|
|
@@ -145,15 +141,6 @@ let config = {
|
|
|
145
141
|
'reactBeautifulDnd',
|
|
146
142
|
// 'diffLib',
|
|
147
143
|
],
|
|
148
|
-
draftEditor: [
|
|
149
|
-
'immutableLib',
|
|
150
|
-
'draftJs',
|
|
151
|
-
'draftJsLibIsSoftNewlineEvent',
|
|
152
|
-
'draftJsFilters',
|
|
153
|
-
'draftJsInlineToolbarPlugin',
|
|
154
|
-
'draftJsImportHtml',
|
|
155
|
-
'draftJsBlockBreakoutPlugin',
|
|
156
|
-
],
|
|
157
144
|
},
|
|
158
145
|
appExtras: [],
|
|
159
146
|
maxResponseSize: 2000000000, // This is superagent default (200 mb)
|
package/src/helpers/User/User.js
CHANGED
|
@@ -12,3 +12,32 @@ import { intersection } from 'lodash';
|
|
|
12
12
|
export function userHasRoles(user, roles = []) {
|
|
13
13
|
return intersection(user?.roles ?? [], roles).length > 0;
|
|
14
14
|
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Checks if the user is Manager.
|
|
18
|
+
* @method isManager
|
|
19
|
+
* @returns {boolean}
|
|
20
|
+
*/
|
|
21
|
+
export function isManager(user) {
|
|
22
|
+
return userHasRoles(user, ['Manager']);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Checks if the user can assing group.
|
|
27
|
+
* @method canAssignGroup
|
|
28
|
+
* @returns {boolean}
|
|
29
|
+
*/
|
|
30
|
+
export function canAssignGroup(isManager, group) {
|
|
31
|
+
if (isManager) return true;
|
|
32
|
+
return !group.roles.includes('Manager');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Checks if the user can assign role.
|
|
37
|
+
* @method canDeleteGroup
|
|
38
|
+
* @returns {boolean}
|
|
39
|
+
*/
|
|
40
|
+
export function canAssignRole(isManager, role) {
|
|
41
|
+
if (isManager) return true;
|
|
42
|
+
return role.id !== 'Manager';
|
|
43
|
+
}
|
package/src/helpers/index.js
CHANGED
|
@@ -116,7 +116,12 @@ export {
|
|
|
116
116
|
composeSchema,
|
|
117
117
|
} from './Extensions';
|
|
118
118
|
export { asyncConnect } from './AsyncConnect';
|
|
119
|
-
export {
|
|
119
|
+
export {
|
|
120
|
+
userHasRoles,
|
|
121
|
+
isManager,
|
|
122
|
+
canAssignGroup,
|
|
123
|
+
canAssignRole,
|
|
124
|
+
} from './User/User';
|
|
120
125
|
// export { injectLazyLibs } from './Loadable/Loadable';
|
|
121
126
|
export { useDetectClickOutside } from './Utils/useDetectClickOutside';
|
|
122
127
|
export { useEvent } from './Utils/useEvent';
|
package/test-setup-config.js
CHANGED
|
@@ -10,15 +10,6 @@ import React from 'react';
|
|
|
10
10
|
import config from '@plone/volto/registry';
|
|
11
11
|
import { loadables } from '@plone/volto/config/Loadables';
|
|
12
12
|
import { nonContentRoutes } from '@plone/volto/config/NonContentRoutes';
|
|
13
|
-
import ToHTMLRenderers, {
|
|
14
|
-
options as ToHTMLOptions,
|
|
15
|
-
} from '@plone/volto/config/RichTextEditor/ToHTML';
|
|
16
|
-
import {
|
|
17
|
-
extendedBlockRenderMap,
|
|
18
|
-
blockStyleFn,
|
|
19
|
-
listBlockTypes,
|
|
20
|
-
} from '@plone/volto/config/RichTextEditor/Blocks';
|
|
21
|
-
import FromHTMLCustomBlockFn from '@plone/volto/config/RichTextEditor/FromHTML';
|
|
22
13
|
import { contentIcons } from '@plone/volto/config/ContentIcons';
|
|
23
14
|
import {
|
|
24
15
|
styleClassNameConverters,
|
|
@@ -33,25 +24,6 @@ import {
|
|
|
33
24
|
|
|
34
25
|
import ListingBlockSchema from '@plone/volto/components/manage/Blocks/Listing/schema';
|
|
35
26
|
|
|
36
|
-
// we need to do a redefinition here because of circular import issues
|
|
37
|
-
// because draftjs-based components are not really tested, this is basically
|
|
38
|
-
// dummy code.
|
|
39
|
-
const richtextEditorSettings = (props) => {
|
|
40
|
-
return {
|
|
41
|
-
extendedBlockRenderMap,
|
|
42
|
-
blockStyleFn,
|
|
43
|
-
listBlockTypes,
|
|
44
|
-
FromHTMLCustomBlockFn,
|
|
45
|
-
// richTextEditorPlugins: plugins,
|
|
46
|
-
// richTextEditorInlineToolbarButtons: inlineToolbarButtons,
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const richtextViewSettings = {
|
|
51
|
-
ToHTMLRenderers,
|
|
52
|
-
ToHTMLOptions,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
27
|
config.set('settings', {
|
|
56
28
|
apiPath: 'http://localhost:8080/Plone',
|
|
57
29
|
publicURL: 'http://localhost:3000',
|
|
@@ -60,8 +32,6 @@ config.set('settings', {
|
|
|
60
32
|
defaultPageSize: 25,
|
|
61
33
|
isMultilingual: false,
|
|
62
34
|
nonContentRoutes,
|
|
63
|
-
richtextEditorSettings,
|
|
64
|
-
richtextViewSettings,
|
|
65
35
|
contentIcons: contentIcons,
|
|
66
36
|
loadables,
|
|
67
37
|
lazyBundles: {
|
|
@@ -135,27 +135,22 @@ export { default as SchemaWidgetFieldset } from "@plone/volto/components/manage/
|
|
|
135
135
|
export { default as SelectWidget } from "@plone/volto/components/manage/Widgets/SelectWidget";
|
|
136
136
|
export { default as TextareaWidget } from "@plone/volto/components/manage/Widgets/TextareaWidget";
|
|
137
137
|
export { default as TextWidget } from "@plone/volto/components/manage/Widgets/TextWidget";
|
|
138
|
-
export { default as WysiwygWidget } from "@plone/volto/components/manage/Widgets/WysiwygWidget";
|
|
139
138
|
export { default as ObjectWidget } from "@plone/volto/components/manage/Widgets/ObjectWidget";
|
|
140
139
|
export { default as ObjectListWidget } from "@plone/volto/components/manage/Widgets/ObjectListWidget";
|
|
141
140
|
export { default as EditDefaultBlock } from "@plone/volto/components/manage/Blocks/Block/DefaultEdit";
|
|
142
141
|
export { default as EditDescriptionBlock } from "@plone/volto/components/manage/Blocks/Description/Edit";
|
|
143
142
|
export { default as EditTitleBlock } from "@plone/volto/components/manage/Blocks/Title/Edit";
|
|
144
143
|
export { default as EditToCBlock } from "@plone/volto/components/manage/Blocks/ToC/Edit";
|
|
145
|
-
export { default as EditTextBlock } from "@plone/volto/components/manage/Blocks/Text/Edit";
|
|
146
144
|
export { default as EditImageBlock } from "@plone/volto/components/manage/Blocks/Image/Edit";
|
|
147
145
|
export { default as EditListingBlock } from "@plone/volto/components/manage/Blocks/Listing/Edit";
|
|
148
146
|
export { default as EditVideoBlock } from "@plone/volto/components/manage/Blocks/Video/Edit";
|
|
149
147
|
export { default as EditBlock } from "@plone/volto/components/manage/Blocks/Block/Edit";
|
|
150
|
-
export { default as EditHeroImageLeftBlock } from "@plone/volto/components/manage/Blocks/HeroImageLeft/Edit";
|
|
151
|
-
export { default as ViewHeroImageLeftBlock } from "@plone/volto/components/manage/Blocks/HeroImageLeft/View";
|
|
152
148
|
export { default as EditMapBlock } from "@plone/volto/components/manage/Blocks/Maps/Edit";
|
|
153
149
|
export { default as EditHTMLBlock } from "@plone/volto/components/manage/Blocks/HTML/Edit";
|
|
154
150
|
export { default as ViewDefaultBlock } from "@plone/volto/components/manage/Blocks/Block/DefaultView";
|
|
155
151
|
export { default as ViewDescriptionBlock } from "@plone/volto/components/manage/Blocks/Description/View";
|
|
156
152
|
export { default as ViewTitleBlock } from "@plone/volto/components/manage/Blocks/Title/View";
|
|
157
153
|
export { default as ViewToCBlock } from "@plone/volto/components/manage/Blocks/ToC/View";
|
|
158
|
-
export { default as ViewTextBlock } from "@plone/volto/components/manage/Blocks/Text/View";
|
|
159
154
|
export { default as ViewImageBlock } from "@plone/volto/components/manage/Blocks/Image/View";
|
|
160
155
|
export { default as ViewListingBlock } from "@plone/volto/components/manage/Blocks/Listing/View";
|
|
161
156
|
export { default as ViewVideoBlock } from "@plone/volto/components/manage/Blocks/Video/View";
|
|
@@ -170,7 +165,6 @@ export { default as LeadImageSidebar } from "@plone/volto/components/manage/Bloc
|
|
|
170
165
|
export { default as Style } from "@plone/volto/components/manage/Blocks/Block/Style";
|
|
171
166
|
export { default as BlockSettingsSidebar } from "@plone/volto/components/manage/Blocks/Block/Settings";
|
|
172
167
|
export { default as BlockSettingsSchema } from "@plone/volto/components/manage/Blocks/Block/Schema";
|
|
173
|
-
export { default as TextSettingsSchema } from "@plone/volto/components/manage/Blocks/Text/Schema";
|
|
174
168
|
export { default as ImageSettingsSchema } from "@plone/volto/components/manage/Blocks/Image/LayoutSchema";
|
|
175
169
|
export { default as ToCSettingsSchema } from "@plone/volto/components/manage/Blocks/ToC/Schema";
|
|
176
170
|
export { default as MaybeWrap } from "@plone/volto/components/manage/MaybeWrap/MaybeWrap";
|
package/types/config/Blocks.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="@plone/registry/node_modules/@plone/types/src/modules" />
|
|
2
1
|
export const groupBlocksOrder: {
|
|
3
2
|
id: string;
|
|
4
3
|
title: string;
|
|
@@ -9,49 +8,9 @@ export namespace blocksConfig {
|
|
|
9
8
|
namespace blocksConfig {
|
|
10
9
|
namespace teaser {
|
|
11
10
|
export { gridTeaserDisableStylingSchema as schemaEnhancer };
|
|
12
|
-
export let id: string;
|
|
13
|
-
export let title: string;
|
|
14
|
-
export { imagesSVG as icon };
|
|
15
|
-
export let group: string;
|
|
16
|
-
export { TeaserViewBlock as view };
|
|
17
|
-
export { TeaserEditBlock as edit };
|
|
18
|
-
export let restricted: boolean;
|
|
19
|
-
export let mostUsed: boolean;
|
|
20
|
-
export let sidebarTab: number;
|
|
21
|
-
export { TeaserSchema as blockSchema };
|
|
22
|
-
export { TeaserBlockDataAdapter as dataAdapter };
|
|
23
|
-
export let variations: {
|
|
24
|
-
id: string;
|
|
25
|
-
isDefault: boolean;
|
|
26
|
-
title: string;
|
|
27
|
-
template: {
|
|
28
|
-
(props: any): import("react/jsx-runtime").JSX.Element;
|
|
29
|
-
propTypes: {
|
|
30
|
-
data: any;
|
|
31
|
-
isEditMode: any;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
}[];
|
|
35
11
|
}
|
|
36
12
|
namespace image {
|
|
37
13
|
export { gridImageDisableSizeAndPositionHandlersSchema as schemaEnhancer };
|
|
38
|
-
let id_1: string;
|
|
39
|
-
export { id_1 as id };
|
|
40
|
-
let title_1: string;
|
|
41
|
-
export { title_1 as title };
|
|
42
|
-
export { cameraSVG as icon };
|
|
43
|
-
let group_1: string;
|
|
44
|
-
export { group_1 as group };
|
|
45
|
-
export { ViewImageBlock as view };
|
|
46
|
-
export { EditImageBlock as edit };
|
|
47
|
-
export { ImageSettingsSchema as schema };
|
|
48
|
-
let restricted_1: boolean;
|
|
49
|
-
export { restricted_1 as restricted };
|
|
50
|
-
let mostUsed_1: boolean;
|
|
51
|
-
export { mostUsed_1 as mostUsed };
|
|
52
|
-
let sidebarTab_1: number;
|
|
53
|
-
export { sidebarTab_1 as sidebarTab };
|
|
54
|
-
export { getImageBlockSizes as getSizes };
|
|
55
14
|
}
|
|
56
15
|
}
|
|
57
16
|
}
|
|
@@ -59,14 +18,4 @@ export namespace blocksConfig {
|
|
|
59
18
|
export const initialBlocks: {};
|
|
60
19
|
export const initialBlocksFocus: {};
|
|
61
20
|
import { gridTeaserDisableStylingSchema } from '@plone/volto/components/manage/Blocks/Teaser/schema';
|
|
62
|
-
import imagesSVG from '@plone/volto/icons/images.svg';
|
|
63
|
-
import TeaserViewBlock from '@plone/volto/components/manage/Blocks/Teaser/View';
|
|
64
|
-
import TeaserEditBlock from '@plone/volto/components/manage/Blocks/Teaser/Edit';
|
|
65
|
-
import { TeaserSchema } from '@plone/volto/components/manage/Blocks/Teaser/schema';
|
|
66
|
-
import { TeaserBlockDataAdapter } from '@plone/volto/components/manage/Blocks/Teaser/adapter';
|
|
67
21
|
import { gridImageDisableSizeAndPositionHandlersSchema } from '@plone/volto/components/manage/Blocks/Image/schema';
|
|
68
|
-
import cameraSVG from '@plone/volto/icons/camera.svg';
|
|
69
|
-
import ViewImageBlock from '@plone/volto/components/manage/Blocks/Image/View';
|
|
70
|
-
import EditImageBlock from '@plone/volto/components/manage/Blocks/Image/Edit';
|
|
71
|
-
import ImageSettingsSchema from '@plone/volto/components/manage/Blocks/Image/LayoutSchema';
|
|
72
|
-
import { getImageBlockSizes } from '@plone/volto/components/manage/Blocks/Image/utils';
|
|
@@ -17,14 +17,4 @@ export namespace loadables {
|
|
|
17
17
|
let reactDndHtml5Backend: any;
|
|
18
18
|
let reactBeautifulDnd: any;
|
|
19
19
|
let rrule: any;
|
|
20
|
-
let immutableLib: any;
|
|
21
|
-
let draftJs: any;
|
|
22
|
-
let draftJsLibIsSoftNewlineEvent: any;
|
|
23
|
-
let draftJsFilters: any;
|
|
24
|
-
let draftJsInlineToolbarPlugin: any;
|
|
25
|
-
let draftJsImportHtml: any;
|
|
26
|
-
let draftJsBlockBreakoutPlugin: any;
|
|
27
|
-
let draftJsCreateInlineStyleButton: any;
|
|
28
|
-
let draftJsCreateBlockStyleButton: any;
|
|
29
|
-
let draftJsPluginsUtils: any;
|
|
30
20
|
}
|
|
@@ -11,7 +11,6 @@ export namespace widgetMapping {
|
|
|
11
11
|
export { RegistryImageWidget as site_logo };
|
|
12
12
|
}
|
|
13
13
|
export namespace widget {
|
|
14
|
-
export { WysiwygWidget as richtext };
|
|
15
14
|
export { TextareaWidget as textarea };
|
|
16
15
|
export { DatetimeWidget as datetime };
|
|
17
16
|
export { DatetimeWidget as date };
|
|
@@ -112,7 +111,6 @@ import QuerystringWidget from '@plone/volto/components/manage/Widgets/Querystrin
|
|
|
112
111
|
import UrlWidget from '@plone/volto/components/manage/Widgets/UrlWidget';
|
|
113
112
|
import IdWidget from '@plone/volto/components/manage/Widgets/IdWidget';
|
|
114
113
|
import RegistryImageWidget from '@plone/volto/components/manage/Widgets/RegistryImageWidget';
|
|
115
|
-
import WysiwygWidget from '@plone/volto/components/manage/Widgets/WysiwygWidget';
|
|
116
114
|
import TextareaWidget from '@plone/volto/components/manage/Widgets/TextareaWidget';
|
|
117
115
|
import PasswordWidget from '@plone/volto/components/manage/Widgets/PasswordWidget';
|
|
118
116
|
import FileWidget from '@plone/volto/components/manage/Widgets/FileWidget';
|
|
@@ -4,3 +4,21 @@
|
|
|
4
4
|
* @returns {boolean}
|
|
5
5
|
*/
|
|
6
6
|
export function userHasRoles(user: any, roles?: any[]): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if the user is Manager.
|
|
9
|
+
* @method isManager
|
|
10
|
+
* @returns {boolean}
|
|
11
|
+
*/
|
|
12
|
+
export function isManager(user: any): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Checks if the user can assing group.
|
|
15
|
+
* @method canAssignGroup
|
|
16
|
+
* @returns {boolean}
|
|
17
|
+
*/
|
|
18
|
+
export function canAssignGroup(isManager: any, group: any): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Checks if the user can assign role.
|
|
21
|
+
* @method canDeleteGroup
|
|
22
|
+
* @returns {boolean}
|
|
23
|
+
*/
|
|
24
|
+
export function canAssignRole(isManager: any, role: any): boolean;
|
package/types/helpers/index.d.ts
CHANGED
|
@@ -8,7 +8,6 @@ export { default as langmap } from "./LanguageMap/LanguageMap";
|
|
|
8
8
|
export { default as Helmet } from "./Helmet/Helmet";
|
|
9
9
|
export { messages } from "./MessageLabels/MessageLabels";
|
|
10
10
|
export { asyncConnect } from "./AsyncConnect";
|
|
11
|
-
export { userHasRoles } from "./User/User";
|
|
12
11
|
export { useDetectClickOutside } from "./Utils/useDetectClickOutside";
|
|
13
12
|
export { useEvent } from "./Utils/useEvent";
|
|
14
13
|
export { usePrevious } from "./Utils/usePrevious";
|
|
@@ -27,4 +26,5 @@ export { getBoolean, getVocabName, getVocabFromHint, getVocabFromField, getVocab
|
|
|
27
26
|
export { default as FormValidation, validateFileUploadSize, tryParseJSON } from "./FormValidation/FormValidation";
|
|
28
27
|
export { difference, getColor, getInitials, safeWrapper, applyConfig, withServerErrorCode, parseDateTime, toGettextLang, normalizeLanguageName, toReactIntlLang, toLangUnderscoreRegion, toBackendLang, hasApiExpander, replaceItemOfArray, cloneDeepSchema, arrayRange, reorderArray, isInteractiveElement, slugify, normalizeString } from "@plone/volto/helpers/Utils/Utils";
|
|
29
28
|
export { withBlockSchemaEnhancer, withVariationSchemaEnhancer, withBlockExtensions, applySchemaEnhancer, resolveExtension, resolveBlockExtensions, addStyling, composeSchema } from "./Extensions";
|
|
29
|
+
export { userHasRoles, isManager, canAssignGroup, canAssignRole } from "./User/User";
|
|
30
30
|
export { getCurrentStateMapping, getWorkflowOptions } from "./Workflows/Workflows";
|
|
@@ -7,7 +7,7 @@ const offline = process.env.OFFLINE_BUNDLE_ANALYZE === 'true' ? true : false;
|
|
|
7
7
|
|
|
8
8
|
const defaultOptions = {
|
|
9
9
|
concatenateModules: false,
|
|
10
|
-
analyzerHost: '
|
|
10
|
+
analyzerHost: '127.0.0.1',
|
|
11
11
|
analyzerMode: offline ? 'static' : 'server',
|
|
12
12
|
generateStatsFile: true,
|
|
13
13
|
statsFilename: 'stats.json',
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { isInternalURL, flattenToAppURL } from '@plone/volto/helpers';
|
|
4
|
-
|
|
5
|
-
const propTypes = {
|
|
6
|
-
className: PropTypes.string,
|
|
7
|
-
children: PropTypes.node.isRequired,
|
|
8
|
-
entityKey: PropTypes.string,
|
|
9
|
-
getEditorState: PropTypes.func.isRequired,
|
|
10
|
-
target: PropTypes.string,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const Link = ({ children, className, entityKey, getEditorState, target }) => {
|
|
14
|
-
const entity = getEditorState().getCurrentContent().getEntity(entityKey);
|
|
15
|
-
const entityData = entity ? entity.get('data') : undefined;
|
|
16
|
-
const href = (entityData && entityData.url) || undefined;
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<a
|
|
20
|
-
className={className}
|
|
21
|
-
title={href}
|
|
22
|
-
href={isInternalURL(href) ? flattenToAppURL(href) : href}
|
|
23
|
-
target={target}
|
|
24
|
-
rel="noopener noreferrer"
|
|
25
|
-
>
|
|
26
|
-
{children}
|
|
27
|
-
</a>
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
Link.propTypes = propTypes;
|
|
32
|
-
Link.defaultProps = {
|
|
33
|
-
className: null,
|
|
34
|
-
entityKey: null,
|
|
35
|
-
target: null,
|
|
36
|
-
};
|
|
37
|
-
export default Link;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import cx from 'classnames';
|
|
4
|
-
import EditorUtils from '../../utils/EditorUtils';
|
|
5
|
-
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
6
|
-
import AddLinkForm from '@plone/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm';
|
|
7
|
-
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
8
|
-
|
|
9
|
-
import linkSVG from '@plone/volto/icons/link.svg';
|
|
10
|
-
import unlinkSVG from '@plone/volto/icons/unlink.svg';
|
|
11
|
-
|
|
12
|
-
// import unionClassNames from 'union-class-names';
|
|
13
|
-
//import EditorUtils from 'draft-js-plugins-utils';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Add link form class.
|
|
17
|
-
* @class LinkButton
|
|
18
|
-
* @extends Component
|
|
19
|
-
*/
|
|
20
|
-
class LinkButton extends Component {
|
|
21
|
-
static propTypes = {
|
|
22
|
-
placeholder: PropTypes.string,
|
|
23
|
-
theme: PropTypes.shape({}).isRequired,
|
|
24
|
-
ownTheme: PropTypes.shape({}).isRequired,
|
|
25
|
-
onRemoveLinkAtSelection: PropTypes.func.isRequired,
|
|
26
|
-
onOverrideContent: PropTypes.func.isRequired,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
constructor(props) {
|
|
30
|
-
super(props);
|
|
31
|
-
|
|
32
|
-
this.DraftEditorUtils = props.draftJsPluginsUtils.default;
|
|
33
|
-
this.EditorUtils = EditorUtils(props);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
static defaultProps = {
|
|
37
|
-
placeholder: '',
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
onMouseDown = (event) => {
|
|
41
|
-
event.preventDefault();
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
onAddLinkClick = (e) => {
|
|
45
|
-
e.preventDefault();
|
|
46
|
-
e.stopPropagation();
|
|
47
|
-
const { ownTheme, placeholder, onOverrideContent } = this.props;
|
|
48
|
-
const link = this.EditorUtils.getCurrentEntity(
|
|
49
|
-
this.props.getEditorState(),
|
|
50
|
-
)?.getData()?.url;
|
|
51
|
-
|
|
52
|
-
const content = (props) => (
|
|
53
|
-
<AddLinkForm
|
|
54
|
-
{...props}
|
|
55
|
-
placeholder={placeholder}
|
|
56
|
-
theme={ownTheme}
|
|
57
|
-
block="draft-js"
|
|
58
|
-
data={{ url: link || '' }}
|
|
59
|
-
onChangeBlock={() => {}}
|
|
60
|
-
onClear={() => {
|
|
61
|
-
this.props.setEditorState(
|
|
62
|
-
this.DraftEditorUtils.removeLinkAtSelection(
|
|
63
|
-
this.props.getEditorState(),
|
|
64
|
-
),
|
|
65
|
-
);
|
|
66
|
-
}}
|
|
67
|
-
onChangeValue={(url) => {
|
|
68
|
-
this.props.setEditorState(
|
|
69
|
-
this.DraftEditorUtils.createLinkAtSelection(
|
|
70
|
-
this.props.getEditorState(),
|
|
71
|
-
url,
|
|
72
|
-
),
|
|
73
|
-
);
|
|
74
|
-
}}
|
|
75
|
-
/>
|
|
76
|
-
);
|
|
77
|
-
onOverrideContent(content);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Render method.
|
|
82
|
-
* @method render
|
|
83
|
-
* @returns {string} Markup for the component.
|
|
84
|
-
*/
|
|
85
|
-
render() {
|
|
86
|
-
const { theme } = this.props;
|
|
87
|
-
const hasLinkSelected = this.EditorUtils.hasEntity(
|
|
88
|
-
this.props.getEditorState(),
|
|
89
|
-
'LINK',
|
|
90
|
-
);
|
|
91
|
-
const className = hasLinkSelected
|
|
92
|
-
? cx(theme.button, theme.active)
|
|
93
|
-
: theme.button;
|
|
94
|
-
|
|
95
|
-
return (
|
|
96
|
-
<div
|
|
97
|
-
className={theme.buttonWrapper}
|
|
98
|
-
onMouseDown={this.onMouseDown}
|
|
99
|
-
role="presentation"
|
|
100
|
-
>
|
|
101
|
-
<button
|
|
102
|
-
className={className}
|
|
103
|
-
onClick={
|
|
104
|
-
this.onAddLinkClick
|
|
105
|
-
// hasLinkSelected
|
|
106
|
-
// ? () =>
|
|
107
|
-
// onRemoveLinkAtSelection(
|
|
108
|
-
// this.props.setEditorState,
|
|
109
|
-
// this.props.getEditorState,
|
|
110
|
-
// )
|
|
111
|
-
// : this.onAddLinkClick
|
|
112
|
-
}
|
|
113
|
-
type="button"
|
|
114
|
-
>
|
|
115
|
-
{!hasLinkSelected ? (
|
|
116
|
-
<Icon name={linkSVG} size="24px" />
|
|
117
|
-
) : (
|
|
118
|
-
<Icon name={unlinkSVG} size="24px" />
|
|
119
|
-
)}
|
|
120
|
-
</button>
|
|
121
|
-
</div>
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export default injectLazyLibs(['draftJs', 'draftJsPluginsUtils'])(LinkButton);
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import decorateComponentWithProps from 'decorate-component-with-props';
|
|
2
|
-
|
|
3
|
-
import DefaultLink from './components/Link';
|
|
4
|
-
import LinkButton from './components/LinkButton';
|
|
5
|
-
import linkStrategy, { matchesEntityType } from './linkStrategy';
|
|
6
|
-
|
|
7
|
-
function unboundRemoveEntity(editorState) {
|
|
8
|
-
const contentState = editorState.getCurrentContent();
|
|
9
|
-
const selectionState = editorState.getSelection();
|
|
10
|
-
const startKey = selectionState.getStartKey();
|
|
11
|
-
const contentBlock = contentState.getBlockForKey(startKey);
|
|
12
|
-
const startOffset = selectionState.getStartOffset();
|
|
13
|
-
const entity = contentBlock.getEntityAt(startOffset);
|
|
14
|
-
|
|
15
|
-
if (!entity) {
|
|
16
|
-
return editorState;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let entitySelection = null;
|
|
20
|
-
|
|
21
|
-
contentBlock.findEntityRanges(
|
|
22
|
-
(character) => character.getEntity() === entity,
|
|
23
|
-
(start, end) => {
|
|
24
|
-
entitySelection = selectionState.merge({
|
|
25
|
-
anchorOffset: start,
|
|
26
|
-
focusOffset: end,
|
|
27
|
-
isBackward: false,
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const newContentState = this.Modifier.applyEntity(
|
|
33
|
-
contentState,
|
|
34
|
-
entitySelection,
|
|
35
|
-
null,
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
const newEditorState = this.EditorState.push(
|
|
39
|
-
editorState,
|
|
40
|
-
newContentState,
|
|
41
|
-
'apply-entity',
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
return newEditorState;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default function AnchorPlugin(config = {}) {
|
|
48
|
-
// ToDo: Get rif of the remainings of having the original CSS modules
|
|
49
|
-
const defaultTheme = {};
|
|
50
|
-
|
|
51
|
-
const {
|
|
52
|
-
theme = defaultTheme,
|
|
53
|
-
placeholder,
|
|
54
|
-
Link,
|
|
55
|
-
linkTarget,
|
|
56
|
-
libraries,
|
|
57
|
-
} = config;
|
|
58
|
-
|
|
59
|
-
const removeEntity = unboundRemoveEntity.bind(libraries);
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
decorators: [
|
|
63
|
-
{
|
|
64
|
-
strategy: linkStrategy,
|
|
65
|
-
matchesEntityType,
|
|
66
|
-
component:
|
|
67
|
-
Link ||
|
|
68
|
-
decorateComponentWithProps(DefaultLink, {
|
|
69
|
-
className: 'link-anchorlink-theme',
|
|
70
|
-
target: linkTarget,
|
|
71
|
-
}),
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
|
|
75
|
-
LinkButton: decorateComponentWithProps(LinkButton, {
|
|
76
|
-
ownTheme: theme,
|
|
77
|
-
placeholder,
|
|
78
|
-
onRemoveLinkAtSelection: (setEditorState, getEditorState) =>
|
|
79
|
-
setEditorState(removeEntity(getEditorState())),
|
|
80
|
-
}),
|
|
81
|
-
};
|
|
82
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export const matchesEntityType = (type) => type === 'LINK';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @export strategy
|
|
7
|
-
* @param {*} contentBlock contentBlock
|
|
8
|
-
* @param {*} cb cb
|
|
9
|
-
* @param {*} contentState contentState
|
|
10
|
-
* @returns {*} string
|
|
11
|
-
*/
|
|
12
|
-
export default function strategy(contentBlock, cb, contentState) {
|
|
13
|
-
if (!contentState) return;
|
|
14
|
-
contentBlock.findEntityRanges((character) => {
|
|
15
|
-
const entityKey = character.getEntity();
|
|
16
|
-
return (
|
|
17
|
-
entityKey !== null &&
|
|
18
|
-
matchesEntityType(contentState.getEntity(entityKey).getType())
|
|
19
|
-
);
|
|
20
|
-
}, cb);
|
|
21
|
-
}
|