diff --git a/.project.eslintrc.js b/.project.eslintrc.js index cfefd89..765070f 100644 --- a/.project.eslintrc.js +++ b/.project.eslintrc.js @@ -1,7 +1,9 @@ const fs = require('fs'); const path = require('path'); -const projectRootPath = fs.realpathSync('./project'); // __dirname +const projectRootPath = fs.existsSync('./project') + ? fs.realpathSync('./project') + : fs.realpathSync('./../../../'); const packageJson = require(path.join(projectRootPath, 'package.json')); const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions; diff --git a/CHANGELOG.md b/CHANGELOG.md index e09ac08..9298772 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,17 @@ 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). -### [1.0.0](https://github.com/eea/volto-call-to-action-block/compare/0.2.4...1.0.0) - 28 October 2022 +### [2.0.0](https://github.com/eea/volto-call-to-action-block/compare/1.0.0...2.0.0) - 15 November 2022 + +#### :nail_care: Enhancements + +- refactor(Styling): Use schemaEnhancer in favor of StyleWrapper [Alin Voinea - [`bba7ea1`](https://github.com/eea/volto-call-to-action-block/commit/bba7ea1ce39c4ff387c9ccb0dce3f10b3b678f59)] + +#### :hammer_and_wrench: Others + +- test(estlint): Fix .project.eslintrc.js [Alin Voinea - [`39e8df4`](https://github.com/eea/volto-call-to-action-block/commit/39e8df468509414924327917154f035235ec5798)] +- test(cypress): Rename [Alin Voinea - [`ef8b823`](https://github.com/eea/volto-call-to-action-block/commit/ef8b82323a0c108e58f73c180f5b4cb23ed04f0e)] +## [1.0.0](https://github.com/eea/volto-call-to-action-block/compare/0.2.4...1.0.0) - 28 October 2022 #### :nail_care: Enhancements diff --git a/Jenkinsfile b/Jenkinsfile index fc40a09..49091b4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { environment { GIT_NAME = "volto-call-to-action-block" NAMESPACE = "@eeacms" - SONARQUBE_TAGS = "volto.eea.europa.eu,demo-www.eea.europa.eu,prod-www.eea.europa.eu" + SONARQUBE_TAGS = "volto.eea.europa.eu,demo-www.eea.europa.eu,prod-www.eea.europa.eu,circularity.eea.europa.eu" DEPENDENCIES = "" VOLTO = "alpha" } diff --git a/README.md b/README.md index d1f83eb..b594733 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,12 @@ ![Call to Action](https://github.com/eea/volto-call-to-action-block/raw/develop/docs/call-to-action.gif) +## Upgrade + +### Upgrading to 2.x + +This version requires: `@plone/volto >= 16.0.0.alpha.46` (schemaEnhancer / addStyling). + ## Getting started ### Try volto-call-to-action-block with Docker diff --git a/cypress/e2e/01-block-basics.cy.js b/cypress/e2e/01-block-call-to-action.cy.js similarity index 100% rename from cypress/e2e/01-block-basics.cy.js rename to cypress/e2e/01-block-call-to-action.cy.js diff --git a/package.json b/package.json index 46a75c3..00a4d06 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@eeacms/volto-call-to-action-block", - "version": "1.0.0", + "version": "2.0.0", "description": "@eeacms/volto-call-to-action-block: Volto add-on", "main": "src/index.js", "author": "European Environment Agency: IDM2 A-Team", diff --git a/src/components/Schema.js b/src/components/Schema.js index 2d14882..ecd1cf8 100644 --- a/src/components/Schema.js +++ b/src/components/Schema.js @@ -1,4 +1,5 @@ import { defineMessages } from 'react-intl'; +import { addStyling } from '@plone/volto/helpers'; const messages = defineMessages({ Type: { @@ -111,41 +112,46 @@ export const EditSchema = ({ intl }) => ({ required: [], }); -export const StylingSchema = ({ intl }) => ({ - title: intl.formatMessage(messages.Type), - block: 'callToAction', - fieldsets: [ - { - id: 'default', - title: 'Default', - fields: ['align', 'theme', 'inverted', 'icon', 'rightIcon'], - }, - ], - properties: { - align: { - title: intl.formatMessage(messages.Align), - widget: 'align', +export const StylingSchema = (props) => { + const { intl } = props; + const schema = addStyling(props); + schema.properties.styles.schema = { + title: intl.formatMessage(messages.Type), + block: 'callToAction', + fieldsets: [ + { + id: 'default', + title: 'Default', + fields: ['align', 'theme', 'inverted', 'icon', 'rightIcon'], + }, + ], + properties: { + align: { + title: intl.formatMessage(messages.Align), + widget: 'align', + }, + theme: { + title: intl.formatMessage(messages.Theme), + choices: [ + ['primary', intl.formatMessage(messages.ThemePrimary)], + ['secondary', intl.formatMessage(messages.ThemeSecondary)], + ['tertiary', intl.formatMessage(messages.ThemeTertiary)], + ['link', intl.formatMessage(messages.ThemeLink)], + ], + }, + inverted: { + title: intl.formatMessage(messages.Inverted), + type: 'boolean', + }, + icon: { + title: intl.formatMessage(messages.Icon), + }, + rightIcon: { + title: intl.formatMessage(messages.IconRight), + type: 'boolean', + }, }, - theme: { - title: intl.formatMessage(messages.Theme), - choices: [ - ['primary', intl.formatMessage(messages.ThemePrimary)], - ['secondary', intl.formatMessage(messages.ThemeSecondary)], - ['tertiary', intl.formatMessage(messages.ThemeTertiary)], - ['link', intl.formatMessage(messages.ThemeLink)], - ], - }, - inverted: { - title: intl.formatMessage(messages.Inverted), - type: 'boolean', - }, - icon: { - title: intl.formatMessage(messages.Icon), - }, - rightIcon: { - title: intl.formatMessage(messages.IconRight), - type: 'boolean', - }, - }, - required: [], -}); + required: [], + }; + return schema; +}; diff --git a/src/index.js b/src/index.js index c639d7c..f167686 100644 --- a/src/index.js +++ b/src/index.js @@ -14,11 +14,10 @@ const applyConfig = (config) => { view: View, edit: Edit, editSchema: EditSchema, - stylesSchema: StylingSchema, + schemaEnhancer: StylingSchema, restricted: false, mostUsed: false, sidebarTab: 1, - enableStyling: true, security: { addPermission: [], view: [],