@eeacms/volto-cca-policy 0.3.131 → 1.0.1
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/.eslintrc.js +7 -7
- package/CHANGELOG.md +44 -14
- package/docker-compose.yml +16 -16
- package/jest-addon.config.js +25 -420
- package/package.json +1 -2
- package/src/components/MigrationButtons.jsx +5 -1
- package/src/components/manage/Blocks/ASTNavigation/ASTNavigationEdit.jsx +2 -1
- package/src/components/manage/Blocks/ASTNavigation/ASTNavigationView.jsx +10 -4
- package/src/components/manage/Blocks/ASTNavigation/ASTNavigationView.test.jsx +87 -35
- package/src/components/manage/Blocks/C3SIndicatorsGlossaryBlock/C3SIndicatorsGlossaryBlockEdit.jsx +1 -1
- package/src/components/manage/Blocks/C3SIndicatorsGlossaryBlock/C3SIndicatorsGlossaryBlockView.test.jsx +1 -1
- package/src/components/manage/Blocks/C3SIndicatorsListingBlock/C3SIndicatorsListingBlockEdit.jsx +1 -1
- package/src/components/manage/Blocks/C3SIndicatorsListingBlock/C3SIndicatorsListingBlockView.jsx +1 -1
- package/src/components/manage/Blocks/C3SIndicatorsListingBlock/C3SIndicatorsListingBlockView.test.jsx +1 -1
- package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/C3SIndicatorsOverviewBlockEdit.jsx +1 -1
- package/src/components/manage/Blocks/C3SIndicatorsOverviewBlock/schema.js +0 -20
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerEdit.test.jsx +1 -1
- package/src/components/manage/Blocks/CaseStudyExplorer/{CaseStudyExplorerView.js → CaseStudyExplorerView.jsx} +1 -1
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyExplorerView.test.jsx +2 -2
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyFilters.test.jsx +1 -1
- package/src/components/manage/Blocks/CaseStudyExplorer/CaseStudyMap.test.jsx +1 -1
- package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.jsx +2 -1
- package/src/components/manage/Blocks/CaseStudyExplorer/FeatureDisplay.test.jsx +1 -1
- package/src/components/manage/Blocks/CaseStudyExplorer/styles.less +0 -4
- package/src/components/manage/Blocks/CaseStudyExplorer/utils.js +0 -30
- package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsEdit.jsx +1 -1
- package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.jsx +3 -2
- package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.test.jsx +1 -1
- package/src/components/manage/Blocks/ContentLinks/ContentLinksEdit.jsx +1 -1
- package/src/components/manage/Blocks/ContentLinks/ContentLinksView.jsx +1 -1
- package/src/components/manage/Blocks/ContentLinks/ContentLinksView.test.jsx +1 -1
- package/src/components/manage/Blocks/ContentLinks/DropdownListView.jsx +1 -1
- package/src/components/manage/Blocks/ContentLinks/DropdownListView.test.jsx +1 -1
- package/src/components/manage/Blocks/CountryMapHeatIndex/Filter.test.jsx +1 -1
- package/src/components/manage/Blocks/CountryMapHeatIndex/{View.js → View.jsx} +14 -10
- package/src/components/manage/Blocks/CountryMapHeatIndex/mapstyle.js +1 -3
- package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryEdit.jsx +2 -1
- package/src/components/manage/Blocks/CountryMapObservatory/CountryMapObservatoryOLView.jsx +4 -3
- package/src/components/manage/Blocks/CountryMapProfile/Filter.test.jsx +1 -1
- package/src/components/manage/Blocks/CountryMapProfile/OLView.jsx +5 -12
- package/src/components/manage/Blocks/CountryProfileDetail/{CountryTabPane.js → CountryTabPane.jsx} +11 -4
- package/src/components/manage/Blocks/CountryProfileDetail/CountryTabPane.test.jsx +1 -1
- package/src/components/manage/Blocks/CountryProfileDetail/{View.js → View.jsx} +20 -15
- package/src/components/manage/Blocks/CountryProfileDetail/View.test.jsx +134 -20
- package/src/components/manage/Blocks/CountryProfileDetail/index.js +0 -1
- package/src/components/manage/Blocks/DataConnectedEmbedBlock/index.js +0 -2
- package/src/components/manage/Blocks/ECDEIndicators/ECDEIndicatorsView.jsx +1 -1
- package/src/components/manage/Blocks/FilterAceContent/FilterAceContentEdit.jsx +3 -3
- package/src/components/manage/Blocks/FilterAceContent/FilterAceContentView.jsx +2 -2
- package/src/components/manage/Blocks/FilterAceContent/FilterAceContentView.test.jsx +1 -1
- package/src/components/manage/Blocks/FlourishEmbedBlock/FlourishEmbedBlockEdit.jsx +1 -1
- package/src/components/manage/Blocks/Listing/DropdownListingView.jsx +1 -1
- package/src/components/manage/Blocks/Listing/EventAccordionListingView.jsx +1 -1
- package/src/components/manage/Blocks/Listing/EventAccordionListingView.test.jsx +5 -3
- package/src/components/manage/Blocks/Listing/EventCardsListingView.jsx +2 -1
- package/src/components/manage/Blocks/Listing/EventCardsListingView.test.jsx +10 -4
- package/src/components/manage/Blocks/Listing/IndicatorCardsListingView.jsx +2 -2
- package/src/components/manage/Blocks/Listing/OrganisationCardsListingView.jsx +3 -1
- package/src/components/manage/Blocks/Listing/SimpleCardsListingView.jsx +1 -1
- package/src/components/manage/Blocks/Listing/SimpleCardsListingView.test.jsx +5 -3
- package/src/components/manage/Blocks/Listing/SimpleItemListingView.jsx +2 -2
- package/src/components/manage/Blocks/Listing/SimpleItemListingView.test.jsx +6 -4
- package/src/components/manage/Blocks/RASTBlock/ContextNavigation.jsx +0 -1
- package/src/components/manage/Blocks/RASTBlock/RASTAccordion.jsx +1 -1
- package/src/components/manage/Blocks/RASTBlock/RASTAccordion.test.jsx +1 -1
- package/src/components/manage/Blocks/RASTBlock/RASTAccordionContent.jsx +2 -2
- package/src/components/manage/Blocks/RASTBlock/RASTEdit.jsx +1 -1
- package/src/components/manage/Blocks/RASTBlock/RASTMap.jsx +1 -1
- package/src/components/manage/Blocks/RASTBlock/RASTMap.test.jsx +1 -1
- package/src/components/manage/Blocks/RASTBlock/RASTView.jsx +1 -1
- package/src/components/manage/Blocks/ReadMore/ReadMoreEdit.jsx +1 -1
- package/src/components/manage/Blocks/ReadMore/ReadMoreView.jsx +1 -1
- package/src/components/manage/Blocks/ReadMore/ReadMoreView.test.jsx +1 -1
- package/src/components/manage/Blocks/RedirectBlock/{RedirectBlock.test.js → RedirectBlock.test.jsx} +1 -1
- package/src/components/manage/Blocks/RedirectBlock/RedirectBlockEdit.jsx +2 -1
- package/src/components/manage/Blocks/RedirectBlock/RedirectBlockView.jsx +2 -2
- package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentEdit.jsx +1 -1
- package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentView.jsx +1 -1
- package/src/components/manage/Blocks/RelevantAceContent/RelevantAceContentView.test.jsx +1 -1
- package/src/components/manage/Blocks/SearchAceContent/SearchAceContentEdit.jsx +1 -1
- package/src/components/manage/Blocks/SearchAceContent/SearchAceContentView.jsx +1 -1
- package/src/components/manage/Blocks/SearchAceContent/SearchAceContentView.test.jsx +1 -1
- package/src/components/manage/Blocks/TabsBlock/Spotlight.jsx +2 -2
- package/src/components/manage/Blocks/TabsBlock/Spotlight.test.jsx +7 -1
- package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectEdit.jsx +1 -1
- package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectView.jsx +1 -1
- package/src/components/manage/Blocks/TransRegionSelect/TransRegionSelectView.test.jsx +1 -1
- package/src/components/manage/CreateArchivedCopyButton/CreateArchivedCopyButton.jsx +5 -2
- package/src/components/manage/CreateArchivedCopyButton/CreateArchivedCopyButton.test.jsx +3 -6
- package/src/components/manage/Workflow/WorkflowLinkIntegrityModal.jsx +1 -1
- package/src/components/manage/Workflow/WorkflowLinkIntegrityModal.test.jsx +1 -1
- package/src/components/theme/ASTNavigation/ASTAccordion.test.jsx +1 -1
- package/src/components/theme/ASTNavigation/ASTLogoMap.jsx +1 -1
- package/src/components/theme/ASTNavigation/ASTLogoMap.test.jsx +1 -1
- package/src/components/theme/ASTNavigation/ASTNavigation.jsx +9 -5
- package/src/components/theme/ASTNavigation/ASTNavigation.test.jsx +323 -0
- package/src/components/theme/ASTNavigation/{utils.js → LinkWrap.jsx} +4 -9
- package/src/components/theme/ASTNavigation/UASTLogoMap.jsx +1 -1
- package/src/components/theme/ASTNavigation/UASTLogoMap.test.jsx +1 -1
- package/src/components/theme/Header/Header.jsx +5 -5
- package/src/components/theme/Header/LanguageSwitch.jsx +5 -5
- package/src/components/theme/MissionSignatoryProfile/MissionSignatoryProfileView.jsx +1 -1
- package/src/components/theme/TranslationDisclaimer/TranslationDisclaimer.jsx +1 -1
- package/src/components/theme/TranslationDisclaimer/TranslationInfo.jsx +1 -1
- package/src/components/theme/Views/AdaptationOptionView.jsx +1 -1
- package/src/components/theme/Views/AdaptationOptionView.test.jsx +5 -3
- package/src/components/theme/Views/ArchivedVersionListing.jsx +1 -1
- package/src/components/theme/Views/ArchivedVersionListing.test.jsx +2 -2
- package/src/components/theme/Views/ArchivedVersionNotice.jsx +1 -1
- package/src/components/theme/Views/ArchivedVersionNotice.test.jsx +1 -1
- package/src/components/theme/Views/BrokenLinks.jsx +1 -1
- package/src/components/theme/Views/BrokenLinks.test.jsx +1 -1
- package/src/components/theme/Views/CaseStudyView.test.jsx +1 -1
- package/src/components/theme/Views/DatabaseItemView.test.jsx +1 -1
- package/src/components/theme/Views/NewsItemView.jsx +1 -1
- package/src/components/theme/Views/ProjectView.test.jsx +1 -1
- package/src/components/theme/Views/VersionsGroup.jsx +1 -1
- package/src/components/theme/Views/VersionsGroup.test.jsx +1 -1
- package/src/components/theme/Widgets/GeocharsWidget.jsx +1 -1
- package/src/components/theme/Widgets/GeolocationWidget.jsx +1 -1
- package/src/components/theme/Widgets/GeolocationWidget.test.jsx +1 -1
- package/src/components/theme/Widgets/ImageWidget.jsx +29 -13
- package/src/components/theme/Widgets/ImageWidget.test.jsx +1 -1
- package/src/components/theme/Widgets/PromotionalImageWidget.jsx +6 -4
- package/src/components/theme/Widgets/utils.js +1 -1
- package/src/constants.js +539 -2
- package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/Header.jsx +1 -1
- package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderMenuPopUp.js +52 -24
- package/src/customizations/@eeacms/volto-eea-design-system/ui/Header/HeaderSearchPopUp.js +1 -0
- package/src/customizations/@eeacms/volto-eea-website-theme/components/theme/DraftBackground/DraftBackground.jsx +2 -1
- package/src/customizations/@eeacms/volto-listing-block/blocks/Listing/item-templates/SimpleItemTemplates.jsx +2 -2
- package/src/customizations/@eeacms/volto-listing-block/components/UniversalCard/fragments/CardTitle.jsx +1 -1
- package/src/customizations/@plone/volto-slate/blocks/Table/TableBlockView.jsx +3 -3
- package/src/customizations/@plone/volto-slate/blocks/Text/{index.js → index.jsx} +2 -21
- package/src/customizations/@plone/volto-slate/editor/extensions/normalizeNode.js +1 -1
- package/src/customizations/@plone/volto-slate/utils/blocks.js +11 -8
- package/src/customizations/@plone/volto-slate/utils/volto-blocks.js +2 -2
- package/src/customizations/@plone/volto-slate/widgets/HtmlSlateWidget.jsx +2 -2
- package/src/customizations/@plone-collective/volto-authomatic/components/Login/Login.jsx +7 -4
- package/src/customizations/@plone-collective/volto-rss-provider/components/RSSFeedView.jsx +5 -8
- package/src/customizations/@plone-collective/volto-rss-provider/express-middleware.js +2 -1
- package/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +3 -3
- package/src/customizations/volto/components/manage/Blocks/Grid/templates.js +1 -1
- package/src/customizations/volto/components/manage/Contents/ContentsBreadcrumbs.jsx +1 -1
- package/src/customizations/volto/components/manage/Controlpanels/ContentTypeLayout.jsx +12 -14
- package/src/customizations/volto/components/manage/Display/Display.jsx +10 -5
- package/src/customizations/volto/components/manage/Multilingual/TranslationObject.jsx +7 -6
- package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.jsx +4 -1
- package/src/customizations/volto/components/manage/Workflow/Workflow.jsx +12 -8
- package/src/customizations/volto/components/theme/App/App.jsx +16 -23
- package/src/customizations/volto/components/theme/Sitemap/Sitemap.jsx +3 -2
- package/src/customizations/volto/components/theme/View/DefaultView.jsx +5 -4
- package/src/customizations/volto/components/theme/View/LinkView.jsx +2 -2
- package/src/customizations/volto/components/theme/View/View.jsx +10 -11
- package/src/customizations/volto/helpers/Url/Url-old.js +2 -1
- package/src/customizations/volto/middleware/api.js +6 -4
- package/src/customizations/volto/reducers/actions/actions.js +2 -5
- package/src/customizations/volto/reducers/breadcrumbs/breadcrumbs.js +3 -6
- package/src/customizations/volto/reducers/navigation/navigation.js +3 -6
- package/src/customizations/volto/server.jsx +9 -8
- package/src/express-middleware.js +1 -1
- package/src/helpers/ContentMetadata.jsx +4 -4
- package/src/helpers/Utils.jsx +5 -5
- package/src/helpers/index.js +1 -8
- package/src/hocs/index.js +2 -0
- package/src/index.js +9 -7
- package/src/search/common.js +4 -41
- package/src/search/utils.test.js +1 -1
- package/src/search/vocabulary.js +2 -2
- package/src/store/reducers/physical-breadcrumbs.js +2 -2
- package/src/utils.js +1 -1
- package/src/helpers/Constants.jsx +0 -535
- package/theme/assets/images/administrative_support_service.png +0 -0
- /package/src/components/manage/Blocks/CaseStudyExplorer/{CaseStudyExplorerEdit.js → CaseStudyExplorerEdit.jsx} +0 -0
- /package/src/components/manage/Blocks/CountryMapHeatIndex/{Edit.js → Edit.jsx} +0 -0
- /package/src/components/manage/Blocks/CountryMapProfile/{Edit.js → Edit.jsx} +0 -0
- /package/src/components/manage/Blocks/CountryProfileDetail/{Edit.js → Edit.jsx} +0 -0
- /package/src/components/manage/Blocks/ReadMore/{schema.js → schema.jsx} +0 -0
- /package/src/helpers/{clientOnly.js → clientOnly.jsx} +0 -0
- /package/src/{components/manage/Blocks/withResponsiveContainer.js → hocs/withResponsiveContainer.jsx} +0 -0
- /package/src/{components/manage/Blocks → hocs}/withVisibilitySensor.jsx +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MemoryRouter } from 'react-router-dom';
|
|
2
2
|
import configureStore from 'redux-mock-store';
|
|
3
|
-
import '@testing-library/jest-dom
|
|
3
|
+
import '@testing-library/jest-dom';
|
|
4
4
|
import { render, waitFor } from '@testing-library/react';
|
|
5
5
|
import { Provider } from 'react-intl-redux';
|
|
6
6
|
import { BrokenLinksComponent } from './BrokenLinks';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MemoryRouter } from 'react-router-dom';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
|
-
import '@testing-library/jest-dom
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
5
|
import { Provider } from 'react-intl-redux';
|
|
6
6
|
import CaseStudyView from './CaseStudyView';
|
|
7
7
|
import renderer from 'react-test-renderer';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MemoryRouter } from 'react-router-dom';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
|
-
import '@testing-library/jest-dom
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
5
|
import { Provider } from 'react-intl-redux';
|
|
6
6
|
import DatabaseItemView from './DatabaseItemView';
|
|
7
7
|
import renderer from 'react-test-renderer';
|
|
@@ -4,7 +4,7 @@ import { filterBlocks } from '@eeacms/volto-cca-policy/utils';
|
|
|
4
4
|
import { HTMLField, SubjectTags } from '@eeacms/volto-cca-policy/helpers';
|
|
5
5
|
import { PortalMessage } from '@eeacms/volto-cca-policy/components';
|
|
6
6
|
import RenderBlocks from '@plone/volto/components/theme/View/RenderBlocks';
|
|
7
|
-
import
|
|
7
|
+
import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
|
|
8
8
|
|
|
9
9
|
const DescriptionText = ({ content }) => {
|
|
10
10
|
return (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MemoryRouter } from 'react-router-dom';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
|
-
import '@testing-library/jest-dom
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
5
|
import { Provider } from 'react-intl-redux';
|
|
6
6
|
import ProjectView from './ProjectView';
|
|
7
7
|
import renderer from 'react-test-renderer';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Link } from 'react-router-dom';
|
|
3
3
|
import { FormattedMessage } from 'react-intl';
|
|
4
|
-
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
4
|
+
import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
|
|
5
5
|
|
|
6
6
|
function VersionsGroup({ content }) {
|
|
7
7
|
const relatedItems = content?.relatedItems || [];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MemoryRouter } from 'react-router-dom';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
|
-
import '@testing-library/jest-dom
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
5
|
import { Provider } from 'react-intl-redux';
|
|
6
6
|
import { render } from '@testing-library/react';
|
|
7
7
|
import VersionsGroup from './VersionsGroup';
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from './utils';
|
|
10
10
|
|
|
11
11
|
import { injectIntl } from 'react-intl';
|
|
12
|
-
import
|
|
12
|
+
import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper';
|
|
13
13
|
|
|
14
14
|
const SelectElement = (props) => {
|
|
15
15
|
const { element, handleSelect } = props;
|
|
@@ -4,7 +4,7 @@ import { Input, Label, Button } from 'semantic-ui-react';
|
|
|
4
4
|
import config from '@plone/volto/registry';
|
|
5
5
|
|
|
6
6
|
import { injectIntl } from 'react-intl';
|
|
7
|
-
import
|
|
7
|
+
import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper';
|
|
8
8
|
import MapContainer from '@eeacms/volto-cca-policy/components/theme/Widgets/GeolocationWidgetMapContainer';
|
|
9
9
|
|
|
10
10
|
const defaultValue = {
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { MemoryRouter } from 'react-router-dom';
|
|
3
3
|
import configureStore from 'redux-mock-store';
|
|
4
4
|
import { render } from '@testing-library/react';
|
|
5
|
-
import '@testing-library/jest-dom
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
6
|
import { Provider } from 'react-intl-redux';
|
|
7
7
|
|
|
8
8
|
import GeolocationWidget from './GeolocationWidget';
|
|
@@ -7,13 +7,12 @@ import useLinkEditor from '@plone/volto/components/manage/AnchorPlugin/useLinkEd
|
|
|
7
7
|
import withObjectBrowser from '@plone/volto/components/manage/Sidebar/ObjectBrowser';
|
|
8
8
|
import NativeImageWidget from '@plone/volto/components/manage/Widgets/ImageWidget';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
isInternalURL,
|
|
13
|
-
validateFileUploadSize,
|
|
14
|
-
} from '@plone/volto/helpers';
|
|
10
|
+
import { flattenToAppURL, isInternalURL } from '@plone/volto/helpers/Url/Url';
|
|
11
|
+
import { validateFileUploadSize } from '@plone/volto/helpers/FormValidation/FormValidation';
|
|
15
12
|
import { readAsDataURL } from 'promise-file-reader';
|
|
16
|
-
import
|
|
13
|
+
import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper';
|
|
14
|
+
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
15
|
+
import Image from '@plone/volto/components/theme/Image/Image';
|
|
17
16
|
|
|
18
17
|
import imageBlockSVG from '@plone/volto/components/manage/Blocks/Image/block-image.svg';
|
|
19
18
|
import deleteSVG from '@plone/volto/icons/delete.svg';
|
|
@@ -117,13 +116,30 @@ const getImageFilename = (value) => {
|
|
|
117
116
|
};
|
|
118
117
|
|
|
119
118
|
const parseDataURL = (dataUrl) => {
|
|
120
|
-
const
|
|
121
|
-
|
|
119
|
+
const DATA_URL_PREFIX = 'data:';
|
|
120
|
+
|
|
121
|
+
if (typeof dataUrl !== 'string' || !dataUrl.startsWith(DATA_URL_PREFIX)) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const start = DATA_URL_PREFIX.length;
|
|
126
|
+
const dataSeparator = dataUrl.indexOf(',', start);
|
|
127
|
+
|
|
128
|
+
if (dataSeparator === -1) return null;
|
|
129
|
+
|
|
130
|
+
const encodingSeparator = dataUrl.lastIndexOf(';', dataSeparator);
|
|
131
|
+
|
|
132
|
+
if (encodingSeparator < start) return null;
|
|
133
|
+
|
|
134
|
+
const contentType = dataUrl.slice(start, encodingSeparator);
|
|
135
|
+
const encoding = dataUrl.slice(encodingSeparator + 1, dataSeparator);
|
|
136
|
+
|
|
137
|
+
if (!contentType || !encoding) return null;
|
|
122
138
|
|
|
123
139
|
return {
|
|
124
|
-
'content-type':
|
|
125
|
-
encoding
|
|
126
|
-
data:
|
|
140
|
+
'content-type': contentType,
|
|
141
|
+
encoding,
|
|
142
|
+
data: dataUrl.slice(dataSeparator + 1),
|
|
127
143
|
};
|
|
128
144
|
};
|
|
129
145
|
|
|
@@ -431,7 +447,7 @@ const UnconnectedImageInput = (props) => {
|
|
|
431
447
|
)}
|
|
432
448
|
{error && <Message negative>{error}</Message>}
|
|
433
449
|
{previewSrc ? (
|
|
434
|
-
<
|
|
450
|
+
<Image className={props.className} src={previewSrc} alt="" />
|
|
435
451
|
) : (
|
|
436
452
|
<Message warning>
|
|
437
453
|
Existing value found, but no image preview could be resolved.
|
|
@@ -470,7 +486,7 @@ const UnconnectedImageInput = (props) => {
|
|
|
470
486
|
</Dimmer>
|
|
471
487
|
)}
|
|
472
488
|
{error && <Message negative>{error}</Message>}
|
|
473
|
-
<
|
|
489
|
+
<Image src={imageBlockSVG} alt="" className="placeholder" />
|
|
474
490
|
<p>{intl.formatMessage(messages.addImage)}</p>
|
|
475
491
|
{toolbar}
|
|
476
492
|
</Message>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MemoryRouter } from 'react-router-dom';
|
|
3
3
|
import { render } from '@testing-library/react';
|
|
4
|
-
import '@testing-library/jest-dom
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
5
|
import { Provider } from 'react-intl-redux';
|
|
6
6
|
import configureStore from 'redux-mock-store';
|
|
7
7
|
|
|
@@ -11,9 +11,11 @@ import { Button, Image, Dimmer } from 'semantic-ui-react';
|
|
|
11
11
|
import { readAsDataURL } from 'promise-file-reader';
|
|
12
12
|
import { injectIntl } from 'react-intl';
|
|
13
13
|
import deleteSVG from '@plone/volto/icons/delete.svg';
|
|
14
|
-
import
|
|
14
|
+
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
15
|
+
import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper';
|
|
15
16
|
import loadable from '@loadable/component';
|
|
16
|
-
import { flattenToAppURL
|
|
17
|
+
import { flattenToAppURL } from '@plone/volto/helpers/Url/Url';
|
|
18
|
+
import { validateFileUploadSize } from '@plone/volto/helpers/FormValidation/FormValidation';
|
|
17
19
|
import { defineMessages, useIntl } from 'react-intl';
|
|
18
20
|
|
|
19
21
|
const imageMimetypes = [
|
|
@@ -104,8 +106,8 @@ const FileWidget = (props) => {
|
|
|
104
106
|
const imgsrc = value?.download
|
|
105
107
|
? `${flattenToAppURL(value?.download)}?id=${Date.now()}`
|
|
106
108
|
: value?.data
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
? `data:${value['content-type']};${value.encoding},${value.data}`
|
|
110
|
+
: null;
|
|
109
111
|
|
|
110
112
|
/**
|
|
111
113
|
* Drop handler
|