design-comuni-plone-theme 11.26.0 → 11.26.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/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +24 -0
- package/RELEASE.md +6 -0
- package/package.json +1 -1
- package/publiccode.yml +2 -2
- package/src/helpers/files.js +10 -3
- package/src/helpers/files.test.js +90 -0
- package/src/theme/ItaliaTheme/Print/_blocks.scss +12 -0
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## [11.26.2](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v11.26.1...v11.26.2) (2024-12-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* theme build bug due to print styles desync ([2aacb6a](https://github.com/RedTurtle/design-comuni-plone-theme/commit/2aacb6a78d6d4c93ef24a4d3b89ff6b587baa698))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Documentation
|
|
12
|
+
|
|
13
|
+
* updated publiccode ([ba2e5c8](https://github.com/RedTurtle/design-comuni-plone-theme/commit/ba2e5c85bfbc0de260a0d0dc8839b2286500656d))
|
|
14
|
+
|
|
15
|
+
## [11.26.1](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v11.26.0...v11.26.1) (2024-12-27)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* getFileViewFormat regex inconsistencies with different filenames that included @@download/**, added anti-regression tests ([#847](https://github.com/RedTurtle/design-comuni-plone-theme/issues/847)) ([ea9f76d](https://github.com/RedTurtle/design-comuni-plone-theme/commit/ea9f76df28c82155c4a0dc965b1cdeba4d5fab55))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Documentation
|
|
24
|
+
|
|
25
|
+
* updated publiccode and release log ([575ad56](https://github.com/RedTurtle/design-comuni-plone-theme/commit/575ad563ff8781d5dd0483c70f1664ba6a46134a))
|
|
26
|
+
|
|
3
27
|
## [11.26.0](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v11.25.4...v11.26.0) (2024-12-20)
|
|
4
28
|
|
|
5
29
|
|
package/RELEASE.md
CHANGED
|
@@ -41,6 +41,12 @@
|
|
|
41
41
|
- ...
|
|
42
42
|
-->
|
|
43
43
|
|
|
44
|
+
## Versione 11.26.1 (27/12/2024)
|
|
45
|
+
|
|
46
|
+
### Fix
|
|
47
|
+
|
|
48
|
+
- Risolto un problema riguardante la visualizzazione delle estensioni dei file quando si utilizza un link ad un documento nei blocchi di testo.
|
|
49
|
+
|
|
44
50
|
## Versione 11.26.0 (20/12/2024)
|
|
45
51
|
|
|
46
52
|
### Migliorie
|
package/package.json
CHANGED
package/publiccode.yml
CHANGED
|
@@ -227,9 +227,9 @@ maintenance:
|
|
|
227
227
|
name: io-Comune - Il sito AgID per Comuni ed Enti Pubblici
|
|
228
228
|
platforms:
|
|
229
229
|
- web
|
|
230
|
-
releaseDate: '2024-12-
|
|
230
|
+
releaseDate: '2024-12-27'
|
|
231
231
|
softwareType: standalone/web
|
|
232
|
-
softwareVersion: 11.26.
|
|
232
|
+
softwareVersion: 11.26.2
|
|
233
233
|
url: 'https://github.com/italia/design-comuni-plone-theme'
|
|
234
234
|
usedBy:
|
|
235
235
|
- ASP Comuni Modenesi Area Nord
|
package/src/helpers/files.js
CHANGED
|
@@ -119,12 +119,19 @@ export const FILE_EXTENSIONS = {
|
|
|
119
119
|
icon: { lib: '', name: faFileOdp, svg_format: true },
|
|
120
120
|
format_name: 'ODP',
|
|
121
121
|
},
|
|
122
|
+
pdf: {
|
|
123
|
+
icon: { lib: 'far', name: 'file-pdf' },
|
|
124
|
+
format_name: 'PDF',
|
|
125
|
+
},
|
|
122
126
|
};
|
|
123
127
|
|
|
124
128
|
export const getFileViewFormat = (file) => {
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
|
|
129
|
+
const cleanedFilename = (file.filename || '').split(/\/[@?#]/)[0];
|
|
130
|
+
const regexEx = /\.([a-zA-Z0-9]+)$/;
|
|
131
|
+
|
|
132
|
+
const match = regexEx.exec(cleanedFilename);
|
|
133
|
+
const fileExtension = match ? match[1] : null;
|
|
134
|
+
const typeOfContent = file['content-type'] ?? file['mime_type'];
|
|
128
135
|
|
|
129
136
|
const viewFormat = {
|
|
130
137
|
icon: null,
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { getFileViewFormat, FILE_EXTENSIONS, FILE_FORMATS } from './files';
|
|
2
|
+
|
|
3
|
+
describe('getFileViewFormat', () => {
|
|
4
|
+
test('should correctly extract the extension and match the icon for a valid PDF URL with multiple segments after the extension', () => {
|
|
5
|
+
const file = {
|
|
6
|
+
filename:
|
|
7
|
+
'https://example.com/amministrazione/documenti-e-dati/modulistica/area-servizi-educativi-e-scolastici/intestazione-ripartizione-rette/modulo_intestazione_ripartizione_rette_nona_784_9690.pdf/@@download/file_principale',
|
|
8
|
+
'content-type': 'application/pdf',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const result = getFileViewFormat(file);
|
|
12
|
+
|
|
13
|
+
expect(result.icon).toEqual(FILE_EXTENSIONS.pdf.icon); // Verifica che l'icona sia corretta
|
|
14
|
+
expect(result.label).toEqual(FILE_EXTENSIONS.pdf.format_name); // Verifica che il formato sia corretto
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('should correctly handle a PDF URL without multiple segments after the extension', () => {
|
|
18
|
+
const file = {
|
|
19
|
+
filename:
|
|
20
|
+
'https://example.com/amministrazione/documenti-e-dati/modulistica/area-servizi-educativi-e-scolastici/intestazione-ripartizione-rette/modulo_intestazione_ripartizione_rette_nona_784_9690.pdf/@@download/filehttps://example.com/amministrazione/documenti-e-dati/modulistica/area-servizi-educativi-e-scolastici/intestazione-ripartizione-rette/modulo_intestazione_ripartizione_rette_nona_784_9690.pdf',
|
|
21
|
+
'content-type': 'application/pdf',
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const result = getFileViewFormat(file);
|
|
25
|
+
|
|
26
|
+
expect(result.icon).toEqual(FILE_EXTENSIONS.pdf.icon);
|
|
27
|
+
expect(result.label).toEqual(FILE_EXTENSIONS.pdf.format_name);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('should return correct format for a non-PDF file extension', () => {
|
|
31
|
+
const file = {
|
|
32
|
+
filename: 'https://example.com/file/example.xsd',
|
|
33
|
+
'content-type': 'application/xml',
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const result = getFileViewFormat(file);
|
|
37
|
+
|
|
38
|
+
expect(result.icon).toEqual(FILE_EXTENSIONS.xsd.icon);
|
|
39
|
+
expect(result.label).toEqual(FILE_EXTENSIONS.xsd.format_name);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('should return correct format for a non-PDF content-type', () => {
|
|
43
|
+
const file = {
|
|
44
|
+
filename: 'https://example.com/file/example.xml',
|
|
45
|
+
'content-type': 'application/xml',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const result = getFileViewFormat(file);
|
|
49
|
+
|
|
50
|
+
expect(result.icon).toEqual(FILE_FORMATS['application/xml'].icon);
|
|
51
|
+
expect(result.label).toEqual(FILE_FORMATS['application/xml'].format_name);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test('should return null format when extension or content-type is not found', () => {
|
|
55
|
+
const file = {
|
|
56
|
+
filename: 'https://example.com/file/unknown.xyz',
|
|
57
|
+
'content-type': 'application/unknown',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const result = getFileViewFormat(file);
|
|
61
|
+
|
|
62
|
+
expect(result.icon).toBeNull();
|
|
63
|
+
expect(result.label).toBeNull();
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
test('should handle file URLs without an extension', () => {
|
|
67
|
+
const file = {
|
|
68
|
+
filename: 'https://example.com/file/no-extension/',
|
|
69
|
+
'content-type': 'text/plain',
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const result = getFileViewFormat(file);
|
|
73
|
+
|
|
74
|
+
expect(result.icon).toEqual(FILE_FORMATS['text/plain'].icon);
|
|
75
|
+
expect(result.label).toEqual(FILE_FORMATS['text/plain'].format_name);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('should handle case where URL is .pdf but content-type is text/plain', () => {
|
|
79
|
+
const file = {
|
|
80
|
+
filename: 'https://example.com/file/example.pdf',
|
|
81
|
+
'content-type': 'text/plain',
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const result = getFileViewFormat(file);
|
|
85
|
+
|
|
86
|
+
// La funzione dovrebbe comunque dare priorità all'estensione ".pdf" rispetto al content-type "text/plain"
|
|
87
|
+
expect(result.icon).toEqual(FILE_EXTENSIONS.pdf.icon); // Verifica che l'icona PDF venga restituita
|
|
88
|
+
expect(result.label).toEqual(FILE_EXTENSIONS.pdf.format_name); // Verifica che il formato PDF venga restituito
|
|
89
|
+
});
|
|
90
|
+
});
|
|
@@ -187,6 +187,16 @@
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
.block.image-text-block {
|
|
191
|
+
.image-text-card-wrapper {
|
|
192
|
+
page-break-inside: avoid;
|
|
193
|
+
|
|
194
|
+
h2 {
|
|
195
|
+
page-break-after: avoid;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
190
200
|
.block.accordion {
|
|
191
201
|
.public-ui {
|
|
192
202
|
width: 100%;
|
|
@@ -219,6 +229,7 @@
|
|
|
219
229
|
}
|
|
220
230
|
}
|
|
221
231
|
}
|
|
232
|
+
}
|
|
222
233
|
|
|
223
234
|
.block.numbersBlock {
|
|
224
235
|
color: #000;
|
|
@@ -344,6 +355,7 @@
|
|
|
344
355
|
}
|
|
345
356
|
}
|
|
346
357
|
|
|
358
|
+
// listing variations
|
|
347
359
|
div.block.listing {
|
|
348
360
|
page-break-inside: avoid;
|
|
349
361
|
|