generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
292 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: \n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: \n" | ||
"PO-Revision-Date: \n" | ||
"Last-Translator: \n" | ||
"Language: \n" | ||
"Language-Team: \n" | ||
"Content-Type: \n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#: components/manage/Blocks/Group/EditBlockWrapper | ||
# defaultMessage: Unknown Block {block} | ||
msgid "Unknown Block" | ||
msgstr "" | ||
|
||
#: components/manage/Blocks/Group/EditBlockWrapper | ||
# defaultMessage: delete | ||
msgid "delete" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Plone\n" | ||
"POT-Creation-Date: 2023-06-28T10:48:22.678Z\n" | ||
"POT-Creation-Date: 2023-08-29T17:38:01.779Z\n" | ||
"Last-Translator: Plone i18n <[email protected]>\n" | ||
"Language-Team: Plone i18n <[email protected]>\n" | ||
"MIME-Version: 1.0\n" | ||
|
@@ -13,4 +13,12 @@ msgstr "" | |
"Preferred-Encodings: utf-8\n" | ||
"Domain: volto\n" | ||
|
||
#: components/manage/Blocks/Group/EditBlockWrapper | ||
# defaultMessage: Unknown Block {block} | ||
msgid "Unknown Block" | ||
msgstr "" | ||
|
||
#: components/manage/Blocks/Group/EditBlockWrapper | ||
# defaultMessage: delete | ||
msgid "delete" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export GroupBlockEdit from './manage/Blocks/Group/Edit'; | ||
export GroupBlockView from './manage/Blocks/Group/View'; | ||
export GroupBlockLayout from './manage/Blocks/Group/LayoutSchema'; | ||
export { default as GroupBlockDefaultBody } from './manage/Blocks/Group/DefaultBody'; | ||
export { default as GroupBlockEdit } from './manage/Blocks/Group/Edit'; | ||
export { default as GroupBlockView } from './manage/Blocks/Group/View'; | ||
export { default as GroupBlockLayout } from './manage/Blocks/Group/LayoutSchema'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { GroupBlockDefaultBody } from '@eeacms/volto-group-block/components'; | ||
|
||
const Body = (props) => { | ||
const { variation } = props; | ||
|
||
const BodyComponent = variation?.template || GroupBlockDefaultBody; | ||
|
||
return <BodyComponent {...props} />; | ||
}; | ||
|
||
Body.propTypes = { | ||
variation: PropTypes.objectOf(PropTypes.any).isRequired, | ||
}; | ||
|
||
export default Body; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import { Button } from 'semantic-ui-react'; | ||
import { BlocksForm, Icon, RenderBlocks } from '@plone/volto/components'; | ||
import EditBlockWrapper from './EditBlockWrapper'; | ||
|
||
import helpSVG from '@plone/volto/icons/help.svg'; | ||
|
||
const GroupBlockDefaultBody = (props) => { | ||
const { | ||
block, | ||
data, | ||
onChangeBlock, | ||
onChangeField, | ||
pathname, | ||
selected, | ||
selectedBlock, | ||
onSelectBlock, | ||
setSelectedBlock, | ||
manage, | ||
childBlocksForm, | ||
multiSelected, | ||
formDescription, | ||
isEditMode, | ||
} = props; | ||
const metadata = props.metadata || props.properties; | ||
const blockState = {}; | ||
|
||
// Get editing instructions from block settings or props | ||
let instructions = data?.instructions?.data || data?.instructions; | ||
if (!instructions || instructions === '<p><br/></p>') { | ||
instructions = formDescription; | ||
} | ||
return isEditMode ? ( | ||
<BlocksForm | ||
metadata={metadata} | ||
properties={childBlocksForm} | ||
manage={manage} | ||
selectedBlock={selected ? selectedBlock : null} | ||
allowedBlocks={data.allowedBlocks} | ||
title={data.placeholder} | ||
description={instructions} | ||
onSelectBlock={(id, l, e) => { | ||
const isMultipleSelection = e | ||
? e.shiftKey || e.ctrlKey || e.metaKey | ||
: false; | ||
onSelectBlock(id, isMultipleSelection, e, selectedBlock); | ||
}} | ||
onChangeFormData={(newFormData) => { | ||
onChangeBlock(block, { | ||
...data, | ||
data: newFormData, | ||
}); | ||
}} | ||
onChangeField={(id, value) => { | ||
if (['blocks', 'blocks_layout'].indexOf(id) > -1) { | ||
blockState[id] = value; | ||
onChangeBlock(block, { | ||
...data, | ||
data: { | ||
...data.data, | ||
...blockState, | ||
}, | ||
}); | ||
} else { | ||
onChangeField(id, value); | ||
} | ||
}} | ||
pathname={pathname} | ||
> | ||
{({ draginfo }, editBlock, blockProps) => ( | ||
<EditBlockWrapper | ||
draginfo={draginfo} | ||
blockProps={blockProps} | ||
disabled={data.disableInnerButtons} | ||
extraControls={ | ||
<> | ||
{instructions && ( | ||
<> | ||
<Button | ||
icon | ||
basic | ||
title="Section help" | ||
onClick={() => { | ||
setSelectedBlock(); | ||
const tab = manage ? 0 : 1; | ||
props.setSidebarTab(tab); | ||
}} | ||
> | ||
<Icon name={helpSVG} className="" size="19px" /> | ||
</Button> | ||
</> | ||
)} | ||
</> | ||
} | ||
multiSelected={multiSelected.includes(blockProps.block)} | ||
> | ||
{editBlock} | ||
</EditBlockWrapper> | ||
)} | ||
</BlocksForm> | ||
) : ( | ||
<RenderBlocks {...props} metadata={metadata} content={data?.data || {}} /> | ||
); | ||
}; | ||
|
||
export default GroupBlockDefaultBody; |
Oops, something went wrong.