@plone/volto 18.0.0-alpha.3 → 18.0.0-alpha.4
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/.eslintrc +3 -3
- package/.prettierignore +8 -0
- package/.prettierrc +12 -0
- package/{packages/registry/.release-it.json → .release-it.json} +11 -6
- package/CHANGELOG.md +29 -4
- package/package.json +57 -127
- package/razzle.config.js +4 -7
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.jsx +2 -2
- package/src/components/manage/Form/Form.jsx +5 -2
- package/src/config/index.js +0 -4
- package/src/icons/divide-horizontal.svg +0 -0
- package/src/icons/divide-vertical.svg +0 -0
- package/src/icons/hero.svg +0 -0
- package/src/icons/slider.svg +0 -0
- package/src/icons/summary.svg +0 -0
- package/src/middleware/api.js +1 -1
- package/theme/themes/default/elements/icon.overrides +0 -0
- package/theme/themes/default/globals/reset.overrides +0 -0
- package/theme/themes/default/globals/site.variables +0 -0
- package/theme/themes/default/modules/dropdown.overrides +0 -0
- package/theme/themes/default/modules/dropdown.variables +0 -0
- package/theme/themes/default/modules/modal.variables +0 -0
- package/theme/themes/default/modules/video.overrides +0 -0
- package/theme/themes/default/modules/video.variables +0 -0
- package/theme/themes/pastanaga/assets/fonts/icons.eot +0 -0
- package/theme/themes/pastanaga/assets/fonts/icons.svg +0 -0
- package/theme/themes/pastanaga/assets/fonts/icons.ttf +0 -0
- package/theme/themes/pastanaga/assets/fonts/icons.woff +0 -0
- package/theme/themes/pastanaga/globals/reset.overrides +0 -0
- package/theme/themes/pastanaga/globals/site.variables +0 -0
- package/theme/themes/pastanaga/modules/dropdown.variables +0 -0
- package/theme/themes/pastanaga/modules/modal.variables +0 -0
- package/theme/themes/pastanaga/modules/video.overrides +0 -0
- package/theme/themes/pastanaga/modules/video.variables +0 -0
- package/tsconfig.json +1 -4
- package/types/config/RichTextEditor/index.d.ts +5 -8
- package/types/helpers/AsyncConnect/index.d.ts +2 -2
- package/types/helpers/Url/Url.d.ts +3 -3
- package/types/icons/load-icons.d.ts +1 -1
- package/webpack-plugins/webpack-less-plugin.js +1 -0
- package/CODE_OF_CONDUCT.md +0 -13
- package/CONTRIBUTING.md +0 -7
- package/README.md +0 -154
- package/RELEASING.md +0 -73
- package/ROADMAP.md +0 -30
- package/SECURITY.md +0 -14
- package/apps/plone/node_modules/.bin/acorn +0 -17
- package/apps/plone/node_modules/.bin/addon +0 -17
- package/apps/plone/node_modules/.bin/autoprefixer +0 -17
- package/apps/plone/node_modules/.bin/browserslist +0 -17
- package/apps/plone/node_modules/.bin/build-storybook +0 -17
- package/apps/plone/node_modules/.bin/changelogupdater +0 -17
- package/apps/plone/node_modules/.bin/eslint +0 -17
- package/apps/plone/node_modules/.bin/eslint-config-prettier +0 -17
- package/apps/plone/node_modules/.bin/i18n +0 -17
- package/apps/plone/node_modules/.bin/jest +0 -17
- package/apps/plone/node_modules/.bin/lessc +0 -17
- package/apps/plone/node_modules/.bin/missdev +0 -17
- package/apps/plone/node_modules/.bin/prettier +0 -17
- package/apps/plone/node_modules/.bin/razzle +0 -17
- package/apps/plone/node_modules/.bin/server-test +0 -17
- package/apps/plone/node_modules/.bin/start-server-and-test +0 -17
- package/apps/plone/node_modules/.bin/start-storybook +0 -17
- package/apps/plone/node_modules/.bin/start-test +0 -17
- package/apps/plone/node_modules/.bin/storybook-server +0 -17
- package/apps/plone/node_modules/.bin/stylelint +0 -17
- package/apps/plone/node_modules/.bin/tlds +0 -17
- package/apps/plone/node_modules/.bin/ts-jest +0 -17
- package/apps/plone/node_modules/.bin/tsc +0 -17
- package/apps/plone/node_modules/.bin/tsserver +0 -17
- package/apps/plone/node_modules/.bin/uuid +0 -17
- package/apps/plone/node_modules/.bin/webpack +0 -17
- package/apps/plone/node_modules/.bin/webpack-dev-server +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/acorn +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/addon +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/browserslist +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/changelogupdater +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/eslint +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/eslint-config-prettier +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/i18n +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/prettier +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/release-it +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/stylelint +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/tsc +0 -17
- package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/tsserver +0 -17
- package/logos/Logo.png +0 -0
- package/logos/VoltoLogoEra2-dark-mode.png +0 -0
- package/logos/VoltoLogoEra2.png +0 -0
- package/logos/volto-colorful.png +0 -0
- package/logos/volto-colorful.svg +0 -35
- package/logos/volto-guide.png +0 -0
- package/logos/volto-h-transparent.svg +0 -6
- package/logos/volto-transparent.png +0 -0
- package/logos/volto-transparent.svg +0 -19
- package/logos/volto-transparent2.svg +0 -5
- package/logos/volto-yellow.svg +0 -29
- package/logos/volto.sketch +0 -0
- package/packages/README.md +0 -7
- package/packages/registry/.towncrier/towncrier_template.jinja +0 -10
- package/packages/registry/CHANGELOG.md +0 -16
- package/packages/registry/README.md +0 -207
- package/packages/registry/addon-registry.js +0 -603
- package/packages/registry/create-addons-loader.js +0 -116
- package/packages/registry/create-theme-addons-loader.js +0 -78
- package/packages/registry/news/.gitkeep +0 -0
- package/packages/registry/node_modules/.bin/browserslist +0 -17
- package/packages/registry/node_modules/.bin/parcel +0 -17
- package/packages/registry/node_modules/.bin/release-it +0 -17
- package/packages/registry/node_modules/.bin/tsc +0 -17
- package/packages/registry/node_modules/.bin/tsserver +0 -17
- package/packages/registry/node_modules/.bin/vitest +0 -17
- package/packages/registry/package.json +0 -76
- package/packages/registry/src/index.ts +0 -174
- package/packages/registry/src/registry.test.js +0 -111
- package/packages/registry/tsconfig.json +0 -32
- package/packages/scripts/CHANGELOG.md +0 -173
- package/packages/scripts/README.md +0 -128
- package/packages/scripts/addon/consolidate.js +0 -28
- package/packages/scripts/addon/generators.js +0 -213
- package/packages/scripts/addon/getAddonInfo.js +0 -65
- package/packages/scripts/addon/index.js +0 -88
- package/packages/scripts/addon/utils.js +0 -44
- package/packages/scripts/backportpr.js +0 -75
- package/packages/scripts/changelogupdater.cjs +0 -94
- package/packages/scripts/corepackagebump.js +0 -20
- package/packages/scripts/i18n.cjs +0 -310
- package/packages/scripts/package.json +0 -76
- package/packages/scripts/templates/towncrier_template.jinja +0 -10
- package/packages/types/Blocks/View.ts +0 -11
- package/packages/types/actions.ts +0 -15
- package/packages/types/breadcrumbs.ts +0 -10
- package/packages/types/config/Blocks.ts +0 -153
- package/packages/types/config/Content.ts +0 -62
- package/packages/types/config/Settings.ts +0 -86
- package/packages/types/config/Views.ts +0 -15
- package/packages/types/config/Widgets.ts +0 -7
- package/packages/types/config/index.ts +0 -21
- package/packages/types/content/common.ts +0 -60
- package/packages/types/content/get.ts +0 -66
- package/packages/types/index.ts +0 -0
- package/packages/types/navigation.ts +0 -12
- package/packages/types/node_modules/.bin/browserslist +0 -17
- package/packages/types/node_modules/.bin/parcel +0 -17
- package/packages/types/node_modules/.bin/release-it +0 -17
- package/packages/types/node_modules/.bin/tsc +0 -17
- package/packages/types/node_modules/.bin/tsserver +0 -17
- package/packages/types/package.json +0 -64
- package/packages/types/types.ts +0 -61
- package/packages/volto-slate/.i18n.babel.config.js +0 -1
- package/packages/volto-slate/README.md +0 -4
- package/packages/volto-slate/build/messages/src/blocks/Table/TableBlockEdit.json +0 -90
- package/packages/volto-slate/build/messages/src/blocks/Text/DefaultTextBlockEditor.json +0 -6
- package/packages/volto-slate/build/messages/src/blocks/Text/DetachedTextBlockEditor.json +0 -6
- package/packages/volto-slate/build/messages/src/blocks/Text/SlashMenu.json +0 -6
- package/packages/volto-slate/build/messages/src/editor/plugins/AdvancedLink/index.json +0 -10
- package/packages/volto-slate/build/messages/src/editor/plugins/Link/index.json +0 -10
- package/packages/volto-slate/build/messages/src/editor/plugins/Table/index.json +0 -30
- package/packages/volto-slate/build/messages/src/elementEditor/messages.json +0 -10
- package/packages/volto-slate/build/messages/src/widgets/HtmlSlateWidget.json +0 -6
- package/packages/volto-slate/build/messages/src/widgets/RichTextWidgetView.json +0 -6
- package/packages/volto-slate/locales/de/LC_MESSAGES/volto.po +0 -148
- package/packages/volto-slate/locales/en/LC_MESSAGES/volto.po +0 -148
- package/packages/volto-slate/locales/volto.pot +0 -182
- package/packages/volto-slate/package.json +0 -43
- package/packages/volto-slate/src/actions/content.js +0 -30
- package/packages/volto-slate/src/actions/index.js +0 -3
- package/packages/volto-slate/src/actions/plugins.js +0 -9
- package/packages/volto-slate/src/actions/selection.js +0 -22
- package/packages/volto-slate/src/blocks/Table/Cell.jsx +0 -87
- package/packages/volto-slate/src/blocks/Table/Cell.test.js +0 -54
- package/packages/volto-slate/src/blocks/Table/TableBlockEdit.jsx +0 -694
- package/packages/volto-slate/src/blocks/Table/TableBlockEdit.test.js +0 -40
- package/packages/volto-slate/src/blocks/Table/TableBlockView.jsx +0 -150
- package/packages/volto-slate/src/blocks/Table/TableBlockView.test.js +0 -49
- package/packages/volto-slate/src/blocks/Table/deconstruct.js +0 -113
- package/packages/volto-slate/src/blocks/Table/extensions/normalizeTable.js +0 -5
- package/packages/volto-slate/src/blocks/Table/index.js +0 -60
- package/packages/volto-slate/src/blocks/Table/schema.js +0 -122
- package/packages/volto-slate/src/blocks/Text/DefaultTextBlockEditor.jsx +0 -304
- package/packages/volto-slate/src/blocks/Text/DetachedTextBlockEditor.jsx +0 -77
- package/packages/volto-slate/src/blocks/Text/MarkdownIntroduction.jsx +0 -59
- package/packages/volto-slate/src/blocks/Text/PluginSidebar.jsx +0 -18
- package/packages/volto-slate/src/blocks/Text/ShortcutListing.jsx +0 -28
- package/packages/volto-slate/src/blocks/Text/SlashMenu.jsx +0 -203
- package/packages/volto-slate/src/blocks/Text/TextBlockEdit.jsx +0 -38
- package/packages/volto-slate/src/blocks/Text/TextBlockEdit.test.js +0 -107
- package/packages/volto-slate/src/blocks/Text/TextBlockSchema.js +0 -54
- package/packages/volto-slate/src/blocks/Text/TextBlockView.jsx +0 -31
- package/packages/volto-slate/src/blocks/Text/css/editor.css +0 -18
- package/packages/volto-slate/src/blocks/Text/extensions/Readme.md +0 -49
- package/packages/volto-slate/src/blocks/Text/extensions/breakList.js +0 -100
- package/packages/volto-slate/src/blocks/Text/extensions/index.js +0 -6
- package/packages/volto-slate/src/blocks/Text/extensions/insertBreak.js +0 -57
- package/packages/volto-slate/src/blocks/Text/extensions/isSelected.js +0 -7
- package/packages/volto-slate/src/blocks/Text/extensions/normalizeExternalData.js +0 -7
- package/packages/volto-slate/src/blocks/Text/extensions/withDeserializers.js +0 -87
- package/packages/volto-slate/src/blocks/Text/extensions/withLists.js +0 -5
- package/packages/volto-slate/src/blocks/Text/index.js +0 -171
- package/packages/volto-slate/src/blocks/Text/keyboard/backspaceInList.js +0 -58
- package/packages/volto-slate/src/blocks/Text/keyboard/breakBlocks.js +0 -3
- package/packages/volto-slate/src/blocks/Text/keyboard/cancelEsc.js +0 -7
- package/packages/volto-slate/src/blocks/Text/keyboard/indentListItems.js +0 -240
- package/packages/volto-slate/src/blocks/Text/keyboard/index.js +0 -52
- package/packages/volto-slate/src/blocks/Text/keyboard/joinBlocks.js +0 -180
- package/packages/volto-slate/src/blocks/Text/keyboard/moveListItems.js +0 -124
- package/packages/volto-slate/src/blocks/Text/keyboard/slashMenu.js +0 -19
- package/packages/volto-slate/src/blocks/Text/keyboard/softBreak.js +0 -7
- package/packages/volto-slate/src/blocks/Text/keyboard/traverseBlocks.js +0 -81
- package/packages/volto-slate/src/blocks/Text/keyboard/unwrapEmptyString.js +0 -26
- package/packages/volto-slate/src/blocks/Text/schema.js +0 -39
- package/packages/volto-slate/src/constants.js +0 -123
- package/packages/volto-slate/src/editor/EditorContext.jsx +0 -5
- package/packages/volto-slate/src/editor/EditorReference.jsx +0 -22
- package/packages/volto-slate/src/editor/SlateEditor.jsx +0 -375
- package/packages/volto-slate/src/editor/config.jsx +0 -344
- package/packages/volto-slate/src/editor/decorate.js +0 -68
- package/packages/volto-slate/src/editor/deserialize.js +0 -185
- package/packages/volto-slate/src/editor/extensions/index.js +0 -6
- package/packages/volto-slate/src/editor/extensions/insertBreak.js +0 -15
- package/packages/volto-slate/src/editor/extensions/insertData.js +0 -159
- package/packages/volto-slate/src/editor/extensions/isInline.js +0 -14
- package/packages/volto-slate/src/editor/extensions/normalizeExternalData.js +0 -8
- package/packages/volto-slate/src/editor/extensions/normalizeNode.js +0 -48
- package/packages/volto-slate/src/editor/extensions/withDeserializers.js +0 -15
- package/packages/volto-slate/src/editor/extensions/withTestingFeatures.jsx +0 -84
- package/packages/volto-slate/src/editor/index.js +0 -14
- package/packages/volto-slate/src/editor/less/editor.less +0 -173
- package/packages/volto-slate/src/editor/less/globals.less +0 -18
- package/packages/volto-slate/src/editor/less/slate.less +0 -28
- package/packages/volto-slate/src/editor/plugins/AdvancedLink/deserialize.js +0 -90
- package/packages/volto-slate/src/editor/plugins/AdvancedLink/extensions.js +0 -32
- package/packages/volto-slate/src/editor/plugins/AdvancedLink/index.js +0 -50
- package/packages/volto-slate/src/editor/plugins/AdvancedLink/render.jsx +0 -37
- package/packages/volto-slate/src/editor/plugins/AdvancedLink/schema.js +0 -114
- package/packages/volto-slate/src/editor/plugins/AdvancedLink/styles.less +0 -8
- package/packages/volto-slate/src/editor/plugins/Blockquote/index.js +0 -30
- package/packages/volto-slate/src/editor/plugins/Callout/index.js +0 -34
- package/packages/volto-slate/src/editor/plugins/Image/deconstruct.js +0 -30
- package/packages/volto-slate/src/editor/plugins/Image/extensions.js +0 -51
- package/packages/volto-slate/src/editor/plugins/Image/index.js +0 -11
- package/packages/volto-slate/src/editor/plugins/Image/render.jsx +0 -22
- package/packages/volto-slate/src/editor/plugins/Link/extensions.js +0 -58
- package/packages/volto-slate/src/editor/plugins/Link/index.js +0 -164
- package/packages/volto-slate/src/editor/plugins/Link/render.jsx +0 -54
- package/packages/volto-slate/src/editor/plugins/Markdown/constants.js +0 -81
- package/packages/volto-slate/src/editor/plugins/Markdown/extensions.js +0 -334
- package/packages/volto-slate/src/editor/plugins/Markdown/index.js +0 -28
- package/packages/volto-slate/src/editor/plugins/Markdown/utils.js +0 -198
- package/packages/volto-slate/src/editor/plugins/StyleMenu/StyleMenu.jsx +0 -153
- package/packages/volto-slate/src/editor/plugins/StyleMenu/index.js +0 -19
- package/packages/volto-slate/src/editor/plugins/StyleMenu/style.less +0 -29
- package/packages/volto-slate/src/editor/plugins/StyleMenu/utils.js +0 -168
- package/packages/volto-slate/src/editor/plugins/Table/TableButton.jsx +0 -142
- package/packages/volto-slate/src/editor/plugins/Table/TableCell.jsx +0 -44
- package/packages/volto-slate/src/editor/plugins/Table/TableContainer.jsx +0 -37
- package/packages/volto-slate/src/editor/plugins/Table/TableSizePicker.jsx +0 -83
- package/packages/volto-slate/src/editor/plugins/Table/extensions.js +0 -87
- package/packages/volto-slate/src/editor/plugins/Table/index.js +0 -390
- package/packages/volto-slate/src/editor/plugins/Table/less/public.less +0 -29
- package/packages/volto-slate/src/editor/plugins/Table/less/table.less +0 -28
- package/packages/volto-slate/src/editor/plugins/Table/render.jsx +0 -30
- package/packages/volto-slate/src/editor/plugins/index.js +0 -19
- package/packages/volto-slate/src/editor/render.jsx +0 -224
- package/packages/volto-slate/src/editor/ui/BasicToolbar.jsx +0 -11
- package/packages/volto-slate/src/editor/ui/BlockButton.jsx +0 -31
- package/packages/volto-slate/src/editor/ui/ClearFormattingButton.jsx +0 -21
- package/packages/volto-slate/src/editor/ui/ExpandedToolbar.jsx +0 -18
- package/packages/volto-slate/src/editor/ui/Expando.jsx +0 -5
- package/packages/volto-slate/src/editor/ui/InlineToolbar.jsx +0 -73
- package/packages/volto-slate/src/editor/ui/MarkButton.jsx +0 -23
- package/packages/volto-slate/src/editor/ui/MarkElementButton.jsx +0 -30
- package/packages/volto-slate/src/editor/ui/Menu.jsx +0 -13
- package/packages/volto-slate/src/editor/ui/PositionedToolbar.jsx +0 -32
- package/packages/volto-slate/src/editor/ui/Separator.jsx +0 -7
- package/packages/volto-slate/src/editor/ui/SlateContextToolbar.jsx +0 -13
- package/packages/volto-slate/src/editor/ui/SlateToolbar.jsx +0 -96
- package/packages/volto-slate/src/editor/ui/Toolbar.jsx +0 -103
- package/packages/volto-slate/src/editor/ui/ToolbarButton.jsx +0 -33
- package/packages/volto-slate/src/editor/ui/ToolbarButton.test.js +0 -25
- package/packages/volto-slate/src/editor/ui/index.js +0 -15
- package/packages/volto-slate/src/editor/utils.js +0 -248
- package/packages/volto-slate/src/elementEditor/ContextButtons.jsx +0 -56
- package/packages/volto-slate/src/elementEditor/PluginEditor.jsx +0 -124
- package/packages/volto-slate/src/elementEditor/Readme.md +0 -6
- package/packages/volto-slate/src/elementEditor/SchemaProvider.jsx +0 -3
- package/packages/volto-slate/src/elementEditor/SidebarEditor.jsx +0 -46
- package/packages/volto-slate/src/elementEditor/ToolbarButton.jsx +0 -44
- package/packages/volto-slate/src/elementEditor/index.js +0 -5
- package/packages/volto-slate/src/elementEditor/makeInlineElementPlugin.js +0 -100
- package/packages/volto-slate/src/elementEditor/messages.js +0 -14
- package/packages/volto-slate/src/elementEditor/utils.js +0 -226
- package/packages/volto-slate/src/hooks/index.js +0 -3
- package/packages/volto-slate/src/hooks/useEditorContext.js +0 -6
- package/packages/volto-slate/src/hooks/useIsomorphicLayoutEffect.js +0 -7
- package/packages/volto-slate/src/hooks/useSelectionPosition.js +0 -25
- package/packages/volto-slate/src/i18n.js +0 -180
- package/packages/volto-slate/src/icons/hashlink.svg +0 -57
- package/packages/volto-slate/src/index.js +0 -61
- package/packages/volto-slate/src/reducers/content.js +0 -74
- package/packages/volto-slate/src/reducers/index.js +0 -3
- package/packages/volto-slate/src/reducers/plugins.js +0 -17
- package/packages/volto-slate/src/reducers/selection.js +0 -16
- package/packages/volto-slate/src/utils/blocks.js +0 -375
- package/packages/volto-slate/src/utils/blocks.test.js +0 -138
- package/packages/volto-slate/src/utils/editor.js +0 -31
- package/packages/volto-slate/src/utils/image.js +0 -25
- package/packages/volto-slate/src/utils/index.js +0 -11
- package/packages/volto-slate/src/utils/internals.js +0 -46
- package/packages/volto-slate/src/utils/lists.js +0 -92
- package/packages/volto-slate/src/utils/marks.js +0 -104
- package/packages/volto-slate/src/utils/mime-types.js +0 -24
- package/packages/volto-slate/src/utils/nodes.js +0 -4
- package/packages/volto-slate/src/utils/ops.js +0 -20
- package/packages/volto-slate/src/utils/random.js +0 -17
- package/packages/volto-slate/src/utils/selection.js +0 -236
- package/packages/volto-slate/src/utils/slate-string-utils.js +0 -408
- package/packages/volto-slate/src/utils/volto-blocks.js +0 -314
- package/packages/volto-slate/src/widgets/ErrorBoundary.jsx +0 -27
- package/packages/volto-slate/src/widgets/HtmlSlateWidget.jsx +0 -139
- package/packages/volto-slate/src/widgets/ObjectByTypeWidget.jsx +0 -49
- package/packages/volto-slate/src/widgets/RichTextWidget.jsx +0 -72
- package/packages/volto-slate/src/widgets/RichTextWidgetView.jsx +0 -37
- package/packages/volto-slate/src/widgets/style.css +0 -21
- package/types/components/manage/Blocks/Video/Body.test.d.ts +0 -1
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export class ErrorBoundary extends React.Component {
|
|
4
|
-
constructor(props) {
|
|
5
|
-
super(props);
|
|
6
|
-
this.state = { hasError: false };
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
static getDerivedStateFromError(error) {
|
|
10
|
-
// Update state so the next render will show the fallback UI.
|
|
11
|
-
return { hasError: true };
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
componentDidCatch(error, errorInfo) {
|
|
15
|
-
// eslint-disable-next-line
|
|
16
|
-
console.error(error, errorInfo);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
render() {
|
|
20
|
-
if (this.state.hasError) {
|
|
21
|
-
// You can render any custom fallback UI
|
|
22
|
-
return <pre className="slate error">{`ERROR: ${this.props.name}`}</pre>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return this.props.children;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* HtmlSlateWidget, a slate widget variant that saves its data as HTML
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import ReactDOMServer from 'react-dom/server';
|
|
7
|
-
import configureStore from 'redux-mock-store';
|
|
8
|
-
import { MemoryRouter } from 'react-router-dom';
|
|
9
|
-
import { Provider, useSelector } from 'react-redux';
|
|
10
|
-
import { defineMessages, injectIntl } from 'react-intl';
|
|
11
|
-
|
|
12
|
-
import { FormFieldWrapper } from '@plone/volto/components';
|
|
13
|
-
import SlateEditor from '@plone/volto-slate/editor/SlateEditor';
|
|
14
|
-
import { serializeNodes } from '@plone/volto-slate/editor/render';
|
|
15
|
-
import { makeEditor } from '@plone/volto-slate/utils';
|
|
16
|
-
import deserialize from '@plone/volto-slate/editor/deserialize';
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
createEmptyParagraph,
|
|
20
|
-
normalizeExternalData,
|
|
21
|
-
} from '@plone/volto-slate/utils';
|
|
22
|
-
import { ErrorBoundary } from './ErrorBoundary';
|
|
23
|
-
|
|
24
|
-
import './style.css';
|
|
25
|
-
|
|
26
|
-
const messages = defineMessages({
|
|
27
|
-
error: {
|
|
28
|
-
id:
|
|
29
|
-
'An error has occurred while editing "{name}" field. We have been notified and we are looking into it. Please save your work and retry. If the issue persists please contact the site administrator.',
|
|
30
|
-
defaultMessage:
|
|
31
|
-
'An error has occurred while editing "{name}" field. We have been notified and we are looking into it. Please save your work and retry. If the issue persists please contact the site administrator.',
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const HtmlSlateWidget = (props) => {
|
|
36
|
-
const {
|
|
37
|
-
id,
|
|
38
|
-
onChange,
|
|
39
|
-
value,
|
|
40
|
-
focus,
|
|
41
|
-
className,
|
|
42
|
-
block,
|
|
43
|
-
placeholder,
|
|
44
|
-
properties,
|
|
45
|
-
intl,
|
|
46
|
-
} = props;
|
|
47
|
-
|
|
48
|
-
const [selected, setSelected] = React.useState(focus);
|
|
49
|
-
|
|
50
|
-
const editor = React.useMemo(() => makeEditor(), []);
|
|
51
|
-
|
|
52
|
-
const token = useSelector((state) => state.userSession.token);
|
|
53
|
-
|
|
54
|
-
const toHtml = React.useCallback(
|
|
55
|
-
(value) => {
|
|
56
|
-
const mockStore = configureStore();
|
|
57
|
-
const html = ReactDOMServer.renderToStaticMarkup(
|
|
58
|
-
<Provider store={mockStore({ userSession: { token } })}>
|
|
59
|
-
<MemoryRouter>{serializeNodes(value || [])}</MemoryRouter>
|
|
60
|
-
</Provider>,
|
|
61
|
-
);
|
|
62
|
-
// console.log('toHtml value', JSON.stringify(value));
|
|
63
|
-
// console.log('toHtml html', html);
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
'content-type': value ? value['content-type'] : 'text/html',
|
|
67
|
-
encoding: value ? value.encoding : 'utf8',
|
|
68
|
-
data: html,
|
|
69
|
-
};
|
|
70
|
-
},
|
|
71
|
-
[token],
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
const fromHtml = React.useCallback(
|
|
75
|
-
(value) => {
|
|
76
|
-
const html = value?.data || '';
|
|
77
|
-
|
|
78
|
-
const parsed = new DOMParser().parseFromString(html, 'text/html');
|
|
79
|
-
const body =
|
|
80
|
-
parsed.getElementsByTagName('google-sheets-html-origin').length > 0
|
|
81
|
-
? parsed.querySelector('google-sheets-html-origin > table')
|
|
82
|
-
: parsed.body;
|
|
83
|
-
let data = deserialize(editor, body, { collapseWhitespace: false });
|
|
84
|
-
data = normalizeExternalData(editor, data);
|
|
85
|
-
|
|
86
|
-
// editor.children = data;
|
|
87
|
-
// Editor.normalize(editor);
|
|
88
|
-
// TODO: need to add {text: ""} placeholders between elements
|
|
89
|
-
const res = data.length ? data : [createEmptyParagraph()];
|
|
90
|
-
// console.log('from html', { html: value?.data, res });
|
|
91
|
-
return res;
|
|
92
|
-
},
|
|
93
|
-
[editor],
|
|
94
|
-
);
|
|
95
|
-
|
|
96
|
-
const valueFromHtml = React.useMemo(() => {
|
|
97
|
-
return fromHtml(value);
|
|
98
|
-
}, [value, fromHtml]);
|
|
99
|
-
|
|
100
|
-
const handleChange = React.useCallback(
|
|
101
|
-
(newValue) => {
|
|
102
|
-
onChange(id, toHtml(newValue));
|
|
103
|
-
},
|
|
104
|
-
[onChange, toHtml, id],
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
const handleClick = React.useCallback(() => {
|
|
108
|
-
setSelected(true);
|
|
109
|
-
}, []);
|
|
110
|
-
|
|
111
|
-
return (
|
|
112
|
-
<FormFieldWrapper {...props} draggable={false} className="slate_wysiwyg">
|
|
113
|
-
<div
|
|
114
|
-
className="slate_wysiwyg_box"
|
|
115
|
-
role="textbox"
|
|
116
|
-
tabIndex="-1"
|
|
117
|
-
style={{ boxSizing: 'initial' }}
|
|
118
|
-
onClick={handleClick}
|
|
119
|
-
onKeyDown={() => {}}
|
|
120
|
-
>
|
|
121
|
-
<ErrorBoundary name={intl.formatMessage(messages.error, { name: id })}>
|
|
122
|
-
<SlateEditor
|
|
123
|
-
className={className}
|
|
124
|
-
id={id}
|
|
125
|
-
name={id}
|
|
126
|
-
value={valueFromHtml}
|
|
127
|
-
onChange={handleChange}
|
|
128
|
-
block={block}
|
|
129
|
-
selected={selected}
|
|
130
|
-
properties={properties}
|
|
131
|
-
placeholder={placeholder}
|
|
132
|
-
/>
|
|
133
|
-
</ErrorBoundary>
|
|
134
|
-
</div>
|
|
135
|
-
</FormFieldWrapper>
|
|
136
|
-
);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export default injectIntl(HtmlSlateWidget);
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Menu, Tab } from 'semantic-ui-react';
|
|
3
|
-
import { Icon, ObjectWidget } from '@plone/volto/components';
|
|
4
|
-
|
|
5
|
-
export const ObjectByTypeWidget = (props) => {
|
|
6
|
-
const { schemas, value = {}, onChange, errors = {}, id } = props;
|
|
7
|
-
const objectId = id;
|
|
8
|
-
|
|
9
|
-
const schemaIds = schemas.map(({ id }) => id);
|
|
10
|
-
const defaultActiveTab = value
|
|
11
|
-
? schemaIds.indexOf(Object.keys(value)[0])
|
|
12
|
-
: null;
|
|
13
|
-
|
|
14
|
-
const [activeTab, setActiveTab] = React.useState(
|
|
15
|
-
defaultActiveTab > -1 ? defaultActiveTab : 0,
|
|
16
|
-
);
|
|
17
|
-
const createTab = ({ schema, id, icon }, index) => {
|
|
18
|
-
return {
|
|
19
|
-
menuItem: () => (
|
|
20
|
-
<Menu.Item
|
|
21
|
-
onClick={() => setActiveTab(index)}
|
|
22
|
-
active={activeTab === index}
|
|
23
|
-
key={id}
|
|
24
|
-
>
|
|
25
|
-
<Icon size="24px" name={icon} title={schema.title} />
|
|
26
|
-
</Menu.Item>
|
|
27
|
-
),
|
|
28
|
-
render: () => {
|
|
29
|
-
return (
|
|
30
|
-
<Tab.Pane>
|
|
31
|
-
<ObjectWidget
|
|
32
|
-
schema={schema}
|
|
33
|
-
id={id}
|
|
34
|
-
errors={errors}
|
|
35
|
-
value={value[id] || {}}
|
|
36
|
-
onChange={(schemaId, v) => {
|
|
37
|
-
onChange(objectId, { [schemaId]: v });
|
|
38
|
-
}}
|
|
39
|
-
/>
|
|
40
|
-
</Tab.Pane>
|
|
41
|
-
);
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return <Tab panes={schemas.map(createTab)} activeIndex={activeTab} />;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export default ObjectByTypeWidget;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A Slate widget that uses internal JSON representation as its value
|
|
3
|
-
*
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import isUndefined from 'lodash/isUndefined';
|
|
8
|
-
import isString from 'lodash/isString';
|
|
9
|
-
import { FormFieldWrapper } from '@plone/volto/components';
|
|
10
|
-
import SlateEditor from '@plone/volto-slate/editor/SlateEditor';
|
|
11
|
-
|
|
12
|
-
import { createEmptyParagraph, createParagraph } from '../utils/blocks';
|
|
13
|
-
|
|
14
|
-
import './style.css';
|
|
15
|
-
|
|
16
|
-
const getValue = (value) => {
|
|
17
|
-
if (isUndefined(value) || !isUndefined(value?.data)) {
|
|
18
|
-
return [createEmptyParagraph()];
|
|
19
|
-
}
|
|
20
|
-
// Previously this was a text field
|
|
21
|
-
if (isString(value)) {
|
|
22
|
-
return [createParagraph(value)];
|
|
23
|
-
}
|
|
24
|
-
return value;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const SlateRichTextWidget = (props) => {
|
|
28
|
-
const {
|
|
29
|
-
id,
|
|
30
|
-
onChange,
|
|
31
|
-
value,
|
|
32
|
-
focus,
|
|
33
|
-
className,
|
|
34
|
-
block,
|
|
35
|
-
placeholder,
|
|
36
|
-
properties,
|
|
37
|
-
readOnly = false,
|
|
38
|
-
} = props;
|
|
39
|
-
const [selected, setSelected] = React.useState(focus);
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<FormFieldWrapper {...props} draggable={false} className="slate_wysiwyg">
|
|
43
|
-
<div
|
|
44
|
-
className="slate_wysiwyg_box"
|
|
45
|
-
role="textbox"
|
|
46
|
-
tabIndex="-1"
|
|
47
|
-
style={{ boxSizing: 'initial' }}
|
|
48
|
-
onClick={() => {
|
|
49
|
-
setSelected(true);
|
|
50
|
-
}}
|
|
51
|
-
onKeyDown={() => {}}
|
|
52
|
-
>
|
|
53
|
-
<SlateEditor
|
|
54
|
-
className={className}
|
|
55
|
-
readOnly={readOnly}
|
|
56
|
-
id={id}
|
|
57
|
-
name={id}
|
|
58
|
-
value={getValue(value)}
|
|
59
|
-
onChange={(newValue) => {
|
|
60
|
-
onChange(id, newValue);
|
|
61
|
-
}}
|
|
62
|
-
block={block}
|
|
63
|
-
selected={selected}
|
|
64
|
-
properties={properties}
|
|
65
|
-
placeholder={placeholder}
|
|
66
|
-
/>
|
|
67
|
-
</div>
|
|
68
|
-
</FormFieldWrapper>
|
|
69
|
-
);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export default SlateRichTextWidget;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import cx from 'classnames';
|
|
3
|
-
import config from '@plone/volto/registry';
|
|
4
|
-
import { ErrorBoundary } from './ErrorBoundary';
|
|
5
|
-
import { defineMessages, injectIntl } from 'react-intl';
|
|
6
|
-
import './style.css';
|
|
7
|
-
|
|
8
|
-
const messages = defineMessages({
|
|
9
|
-
error: {
|
|
10
|
-
id:
|
|
11
|
-
'An error has occurred while rendering "{name}" field. We have been notified and we are looking into it. If the issue persists please contact the site administrator.',
|
|
12
|
-
defaultMessage:
|
|
13
|
-
'An error has occurred while rendering "{name}" field. We have been notified and we are looking into it. If the issue persists please contact the site administrator.',
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export const SlateRichTextWidgetView = ({
|
|
18
|
-
value,
|
|
19
|
-
children,
|
|
20
|
-
className,
|
|
21
|
-
intl,
|
|
22
|
-
}) => {
|
|
23
|
-
const Block = config.blocks.blocksConfig.slate.view;
|
|
24
|
-
return value ? (
|
|
25
|
-
<ErrorBoundary
|
|
26
|
-
name={intl.formatMessage(messages.error, { name: className })}
|
|
27
|
-
>
|
|
28
|
-
<div className={cx(className, 'slate', 'widget')}>
|
|
29
|
-
<Block data={{ value: value }}>{children}</Block>
|
|
30
|
-
</div>
|
|
31
|
-
</ErrorBoundary>
|
|
32
|
-
) : (
|
|
33
|
-
''
|
|
34
|
-
);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export default injectIntl(SlateRichTextWidgetView);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
.slate_wysiwyg_box {
|
|
2
|
-
padding: 2px 3px;
|
|
3
|
-
border-bottom: 1px solid #c7d5d8;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.metadata.mention.slate.widget {
|
|
7
|
-
display: inline;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.metadata.mention.slate.widget > :first-child {
|
|
11
|
-
display: inline;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.metadata.mention.slate.widget > :last-child {
|
|
15
|
-
display: inline;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.slate.error {
|
|
19
|
-
color: #f00;
|
|
20
|
-
white-space: normal;
|
|
21
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|