@eeacms/volto-slate-footnote 4.0.4 → 4.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,8 +4,14 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ #### [4.0.5](https://github.com/eea/volto-slate-footnote/compare/4.0.4...4.0.5)
8
+
9
+ - Allow other block types to define footnotes - refs #148688 [`12f5920`](https://github.com/eea/volto-slate-footnote/commit/12f592019bbc37d71c14a64387ef9fbaf1828adc)
10
+
7
11
  #### [4.0.4](https://github.com/eea/volto-slate-footnote/compare/4.0.3...4.0.4)
8
12
 
13
+ > 3 January 2022
14
+
9
15
 
10
16
  #### [4.0.3](https://github.com/eea/volto-slate-footnote/compare/4.0.2...4.0.3)
11
17
 
package/Jenkinsfile CHANGED
@@ -4,7 +4,7 @@ pipeline {
4
4
  environment {
5
5
  GIT_NAME = "volto-slate-footnote"
6
6
  NAMESPACE = "@eeacms"
7
- SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater"
7
+ SONARQUBE_TAGS = "volto.eea.europa.eu,biodiversity.europa.eu,www.eea.europa.eu-ims,climate-energy.eea.europa.eu,sustainability.eionet.europa.eu,forest.eea.europa.eu,clms.land.copernicus.eu,industry.eea.europa.eu,water.europa.eu-freshwater,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu"
8
8
  DEPENDENCIES = "volto-slate:asDefault"
9
9
  }
10
10
 
@@ -184,10 +184,10 @@ pipeline {
184
184
  unstash "xunit-reports"
185
185
  unstash "cypress-coverage"
186
186
  def scannerHome = tool 'SonarQubeScanner';
187
- def nodeJS = tool 'NodeJS11';
187
+ def nodeJS = tool 'NodeJS';
188
188
  withSonarQubeEnv('Sonarqube') {
189
189
  sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
190
- sh "export PATH=$PATH:${scannerHome}/bin:${nodeJS}/bin; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
190
+ sh "export PATH=${scannerHome}/bin:${nodeJS}/bin:$PATH; sonar-scanner -Dsonar.javascript.lcov.reportPaths=./xunit-reports/coverage/lcov.info,./cypress-coverage/coverage/lcov.info -Dsonar.sources=./src -Dsonar.projectKey=$GIT_NAME-$BRANCH_NAME -Dsonar.projectVersion=$BRANCH_NAME-$BUILD_NUMBER"
191
191
  sh '''try=2; while [ \$try -gt 0 ]; do curl -s -XPOST -u "${SONAR_AUTH_TOKEN}:" "${SONAR_HOST_URL}api/project_tags/set?project=${GIT_NAME}-${BRANCH_NAME}&tags=${SONARQUBE_TAGS},${BRANCH_NAME}" > set_tags_result; if [ \$(grep -ic error set_tags_result ) -eq 0 ]; then try=0; else cat set_tags_result; echo "... Will retry"; sleep 60; try=\$(( \$try - 1 )); fi; done'''
192
192
  }
193
193
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-slate-footnote",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
4
4
  "description": "volto-slate-footnote: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
package/src/constants.js CHANGED
@@ -1 +1,2 @@
1
1
  export const FOOTNOTE = 'footnote';
2
+ export const SLATE = 'slate';
@@ -11,6 +11,7 @@ import { Node } from 'slate';
11
11
  import { useSelector } from 'react-redux';
12
12
  import { isEmpty } from 'lodash';
13
13
  import { getAllBlocksAndSlateFields } from '@eeacms/volto-slate-footnote/editor/utils';
14
+ import config from '@plone/volto/registry';
14
15
 
15
16
  const FootnoteEditor = (props) => {
16
17
  const {
@@ -66,7 +67,7 @@ const FootnoteEditor = (props) => {
66
67
  // add label and value for the multi search widget
67
68
  // flatten blocks to add all extra in the list
68
69
  flatAllBlocks
69
- .filter((b) => b['@type'] === 'slate')
70
+ .filter((b) => config.settings.blocksWithFootnotes.includes(b['@type']))
70
71
  .forEach(({ value }) => {
71
72
  if (!value) return;
72
73
 
@@ -118,7 +118,7 @@ export const makeFootnoteListOfUniqueItems = (blocks) => {
118
118
  let notesObjResult = {};
119
119
 
120
120
  blocks
121
- .filter((b) => b['@type'] === 'slate')
121
+ .filter((b) => config.settings.blocksWithFootnotes.includes(b['@type']))
122
122
  .forEach(({ value }) => {
123
123
  if (!value) return;
124
124
  // Node.elements(value[0]) returns an iterable generator of nodes
package/src/index.js CHANGED
@@ -3,7 +3,7 @@ import codeSVG from '@plone/volto/icons/blog-entry.svg';
3
3
  import FootnotesBlockView from './Blocks/Footnote/FootnotesBlockView';
4
4
  import FootnotesBlockEdit from './Blocks/Footnote/FootnotesBlockEdit';
5
5
  import FootnotesBlockSchema from './Blocks/Footnote/FootnotesBlockSchema';
6
- import { FOOTNOTE } from './constants';
6
+ import { FOOTNOTE, SLATE } from './constants';
7
7
  import installFootnoteEditor from './editor';
8
8
  import SearchWidget from '@eeacms/volto-slate-footnote/editor/MultiSelectSearchWidget';
9
9
 
@@ -36,5 +36,10 @@ export default function install(config) {
36
36
  config.widgets.widget.searchInput = SearchWidget;
37
37
  config = installFootnoteEditor(config);
38
38
 
39
+ config.settings.blocksWithFootnotes = [
40
+ ...(config.settings.blocksWithFootnotes || []),
41
+ SLATE,
42
+ ];
43
+
39
44
  return config;
40
45
  }