From 697446207f16633730f11787e994a2ba2485ff4f Mon Sep 17 00:00:00 2001 From: Giulia Ghisini Date: Mon, 16 Oct 2023 12:27:11 +0200 Subject: [PATCH] fix: link widget in slate and added Callout to blocks widget --- src/config/Slate/Link/index.js | 6 +++++- src/config/Widgets/widgets.js | 1 - src/config/italiaConfig.js | 3 ++- .../components/LinkButton/AddLinkForm.jsx | 14 +++++++------- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/config/Slate/Link/index.js b/src/config/Slate/Link/index.js index 0d25cbc91..b3f5907b1 100644 --- a/src/config/Slate/Link/index.js +++ b/src/config/Slate/Link/index.js @@ -1,3 +1,4 @@ +/*Customized LinkEditor to handle data-element*/ import React from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { ReactEditor } from 'slate-react'; @@ -99,7 +100,10 @@ export default function install(config) { isActiveElement, unwrapElement, }; - + //remove Volto helper link to add custom helper link + slate.persistentHelpers = slate.persistentHelpers.filter( + (h) => h().props.pluginId !== 'link', + ); slate.persistentHelpers.push((props) => ( )); diff --git a/src/config/Widgets/widgets.js b/src/config/Widgets/widgets.js index ccb04c4d9..0bb117310 100644 --- a/src/config/Widgets/widgets.js +++ b/src/config/Widgets/widgets.js @@ -82,7 +82,6 @@ const getItaliaWidgets = (config) => { }, widget: { ...config.widgets.widget, - //richtext: WysiwygWidget, color_list: ColorListWidget, path_filters: PathFiltersWidget, location_filter: LocationFiltersWidget, diff --git a/src/config/italiaConfig.js b/src/config/italiaConfig.js index 348363955..839a5419b 100644 --- a/src/config/italiaConfig.js +++ b/src/config/italiaConfig.js @@ -33,7 +33,7 @@ import LeftColumnFacets from '@plone/volto/components/manage/Blocks/Search/layou import HandleAnchor from 'design-comuni-plone-theme/components/ItaliaTheme/AppExtras/HandleAnchor'; import GenericAppExtras from 'design-comuni-plone-theme/components/ItaliaTheme/AppExtras/GenericAppExtras'; import PageLoader from 'design-comuni-plone-theme/components/ItaliaTheme/AppExtras/PageLoader'; -import redraft from 'redraft'; + import { loadables as ItaliaLoadables } from 'design-comuni-plone-theme/config/loadables'; // CTs icons @@ -286,6 +286,7 @@ export default function applyConfig(voltoConfig) { 'break', 'testo_riquadro_semplice', 'testo_riquadro_immagine', + 'callout_block', 'rssBlock', //se si aggiunge un nuovo blocco, verificare che in edit non ci siano bottoni che provocano il submit della form. Se succede, gestirli con e.prevenDefault() e.stopPropagation(). ], diff --git a/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx b/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx index bab4ec682..2425da1c5 100644 --- a/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +++ b/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx @@ -105,12 +105,6 @@ class AddLinkForm extends Component { } handleClickOutside = (e) => { - // console.log( - // 'handle', - // this.linkFormContainer.current, - // this.props, - // doesNodeContainClick(this.linkFormContainer.current, e), - // ); if ( this.linkFormContainer.current && doesNodeContainClick(this.linkFormContainer.current, e) @@ -248,7 +242,13 @@ class AddLinkForm extends Component { : cx('ui input editor-link', 'input-anchorlink-theme'); return ( -
+
{ + console.log(e.target); + }} + >