@eeacms/volto-slate-metadata-mentions 6.1.0 → 6.1.2
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,12 +4,37 @@ 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
|
+
### [6.1.2](https://github.com/eea/volto-slate-metadata-mentions/compare/6.1.1...6.1.2) - 24 July 2023
|
|
8
|
+
|
|
9
|
+
#### :hammer_and_wrench: Others
|
|
10
|
+
|
|
11
|
+
- test: Fix issues identified by Sonarqube - refs #254220 [dana-cfc4 - [`0f85e72`](https://github.com/eea/volto-slate-metadata-mentions/commit/0f85e723d3a561f437861cfb80f6e779271a7de1)]
|
|
12
|
+
### [6.1.1](https://github.com/eea/volto-slate-metadata-mentions/compare/6.1.0...6.1.1) - 12 June 2023
|
|
13
|
+
|
|
14
|
+
#### :rocket: New Features
|
|
15
|
+
|
|
16
|
+
- feat: add unit tests for utils - refs #253277 [ana-oprea - [`3544bc8`](https://github.com/eea/volto-slate-metadata-mentions/commit/3544bc877d0b7385606f022c0229c7c0bbdac719)]
|
|
17
|
+
|
|
18
|
+
#### :house: Internal changes
|
|
19
|
+
|
|
20
|
+
- chore: [JENKINS] Deprecate circularity website [valentinab25 - [`bea37a4`](https://github.com/eea/volto-slate-metadata-mentions/commit/bea37a4cd51c087a67dbb23f8ac778e201f06596)]
|
|
21
|
+
|
|
22
|
+
#### :hammer_and_wrench: Others
|
|
23
|
+
|
|
24
|
+
- test: jest should look for addons in node_modules Refs #253277 [valentinab25 - [`98fa009`](https://github.com/eea/volto-slate-metadata-mentions/commit/98fa00918b613bdbf079300e4683f300ba77c575)]
|
|
25
|
+
- test: Fix test config, coverage Refs #253277 [valentinab25 - [`e87dda2`](https://github.com/eea/volto-slate-metadata-mentions/commit/e87dda2b7ec6f8d39383ee4024265628e562be8f)]
|
|
26
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`d941f6b`](https://github.com/eea/volto-slate-metadata-mentions/commit/d941f6bcdf7154c8fac1a6e8c9436f2a0af1dfef)]
|
|
7
27
|
### [6.1.0](https://github.com/eea/volto-slate-metadata-mentions/compare/6.0.1...6.1.0) - 27 March 2023
|
|
8
28
|
|
|
9
29
|
#### :hammer_and_wrench: Others
|
|
10
30
|
|
|
11
|
-
-
|
|
31
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`eb5cef6`](https://github.com/eea/volto-slate-metadata-mentions/commit/eb5cef62bf50f5f100e4348f5642166168f7db3b)]
|
|
32
|
+
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`11d00a7`](https://github.com/eea/volto-slate-metadata-mentions/commit/11d00a7994b7ad7efaeb1d23582052be43abac1b)]
|
|
33
|
+
- Add Sonarqube tag using advisory-board-frontend addons list [EEA Jenkins - [`5293413`](https://github.com/eea/volto-slate-metadata-mentions/commit/5293413f9bbf28d304c3a26c5df9c6bca935ca04)]
|
|
12
34
|
- test(Jenkins): Run tests and cypress with latest canary @plone/volto [Alin Voinea - [`fc0a308`](https://github.com/eea/volto-slate-metadata-mentions/commit/fc0a30840ee5cc4c3d00683800c510080b13cb09)]
|
|
35
|
+
- Add Sonarqube tag using cca-frontend addons list [EEA Jenkins - [`abb75cd`](https://github.com/eea/volto-slate-metadata-mentions/commit/abb75cd923d258edd89cee3b5ef52e6232cf0a03)]
|
|
36
|
+
- yarn 3 [Alin Voinea - [`ae13d7b`](https://github.com/eea/volto-slate-metadata-mentions/commit/ae13d7b7e029da5765c8e85aede5f08c01131152)]
|
|
37
|
+
- Add Sonarqube tag using demo-kitkat-frontend addons list [EEA Jenkins - [`561f504`](https://github.com/eea/volto-slate-metadata-mentions/commit/561f5043e35499b2208d81358f3289a9199ce8dd)]
|
|
13
38
|
### [6.0.1](https://github.com/eea/volto-slate-metadata-mentions/compare/6.0.0...6.0.1) - 16 November 2022
|
|
14
39
|
|
|
15
40
|
#### :hammer_and_wrench: Others
|
|
@@ -24,35 +49,47 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
24
49
|
|
|
25
50
|
#### :hammer_and_wrench: Others
|
|
26
51
|
|
|
52
|
+
- Add Sonarqube tag using marine-frontend addons list [EEA Jenkins - [`a684cac`](https://github.com/eea/volto-slate-metadata-mentions/commit/a684cac03f47b8d89bbf4b14ede23143e4b774a5)]
|
|
53
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`a30ae17`](https://github.com/eea/volto-slate-metadata-mentions/commit/a30ae17a70d891d20f6b73ea4a5c6576316894a2)]
|
|
27
54
|
### [5.0.1](https://github.com/eea/volto-slate-metadata-mentions/compare/5.0.0...5.0.1) - 30 June 2022
|
|
28
55
|
|
|
29
56
|
#### :hammer_and_wrench: Others
|
|
30
57
|
|
|
58
|
+
- Add Sonarqube tag using circularity-frontend addons list [EEA Jenkins - [`6d5c31f`](https://github.com/eea/volto-slate-metadata-mentions/commit/6d5c31f8217c9f5a52fc2447c5d89fafa717932d)]
|
|
31
59
|
## [5.0.0](https://github.com/eea/volto-slate-metadata-mentions/compare/4.0.3...5.0.0) - 6 April 2022
|
|
32
60
|
|
|
33
61
|
#### :hammer_and_wrench: Others
|
|
34
62
|
|
|
35
63
|
- Breaking 5.0.0 [Alin Voinea - [`9daf888`](https://github.com/eea/volto-slate-metadata-mentions/commit/9daf88800e0f375b9e7927540827c64c8f03c00e)]
|
|
64
|
+
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`c77d975`](https://github.com/eea/volto-slate-metadata-mentions/commit/c77d975b57d3982b360b8d0bc2d3aa4d64a41254)]
|
|
36
65
|
### [4.0.3](https://github.com/eea/volto-slate-metadata-mentions/compare/4.0.2...4.0.3) - 16 March 2022
|
|
37
66
|
|
|
38
67
|
#### :hammer_and_wrench: Others
|
|
39
68
|
|
|
69
|
+
- Add Sonarqube tag using eea-website-frontend addons list [EEA Jenkins - [`80d1b4e`](https://github.com/eea/volto-slate-metadata-mentions/commit/80d1b4eafce60c03c5fb3698ef2375ee903c05d6)]
|
|
40
70
|
### [4.0.2](https://github.com/eea/volto-slate-metadata-mentions/compare/4.0.1...4.0.2) - 3 January 2022
|
|
41
71
|
|
|
42
72
|
### [4.0.1](https://github.com/eea/volto-slate-metadata-mentions/compare/4.0.0...4.0.1) - 18 December 2021
|
|
43
73
|
|
|
44
74
|
#### :hammer_and_wrench: Others
|
|
45
75
|
|
|
76
|
+
- Add Sonarqube tag using freshwater-frontend addons list [EEA Jenkins - [`2de3bf6`](https://github.com/eea/volto-slate-metadata-mentions/commit/2de3bf624ff35504add94f5daf37484a8f459df7)]
|
|
46
77
|
- Refs #142010 - Optimize Volto-addons gitflow pipelines [valentinab25 - [`3a6a696`](https://github.com/eea/volto-slate-metadata-mentions/commit/3a6a69612652cd947d54f77c430bdca21b82a0df)]
|
|
78
|
+
- Add Sonarqube tag using industry-frontend addons list [EEA Jenkins - [`6e8fb49`](https://github.com/eea/volto-slate-metadata-mentions/commit/6e8fb492411d12c570ae75f00ee710818e5027f8)]
|
|
79
|
+
- Add Sonarqube tag using clms-frontend addons list [EEA Jenkins - [`fc8fcc3`](https://github.com/eea/volto-slate-metadata-mentions/commit/fc8fcc35bf20e4a1c3b3bbc099e67045e3feea15)]
|
|
80
|
+
- Add Sonarqube tag using forests-frontend addons list [EEA Jenkins - [`9e0c360`](https://github.com/eea/volto-slate-metadata-mentions/commit/9e0c360b5e842d30f4cc09efe3e3f8f7d3bd351c)]
|
|
81
|
+
- Add Sonarqube tag using sustainability-frontend addons list [EEA Jenkins - [`e7404b9`](https://github.com/eea/volto-slate-metadata-mentions/commit/e7404b9f21415e894c149e5c8275bf74d0540c2c)]
|
|
47
82
|
## [4.0.0](https://github.com/eea/volto-slate-metadata-mentions/compare/3.0.2...4.0.0) - 24 September 2021
|
|
48
83
|
|
|
49
84
|
#### :hammer_and_wrench: Others
|
|
50
85
|
|
|
51
86
|
- Allow also dict fields: temporal, geolocation [Alin Voinea - [`49be384`](https://github.com/eea/volto-slate-metadata-mentions/commit/49be3845a5fed9957139ebe88d24adc44b2521d5)]
|
|
87
|
+
- Add Sonarqube tag using climate-energy-frontend addons list [EEA Jenkins - [`53de974`](https://github.com/eea/volto-slate-metadata-mentions/commit/53de9745893b04f14f4688c81e52a857a5fbe7b9)]
|
|
52
88
|
### [3.0.2](https://github.com/eea/volto-slate-metadata-mentions/compare/3.0.1...3.0.2) - 10 September 2021
|
|
53
89
|
|
|
54
90
|
#### :hammer_and_wrench: Others
|
|
55
91
|
|
|
92
|
+
- Add Sonarqube tag using ims-frontend addons list [EEA Jenkins - [`cc67fec`](https://github.com/eea/volto-slate-metadata-mentions/commit/cc67fec41698b99c1382b8be4a9aec4d14806d15)]
|
|
56
93
|
### [3.0.1](https://github.com/eea/volto-slate-metadata-mentions/compare/3.0.0...3.0.1) - 9 September 2021
|
|
57
94
|
|
|
58
95
|
## [3.0.0](https://github.com/eea/volto-slate-metadata-mentions/compare/2.4.0...3.0.0) - 3 September 2021
|
|
@@ -62,6 +99,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
62
99
|
- Update package metadata [Alin Voinea - [`af8c5b3`](https://github.com/eea/volto-slate-metadata-mentions/commit/af8c5b3bf2ce6d9520b3d9378c648a37d8d519d3)]
|
|
63
100
|
- Add ErrorBoundary to Widgets [Alin Voinea - [`f9c7e0d`](https://github.com/eea/volto-slate-metadata-mentions/commit/f9c7e0de20c13305e9dfe09a968753f44e3224ce)]
|
|
64
101
|
- Make sure it doesn't crash if used with SlateJSONField [Alin Voinea - [`60dbd38`](https://github.com/eea/volto-slate-metadata-mentions/commit/60dbd389f217b7341eb0c369abd044424357ab05)]
|
|
102
|
+
- Add Sonarqube tag using frontend addons list [EEA Jenkins - [`7c7f219`](https://github.com/eea/volto-slate-metadata-mentions/commit/7c7f2196bafde9bbb3ecead19d65ff109080e1f1)]
|
|
65
103
|
### [2.4.0](https://github.com/eea/volto-slate-metadata-mentions/compare/2.3.1...2.4.0) - 1 July 2021
|
|
66
104
|
|
|
67
105
|
### [2.3.1](https://github.com/eea/volto-slate-metadata-mentions/compare/2.3.0...2.3.1) - 1 July 2021
|
|
@@ -181,6 +219,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
|
181
219
|
- Cleanup [Alin Voinea - [`4edb16c`](https://github.com/eea/volto-slate-metadata-mentions/commit/4edb16c39bd1632a285aae1dc4b23bc3121b30af)]
|
|
182
220
|
- Remove unused uid normalizer [Alin Voinea - [`6006d90`](https://github.com/eea/volto-slate-metadata-mentions/commit/6006d9070ca8418c508f002032eca087c851b489)]
|
|
183
221
|
- Cosmetics [Alin Voinea - [`15424a4`](https://github.com/eea/volto-slate-metadata-mentions/commit/15424a48b14117a19c00167966a8fa15bcff8504)]
|
|
222
|
+
- yarn lint [Alin Voinea - [`45403b3`](https://github.com/eea/volto-slate-metadata-mentions/commit/45403b3962c2c995e22c8c40535098948f6f8d2b)]
|
|
184
223
|
- lint [Alin Voinea - [`9eedfe6`](https://github.com/eea/volto-slate-metadata-mentions/commit/9eedfe614e9202a2fd3d97c5d8cf53a52a43a3a4)]
|
|
185
224
|
- Update widgets to use children; lint [Alin Voinea - [`17b5eec`](https://github.com/eea/volto-slate-metadata-mentions/commit/17b5eecc0ce445c123fd57abbc14e045f4920370)]
|
|
186
225
|
- Style token widget [Alin Voinea - [`4fa52f5`](https://github.com/eea/volto-slate-metadata-mentions/commit/4fa52f5cc7cfde140e482048792c6f1782b4ee4e)]
|
package/Jenkinsfile
CHANGED
|
@@ -4,7 +4,7 @@ pipeline {
|
|
|
4
4
|
environment {
|
|
5
5
|
GIT_NAME = "volto-slate-metadata-mentions"
|
|
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,demo-www.eea.europa.eu,clmsdemo.devel6cph.eea.europa.eu,
|
|
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,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"
|
|
8
8
|
DEPENDENCIES = ""
|
|
9
9
|
VOLTO = ""
|
|
10
10
|
}
|
|
@@ -188,6 +188,7 @@ pipeline {
|
|
|
188
188
|
def nodeJS = tool 'NodeJS';
|
|
189
189
|
withSonarQubeEnv('Sonarqube') {
|
|
190
190
|
sh '''sed -i "s#/opt/frontend/my-volto-project/src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
|
|
191
|
+
sh '''sed -i "s#src/addons/${GIT_NAME}/##g" xunit-reports/coverage/lcov.info'''
|
|
191
192
|
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"
|
|
192
193
|
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'''
|
|
193
194
|
}
|
package/jest-addon.config.js
CHANGED
|
@@ -5,19 +5,19 @@ module.exports = {
|
|
|
5
5
|
'!src/**/*.d.ts',
|
|
6
6
|
],
|
|
7
7
|
moduleNameMapper: {
|
|
8
|
+
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
|
8
9
|
'@plone/volto/cypress': '<rootDir>/node_modules/@plone/volto/cypress',
|
|
9
10
|
'@plone/volto/babel': '<rootDir>/node_modules/@plone/volto/babel',
|
|
10
11
|
'@plone/volto/(.*)$': '<rootDir>/node_modules/@plone/volto/src/$1',
|
|
11
12
|
'@package/(.*)$': '<rootDir>/src/$1',
|
|
12
13
|
'@root/(.*)$': '<rootDir>/src/$1',
|
|
13
14
|
'@plone/volto-quanta/(.*)$': '<rootDir>/src/addons/volto-quanta/src/$1',
|
|
14
|
-
'@eeacms/(.*?)/(.*)$': '<rootDir>/
|
|
15
|
+
'@eeacms/(.*?)/(.*)$': '<rootDir>/node_modules/@eeacms/$1/src/$2',
|
|
15
16
|
'@plone/volto-slate':
|
|
16
17
|
'<rootDir>/node_modules/@plone/volto/packages/volto-slate/src',
|
|
17
18
|
'~/(.*)$': '<rootDir>/src/$1',
|
|
18
19
|
'load-volto-addons':
|
|
19
20
|
'<rootDir>/node_modules/@plone/volto/jest-addons-loader.js',
|
|
20
|
-
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
|
|
21
21
|
},
|
|
22
22
|
transform: {
|
|
23
23
|
'^.+\\.js(x)?$': 'babel-jest',
|
package/package.json
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// import { useFormStateContext } from '@plone/volto/components/manage/Form/FormContext';
|
|
2
1
|
import { Icon as VoltoIcon, InlineForm } from '@plone/volto/components';
|
|
3
2
|
import briefcaseSVG from '@plone/volto/icons/briefcase.svg';
|
|
4
3
|
import checkSVG from '@plone/volto/icons/check.svg';
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Editor, Range } from 'slate';
|
|
2
|
+
import { getMentionWidget, isCursorInMention } from './utils';
|
|
3
|
+
|
|
4
|
+
jest.mock('slate', () => ({
|
|
5
|
+
Editor: {
|
|
6
|
+
above: jest.fn(),
|
|
7
|
+
},
|
|
8
|
+
Range: {
|
|
9
|
+
isCollapsed: jest.fn(),
|
|
10
|
+
},
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
describe('getMentionWidget', () => {
|
|
14
|
+
it('returns correct widget for each type', () => {
|
|
15
|
+
expect(getMentionWidget('subjects')).toEqual('tags');
|
|
16
|
+
expect(getMentionWidget('testId', { factory: 'Choice' })).toEqual(
|
|
17
|
+
'choices',
|
|
18
|
+
);
|
|
19
|
+
expect(getMentionWidget('testId', { factory: 'Relation Choice' })).toEqual(
|
|
20
|
+
'relation',
|
|
21
|
+
);
|
|
22
|
+
expect(getMentionWidget('testId', { factory: 'Relation List' })).toEqual(
|
|
23
|
+
'relations',
|
|
24
|
+
);
|
|
25
|
+
expect(getMentionWidget('testId', { factory: 'Image' })).toEqual('image');
|
|
26
|
+
expect(getMentionWidget('testId', { factory: 'File' })).toEqual('file');
|
|
27
|
+
expect(
|
|
28
|
+
getMentionWidget('testId', { widget: 'Widget1', type: 'Type1' }),
|
|
29
|
+
).toEqual('Widget1');
|
|
30
|
+
expect(getMentionWidget('testId', { type: 'Type1' })).toEqual('Type1');
|
|
31
|
+
expect(getMentionWidget('testId')).toEqual('testId');
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe('isCursorInMention', () => {
|
|
36
|
+
const editor = {};
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
jest.resetAllMocks();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('returns false if no mention', () => {
|
|
42
|
+
Editor.above.mockReturnValueOnce(undefined);
|
|
43
|
+
expect(isCursorInMention(editor)).toEqual(false);
|
|
44
|
+
expect(Editor.above).toHaveBeenCalledWith(editor, {
|
|
45
|
+
match: expect.any(Function),
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('returns false if selection not collapsed', () => {
|
|
50
|
+
Editor.above.mockReturnValueOnce([{}]);
|
|
51
|
+
Range.isCollapsed.mockReturnValueOnce(false);
|
|
52
|
+
expect(isCursorInMention(editor)).toEqual(false);
|
|
53
|
+
expect(Editor.above).toHaveBeenCalledWith(editor, {
|
|
54
|
+
match: expect.any(Function),
|
|
55
|
+
});
|
|
56
|
+
expect(Range.isCollapsed).toHaveBeenCalledWith(editor.selection);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('returns true if selection collapsed inside a mention', () => {
|
|
60
|
+
Editor.above.mockReturnValueOnce([{}]);
|
|
61
|
+
Range.isCollapsed.mockReturnValueOnce(true);
|
|
62
|
+
expect(isCursorInMention(editor)).toEqual({});
|
|
63
|
+
expect(Editor.above).toHaveBeenCalledWith(editor, {
|
|
64
|
+
match: expect.any(Function),
|
|
65
|
+
});
|
|
66
|
+
expect(Range.isCollapsed).toHaveBeenCalledWith(editor.selection);
|
|
67
|
+
});
|
|
68
|
+
});
|