Skip to content

Commit a7ccfee

Browse files
committed
Merge branch 'development' of github.com:UNICEFECAR/USupport-cms into staging
2 parents 477fa46 + 875f830 commit a7ccfee

11 files changed

Lines changed: 299 additions & 69 deletions

File tree

config/ckeditor.js

Lines changed: 60 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,67 @@
11
/* eslint-disable */
22
const CKEConfig = () => ({
33
presets: {
4-
markdown: {
4+
default: {
55
field: {
6-
key: "markdown",
7-
value: "markdown",
6+
key: "default",
7+
value: "default",
88
metadatas: {
99
intlLabel: {
10-
id: "ckeditor.preset.markdown.label",
11-
defaultMessage: "Markdown output",
10+
id: "ckeditor.preset.default.label",
11+
defaultMessage: "Default (HTML)",
1212
},
1313
},
1414
},
15+
1516
editorConfig: {
16-
placeholder: "Markdown editor",
17+
placeholder: "Default editor (HTML output)",
18+
1719
plugins: [
1820
globalThis.SH_CKE.Essentials,
1921
globalThis.SH_CKE.Autoformat,
20-
globalThis.SH_CKE.BlockQuote,
21-
globalThis.SH_CKE.Bold,
22+
globalThis.SH_CKE.Paragraph,
2223
globalThis.SH_CKE.Heading,
24+
globalThis.SH_CKE.Alignment,
25+
26+
globalThis.SH_CKE.Bold,
27+
globalThis.SH_CKE.Italic,
28+
globalThis.SH_CKE.Strikethrough,
29+
globalThis.SH_CKE.Link,
30+
31+
globalThis.SH_CKE.List,
32+
globalThis.SH_CKE.Indent,
33+
globalThis.SH_CKE.BlockQuote,
34+
globalThis.SH_CKE.HorizontalLine,
35+
2336
globalThis.SH_CKE.Image,
2437
globalThis.SH_CKE.ImageCaption,
2538
globalThis.SH_CKE.ImageStyle,
2639
globalThis.SH_CKE.ImageToolbar,
2740
globalThis.SH_CKE.ImageUpload,
28-
globalThis.SH_CKE.Indent,
29-
globalThis.SH_CKE.Italic,
30-
globalThis.SH_CKE.Link,
31-
globalThis.SH_CKE.List,
41+
3242
globalThis.SH_CKE.MediaEmbed,
33-
globalThis.SH_CKE.Paragraph,
43+
3444
globalThis.SH_CKE.Table,
35-
globalThis.SH_CKE.TableCaption,
45+
globalThis.SH_CKE.TableToolbar,
46+
globalThis.SH_CKE.TableProperties,
3647
globalThis.SH_CKE.TableCellProperties,
3748
globalThis.SH_CKE.TableColumnResize,
38-
globalThis.SH_CKE.TableProperties,
39-
globalThis.SH_CKE.TableToolbar,
40-
globalThis.SH_CKE.SourceEditing,
41-
globalThis.SH_CKE.StrapiMediaLib,
42-
globalThis.SH_CKE.StrapiUploadAdapter,
43-
globalThis.SH_CKE.Markdown,
44-
globalThis.SH_CKE.Strikethrough,
45-
globalThis.SH_CKE.HorizontalLine,
49+
globalThis.SH_CKE.TableCaption,
50+
4651
globalThis.SH_CKE.FontFamily,
4752
globalThis.SH_CKE.FontSize,
4853
globalThis.SH_CKE.FontColor,
4954
globalThis.SH_CKE.FontBackgroundColor,
55+
56+
globalThis.SH_CKE.SourceEditing,
57+
58+
globalThis.SH_CKE.StrapiMediaLib,
59+
globalThis.SH_CKE.StrapiUploadAdapter,
60+
61+
// 🔑 REQUIRED FOR HTML OUTPUT
62+
globalThis.SH_CKE.GeneralHtmlSupport,
5063
],
64+
5165
toolbar: {
5266
items: [
5367
"heading",
@@ -61,12 +75,12 @@ const CKEConfig = () => ({
6175
"strikethrough",
6276
"link",
6377
"|",
78+
"alignment",
79+
"|",
6480
"bulletedList",
6581
"numberedList",
6682
"|",
6783
"insertTable",
68-
"setTableRowHeader",
69-
"setTableColumnHeader",
7084
"|",
7185
"uploadImage",
7286
"strapiMediaLib",
@@ -83,6 +97,24 @@ const CKEConfig = () => ({
8397
],
8498
shouldNotGroupWhenFull: true,
8599
},
100+
101+
/**
102+
* 🔑 HTML OUTPUT CONFIG
103+
*/
104+
htmlSupport: {
105+
allow: [
106+
{
107+
name: /.*/,
108+
attributes: true,
109+
classes: true,
110+
styles: true,
111+
},
112+
],
113+
},
114+
115+
/**
116+
* Table config
117+
*/
86118
table: {
87119
contentToolbar: [
88120
"tableColumn",
@@ -93,6 +125,10 @@ const CKEConfig = () => ({
93125
"toggleTableCaption",
94126
],
95127
},
128+
129+
/**
130+
* Image config
131+
*/
96132
image: {
97133
toolbar: [
98134
"imageStyle:inline",

src/api/about-us-page/content-types/about-us-page/schema.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@
5353
},
5454
"type": "boolean",
5555
"default": false
56+
},
57+
"content_ck": {
58+
"pluginOptions": {
59+
"i18n": {
60+
"localized": true
61+
}
62+
},
63+
"type": "customField",
64+
"options": {
65+
"preset": "default"
66+
},
67+
"customField": "plugin::ckeditor5.CKEditor"
5668
}
5769
}
5870
}

src/api/article/content-types/article/schema.json

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020
"type": "media",
2121
"multiple": false,
2222
"required": false,
23-
"allowedTypes": [
24-
"images"
25-
],
23+
"allowedTypes": ["images"],
2624
"pluginOptions": {
2725
"i18n": {
2826
"localized": true
@@ -152,12 +150,7 @@
152150
"type": "media",
153151
"multiple": false,
154152
"required": false,
155-
"allowedTypes": [
156-
"images",
157-
"files",
158-
"videos",
159-
"audios"
160-
],
153+
"allowedTypes": ["images", "files", "videos", "audios"],
161154
"pluginOptions": {
162155
"i18n": {
163156
"localized": true
@@ -171,6 +164,18 @@
171164
}
172165
},
173166
"type": "integer"
167+
},
168+
"body_ck": {
169+
"pluginOptions": {
170+
"i18n": {
171+
"localized": true
172+
}
173+
},
174+
"type": "customField",
175+
"options": {
176+
"preset": "default"
177+
},
178+
"customField": "plugin::ckeditor5.CKEditor"
174179
}
175180
}
176181
}

src/api/assessment-result/content-types/assessment-result/schema.json

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@
3232
}
3333
},
3434
"type": "enumeration",
35-
"enum": [
36-
"low",
37-
"moderate",
38-
"high"
39-
],
35+
"enum": ["low", "moderate", "high"],
4036
"required": true
4137
},
4238
"social": {
@@ -46,11 +42,7 @@
4642
}
4743
},
4844
"type": "enumeration",
49-
"enum": [
50-
"low",
51-
"moderate",
52-
"high"
53-
],
45+
"enum": ["low", "moderate", "high"],
5446
"required": true
5547
},
5648
"biological": {
@@ -60,11 +52,7 @@
6052
}
6153
},
6254
"type": "enumeration",
63-
"enum": [
64-
"low",
65-
"moderate",
66-
"high"
67-
],
55+
"enum": ["low", "moderate", "high"],
6856
"required": true
6957
},
7058
"articles": {
@@ -90,7 +78,7 @@
9078
},
9179
"type": "customField",
9280
"options": {
93-
"preset": "markdown"
81+
"preset": "default"
9482
},
9583
"customField": "plugin::ckeditor5.CKEditor"
9684
}

src/api/cookie-policy/content-types/cookie-policy/schema.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,42 @@
7171
},
7272
"type": "boolean",
7373
"default": false
74+
},
75+
"website_ck": {
76+
"pluginOptions": {
77+
"i18n": {
78+
"localized": true
79+
}
80+
},
81+
"type": "customField",
82+
"options": {
83+
"preset": "default"
84+
},
85+
"customField": "plugin::ckeditor5.CKEditor"
86+
},
87+
"client_ck": {
88+
"pluginOptions": {
89+
"i18n": {
90+
"localized": true
91+
}
92+
},
93+
"type": "customField",
94+
"options": {
95+
"preset": "default"
96+
},
97+
"customField": "plugin::ckeditor5.CKEditor"
98+
},
99+
"provider_ck": {
100+
"pluginOptions": {
101+
"i18n": {
102+
"localized": true
103+
}
104+
},
105+
"type": "customField",
106+
"options": {
107+
"preset": "default"
108+
},
109+
"customField": "plugin::ckeditor5.CKEditor"
74110
}
75111
}
76112
}

src/api/cookie-policy/controllers/cookie-policy.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ module.exports = createCoreController(
2222
.findMany({ where: { locale: query.locale } });
2323

2424
let result = null;
25-
console.log(query);
25+
const platformKey = query.platform;
26+
const platformKeyCK = `${platformKey}_ck`;
27+
2628
if (query.country === "global") {
2729
// Look for cookie policy with global flag set to true
2830
for (let i = 0; i < cookiePolicy.length; i++) {
2931
const currentData = cookiePolicy[i];
3032
if (currentData.global === true) {
31-
result = currentData[query.platform];
33+
result = currentData[platformKeyCK] || currentData[platformKey];
3234
break;
3335
}
3436
}
@@ -37,7 +39,7 @@ module.exports = createCoreController(
3739
for (let i = 0; i < cookiePolicy.length; i++) {
3840
const currentData = cookiePolicy[i];
3941
if (currentData.is_playandheal === true) {
40-
result = currentData[query.platform];
42+
result = currentData[platformKeyCK] || currentData[platformKey];
4143
break;
4244
}
4345
}
@@ -46,7 +48,7 @@ module.exports = createCoreController(
4648
for (let i = 0; i < cookiePolicy.length; i++) {
4749
const currentData = cookiePolicy[i];
4850
if (currentData.country === query.country) {
49-
result = currentData[query.platform];
51+
result = currentData[platformKeyCK] || currentData[platformKey];
5052
break;
5153
}
5254
}

src/api/privacy-policy/content-types/privacy-policy/schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
},
8383
"type": "customField",
8484
"options": {
85-
"preset": "markdown"
85+
"preset": "default"
8686
},
8787
"customField": "plugin::ckeditor5.CKEditor"
8888
},
@@ -94,7 +94,7 @@
9494
},
9595
"type": "customField",
9696
"options": {
97-
"preset": "markdown"
97+
"preset": "default"
9898
},
9999
"customField": "plugin::ckeditor5.CKEditor"
100100
},
@@ -106,7 +106,7 @@
106106
},
107107
"type": "customField",
108108
"options": {
109-
"preset": "markdown"
109+
"preset": "default"
110110
},
111111
"customField": "plugin::ckeditor5.CKEditor"
112112
}

src/api/privacy-policy/controllers/privacy-policy.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,15 @@ module.exports = createCoreController(
2222
.findMany({ where: { locale: query.locale } });
2323

2424
let result = null;
25+
const platformKey = query.platform;
26+
const platformKeyCK = `${platformKey}_ck`;
27+
2528
for (let i = 0; i < privacyPolicies.length; i++) {
2629
const currentData = privacyPolicies[i];
2730
if (currentData.country === query.country) {
28-
result = currentData[query.platform];
29-
} else if (
30-
currentData.is_playandheal &&
31-
query.filters?.is_playandheal
32-
) {
33-
result = currentData[query.platform];
31+
result = currentData[platformKeyCK] || currentData[platformKey];
3432
} else if (currentData.global && query.filters?.global) {
35-
result = currentData[query.platform];
33+
result = currentData[platformKeyCK] || currentData[platformKey];
3634
}
3735
}
3836

0 commit comments

Comments
 (0)