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

Commit

Permalink
Merge pull request #150 from eea/develop
Browse files Browse the repository at this point in the history
Release 3.0.0
  • Loading branch information
avoinea committed Sep 10, 2021
2 parents 5e4cab9 + 657e5cb commit e9fac27
Show file tree
Hide file tree
Showing 68 changed files with 1,750 additions and 522 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
.vscode/
.eslintrc.js
.history
.eslintrc.js
project
logs
*.log
npm-debug.log*
.DS_Store
*.swp
yarn-error.log
yarn.lock
package-lock.json

node_modules
build
dist
cypress/videos
cypress/reports
screenshots
videos
.env.local
Expand Down
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,51 @@ 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).

#### [3.0.0](https://github.com/eea/volto-slate/compare/3.0.0-alpha.0...3.0.0)

- Fix cypress api_url [`596cbfb`](https://github.com/eea/volto-slate/commit/596cbfbf1d1820c28faa1ea178ee05a2b6a72f9c)
- Add Sonarqube tag using ims-frontend addons list [`a97689d`](https://github.com/eea/volto-slate/commit/a97689de4dc39186da03ed0b1216471d2e305764)

#### [3.0.0-alpha.0](https://github.com/eea/volto-slate/compare/2.9.3...3.0.0-alpha.0)

> 9 September 2021
- Cypress - refactoring / reorganize [`#148`](https://github.com/eea/volto-slate/pull/148)
- Slate widget with HTML backend data [`#146`](https://github.com/eea/volto-slate/pull/146)
- Code cleanup, use better method of detecting text blocks [`#144`](https://github.com/eea/volto-slate/pull/144)
- Cleanup the text normalization stages [`#143`](https://github.com/eea/volto-slate/pull/143)
- Fix volto-object-widget dependency pin [`d72ebdd`](https://github.com/eea/volto-slate/commit/d72ebddee1e25afdc188d39c953796d2e94ced2e)
- Cypress increase timeout and retries [`c8ff87c`](https://github.com/eea/volto-slate/commit/c8ff87c38e304661c348a7590dad994fa700bdb2)
- Reduce cypress timeout and retries [`ee28f67`](https://github.com/eea/volto-slate/commit/ee28f67f0022f44cce58d9b5423770f9e8320369)
- yarn lint [`4f16d84`](https://github.com/eea/volto-slate/commit/4f16d84db174bb092344f91522dc5d2a0cf44f91)
- Add cypress tests for Slate JSON Field metadata [`c2460d9`](https://github.com/eea/volto-slate/commit/c2460d9e6fec7e90c9c0eefb6f43f9b994588b74)
- Fix deconstructToVoltoBlocks conditions [`887ec31`](https://github.com/eea/volto-slate/commit/887ec312e02e0ca56e17de423a078024ca8e6a24)
- Cypress retry 3 times before fail [`dd4762b`](https://github.com/eea/volto-slate/commit/dd4762bbd59195e7de7803b4432ab7f75568ee56)
- Fix deserialize.js [`aef31f1`](https://github.com/eea/volto-slate/commit/aef31f14c599a8dd5fbc3d78de6772080142abb6)
- Fix isNotTextBlock condition [`d20aa43`](https://github.com/eea/volto-slate/commit/d20aa43d65e7e79f9d64fa3075fb1751bb06c07a)
- Fix list items style within sidebar metadata editor [`3044370`](https://github.com/eea/volto-slate/commit/3044370593b24753acc5b2b0b633353d84b783f5)
- Code cleanup [`1770743`](https://github.com/eea/volto-slate/commit/177074371e00eba400181b5827592e1537786821)
- Be more safe with list handling out of blocks [`4921e1e`](https://github.com/eea/volto-slate/commit/4921e1ec90d1edfeda546b1cab005b3ddb129520)
- Be more safe with list handling out of blocks [`f996057`](https://github.com/eea/volto-slate/commit/f99605792c002396ddd83c0d1264cd31374c9ea1)
- Remove unused import [`c0bb6b5`](https://github.com/eea/volto-slate/commit/c0bb6b534199a9438860467bb4621e9d95c7b2ad)
- Fix table cell selection [`405db60`](https://github.com/eea/volto-slate/commit/405db601fcebbbdffe33793dc9766c64786a438b)
- Remove DEPRECATED PageLinkSchema. Not used [`55bfdf7`](https://github.com/eea/volto-slate/commit/55bfdf7b4bc801b43d2610bb5e1121e272c8581f)
- Fix linting [`efcceb4`](https://github.com/eea/volto-slate/commit/efcceb46a227ca86d9eaae688e51694d210f78fd)
- Remove DEPRECATED ObjectBrowserWidget. Moved to Volto core [`97c8d15`](https://github.com/eea/volto-slate/commit/97c8d1503a1ad11869635ed1c86c57594af5c6f8)
- Remove DEPRECATED ObjectWidget from futurevolto. Moved to Volto core [`bc38505`](https://github.com/eea/volto-slate/commit/bc38505c656f689b4ca70eebd4fd29ad0cbfd491)
- Remove DEPRECATED Blocks helpers and SidebarPopup [`3edf6a8`](https://github.com/eea/volto-slate/commit/3edf6a88604080091c70b560e03116b684945ad5)
- Add SlateRichtextWidgetView to be used with metadata block/mentions [`369f7ef`](https://github.com/eea/volto-slate/commit/369f7ef73d1bc64841a6d14b11594e9a3ad1f651)
- BREAKING - Remove table button from defaults [`945a13a`](https://github.com/eea/volto-slate/commit/945a13a257ef4d2edfa751fe4f91af07ac243f3a)
- Remove duplicate blockquote button within toolbar [`346620f`](https://github.com/eea/volto-slate/commit/346620ff5de6f4c45f9d48624401c72ebb58ac92)
- Support new metadata fields on old content [`e4c7f9d`](https://github.com/eea/volto-slate/commit/e4c7f9ddc6e67b18baaff0ea1379379055a32168)
- Register slate widget to be used with DX metadata [`c98f6c0`](https://github.com/eea/volto-slate/commit/c98f6c0e07bfc26278a2bb4dade79f83036c2a6f)
- Add Lock-Token to default CORS allow_headers [`57f7f95`](https://github.com/eea/volto-slate/commit/57f7f9506662dbe1f777328d55ce61250061713a)

#### [2.9.3](https://github.com/eea/volto-slate/compare/2.9.2...2.9.3)

> 26 August 2021
- Release [`#139`](https://github.com/eea/volto-slate/pull/139)
- Add EditorReference component, fix interaction with table cells [`#138`](https://github.com/eea/volto-slate/pull/138)

#### [2.9.2](https://github.com/eea/volto-slate/compare/2.9.1...2.9.2)
Expand Down
22 changes: 20 additions & 2 deletions DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,33 @@
1. Assuming everything is right about your development environment, make
a clone of this repo, then:

make build-frontend
make

1. This will create a `project` folder with a bootstrapped Volto.

cd project
cd volto-slate/project
yarn start

Just change the code in your clone and it will automatically refresh Volto!

## Cypress tests

### Start backend

cd volto-slate
make start-docker-backend

### Start frontend

make
cd project
yarn start

### Open cypress

cd volto-slate
yarn cypress:open

## Develop

Before starting make sure your development environment is properly set. See [Volto Developer Documentation](https://docs.voltocms.com/getting-started/install/)
Expand Down
8 changes: 5 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ pipeline {
environment {
GIT_NAME = "volto-slate"
NAMESPACE = ""
DEPENDENCIES = "volto-slate:asDefault"
SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,biodiversity.europa.eu"
DEPENDENCIES = "volto-slate:asDefault,asDefaultRichText"
SONARQUBE_TAGS = "volto.eea.europa.eu,climate-energy.eea.europa.eu,forest.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims"
PLONE_VERSIONS = "plone.schema=1.3.0 plone.restapi=8.9.1"
PLONE_ADDONS = "eea.schema.slate"
}

stages {
Expand Down Expand Up @@ -82,7 +84,7 @@ pipeline {
node(label: 'docker') {
script {
try {
sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
sh '''docker pull plone; docker run -d --name="$BUILD_TAG-plone" -e SITE="Plone" -e ADDONS="$PLONE_ADDONS" -e VERSIONS="$PLONE_VERSIONS" -e PROFILES="profile-plone.restapi:blocks" plone fg'''
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" plone/volto-addon-ci cypress'''
} finally {
try {
Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SHELL=/bin/bash

DIR=$(shell basename $$(pwd))
ADDON ?= volto-slate:asDefault
ADDON ?= volto-slate:asDefault,asDefaultRichText

# We like colors
# From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects
Expand Down Expand Up @@ -47,6 +47,11 @@ start-test-backend: ## Start Test Plone Backend
@echo "$(GREEN)==> Start Test Plone Backend$(RESET)"
ZSERVER_PORT=55001 CONFIGURE_PACKAGES=plone.app.contenttypes,plone.restapi,kitconcept.volto,kitconcept.volto.cors,eea.volto.slate APPLY_PROFILES=plone.app.contenttypes:plone-content,plone.restapi:default,kitconcept.volto:default-homepage,eea.volto.slate:default ./api/bin/robot-server plone.app.robotframework.testing.PLONE_ROBOT_TESTING

.PHONY: start-docker-backend
start-docker-backend:
@echo "$(GREEN)==> Start Plone Backend$(RESET)"
docker pull plone
docker run -it --rm -e SITE="Plone" -e ADDONS="eea.schema.slate" -e VERSIONS="plone.schema=1.3.0 plone.restapi=8.9.1" -e PROFILES="profile-plone.restapi:blocks" -p 8080:8080 plone fg

.PHONY: help
help: ## Show this help.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ volto-slate provides several optional configuration:
similar to Volto
- `simpleLink` reuses Volto's link plugin and makes for a better replacement
of Volto's rich text editor.
- `tableButton` adds table button to Slate toolbar in order to easily insert
Table block after.

## Features

Expand Down
10 changes: 10 additions & 0 deletions SlateSchema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Slate document schema and normalizations

The following normalizations are applied to the text:

# Basic slate editor (the foundation level)

- remove childless list nodes (ul/ol)
- nodes that are not <li>, inside <ol/ul> are lifted up

# Text block editor
10 changes: 7 additions & 3 deletions api/buildout.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[buildout]
index = https://pypi.org/simple/
extends = http://dist.plone.org/release/5.2.3/versions.cfg
extends = http://dist.plone.org/release/5.2.5/versions.cfg
find-links += http://dist.plone.org/thirdparty/
parts = instance plonesite robot-server test test-coverage
versions = versions
Expand All @@ -26,9 +26,11 @@ eggs =
kitconcept.volto
Products.PloneHotfix20200121
eea.volto.slate
eea.schema.slate
plone.restapi [test]
zcml =
eea.volto.slate
eea.schema.slate

zcml-additional =
<configure xmlns="http://namespaces.zope.org/zope"
Expand All @@ -38,7 +40,7 @@ zcml-additional =
allow_methods="DELETE,GET,OPTIONS,PATCH,POST,PUT"
allow_credentials="true"
expose_headers="Content-Length,X-My-Header"
allow_headers="Accept,Authorization,Content-Type,X-Custom-Header,Origin"
allow_headers="Accept,Authorization,Content-Type,X-Custom-Header,Origin,Lock-Token"
max_age="3600"
/>
</configure>
Expand Down Expand Up @@ -94,7 +96,9 @@ mode = 755
[versions]
setuptools =
zc.buildout =
plone.restapi = 7.0.0
plone.restapi = 8.9.1
plone.schema = 1.3.0
plone.rest = 1.6.2

kitconcept.volto =

Expand Down
7 changes: 6 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"baseUrl": "http://localhost:3000",
"viewportWidth": 1280,
"defaultCommandTimeout": 15000,
"defaultCommandTimeout": 8888,
"chromeWebSecurity": false,
"reporter": "junit",
"video": true,
"retries": {
"runMode": 8,
"openMode": 0
},
"reporterOptions": {
"mochaFile": "cypress/reports/cypress-[hash].xml",
"jenkinsMode": true,
Expand Down
6 changes: 2 additions & 4 deletions cypress/integration/01-block-slate-empty.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ describe('Block Tests', () => {
.clear()
.type('My Add-on Page')
.type('{enter}')
.get('.documentFirstHeading span[data-text]')
.get('.content-area .documentFirstHeading span[data-text]')
.contains('My Add-on Page');

// Save
cy.get('#toolbar-save').click();
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
cy.waitForResourceToLoad('my-page');
cy.toolbarSave();

// then the page view should contain our changes
cy.contains('My Add-on Page');
Expand Down
18 changes: 5 additions & 13 deletions cypress/integration/02-block-slate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,17 @@ describe('Block Tests', () => {
afterEach(slateAfterEach);

it('should create 4 slate blocks, first 3 with mouse, the last with an Enter in the third block', () => {
cy.get('.slate-editor [contenteditable=true]')
cy.get('.content-area .slate-editor [contenteditable=true]')
.focus()
.click()
.wait(1000)
.type("Hello Slate World")
.type("{enter}");

cy.wait(500);
.type('Hello Slate World')
.type('{enter}');

// Save
cy.get('#toolbar-save').click();
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
cy.waitForResourceToLoad('@navigation');
cy.waitForResourceToLoad('@breadcrumbs');
cy.waitForResourceToLoad('@actions');
cy.waitForResourceToLoad('@types');
cy.waitForResourceToLoad('my-page');
cy.toolbarSave();

// then the page view should contain our changes
cy.get('.ui.container p').contains('Hello Slate World');
cy.contains('Hello Slate World');
});
});
11 changes: 9 additions & 2 deletions cypress/integration/03-block-slate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ describe('Block Tests', () => {
afterEach(slateAfterEach);

it('should create a block with some text, move the cursor in the middle of the text, insert a line break, and then have 2 blocks with the two parts of the initial text', () => {
cy.get('.slate-editor [contenteditable=true]').focus()
cy.get('.content-area .slate-editor [contenteditable=true]')
.focus()
.click()
.wait(1000)
.type("hello, world")
.type('hello, world')
.type('{leftarrow}')
.type('{leftarrow}')
.type('{leftarrow}')
Expand All @@ -36,5 +37,11 @@ describe('Block Tests', () => {
},
]);
});

// Save
cy.toolbarSave();

cy.contains('hello, ');
cy.contains('world');
});
});
56 changes: 11 additions & 45 deletions cypress/integration/04-block-focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,25 @@ describe('Block Tests', () => {
beforeEach(slateBeforeEach);
afterEach(slateAfterEach);

it('As editor I can add a link to a text block', function () {
it('As editor I can add text and select parts of it and see the Slate Toolbar', function () {
// Complete chained commands
cy.get('.slate-editor [contenteditable=true]')
.focus()
.click()
.wait(1000)
.type('Colorless green ideas sleep furiously.');

cy.get('.slate-editor.selected [contenteditable=true]').setSelection(
'furiously',
);
cy.getSlateEditorAndType('Colorless green ideas sleep furiously.');
cy.setSlateSelection('furiously');

// This also works
cy.get('.slate-editor [contenteditable=true]')
.focus()
.click()
.wait(1000)
.type('Colorless green ideas sleep furiously.')
.setSelection('furiously');

// As a function
const getSlateEditorAndType = (selector, type) => {
return cy.get(selector).focus().click().wait(1000).type(type);
};

getSlateEditorAndType(
'.slate-editor [contenteditable=true]',
cy.getSlateEditorAndType(
'Colorless green ideas sleep furiously.',
).setSelection('furiously');

cy.wait(1000);

cy.get('.slate-inline-toolbar .button-wrapper a[title="Link"]').click();
cy.get('.sidebar-container a.item:nth-child(3)').click();
cy.get('input[name="external_link-0-external"]')
.click()
.type('https://google.com{enter}');
cy.get('.sidebar-container .form .header button:first-of-type').click();
// This also works
cy.getSlateEditorAndType(
'Colorless green ideas sleep furiously.',
).setSlateSelection('furiously');

cy.get('#toolbar-save').click();
cy.url().should('eq', Cypress.config().baseUrl + '/cypress/my-page');
cy.waitForResourceToLoad('@navigation');
cy.waitForResourceToLoad('@breadcrumbs');
cy.waitForResourceToLoad('@actions');
cy.waitForResourceToLoad('@types');
cy.waitForResourceToLoad('my-page');
// Save
cy.toolbarSave();

// then the page view should contain a link
cy.get('.ui.container p').contains(
'Colorless green ideas sleep furiously.',
);
cy.get('.ui.container p a')
.should('have.attr', 'href')
.and('include', 'https://google.com');
cy.contains('Colorless green ideas sleep furiously.');
});
});
Loading

0 comments on commit e9fac27

Please sign in to comment.