Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #84 from eea/develop
Browse files Browse the repository at this point in the history
add advanced link in config for fise
  • Loading branch information
andreiggr committed Dec 15, 2022
2 parents 014de45 + 38fc280 commit 0c17ddf
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 39 deletions.
1 change: 0 additions & 1 deletion .project.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const fs = require('fs');
const path = require('path');

const projectRootPath = fs.realpathSync('./project'); // __dirname
const packageJson = require(path.join(projectRootPath, 'package.json'));
const jsConfig = require(path.join(projectRootPath, 'jsconfig.json')).compilerOptions;

const pathsConfig = jsConfig.paths;
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +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).

### [0.2.23](https://github.com/eea/volto-forests-theme/compare/0.2.22...0.2.23) - 15 December 2022

#### :hammer_and_wrench: Others

- tests update [andreiggr - [`c31e9b9`](https://github.com/eea/volto-forests-theme/commit/c31e9b963b08cd7b2036b2fece43c53ee91546a7)]
- jenkins update [andreiggr - [`b98dc6a`](https://github.com/eea/volto-forests-theme/commit/b98dc6ab96562874e447b5cc7875780a631f2022)]
- add missing eslintrc.js [andreiggr - [`f4b2e25`](https://github.com/eea/volto-forests-theme/commit/f4b2e259812da2a127e198954eb7c621e7848e0f)]
- jenkins update [andreiggr - [`0e19006`](https://github.com/eea/volto-forests-theme/commit/0e1900672b2c3e3aff6ddbf6397ee309c1385a1f)]
- git pushMerge branch 'develop' of github.com:eea/volto-forests-theme into develop [andreiggr - [`5954eac`](https://github.com/eea/volto-forests-theme/commit/5954eacc3a52f3bbf02e4b51eb5de81790c05d69)]
- use yarn 1.18 [andreiggr - [`5f409fe`](https://github.com/eea/volto-forests-theme/commit/5f409fefe0106eb99801a282d94ba606106f45d2)]
- add advanced link in config for fise [andreiggr - [`4616af9`](https://github.com/eea/volto-forests-theme/commit/4616af93cc26035a34a481288c34364254a0a952)]
### [0.2.22](https://github.com/eea/volto-forests-theme/compare/0.2.21...0.2.22) - 7 November 2022

#### :hammer_and_wrench: Others
Expand Down
16 changes: 8 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pipeline {
NAMESPACE = "@eeacms"
SONARQUBE_TAGS = "volto.eea.europa.eu,forest.eea.europa.eu"
DEPENDENCIES = ""
VOLTO = "alpha"
VOLTO = "16.0.0-alpha.45"
}

stages {
Expand Down Expand Up @@ -39,21 +39,21 @@ pipeline {
steps {
parallel(

"ES lint": {
"ES lint": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-eslint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha eslint'''
sh '''docker run -i --rm --name="$BUILD_TAG-eslint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci eslint'''
}
},

"Style lint": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-stylelint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha stylelint'''
sh '''docker run -i --rm --name="$BUILD_TAG-stylelint" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci stylelint'''
}
},

"Prettier": {
node(label: 'docker') {
sh '''docker run -i --rm --name="$BUILD_TAG-prettier" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha prettier'''
sh '''docker run -i --rm --name="$BUILD_TAG-prettier" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci prettier'''
}
}
)
Expand All @@ -77,8 +77,8 @@ pipeline {
node(label: 'docker') {
script {
try {
sh '''docker pull plone/volto-addon-ci:alpha'''
sh '''docker run -i --name="$BUILD_TAG-volto" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e VOLTO=$VOLTO plone/volto-addon-ci:alpha'''
sh '''docker pull plone/volto-addon-ci'''
sh '''docker run -i --name="$BUILD_TAG-volto" -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" plone/volto-addon-ci'''
sh '''rm -rf xunit-reports'''
sh '''mkdir -p xunit-reports'''
sh '''docker cp $BUILD_TAG-volto:/opt/frontend/my-volto-project/coverage xunit-reports/'''
Expand Down Expand Up @@ -126,7 +126,7 @@ pipeline {
script {
try {
sh '''docker pull eeacms/plone-backend; docker run -d --rm --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="eea.kitkat:testing" eeacms/plone-backend'''
sh '''docker pull plone/volto-addon-ci:alpha; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=development -e VOLTO="$VOLTO" plone/volto-addon-ci:alpha cypress'''
sh '''docker pull plone/volto-addon-ci; docker run -i --name="$BUILD_TAG-cypress" --link $BUILD_TAG-plone:plone -e NAMESPACE="$NAMESPACE" -e GIT_NAME=$GIT_NAME -e GIT_BRANCH="$BRANCH_NAME" -e GIT_CHANGE_ID="$CHANGE_ID" -e DEPENDENCIES="$DEPENDENCIES" -e NODE_ENV=development -e VOLTO="$VOLTO" plone/volto-addon-ci cypress'''
} finally {
try {
sh '''rm -rf cypress-reports cypress-results cypress-coverage'''
Expand Down
56 changes: 28 additions & 28 deletions cypress/e2e/block-basics.cy.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import { setupBeforeEach, tearDownAfterEach } from '../support/e2e';
// import { setupBeforeEach, tearDownAfterEach } from '../support/e2e';

describe('Blocks Tests', () => {
beforeEach(setupBeforeEach);
afterEach(tearDownAfterEach);
// describe('Blocks Tests', () => {
// beforeEach(setupBeforeEach);
// afterEach(tearDownAfterEach);

it('Add Block: Empty', () => {
// Change page title
// cy.get('.documentFirstHeading > .public-DraftStyleDefault-block')
// .clear()
// .type('My Add-on Page')
// .get('.documentFirstHeading span[data-text]')
// .contains('My Add-on Page');
// cy.get('.documentFirstHeading > .public-DraftStyleDefault-block').type(
// '{enter}',
// );
// // Add block
// cy.get('.ui.basic.icon.button.block-add-button').first().click();
// //cy.get('.blocks-chooser .title').contains('Common Blocks').click();
// cy.get('.content.active.common_blocks .button.image')
// .contains('Image')
// .click();
// // Save
// cy.get('#toolbar-save').click();
// cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
// // then the page view should contain our changes
// cy.contains('My Page');
// cy.get('.block.image');
});
});
// it('Add Block: Empty', () => {
// // Change page title
// // cy.get('.documentFirstHeading > .public-DraftStyleDefault-block')
// // .clear()
// // .type('My Add-on Page')
// // .get('.documentFirstHeading span[data-text]')
// // .contains('My Add-on Page');
// // cy.get('.documentFirstHeading > .public-DraftStyleDefault-block').type(
// // '{enter}',
// // );
// // // Add block
// // cy.get('.ui.basic.icon.button.block-add-button').first().click();
// // //cy.get('.blocks-chooser .title').contains('Common Blocks').click();
// // cy.get('.content.active.common_blocks .button.image')
// // .contains('Image')
// // .click();
// // // Save
// // cy.get('#toolbar-save').click();
// // cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
// // // then the page view should contain our changes
// // cy.contains('My Page');
// // cy.get('.block.image');
// });
// });
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-forests-theme",
"version": "0.2.22",
"version": "0.2.23",
"description": "@eeacms/volto-forests-theme: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down Expand Up @@ -58,5 +58,6 @@
"lint:fix": "../../../node_modules/eslint/bin/eslint.js --fix 'src/**/*.{js,jsx}'",
"cypress:run": "../../../node_modules/cypress/bin/cypress run",
"cypress:open": "../../../node_modules/cypress/bin/cypress open"
}
},
"packageManager": "yarn@1.18.0"
}
49 changes: 49 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,27 @@ import reducers from '@eeacms/volto-forests-theme/reducers';

import './slate-styles.css';

import linkSVG from '@plone/volto/icons/link.svg';
import { makeInlineElementPlugin } from '@plone/volto-slate/elementEditor';

import { LINK } from '@plone/volto-slate/constants';
import { LinkElement } from '@plone/volto-slate/editor/plugins/AdvancedLink/render';
import { withLink } from '@plone/volto-slate/editor/plugins/AdvancedLink/extensions';
import { linkDeserializer } from '@plone/volto-slate/editor/plugins/AdvancedLink/deserialize';
import LinkEditSchema from '@plone/volto-slate/editor/plugins/AdvancedLink/schema';
import { defineMessages } from 'react-intl'; // , defineMessages

const messages = defineMessages({
edit: {
id: 'Edit link',
defaultMessage: 'Edit link',
},
delete: {
id: 'Remove link',
defaultMessage: 'Remove link',
},
});

export default function applyConfig(config) {
// Add here your project's configuration here by modifying `config` accordingly
config = [
Expand Down Expand Up @@ -130,5 +151,33 @@ export default function applyConfig(config) {
// { cssClass: 'green-block-text', label: 'Green Text' },
// { cssClass: 'underline-block-text', label: 'Underline Text' },
// ];

//advancedlink is currently not working properly/not recognized in fise, so we add it to config manually
const { slate } = config.settings;

slate.toolbarButtons = [...(slate.toolbarButtons || []), LINK];
slate.expandedToolbarButtons = [
...(slate.expandedToolbarButtons || []),
LINK,
];

slate.htmlTagsToSlate.A = linkDeserializer;

const opts = {
title: 'Link',
pluginId: LINK,
elementType: LINK,
element: LinkElement,
isInlineElement: true,
editSchema: LinkEditSchema,
extensions: [withLink],
hasValue: (formData) => !!formData.link,
toolbarButtonIcon: linkSVG,
messages,
};

const [installLinkEditor] = makeInlineElementPlugin(opts);
config = installLinkEditor(config);

return config;
}

0 comments on commit 0c17ddf

Please sign in to comment.