@plone/volto 18.0.0-alpha.3 → 18.0.0-alpha.5
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/.eslintignore +1 -0
- package/.eslintrc +3 -3
- package/.prettierignore +8 -0
- package/.prettierrc +12 -0
- package/{packages/registry/.release-it.json → .release-it.json} +12 -6
- package/CHANGELOG.md +50 -4
- package/package.json +60 -127
- package/razzle.config.js +4 -7
- package/src/components/manage/Add/Add.jsx +6 -0
- package/src/components/manage/BlockChooser/BlockChooser.jsx +3 -1
- package/src/components/manage/BlockChooser/BlockChooserButton.jsx +5 -0
- package/src/components/manage/Blocks/Block/BlocksForm.jsx +4 -0
- package/src/components/manage/Blocks/Block/DefaultEdit.jsx +3 -1
- package/src/components/manage/Blocks/Block/EditBlockWrapper.jsx +5 -0
- package/src/components/manage/Blocks/Block/Settings.jsx +10 -1
- package/src/components/manage/Blocks/Container/Data.jsx +4 -1
- package/src/components/manage/Blocks/HeroImageLeft/Data.jsx +3 -1
- package/src/components/manage/Blocks/Image/ImageSidebar.jsx +4 -1
- package/src/components/manage/Blocks/Listing/ListingData.jsx +4 -1
- package/src/components/manage/Blocks/Maps/MapsSidebar.jsx +3 -1
- package/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +4 -0
- package/src/components/manage/Blocks/Teaser/Data.jsx +4 -1
- package/src/components/manage/Blocks/ToC/Edit.jsx +2 -0
- package/src/components/manage/Blocks/Video/VideoSidebar.jsx +3 -1
- package/src/components/manage/Controlpanels/Users/UserGroupMembershipControlPanel.jsx +2 -2
- package/src/components/manage/Edit/Edit.jsx +1 -0
- package/src/components/manage/Form/Form.jsx +14 -3
- package/src/components/theme/Image/Image.jsx +4 -2
- package/src/components/theme/Image/Image.test.jsx +32 -0
- package/src/config/index.js +0 -4
- package/src/helpers/Blocks/Blocks.js +11 -2
- package/src/helpers/Extensions/withBlockSchemaEnhancer.js +20 -9
- package/src/helpers/Url/Url.js +5 -4
- package/src/helpers/Url/Url.test.js +52 -0
- 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/Extensions/withBlockSchemaEnhancer.d.ts +3 -1
- 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,159 +0,0 @@
|
|
|
1
|
-
import { Editor, Text, Transforms } from 'slate';
|
|
2
|
-
import { deserialize } from '@plone/volto-slate/editor/deserialize';
|
|
3
|
-
import {
|
|
4
|
-
createBlock,
|
|
5
|
-
createDefaultBlock,
|
|
6
|
-
MIMETypeName,
|
|
7
|
-
normalizeExternalData,
|
|
8
|
-
} from '@plone/volto-slate/utils';
|
|
9
|
-
import { isBlockActive } from '../../utils/blocks';
|
|
10
|
-
|
|
11
|
-
export const insertData = (editor) => {
|
|
12
|
-
editor.dataTransferHandlers = {
|
|
13
|
-
...editor.dataTransferHandlers,
|
|
14
|
-
'application/x-slate-fragment': (dt, fullMime) => {
|
|
15
|
-
const decoded = decodeURIComponent(window.atob(dt));
|
|
16
|
-
const parsed = JSON.parse(decoded);
|
|
17
|
-
editor.beforeInsertFragment && editor.beforeInsertFragment(parsed);
|
|
18
|
-
editor.insertFragment(parsed);
|
|
19
|
-
|
|
20
|
-
return true;
|
|
21
|
-
},
|
|
22
|
-
'text/html': (dt, fullMime) => {
|
|
23
|
-
const parsed = new DOMParser().parseFromString(dt, 'text/html');
|
|
24
|
-
|
|
25
|
-
const body =
|
|
26
|
-
parsed.getElementsByTagName('google-sheets-html-origin').length > 0
|
|
27
|
-
? parsed.querySelector('google-sheets-html-origin > table')
|
|
28
|
-
: parsed.body;
|
|
29
|
-
|
|
30
|
-
let fragment;
|
|
31
|
-
|
|
32
|
-
// eslint-disable-next-line no-console
|
|
33
|
-
console.debug('clipboard operation', {
|
|
34
|
-
clipboard: dt,
|
|
35
|
-
parsedBody: body,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const val = deserialize(editor, body);
|
|
39
|
-
fragment = Array.isArray(val) ? val : [val];
|
|
40
|
-
fragment = editor.normalizeExternalData(fragment);
|
|
41
|
-
|
|
42
|
-
editor.insertFragment(fragment);
|
|
43
|
-
|
|
44
|
-
// eslint-disable-next-line no-console
|
|
45
|
-
console.debug('result clipboard operation', {
|
|
46
|
-
clipboard: dt,
|
|
47
|
-
parsedBody: body,
|
|
48
|
-
deserializedValue: val,
|
|
49
|
-
normalizedFragment: fragment,
|
|
50
|
-
editorChildren: editor.children,
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return true;
|
|
54
|
-
},
|
|
55
|
-
'text/plain': (dt, fullMime) => {
|
|
56
|
-
const text = dt;
|
|
57
|
-
if (!text) return;
|
|
58
|
-
|
|
59
|
-
const paras = text.split('\n');
|
|
60
|
-
|
|
61
|
-
// If just 1 line insert text
|
|
62
|
-
if (paras.length === 1) {
|
|
63
|
-
Transforms.insertText(editor, paras[0]);
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Check if inside a list
|
|
68
|
-
const fragment =
|
|
69
|
-
isBlockActive(editor, 'ul') || isBlockActive(editor, 'ol')
|
|
70
|
-
? paras.map((p) => createBlock('li', [{ text: p }]))
|
|
71
|
-
: paras.map((p) => createDefaultBlock([{ text: p }]));
|
|
72
|
-
|
|
73
|
-
// check if fragment is p with text and insert as fragment if so
|
|
74
|
-
const fragmentContainsText = (f) => {
|
|
75
|
-
var trigger = false;
|
|
76
|
-
if (f && f[0]) {
|
|
77
|
-
f.forEach((frag) => {
|
|
78
|
-
if (frag.type === 'p') {
|
|
79
|
-
if (frag.children) {
|
|
80
|
-
frag.children.forEach((child) => {
|
|
81
|
-
if (child.text) {
|
|
82
|
-
trigger = true;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
return trigger;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
// When there's already text in the editor, insert a fragment, not nodes
|
|
93
|
-
const containsText = fragmentContainsText(fragment);
|
|
94
|
-
if (fragment && containsText) {
|
|
95
|
-
Transforms.insertFragment(editor, fragment);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if (Editor.string(editor, [])) {
|
|
99
|
-
if (
|
|
100
|
-
Array.isArray(fragment) &&
|
|
101
|
-
fragment.findIndex((b) => Editor.isInline(b) || Text.isText(b)) > -1
|
|
102
|
-
) {
|
|
103
|
-
// console.log('insert fragment', fragment);
|
|
104
|
-
// TODO: we want normalization also when dealing with fragments
|
|
105
|
-
Transforms.insertFragment(editor, fragment);
|
|
106
|
-
return true;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// always normalize when dealing with plain text
|
|
111
|
-
const nodes = normalizeExternalData(editor, fragment);
|
|
112
|
-
if (!containsText) {
|
|
113
|
-
Transforms.insertNodes(editor, nodes);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return true;
|
|
117
|
-
},
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
// TODO: use the rtf data to get the embedded images.
|
|
121
|
-
// const text = data.getData('text/rtf');
|
|
122
|
-
|
|
123
|
-
const { insertData } = editor;
|
|
124
|
-
|
|
125
|
-
// TODO: move this to extensions/insertData
|
|
126
|
-
// TODO: update and improve comments & docs related to
|
|
127
|
-
// `dataTransferFormatsOrder` and `dataTransferHandlers` features
|
|
128
|
-
editor.insertData = (data) => {
|
|
129
|
-
if (editor.beforeInsertData) {
|
|
130
|
-
editor.beforeInsertData(data);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
for (let i = 0; i < editor.dataTransferFormatsOrder.length; ++i) {
|
|
134
|
-
const dt = editor.dataTransferFormatsOrder[i];
|
|
135
|
-
if (dt === 'files') {
|
|
136
|
-
const { files } = data;
|
|
137
|
-
if (files && files.length > 0) {
|
|
138
|
-
// or handled here
|
|
139
|
-
return editor.dataTransferHandlers['files'](files);
|
|
140
|
-
}
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
const satisfyingFormats = data.types.filter((y) =>
|
|
144
|
-
new MIMETypeName(dt).matches(new MIMETypeName(y)),
|
|
145
|
-
);
|
|
146
|
-
for (let j = 0; j < satisfyingFormats.length; ++j) {
|
|
147
|
-
const y = satisfyingFormats[j];
|
|
148
|
-
if (editor.dataTransferHandlers[dt](data.getData(y), y)) {
|
|
149
|
-
// handled here
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
// not handled until this point
|
|
155
|
-
return insertData(data);
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
return editor;
|
|
159
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import config from '@plone/volto/registry';
|
|
2
|
-
|
|
3
|
-
export const isInline = (editor) => {
|
|
4
|
-
const { isInline } = editor;
|
|
5
|
-
const { slate } = config.settings;
|
|
6
|
-
|
|
7
|
-
editor.isInline = (element) => {
|
|
8
|
-
return element && slate.inlineElements.includes(element.type)
|
|
9
|
-
? true
|
|
10
|
-
: isInline(element);
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
return editor;
|
|
14
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Text, Transforms, Element, Node } from 'slate'; // Editor,
|
|
2
|
-
import config from '@plone/volto/registry';
|
|
3
|
-
|
|
4
|
-
export const normalizeNode = (editor) => {
|
|
5
|
-
// enforce list rules (no block elements, only ol/ul/li as possible children
|
|
6
|
-
const { normalizeNode } = editor;
|
|
7
|
-
const { slate } = config.settings;
|
|
8
|
-
|
|
9
|
-
const validListElements = [...slate.listTypes, slate.listItemType];
|
|
10
|
-
|
|
11
|
-
editor.normalizeNode = (entry) => {
|
|
12
|
-
const [node, path] = entry;
|
|
13
|
-
|
|
14
|
-
const isTextNode = Text.isText(node);
|
|
15
|
-
const isInlineNode = editor.isInline(node);
|
|
16
|
-
const isElementNode = Element.isElement(node);
|
|
17
|
-
const isListTypeNode = slate.listTypes.includes(node.type);
|
|
18
|
-
|
|
19
|
-
// delete childless ul/ol nodes
|
|
20
|
-
if (!isTextNode && isElementNode && !isInlineNode && isListTypeNode) {
|
|
21
|
-
if ((node.children || []).length === 0) {
|
|
22
|
-
Transforms.removeNodes(editor, { at: path });
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (isElementNode && isListTypeNode) {
|
|
28
|
-
// lift all child nodes of ul/ol that are not ul/ol/li
|
|
29
|
-
for (const [child, childPath] of Node.children(editor, path)) {
|
|
30
|
-
if (
|
|
31
|
-
!validListElements.includes(child.type) &&
|
|
32
|
-
!validListElements.includes(node.type)
|
|
33
|
-
) {
|
|
34
|
-
Transforms.liftNodes(editor, { at: childPath, split: true });
|
|
35
|
-
|
|
36
|
-
// Alternate strategy, need to investigate
|
|
37
|
-
// const newParent = { type: slate.defaultBlockType, children: [] };
|
|
38
|
-
// Transforms.wrapNodes(editor, newParent, { at: childPath });
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
normalizeNode(entry);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
return editor;
|
|
48
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import config from '@plone/volto/registry';
|
|
2
|
-
|
|
3
|
-
export const withDeserializers = (editor) => {
|
|
4
|
-
// Saving a copy of these deserializers in the editor makes possible to have
|
|
5
|
-
// different deserializers per editor
|
|
6
|
-
//
|
|
7
|
-
// For example, for the TextBlock deserializer we exclude h1,h4,h5,h6 tags
|
|
8
|
-
// and handle lists very differently
|
|
9
|
-
|
|
10
|
-
const { slate } = config.settings;
|
|
11
|
-
|
|
12
|
-
editor.htmlTagsToSlate = slate.htmlTagsToSlate;
|
|
13
|
-
|
|
14
|
-
return editor;
|
|
15
|
-
};
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { ReactEditor } from 'slate-react';
|
|
3
|
-
import { omit } from 'lodash';
|
|
4
|
-
|
|
5
|
-
const withTestingFeatures = (WrappedComponent) => {
|
|
6
|
-
return (props) => {
|
|
7
|
-
let ref = React.useRef();
|
|
8
|
-
|
|
9
|
-
// Source: https://stackoverflow.com/a/53623568/258462
|
|
10
|
-
const onTestSelectWord = (val) => {
|
|
11
|
-
let slateEditor =
|
|
12
|
-
val.detail.parentElement.parentElement.parentElement.parentElement;
|
|
13
|
-
|
|
14
|
-
// Events are special, can't use spread or Object.keys
|
|
15
|
-
let selectEvent = {};
|
|
16
|
-
for (let key in val) {
|
|
17
|
-
if (key === 'currentTarget') {
|
|
18
|
-
selectEvent['currentTarget'] = slateEditor;
|
|
19
|
-
} else if (key === 'type') {
|
|
20
|
-
selectEvent['type'] = 'select';
|
|
21
|
-
} else {
|
|
22
|
-
selectEvent[key] = val[key];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Make selection
|
|
27
|
-
let selection = window.getSelection();
|
|
28
|
-
let range = document.createRange();
|
|
29
|
-
range.selectNodeContents(val.detail);
|
|
30
|
-
selection.removeAllRanges();
|
|
31
|
-
selection.addRange(range);
|
|
32
|
-
|
|
33
|
-
// Slate monitors DOM selection changes automatically
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const onTestSelectRange = (val) => {
|
|
37
|
-
const newDomRange =
|
|
38
|
-
val && ReactEditor.toDOMRange(window.focusedSlateEditor, val.detail);
|
|
39
|
-
|
|
40
|
-
let selection = window.getSelection();
|
|
41
|
-
selection.removeAllRanges();
|
|
42
|
-
selection.addRange(newDomRange);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
React.useEffect(() => {
|
|
46
|
-
document.addEventListener('Test_SelectWord', onTestSelectWord);
|
|
47
|
-
document.addEventListener('Test_SelectRange', onTestSelectRange);
|
|
48
|
-
return () => {
|
|
49
|
-
document.removeEventListener('Test_SelectWord', onTestSelectWord);
|
|
50
|
-
document.removeEventListener('Test_SelectRange', onTestSelectRange);
|
|
51
|
-
};
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const handleFocus = React.useCallback(() => {
|
|
55
|
-
window.focusedSlateEditor = ref?.current;
|
|
56
|
-
if (props.onFocus) {
|
|
57
|
-
props.onFocus();
|
|
58
|
-
}
|
|
59
|
-
}, [props]);
|
|
60
|
-
|
|
61
|
-
const managedProps = useMemo(() => {
|
|
62
|
-
return omit(props, 'onFocus');
|
|
63
|
-
}, [props]);
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<WrappedComponent
|
|
67
|
-
debug
|
|
68
|
-
debug-values={{
|
|
69
|
-
'data-slate-value': JSON.stringify(props.value, null, 2),
|
|
70
|
-
'data-slate-selection': JSON.stringify(
|
|
71
|
-
ref?.current?.selection,
|
|
72
|
-
null,
|
|
73
|
-
2,
|
|
74
|
-
),
|
|
75
|
-
}}
|
|
76
|
-
testingEditorRef={ref}
|
|
77
|
-
onFocus={handleFocus}
|
|
78
|
-
{...managedProps}
|
|
79
|
-
/>
|
|
80
|
-
);
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export default withTestingFeatures;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as slateConfig from './config';
|
|
2
|
-
import installDefaultPlugins from './plugins';
|
|
3
|
-
export { default as SlateEditor } from './SlateEditor';
|
|
4
|
-
export { default as EditorReference } from './EditorReference';
|
|
5
|
-
|
|
6
|
-
export default function applyConfig(config) {
|
|
7
|
-
config.settings.slate = {
|
|
8
|
-
...slateConfig,
|
|
9
|
-
// showExpandedToolbar: false,
|
|
10
|
-
enableExpandedToolbar: false,
|
|
11
|
-
};
|
|
12
|
-
config = installDefaultPlugins(config);
|
|
13
|
-
return config;
|
|
14
|
-
}
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
@import 'globals.less';
|
|
2
|
-
|
|
3
|
-
@addon: '@plone/volto-slate';
|
|
4
|
-
@addontype: 'editor';
|
|
5
|
-
@addonelement: 'slate';
|
|
6
|
-
|
|
7
|
-
.loadAddonVariables();
|
|
8
|
-
|
|
9
|
-
// TODO: move these to less variables
|
|
10
|
-
|
|
11
|
-
& {
|
|
12
|
-
.slate-inline-toolbar {
|
|
13
|
-
position: absolute;
|
|
14
|
-
|
|
15
|
-
/* should be above admin panes (100), and below the Link modal form (1000) */
|
|
16
|
-
z-index: 1500;
|
|
17
|
-
|
|
18
|
-
top: -10000px;
|
|
19
|
-
left: -10000px;
|
|
20
|
-
|
|
21
|
-
max-width: 100vw;
|
|
22
|
-
opacity: 0;
|
|
23
|
-
// transition: opacity 0.5s;
|
|
24
|
-
|
|
25
|
-
&.upper {
|
|
26
|
-
transform: translateY(-100%);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.toolbar-wrapper.active {
|
|
31
|
-
margin-bottom: 0.6em;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.slate-editor p {
|
|
35
|
-
/* In editor the <p> are wrapped in weird markup */
|
|
36
|
-
margin-bottom: 0 !important;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.slate-toolbar {
|
|
40
|
-
display: flex;
|
|
41
|
-
box-sizing: border-box;
|
|
42
|
-
padding: 3px;
|
|
43
|
-
border: none;
|
|
44
|
-
background: #fff;
|
|
45
|
-
border-radius: 2px;
|
|
46
|
-
box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
|
|
47
|
-
font-family: 'Poppins', 'Helvetica Neue', Arial, Helvetica, sans-serif;
|
|
48
|
-
font-size: 1rem;
|
|
49
|
-
font-weight: normal;
|
|
50
|
-
|
|
51
|
-
.expando {
|
|
52
|
-
flex-grow: 1;
|
|
53
|
-
background-color: #fff;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.toolbar-separator {
|
|
57
|
-
display: inline-block;
|
|
58
|
-
height: 32px;
|
|
59
|
-
border-right: 1px solid #ddd;
|
|
60
|
-
margin: 0 0.5rem;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.toolbar-separator + .button-wrapper {
|
|
64
|
-
margin-left: 0px;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.button-wrapper {
|
|
68
|
-
display: inline-block;
|
|
69
|
-
margin-left: 3px;
|
|
70
|
-
|
|
71
|
-
.ui.tiny.compact.icon.toggle.button {
|
|
72
|
-
width: 32px;
|
|
73
|
-
height: 32px;
|
|
74
|
-
box-sizing: border-box;
|
|
75
|
-
padding: 4px !important;
|
|
76
|
-
border: 0;
|
|
77
|
-
background: rgba(255, 255, 255, 0.975);
|
|
78
|
-
border-radius: 1px;
|
|
79
|
-
color: @brown;
|
|
80
|
-
font-size: 18px;
|
|
81
|
-
vertical-align: bottom;
|
|
82
|
-
|
|
83
|
-
& > svg {
|
|
84
|
-
fill: #888;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
&:hover,
|
|
88
|
-
&:focus {
|
|
89
|
-
background: #f3f3f3;
|
|
90
|
-
outline: 0; /* reset for :focus */
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
&.active {
|
|
94
|
-
// TODO: stop using !important, use smth better
|
|
95
|
-
background: #efefef !important;
|
|
96
|
-
border-radius: 3px;
|
|
97
|
-
box-shadow: inset 0 0 0 1px @blue !important;
|
|
98
|
-
color: @blue !important;
|
|
99
|
-
|
|
100
|
-
& > svg {
|
|
101
|
-
fill: #444;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.ui.buttons {
|
|
108
|
-
width: 100%;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.ui.button:not(.icon) > .icon:not(.button):not(.dropdown) {
|
|
112
|
-
// TODO: is it possible to not use !important here and override button.less?
|
|
113
|
-
margin: auto auto auto auto !important;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.ui.button:last-child {
|
|
117
|
-
// TODO: is it possible to not use !important here and override button.less?
|
|
118
|
-
margin-right: 0 !important;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.highlight-selection {
|
|
123
|
-
background-color: #8080803d;
|
|
124
|
-
// color: white;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.ui.input.editor-link input {
|
|
128
|
-
padding: 0;
|
|
129
|
-
border: none;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.sidebar-container {
|
|
134
|
-
.slate-editor {
|
|
135
|
-
ul {
|
|
136
|
-
li {
|
|
137
|
-
display: list-item;
|
|
138
|
-
padding: 0;
|
|
139
|
-
|
|
140
|
-
span {
|
|
141
|
-
display: initial;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.power-user-menu {
|
|
149
|
-
position: absolute;
|
|
150
|
-
z-index: 10;
|
|
151
|
-
top: 29px;
|
|
152
|
-
left: -9px;
|
|
153
|
-
width: 210px;
|
|
154
|
-
background-color: rgba(255, 255, 255, 0.975);
|
|
155
|
-
border-radius: 2px;
|
|
156
|
-
box-shadow: 0 0 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.05);
|
|
157
|
-
|
|
158
|
-
.ui.menu {
|
|
159
|
-
border: 0;
|
|
160
|
-
border-radius: 2px;
|
|
161
|
-
|
|
162
|
-
.icon {
|
|
163
|
-
margin-right: 12px;
|
|
164
|
-
vertical-align: middle;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.item.active {
|
|
168
|
-
background: #efefef !important;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.loadAddonOverrides();
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/* Needed by semantic.less */
|
|
2
|
-
@type: 'extra';
|
|
3
|
-
@element: 'custom';
|
|
4
|
-
|
|
5
|
-
@import (multiple, reference, optional) '../../theme.config';
|
|
6
|
-
|
|
7
|
-
/* Enables customization of addons */
|
|
8
|
-
.loadAddonOverrides() {
|
|
9
|
-
@import (optional)
|
|
10
|
-
'@{siteFolder}/../addons/@{addon}/@{addontype}s/@{addonelement}.overrides';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/* Helper to load variables */
|
|
14
|
-
.loadAddonVariables() {
|
|
15
|
-
@import (optional) '@{addonelement}.variables';
|
|
16
|
-
@import (optional)
|
|
17
|
-
'@{siteFolder}/../addons/@{addon}/@{addontype}s/@{addonelement}.variables';
|
|
18
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
h1,
|
|
2
|
-
h2,
|
|
3
|
-
h3,
|
|
4
|
-
h4 {
|
|
5
|
-
&:hover {
|
|
6
|
-
a.anchor {
|
|
7
|
-
svg {
|
|
8
|
-
opacity: 1;
|
|
9
|
-
transform: rotate(15deg);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
a.anchor {
|
|
15
|
-
position: absolute;
|
|
16
|
-
display: inline-block;
|
|
17
|
-
margin-left: 5px;
|
|
18
|
-
vertical-align: middle;
|
|
19
|
-
|
|
20
|
-
svg {
|
|
21
|
-
width: 1.6ch;
|
|
22
|
-
fill: #42526e;
|
|
23
|
-
opacity: 0;
|
|
24
|
-
transform: rotate(15deg) translate(-8px, 2px);
|
|
25
|
-
transition: opacity 0.2s ease 0s, transform 0.2s ease 0s;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'slate-hyperscript';
|
|
2
|
-
import { LINK } from '@plone/volto-slate/constants';
|
|
3
|
-
import { deserialize } from '@plone/volto-slate/editor/deserialize';
|
|
4
|
-
import { isEmpty } from 'lodash';
|
|
5
|
-
// import { Editor } from 'slate';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @param {HTMLAnchorElement} aEl
|
|
9
|
-
*/
|
|
10
|
-
const hasValidTarget = (aEl) => {
|
|
11
|
-
return (
|
|
12
|
-
aEl.hasAttribute('target') &&
|
|
13
|
-
['_blank', '_self', '_parent', '_top'].includes(aEl.getAttribute('target'))
|
|
14
|
-
);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* This is almost the inverse function of LinkElement render function at
|
|
19
|
-
* src/editor/plugins/Link/render.jsx
|
|
20
|
-
* @param {Editor} editor
|
|
21
|
-
* @param {HTMLElement} el
|
|
22
|
-
*/
|
|
23
|
-
export const linkDeserializer = (editor, el) => {
|
|
24
|
-
let parent = el;
|
|
25
|
-
|
|
26
|
-
let children = Array.from(parent.childNodes)
|
|
27
|
-
.map((el) => deserialize(editor, el))
|
|
28
|
-
.flat();
|
|
29
|
-
|
|
30
|
-
if (isEmpty(children)) {
|
|
31
|
-
//nodes must contain at least one Text descendant
|
|
32
|
-
children = [{ text: '' }];
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const attrs = {
|
|
36
|
-
type: LINK,
|
|
37
|
-
url: el.getAttribute('href'),
|
|
38
|
-
data: {},
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
if (el.hasAttribute('title')) attrs.data.title = el.getAttribute('title');
|
|
42
|
-
|
|
43
|
-
const targetSet = hasValidTarget(el);
|
|
44
|
-
|
|
45
|
-
// We don't use this isExternalLink because links can come w/o a target from
|
|
46
|
-
// outside of Volto Slate blocks and still be external.
|
|
47
|
-
// let isExternalLink;
|
|
48
|
-
if (targetSet) {
|
|
49
|
-
attrs.data = attrs.data || {};
|
|
50
|
-
attrs.data.link = attrs.data.link || {};
|
|
51
|
-
attrs.data.link.external = { target: el.getAttribute('target') };
|
|
52
|
-
// isExternalLink = true;
|
|
53
|
-
} else {
|
|
54
|
-
// isExternalLink = false;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (attrs.url?.startsWith('mailto:')) {
|
|
58
|
-
// TODO: improve security because we are using regex-es
|
|
59
|
-
attrs.data = attrs.data || {};
|
|
60
|
-
attrs.data.link = attrs.data.link || {};
|
|
61
|
-
attrs.data.link.email = {
|
|
62
|
-
email_address: attrs.url
|
|
63
|
-
.replace(/^mailto:/g, '')
|
|
64
|
-
.replace(/\?subject=.+$/g, ''),
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const subject = attrs.url.match(/\?subject=(.*)$/);
|
|
68
|
-
if (subject && subject[1]) {
|
|
69
|
-
attrs.data.link.email.email_subject = subject[1];
|
|
70
|
-
}
|
|
71
|
-
} else if (/* !isExternalLink && */ attrs.url?.startsWith('/')) {
|
|
72
|
-
// TODO: improve this condition if it is not very good
|
|
73
|
-
attrs.data = attrs.data || {};
|
|
74
|
-
attrs.data.link = attrs.data.link || {};
|
|
75
|
-
attrs.data.link.internal = { internal_link: [{ '@id': attrs.url }] };
|
|
76
|
-
} else {
|
|
77
|
-
// the general condition: if it is external link
|
|
78
|
-
attrs.data = attrs.data || {};
|
|
79
|
-
attrs.data.link = attrs.data.link || {};
|
|
80
|
-
attrs.data.link.external = attrs.data.link.external || {};
|
|
81
|
-
attrs.data.link.external.external_link = attrs.url;
|
|
82
|
-
if (!targetSet) {
|
|
83
|
-
attrs.data.link.external.target = '_self';
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return jsx('element', attrs, children);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
linkDeserializer.id = 'linkDeserializer';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// import isUrl from 'is-url';
|
|
2
|
-
// import { wrapLink } from './utils';
|
|
3
|
-
import { LINK } from '@plone/volto-slate/constants';
|
|
4
|
-
|
|
5
|
-
export const withLink = (editor) => {
|
|
6
|
-
// const { insertData, insertText, isInline } = editor;
|
|
7
|
-
|
|
8
|
-
const { isInline } = editor;
|
|
9
|
-
|
|
10
|
-
editor.isInline = (element) => {
|
|
11
|
-
return element && element.type === LINK ? true : isInline(element);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
// editor.insertText = (text) => {
|
|
15
|
-
// if (text && isUrl(text)) {
|
|
16
|
-
// wrapLink(editor, text);
|
|
17
|
-
// } else {
|
|
18
|
-
// insertText(text);
|
|
19
|
-
// }
|
|
20
|
-
// };
|
|
21
|
-
//
|
|
22
|
-
// editor.insertData = (data) => {
|
|
23
|
-
// const text = data.getData('text/plain');
|
|
24
|
-
//
|
|
25
|
-
// if (text && isUrl(text)) {
|
|
26
|
-
// wrapLink(editor, text);
|
|
27
|
-
// } else {
|
|
28
|
-
// insertData(data);
|
|
29
|
-
// }
|
|
30
|
-
// };
|
|
31
|
-
return editor;
|
|
32
|
-
};
|