Skip to content

Commit

Permalink
Enable variations on new Embed block
Browse files Browse the repository at this point in the history
  • Loading branch information
andreiggr committed Oct 24, 2022
1 parent 639f92b commit 82b457f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
18 changes: 15 additions & 3 deletions src/Blocks/EmbedEEAVisualization/Edit.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React from 'react';
import { SidebarPortal } from '@plone/volto/components';
import InlineForm from '@plone/volto/components/manage/Form/InlineForm';
import BlockDataForm from '@plone/volto/components/manage/Form/BlockDataForm';
import ConnectedChart from '@eeacms/volto-plotlycharts/ConnectedChart';
import schema from './schema';

import '@eeacms/volto-plotlycharts/less/visualization.less';

const Edit = (props) => {
const { data } = props;
const { data, block } = props;
return (
<>
<ConnectedChart
Expand All @@ -28,7 +28,7 @@ const Edit = (props) => {
/>

<SidebarPortal selected={props.selected}>
<InlineForm
{/* <InlineForm
schema={schema}
title={schema.title}
onChangeField={(id, value) => {
Expand All @@ -38,6 +38,18 @@ const Edit = (props) => {
});
}}
formData={props.data}
/> */}
<BlockDataForm
block={block}
title={schema.title}
schema={schema}
onChangeField={(id, value) => {
props.onChangeBlock(block, {
...data,
[id]: value,
});
}}
formData={data}
/>
</SidebarPortal>
</>
Expand Down
21 changes: 15 additions & 6 deletions src/Blocks/EmbedEEAVisualization/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,23 @@ export default (config) => {
addPermission: [],
view: [],
},
variations: [
{
id: 'default',
title: 'Default',
isDefault: true,
view: View,
},
{
id: 'extra',
title: 'Extra (expand if needed)',
isDefault: false,
view: View,
},
],
};

config.blocks.blocksConfig.embed_eea_visualization = visualizationBlockConfig;
// This is required for compatibility with previous version
// TODO: script for migration
// config.blocks.blocksConfig.embed_chart = {
// ...visualizationBlockConfig,
// id: 'embed_chart',
// };

return config;
};

0 comments on commit 82b457f

Please sign in to comment.