From 0bf3ceeb5c1a4b171f6af56abd816fd33721818e Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 2 Jul 2024 18:53:33 -0700 Subject: [PATCH 01/11] Add link to pull request preview builds in the pull request description only when documentation-related files change --- .github/workflows/docs-rtd-pr-preview.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs-rtd-pr-preview.yml b/.github/workflows/docs-rtd-pr-preview.yml index 30e8fd732f..83d7e72494 100644 --- a/.github/workflows/docs-rtd-pr-preview.yml +++ b/.github/workflows/docs-rtd-pr-preview.yml @@ -6,8 +6,10 @@ on: - opened # Execute this action only on PRs that touch # documentation files. - # paths: - # - "docs/**" + paths: + - "docs/source/**" + - .readthedocs.yaml + - requirements-docs.txt permissions: pull-requests: write From 938ae3520728ae6bee451d1bdba378aa18d3ee93 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 2 Jul 2024 19:40:07 -0700 Subject: [PATCH 02/11] Testing array of events --- .github/workflows/docs-rtd-pr-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-rtd-pr-preview.yml b/.github/workflows/docs-rtd-pr-preview.yml index 83d7e72494..4f09b7f768 100644 --- a/.github/workflows/docs-rtd-pr-preview.yml +++ b/.github/workflows/docs-rtd-pr-preview.yml @@ -1,7 +1,7 @@ # .github/workflows/docs-rtd-pr-preview.yml name: readthedocs/actions on: - pull_request_target: + [push, pull_request_target]: types: - opened # Execute this action only on PRs that touch From 17ab6073833e926c01efebaea6b33937b1994171 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 2 Jul 2024 19:53:13 -0700 Subject: [PATCH 03/11] Revert --- .github/workflows/docs-rtd-pr-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-rtd-pr-preview.yml b/.github/workflows/docs-rtd-pr-preview.yml index 4f09b7f768..83d7e72494 100644 --- a/.github/workflows/docs-rtd-pr-preview.yml +++ b/.github/workflows/docs-rtd-pr-preview.yml @@ -1,7 +1,7 @@ # .github/workflows/docs-rtd-pr-preview.yml name: readthedocs/actions on: - [push, pull_request_target]: + pull_request_target: types: - opened # Execute this action only on PRs that touch From 6cb749ff5641f95509272d613647727598d04db3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Fern=C3=A1ndez=20de=20Alba?= Date: Wed, 3 Jul 2024 10:48:59 +0200 Subject: [PATCH 04/11] Fix dependencies in `volto-slate` (#6148) --- packages/volto-slate/news/6148.internal | 1 + packages/volto-slate/package.json | 5 +++++ pnpm-lock.yaml | 15 +++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 packages/volto-slate/news/6148.internal diff --git a/packages/volto-slate/news/6148.internal b/packages/volto-slate/news/6148.internal new file mode 100644 index 0000000000..b396df6665 --- /dev/null +++ b/packages/volto-slate/news/6148.internal @@ -0,0 +1 @@ +Fix dependencies for the package @sneridagh diff --git a/packages/volto-slate/package.json b/packages/volto-slate/package.json index 93925ff1b7..9429474105 100644 --- a/packages/volto-slate/package.json +++ b/packages/volto-slate/package.json @@ -28,7 +28,12 @@ "react": "18.2.0", "react-dom": "18.2.0", "react-intersection-observer": "9.1.0", + "react-intl": "3.12.1", + "react-redux": "8.1.2", + "react-router-dom": "5.2.0", + "react-toastify": "5.5.0", "redux-mock-store": "1.5.4", + "semantic-ui-react": "2.1.5", "slate": "0.100.0", "slate-history": "0.100.0", "slate-hyperscript": "0.100.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cb68e5cbf1..8d3fbd3f95 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2349,9 +2349,24 @@ importers: react-intersection-observer: specifier: 9.1.0 version: 9.1.0(react@18.2.0) + react-intl: + specifier: 3.12.1 + version: 3.12.1(react@18.2.0) + react-redux: + specifier: 8.1.2 + version: 8.1.2(@types/react-dom@18.2.25)(@types/react@18.2.79)(react-dom@18.2.0(react@18.2.0))(react@18.2.0)(redux@4.2.1) + react-router-dom: + specifier: 5.2.0 + version: 5.2.0(react@18.2.0) + react-toastify: + specifier: 5.5.0 + version: 5.5.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) redux-mock-store: specifier: 1.5.4 version: 1.5.4 + semantic-ui-react: + specifier: 2.1.5 + version: 2.1.5(react-dom@18.2.0(react@18.2.0))(react@18.2.0) slate: specifier: 0.100.0 version: 0.100.0 From c32b2b69c0969d14736e427117c7ae42127520d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Fern=C3=A1ndez=20de=20Alba?= Date: Wed, 3 Jul 2024 14:38:30 +0200 Subject: [PATCH 05/11] Fix aria-label in ObjectBrowserNav component (#6150) Co-authored-by: ichim-david --- packages/volto/news/6150.bugfix | 1 + .../src/components/manage/Sidebar/ObjectBrowserNav.jsx | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 packages/volto/news/6150.bugfix diff --git a/packages/volto/news/6150.bugfix b/packages/volto/news/6150.bugfix new file mode 100644 index 0000000000..b9ab55e450 --- /dev/null +++ b/packages/volto/news/6150.bugfix @@ -0,0 +1 @@ +Fix aria-label of items that are `folderish` in ObjectBrowserNav component when performing item search. Previously it said `Select item.title` now `Browse item.title`. This brings it in line with the aria-label when not performing an item search. @sneridagh diff --git a/packages/volto/src/components/manage/Sidebar/ObjectBrowserNav.jsx b/packages/volto/src/components/manage/Sidebar/ObjectBrowserNav.jsx index d7324ba1b3..3c837d0e5a 100644 --- a/packages/volto/src/components/manage/Sidebar/ObjectBrowserNav.jsx +++ b/packages/volto/src/components/manage/Sidebar/ObjectBrowserNav.jsx @@ -60,9 +60,11 @@ const ObjectBrowserNav = ({ onClick={(e) => handleClickOnItem(item)} onDoubleClick={() => handleDoubleClickOnItem(item)} className="image-preview" - aria-label={`${intl.formatMessage(messages.select)} ${ - item.title - }`} + aria-label={ + item.is_folderish && mode === 'image' + ? `${intl.formatMessage(messages.browse)} ${item.title}` + : `${intl.formatMessage(messages.select)} ${item.title}` + } > {item['@type'] === 'Image' ? ( Date: Wed, 3 Jul 2024 14:43:28 +0200 Subject: [PATCH 06/11] Release @plone/slate 18.0.0-alpha.16 --- packages/volto-slate/CHANGELOG.md | 6 ++++++ packages/volto-slate/news/6148.internal | 1 - packages/volto-slate/package.json | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) delete mode 100644 packages/volto-slate/news/6148.internal diff --git a/packages/volto-slate/CHANGELOG.md b/packages/volto-slate/CHANGELOG.md index 9babaf7141..fc1a56488d 100644 --- a/packages/volto-slate/CHANGELOG.md +++ b/packages/volto-slate/CHANGELOG.md @@ -8,6 +8,12 @@ +## 18.0.0-alpha.16 (2024-07-03) + +### Internal + +- Fix dependencies for the package @sneridagh [#6148](https://github.com/plone/volto/issues/6148) + ## 18.0.0-alpha.15 (2024-06-28) ### Internal diff --git a/packages/volto-slate/news/6148.internal b/packages/volto-slate/news/6148.internal deleted file mode 100644 index b396df6665..0000000000 --- a/packages/volto-slate/news/6148.internal +++ /dev/null @@ -1 +0,0 @@ -Fix dependencies for the package @sneridagh diff --git a/packages/volto-slate/package.json b/packages/volto-slate/package.json index 9429474105..5000a3f7ee 100644 --- a/packages/volto-slate/package.json +++ b/packages/volto-slate/package.json @@ -1,6 +1,6 @@ { "name": "@plone/volto-slate", - "version": "18.0.0-alpha.15", + "version": "18.0.0-alpha.16", "description": "Slate.js integration with Volto", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", From 7137bd410bb9c1d5fdaf49ac5584261d1ecb5d6b Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Wed, 3 Jul 2024 14:44:15 +0200 Subject: [PATCH 07/11] Release 18.0.0-alpha.40 --- docs/source/release-notes/index.md | 14 ++++++++++++++ packages/volto/CHANGELOG.md | 14 ++++++++++++++ packages/volto/news/6134.internal | 1 - packages/volto/news/6135.documentation | 1 - packages/volto/news/6150.bugfix | 1 - packages/volto/package.json | 2 +- 6 files changed, 29 insertions(+), 4 deletions(-) delete mode 100644 packages/volto/news/6134.internal delete mode 100644 packages/volto/news/6135.documentation delete mode 100644 packages/volto/news/6150.bugfix diff --git a/docs/source/release-notes/index.md b/docs/source/release-notes/index.md index 4728bf767b..88e1025d28 100644 --- a/docs/source/release-notes/index.md +++ b/docs/source/release-notes/index.md @@ -17,6 +17,20 @@ myst: +## 18.0.0-alpha.40 (2024-07-03) + +### Bugfix + +- Fix aria-label of items that are `folderish` in ObjectBrowserNav component when performing item search. Previously it said `Select item.title` now `Browse item.title`. This brings it in line with the aria-label when not performing an item search. @sneridagh [#6150](https://github.com/plone/volto/issues/6150) + +### Internal + +- Automatically add a PLIP issue to the PLIP project board. @stevepiercy [#6134](https://github.com/plone/volto/issues/6134) + +### Documentation + +- Fix link to renamed `src/constants/Languages.cjs`. @stevepiercy [#6135](https://github.com/plone/volto/issues/6135) + ## 18.0.0-alpha.39 (2024-06-28) ### Bugfix diff --git a/packages/volto/CHANGELOG.md b/packages/volto/CHANGELOG.md index 4728bf767b..88e1025d28 100644 --- a/packages/volto/CHANGELOG.md +++ b/packages/volto/CHANGELOG.md @@ -17,6 +17,20 @@ myst: +## 18.0.0-alpha.40 (2024-07-03) + +### Bugfix + +- Fix aria-label of items that are `folderish` in ObjectBrowserNav component when performing item search. Previously it said `Select item.title` now `Browse item.title`. This brings it in line with the aria-label when not performing an item search. @sneridagh [#6150](https://github.com/plone/volto/issues/6150) + +### Internal + +- Automatically add a PLIP issue to the PLIP project board. @stevepiercy [#6134](https://github.com/plone/volto/issues/6134) + +### Documentation + +- Fix link to renamed `src/constants/Languages.cjs`. @stevepiercy [#6135](https://github.com/plone/volto/issues/6135) + ## 18.0.0-alpha.39 (2024-06-28) ### Bugfix diff --git a/packages/volto/news/6134.internal b/packages/volto/news/6134.internal deleted file mode 100644 index 97a602f581..0000000000 --- a/packages/volto/news/6134.internal +++ /dev/null @@ -1 +0,0 @@ -Automatically add a PLIP issue to the PLIP project board. @stevepiercy diff --git a/packages/volto/news/6135.documentation b/packages/volto/news/6135.documentation deleted file mode 100644 index f689548589..0000000000 --- a/packages/volto/news/6135.documentation +++ /dev/null @@ -1 +0,0 @@ -Fix link to renamed `src/constants/Languages.cjs`. @stevepiercy diff --git a/packages/volto/news/6150.bugfix b/packages/volto/news/6150.bugfix deleted file mode 100644 index b9ab55e450..0000000000 --- a/packages/volto/news/6150.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix aria-label of items that are `folderish` in ObjectBrowserNav component when performing item search. Previously it said `Select item.title` now `Browse item.title`. This brings it in line with the aria-label when not performing an item search. @sneridagh diff --git a/packages/volto/package.json b/packages/volto/package.json index c6dbf64c40..6a1d56f772 100644 --- a/packages/volto/package.json +++ b/packages/volto/package.json @@ -9,7 +9,7 @@ } ], "license": "MIT", - "version": "18.0.0-alpha.39", + "version": "18.0.0-alpha.40", "repository": { "type": "git", "url": "git@github.com:plone/volto.git" From 81476439d2e91fcfd50ab94a353b1b7a7724cd27 Mon Sep 17 00:00:00 2001 From: ichim-david Date: Thu, 4 Jul 2024 18:06:20 +0300 Subject: [PATCH 08/11] Fixes for Image widget (#6151) Co-authored-by: Victor Fernandez de Alba --- packages/volto-slate/news/6159.feature | 3 ++ .../volto-slate/src/editor/less/editor.less | 3 +- .../src/editor/ui/PositionedToolbar.jsx | 11 ++++- packages/volto/news/6159.breaking | 5 +++ packages/volto/news/6159.bugfix | 5 +++ .../components/LinkButton/AddLinkForm.jsx | 2 +- .../manage/AnchorPlugin/useLinkEditor.jsx | 42 +++++++++---------- .../src/components/manage/Form/InlineForm.jsx | 4 +- .../components/manage/Widgets/ImageWidget.jsx | 39 +++++++++++++---- .../pastanaga/collections/form.overrides | 4 +- .../theme/themes/pastanaga/extras/blocks.less | 19 ++++++--- 11 files changed, 95 insertions(+), 42 deletions(-) create mode 100644 packages/volto-slate/news/6159.feature create mode 100644 packages/volto/news/6159.breaking create mode 100644 packages/volto/news/6159.bugfix diff --git a/packages/volto-slate/news/6159.feature b/packages/volto-slate/news/6159.feature new file mode 100644 index 0000000000..ca1ab49635 --- /dev/null +++ b/packages/volto-slate/news/6159.feature @@ -0,0 +1,3 @@ +Use the unused `toggleButton` prop in `PositionedToolbar` to render the toolbar in a different `portal` target falling back to `document.body` if `toggleButton` is not provided. @ichim-david + +When `toggleButton` is provided as a `portal` target, allow negative left positioning except when the target is `document.body` to prevent the toolbar going off-screen and avoid breaking changes. @ichim-david \ No newline at end of file diff --git a/packages/volto-slate/src/editor/less/editor.less b/packages/volto-slate/src/editor/less/editor.less index 67b435ea77..a1a51d8b23 100644 --- a/packages/volto-slate/src/editor/less/editor.less +++ b/packages/volto-slate/src/editor/less/editor.less @@ -27,7 +27,7 @@ } .link-form-container { - margin-left: 5px; + margin-left: 2px; display: flex; align-items: center; } @@ -53,6 +53,7 @@ font-family: 'Poppins', 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: 1rem; font-weight: normal; + min-width: 300px; // needed for image widget slate toolbar .expando { flex-grow: 1; diff --git a/packages/volto-slate/src/editor/ui/PositionedToolbar.jsx b/packages/volto-slate/src/editor/ui/PositionedToolbar.jsx index 1ea7ab68ce..bc3b4f452f 100644 --- a/packages/volto-slate/src/editor/ui/PositionedToolbar.jsx +++ b/packages/volto-slate/src/editor/ui/PositionedToolbar.jsx @@ -7,12 +7,19 @@ const PositionedToolbar = ({ toggleButton, className, children, position }) => { // TODO: "position" is actually an object like `{ style: {} }` // To be renamed as "attributes" or "attrs" const ref = React.useRef(); + const portalTarget = toggleButton || document.body; React.useEffect(() => { const el = ref.current; const { style } = position || {}; - const left = `${Math.max(style.left - el.offsetWidth / 2, 0)}px`; + // allow negative left positioning when portal isn't document.body + // we need to use Math.max to avoid Slate AddLink popup going off screen + // and it adds the toolbar to the body + const left = + portalTarget === document.body + ? `${Math.max(style.left - el.offsetWidth / 2, 0)}px` + : `${style.left - el.offsetWidth / 2}px`; const top = `${style.top - el.offsetHeight}px`; el.style.opacity = style.opacity; @@ -24,7 +31,7 @@ const PositionedToolbar = ({ toggleButton, className, children, position }) => { {children} , - document.body, + portalTarget, ); }; diff --git a/packages/volto/news/6159.breaking b/packages/volto/news/6159.breaking new file mode 100644 index 0000000000..affa9041ab --- /dev/null +++ b/packages/volto/news/6159.breaking @@ -0,0 +1,5 @@ +Fixed image widget position and look and feel in sidebar. @ichim-david + +Breaking: +- Updated the markup of the widget in the sidebar to render the widget on a single column bellow the label. +- AddLink Pop-up of the widget is now rendered inside `toolbar-inner` instead of the document body, this fixes the positioning of the toolbar when scrolling. diff --git a/packages/volto/news/6159.bugfix b/packages/volto/news/6159.bugfix new file mode 100644 index 0000000000..8805e1adf7 --- /dev/null +++ b/packages/volto/news/6159.bugfix @@ -0,0 +1,5 @@ +Restored browse link in `Slate` `AddLink` Pop-up. @ichim-david +Fixed recursive error when uploading an image using the `Image` widget. @sneridagh +Fixed image display when using an external URL. @sneridagh +Fixed the position of the `Image` widget toolbar when scrolling by changing the position of the toolbar to be within the widget area instead of the body. @ichim-david +Improved display of `AddLink` Pop-up when using it inside the `Image` widget where we don't have a link picker. @ichim-david \ No newline at end of file diff --git a/packages/volto/src/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx b/packages/volto/src/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx index 4d12f58f06..306865b763 100644 --- a/packages/volto/src/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx +++ b/packages/volto/src/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm.jsx @@ -64,6 +64,7 @@ class AddLinkForm extends Component { }; static defaultProps = { + objectBrowserPickerType: 'link', placeholder: 'Enter URL or select an item', }; @@ -246,7 +247,6 @@ class AddLinkForm extends Component {
this.onChange(target.value)} diff --git a/packages/volto/src/components/manage/AnchorPlugin/useLinkEditor.jsx b/packages/volto/src/components/manage/AnchorPlugin/useLinkEditor.jsx index 8350587407..75deb43990 100644 --- a/packages/volto/src/components/manage/AnchorPlugin/useLinkEditor.jsx +++ b/packages/volto/src/components/manage/AnchorPlugin/useLinkEditor.jsx @@ -16,36 +16,38 @@ import React from 'react'; import { PositionedToolbar } from '@plone/volto-slate/editor/ui'; import AddLinkForm from '@plone/volto/components/manage/AnchorPlugin/components/LinkButton/AddLinkForm'; -function getPositionStyle(el) { - const rect = el.getBoundingClientRect(); - - return { - style: { - opacity: 1, - top: rect.top + window.pageYOffset - 6, - left: rect.left + window.pageXOffset + rect.width / 2, - }, - }; +function getPositionStyle(position) { + return ( + position || { + style: { + opacity: 1, + top: -5, + left: 55, + }, + } + ); } const useLinkEditor = () => { const [showLinkEditor, setShowLinkEditor] = React.useState(false); const show = React.useCallback(() => setShowLinkEditor(true), []); - const savedPosition = React.useRef(); const anchorNode = React.useRef(); - if (anchorNode.current) { - savedPosition.current = getPositionStyle(anchorNode.current); - } - const LinkEditor = React.useCallback( (props) => { - const { id, value, onChange, placeholder, objectBrowserPickerType } = - props; - return showLinkEditor && anchorNode.current && savedPosition.current ? ( + const { + id, + value, + onChange, + placeholder, + objectBrowserPickerType, + position, + } = props; + return showLinkEditor && anchorNode.current ? ( { theme={{}} objectBrowserPickerType={objectBrowserPickerType} onChangeValue={(url) => { - savedPosition.current = null; setShowLinkEditor(false); onChange(id, url); }} onClear={() => {}} onOverrideContent={(c) => { - savedPosition.current = null; setShowLinkEditor(false); }} /> diff --git a/packages/volto/src/components/manage/Form/InlineForm.jsx b/packages/volto/src/components/manage/Form/InlineForm.jsx index 66cb25d0b3..64bfb21946 100644 --- a/packages/volto/src/components/manage/Form/InlineForm.jsx +++ b/packages/volto/src/components/manage/Form/InlineForm.jsx @@ -153,8 +153,8 @@ const InlineForm = (props) => { focus={index === focusIndex} value={formData[field]} required={schema.required.indexOf(field) !== -1} - onChange={(id, value) => { - onChangeField(id, value); + onChange={(id, value, itemInfo) => { + onChangeField(id, value, itemInfo); }} key={field} error={errors[field]} diff --git a/packages/volto/src/components/manage/Widgets/ImageWidget.jsx b/packages/volto/src/components/manage/Widgets/ImageWidget.jsx index 105c60bb45..5c0dc6adc4 100644 --- a/packages/volto/src/components/manage/Widgets/ImageWidget.jsx +++ b/packages/volto/src/components/manage/Widgets/ImageWidget.jsx @@ -14,6 +14,7 @@ import { getBaseUrl, isInternalURL, validateFileUploadSize, + usePrevious, } from '@plone/volto/helpers'; import { createContent } from '@plone/volto/actions'; import { readAsDataURL } from 'promise-file-reader'; @@ -91,13 +92,14 @@ const UnconnectedImageInput = (props) => { const requestId = `image-upload-${id}`; - const { loading, loaded } = props.request; + const loaded = props.request.loaded; const { content } = props; const imageId = content?.['@id']; const image = content?.image; + let loading = false; useEffect(() => { - if (uploading && !loading && loaded) { + if (uploading && loading && loaded) { setUploading(false); onChange(id, imageId, { image_field: 'image', @@ -106,6 +108,8 @@ const UnconnectedImageInput = (props) => { } }, [loading, loaded, uploading, imageId, image, id, onChange]); // Explicitly list all dependencies + loading = usePrevious(props.request?.loading); + const handleUpload = React.useCallback( (eventOrFile) => { if (restrictFileUpload === true) return; @@ -161,7 +165,11 @@ const UnconnectedImageInput = (props) => { {selected && }
@@ -302,10 +310,25 @@ export const ImageInput = compose( ), )(withObjectBrowser(UnconnectedImageInput)); -const ImageUploadWidget = (props) => ( - - - -); +const ImageUploadWidget = (props) => { + const { fieldSet, id, title } = props; + return ( + +
+ +
+ +
+ ); +}; export default ImageUploadWidget; diff --git a/packages/volto/theme/themes/pastanaga/collections/form.overrides b/packages/volto/theme/themes/pastanaga/collections/form.overrides index 41323d6ebe..963bf4b6c4 100644 --- a/packages/volto/theme/themes/pastanaga/collections/form.overrides +++ b/packages/volto/theme/themes/pastanaga/collections/form.overrides @@ -151,13 +151,13 @@ .ui.form .inline.field .link-form-container { .wrapper { display: flex; - border-bottom: 1px solid @lightGreyBorderColor; .ui.input.input-anchorlink-theme { vertical-align: unset; input { - height: unset; + width: 100%; + height: unset; // input is only 40px and form.overrides sets height to 60px } } } diff --git a/packages/volto/theme/themes/pastanaga/extras/blocks.less b/packages/volto/theme/themes/pastanaga/extras/blocks.less index 45ddb6d239..8be103cb0c 100644 --- a/packages/volto/theme/themes/pastanaga/extras/blocks.less +++ b/packages/volto/theme/themes/pastanaga/extras/blocks.less @@ -446,6 +446,7 @@ div.image-upload-widget-image { text-align: center; .toolbar-wrapper { + position: relative; display: flex; flex-direction: column; justify-content: flex-end; @@ -726,10 +727,22 @@ div.image-upload-widget-image { .link-form-container { .inline.field .wrapper { - min-height: initial; + width: 270px; // needed to ensure placeholder shows and buttons are aligned to the right + min-height: initial; // overrides .input.field .wrapper + justify-content: space-between; border-bottom: none; } + .ui.input-anchorlink-theme { + width: 100% !important; // overrides form.less width: auto + max-width: 81%; // needed so buttons don't shift to the right when value is present + margin-left: 0 !important; // overrides .block .toolbar-inner .ui.input + } + + .ui.buttons { + width: auto; // for Add Link popup button to be aligned to the right + } + button { padding: 0; border: 0; @@ -743,10 +756,6 @@ div.image-upload-widget-image { outline: none; } } - - .ui.input { - min-width: 250px; - } } .blocks-chooser { From c4a98cdb2d1ea6a0a9e8024d175b37407392a34f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Fern=C3=A1ndez=20de=20Alba?= Date: Fri, 5 Jul 2024 15:26:02 +0200 Subject: [PATCH 09/11] =?UTF-8?q?Revisit=20login/logout=20process,=20bette?= =?UTF-8?q?r=20catching=20of=20edge=20cases=20(unauthor=E2=80=A6=20(#6155)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/volto/news/6155.bugfix | 1 + .../src/components/theme/Login/Login.jsx | 29 ++++++++++++++++--- .../src/components/theme/Logout/Logout.jsx | 4 +-- .../Logout/__snapshots__/Logout.test.jsx.snap | 6 +--- 4 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 packages/volto/news/6155.bugfix diff --git a/packages/volto/news/6155.bugfix b/packages/volto/news/6155.bugfix new file mode 100644 index 0000000000..cc31601fac --- /dev/null +++ b/packages/volto/news/6155.bugfix @@ -0,0 +1 @@ +Revisit login/logout process, better catching of edge cases @sneridagh diff --git a/packages/volto/src/components/theme/Login/Login.jsx b/packages/volto/src/components/theme/Login/Login.jsx index a624a04304..efdc409e21 100644 --- a/packages/volto/src/components/theme/Login/Login.jsx +++ b/packages/volto/src/components/theme/Login/Login.jsx @@ -12,10 +12,15 @@ import { import { FormattedMessage, defineMessages, useIntl } from 'react-intl'; import qs from 'query-string'; -import { Helmet } from '@plone/volto/helpers'; +import { Helmet, usePrevious } from '@plone/volto/helpers'; import config from '@plone/volto/registry'; import { Icon } from '@plone/volto/components'; -import { login, resetLoginRequest } from '@plone/volto/actions'; +import { + login, + logout, + resetLoginRequest, + purgeMessages, +} from '@plone/volto/actions'; import { toast } from 'react-toastify'; import { Toast } from '@plone/volto/components'; import aheadSVG from '@plone/volto/icons/ahead.svg'; @@ -78,8 +83,22 @@ const Login = (props) => { location.pathname.replace(/\/login\/?$/, '').replace(/\/logout\/?$/, '') || '/'; + const previousToken = usePrevious(token); + useEffect(() => { - if (token && !(props.isLogout || location?.state?.isLogout)) { + if (location?.state?.isLogout) { + // Execute a true Logout action + // This is needed to cover the use case of being logged in in + // another backend (eg. in development), having a token for + // localhost and try to use it, the login route has to know that + // it's the same as it comes from a logout + // See also Unauthorized.jsx + dispatch(logout()); + dispatch(purgeMessages()); + // Reset the location state + history.push(`${location.pathname}${location.search}`); + } else if (token && token !== previousToken) { + // We just did a true login action history.push(returnUrl || '/'); if (toast.isActive('loggedOut')) { toast.dismiss('loggedOut'); @@ -116,8 +135,10 @@ const Login = (props) => { intl, history, returnUrl, - props.isLogout, + location.search, + location.pathname, location?.state?.isLogout, + previousToken, ]); const onLogin = (event) => { diff --git a/packages/volto/src/components/theme/Logout/Logout.jsx b/packages/volto/src/components/theme/Logout/Logout.jsx index 70ad7bf472..29e175c1a4 100644 --- a/packages/volto/src/components/theme/Logout/Logout.jsx +++ b/packages/volto/src/components/theme/Logout/Logout.jsx @@ -3,7 +3,7 @@ import { useDispatch, useSelector, shallowEqual } from 'react-redux'; import { useHistory } from 'react-router-dom'; import { defineMessages, useIntl } from 'react-intl'; import qs from 'query-string'; -import { Login, Toast } from '@plone/volto/components'; +import { Toast } from '@plone/volto/components'; import { logout, purgeMessages } from '@plone/volto/actions'; import { toast } from 'react-toastify'; @@ -55,7 +55,7 @@ const Logout = ({ location }) => { } }, [history, returnUrl, intl, token]); - return ; + return ''; }; export default Logout; diff --git a/packages/volto/src/components/theme/Logout/__snapshots__/Logout.test.jsx.snap b/packages/volto/src/components/theme/Logout/__snapshots__/Logout.test.jsx.snap index eb1076578a..2884e0d677 100644 --- a/packages/volto/src/components/theme/Logout/__snapshots__/Logout.test.jsx.snap +++ b/packages/volto/src/components/theme/Logout/__snapshots__/Logout.test.jsx.snap @@ -1,7 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Logout renders a logout component 1`] = ` -
-
-
-`; +exports[`Logout renders a logout component 1`] = `
`; From 38aee903b0415946f070eb54777a3006208688f3 Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Fri, 5 Jul 2024 15:27:01 +0200 Subject: [PATCH 10/11] Release @plone/slate 18.0.0-alpha.17 --- packages/volto-slate/CHANGELOG.md | 8 ++++++++ packages/volto-slate/news/6159.feature | 3 --- packages/volto-slate/package.json | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) delete mode 100644 packages/volto-slate/news/6159.feature diff --git a/packages/volto-slate/CHANGELOG.md b/packages/volto-slate/CHANGELOG.md index fc1a56488d..554619a18d 100644 --- a/packages/volto-slate/CHANGELOG.md +++ b/packages/volto-slate/CHANGELOG.md @@ -8,6 +8,14 @@ +## 18.0.0-alpha.17 (2024-07-05) + +### Feature + +- Use the unused `toggleButton` prop in `PositionedToolbar` to render the toolbar in a different `portal` target falling back to `document.body` if `toggleButton` is not provided. @ichim-david + + When `toggleButton` is provided as a `portal` target, allow negative left positioning except when the target is `document.body` to prevent the toolbar going off-screen and avoid breaking changes. @ichim-david [#6159](https://github.com/plone/volto/issues/6159) + ## 18.0.0-alpha.16 (2024-07-03) ### Internal diff --git a/packages/volto-slate/news/6159.feature b/packages/volto-slate/news/6159.feature deleted file mode 100644 index ca1ab49635..0000000000 --- a/packages/volto-slate/news/6159.feature +++ /dev/null @@ -1,3 +0,0 @@ -Use the unused `toggleButton` prop in `PositionedToolbar` to render the toolbar in a different `portal` target falling back to `document.body` if `toggleButton` is not provided. @ichim-david - -When `toggleButton` is provided as a `portal` target, allow negative left positioning except when the target is `document.body` to prevent the toolbar going off-screen and avoid breaking changes. @ichim-david \ No newline at end of file diff --git a/packages/volto-slate/package.json b/packages/volto-slate/package.json index 5000a3f7ee..c64a51372f 100644 --- a/packages/volto-slate/package.json +++ b/packages/volto-slate/package.json @@ -1,6 +1,6 @@ { "name": "@plone/volto-slate", - "version": "18.0.0-alpha.16", + "version": "18.0.0-alpha.17", "description": "Slate.js integration with Volto", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", From b9ebf670da0d4405fb596ed749d534cdf87b7119 Mon Sep 17 00:00:00 2001 From: Victor Fernandez de Alba Date: Fri, 5 Jul 2024 15:27:51 +0200 Subject: [PATCH 11/11] Release 18.0.0-alpha.41 --- docs/source/release-notes/index.md | 19 +++++++++++++++++++ packages/volto/CHANGELOG.md | 19 +++++++++++++++++++ packages/volto/news/6155.bugfix | 1 - packages/volto/news/6159.breaking | 5 ----- packages/volto/news/6159.bugfix | 5 ----- packages/volto/package.json | 2 +- .../types/components/theme/Logout/Logout.d.ts | 2 +- 7 files changed, 40 insertions(+), 13 deletions(-) delete mode 100644 packages/volto/news/6155.bugfix delete mode 100644 packages/volto/news/6159.breaking delete mode 100644 packages/volto/news/6159.bugfix diff --git a/docs/source/release-notes/index.md b/docs/source/release-notes/index.md index 88e1025d28..8fea32ad54 100644 --- a/docs/source/release-notes/index.md +++ b/docs/source/release-notes/index.md @@ -17,6 +17,25 @@ myst: +## 18.0.0-alpha.41 (2024-07-05) + +### Breaking + +- Fixed image widget position and look and feel in sidebar. @ichim-david + + Breaking: + - Updated the markup of the widget in the sidebar to render the widget on a single column bellow the label. + - AddLink Pop-up of the widget is now rendered inside `toolbar-inner` instead of the document body, this fixes the positioning of the toolbar when scrolling. [#6159](https://github.com/plone/volto/issues/6159) + +### Bugfix + +- Revisit login/logout process, better catching of edge cases @sneridagh [#6155](https://github.com/plone/volto/issues/6155) +- Restored browse link in `Slate` `AddLink` Pop-up. @ichim-david + Fixed recursive error when uploading an image using the `Image` widget. @sneridagh + Fixed image display when using an external URL. @sneridagh + Fixed the position of the `Image` widget toolbar when scrolling by changing the position of the toolbar to be within the widget area instead of the body. @ichim-david + Improved display of `AddLink` Pop-up when using it inside the `Image` widget where we don't have a link picker. @ichim-david [#6159](https://github.com/plone/volto/issues/6159) + ## 18.0.0-alpha.40 (2024-07-03) ### Bugfix diff --git a/packages/volto/CHANGELOG.md b/packages/volto/CHANGELOG.md index 88e1025d28..8fea32ad54 100644 --- a/packages/volto/CHANGELOG.md +++ b/packages/volto/CHANGELOG.md @@ -17,6 +17,25 @@ myst: +## 18.0.0-alpha.41 (2024-07-05) + +### Breaking + +- Fixed image widget position and look and feel in sidebar. @ichim-david + + Breaking: + - Updated the markup of the widget in the sidebar to render the widget on a single column bellow the label. + - AddLink Pop-up of the widget is now rendered inside `toolbar-inner` instead of the document body, this fixes the positioning of the toolbar when scrolling. [#6159](https://github.com/plone/volto/issues/6159) + +### Bugfix + +- Revisit login/logout process, better catching of edge cases @sneridagh [#6155](https://github.com/plone/volto/issues/6155) +- Restored browse link in `Slate` `AddLink` Pop-up. @ichim-david + Fixed recursive error when uploading an image using the `Image` widget. @sneridagh + Fixed image display when using an external URL. @sneridagh + Fixed the position of the `Image` widget toolbar when scrolling by changing the position of the toolbar to be within the widget area instead of the body. @ichim-david + Improved display of `AddLink` Pop-up when using it inside the `Image` widget where we don't have a link picker. @ichim-david [#6159](https://github.com/plone/volto/issues/6159) + ## 18.0.0-alpha.40 (2024-07-03) ### Bugfix diff --git a/packages/volto/news/6155.bugfix b/packages/volto/news/6155.bugfix deleted file mode 100644 index cc31601fac..0000000000 --- a/packages/volto/news/6155.bugfix +++ /dev/null @@ -1 +0,0 @@ -Revisit login/logout process, better catching of edge cases @sneridagh diff --git a/packages/volto/news/6159.breaking b/packages/volto/news/6159.breaking deleted file mode 100644 index affa9041ab..0000000000 --- a/packages/volto/news/6159.breaking +++ /dev/null @@ -1,5 +0,0 @@ -Fixed image widget position and look and feel in sidebar. @ichim-david - -Breaking: -- Updated the markup of the widget in the sidebar to render the widget on a single column bellow the label. -- AddLink Pop-up of the widget is now rendered inside `toolbar-inner` instead of the document body, this fixes the positioning of the toolbar when scrolling. diff --git a/packages/volto/news/6159.bugfix b/packages/volto/news/6159.bugfix deleted file mode 100644 index 8805e1adf7..0000000000 --- a/packages/volto/news/6159.bugfix +++ /dev/null @@ -1,5 +0,0 @@ -Restored browse link in `Slate` `AddLink` Pop-up. @ichim-david -Fixed recursive error when uploading an image using the `Image` widget. @sneridagh -Fixed image display when using an external URL. @sneridagh -Fixed the position of the `Image` widget toolbar when scrolling by changing the position of the toolbar to be within the widget area instead of the body. @ichim-david -Improved display of `AddLink` Pop-up when using it inside the `Image` widget where we don't have a link picker. @ichim-david \ No newline at end of file diff --git a/packages/volto/package.json b/packages/volto/package.json index 6a1d56f772..1d6732e1d7 100644 --- a/packages/volto/package.json +++ b/packages/volto/package.json @@ -9,7 +9,7 @@ } ], "license": "MIT", - "version": "18.0.0-alpha.40", + "version": "18.0.0-alpha.41", "repository": { "type": "git", "url": "git@github.com:plone/volto.git" diff --git a/packages/volto/types/components/theme/Logout/Logout.d.ts b/packages/volto/types/components/theme/Logout/Logout.d.ts index 480a4ae25b..3e903a7828 100644 --- a/packages/volto/types/components/theme/Logout/Logout.d.ts +++ b/packages/volto/types/components/theme/Logout/Logout.d.ts @@ -1,4 +1,4 @@ export default Logout; declare function Logout({ location }: { location: any; -}): import("react/jsx-runtime").JSX.Element; +}): string;