design-comuni-plone-theme 11.10.2 → 12.0.0-alpha.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/.github/workflows/slate.yml +47 -0
- package/.yarn/cache/@babel-helper-module-imports-npm-7.24.3-edb733448b-c23492189b.zip +0 -0
- package/.yarn/cache/@babel-types-npm-7.24.0-a0508cb308-4b574a37d4.zip +0 -0
- package/.yarn/cache/babel-plugin-lodash-npm-3.3.4-c7161075b6-044a4261e6.zip +0 -0
- package/.yarn/cache/require-package-name-npm-2.0.1-ac9a206b63-00f4e9e467.zip +0 -0
- package/.yarn/cache/{volto-form-block-npm-3.7.2-f24953a510-7387a1b85a.zip → volto-form-block-npm-3.8.2-e49cbe07d5-5b72a06a5e.zip} +0 -0
- package/.yarn/cache/{volto-gdpr-privacy-npm-2.2.1-bc93b3e168-bce76108c3.zip → volto-gdpr-privacy-npm-2.2.0-6be0f74d53-8a93254251.zip} +0 -0
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +878 -916
- package/RELEASE.md +8 -0
- package/locales/de/LC_MESSAGES/volto.po +86 -18
- package/locales/en/LC_MESSAGES/volto.po +86 -18
- package/locales/es/LC_MESSAGES/volto.po +86 -18
- package/locales/fr/LC_MESSAGES/volto.po +86 -18
- package/locales/it/LC_MESSAGES/volto.po +86 -18
- package/locales/volto.pot +87 -19
- package/package.json +5 -3
- package/publiccode.yml +2 -2
- package/src/components/Collapse.jsx +1 -0
- package/src/components/ItaliaTheme/Blocks/Accordion/Block/EditBlock.jsx +29 -24
- package/src/components/ItaliaTheme/Blocks/Accordion/Block/ViewBlock.jsx +4 -12
- package/src/components/ItaliaTheme/Blocks/Accordion/Edit.jsx +67 -6
- package/src/components/ItaliaTheme/Blocks/Alert/Edit.jsx +60 -113
- package/src/components/ItaliaTheme/Blocks/Alert/Sidebar.jsx +1 -0
- package/src/components/ItaliaTheme/Blocks/Alert/View.jsx +5 -14
- package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Block.jsx +16 -11
- package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Body.jsx +2 -1
- package/src/components/ItaliaTheme/Blocks/ArgumentsInEvidence/Edit.jsx +39 -1
- package/src/components/ItaliaTheme/Blocks/CTABlock/Block.jsx +35 -95
- package/src/components/ItaliaTheme/Blocks/Callout/Edit.jsx +108 -0
- package/src/components/ItaliaTheme/Blocks/Callout/Sidebar.jsx +173 -0
- package/src/components/ItaliaTheme/Blocks/Callout/View.jsx +45 -0
- package/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/EditBlock.jsx +84 -63
- package/src/components/ItaliaTheme/Blocks/ContactsBlock/Block/ViewBlock.jsx +19 -39
- package/src/components/ItaliaTheme/Blocks/ContactsBlock/Edit.jsx +92 -19
- package/src/components/ItaliaTheme/Blocks/ContactsBlock/View.jsx +13 -21
- package/src/components/ItaliaTheme/Blocks/CountDown/Edit.jsx +21 -25
- package/src/components/ItaliaTheme/Blocks/CountDown/View.jsx +6 -15
- package/src/components/ItaliaTheme/Blocks/IconBlocks/Block/EditBlock.jsx +40 -15
- package/src/components/ItaliaTheme/Blocks/IconBlocks/Block/ViewBlock.jsx +6 -21
- package/src/components/ItaliaTheme/Blocks/IconBlocks/Edit.jsx +93 -20
- package/src/components/ItaliaTheme/Blocks/IconBlocks/Sidebar.jsx +1 -9
- package/src/components/ItaliaTheme/Blocks/IconBlocks/View.jsx +4 -17
- package/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/EditBlock.jsx +46 -15
- package/src/components/ItaliaTheme/Blocks/NumbersBlock/Block/ViewBlock.jsx +2 -18
- package/src/components/ItaliaTheme/Blocks/NumbersBlock/Edit.jsx +84 -11
- package/src/components/ItaliaTheme/Blocks/NumbersBlock/View.jsx +2 -11
- package/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Block.jsx +33 -67
- package/src/components/ItaliaTheme/Blocks/TextCard/CardWithImage/Edit.jsx +2 -8
- package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/BodyWrapper.jsx +2 -1
- package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Edit.jsx +98 -84
- package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/View.jsx +20 -3
- package/src/components/ItaliaTheme/Blocks/__tests__/Accordion.test.jsx +11 -28
- package/src/components/ItaliaTheme/Blocks/__tests__/Alert.test.jsx +10 -14
- package/src/components/ItaliaTheme/Blocks/__tests__/ArgumentsInEvidence.test.jsx +20 -28
- package/src/components/ItaliaTheme/Blocks/__tests__/CTABlock.test.jsx +14 -29
- package/src/components/ItaliaTheme/Blocks/__tests__/CardWithImage.test.jsx +11 -28
- package/src/components/ItaliaTheme/Blocks/__tests__/ContactsBlock.test.jsx +75 -140
- package/src/components/ItaliaTheme/Blocks/__tests__/Countdown.test.jsx +20 -28
- package/src/components/ItaliaTheme/Blocks/__tests__/IconBlocks.test.jsx +22 -56
- package/src/components/ItaliaTheme/Blocks/__tests__/NumbersBlock.test.jsx +14 -43
- package/src/components/ItaliaTheme/Blocks/__tests__/SimpleCard.test.jsx +14 -30
- package/src/components/ItaliaTheme/Footer/FooterInfos.jsx +22 -8
- package/src/components/ItaliaTheme/Footer/FooterNavigation.jsx +3 -3
- package/src/components/ItaliaTheme/MegaMenu/MegaMenu.jsx +5 -1
- package/src/components/ItaliaTheme/Slider/SingleSlideWrapper.jsx +2 -3
- package/src/components/ItaliaTheme/View/BandoView/BandoApprofondimenti.jsx +1 -2
- package/src/components/ItaliaTheme/View/CartellaModulisticaView/DocRow.jsx +14 -5
- package/src/components/ItaliaTheme/View/Commons/Attachment.jsx +19 -3
- package/src/components/ItaliaTheme/View/Commons/Attachments.jsx +0 -1
- package/src/components/ItaliaTheme/View/Commons/DownloadFileFormat.jsx +11 -7
- package/src/components/ItaliaTheme/View/Commons/Module.jsx +7 -6
- package/src/components/ItaliaTheme/View/Commons/PageHeader/PageHeaderLinkServizio.jsx +6 -2
- package/src/components/ItaliaTheme/View/Commons/RichTextRender.jsx +8 -6
- package/src/components/ItaliaTheme/View/Commons/__tests__/RichText.test.jsx +14 -17
- package/src/components/ItaliaTheme/View/ServizioView/ServizioAccedi.jsx +5 -6
- package/src/components/ItaliaTheme/View/ServizioView/ServizioMetatag.jsx +4 -0
- package/src/components/ItaliaTheme/View/__tests__/CartellaModulisticaView.test.jsx +12 -1
- package/src/components/ItaliaTheme/View/__tests__/IncaricoView.test.jsx +24 -30
- package/src/components/ItaliaTheme/View/__tests__/PageView.test.jsx +24 -2
- package/src/components/ItaliaTheme/View/__tests__/PersonaView.test.jsx +96 -92
- package/src/components/ItaliaTheme/View/__tests__/ServizioAChiSiRivolge.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioAccedi.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioCasiParticolari.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioComeFare.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioCondizioni.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioContatti.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioCosE.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioCosaServe.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioCosaSiOttiene.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioCostiVincoli.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioMetadati.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioModulistica.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioProcedure.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioSitiEsterni.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioTempiScadenze.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioUlterioriInformazioni.test.jsx +240 -286
- package/src/components/ItaliaTheme/View/__tests__/ServizioView.test.jsx +470 -560
- package/src/components/ItaliaTheme/View/__tests__/TrasparenzaView.test.jsx +12 -1
- package/src/components/ItaliaTheme/manage/Widgets/ColorListWidget.jsx +11 -2
- package/src/components/ItaliaTheme/manage/Widgets/HtmlSlateWidget.jsx +154 -0
- package/src/components/ItaliaTheme/manage/Widgets/RichTextWidget.jsx +88 -0
- package/src/components/ItaliaTheme/manage/Widgets/SimpleTextEditorWidget.jsx +158 -0
- package/src/components/ItaliaTheme/manage/Widgets/TextEditorWidget.jsx +167 -270
- package/src/config/Blocks/ListingOptions/index.js +0 -1
- package/src/config/Blocks/ListingOptions/utils.js +0 -7
- package/src/config/Blocks/blocks.js +29 -8
- package/src/config/Blocks/listingVariations.js +1 -1
- package/src/config/Slate/Alignment/AlignMenu.jsx +169 -0
- package/src/config/Slate/Alignment/index.js +42 -0
- package/src/config/Slate/Blockquote/BlockquoteMenu.jsx +151 -0
- package/src/config/Slate/Blockquote/index.js +12 -0
- package/src/config/Slate/Headings/HeadingsMenu.jsx +139 -0
- package/src/config/Slate/Headings/headingsMenu.scss +44 -0
- package/src/config/Slate/Headings/index.js +62 -0
- package/src/config/Slate/Link/deserializer.js +25 -0
- package/src/config/Slate/Link/index.js +126 -0
- package/src/config/Slate/Link/renderer.jsx +99 -0
- package/src/config/Slate/LinkButton/index.js +47 -0
- package/src/config/Slate/TextLarger/index.js +51 -0
- package/src/config/Slate/Underline/index.js +10 -0
- package/src/config/Slate/config.js +43 -0
- package/src/config/Slate/deserializers.js +66 -0
- package/src/config/Slate/dropdownStyle.scss +14 -0
- package/src/config/Slate/dropdownUtils.js +422 -0
- package/src/config/Slate/extensions/breakList.js +91 -0
- package/src/config/Slate/handlers.js +243 -0
- package/src/config/Slate/utils.js +73 -0
- package/src/config/Widgets/widgets.js +1 -2
- package/src/config/italiaConfig.js +7 -54
- package/src/customizations/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +360 -0
- package/src/customizations/volto/components/manage/Blocks/HeroImageLeft/Edit.jsx +75 -200
- package/src/customizations/volto/components/manage/Blocks/Video/Edit.jsx +1 -1
- package/src/customizations/volto/components/manage/Form/BlocksToolbar.jsx +1 -1
- package/src/customizations/volto/components/manage/UniversalLink/UniversalLink.jsx +59 -6
- package/src/customizations/volto-form-block/components/Field.jsx +45 -22
- package/src/customizations/volto-form-block/components/FormResult.jsx +74 -0
- package/src/customizations/volto-form-block/components/FormView.jsx +79 -66
- package/src/customizations/volto-form-block/components/Widget/Button.jsx +50 -0
- package/src/helpers/EnhanceLink.js +44 -0
- package/src/helpers/FormValidation/FormValidationHelpers.js +3 -0
- package/src/helpers/blocks.js +86 -0
- package/src/helpers/files.js +14 -14
- package/src/helpers/index.js +4 -3
- package/src/helpers/richTextHelper.js +10 -0
- package/src/icons/Group.svg +1 -0
- package/src/icons/blocco-icone.svg +0 -3
- package/src/icons/blockquote-card-dark.svg +1 -0
- package/src/icons/blockquote-card.svg +1 -0
- package/src/icons/blockquote-simple.svg +1 -0
- package/src/icons/text-larger.svg +1 -0
- package/src/theme/ItaliaTheme/Blocks/_accordion.scss +1 -10
- package/src/theme/ItaliaTheme/Blocks/_alert.scss +53 -1
- package/src/theme/ItaliaTheme/Blocks/_bandiInEvidenceTemplate.scss +1 -0
- package/src/theme/ItaliaTheme/Blocks/_callout.scss +32 -0
- package/src/theme/ItaliaTheme/Blocks/_contacts.scss +15 -32
- package/src/theme/ItaliaTheme/Blocks/_ctaBlock.scss +0 -14
- package/src/theme/ItaliaTheme/Blocks/_gridBlock.scss +1 -1
- package/src/theme/ItaliaTheme/Blocks/_hero.scss +1 -8
- package/src/theme/ItaliaTheme/Blocks/_iconBlocks.scss +0 -30
- package/src/theme/ItaliaTheme/Blocks/_imageCardTextBlock.scss +3 -2
- package/src/theme/ItaliaTheme/Blocks/_numbers.scss +1 -5
- package/src/theme/ItaliaTheme/Blocks/_simpleCardTextBlock.scss +8 -2
- package/src/theme/ItaliaTheme/Blocks/_tableOfContents.scss +1 -0
- package/src/theme/ItaliaTheme/Components/_megamenu.scss +0 -4
- package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_cta.scss +1 -0
- package/src/theme/ItaliaTheme/Subsites/ItaliaTheme/Blocks/_searchSections.scss +1 -0
- package/src/theme/ItaliaTheme/Subsites/bootstrap-italia/custom/_headercenter.scss +1 -0
- package/src/theme/ItaliaTheme/Views/_cartellaModulistica.scss +11 -2
- package/src/theme/ItaliaTheme/Views/_slider.scss +3 -3
- package/src/theme/ItaliaTheme/Widgets/_iconWidget.scss +4 -0
- package/src/theme/ItaliaTheme/_main.scss +42 -54
- package/src/theme/_cms-ui.scss +59 -161
- package/src/theme/extras/_forms.scss +2 -14
- package/src/theme/site.scss +1 -0
- package/test-setup-config.js +58 -0
- package/src/components/ItaliaTheme/Blocks/TextCard/SimpleCard/Block.jsx +0 -151
- package/src/config/RichTextEditor/LinkEntity.jsx +0 -27
- package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/Link/index.jsx +0 -44
- package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +0 -349
- package/src/config/RichTextEditor/Plugins/AnchorPlugin/components/LinkButton/index.js +0 -150
- package/src/config/RichTextEditor/Plugins/AnchorPlugin/index.js +0 -88
- package/src/config/RichTextEditor/ToolbarButtons/AlignButton.jsx +0 -61
- package/src/config/RichTextEditor/ToolbarButtons/ButtonsButton.jsx +0 -14
- package/src/config/RichTextEditor/ToolbarButtons/CalloutsButton.jsx +0 -38
- package/src/config/RichTextEditor/ToolbarButtons/DraftJsDropdownButton.jsx +0 -106
- package/src/config/RichTextEditor/ToolbarButtons/HeadingsButton.jsx +0 -57
- package/src/config/RichTextEditor/ToolbarButtons/TextSizeButton.jsx +0 -65
- package/src/config/RichTextEditor/ToolbarButtons/UnderlineButton.jsx +0 -14
- package/src/config/RichTextEditor/config.js +0 -253
- package/src/config/volto-gdpr-privacy-defaultPanelConfig.js +0 -292
- package/src/customizations/volto/components/manage/Blocks/ToC/View.jsx +0 -134
- package/src/customizations/volto/components/manage/Blocks/ToC/variations/DefaultTocRenderer.jsx +0 -99
- package/src/customizations/volto/config/RichTextEditor/Plugins.jsx +0 -63
- package/src/helpers/redraftHelper.js +0 -9
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Edit text block.
|
|
3
3
|
* @module components/Widgets/TextEditorWidget/TextEditorWidget
|
|
4
|
+
*
|
|
5
|
+
* E' come il componente DetatchedTextBlockEditor di @plone/volto-slate,
|
|
6
|
+
* ma in più ha il withBlockProperties,
|
|
7
|
+
* che serve per getire gli handler (le function di focusPrev e focusNext)
|
|
4
8
|
*/
|
|
5
9
|
|
|
6
|
-
import React
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { connect } from 'react-redux';
|
|
7
12
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { compose } from 'redux';
|
|
9
|
-
import { defineMessages, injectIntl } from 'react-intl';
|
|
10
|
-
import { includes, isEqual } from 'lodash';
|
|
11
|
-
import loadable from '@loadable/component';
|
|
12
|
-
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
|
|
13
13
|
|
|
14
|
+
import { defineMessages, useIntl } from 'react-intl';
|
|
15
|
+
import { useInView } from 'react-intersection-observer';
|
|
16
|
+
import { SlateEditor } from '@plone/volto-slate/editor';
|
|
17
|
+
import { serializeNodesToText } from '@plone/volto-slate/editor/render';
|
|
18
|
+
import { handleKeyDetached } from '@plone/volto-slate/blocks/Text/keyboard';
|
|
19
|
+
import {
|
|
20
|
+
uploadContent,
|
|
21
|
+
saveSlateBlockSelection,
|
|
22
|
+
} from '@plone/volto-slate/actions';
|
|
23
|
+
import SimpleTextEditorWidget from './SimpleTextEditorWidget';
|
|
24
|
+
import { breakList as customBreakList } from 'design-comuni-plone-theme/config/Slate/extensions/breakList';
|
|
14
25
|
import config from '@plone/volto/registry';
|
|
15
26
|
|
|
16
27
|
const messages = defineMessages({
|
|
@@ -20,284 +31,170 @@ const messages = defineMessages({
|
|
|
20
31
|
},
|
|
21
32
|
});
|
|
22
33
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
showToolbar: PropTypes.bool,
|
|
49
|
-
onSelectBlock: PropTypes.func,
|
|
50
|
-
onAddBlock: PropTypes.func,
|
|
51
|
-
disableMoveToNearest: PropTypes.bool,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Default properties
|
|
56
|
-
* @property {Object} defaultProps Default properties.
|
|
57
|
-
* @static
|
|
58
|
-
*/
|
|
59
|
-
static defaultProps = {
|
|
60
|
-
showToolbar: true,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Constructor
|
|
65
|
-
* @method constructor
|
|
66
|
-
* @param {Object} props Component properties
|
|
67
|
-
* @constructs WysiwygEditor
|
|
68
|
-
*/
|
|
69
|
-
constructor(props) {
|
|
70
|
-
super(props);
|
|
71
|
-
const { settings } = config;
|
|
72
|
-
|
|
73
|
-
this.draftConfig = settings.richtextEditorSettings(props);
|
|
74
|
-
|
|
75
|
-
const { EditorState, convertFromRaw } = props.draftJs;
|
|
76
|
-
const createInlineToolbarPlugin = props.draftJsInlineToolbarPlugin.default;
|
|
77
|
-
|
|
78
|
-
if (!__SERVER__) {
|
|
79
|
-
let editorState;
|
|
80
|
-
if (props.data && props.data[props.fieldName]) {
|
|
81
|
-
editorState = EditorState.createWithContent(
|
|
82
|
-
convertFromRaw(props.data[props.fieldName]),
|
|
83
|
-
);
|
|
84
|
-
} else {
|
|
85
|
-
editorState = EditorState.createEmpty();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const inlineToolbarPlugin = createInlineToolbarPlugin({
|
|
89
|
-
structure: this.draftConfig.richTextEditorInlineToolbarButtons,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
this.state = {
|
|
93
|
-
editorState,
|
|
94
|
-
inlineToolbarPlugin,
|
|
95
|
-
addNewBlockOpened: false,
|
|
34
|
+
const TextEditorWidget = (props) => {
|
|
35
|
+
const {
|
|
36
|
+
showToolbar = true,
|
|
37
|
+
setSelected,
|
|
38
|
+
wrapClass,
|
|
39
|
+
index,
|
|
40
|
+
properties,
|
|
41
|
+
value,
|
|
42
|
+
fieldName,
|
|
43
|
+
block,
|
|
44
|
+
selected,
|
|
45
|
+
onSelectBlock,
|
|
46
|
+
onChangeBlock,
|
|
47
|
+
data = {},
|
|
48
|
+
...otherProps
|
|
49
|
+
} = props;
|
|
50
|
+
|
|
51
|
+
const { slate } = config.settings;
|
|
52
|
+
const { textblockExtensions } = slate;
|
|
53
|
+
const withBlockProperties = React.useCallback(
|
|
54
|
+
(editor) => {
|
|
55
|
+
const p = {
|
|
56
|
+
...props,
|
|
57
|
+
showToolbar: showToolbar,
|
|
58
|
+
data: { ...props.data, disableNewBlocks: true },
|
|
96
59
|
};
|
|
60
|
+
editor.getBlockProps = () => p;
|
|
61
|
+
return editor;
|
|
62
|
+
},
|
|
63
|
+
[props, showToolbar],
|
|
64
|
+
);
|
|
65
|
+
//const [uid, setUid] = useState();
|
|
66
|
+
// const getEditor = React.useCallback((editor) => {
|
|
67
|
+
// setUid(editor.uid);
|
|
68
|
+
// return editor;
|
|
69
|
+
// });
|
|
70
|
+
|
|
71
|
+
//const link_pid = `${uid}-link`;
|
|
72
|
+
// const show_sidebar_editor = useSelector((state) => {
|
|
73
|
+
// return state['slate_plugins']?.[link_pid]?.show_sidebar_editor;
|
|
74
|
+
// });
|
|
75
|
+
|
|
76
|
+
const intl = useIntl();
|
|
77
|
+
const placeholder =
|
|
78
|
+
otherProps.placeholder || intl.formatMessage(messages.text);
|
|
79
|
+
|
|
80
|
+
const { ref, inView } = useInView({
|
|
81
|
+
threshold: 0,
|
|
82
|
+
rootMargin: '0px 0px 200px 0px',
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const _value = fieldName ? data[fieldName] : value;
|
|
86
|
+
|
|
87
|
+
const selectThis = () => {
|
|
88
|
+
if (setSelected) {
|
|
89
|
+
setSelected(fieldName ?? true);
|
|
90
|
+
} else if (onSelectBlock) {
|
|
91
|
+
onSelectBlock(block);
|
|
97
92
|
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Component will receive props
|
|
102
|
-
* @method componentDidMount
|
|
103
|
-
* @returns {undefined}
|
|
104
|
-
*/
|
|
105
|
-
componentDidMount() {
|
|
106
|
-
if (this.props.selected && this.node) {
|
|
107
|
-
setTimeout(this.node.focus, 0);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Component will receive props
|
|
113
|
-
* @method componentWillReceiveProps
|
|
114
|
-
* @param {Object} nextProps Next properties
|
|
115
|
-
* @returns {undefined}
|
|
116
|
-
*/
|
|
117
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
118
|
-
if (!this.props.selected && nextProps.selected) {
|
|
119
|
-
// See https://github.com/draft-js-plugins/draft-js-plugins/issues/800
|
|
120
|
-
setTimeout(this.node.focus, 0);
|
|
121
|
-
const { EditorState } = this.props.draftJs;
|
|
122
|
-
|
|
123
|
-
this.setState({
|
|
124
|
-
editorState: EditorState.moveFocusToEnd(this.state.editorState),
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Change handler
|
|
131
|
-
* @method onChange
|
|
132
|
-
* @param {object} editorState Editor state.
|
|
133
|
-
* @returns {undefined}
|
|
134
|
-
*/
|
|
135
|
-
onChange = (editorState) => {
|
|
136
|
-
const { convertToRaw } = this.props.draftJs;
|
|
137
|
-
if (
|
|
138
|
-
!isEqual(
|
|
139
|
-
convertToRaw(editorState.getCurrentContent()),
|
|
140
|
-
convertToRaw(this.state.editorState.getCurrentContent()),
|
|
141
|
-
)
|
|
142
|
-
) {
|
|
143
|
-
this.props.onChangeBlock({
|
|
144
|
-
...this.props.data,
|
|
145
|
-
[this.props.fieldName]: convertToRaw(editorState.getCurrentContent()),
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
this.setState({ editorState });
|
|
149
93
|
};
|
|
150
94
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
* @returns {string} Markup for the component.
|
|
155
|
-
*/
|
|
156
|
-
render() {
|
|
157
|
-
if (__SERVER__) {
|
|
158
|
-
return <div />;
|
|
95
|
+
const extensions = [...textblockExtensions].map((f) => {
|
|
96
|
+
if (f.name === 'breakList') {
|
|
97
|
+
return customBreakList;
|
|
159
98
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
this.onChange(
|
|
189
|
-
RichUtils.insertSoftNewline(this.state.editorState),
|
|
190
|
-
);
|
|
191
|
-
return 'handled';
|
|
99
|
+
return f;
|
|
100
|
+
});
|
|
101
|
+
return (
|
|
102
|
+
<div
|
|
103
|
+
className={wrapClass}
|
|
104
|
+
onClick={() => selectThis()}
|
|
105
|
+
onFocus={() => selectThis()}
|
|
106
|
+
onKeyDown={() => selectThis()}
|
|
107
|
+
role={'textbox'}
|
|
108
|
+
tabIndex="-1"
|
|
109
|
+
>
|
|
110
|
+
{showToolbar ? (
|
|
111
|
+
<div
|
|
112
|
+
className="text-slate-editor-inner detached-slate-editor"
|
|
113
|
+
ref={ref}
|
|
114
|
+
>
|
|
115
|
+
<SlateEditor
|
|
116
|
+
index={index}
|
|
117
|
+
readOnly={!inView}
|
|
118
|
+
properties={properties}
|
|
119
|
+
extensions={extensions}
|
|
120
|
+
renderExtensions={[withBlockProperties /*, getEditor*/]}
|
|
121
|
+
value={_value}
|
|
122
|
+
block={block /* is this needed? */}
|
|
123
|
+
slateSettings={otherProps.slateSettings}
|
|
124
|
+
onFocus={() => {
|
|
125
|
+
if (!selected) {
|
|
126
|
+
selectThis();
|
|
192
127
|
}
|
|
193
|
-
|
|
194
|
-
if (
|
|
195
|
-
!disableMoveToNearest &&
|
|
196
|
-
this.props.onSelectBlock &&
|
|
197
|
-
this.props.onAddBlock
|
|
198
|
-
) {
|
|
199
|
-
const selectionState = this.state.editorState.getSelection();
|
|
200
|
-
const anchorKey = selectionState.getAnchorKey();
|
|
201
|
-
const currentContent =
|
|
202
|
-
this.state.editorState.getCurrentContent();
|
|
203
|
-
const currentContentBlock =
|
|
204
|
-
currentContent.getBlockForKey(anchorKey);
|
|
205
|
-
const blockType = currentContentBlock.getType();
|
|
206
|
-
if (!includes(this.draftConfig.listBlockTypes, blockType)) {
|
|
207
|
-
this.props.onSelectBlock(
|
|
208
|
-
this.props.onAddBlock('text', this.props.index + 1),
|
|
209
|
-
);
|
|
210
|
-
return 'handled';
|
|
211
|
-
}
|
|
212
|
-
return 'un-handled';
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return {};
|
|
216
128
|
}}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
this.props.setFocus(this.props.prevFocus);
|
|
220
|
-
e.stopPropagation();
|
|
221
|
-
} else {
|
|
222
|
-
if (this.props.disableMoveToNearest) {
|
|
223
|
-
e.stopPropagation();
|
|
224
|
-
} else {
|
|
225
|
-
if (this.props.onFocusPreviousBlock) {
|
|
226
|
-
const selectionState =
|
|
227
|
-
this.state.editorState.getSelection();
|
|
228
|
-
const currentCursorPosition =
|
|
229
|
-
selectionState.getStartOffset();
|
|
129
|
+
onChange={(value, selection, editor) => {
|
|
130
|
+
let v = value;
|
|
230
131
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}}
|
|
241
|
-
onDownArrow={(e) => {
|
|
242
|
-
if (this.props.nextFocus) {
|
|
243
|
-
this.props.setFocus(this.props.nextFocus);
|
|
244
|
-
e.stopPropagation();
|
|
245
|
-
} else {
|
|
246
|
-
if (this.props.disableMoveToNearest) {
|
|
247
|
-
e.stopPropagation();
|
|
248
|
-
} else {
|
|
249
|
-
if (this.props.onFocusNextBlock) {
|
|
250
|
-
const selectionState =
|
|
251
|
-
this.state.editorState.getSelection();
|
|
252
|
-
const { editorState } = this.state;
|
|
253
|
-
const currentCursorPosition =
|
|
254
|
-
selectionState.getStartOffset();
|
|
255
|
-
const blockLength = editorState
|
|
256
|
-
.getCurrentContent()
|
|
257
|
-
.getFirstBlock()
|
|
258
|
-
.getLength();
|
|
132
|
+
let retVal = {
|
|
133
|
+
value: v,
|
|
134
|
+
plaintext: serializeNodesToText(value || []),
|
|
135
|
+
};
|
|
259
136
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
137
|
+
if (fieldName) {
|
|
138
|
+
retVal = { [fieldName]: v };
|
|
265
139
|
}
|
|
140
|
+
onChangeBlock(block, {
|
|
141
|
+
...data,
|
|
142
|
+
...retVal,
|
|
143
|
+
});
|
|
266
144
|
}}
|
|
267
|
-
|
|
268
|
-
|
|
145
|
+
selected={selected}
|
|
146
|
+
placeholder={placeholder}
|
|
147
|
+
onKeyDown={handleKeyDetached}
|
|
148
|
+
editableProps={{
|
|
149
|
+
'aria-multiline': 'true',
|
|
150
|
+
}}
|
|
151
|
+
onBlur={() => {
|
|
152
|
+
// //fix: click on toolbar dropdown items. But you cannot reselect h2 text for example if you go out of the block
|
|
153
|
+
// if (!show_sidebar_editor) {
|
|
154
|
+
// setSelected(fieldName ? null : false);
|
|
155
|
+
// }
|
|
269
156
|
}}
|
|
270
157
|
/>
|
|
271
|
-
{this.props.showToolbar && this.node && <InlineToolbar />}
|
|
272
158
|
</div>
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
injectLazyLibs([
|
|
282
|
-
'draftJs',
|
|
283
|
-
'draftJsLibIsSoftNewlineEvent',
|
|
284
|
-
'draftJsFilters',
|
|
285
|
-
'draftJsInlineToolbarPlugin',
|
|
286
|
-
'draftJsBlockBreakoutPlugin',
|
|
287
|
-
'draftJsCreateInlineStyleButton',
|
|
288
|
-
'draftJsCreateBlockStyleButton',
|
|
289
|
-
'immutableLib',
|
|
290
|
-
// TODO: add all plugin dependencies, also in Wysiwyg and Cell
|
|
291
|
-
]),
|
|
292
|
-
)(TextEditorWidgetComponent),
|
|
293
|
-
);
|
|
159
|
+
) : (
|
|
160
|
+
<div className="text-editor-inner simple-text">
|
|
161
|
+
<SimpleTextEditorWidget {...props} index={index} value={_value} />
|
|
162
|
+
</div>
|
|
163
|
+
)}
|
|
164
|
+
</div>
|
|
165
|
+
);
|
|
166
|
+
};
|
|
294
167
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
168
|
+
TextEditorWidget.propTypes = {
|
|
169
|
+
data: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
170
|
+
setSelected: PropTypes.func,
|
|
171
|
+
onChangeBlock: PropTypes.func.isRequired,
|
|
172
|
+
block: PropTypes.string.isRequired,
|
|
173
|
+
selected: PropTypes.bool.isRequired,
|
|
174
|
+
showToolbar: PropTypes.bool,
|
|
175
|
+
wrapClass: PropTypes.string,
|
|
176
|
+
focusPrevField: PropTypes.func,
|
|
177
|
+
focusNextField: PropTypes.func,
|
|
178
|
+
//from block props:
|
|
179
|
+
properties: PropTypes.objectOf(PropTypes.any).isRequired,
|
|
180
|
+
onFocusPreviousBlock: PropTypes.func.isRequired,
|
|
181
|
+
onFocusNextBlock: PropTypes.func.isRequired,
|
|
182
|
+
onSelectBlock: PropTypes.func.isRequired,
|
|
301
183
|
};
|
|
302
184
|
|
|
303
|
-
export default
|
|
185
|
+
export default connect(
|
|
186
|
+
(state, props) => {
|
|
187
|
+
const blockId = props.block;
|
|
188
|
+
return {
|
|
189
|
+
defaultSelection: blockId
|
|
190
|
+
? state.slate_block_selections?.[blockId]
|
|
191
|
+
: null,
|
|
192
|
+
uploadRequest: state.upload_content?.[props.block]?.upload || {},
|
|
193
|
+
uploadedContent: state.upload_content?.[props.block]?.data || {},
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
uploadContent,
|
|
198
|
+
saveSlateBlockSelection, // needed as editor blockProps
|
|
199
|
+
},
|
|
200
|
+
)(TextEditorWidget);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export {
|
|
2
2
|
addSchemaField,
|
|
3
3
|
templatesOptions,
|
|
4
|
-
cloneBlock,
|
|
5
4
|
} from 'design-comuni-plone-theme/config/Blocks/ListingOptions/utils';
|
|
6
5
|
export addDefaultOptions from 'design-comuni-plone-theme/config/Blocks/ListingOptions/defaultOptions';
|
|
7
6
|
export addDefaultAdditionalOptions from 'design-comuni-plone-theme/config/Blocks/ListingOptions/defaultAdditionalOptions';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defineMessages } from 'react-intl';
|
|
2
|
-
import { v4 as uuid } from 'uuid';
|
|
3
2
|
|
|
4
3
|
const messages = defineMessages({
|
|
5
4
|
show_icon: {
|
|
@@ -179,9 +178,3 @@ export const addLighthouseField = (schema, intl, position = 1) => {
|
|
|
179
178
|
|
|
180
179
|
return pos;
|
|
181
180
|
};
|
|
182
|
-
|
|
183
|
-
export const cloneBlock = (blockData) => {
|
|
184
|
-
const blockID = uuid();
|
|
185
|
-
const clonedData = { ...blockData, block: blockID };
|
|
186
|
-
return [blockID, clonedData];
|
|
187
|
-
};
|
|
@@ -65,7 +65,11 @@ import countDownSVG from 'design-comuni-plone-theme/icons/count-down.svg';
|
|
|
65
65
|
import CountDownBlockView from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/CountDown/View';
|
|
66
66
|
import CountDownBlockEdit from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/CountDown/Edit';
|
|
67
67
|
|
|
68
|
-
import
|
|
68
|
+
import calloutSVG from '@plone/volto/icons/megaphone.svg';
|
|
69
|
+
import CalloutView from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/Callout/View';
|
|
70
|
+
import CalloutEdit from 'design-comuni-plone-theme/components/ItaliaTheme/Blocks/Callout/Edit';
|
|
71
|
+
|
|
72
|
+
import { cloneBlock } from 'design-comuni-plone-theme/helpers/blocks';
|
|
69
73
|
|
|
70
74
|
const italiaBlocks = {
|
|
71
75
|
highlitedContent: {
|
|
@@ -204,7 +208,6 @@ const italiaBlocks = {
|
|
|
204
208
|
restricted: false,
|
|
205
209
|
mostUsed: false,
|
|
206
210
|
cloneData: cloneBlock,
|
|
207
|
-
blockHasOwnFocusManagement: true,
|
|
208
211
|
security: {
|
|
209
212
|
addPermission: [],
|
|
210
213
|
view: [],
|
|
@@ -222,7 +225,6 @@ const italiaBlocks = {
|
|
|
222
225
|
restricted: false,
|
|
223
226
|
mostUsed: false,
|
|
224
227
|
cloneData: cloneBlock,
|
|
225
|
-
blockHasOwnFocusManagement: true,
|
|
226
228
|
security: {
|
|
227
229
|
addPermission: [],
|
|
228
230
|
view: [],
|
|
@@ -238,7 +240,6 @@ const italiaBlocks = {
|
|
|
238
240
|
restricted: false,
|
|
239
241
|
mostUsed: false,
|
|
240
242
|
cloneData: cloneBlock,
|
|
241
|
-
blockHasOwnFocusManagement: true,
|
|
242
243
|
security: {
|
|
243
244
|
addPermission: [],
|
|
244
245
|
view: [],
|
|
@@ -277,6 +278,7 @@ const italiaBlocks = {
|
|
|
277
278
|
view: [],
|
|
278
279
|
},
|
|
279
280
|
sidebarTab: 1,
|
|
281
|
+
blockHasOwnFocusManagement: true,
|
|
280
282
|
},
|
|
281
283
|
iconBlocks: {
|
|
282
284
|
id: 'iconBlocks',
|
|
@@ -293,6 +295,7 @@ const italiaBlocks = {
|
|
|
293
295
|
view: [],
|
|
294
296
|
},
|
|
295
297
|
sidebarTab: 1,
|
|
298
|
+
blockHasOwnFocusManagement: true,
|
|
296
299
|
},
|
|
297
300
|
contacts: {
|
|
298
301
|
id: 'contacts',
|
|
@@ -309,6 +312,7 @@ const italiaBlocks = {
|
|
|
309
312
|
view: [],
|
|
310
313
|
},
|
|
311
314
|
sidebarTab: 1,
|
|
315
|
+
blockHasOwnFocusManagement: true,
|
|
312
316
|
},
|
|
313
317
|
|
|
314
318
|
video_gallery: {
|
|
@@ -337,7 +341,6 @@ const italiaBlocks = {
|
|
|
337
341
|
restricted: false,
|
|
338
342
|
mostUsed: false,
|
|
339
343
|
cloneData: cloneBlock,
|
|
340
|
-
blockHasOwnFocusManagement: true,
|
|
341
344
|
security: {
|
|
342
345
|
addPermission: [],
|
|
343
346
|
view: [],
|
|
@@ -359,15 +362,33 @@ const italiaBlocks = {
|
|
|
359
362
|
view: [],
|
|
360
363
|
},
|
|
361
364
|
sidebarTab: 1,
|
|
365
|
+
blockHasOwnFocusManagement: true,
|
|
366
|
+
},
|
|
367
|
+
callout_block: {
|
|
368
|
+
id: 'callout_block',
|
|
369
|
+
title: 'Callout',
|
|
370
|
+
icon: calloutSVG,
|
|
371
|
+
group: 'text',
|
|
372
|
+
view: CalloutView,
|
|
373
|
+
edit: CalloutEdit,
|
|
374
|
+
restricted: false,
|
|
375
|
+
mostUsed: false,
|
|
376
|
+
cloneData: cloneBlock,
|
|
377
|
+
security: {
|
|
378
|
+
addPermission: [],
|
|
379
|
+
view: [],
|
|
380
|
+
},
|
|
381
|
+
sidebarTab: 1,
|
|
382
|
+
blockHasOwnFocusManagement: true,
|
|
362
383
|
},
|
|
363
384
|
};
|
|
364
385
|
|
|
365
386
|
const getItaliaBlocks = (config) => {
|
|
366
387
|
delete config.blocks.blocksConfig.teaser;
|
|
367
388
|
config.blocks.blocksConfig.gridBlock.allowedBlocks =
|
|
368
|
-
config.blocks.blocksConfig.gridBlock.allowedBlocks
|
|
369
|
-
|
|
370
|
-
|
|
389
|
+
config.blocks.blocksConfig.gridBlock.allowedBlocks.filter(
|
|
390
|
+
(item) => !['teaser'].includes(item),
|
|
391
|
+
);
|
|
371
392
|
return italiaBlocks;
|
|
372
393
|
};
|
|
373
394
|
export default getItaliaBlocks;
|
|
@@ -66,8 +66,8 @@ import {
|
|
|
66
66
|
addLinkMoreOptions,
|
|
67
67
|
addSmallBlockLinksTemplateOptions,
|
|
68
68
|
addAttachmentCardTemplateOptions,
|
|
69
|
-
cloneBlock,
|
|
70
69
|
} from 'design-comuni-plone-theme/config/Blocks/ListingOptions';
|
|
70
|
+
import { cloneBlock } from 'design-comuni-plone-theme/helpers/blocks';
|
|
71
71
|
|
|
72
72
|
import { addLighthouseField } from 'design-comuni-plone-theme/config/Blocks/ListingOptions/utils';
|
|
73
73
|
|