diff --git a/frontend/mrs.developer.json b/frontend/mrs.developer.json index 6320943c..479b13fa 100644 --- a/frontend/mrs.developer.json +++ b/frontend/mrs.developer.json @@ -1,61 +1,5 @@ { "volto-plonede": { "local": "addons/volto-plonede/src" - }, - "volto-slider-block": { - "develop": false, - "package": "@kitconcept/volto-slider-block", - "url": "git@github.com:kitconcept/volto-slider-block.git", - "https": "https://github.com/kitconcept/volto-slider-block.git", - "path": "src", - "branch": "master" - }, - "volto-heading-block": { - "develop": false, - "package": "@kitconcept/volto-heading-block", - "url": "git@github.com:kitconcept/volto-heading-block.git", - "https": "https://github.com/kitconcept/volto-heading-block.git", - "path": "src", - "branch": "master" - }, - "volto-blocks-grid": { - "develop": false, - "package": "@kitconcept/volto-blocks-grid", - "url": "git@github.com:kitconcept/volto-blocks-grid.git", - "https": "https://github.com/kitconcept/volto-blocks-grid.git", - "path": "src", - "branch": "main" - }, - "volto-button-block": { - "develop": false, - "package": "@kitconcept/volto-button-block", - "url": "git@github.com:kitconcept/volto-button-block.git", - "https": "https://github.com/kitconcept/volto-button-block.git", - "path": "src", - "branch": "master" - }, - "volto-separator-block": { - "develop": false, - "package": "@kitconcept/volto-separator-block", - "url": "git@github.com:kitconcept/volto-separator-block.git", - "https": "https://github.com/kitconcept/volto-separator-block.git", - "path": "src", - "branch": "main" - }, - "volto-introduction-block": { - "develop": false, - "package": "@kitconcept/volto-introduction-block", - "url": "git@github.com:kitconcept/volto-introduction-block.git", - "https": "https://github.com/kitconcept/volto-introduction-block.git", - "path": "src", - "branch": "main" - }, - "volto-dsgvo-banner": { - "develop": false, - "package": "@kitconcept/volto-dsgvo-banner", - "url": "git@github.com:kitconcept/volto-dsgvo-banner.git", - "https": "https://github.com/kitconcept/volto-dsgvo-banner.git", - "path": "src", - "branch": "master" } } diff --git a/frontend/package.json b/frontend/package.json index c7a7efab..c4aee40f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -27,7 +27,6 @@ "addons": [ "@eeacms/volto-accordion-block", "@eeacms/volto-matomo", - "@kitconcept/volto-blocks-grid", "@kitconcept/volto-button-block", "@kitconcept/volto-dsgvo-banner", "@kitconcept/volto-export", @@ -36,6 +35,7 @@ "@kitconcept/volto-separator-block", "@kitconcept/volto-slider-block", "@plone-collective/volto-authomatic", + "@kitconcept/volto-light-theme", "volto-form-block", "volto-plonede" ], @@ -142,7 +142,6 @@ "dependencies": { "@eeacms/volto-accordion-block": "10.3.0", "@eeacms/volto-matomo": "4.1.3", - "@kitconcept/volto-blocks-grid": "8.0.3", "@kitconcept/volto-button-block": "2.3.1", "@kitconcept/volto-dsgvo-banner": "2.2.0", "@kitconcept/volto-export": "1.1.0", diff --git a/frontend/src/addons/volto-plonede/src/components/index.js b/frontend/src/addons/volto-plonede/src/components/index.js deleted file mode 100644 index cf9a47fa..00000000 --- a/frontend/src/addons/volto-plonede/src/components/index.js +++ /dev/null @@ -1,23 +0,0 @@ -import { ButtonBlockSchemaEnhancer } from './manage/Blocks/ButtonBlockEnhancer'; -import { DefaultStylingSchemaEnhancer } from './manage/Blocks/DefaultStylingEnhancer'; -import { HeadingBlockSchemaEnhancer } from './manage/Blocks/HeadingBlockEnhancer'; -import { HeroBlockSchemaEnhancer } from './manage/Blocks/HeroBlockEnhancer'; -import { ImageBlockSchemaEnhancer } from './manage/Blocks/ImageBlockEnhancer'; -import { ListingBlockSchemaEnhancer } from './manage/Blocks/ListingBlockEnhancer'; -import { SliderBlockSchemaEnhancer } from './manage/Blocks/SliderBlockEnhancer'; -import { TeaserBlockSchemaEnhancer } from './manage/Blocks/TeaserBlockEnhancer'; -import { VideoBlockSchemaEnhancer } from './manage/Blocks/VideoBlockEnhancer'; -import EventTemplate from './manage/Blocks/Listing/EventTemplate'; - -export { - ButtonBlockSchemaEnhancer, - DefaultStylingSchemaEnhancer, - HeadingBlockSchemaEnhancer, - HeroBlockSchemaEnhancer, - ImageBlockSchemaEnhancer, - ListingBlockSchemaEnhancer, - SliderBlockSchemaEnhancer, - TeaserBlockSchemaEnhancer, - VideoBlockSchemaEnhancer, - EventTemplate, -}; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/ButtonBlockEnhancer.js b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/ButtonBlockEnhancer.js deleted file mode 100644 index f91c59bc..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/ButtonBlockEnhancer.js +++ /dev/null @@ -1,42 +0,0 @@ -import { defineMessages } from 'react-intl'; - -const messages = defineMessages({ - backgroundColor: { - id: 'Background color', - defaultMessage: 'Background color', - }, - newTab: { - id: 'Open in new tab', - defaultMessage: 'Open in new tab', - }, - outerAlign: { - id: 'Alignment', - defaultMessage: 'Alignment', - }, -}); -export const ButtonBlockSchemaEnhancer = ({ schema, intl }) => { - //Color - const colors = [ - { name: 'white', label: 'White' }, - { name: 'blue', label: 'Blue' }, - ]; - schema.properties.backgroundColor = { - widget: 'color_picker', - title: intl.formatMessage(messages.backgroundColor), - colors, - default: 'blue', - }; - schema.properties.outerAlign = { - widget: 'align', - title: intl.formatMessage(messages.outerAlign), - actions: ['center', 'wide'], - default: 'wide', - }; - - const arr = schema.fieldsets[0].fields; - arr.splice(2, 0, 'outerAlign'); - arr.push('backgroundColor'); - schema.fieldsets[0].fields = arr; - - return schema; -}; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/DefaultStylingEnhancer.js b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/DefaultStylingEnhancer.js deleted file mode 100644 index d7e48522..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/DefaultStylingEnhancer.js +++ /dev/null @@ -1,37 +0,0 @@ -import { addStyling } from '@plone/volto/helpers/Extensions/withBlockSchemaEnhancer'; -import { defineMessages } from 'react-intl'; -import config from '@plone/volto/registry'; - -const messages = defineMessages({ - backgroundColor: { - id: 'Background color', - defaultMessage: 'Background color', - }, -}); - -export const DefaultStylingSchemaEnhancer = ({ schema, formData, intl }) => { - const DLR_BG_COLORS = [ - { name: 'transparent', label: 'Transparent' }, - { name: 'grey', label: 'Grey' }, - ]; - - const colors = - config.blocks?.blocksConfig?.[formData['@type']]?.colors || DLR_BG_COLORS; - - const defaultBGColor = - config.blocks?.blocksConfig?.[formData['@type']]?.defaultBGColor; - - addStyling({ schema, intl }); - - schema.properties.styles.schema.fieldsets[0].fields = [ - ...schema.properties.styles.schema.fieldsets[0].fields, - 'backgroundColor', - ]; - schema.properties.styles.schema.properties.backgroundColor = { - widget: 'color_picker', - title: intl.formatMessage(messages.backgroundColor), - colors, - default: defaultBGColor, - }; - return schema; -}; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/HeadingBlockEnhancer.js b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/HeadingBlockEnhancer.js deleted file mode 100644 index f0caa042..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/HeadingBlockEnhancer.js +++ /dev/null @@ -1,10 +0,0 @@ -export const HeadingBlockSchemaEnhancer = ({ schema }) => { - schema.properties.align = { - title: 'Align', - widget: 'align', - actions: ['left', 'center', 'right'], - default: 'left', - }; - schema.fieldsets[0].fields = [...schema.fieldsets[0].fields, ...['align']]; - return schema; -}; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/HeroBlockEnhancer.js b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/HeroBlockEnhancer.js deleted file mode 100644 index ce4f9f05..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/HeroBlockEnhancer.js +++ /dev/null @@ -1,75 +0,0 @@ -import { defineMessages } from 'react-intl'; - -const messages = defineMessages({ - //Button - buttonColor: { - id: 'Button color', - defaultMessage: 'Button color', - }, - buttonText: { - id: 'Button text', - defaultMessage: 'Button text', - }, - - //Backgroundcolor - backgroundColor: { - id: 'Background color', - defaultMessage: 'Background color', - }, - showButton: { - id: 'Show button', - defineMessage: 'Show button', - }, - buttonSettings: { - id: 'Button settings', - defineMessage: 'Button settings', - }, -}); - -export const HeroBlockSchemaEnhancer = ({ schema, formData, intl }) => { - //Alignment - schema.properties.align = { - title: 'Align', - widget: 'align', - actions: ['left', 'right'], - default: 'left', - }; - - //Button - schema.properties.showButton = { - type: 'boolean', - default: false, - title: intl.formatMessage(messages.showButton), - }; - - const buttonColors = [ - { name: 'white', label: 'White' }, - { name: 'blue', label: 'Blue' }, - ]; - schema.properties.buttonColor = { - widget: 'color_picker', - title: intl.formatMessage(messages.buttonColor), - colors: buttonColors, - default: 'blue', - }; - schema.properties.buttonText = { - title: intl.formatMessage(messages.buttonText), - }; - - schema.fieldsets[0].fields = ['align']; - - schema.fieldsets = [ - ...schema.fieldsets, - { - id: 'button settings', - title: intl.formatMessage(messages.buttonSettings), - fields: [ - ...(formData.showButton - ? ['showButton', 'linkHref', 'buttonText', 'buttonColor'] - : ['showButton']), - ], - }, - ]; - - return schema; -}; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/ImageBlockEnhancer.js b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/ImageBlockEnhancer.js deleted file mode 100644 index ca721a8c..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/ImageBlockEnhancer.js +++ /dev/null @@ -1,63 +0,0 @@ -import { defineMessages } from 'react-intl'; - -const messages = defineMessages({ - title: { - id: 'Title', - defaultMessage: 'Title', - }, - credits: { - id: 'Credits', - defaultMessage: 'Credits', - }, - linkTo: { - id: 'Link to', - defineMessage: 'Link to', - }, - creditSettings: { - id: 'Credit settings', - defaultMessage: 'Credit settings', - }, - openLinkInNewTab: { - id: 'Open in new tab', - defaultMessage: 'Open in new tab', - }, -}); - -export const ImageBlockSchemaEnhancer = ({ intl, formData, schema }) => { - schema.properties.align.default = 'center'; - schema.properties.align.actions = ['left', 'right', 'center', 'wide', 'full']; - schema.properties.size.default = 'l'; - schema.properties.size.disabled = - formData.align === 'full' || - formData.align === 'wide' || - formData.align === 'center'; - - schema.properties.credits = { - title: intl.formatMessage(messages.credits), - }; - - schema.properties.title = { - title: intl.formatMessage(messages.title), - }; - - schema.properties.linkTo = { - title: intl.formatMessage(messages.linkTo), - widget: 'object_browser', - mode: 'link', - selectedItemAttrs: ['Title', 'Description', 'hasPreviewImage'], - allowExternals: true, - }; - - schema.fieldsets = [ - ...schema.fieldsets, - { - id: 'credit settings', - title: intl.formatMessage(messages.creditSettings), - fields: [...['title', 'credits', 'linkTo']], - }, - ]; - - //schema.fieldsets[0].fields = [...schema.fieldsets[0].fields, ...['']]; - - return schema; -}; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/Listing/EventTemplate.jsx b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/Listing/EventTemplate.jsx deleted file mode 100644 index ec0c7f6f..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/Listing/EventTemplate.jsx +++ /dev/null @@ -1,77 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { ConditionalLink, Component } from '@plone/volto/components'; -import { flattenToAppURL } from '@plone/volto/helpers'; -import { isInternalURL } from '@plone/volto/helpers/Url/Url'; -import FormattedDate from '@plone/volto/components/theme/FormattedDate/FormattedDate'; - -const EventTemplate = ({ items, linkTitle, linkHref, isEditMode }) => { - let link = null; - let href = linkHref?.[0]?.['@id'] || ''; - - if (isInternalURL(href)) { - link = ( - - {linkTitle || href} - - ); - } else if (href) { - link = {linkTitle || href}; - } - return ( - <> -
- {items.map((item) => ( -
- -
-
-
- {item?.start ? ( - - ) : ( - No date - )}{' '} - —  - {item?.end ? ( - - ) : ( - No date - )} -
- {item?.location ? ( -
, {item.location}
- ) : ( - <> - )} -
-

- - {item.title ? item.title : item.id} - -

-

{item.description}

-
-
- ))} -
- - {link &&
{link}
} - - ); -}; - -EventTemplate.propTypes = { - items: PropTypes.arrayOf(PropTypes.any).isRequired, - linkMore: PropTypes.any, - isEditMode: PropTypes.bool, -}; - -export default EventTemplate; - -//item.start && item.end && item.location diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/ListingBlockEnhancer.js b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/ListingBlockEnhancer.js deleted file mode 100644 index 54ab0dcb..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/ListingBlockEnhancer.js +++ /dev/null @@ -1,3 +0,0 @@ -export const ListingBlockSchemaEnhancer = ({ schema }) => { - return schema; -}; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/SliderBlockEnhancer.js b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/SliderBlockEnhancer.js deleted file mode 100644 index 9c4c7868..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/SliderBlockEnhancer.js +++ /dev/null @@ -1,38 +0,0 @@ -import { defineMessages } from 'react-intl'; - -const messages = defineMessages({ - buttonColor: { - id: 'Button color', - defaultMessage: 'Button color', - }, - buttonText: { - id: 'Button text', - defaultMessage: 'Button text', - }, - showButton: { - id: 'Show button', - defaultMessage: 'Show button', - }, - flagAlign: { - id: 'Flag alginment', - defaultMessage: 'Flag alignment', - }, -}); - -export const SliderBlockSchemaEnhancer = ({ schema, intl, formData }) => { - schema.properties.slides.schema.properties.buttonText = { - title: intl.formatMessage(messages.buttonText), - }; - schema.properties.slides.schema.properties.flagAlign = { - widget: 'inner_align', - title: intl.formatMessage(messages.flagAlign), - actions: ['left', 'right'], - default: 'left', - }; - schema.properties.slides.schema.fieldsets[0].fields = [ - ...schema.properties.slides.schema.fieldsets[0].fields, - ...['buttonText', 'flagAlign'], - ]; - //schema.fieldsets[0].fields = [...schema.fieldsets[0].fields, ...]; - return schema; -}; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/TeaserBlockEnhancer.js b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/TeaserBlockEnhancer.js deleted file mode 100644 index 6c2057a5..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/TeaserBlockEnhancer.js +++ /dev/null @@ -1,10 +0,0 @@ -export const TeaserBlockSchemaEnhancer = ({ schema }) => { - schema.properties.align = { - title: 'Object-fit', - widget: 'align', - actions: ['center', 'full'], - default: 'full', - }; - schema.fieldsets[0].fields = [...schema.fieldsets[0].fields, ...['align']]; - return schema; -}; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/VideoBlockEnhancer.js b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/VideoBlockEnhancer.js deleted file mode 100644 index a3bb5561..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/VideoBlockEnhancer.js +++ /dev/null @@ -1,55 +0,0 @@ -import { defineMessages } from 'react-intl'; - -const messages = defineMessages({ - title: { - id: 'Title', - defaultMessage: 'Title', - }, - credits: { - id: 'Credits', - defaultMessage: 'Credits', - }, - linkTo: { - id: 'Link to', - defineMessage: 'Link to', - }, - creditSettings: { - id: 'Credit settings', - defaultMessage: 'Credit settings', - }, - openLinkInNewTab: { - id: 'Open in new tab', - defaultMessage: 'Open in new tab', - }, -}); - -export const VideoBlockSchemaEnhancer = ({ intl, formData, schema }) => { - schema.properties.credits = { - title: intl.formatMessage(messages.credits), - }; - - schema.properties.title = { - title: intl.formatMessage(messages.title), - }; - - schema.properties.linkTo = { - title: intl.formatMessage(messages.linkTo), - widget: 'object_browser', - mode: 'link', - selectedItemAttrs: ['Title', 'Description', 'hasPreviewImage'], - allowExternals: true, - }; - - schema.fieldsets = [ - ...schema.fieldsets, - { - id: 'credit settings', - title: intl.formatMessage(messages.creditSettings), - fields: [...['title', 'credits', 'linkTo']], - }, - ]; - - //schema.fieldsets[0].fields = [...schema.fieldsets[0].fields, ...['']]; - - return schema; -}; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/Data.jsx b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/Data.jsx deleted file mode 100644 index f448e1a7..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/Data.jsx +++ /dev/null @@ -1,47 +0,0 @@ -import React from 'react'; -import { BlockDataForm } from '@plone/volto/components'; - -import { Schema } from './schema'; -import { useIntl, defineMessages } from 'react-intl'; - -const messages = defineMessages({ - Quote: { - id: 'Quote', - defaultMessage: 'Quote', - }, -}); - -const QuoteBlockData = (props) => { - const { data, block, onChangeBlock } = props; - - const intl = useIntl(); - - React.useEffect(() => { - onChangeBlock(block, { - ...data, - backgroundColor: data.backgroundColor || '#d5dde2', - person: data.person, - position: data.position, - }); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - return ( - { - onChangeBlock(block, { - ...data, - [id]: value, - }); - }} - formData={data} - fieldIndex={data.index} - basic - unwrapped - block={block} - /> - ); -}; - -export default QuoteBlockData; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/Edit.jsx b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/Edit.jsx deleted file mode 100644 index a0b78103..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/Edit.jsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; - -import { SidebarPortal } from '@plone/volto/components'; -import View from './View'; - -import QuoteSidebar from './Data'; - -const QuoteBlockEdit = (props) => { - const { data, block, onChangeBlock, selected } = props; - - return ( - <> - - - - - - ); -}; - -export default QuoteBlockEdit; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/Sidebar.jsx b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/Sidebar.jsx deleted file mode 100644 index 1e0af327..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/Sidebar.jsx +++ /dev/null @@ -1,7 +0,0 @@ -import Data from './Data'; - -const QuoteSidebar = (props) => { - return ; -}; - -export default QuoteSidebar; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/View.jsx b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/View.jsx deleted file mode 100644 index 7f500d2e..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/View.jsx +++ /dev/null @@ -1,70 +0,0 @@ -import React from 'react'; -import cx from 'classnames'; -import { flattenToAppURL } from '@plone/volto/helpers'; -import QuoteImage from './quote.png'; -import QuoteImageGrey from './quote-grey.png'; -// import quoteSVG from '@plone/volto/icons/quote.svg'; -// import { Icon } from '@plone/volto/components'; - -const QuoteBlockView = (props) => { - const { data } = props; - return ( - <> - {data && ( -
0, - // The image is returned in an array (empty array = true) - // so we are checking the length of the array to set the 'no-image' - // class when the array is empty. - 'align-left': data.align === 'left', - })} - > -
- {data?.image?.[0] && ( -
- -
- )} -
-
- {data.align !== 'left' && ( - - )} - {data.align === 'left' ? '„' : null} - {data.text}“ -
-
- {data.person} - {data.position && ', '} - {data.position} -
-
-
-
- )} - - ); -}; - -export default QuoteBlockView; diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/quote-grey.png b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/quote-grey.png deleted file mode 100644 index 40f4ad49..00000000 Binary files a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/quote-grey.png and /dev/null differ diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/quote.png b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/quote.png deleted file mode 100644 index 94ee4e88..00000000 Binary files a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/quote.png and /dev/null differ diff --git a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/schema.js b/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/schema.js deleted file mode 100644 index fc32175c..00000000 --- a/frontend/src/addons/volto-plonede/src/components/manage/Blocks/volto-quote-block/schema.js +++ /dev/null @@ -1,83 +0,0 @@ -import { defineMessages } from 'react-intl'; - -const messages = defineMessages({ - quote: { - id: 'Quote', - defaultMessage: 'Quote', - }, - image: { - id: 'Image', - defaultMessage: 'Image', - }, - quoteText: { - id: 'Quote-text', - defaultMessage: 'Quote-text', - }, - quotedPerson: { - id: 'Quoted person', - defaultMessage: 'Quoted person', - }, - name: { - id: 'Name', - defaultMessage: 'Name', - }, - position: { - id: 'Position', - defaultMessage: 'Position', - }, - backgroundColor: { - id: 'Background color', - defaultMessage: 'Background color', - }, - imageAlignment: { - id: 'Image Alignment', - defaultMessage: 'Image Alignment', - }, -}); -export const Schema = (props) => { - const { intl } = props; - const colors = [ - { name: 'white', label: 'White' }, - { name: 'lightGrey', label: 'Light grey' }, - ]; - return { - block: intl.formatMessage(messages.quote), - fieldsets: [ - { - id: 'default', - title: 'Default', - fields: ['image', 'text', 'backgroundColor', 'align'], - }, - { - id: 'person', - title: intl.formatMessage(messages.quotedPerson), - fields: ['person', 'position'], - }, - ], - properties: { - image: { - title: intl.formatMessage(messages.image), - widget: 'object_browser', - mode: 'image', - selectedItemAttrs: [], - }, - text: { - title: intl.formatMessage(messages.quoteText), - widget: 'textarea', - }, - person: { title: intl.formatMessage(messages.name) }, - position: { title: intl.formatMessage(messages.position) }, - backgroundColor: { - title: intl.formatMessage(messages.backgroundColor), - widget: 'color_picker', - colors, - default: 'lightGrey', - }, - align: { - title: intl.formatMessage(messages.imageAlignment), - widget: 'quoteAlign', - }, - }, - required: [], - }; -}; diff --git a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-blocks-grid/components/Teaser/DefaultBody.jsx b/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-blocks-grid/components/Teaser/DefaultBody.jsx deleted file mode 100644 index 65516d8a..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-blocks-grid/components/Teaser/DefaultBody.jsx +++ /dev/null @@ -1,88 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { Message } from 'semantic-ui-react'; -import { defineMessages, useIntl } from 'react-intl'; -import imageBlockSVG from '@plone/volto/components/manage/Blocks/Image/block-image.svg'; -import { flattenToAppURL } from '@plone/volto/helpers'; -import { getTeaserImageURL } from '@kitconcept/volto-blocks-grid/components/Teaser/utils'; -import { MaybeWrap } from '@plone/volto/components'; -import { UniversalLink } from '@plone/volto/components'; -import cx from 'classnames'; -import config from '@plone/volto/registry'; - -const messages = defineMessages({ - PleaseChooseContent: { - id: 'Please choose an existing content as source for this element', - defaultMessage: - 'Please choose an existing content as source for this element', - }, -}); - -const DefaultImage = (props) => {props.alt; - -const TeaserDefaultTemplate = (props) => { - const { className, data, isEditMode } = props; - const intl = useIntl(); - const href = data.href?.[0]; - const image = data.preview_image?.[0]; - const align = data?.styles?.align; - - const hasImageComponent = config.getComponent('Image').component; - const Image = config.getComponent('Image').component || DefaultImage; - const defaultImageSrc = - href && flattenToAppURL(getTeaserImageURL({ href, image, align })); - - return ( -
- <> - {!href && isEditMode && ( - -
- -

{intl.formatMessage(messages.PleaseChooseContent)}

-
-
- )} - {href && ( - -
- {(href.hasPreviewImage || href.image_field || image) && ( -
- -
- )} -
- {data?.head_title && ( -
{data.head_title}
- )} - -

{data?.title}

- {!data.hide_description &&

{data?.description}

} -
-
-
- )} - -
- ); -}; - -TeaserDefaultTemplate.propTypes = { - data: PropTypes.objectOf(PropTypes.any).isRequired, - isEditMode: PropTypes.bool, -}; - -export default TeaserDefaultTemplate; diff --git a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-button-block/components/View.jsx b/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-button-block/components/View.jsx deleted file mode 100644 index 6e135de1..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-button-block/components/View.jsx +++ /dev/null @@ -1,78 +0,0 @@ -import React from 'react'; -import { Button } from 'semantic-ui-react'; -import cx from 'classnames'; -import { ConditionalLink } from '@plone/volto/components'; -import { flattenToAppURL, isInternalURL } from '@plone/volto/helpers'; -import { defineMessages, useIntl } from 'react-intl'; - -const messages = defineMessages({ - ButtonText: { - id: 'Button text', - defaultMessage: 'Button text', - }, -}); - -const View = (props) => { - const { className, data, isEditMode } = props; - const [hasLink, setHasLink] = React.useState(false); - const intl = useIntl(); - - React.useEffect(() => { - if (data.href) { - if (data.href && data.href.length > 0) { - setHasLink(true); - } - if (data.href.length === 0) { - setHasLink(false); - } - } - - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [data.href]); - - const link = hasLink ? ( - data.href.length > 0 && isInternalURL(data.href[0]['@id']) ? ( - 0 ? flattenToAppURL(data.href[0]['@id']) : ''} - condition={!isEditMode} - > - - - ) : ( - data.href.length > 0 && ( - - - - ) - ) - ) : ( - - ); - - return ( -
-
-
{link}
-
-
- ); -}; - -export default View; diff --git a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-dsgvo-banner/components/Banner/Banner.jsx b/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-dsgvo-banner/components/Banner/Banner.jsx deleted file mode 100644 index bbcf08ed..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-dsgvo-banner/components/Banner/Banner.jsx +++ /dev/null @@ -1,292 +0,0 @@ -/* eslint-disable import/no-unresolved */ -import React, { useState, useEffect } from 'react'; -import { includes, isObject } from 'lodash'; -import { Button, Modal, Checkbox, Form } from 'semantic-ui-react'; -import { useCookies } from 'react-cookie'; -import { Link } from 'react-router-dom'; -import { connect } from 'react-redux'; -import config from '@plone/volto/registry'; -import { useIntl, defineMessages, FormattedMessage } from 'react-intl'; -import Google from '@kitconcept/volto-dsgvo-banner/components/Banner/Google'; -import Matomo from '@kitconcept/volto-dsgvo-banner/components/Banner/Matomo'; -import { BodyClass } from '@plone/volto/helpers'; - -import { hideDSGVOBanner } from '@kitconcept/volto-dsgvo-banner/actions'; - -const messages = defineMessages({ - technically_required: { - id: 'Technically required', - defaultMessage: 'Technically required', - }, - tracking: { - id: 'Tracking', - defaultMessage: 'Tracking', - }, -}); - -const Banner = (props) => { - let privacy_url = config.settings.DSGVOBanner.privacy_url; - const modules = config.settings.DSGVOBanner.modules; - const [cookies, setCookie, removeCookie] = useCookies(); - const [configureCookies, setConfigureCookies] = useState(false); - const showConfirmModal = !Number(cookies.confirm_cookies) || props.show; - const intl = useIntl(); - - if (isObject(privacy_url)) { - privacy_url = privacy_url[intl.locale]; - } - const [confirmTracking, setConfirmTracking] = useState( - !!Number(cookies.confirm_tracking), - ); - const [confirmYoutube, setConfirmYoutube] = useState( - !!Number(cookies.confirm_youtube), - ); - const [confirmFacebook, setConfirmFacebook] = useState( - !!Number(cookies.confirm_facebook), - ); - const [confirmGoogle, setConfirmGoogle] = useState( - !!Number(cookies.confirm_google), - ); - - const expiryDate = new Date(); - expiryDate.setMonth(expiryDate.getMonth() + 1); - const options = { path: '/', expires: expiryDate }; - - const confirmSelection = () => { - let expiryDate = new Date(); - expiryDate.setMonth(expiryDate.getMonth() + 1); - if (confirmTracking) { - setCookie('confirm_tracking', 1, options); - window[`ga-disable-${config.settings.DSGVOBanner.trackingId}`] = false; - } else { - removeCookie('confirm_tracking', options); - window[`ga-disable-${config.settings.DSGVOBanner.trackingId}`] = true; - removeCookie('_ga', options); - removeCookie('_gat', options); - removeCookie('_gid', options); - } - - if (confirmFacebook) { - setCookie('confirm_facebook', 1, options); - } else { - removeCookie('confirm_facebook', options); - } - - if (confirmYoutube) { - setCookie('confirm_youtube', 1, options); - } else { - removeCookie('confirm_youtube', options); - } - - if (confirmGoogle) { - setCookie('confirm_google', 1, options); - } else { - removeCookie('confirm_google', options); - } - - setCookie('confirm_cookies', 1, options); - props.hideDSGVOBanner(); - }; - - const confirmAll = () => { - setCookie('confirm_tracking', 1, options); - window[`ga-disable-${config.settings.DSGVOBanner.trackingId}`] = false; - - setCookie('confirm_facebook', 1, options); - setCookie('confirm_youtube', 1, options); - setCookie('confirm_google', 1, options); - setCookie('confirm_cookies', 1, options); - - props.hideDSGVOBanner(); - }; - - useEffect(() => { - if (document && showConfirmModal) { - document.getElementById('question-landing').focus(); - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - - return ( - <> - {config.settings.DSGVOBanner.tracker.type === 'google' && } - {config.settings.DSGVOBanner.tracker.type === 'matomo' && } - - - {!configureCookies ? ( - <> - -

- -

- -

- - - - ), - adjust_privacy_settings: ( - - - - ), - }} - /> -

-

- {' '} - - - - - - . -

-
- - - {modules.length > 0 && ( - - )} - - - ) : ( - <> - -

- -

-
- - - - {includes(modules, 'tracking') && ( - - setConfirmTracking(!confirmTracking)} - checked={confirmTracking} - /> - - )} - {includes(modules, 'youtube') && ( - - setConfirmYoutube(!confirmYoutube)} - checked={confirmYoutube} - /> - - )} - {includes(modules, 'facebook') && ( - - setConfirmFacebook(!confirmFacebook)} - checked={confirmFacebook} - /> - - )} - {includes(modules, 'google') && ( - - setConfirmGoogle(!confirmGoogle)} - checked={confirmGoogle} - /> - - )} -
-
- - - - - - - )} -
- - ); -}; - -export default connect( - (state, props) => ({ - show: state.DSGVOBanner.show, - }), - { - hideDSGVOBanner, - }, -)(Banner); diff --git a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-dsgvo-banner/components/IfConfirm/IfConfirm.jsx b/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-dsgvo-banner/components/IfConfirm/IfConfirm.jsx deleted file mode 100644 index a56a6747..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-dsgvo-banner/components/IfConfirm/IfConfirm.jsx +++ /dev/null @@ -1,56 +0,0 @@ -/* eslint-disable import/no-unresolved */ -import React from 'react'; -import { Button, Message } from 'semantic-ui-react'; -import { useCookies } from 'react-cookie'; -import { connect } from 'react-redux'; -import { FormattedMessage } from 'react-intl'; -import { showDSGVOBanner } from '@kitconcept/volto-dsgvo-banner/actions'; - -const IfConfirm = ({ children, module, showDSGVOBanner }) => { - const [cookies] = useCookies(); - - // We bail out if module is undefined, while this is most likely - // a bug in the caller, there is nothing we can do here, - // but we want to avoid a traceback. - // See https://gitlab.dlr.de/internet-cms/cms-plone/dlr-internet/-/issues/1384 - - if (!module || !!Number(cookies[`confirm_${module}`])) { - return <>{children}; - } else { - return ( -
- -
- {module}, - }} - />{' '} - - - -
-
-
- ); - } -}; - -export default connect((state, props) => ({}), { - showDSGVOBanner, -})(IfConfirm); diff --git a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-heading-block/components/Edit.jsx b/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-heading-block/components/Edit.jsx deleted file mode 100644 index 29f5b539..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-heading-block/components/Edit.jsx +++ /dev/null @@ -1,123 +0,0 @@ -import React from 'react'; -import ContentEditable from 'react-contenteditable'; -import { withBlockExtensions } from '@plone/volto/helpers'; -import { SidebarPortal } from '@plone/volto/components'; -import HeadingSidebar from '@kitconcept/volto-heading-block/components/Sidebar'; -import config from '@plone/volto/registry'; -import cx from 'classnames'; - -// Source: https://stackoverflow.com/questions/5796718/html-entity-decode -var decodeHTMLEntities = (function () { - if (__SERVER__) { - return () => { - throw new Error('DecodeHTMLEntities is not supported in SSR.'); - }; - } - // closure to avoid creating the object each time - var element = document.createElement('div'); - - function decodeHTMLEntities(str) { - if (str && typeof str === 'string') { - // strip script/html tags - str = str.replace(/]*>([\S\s]*?)<\/script>/gim, ''); - str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim, ''); - element.innerHTML = str; - str = element.textContent; - element.textContent = ''; - } - - return str; - } - - return decodeHTMLEntities; -})(); - -class HeadingEdit extends React.Component { - constructor(props) { - super(); - this.state = { - html: props.data.heading || '', - }; - } - - editable = React.createRef(); - componentDidUpdate(prevProps) { - if (this.props.selected && this.editable.current) { - this.editable.current.focus(); - } - } - - handleChange = (event) => { - const { block, data } = this.props; - // Strip all html tags and decode html entities. Apparently this is necessary. - const cleanedText = decodeHTMLEntities(event.target.value); - if (event.nativeEvent.inputType === 'insertFromPaste') { - this.setState({ html: cleanedText }); - } else { - this.setState({ html: event.target.value }); - } - this.props.onChangeBlock(block, { ...data, heading: cleanedText }); - }; - - render = () => { - const { block, data, onChangeBlock, selected } = this.props; - const show_alignment = config.blocks?.blocksConfig?.heading?.show_alignment; - return ( -
-
- { - if (e.key === 'Enter') { - e.preventDefault(); - e.stopPropagation(); - this.props.onSelectBlock( - this.props.onAddBlock( - config.settings.defaultBlockType, - this.props.index + 1, - ), - ); - } else if (e.key === 'ArrowUp') { - e.preventDefault(); - e.stopPropagation(); - this.props.onFocusPreviousBlock( - this.props.block, - this.editable.current, - ); - } else if (e.key === 'ArrowDown') { - e.preventDefault(); - e.stopPropagation(); - this.props.onFocusNextBlock( - this.props.block, - this.editable.current, - ); - } - }} - /> - - - -
-
- ); - }; -} - -export default withBlockExtensions(HeadingEdit); diff --git a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-heading-block/components/View.jsx b/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-heading-block/components/View.jsx deleted file mode 100644 index 2f88e9ac..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-heading-block/components/View.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import React from 'react'; -import { withBlockExtensions } from '@plone/volto/helpers'; -import cx from 'classnames'; -import config from '@plone/volto/registry'; - -const HeadingView = (props) => { - const { className, data } = props; - const Element = data.tag || 'h2'; - const show_alignment = config.blocks?.blocksConfig?.heading?.show_alignment; - return ( - <> - {data && ( -
- {' '} -
- - {data?.heading || ''} - -
-
- )} - - ); -}; - -export default withBlockExtensions(HeadingView); diff --git a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-slider-block/components/DefaultBody.jsx b/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-slider-block/components/DefaultBody.jsx deleted file mode 100644 index bec54d0e..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/@kitconcept/volto-slider-block/components/DefaultBody.jsx +++ /dev/null @@ -1,152 +0,0 @@ -import React from 'react'; -import { useIntl, defineMessages } from 'react-intl'; -import { Icon, MaybeWrap, UniversalLink } from '@plone/volto/components'; -import { Input, Button, Message } from 'semantic-ui-react'; -import cx from 'classnames'; -import navTreeSVG from '@plone/volto/icons/nav.svg'; -import imageBlockSVG from '@plone/volto/components/manage/Blocks/Image/block-image.svg'; -import config from '@plone/volto/registry'; - -const messages = defineMessages({ - PleaseChooseContent: { - id: 'Please choose an existing content as source for this element', - defaultMessage: - 'Please choose an existing content as source for this element', - }, - moreInfo: { - id: 'moreInfo', - defaultMessage: 'More info', - }, - source: { - id: 'Source', - defaultMessage: 'Source', - }, - buttonText: { - id: 'Continue reading', - defaultMessage: 'Continue reading', - }, - buttonColor: { - id: 'Button color', - defaultMessage: 'Button color', - }, -}); - -const DefaultImage = (props) => {props.alt; - -const SliderBody = ({ - index, - onChangeBlock, - block, - data, - dataBlock, - isEditMode, - openObjectBrowser, -}) => { - const intl = useIntl(); - const href = data.href?.[0]; - const image = data.preview_image?.[0]; - - const Image = config.getComponent('Image').component || DefaultImage; - - const handleClick = () => { - openObjectBrowser({ - onSelectItem: (url, document) => { - dataBlock.slides[index].title = document.Title; - dataBlock.slides[index].description = document.Description; - dataBlock.slides[index].href = [ - { - '@id': document['@id'], - Title: document.Title, - Description: document.Description, - title: document.Title, - image_field: document.image_field, - hasPreviewImage: document.hasPreviewImage, - }, - ]; - onChangeBlock(block, dataBlock); - }, - mode: 'link', - }); - }; - - return ( -
- {!href && isEditMode && ( - -
- -

{intl.formatMessage(messages.PleaseChooseContent)}

-
- - - - e.target.blur()} - /> -
-
-
- )} - {href && ( - - - {/* START CUSTOMSTARTIZATION */} - {(href?.hasPreviewImage || href.image_field || image) && ( -
- -
- )} - {/* END CUSTOMIZATION */} -
-
- {data?.head_title && ( - {data?.head_title} - )} -

{data?.nav_title || data?.title}

-
-
-

{data?.description}

-
- -
-
-
- )} -
- ); -}; - -export default SliderBody; diff --git a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/HeroImageLeft/Edit.jsx b/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/HeroImageLeft/Edit.jsx deleted file mode 100644 index 1ee678bc..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/HeroImageLeft/Edit.jsx +++ /dev/null @@ -1,501 +0,0 @@ -/** - * Edit Hero block. - * @module components/manage/Blocks/Image/Edit - */ - -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import { compose } from 'redux'; -import { readAsDataURL } from 'promise-file-reader'; -import { Button, Dimmer, Loader, Message } from 'semantic-ui-react'; -import { isEqual } from 'lodash'; -import { defineMessages, injectIntl } from 'react-intl'; -import { UniversalLink } from '@plone/volto/components'; -import cx from 'classnames'; - -import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable'; -import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers'; -import { createContent } from '@plone/volto/actions'; -import { Icon, SidebarPortal } from '@plone/volto/components'; - -import clearSVG from '@plone/volto/icons/clear.svg'; - -import Data from '@plone/volto/components/manage/Blocks/HeroImageLeft/Data'; - -const messages = defineMessages({ - title: { - id: 'Title', - defaultMessage: 'Title', - }, - description: { - id: 'Description', - defaultMessage: 'Description', - }, - placeholder: { - id: 'Upload a new image', - defaultMessage: 'Upload a new image', - }, - image: { - id: 'Image', - defaultMessage: 'Image', - }, - browse: { - id: 'Browse', - defaultMessage: 'Browse', - }, - uploading: { - id: 'Uploading image', - defaultMessage: 'Uploading image', - }, - buttonText: { - id: 'Button text', - defineMessage: 'Button text', - }, -}); - -/** - * Edit image block class. - * @class Edit - * @extends Component - */ -class EditComponent extends Component { - /** - * Property types. - * @property {Object} propTypes Property types. - * @static - */ - static propTypes = { - selected: PropTypes.bool.isRequired, - block: PropTypes.string.isRequired, - index: PropTypes.number.isRequired, - data: PropTypes.objectOf(PropTypes.any).isRequired, - content: PropTypes.objectOf(PropTypes.any), - request: PropTypes.shape({ - loading: PropTypes.bool, - loaded: PropTypes.bool, - }).isRequired, - pathname: PropTypes.string.isRequired, - onChangeBlock: PropTypes.func.isRequired, - onSelectBlock: PropTypes.func.isRequired, - onDeleteBlock: PropTypes.func.isRequired, - onFocusPreviousBlock: PropTypes.func.isRequired, - onFocusNextBlock: PropTypes.func.isRequired, - handleKeyDown: PropTypes.func.isRequired, - createContent: PropTypes.func.isRequired, - editable: PropTypes.bool, - }; - - /** - * Default properties - * @property {Object} defaultProps Default properties. - * @static - */ - static defaultProps = { - editable: true, - }; - - /** - * Constructor - * @method constructor - * @param {Object} props Component properties - * @constructs WysiwygEditor - */ - constructor(props) { - super(props); - - this.onUploadImage = this.onUploadImage.bind(this); - this.state = { - uploading: false, - }; - - const { Map } = this.props.immutableLib; - - if (!__SERVER__) { - const { DefaultDraftBlockRenderMap, EditorState } = props.draftJs; - const { stateFromHTML } = props.draftJsImportHtml; - - const blockTitleRenderMap = Map({ - unstyled: { - element: 'h1', - }, - }); - - const blockDescriptionRenderMap = Map({ - unstyled: { - element: 'div', - }, - }); - - this.extendedBlockRenderMap = DefaultDraftBlockRenderMap.merge( - blockTitleRenderMap, - ); - - this.extendedDescripBlockRenderMap = DefaultDraftBlockRenderMap.merge( - blockDescriptionRenderMap, - ); - - let titleEditorState; - let descriptionEditorState; - if (props.data && props.data.title) { - titleEditorState = EditorState.createWithContent( - stateFromHTML(props.data.title), - ); - } else { - titleEditorState = EditorState.createEmpty(); - } - if (props.data && props.data.description) { - descriptionEditorState = EditorState.createWithContent( - stateFromHTML(props.data.description), - ); - } else { - descriptionEditorState = EditorState.createEmpty(); - } - this.state = { - uploading: false, - titleEditorState, - descriptionEditorState, - currentFocused: 'title', - }; - } - - this.onChangeTitle = this.onChangeTitle.bind(this); - this.onChangeDescription = this.onChangeDescription.bind(this); - } - - /** - * Component did mount - * @method componentDidMount - * @returns {undefined} - */ - componentDidMount() { - if (this.props.selected) { - this.titleEditor.focus(); - } - } - - /** - * Component will receive props - * @method componentWillReceiveProps - * @param {Object} nextProps Next properties - * @returns {undefined} - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if ( - this.props.request.loading && - nextProps.request.loaded && - this.state.uploading - ) { - this.setState({ - uploading: false, - }); - this.props.onChangeBlock(this.props.block, { - ...this.props.data, - url: nextProps.content['@id'], - }); - } - - const { EditorState } = this.props.draftJs; - const { stateFromHTML } = this.props.draftJsImportHtml; - - if ( - nextProps.data.title && - this.props.data.title !== nextProps.data.title && - !this.props.selected - ) { - const contentState = stateFromHTML(nextProps.data.title); - this.setState({ - titleEditorState: nextProps.data.title - ? EditorState.createWithContent(contentState) - : EditorState.createEmpty(), - }); - } - - if ( - nextProps.data.description && - this.props.data.description !== nextProps.data.description && - !this.props.selected - ) { - const contentState = stateFromHTML(nextProps.data.description); - this.setState({ - descriptionEditorState: nextProps.data.description - ? EditorState.createWithContent(contentState) - : EditorState.createEmpty(), - }); - } - - if (nextProps.selected !== this.props.selected) { - if (this.state.currentFocused === 'title') { - this.titleEditor.focus(); - } else { - this.descriptionEditor.focus(); - } - } - } - - /** - * @param {*} nextProps - * @param {*} nextState - * @returns {boolean} - * @memberof Edit - */ - shouldComponentUpdate(nextProps) { - return this.props.selected || !isEqual(this.props.data, nextProps.data); - } - - /** - * Change Title handler - * @method onChangeTitle - * @param {object} titleEditorState Editor state. - * @returns {undefined} - */ - onChangeTitle(titleEditorState) { - this.setState({ titleEditorState }, () => { - this.props.onChangeBlock(this.props.block, { - ...this.props.data, - title: titleEditorState.getCurrentContent().getPlainText(), - }); - }); - } - - /** - * Change Description handler - * @method onChangeDescription - * @param {object} descriptionEditorState Editor state. - * @returns {undefined} - */ - onChangeDescription(descriptionEditorState) { - this.setState({ descriptionEditorState }, () => { - this.props.onChangeBlock(this.props.block, { - ...this.props.data, - description: descriptionEditorState.getCurrentContent().getPlainText(), - }); - }); - } - - /** - * Upload image handler - * @method onUploadImage - * @returns {undefined} - */ - onUploadImage({ target }) { - const file = target.files[0]; - this.setState({ - uploading: true, - }); - readAsDataURL(file).then((data) => { - const fields = data.match(/^data:(.*);(.*),(.*)$/); - this.props.createContent( - getBaseUrl(this.props.pathname), - { - '@type': 'Image', - image: { - data: fields[3], - encoding: fields[2], - 'content-type': fields[1], - filename: file.name, - }, - }, - this.props.block, - ); - }); - } - - /** - * Render method. - * @method render - * @returns {string} Markup for the component. - */ - render() { - if (__SERVER__) { - return
; - } - const data = this.props.data; - const href = this.props.data.linkHref?.[0]; - const { Editor } = this.props.draftJs; - const placeholder = - this.props.data.placeholder || - this.props.intl.formatMessage(messages.placeholder); - return ( -
- {this.props.selected && this.props.editable && !!this.props.data.url && ( -
- - - -
- )} -
- {this.props.data.url ? ( - - ) : ( -
- - {this.state.uploading && ( - - - {this.props.intl.formatMessage(messages.uploading)} - - - )} -
-

{this.props.intl.formatMessage(messages.image)}

- {this.props.editable && ( - <> -

{placeholder}

-

- -

- - )} -
-
-
- )} -
-
- { - this.titleEditor = node; - }} - readOnly={!this.props.editable} - onChange={this.onChangeTitle} - editorState={this.state.titleEditorState} - blockRenderMap={this.extendedBlockRenderMap} - handleReturn={() => true} - placeholder={this.props.intl.formatMessage(messages.title)} - blockStyleFn={() => 'title-editor'} - onUpArrow={() => { - const selectionState = this.state.titleEditorState.getSelection(); - const { titleEditorState } = this.state; - if ( - titleEditorState - .getCurrentContent() - .getBlockMap() - .first() - .getKey() === selectionState.getFocusKey() - ) { - this.props.onFocusPreviousBlock( - this.props.block, - this.props.blockNode.current, - ); - } - }} - onDownArrow={() => { - const selectionState = this.state.titleEditorState.getSelection(); - const { titleEditorState } = this.state; - if ( - titleEditorState - .getCurrentContent() - .getBlockMap() - .last() - .getKey() === selectionState.getFocusKey() - ) { - this.setState(() => ({ currentFocused: 'description' })); - this.descriptionEditor.focus(); - } - }} - /> - { - this.descriptionEditor = node; - }} - readOnly={!this.props.editable} - onChange={this.onChangeDescription} - editorState={this.state.descriptionEditorState} - blockRenderMap={this.extendedDescripBlockRenderMap} - handleReturn={() => true} - placeholder={this.props.intl.formatMessage( - messages.description, - )} - blockStyleFn={() => 'description-editor'} - onUpArrow={() => { - const selectionState = this.state.descriptionEditorState.getSelection(); - const currentCursorPosition = selectionState.getStartOffset(); - - if (currentCursorPosition === 0) { - this.setState(() => ({ currentFocused: 'title' })); - this.titleEditor.focus(); - } - }} - onDownArrow={() => { - const selectionState = this.state.descriptionEditorState.getSelection(); - const { descriptionEditorState } = this.state; - const currentCursorPosition = selectionState.getStartOffset(); - const blockLength = descriptionEditorState - .getCurrentContent() - .getFirstBlock() - .getLength(); - - if (currentCursorPosition === blockLength) { - this.props.onFocusNextBlock( - this.props.block, - this.props.blockNode.current, - ); - } - }} - /> -
- {href && data.showButton && ( - - - - )} -
-
- - - -
- ); - } -} - -const Edit = injectLazyLibs(['draftJs', 'immutableLib', 'draftJsImportHtml'])( - EditComponent, -); - -export default compose( - injectIntl, - connect( - (state, ownProps) => ({ - request: state.content.subrequests[ownProps.block] || {}, - content: state.content.subrequests[ownProps.block]?.data, - }), - { createContent }, - ), -)(Edit); diff --git a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/HeroImageLeft/View.jsx b/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/HeroImageLeft/View.jsx deleted file mode 100644 index 09aac3ab..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/HeroImageLeft/View.jsx +++ /dev/null @@ -1,89 +0,0 @@ -/** - * View image block. - * @module components/manage/Blocks/Hero/View - */ - -import React from 'react'; -import PropTypes from 'prop-types'; -import { flattenToAppURL } from '@plone/volto/helpers'; -import { UniversalLink } from '@plone/volto/components'; -import { useIntl, defineMessages } from 'react-intl'; -import { Button } from 'semantic-ui-react'; -import cx from 'classnames'; - -/** - * View image block class. - * @class View - * @extends Component - */ -const messages = defineMessages({ - PleaseChooseContent: { - id: 'Please choose an existing content as source for this element', - defaultMessage: - 'Please choose an existing content as source for this element', - }, - moreInfo: { - id: 'moreInfo', - defaultMessage: 'More info', - }, - source: { - id: 'Source', - defaultMessage: 'Source', - }, - ButtonText: { - id: 'Continue reading', - defaultMessage: 'Continue reading', - }, -}); - -const View = (props) => { - const { className, data } = props; - const intl = useIntl(); - const href = data.linkHref?.[0]; - return ( -
-
- {data.url && ( - - )} -
-
- {data.title &&

{data.title}

} - {data.description &&

{data.description}

} -
- {href && data.showButton && ( - - - - )} -
-
-
- ); -}; - -/** - * Property types. - * @property {Object} propTypes Property types. - * @static - */ -View.propTypes = { - data: PropTypes.objectOf(PropTypes.any).isRequired, -}; - -export default View; diff --git a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Image/Edit.jsx b/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Image/Edit.jsx deleted file mode 100644 index 81ce0e43..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Image/Edit.jsx +++ /dev/null @@ -1,431 +0,0 @@ -/** - * Edit image block. - * @module components/manage/Blocks/Image/Edit - */ - -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import { connect } from 'react-redux'; -import { compose } from 'redux'; -import { readAsDataURL } from 'promise-file-reader'; -import { Button, Dimmer, Input, Loader, Message } from 'semantic-ui-react'; -import { defineMessages, injectIntl } from 'react-intl'; -import loadable from '@loadable/component'; -import cx from 'classnames'; -import { isEqual } from 'lodash'; - -import { - Icon, - ImageSidebar, - SidebarPortal, - UniversalLink, -} from '@plone/volto/components'; -import { withBlockExtensions } from '@plone/volto/helpers'; -import { createContent } from '@plone/volto/actions'; -import { - flattenToAppURL, - getBaseUrl, - isInternalURL, -} from '@plone/volto/helpers'; - -import imageBlockSVG from '@plone/volto/components/manage/Blocks/Image/block-image.svg'; -import clearSVG from '@plone/volto/icons/clear.svg'; -import navTreeSVG from '@plone/volto/icons/nav.svg'; -import aheadSVG from '@plone/volto/icons/ahead.svg'; -import uploadSVG from '@plone/volto/icons/upload.svg'; - -const Dropzone = loadable(() => import('react-dropzone')); - -const messages = defineMessages({ - ImageBlockInputPlaceholder: { - id: 'Browse the site, drop an image, or type an URL', - defaultMessage: 'Browse the site, drop an image, or type an URL', - }, - uploadingImage: { - id: 'Uploading image', - defaultMessage: 'Uploading image', - }, - credits: { - id: 'Credits', - defaultMessage: 'Credits', - }, - creditMessage: { - id: 'Plone Foundation', - defaultMessage: 'Plone Foundation', - }, -}); - -/** - * Edit image block class. - * @class Edit - * @extends Component - */ -class Edit extends Component { - /** - * Property types. - * @property {Object} propTypes Property types. - * @static - */ - static propTypes = { - selected: PropTypes.bool.isRequired, - block: PropTypes.string.isRequired, - index: PropTypes.number.isRequired, - data: PropTypes.objectOf(PropTypes.any).isRequired, - content: PropTypes.objectOf(PropTypes.any).isRequired, - request: PropTypes.shape({ - loading: PropTypes.bool, - loaded: PropTypes.bool, - }).isRequired, - pathname: PropTypes.string.isRequired, - onChangeBlock: PropTypes.func.isRequired, - onSelectBlock: PropTypes.func.isRequired, - onDeleteBlock: PropTypes.func.isRequired, - onFocusPreviousBlock: PropTypes.func.isRequired, - onFocusNextBlock: PropTypes.func.isRequired, - handleKeyDown: PropTypes.func.isRequired, - createContent: PropTypes.func.isRequired, - openObjectBrowser: PropTypes.func.isRequired, - }; - - state = { - uploading: false, - url: '', - dragging: false, - }; - - /** - * Component will receive props - * @method componentWillReceiveProps - * @param {Object} nextProps Next properties - * @returns {undefined} - */ - UNSAFE_componentWillReceiveProps(nextProps) { - if ( - this.props.request.loading && - nextProps.request.loaded && - this.state.uploading - ) { - this.setState({ - uploading: false, - }); - this.props.onChangeBlock(this.props.block, { - ...this.props.data, - url: nextProps.content['@id'], - alt: '', - }); - } - } - - /** - * @param {*} nextProps - * @returns {boolean} - * @memberof Edit - */ - shouldComponentUpdate(nextProps) { - return ( - this.props.selected || - nextProps.selected || - !isEqual(this.props.data, nextProps.data) - ); - } - - /** - * Upload image handler (not used), but useful in case that we want a button - * not powered by react-dropzone - * @method onUploadImage - * @returns {undefined} - */ - onUploadImage = (e) => { - e.stopPropagation(); - const file = e.target.files[0]; - this.setState({ - uploading: true, - }); - readAsDataURL(file).then((data) => { - const fields = data.match(/^data:(.*);(.*),(.*)$/); - this.props.createContent( - getBaseUrl(this.props.pathname), - { - '@type': 'Image', - title: file.name, - image: { - data: fields[3], - encoding: fields[2], - 'content-type': fields[1], - filename: file.name, - }, - }, - this.props.block, - ); - }); - }; - - /** - * Change url handler - * @method onChangeUrl - * @param {Object} target Target object - * @returns {undefined} - */ - onChangeUrl = ({ target }) => { - this.setState({ - url: target.value, - }); - }; - - /** - * Submit url handler - * @method onSubmitUrl - * @param {object} e Event - * @returns {undefined} - */ - onSubmitUrl = () => { - this.props.onChangeBlock(this.props.block, { - ...this.props.data, - url: flattenToAppURL(this.state.url), - }); - }; - - /** - * Drop handler - * @method onDrop - * @param {array} files File objects - * @returns {undefined} - */ - onDrop = (file) => { - this.setState({ - uploading: true, - }); - - readAsDataURL(file[0]).then((data) => { - const fields = data.match(/^data:(.*);(.*),(.*)$/); - this.props.createContent( - getBaseUrl(this.props.pathname), - { - '@type': 'Image', - title: file[0].name, - image: { - data: fields[3], - encoding: fields[2], - 'content-type': fields[1], - filename: file[0].name, - }, - }, - this.props.block, - ); - }); - }; - - /** - * Keydown handler on Variant Menu Form - * This is required since the ENTER key is already mapped to a onKeyDown - * event and needs to be overriden with a child onKeyDown. - * @method onKeyDownVariantMenuForm - * @param {Object} e Event object - * @returns {undefined} - */ - onKeyDownVariantMenuForm = (e) => { - if (e.key === 'Enter') { - e.preventDefault(); - e.stopPropagation(); - this.onSubmitUrl(); - } else if (e.key === 'Escape') { - e.preventDefault(); - e.stopPropagation(); - // TODO: Do something on ESC key - } - }; - onDragEnter = () => { - this.setState({ dragging: true }); - }; - onDragLeave = () => { - this.setState({ dragging: false }); - }; - - node = React.createRef(); - - /** - * Render method. - * @method render - * @returns {string} Markup for the component. - */ - render() { - const { data } = this.props; - const placeholder = - this.props.data.placeholder || - this.props.intl.formatMessage(messages.ImageBlockInputPlaceholder); - const creditHref = data?.linkTo?.[0]?.['@id'] || ''; - return ( -
- {data.url ? ( -
- { - if (data.size === 'l') - return `${flattenToAppURL(data.url)}/@@images/image`; - if (data.size === 'm') - return `${flattenToAppURL( - data.url, - )}/@@images/image/preview`; - if (data.size === 's') - return `${flattenToAppURL( - data.url, - )}/@@images/image/mini`; - return `${flattenToAppURL(data.url)}/@@images/image`; - })() - : data.url - } - alt={data.alt || ''} - loading="lazy" - /> -
-
{data.title}
-
- Credit:{' '} - - {'© '} - {data.credits || - this.props.intl.formatMessage(messages.creditMessage)} - -
-
-
- ) : ( -
- {this.props.editable && ( - - {({ getRootProps, getInputProps }) => ( -
- - {this.state.dragging && } - {this.state.uploading && ( - - - {this.props.intl.formatMessage( - messages.uploadingImage, - )} - - - )} -
- -
- - - - - - - { - e.target.focus(); - }} - onFocus={(e) => { - this.props.onSelectBlock(this.props.id); - }} - /> - {this.state.url && ( - - - - )} - - - -
-
-
-
- )} -
- )} -
- )} - - - -
- ); - } -} - -export default compose( - injectIntl, - withBlockExtensions, - connect( - (state, ownProps) => ({ - request: state.content.subrequests[ownProps.block] || {}, - content: state.content.subrequests[ownProps.block]?.data, - }), - { createContent }, - ), -)(Edit); diff --git a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Image/View.jsx b/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Image/View.jsx deleted file mode 100644 index dfaf8287..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Image/View.jsx +++ /dev/null @@ -1,128 +0,0 @@ -/** - * View image block. - * @module components/manage/Blocks/Image/View - */ - -import PropTypes from 'prop-types'; -import { UniversalLink } from '@plone/volto/components'; -import cx from 'classnames'; -import { withBlockExtensions } from '@plone/volto/helpers'; -import { flattenToAppURL, isInternalURL } from '@plone/volto/helpers'; -import { useIntl, defineMessages } from 'react-intl'; - -const messages = defineMessages({ - credits: { - id: 'Credits', - defaultMessage: 'Credits', - }, - creditMessage: { - id: 'Plone Foundation', - defaultMessage: 'Plone Foundation', - }, -}); - -/** - * View image block class. - * @class View - * @extends Component - */ -export const View = (props) => { - const { className, data, detached } = props; - const href = data?.href?.[0]?.['@id'] || ''; - const creditHref = data?.linkTo?.[0]?.['@id'] || ''; - const intl = useIntl(); - - return ( -
- {data.url && ( - <> - {(() => { - const image = ( -
- { - if (data.size === 'l') - return `${flattenToAppURL( - data.url, - )}/@@images/image`; - if (data.size === 'm') - return `${flattenToAppURL( - data.url, - )}/@@images/image/preview`; - if (data.size === 's') - return `${flattenToAppURL( - data.url, - )}/@@images/image/mini`; - return `${flattenToAppURL(data.url)}/@@images/image`; - })() - : data.url - } - alt={data.alt || ''} - loading="lazy" - /> -
-
{data.title}
-
- Credit:{' '} - - {'© '} - {data.credits || - intl.formatMessage(messages.creditMessage)} - -
-
-
- ); - if (href) { - return ( - - {image} - - ); - } else { - return image; - } - })()} - - )} -
- ); -}; - -/** - * Property types. - * @property {Object} propTypes Property types. - * @static - */ -View.propTypes = { - data: PropTypes.objectOf(PropTypes.any).isRequired, -}; - -export default withBlockExtensions(View); diff --git a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/ListingBody.jsx b/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/ListingBody.jsx deleted file mode 100644 index 1cae5cc9..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/ListingBody.jsx +++ /dev/null @@ -1,116 +0,0 @@ -import React, { createRef } from 'react'; -import { FormattedMessage, injectIntl } from 'react-intl'; -import { Pagination, Dimmer, Loader } from 'semantic-ui-react'; -import { Icon } from '@plone/volto/components'; -import config from '@plone/volto/registry'; -import withQuerystringResults from '@plone/volto/components/manage/Blocks/Listing/withQuerystringResults'; - -import paginationLeftSVG from '@plone/volto/icons/left-key.svg'; -import paginationRightSVG from '@plone/volto/icons/right-key.svg'; - -const ListingBody = withQuerystringResults((props) => { - const { - data = {}, - isEditMode, - listingItems, - totalPages, - onPaginationChange, - variation, - currentPage, - prevBatch, - nextBatch, - isFolderContentsListing, - hasLoaded, - } = props; - - let ListingBodyTemplate; - // Legacy support if template is present - const variations = config.blocks?.blocksConfig['listing']?.variations || []; - const defaultVariation = variations.filter((item) => item.isDefault)?.[0]; - - if (data.template && !data.variation) { - const legacyTemplateConfig = variations.find( - (item) => item.id === data.template, - ); - ListingBodyTemplate = legacyTemplateConfig.template; - } else { - ListingBodyTemplate = - variation?.template ?? defaultVariation?.template ?? null; - } - - const listingRef = createRef(); - - return listingItems?.length > 0 ? ( -
- - {totalPages > 1 && ( -
- { - !isEditMode && - listingRef.current.scrollIntoView({ behavior: 'smooth' }); - onPaginationChange(e, { activePage }); - }} - firstItem={null} - lastItem={null} - prevItem={{ - content: , - icon: true, - 'aria-disabled': !prevBatch, - className: !prevBatch ? 'disabled' : null, - }} - nextItem={{ - content: , - icon: true, - 'aria-disabled': !nextBatch, - className: !nextBatch ? 'disabled' : null, - }} - /> -
- )} -
- ) : isEditMode ? ( -
- {isFolderContentsListing && ( - - )} - {hasLoaded && ( - - )} - - - - - -
- ) : ( -
- {hasLoaded && ( - - )} - - - - - -
- ); -}); - -export default injectIntl(ListingBody); diff --git a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/SummaryTemplate.jsx b/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/SummaryTemplate.jsx deleted file mode 100644 index 75e7e8d4..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Listing/SummaryTemplate.jsx +++ /dev/null @@ -1,58 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { ConditionalLink, Component } from '@plone/volto/components'; -import { flattenToAppURL } from '@plone/volto/helpers'; - -import { isInternalURL } from '@plone/volto/helpers/Url/Url'; - -const SummaryTemplate = ({ items, linkTitle, linkHref, isEditMode }) => { - let link = null; - let href = linkHref?.[0]?.['@id'] || ''; - - if (isInternalURL(href)) { - link = ( - - {linkTitle || href} - - ); - } else if (href) { - link = {linkTitle || href}; - } - - return ( - <> -
- {items.map((item) => ( -
-
- -
-
-

- - {item.title ? item.title : item.id} - -

-

{item.description}

-
-
- ))} -
- - {link &&
{link}
} - - ); -}; - -SummaryTemplate.propTypes = { - items: PropTypes.arrayOf(PropTypes.any).isRequired, - linkMore: PropTypes.any, - isEditMode: PropTypes.bool, -}; - -export default SummaryTemplate; diff --git a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Maps/View.jsx b/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Maps/View.jsx deleted file mode 100644 index 252e8f08..00000000 --- a/frontend/src/addons/volto-plonede/src/customizations/volto/components/manage/Blocks/Maps/View.jsx +++ /dev/null @@ -1,50 +0,0 @@ -/** - * View map block. - * @module components/manage/Blocks/Maps/View - */ - -import React from 'react'; -import { injectIntl } from 'react-intl'; -import PropTypes from 'prop-types'; -import cx from 'classnames'; -import { compose } from 'redux'; -import { withBlockExtensions } from '@plone/volto/helpers'; - -/** - * View image block class. - * @class View - * @extends Component - */ - -const View = ({ data, intl }) => ( -
-
-