design-comuni-plone-theme 11.10.1 → 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/install-state.gz +0 -0
- package/CHANGELOG.md +878 -904
- 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 +4 -2
- 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,106 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import unionClassNames from 'union-class-names';
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
Questo è un componente di utility che serve per fare i menu a tendina nella toolbar di draftjs.
|
|
7
|
-
Basta passargli le prop del componente stesso e nella prop optionsList l'elenco delle opzioni
|
|
8
|
-
da mostrare nella tendina.
|
|
9
|
-
*/
|
|
10
|
-
const DraftJsDropdownButton = (props) => {
|
|
11
|
-
const { theme, optionsList } = props;
|
|
12
|
-
const [open, setOpen] = useState(false);
|
|
13
|
-
|
|
14
|
-
const getCurrentBlockType = () => {
|
|
15
|
-
if (!props.getEditorState) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const editorState = props.getEditorState();
|
|
20
|
-
const type = editorState
|
|
21
|
-
.getCurrentContent()
|
|
22
|
-
.getBlockForKey(editorState.getSelection().getStartKey())
|
|
23
|
-
.getType();
|
|
24
|
-
return type;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const hasBlockStyle = () => {
|
|
28
|
-
const type = getCurrentBlockType();
|
|
29
|
-
return props.optionsList.map((o) => o.block_type).indexOf(type) >= 0;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const getDropdownToggleContent = () => {
|
|
33
|
-
const type = getCurrentBlockType();
|
|
34
|
-
let contentWhenSelected = props.optionsList.filter(
|
|
35
|
-
(o) => o.block_type === type,
|
|
36
|
-
)?.[0]?.contentWhenSelected;
|
|
37
|
-
|
|
38
|
-
return contentWhenSelected || props.content;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const className = hasBlockStyle()
|
|
42
|
-
? unionClassNames(theme.button, theme.active)
|
|
43
|
-
: theme.button;
|
|
44
|
-
|
|
45
|
-
const onMouseDown = (event) => {
|
|
46
|
-
event.preventDefault();
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const openDropdown = (e) => {
|
|
50
|
-
e.preventDefault();
|
|
51
|
-
e.stopPropagation();
|
|
52
|
-
setOpen(!open);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<div
|
|
57
|
-
className={`${theme.buttonWrapper} draftJsToolbarDropdown`}
|
|
58
|
-
onMouseDown={onMouseDown}
|
|
59
|
-
role="presentation"
|
|
60
|
-
>
|
|
61
|
-
<button
|
|
62
|
-
className={`${className} draftJsToolbarDropdown-toggle`}
|
|
63
|
-
onClick={openDropdown}
|
|
64
|
-
type="button"
|
|
65
|
-
>
|
|
66
|
-
{getDropdownToggleContent()}
|
|
67
|
-
<span className={`caret ${open ? 'up' : 'down'}`}></span>
|
|
68
|
-
</button>
|
|
69
|
-
|
|
70
|
-
<ul
|
|
71
|
-
className={`draftJsToolbarDropdown-optionswrapper ${
|
|
72
|
-
open ? '' : 'hide'
|
|
73
|
-
}`}
|
|
74
|
-
>
|
|
75
|
-
{optionsList.map((item) => {
|
|
76
|
-
let OptionButton = item.value;
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<li
|
|
80
|
-
key={item.block_type}
|
|
81
|
-
className="draftJsToolbarDropdown-option"
|
|
82
|
-
onClick={() => {
|
|
83
|
-
setOpen(false);
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
86
|
-
<OptionButton {...props} />
|
|
87
|
-
</li>
|
|
88
|
-
);
|
|
89
|
-
})}
|
|
90
|
-
</ul>
|
|
91
|
-
</div>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
DraftJsDropdownButton.propTypes = {
|
|
96
|
-
onChange: PropTypes.func,
|
|
97
|
-
editorState: PropTypes.object,
|
|
98
|
-
placeholder: PropTypes.string,
|
|
99
|
-
theme: PropTypes.shape({}).isRequired,
|
|
100
|
-
ownTheme: PropTypes.shape({}),
|
|
101
|
-
onOverrideContent: PropTypes.func.isRequired,
|
|
102
|
-
optionsList: PropTypes.arrayOf(
|
|
103
|
-
PropTypes.shape({ block_type: PropTypes.string, value: PropTypes.any }),
|
|
104
|
-
).isRequired,
|
|
105
|
-
};
|
|
106
|
-
export default React.memo(DraftJsDropdownButton);
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
4
|
-
import textSVG from '@plone/volto/icons/text.svg';
|
|
5
|
-
import DraftJsDropdownButton from './DraftJsDropdownButton';
|
|
6
|
-
|
|
7
|
-
const HeadingsButton = (props) => {
|
|
8
|
-
const createBlockStyleButton = props.draftJsCreateBlockStyleButton.default;
|
|
9
|
-
|
|
10
|
-
const options = [
|
|
11
|
-
{
|
|
12
|
-
block_type: 'header-two',
|
|
13
|
-
value: createBlockStyleButton({
|
|
14
|
-
blockType: 'header-two',
|
|
15
|
-
children: <h2>H2</h2>,
|
|
16
|
-
}),
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
block_type: 'header-three',
|
|
20
|
-
value: createBlockStyleButton({
|
|
21
|
-
blockType: 'header-three',
|
|
22
|
-
children: <h3>h3</h3>,
|
|
23
|
-
}),
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
block_type: 'header-four',
|
|
27
|
-
value: createBlockStyleButton({
|
|
28
|
-
blockType: 'header-four',
|
|
29
|
-
children: <h4>h4</h4>,
|
|
30
|
-
}),
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
block_type: 'header-five',
|
|
34
|
-
value: createBlockStyleButton({
|
|
35
|
-
blockType: 'header-five',
|
|
36
|
-
children: <h5>h5</h5>,
|
|
37
|
-
}),
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
block_type: 'header-six',
|
|
41
|
-
value: createBlockStyleButton({
|
|
42
|
-
blockType: 'header-six',
|
|
43
|
-
children: <h6>h6</h6>,
|
|
44
|
-
}),
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
return (_props) => (
|
|
49
|
-
<DraftJsDropdownButton
|
|
50
|
-
{..._props}
|
|
51
|
-
optionsList={options}
|
|
52
|
-
content={<Icon name={textSVG} size="24px" />}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export default HeadingsButton;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { defineMessages, useIntl } from 'react-intl';
|
|
3
|
-
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
4
|
-
|
|
5
|
-
// import DraftJsDropdownButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/DraftJsDropdownButton';
|
|
6
|
-
|
|
7
|
-
import formatSVG from '@plone/volto/icons/format.svg';
|
|
8
|
-
|
|
9
|
-
const messages = defineMessages({
|
|
10
|
-
TextSizeButton: {
|
|
11
|
-
id: 'text-size-button',
|
|
12
|
-
defaultMessage: 'Dimensione del testo',
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
/*
|
|
17
|
-
const TextSizeButton = (props) => {
|
|
18
|
-
const createInlineStyleButton = props.draftJsCreateInlineStyleButton.default;
|
|
19
|
-
|
|
20
|
-
const options = [
|
|
21
|
-
{
|
|
22
|
-
block_type: 'text-larger',
|
|
23
|
-
value: createInlineStyleButton({
|
|
24
|
-
style: 'TEXT_LARGER',
|
|
25
|
-
children: <Icon name={formatSVG} size="1.25em" />,
|
|
26
|
-
}),
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
block_type: 'text-smaller',
|
|
30
|
-
value: createInlineStyleButton({
|
|
31
|
-
style: 'TEXT_SMALLER',
|
|
32
|
-
children: <Icon name={formatSVG} size="0.75em" />,
|
|
33
|
-
}),
|
|
34
|
-
},
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
return (_props)=>(
|
|
38
|
-
<DraftJsDropdownButton
|
|
39
|
-
{..._props}
|
|
40
|
-
optionsList={options}
|
|
41
|
-
content={<Icon name={formatSVG} size="1em" />}
|
|
42
|
-
/>
|
|
43
|
-
);
|
|
44
|
-
};
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
const ButtonIcon = (props) => {
|
|
48
|
-
const intl = useIntl();
|
|
49
|
-
return (
|
|
50
|
-
<Icon
|
|
51
|
-
name={formatSVG}
|
|
52
|
-
size="1.25em"
|
|
53
|
-
title={intl.formatMessage(messages.TextSizeButton)}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const TextSizeButton = (props) => {
|
|
59
|
-
const createInlineStyleButton = props.draftJsCreateInlineStyleButton.default;
|
|
60
|
-
return createInlineStyleButton({
|
|
61
|
-
style: 'TEXT_LARGER',
|
|
62
|
-
children: <ButtonIcon />,
|
|
63
|
-
});
|
|
64
|
-
};
|
|
65
|
-
export default TextSizeButton;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import Icon from '@plone/volto/components/theme/Icon/Icon';
|
|
4
|
-
import underlineSVG from '@plone/volto/icons/underline.svg';
|
|
5
|
-
|
|
6
|
-
const UnderlineButton = (props) => {
|
|
7
|
-
const createInlineStyleButton = props.draftJsCreateInlineStyleButton.default;
|
|
8
|
-
return createInlineStyleButton({
|
|
9
|
-
style: 'UNDERLINE',
|
|
10
|
-
children: <Icon name={underlineSVG} size="24px" />,
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default UnderlineButton;
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Styles from '@plone/volto/config/RichTextEditor/Styles';
|
|
3
|
-
|
|
4
|
-
import ToHTMLRenderers from '@plone/volto/config/RichTextEditor/ToHTML';
|
|
5
|
-
import FromHTML from '@plone/volto/config/RichTextEditor/FromHTML';
|
|
6
|
-
import Plugins from '@plone/volto/config/RichTextEditor/Plugins';
|
|
7
|
-
import Blocks from '@plone/volto/config/RichTextEditor/Blocks';
|
|
8
|
-
//import FromHTMLCustomBlockFn from '@plone/volto/config/RichTextEditor/FromHTML';
|
|
9
|
-
|
|
10
|
-
import UnderlineButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/UnderlineButton';
|
|
11
|
-
import HeadingsButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/HeadingsButton';
|
|
12
|
-
import AlignButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/AlignButton';
|
|
13
|
-
import CalloutsButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/CalloutsButton';
|
|
14
|
-
import ButtonsButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/ButtonsButton';
|
|
15
|
-
import TextSizeButton from 'design-comuni-plone-theme/config/RichTextEditor/ToolbarButtons/TextSizeButton';
|
|
16
|
-
|
|
17
|
-
import LinkEntity from 'design-comuni-plone-theme/config/RichTextEditor/LinkEntity';
|
|
18
|
-
|
|
19
|
-
const ItaliaRichTextEditorPlugins = (props) => [];
|
|
20
|
-
const ItaliaRichTextEditorInlineToolbarButtons = (props, plugins) => {
|
|
21
|
-
const linkPlugin = plugins.filter((p) => p.LinkButton != null)[0];
|
|
22
|
-
const Separator = props.draftJsInlineToolbarPlugin.Separator;
|
|
23
|
-
|
|
24
|
-
const buttons = Styles(props);
|
|
25
|
-
const {
|
|
26
|
-
BoldButton,
|
|
27
|
-
ItalicButton,
|
|
28
|
-
// HeadlineTwoButton,
|
|
29
|
-
// HeadlineThreeButton,
|
|
30
|
-
UnorderedListButton,
|
|
31
|
-
OrderedListButton,
|
|
32
|
-
BlockquoteButton,
|
|
33
|
-
// CalloutButton,
|
|
34
|
-
} = buttons;
|
|
35
|
-
|
|
36
|
-
return [
|
|
37
|
-
AlignButton,
|
|
38
|
-
Separator,
|
|
39
|
-
BoldButton,
|
|
40
|
-
ItalicButton,
|
|
41
|
-
UnderlineButton(props),
|
|
42
|
-
TextSizeButton(props),
|
|
43
|
-
Separator,
|
|
44
|
-
HeadingsButton(props),
|
|
45
|
-
linkPlugin.LinkButton,
|
|
46
|
-
ButtonsButton(props),
|
|
47
|
-
Separator,
|
|
48
|
-
UnorderedListButton,
|
|
49
|
-
OrderedListButton,
|
|
50
|
-
BlockquoteButton,
|
|
51
|
-
CalloutsButton(props),
|
|
52
|
-
];
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const renderHTMLBlock = (child) => {
|
|
56
|
-
return child.map((subchild) => {
|
|
57
|
-
if (Array.isArray(subchild)) {
|
|
58
|
-
return subchild.map((subchildren) => {
|
|
59
|
-
if (typeof subchildren === 'string') {
|
|
60
|
-
const last = subchildren.split('\n').length - 1;
|
|
61
|
-
return subchildren.split('\n').map((item, index) => (
|
|
62
|
-
<React.Fragment key={index}>
|
|
63
|
-
{item}
|
|
64
|
-
{index !== last && <br />}
|
|
65
|
-
</React.Fragment>
|
|
66
|
-
));
|
|
67
|
-
} else {
|
|
68
|
-
return subchildren;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
} else {
|
|
72
|
-
return subchild;
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
const ItaliaBlocksHtmlRenderers = {
|
|
77
|
-
blockquote: (children, { keys }) =>
|
|
78
|
-
children.map((child, i) => (
|
|
79
|
-
<blockquote key={keys[i]}>{renderHTMLBlock(child)}</blockquote>
|
|
80
|
-
)),
|
|
81
|
-
'align-center': (children, { keys }) =>
|
|
82
|
-
children.map((child, i) => (
|
|
83
|
-
<p id={keys[i]} key={keys[i]} className="text-center">
|
|
84
|
-
{renderHTMLBlock(child)}
|
|
85
|
-
</p>
|
|
86
|
-
)),
|
|
87
|
-
'align-right': (children, { keys }) =>
|
|
88
|
-
children.map((child, i) => (
|
|
89
|
-
<p id={keys[i]} key={keys[i]} className="text-end">
|
|
90
|
-
{renderHTMLBlock(child)}
|
|
91
|
-
</p>
|
|
92
|
-
)),
|
|
93
|
-
'align-justify': (children, { keys }) =>
|
|
94
|
-
children.map((child, i) => (
|
|
95
|
-
<p id={keys[i]} key={keys[i]} className="text-justify">
|
|
96
|
-
{renderHTMLBlock(child)}
|
|
97
|
-
</p>
|
|
98
|
-
)),
|
|
99
|
-
callout: (children, { keys }) =>
|
|
100
|
-
children.map((child, i) => (
|
|
101
|
-
<p id={keys[i]} key={keys[i]} className="callout" role="note">
|
|
102
|
-
{renderHTMLBlock(child)}
|
|
103
|
-
</p>
|
|
104
|
-
)),
|
|
105
|
-
'callout-bg': (children, { keys }) =>
|
|
106
|
-
children.map((child, i) => (
|
|
107
|
-
<p id={keys[i]} key={keys[i]} className="callout-bg" role="note">
|
|
108
|
-
{renderHTMLBlock(child)}
|
|
109
|
-
</p>
|
|
110
|
-
)),
|
|
111
|
-
buttons: (children, { keys }) =>
|
|
112
|
-
children.map((child, i) => (
|
|
113
|
-
<p id={keys[i]} key={keys[i]} className="draftjs-buttons">
|
|
114
|
-
{renderHTMLBlock(child)}
|
|
115
|
-
</p>
|
|
116
|
-
)),
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const ItaliaInlineHtmlRenderers = {
|
|
120
|
-
TEXT_LARGER: (children, { key }) => (
|
|
121
|
-
<span key={key} className="draftjs-text-larger">
|
|
122
|
-
{children}
|
|
123
|
-
</span>
|
|
124
|
-
),
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
const ItaliaFromHTMLCustomBlockFn = (element) => {
|
|
128
|
-
let ret = FromHTML(element); //get default from plone/volto
|
|
129
|
-
|
|
130
|
-
if (!ret) {
|
|
131
|
-
if (element.className === 'callout-bg') {
|
|
132
|
-
ret = {
|
|
133
|
-
type: 'callout-bg',
|
|
134
|
-
};
|
|
135
|
-
} else if (element.className === 'draftjs-buttons') {
|
|
136
|
-
ret = {
|
|
137
|
-
type: 'buttons',
|
|
138
|
-
};
|
|
139
|
-
} else if (element.className === 'text-center') {
|
|
140
|
-
ret = {
|
|
141
|
-
type: 'align-center',
|
|
142
|
-
};
|
|
143
|
-
} else if (element.className === 'text-end') {
|
|
144
|
-
ret = {
|
|
145
|
-
type: 'align-right',
|
|
146
|
-
};
|
|
147
|
-
} else if (element.className === 'text-justify') {
|
|
148
|
-
ret = {
|
|
149
|
-
type: 'align-justify',
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return ret;
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const ItaliaFromHTMLCustomInlineFn = (element, { Style }) => {
|
|
157
|
-
if (element.tagName === 'SPAN') {
|
|
158
|
-
if (element.className === 'draftjs-text-larger') {
|
|
159
|
-
return Style('TEXT_LARGER');
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
export default function applyConfig(config) {
|
|
165
|
-
config.settings.richtextEditorSettings = (props) => {
|
|
166
|
-
const { plugins /*, inlineToolbarButtons*/ } = Plugins(props); // volto plugins
|
|
167
|
-
const { extendedBlockRenderMap, blockStyleFn, listBlockTypes } = Blocks(
|
|
168
|
-
props,
|
|
169
|
-
);
|
|
170
|
-
|
|
171
|
-
const { immutableLib } = props;
|
|
172
|
-
const { Map } = immutableLib;
|
|
173
|
-
|
|
174
|
-
const blockRenderMap = Map({
|
|
175
|
-
'align-center': {
|
|
176
|
-
element: (props) => <p {...props} style={{ textAlign: 'center' }} />,
|
|
177
|
-
},
|
|
178
|
-
'align-right': {
|
|
179
|
-
element: (props) => <p {...props} style={{ textAlign: 'right' }} />,
|
|
180
|
-
},
|
|
181
|
-
'align-justify': {
|
|
182
|
-
element: (props) => <p {...props} style={{ textAlign: 'justify' }} />,
|
|
183
|
-
},
|
|
184
|
-
'callout-bg': {
|
|
185
|
-
element: 'p',
|
|
186
|
-
},
|
|
187
|
-
buttons: {
|
|
188
|
-
element: 'p',
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
const italiaBlockStyleFunction = (contentBlock) => {
|
|
193
|
-
const type = contentBlock.getType();
|
|
194
|
-
|
|
195
|
-
let r = blockStyleFn(contentBlock) || '';
|
|
196
|
-
r = r.length > 0 ? ' ' : r;
|
|
197
|
-
|
|
198
|
-
const styles = {
|
|
199
|
-
callout: 'callout',
|
|
200
|
-
'callout-bg': 'callout-bg',
|
|
201
|
-
buttons: 'draftjs-buttons',
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
r += styles[type] ?? '';
|
|
205
|
-
|
|
206
|
-
return r;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
return {
|
|
210
|
-
extendedBlockRenderMap: extendedBlockRenderMap
|
|
211
|
-
.update('text-center', (element = 'p') => element)
|
|
212
|
-
.merge(blockRenderMap),
|
|
213
|
-
voltoBlockStyleFn: blockStyleFn,
|
|
214
|
-
blockStyleFn: italiaBlockStyleFunction,
|
|
215
|
-
listBlockTypes: listBlockTypes,
|
|
216
|
-
richTextEditorPlugins: [
|
|
217
|
-
...plugins,
|
|
218
|
-
...ItaliaRichTextEditorPlugins(props),
|
|
219
|
-
],
|
|
220
|
-
richTextEditorInlineToolbarButtons: ItaliaRichTextEditorInlineToolbarButtons(
|
|
221
|
-
props,
|
|
222
|
-
plugins,
|
|
223
|
-
), //[inlineToolbarButtons,...ItaliaRichTextEditorInlineToolbarButtons(props)]
|
|
224
|
-
FromHTMLCustomBlockFn: ItaliaFromHTMLCustomBlockFn,
|
|
225
|
-
FromHTMLCustomInlineFn: ItaliaFromHTMLCustomInlineFn,
|
|
226
|
-
customStyleMap: {
|
|
227
|
-
TEXT_LARGER: { fontSize: '1.75rem' },
|
|
228
|
-
},
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
// TODO: rimuovere questa customizzazione quando sistemano https://github.com/plone/volto/issues/1601
|
|
233
|
-
config.settings.richtextViewSettings.ToHTMLRenderers = {
|
|
234
|
-
...config.settings.richtextViewSettings.ToHTMLRenderers,
|
|
235
|
-
entities: {
|
|
236
|
-
...config.settings.richtextViewSettings.ToHTMLRenderers.entities,
|
|
237
|
-
LINK: (children, props, other) => {
|
|
238
|
-
return (
|
|
239
|
-
<LinkEntity key={other.key} {...props}>
|
|
240
|
-
{children}
|
|
241
|
-
</LinkEntity>
|
|
242
|
-
);
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
blocks: {
|
|
246
|
-
...ToHTMLRenderers.blocks,
|
|
247
|
-
...ItaliaBlocksHtmlRenderers,
|
|
248
|
-
},
|
|
249
|
-
inline: { ...ToHTMLRenderers.inline, ...ItaliaInlineHtmlRenderers },
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
return config;
|
|
253
|
-
}
|