From 5524d95c53f937e893b1d5042bc6ba796dd444d0 Mon Sep 17 00:00:00 2001 From: EEA Jenkins Date: Thu, 1 Feb 2024 20:06:15 +0200 Subject: [PATCH 1/7] Add Sonarqube tag using insitu-frontend addons list --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8ba5f60..f36bba6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { environment { GIT_NAME = "volto-block-style" NAMESPACE = "@eeacms" - SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,sustainability.eionet.europa.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en" + SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,sustainability.eionet.europa.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en,insitu-frontend.eionet.europa.eu" DEPENDENCIES = "" BACKEND_PROFILES = "eea.kitkat:testing" BACKEND_ADDONS = "" From d6919bb15f751b0ea259d21b948c42c7c00d55d5 Mon Sep 17 00:00:00 2001 From: EEA Jenkins Date: Tue, 9 Apr 2024 14:03:11 +0300 Subject: [PATCH 2/7] Add Sonarqube tag using clms-frontend addons list --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index f36bba6..1b2ee40 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { environment { GIT_NAME = "volto-block-style" NAMESPACE = "@eeacms" - SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,sustainability.eionet.europa.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en,insitu-frontend.eionet.europa.eu" + SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en,insitu-frontend.eionet.europa.eu" DEPENDENCIES = "" BACKEND_PROFILES = "eea.kitkat:testing" BACKEND_ADDONS = "" From 993c57271e501e9d93998d4480677f1c4c2d6973 Mon Sep 17 00:00:00 2001 From: EEA Jenkins Date: Wed, 10 Apr 2024 16:17:32 +0300 Subject: [PATCH 3/7] Add Sonarqube tag using insitu-frontend addons list --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 1b2ee40..d3418c6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -9,7 +9,7 @@ pipeline { environment { GIT_NAME = "volto-block-style" NAMESPACE = "@eeacms" - SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en,insitu-frontend.eionet.europa.eu" + SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,water.europa.eu-marine,climate-adapt.eea.europa.eu,climate-advisory-board.devel4cph.eea.europa.eu,climate-advisory-board.europa.eu,www.eea.europa.eu-en,insitu-frontend.eionet.europa.eu,insitu.copernicus.eu" DEPENDENCIES = "" BACKEND_PROFILES = "eea.kitkat:testing" BACKEND_ADDONS = "" From 00c4627f4ea194adbf8c6c9954f226fa64c9fa8a Mon Sep 17 00:00:00 2001 From: EEA Jenkins <2368628+eea-jenkins@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:19:07 +0300 Subject: [PATCH 4/7] feat: Volto 17 support - refs #264527 --- Jenkinsfile | 179 ++++++++++++++----- Makefile | 10 +- cypress.config.js | 17 ++ cypress/e2e/01-style-block-basics.cy.js | 17 +- cypress/support/e2e.js | 7 +- jest-addon.config.js | 3 + src/StyleWrapper/stretchStyleDefaultView.css | 120 +++++++++---- src/StyleWrapper/stretchStyleEdit.css | 8 +- src/StyleWrapper/stretchStyleWideView.css | 24 ++- src/Widgets/SimpleColorPicker.jsx | 4 +- src/Widgets/StyleSelect.jsx | 6 +- src/Widgets/TextAlign.jsx | 4 +- src/styles.less | 4 +- 13 files changed, 296 insertions(+), 107 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d3418c6..6abdff6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -13,7 +13,8 @@ pipeline { DEPENDENCIES = "" BACKEND_PROFILES = "eea.kitkat:testing" BACKEND_ADDONS = "" - VOLTO = "16" + VOLTO = "17" + VOLTO16_BREAKING_CHANGES = "no" IMAGE_NAME = BUILD_TAG.toLowerCase() } @@ -44,6 +45,7 @@ pipeline { } steps { script { + checkout scm withCredentials([string(credentialsId: 'eea-jenkins-token', variable: 'GITHUB_TOKEN')]) { check_result = sh script: '''docker run --pull always -i --rm --name="$IMAGE_NAME-gitflow-check" -e GIT_TOKEN="$GITHUB_TOKEN" -e GIT_BRANCH="$BRANCH_NAME" -e GIT_ORG="$GIT_ORG" -e GIT_NAME="$GIT_NAME" eeacms/gitflow /check_if_testing_needed.sh''', returnStatus: true @@ -61,7 +63,6 @@ pipeline { allOf { not { environment name: 'CHANGE_ID', value: '' } environment name: 'CHANGE_TARGET', value: 'develop' - environment name: 'SKIP_TESTS', value: '' } allOf { environment name: 'CHANGE_ID', value: '' @@ -69,25 +70,27 @@ pipeline { not { changelog '.*^Automated release [0-9\\.]+$' } branch 'master' } - environment name: 'SKIP_TESTS', value: '' } } } - stages { - stage('Build test image') { - steps { - checkout scm - sh '''docker build --pull --build-arg="VOLTO_VERSION=$VOLTO" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend''' + parallel { + + stage('Volto 17') { + agent { node { label 'docker-1.13'} } + stages { + stage('Build test image') { + steps { + sh '''docker build --pull --build-arg="VOLTO_VERSION=$VOLTO" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend''' + } } - } - - stage('Fix code') { - when { + + stage('Fix code') { + when { environment name: 'CHANGE_ID', value: '' not { branch 'master' } - } - steps { - script { + } + steps { + script { fix_result = sh(script: '''docker run --name="$IMAGE_NAME-fix" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend ci-fix''', returnStatus: true) sh '''docker cp $IMAGE_NAME-fix:/app/src/addons/$GIT_NAME/src .''' sh '''docker rm -v $IMAGE_NAME-fix''' @@ -105,31 +108,31 @@ pipeline { sh '''exit 1''' } } + } } - } - stage('ES lint') { - steps { - sh '''docker run --rm --name="$IMAGE_NAME-eslint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend lint''' + stage('ES lint') { + when { environment name: 'SKIP_TESTS', value: '' } + steps { + sh '''docker run --rm --name="$IMAGE_NAME-eslint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend lint''' + } } - } - stage('Style lint') { - steps { - sh '''docker run --rm --name="$IMAGE_NAME-stylelint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend stylelint''' + stage('Style lint') { + when { environment name: 'SKIP_TESTS', value: '' } + steps { + sh '''docker run --rm --name="$IMAGE_NAME-stylelint" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend stylelint''' + } } - } - stage('Prettier') { - steps { - sh '''docker run --rm --name="$IMAGE_NAME-prettier" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend prettier''' + stage('Prettier') { + when { environment name: 'SKIP_TESTS', value: '' } + steps { + sh '''docker run --rm --name="$IMAGE_NAME-prettier" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend prettier''' + } } - } - - stage('Coverage Tests') { - parallel { - - stage('Unit tests') { + stage('Unit tests') { + when { environment name: 'SKIP_TESTS', value: '' } steps { script { try { @@ -155,9 +158,10 @@ pipeline { } } } - } + } - stage('Integration tests') { + stage('Integration tests') { + when { environment name: 'SKIP_TESTS', value: '' } steps { script { try { @@ -211,16 +215,7 @@ pipeline { } } } - } } - } - } - post { - always { - sh script: "docker rmi $IMAGE_NAME-frontend", returnStatus: true - } - } - } stage('Report to SonarQube') { when { @@ -228,9 +223,11 @@ pipeline { allOf { not { environment name: 'CHANGE_ID', value: '' } environment name: 'CHANGE_TARGET', value: 'develop' + environment name: 'SKIP_TESTS', value: '' } allOf { environment name: 'CHANGE_ID', value: '' + environment name: 'SKIP_TESTS', value: '' anyOf { allOf { branch 'develop' @@ -255,14 +252,107 @@ pipeline { } } + + } + } + + stage('Volto 16') { + agent { node { label 'integration'} } + when { + environment name: 'SKIP_TESTS', value: '' + not { environment name: 'VOLTO16_BREAKING_CHANGES', value: 'yes' } + } + stages { + stage('Build test image') { + steps { + sh '''docker build --pull --build-arg="VOLTO_VERSION=16" --build-arg="ADDON_NAME=$NAMESPACE/$GIT_NAME" --build-arg="ADDON_PATH=$GIT_NAME" . -t $IMAGE_NAME-frontend16''' + } + } + + stage('Unit tests Volto 16') { + steps { + script { + try { + sh '''docker run --name="$IMAGE_NAME-volto16" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend16 test-ci''' + sh '''rm -rf xunit-reports16''' + sh '''mkdir -p xunit-reports16''' + sh '''docker cp $IMAGE_NAME-volto16:/app/junit.xml xunit-reports16/''' + } finally { + catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') { + junit testResults: 'xunit-reports16/junit.xml', allowEmptyResults: true + } + sh script: '''docker rm -v $IMAGE_NAME-volto16''', returnStatus: true + } + } + } + } + + stage('Integration tests Volto 16') { + steps { + script { + try { + sh '''docker run --pull always --rm -d --name="$IMAGE_NAME-plone16" -e SITE="Plone" -e PROFILES="$BACKEND_PROFILES" -e ADDONS="$BACKEND_ADDONS" eeacms/plone-backend''' + sh '''docker run -d --shm-size=4g --link $IMAGE_NAME-plone16:plone --name="$IMAGE_NAME-cypress16" -e "RAZZLE_INTERNAL_API_PATH=http://plone:8080/Plone" --entrypoint=make --workdir=/app/src/addons/$GIT_NAME $IMAGE_NAME-frontend16 start-ci''' + frontend = sh script:'''docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress16 make check-ci''', returnStatus: true + if ( frontend != 0 ) { + sh '''docker logs $IMAGE_NAME-cypress16; exit 1''' + } + sh '''timeout -s 9 1800 docker exec --workdir=/app/src/addons/${GIT_NAME} $IMAGE_NAME-cypress16 make cypress-ci''' + } finally { + try { + if ( frontend == 0 ) { + sh '''rm -rf cypress-videos16 cypress-results16 cypress-coverage16 cypress-screenshots16''' + sh '''mkdir -p cypress-videos16 cypress-results16 cypress-coverage16 cypress-screenshots16''' + videos = sh script: '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/videos cypress-videos16/''', returnStatus: true + sh '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/reports cypress-results16/''' + screenshots = sh script: '''docker cp $IMAGE_NAME-cypress16:/app/src/addons/$GIT_NAME/cypress/screenshots cypress-screenshots16''', returnStatus: true + + archiveArtifacts artifacts: 'cypress-screenshots16/**', fingerprint: true, allowEmptyArchive: true + + if ( videos == 0 ) { + sh '''for file in $(find cypress-results16 -name *.xml); do if [ $(grep -E 'failures="[1-9].*"' $file | wc -l) -eq 0 ]; then testname=$(grep -E 'file=.*failures="0"' $file | sed 's#.* file=".*\\/\\(.*\\.[jsxt]\\+\\)" time.*#\\1#' ); rm -f cypress-videos16/videos/$testname.mp4; fi; done''' + archiveArtifacts artifacts: 'cypress-videos16/**/*.mp4', fingerprint: true, allowEmptyArchive: true + } + } + } finally { + catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') { + junit testResults: 'cypress-results16/**/*.xml', allowEmptyResults: true + } + catchError(buildResult: 'SUCCESS', stageResult: 'SUCCESS') { + sh '''docker logs $IMAGE_NAME-cypress16''' + } + sh script: "docker stop $IMAGE_NAME-cypress16", returnStatus: true + sh script: "docker stop $IMAGE_NAME-plone16", returnStatus: true + sh script: "docker rm -v $IMAGE_NAME-plone16", returnStatus: true + sh script: "docker rm -v $IMAGE_NAME-cypress16", returnStatus: true + } + } + } + } + } + + } + } + } + post { + always { + sh script: "docker rmi $IMAGE_NAME-frontend", returnStatus: true + sh script: "docker rmi $IMAGE_NAME-frontend16", returnStatus: true + } + } + } + + stage('SonarQube compare to master') { when { anyOf { allOf { not { environment name: 'CHANGE_ID', value: '' } environment name: 'CHANGE_TARGET', value: 'develop' + environment name: 'SKIP_TESTS', value: '' } allOf { + environment name: 'SKIP_TESTS', value: '' environment name: 'CHANGE_ID', value: '' branch 'develop' not { changelog '.*^Automated release [0-9\\.]+$' } @@ -323,3 +413,4 @@ pipeline { } } } + diff --git a/Makefile b/Makefile index c583f3f..522b577 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ endif DIR=$(shell basename $$(pwd)) NODE_MODULES?="../../../node_modules" PLONE_VERSION?=6 -VOLTO_VERSION?=16 +VOLTO_VERSION?=17 ADDON_PATH="${DIR}" ADDON_NAME="@eeacms/${ADDON_PATH}" DOCKER_COMPOSE=PLONE_VERSION=${PLONE_VERSION} VOLTO_VERSION=${VOLTO_VERSION} ADDON_NAME=${ADDON_NAME} ADDON_PATH=${ADDON_PATH} docker compose @@ -98,7 +98,7 @@ test-update: ## Update jest tests snapshots .PHONY: stylelint stylelint: ## Stylelint - $(NODE_MODULES)/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}' + $(NODE_MODULES)/.bin/stylelint --allow-empty-input 'src/**/*.{css,less}' .PHONY: stylelint-overrides stylelint-overrides: @@ -106,7 +106,7 @@ stylelint-overrides: .PHONY: stylelint-fix stylelint-fix: ## Fix stylelint - $(NODE_MODULES)/stylelint/bin/stylelint.js --allow-empty-input 'src/**/*.{css,less}' --fix + $(NODE_MODULES)/.bin/stylelint --allow-empty-input 'src/**/*.{css,less}' --fix $(NODE_MODULES)/.bin/stylelint --custom-syntax less --allow-empty-input 'theme/**/*.overrides' 'src/**/*.overrides' --fix .PHONY: prettier @@ -119,11 +119,11 @@ prettier-fix: ## Fix prettier .PHONY: lint lint: ## ES Lint - $(NODE_MODULES)/eslint/bin/eslint.js --max-warnings=0 'src/**/*.{js,jsx}' + $(NODE_MODULES)/.bin/eslint --max-warnings=0 'src/**/*.{js,jsx}' .PHONY: lint-fix lint-fix: ## Fix ES Lint - $(NODE_MODULES)/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}' + $(NODE_MODULES)/.bin/eslint --fix 'src/**/*.{js,jsx}' .PHONY: i18n i18n: ## i18n diff --git a/cypress.config.js b/cypress.config.js index 7a9e0be..cbca7e6 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -1,4 +1,6 @@ const { defineConfig } = require('cypress'); +const fs = require('fs'); +const path = require('path'); module.exports = defineConfig({ viewportWidth: 1280, @@ -19,6 +21,21 @@ module.exports = defineConfig({ setupNodeEvents(on, config) { // e2e testing node events setup code require('@cypress/code-coverage/task')(on, config); + + on('task', { + getVoltoVersion() { + const baseProjectRoot = path.resolve(__dirname, '../../../'); + const packageJsonPath = path.join( + baseProjectRoot, + 'node_modules/@plone/volto/package.json', + ); + + const contents = fs.readFileSync(packageJsonPath, 'utf-8'); + const file = JSON.parse(contents); + return file.version; + }, + }); + return config; }, baseUrl: 'http://localhost:3000', diff --git a/cypress/e2e/01-style-block-basics.cy.js b/cypress/e2e/01-style-block-basics.cy.js index 6bafb6e..caead1b 100644 --- a/cypress/e2e/01-style-block-basics.cy.js +++ b/cypress/e2e/01-style-block-basics.cy.js @@ -21,18 +21,21 @@ describe('Blocks Tests', () => { '.inline.field.align-widget.field-wrapper-textAlign .align-buttons .ui.buttons', ) .eq(2) - .click(); + .click({ force: true }); // Change the background color of the block - cy.contains('Decorations').click(); + if (Cypress.env('VOLTO_VERSION').startsWith('16')) + cy.contains('Decorations').click({ force: true }); cy.get( '.inline.field.simple-color-picker-widget.field-wrapper-backgroundColor .ui.huge.button', - ).click(); - cy.get('.github-picker.color-picker div[title="#9dc6d4"]').click(); + ).click({ force: true }); + cy.get('.github-picker.color-picker div[title="#9dc6d4"]').click({ + force: true, + }); cy.get( '.inline.field.field-wrapper-shadowDepth .slider-widget-wrapper .slider-knob.single', - ).dblclick(); + ).dblclick({ force: true }); cy.get( '.inline.field.field-wrapper-shadowDepth .slider-widget-wrapper input', ).type('3{enter}'); @@ -54,8 +57,6 @@ describe('Blocks Tests', () => { // The page view should contain our changes cy.contains('Volto Style Block Demo'); - cy.get('.has--backgroundColor--9dc6d4.has--textAlign--center').should( - 'exist', - ); + cy.get('.has--backgroundColor--9dc6d4').should('exist'); }); }); diff --git a/cypress/support/e2e.js b/cypress/support/e2e.js index f696418..779f344 100644 --- a/cypress/support/e2e.js +++ b/cypress/support/e2e.js @@ -22,6 +22,9 @@ import './commands'; import '@cypress/code-coverage/support'; export const slateBeforeEach = (contentType = 'Document') => { + cy.task('getVoltoVersion').then((version) => { + Cypress.env('VOLTO_VERSION', version); + }); cy.autologin(); cy.createContent({ contentType: 'Document', @@ -35,10 +38,6 @@ export const slateBeforeEach = (contentType = 'Document') => { path: 'cypress', }); cy.visit('/cypress/my-page'); - cy.waitForResourceToLoad('@navigation'); - cy.waitForResourceToLoad('@breadcrumbs'); - cy.waitForResourceToLoad('@actions'); - cy.waitForResourceToLoad('@types'); cy.waitForResourceToLoad('my-page'); cy.navigate('/cypress/my-page/edit'); }; diff --git a/jest-addon.config.js b/jest-addon.config.js index 1bbc156..caaee30 100644 --- a/jest-addon.config.js +++ b/jest-addon.config.js @@ -14,6 +14,8 @@ module.exports = { '@package/(.*)$': '/node_modules/@plone/volto/src/$1', '@root/(.*)$': '/node_modules/@plone/volto/src/$1', '@plone/volto-quanta/(.*)$': '/src/addons/volto-quanta/src/$1', + '@eeacms/search/(.*)$': '/src/addons/volto-searchlib/searchlib/$1', + '@eeacms/search': '/src/addons/volto-searchlib/searchlib', '@eeacms/(.*?)/(.*)$': '/node_modules/@eeacms/$1/src/$2', '@plone/volto-slate$': '/node_modules/@plone/volto/packages/volto-slate/src', @@ -28,6 +30,7 @@ module.exports = { ], transform: { '^.+\\.js(x)?$': 'babel-jest', + '^.+\\.ts(x)?$': 'babel-jest', '^.+\\.(png)$': 'jest-file', '^.+\\.(jpg)$': 'jest-file', '^.+\\.(svg)$': './node_modules/@plone/volto/jest-svgsystem-transform.js', diff --git a/src/StyleWrapper/stretchStyleDefaultView.css b/src/StyleWrapper/stretchStyleDefaultView.css index b62c914..6be8fea 100644 --- a/src/StyleWrapper/stretchStyleDefaultView.css +++ b/src/StyleWrapper/stretchStyleDefaultView.css @@ -33,7 +33,9 @@ body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-ano } */ /* detect if is logged in but in view with toolbar open */ -body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous) +body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ) .stretch { max-width: 1636px; margin: 0; @@ -44,7 +46,9 @@ body:not(.is-authenticated):not(.document_wide_view).stretch { } @media screen and (max-width: 1790px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ) .stretch { right: auto; left: auto; @@ -53,13 +57,17 @@ body:not(.is-authenticated):not(.document_wide_view).stretch { transform: none; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar-collapsed) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar-collapsed) .stretch { max-width: 100vw; margin: 0 -25.54vw; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { max-width: 100vw; margin: 0 -25.5vw; @@ -67,14 +75,18 @@ body:not(.is-authenticated):not(.document_wide_view).stretch { } @media screen and (max-width: 1749px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { margin: 0 -26.1vw; } } @media screen and (max-width: 1700px) { - body:not(.document_wide_view):not(.view-editview):not(.view-addview):not(.is-anonymous):not(.is-authenticated).stretch { + body:not(.document_wide_view):not(.view-editview):not(.view-addview):not( + .is-anonymous + ):not(.is-authenticated).stretch { margin-right: 0; margin-left: 0; transform: translate(-50%, 0%); @@ -93,19 +105,25 @@ body:not(.is-authenticated):not(.document_wide_view).stretch { margin: 0 -26.8vw; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { margin: 0 -26.4vw; } } @media screen and (max-width: 1599px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar-collapsed) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar-collapsed) .stretch { margin: 0 -18.3vw; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { margin: 0 -18.9vw; } @@ -116,12 +134,16 @@ body:not(.is-authenticated):not(.document_wide_view).stretch { } @media screen and (max-width: 1499px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar-collapsed) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar-collapsed) .stretch { margin: 0 -18.4vw; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { margin: 0 -19vw; } @@ -132,12 +154,16 @@ body:not(.is-authenticated):not(.document_wide_view).stretch { } @media screen and (max-width: 1399px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar-collapsed) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar-collapsed) .stretch { margin: 0 -18.5vw; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { margin: 0 -19.2vw; } @@ -148,19 +174,25 @@ body:not(.is-authenticated):not(.document_wide_view).stretch { } @media screen and (max-width: 1280px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar-collapsed) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar-collapsed) .stretch { margin: 0 -17.8vw; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { margin: 0 -15.3rem; } } @media screen and (max-width: 1220px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { margin: 0 -14.9rem; } @@ -177,24 +209,32 @@ body:not(.is-authenticated):not(.document_wide_view).stretch { } @media screen and (max-width: 1199px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar-collapsed) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar-collapsed) .stretch { margin: 0 -3.6vw; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { margin: 0 -3.5vw; } } @media screen and (max-width: 1049px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar-collapsed) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar-collapsed) .stretch { margin: 0 -4vw; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { margin: 0 -4vw; } @@ -205,12 +245,16 @@ body:not(.is-authenticated):not(.document_wide_view).stretch { } @media screen and (max-width: 1000px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar-collapsed) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar-collapsed) .stretch { margin: 0 -4.2vw; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { margin: 0 -4.3vw; } @@ -221,12 +265,16 @@ body:not(.is-authenticated):not(.document_wide_view).stretch { } @media screen and (max-width: 900px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar-collapsed) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar-collapsed) .stretch { margin: 0 -4.65vw; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { margin: 0 -4.9vw; } @@ -237,12 +285,16 @@ body:not(.is-authenticated):not(.document_wide_view).stretch { } @media screen and (max-width: 849px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar-collapsed) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar-collapsed) .stretch { margin: 0 -1.2vw; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { margin: 0 -5vw; } @@ -253,24 +305,32 @@ body:not(.is-authenticated):not(.document_wide_view).stretch { } @media screen and (max-width: 787px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar-collapsed) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar-collapsed) .stretch { margin: 0 -1.2vw; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { margin: 0 -1.2vw; } } @media screen and (max-width: 767px) { - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar-collapsed) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar-collapsed) .stretch { padding: 0; } - body:not(.view-editview):not(.view-addview):not(.document_wide_view):not(.is-anonymous):not(.has-toolbar) + body:not(.view-editview):not(.view-addview):not(.document_wide_view):not( + .is-anonymous + ):not(.has-toolbar) .stretch { padding: 0; } diff --git a/src/StyleWrapper/stretchStyleEdit.css b/src/StyleWrapper/stretchStyleEdit.css index c6de85e..5afcd55 100644 --- a/src/StyleWrapper/stretchStyleEdit.css +++ b/src/StyleWrapper/stretchStyleEdit.css @@ -55,7 +55,9 @@ body:not(.view-viewview):not(.has-sidebar-collapsed):not(.has-toolbar) } /* media queries in edit both sidebars open */ - body:not(.view-viewview):not(.has-sidebar-collapsed):not(.has-toolbar-collapsed) + body:not(.view-viewview):not(.has-sidebar-collapsed):not( + .has-toolbar-collapsed + ) .stretch > fieldset legend { @@ -66,7 +68,9 @@ body:not(.view-viewview):not(.has-sidebar-collapsed):not(.has-toolbar) /* fix for section border to come around the stretched zone */ @media screen and (max-width: 1654px) { - body:not(.view-viewview):not(.has-sidebar-collapsed):not(.has-toolbar-collapsed) + body:not(.view-viewview):not(.has-sidebar-collapsed):not( + .has-toolbar-collapsed + ) .stretched-group { margin: 0 -34px; } diff --git a/src/StyleWrapper/stretchStyleWideView.css b/src/StyleWrapper/stretchStyleWideView.css index 0aa5057..cbc0bdd 100644 --- a/src/StyleWrapper/stretchStyleWideView.css +++ b/src/StyleWrapper/stretchStyleWideView.css @@ -45,7 +45,9 @@ body:not(.is-authenticated).document_wide_view .stretch { } @media screen and (max-width: 1700px) { - body:not(.view-editview):not(.is-anonymous):not(.is-authenticated).document_wide_view + body:not(.view-editview):not(.is-anonymous):not( + .is-authenticated + ).document_wide_view .stretch { margin-right: 0; margin-left: 0; @@ -66,19 +68,25 @@ body:not(.is-authenticated).document_wide_view .stretch { } @media screen and (max-width: 1280px) { - body:not(.view-editview):not(.is-anonymous):not(.has-toolbar-collapsed).document_wide_view + body:not(.view-editview):not(.is-anonymous):not( + .has-toolbar-collapsed + ).document_wide_view .stretch { margin: 0 -0.6rem; } - body:not(.view-editview):not(.is-anonymous):not(.has-toolbar).document_wide_view + body:not(.view-editview):not(.is-anonymous):not( + .has-toolbar + ).document_wide_view .stretch { margin: 0 -1rem; } } @media screen and (max-width: 1220px) { - body:not(.view-editview):not(.is-anonymous):not(.has-toolbar).document_wide_view + body:not(.view-editview):not(.is-anonymous):not( + .has-toolbar + ).document_wide_view .stretch { margin: 0 -0.6rem; } @@ -91,12 +99,16 @@ body:not(.is-authenticated).document_wide_view .stretch { } @media screen and (max-width: 767px) { - body:not(.view-editview):not(.is-anonymous):not(.has-toolbar-collapsed).document_wide_view + body:not(.view-editview):not(.is-anonymous):not( + .has-toolbar-collapsed + ).document_wide_view .stretch { padding: 0; } - body:not(.view-editview):not(.is-anonymous):not(.has-toolbar).document_wide_view + body:not(.view-editview):not(.is-anonymous):not( + .has-toolbar + ).document_wide_view .stretch { padding: 0; } diff --git a/src/Widgets/SimpleColorPicker.jsx b/src/Widgets/SimpleColorPicker.jsx index 3c37518..56ded55 100644 --- a/src/Widgets/SimpleColorPicker.jsx +++ b/src/Widgets/SimpleColorPicker.jsx @@ -6,7 +6,7 @@ import clearSVG from '@plone/volto/icons/clear.svg'; import loadable from '@loadable/component'; const GithubPicker = loadable(() => import('react-color/lib/Github')); -export default (props) => { +const SimpleColorPicker = (props) => { const { id, value, onChange, available_colors } = props; const [showPicker, setShowPicker] = React.useState(false); @@ -56,3 +56,5 @@ export default (props) => { ); }; + +export default SimpleColorPicker; diff --git a/src/Widgets/StyleSelect.jsx b/src/Widgets/StyleSelect.jsx index e27f086..eae4002 100644 --- a/src/Widgets/StyleSelect.jsx +++ b/src/Widgets/StyleSelect.jsx @@ -6,10 +6,8 @@ import cx from 'classnames'; const StyleSelectWidget = (props) => { const { id, value, onChange } = props; - const { - pluggableStyles = [], - previewText = 'Block content', - } = config.settings; + const { pluggableStyles = [], previewText = 'Block content' } = + config.settings; const renderPreview = React.useCallback( (style) => { diff --git a/src/Widgets/TextAlign.jsx b/src/Widgets/TextAlign.jsx index 9e32a37..96989fd 100644 --- a/src/Widgets/TextAlign.jsx +++ b/src/Widgets/TextAlign.jsx @@ -33,7 +33,9 @@ defaultActionsInfo['right'] = [alignRightSVG, messages.right]; defaultActionsInfo['center'] = [alignCenterSVG, messages.center]; defaultActionsInfo['justify'] = [alignJustifySVG, messages.justify]; -export default (props) => { +const TextAlign = (props) => { const actions = { actions: ['left', 'right', 'center', 'justify'] }; return AlignWidget(props, actions); }; + +export default TextAlign; diff --git a/src/styles.less b/src/styles.less index 64e3ae6..3e2d66d 100644 --- a/src/styles.less +++ b/src/styles.less @@ -160,8 +160,8 @@ /* Demo styles */ .green-demo-box { padding: 1em; - background-color: #aef2de; border-radius: 5px; + background-color: #aef2de; -webkit-box-shadow: 0 1px 6px 0 #c7d5d8; box-shadow: 0 1px 6px 0 #c7d5d8; } @@ -169,8 +169,8 @@ .preview-blue-demo-box, .blue-demo-box { padding: 0.3rem; - background: #1b217d; border-radius: 4px; + background: #1b217d; -webkit-box-shadow: 0 0 12px rgba(0, 0, 0, 0.2); box-shadow: 0 0 11px rgba(0, 0, 0, 0.2); color: white !important; From 4b38c0e3023a2515356921eb484e4460d4d87c61 Mon Sep 17 00:00:00 2001 From: alin Date: Mon, 22 Apr 2024 18:46:13 +0300 Subject: [PATCH 5/7] fix: Don't hard fail when block is missing --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index bf38fb7..8040708 100644 --- a/src/index.js +++ b/src/index.js @@ -21,7 +21,7 @@ import './styles.less'; export const applyStyleWrapperToBlock = (blockConfig) => { const BaseEditComponent = blockConfig.edit; let EditComponent = BaseEditComponent; - if (!EditComponent._styleWrapped) { + if (EditComponent && !EditComponent._styleWrapped) { EditComponent = (props) => ( @@ -33,7 +33,7 @@ export const applyStyleWrapperToBlock = (blockConfig) => { const BaseViewComponent = blockConfig.view; let ViewComponent = BaseViewComponent; - if (!ViewComponent._styleWrapped) { + if (ViewComponent && !ViewComponent._styleWrapped) { ViewComponent = (props) => ( From b73e6cf73f17c0842141cfedbc6b105abb9b6782 Mon Sep 17 00:00:00 2001 From: alin Date: Mon, 22 Apr 2024 19:05:12 +0300 Subject: [PATCH 6/7] feat: Release 7.0.0 - Volto 17 support --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 52e3b7d..33c0a99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eeacms/volto-block-style", - "version": "6.1.0", + "version": "7.0.0", "description": "volto-block-style: Volto add-on", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", From 44ebe56cbc3feb9413691c7b7d9d3c6f60a90919 Mon Sep 17 00:00:00 2001 From: EEA Jenkins <@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:16:26 +0000 Subject: [PATCH 7/7] Automated release 7.0.0 --- CHANGELOG.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3815735..6ee1b35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +### [7.0.0](https://github.com/eea/volto-block-style/compare/6.1.0...7.0.0) - 22 April 2024 + +#### :rocket: New Features + +- feat: Release 7.0.0 - Volto 17 support [alin - [`b73e6cf`](https://github.com/eea/volto-block-style/commit/b73e6cf73f17c0842141cfedbc6b105abb9b6782)] +- feat: Volto 17 support - refs #264527 [EEA Jenkins - [`00c4627`](https://github.com/eea/volto-block-style/commit/00c4627f4ea194adbf8c6c9954f226fa64c9fa8a)] + +#### :bug: Bug Fixes + +- fix: Don't hard fail when block is missing [alin - [`4b38c0e`](https://github.com/eea/volto-block-style/commit/4b38c0e3023a2515356921eb484e4460d4d87c61)] + +#### :hammer_and_wrench: Others + ### [6.1.0](https://github.com/eea/volto-block-style/compare/6.0.0...6.1.0) - 1 February 2024 #### :bug: Bug Fixes