mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
[AAE-30886] - Upgrade to latest editorjs (#10672)
* [ci:force] * [AAE-30886] - Upgrade to latest editorjs * [ci:force] - checking if build is ok * [AAE-32127] - fixed custom parser and sanitizer funciton * [AAE-32127] - fixed custom parser and sanitizer funciton * [ci:force]
This commit is contained in:
parent
32341f0b86
commit
b1ff467b9a
.husky
lib/process-services-cloud/src/lib/form/components/widgets/display-rich-text
package-lock.jsonpackage.json@ -1,5 +1,4 @@
|
||||
#!/bin/sh
|
||||
. "$(dirname "$0")/_/husky.sh"
|
||||
|
||||
export NODE_OPTIONS=--max_old_space_size=8192
|
||||
npx lint-staged
|
||||
|
@ -44,21 +44,21 @@ export class DisplayRichTextWidgetComponent extends WidgetComponent implements O
|
||||
parsedHTML: any;
|
||||
|
||||
private static readonly CUSTOM_PARSER = {
|
||||
header: ({ data, tunes }): string => {
|
||||
const paragraphAlign = data.alignment || data.align || tunes?.anyTuneName?.alignment;
|
||||
header: (block: any): string => {
|
||||
const paragraphAlign = block.data.alignment || block.data.align || block.tunes?.anyTuneName?.alignment;
|
||||
if (typeof paragraphAlign !== 'undefined' && ['left', 'right', 'center'].includes(paragraphAlign)) {
|
||||
return `<h${data.level} class="ce-tune-alignment--${paragraphAlign}">${data.text}</h${data.level}>`;
|
||||
return `<h${block.data.level} class="ce-tune-alignment--${paragraphAlign}">${block.data.text}</h${block.data.level}>`;
|
||||
} else {
|
||||
return `<h${data.level}>${data.text}</h${data.level}>`;
|
||||
return `<h${block.data.level}>${block.data.text}</h${block.data.level}>`;
|
||||
}
|
||||
},
|
||||
paragraph: ({ data, tunes }): string => {
|
||||
const paragraphAlign = data.alignment || data.align || tunes?.anyTuneName?.alignment;
|
||||
paragraph: (block: any): string => {
|
||||
const paragraphAlign = block.data.alignment || block.data.align || block.tunes?.anyTuneName?.alignment;
|
||||
|
||||
if (typeof paragraphAlign !== 'undefined' && ['left', 'right', 'center', 'justify'].includes(paragraphAlign)) {
|
||||
return `<p class="ce-tune-alignment--${paragraphAlign}">${data.text}</p>`;
|
||||
return `<p class="ce-tune-alignment--${paragraphAlign}">${block.data.text}</p>`;
|
||||
} else {
|
||||
return `<p>${data.text}</p>`;
|
||||
return `<p>${block.data.text}</p>`;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -68,7 +68,7 @@ export class DisplayRichTextWidgetComponent extends WidgetComponent implements O
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.parsedHTML = edjsHTML(DisplayRichTextWidgetComponent.CUSTOM_PARSER).parseStrict(this.field.value);
|
||||
this.parsedHTML = edjsHTML(DisplayRichTextWidgetComponent.CUSTOM_PARSER, { strict: true }).parse(this.field.value);
|
||||
|
||||
if (!(this.parsedHTML instanceof Error)) {
|
||||
this.sanitizeHtmlContent();
|
||||
@ -78,6 +78,6 @@ export class DisplayRichTextWidgetComponent extends WidgetComponent implements O
|
||||
}
|
||||
|
||||
private sanitizeHtmlContent(): void {
|
||||
this.parsedHTML = this.sanitizer.sanitize(SecurityContext.HTML, this.parsedHTML.join(''));
|
||||
this.parsedHTML = this.sanitizer.sanitize(SecurityContext.HTML, this.parsedHTML);
|
||||
}
|
||||
}
|
||||
|
105
package-lock.json
generated
105
package-lock.json
generated
@ -59,14 +59,14 @@
|
||||
"@angular/cli": "~17.1.0",
|
||||
"@angular/compiler-cli": "17.1.3",
|
||||
"@chromatic-com/storybook": "1.7.0",
|
||||
"@editorjs/code": "2.9.0",
|
||||
"@editorjs/editorjs": "2.30.5",
|
||||
"@editorjs/header": "2.8.1",
|
||||
"@editorjs/inline-code": "1.5.0",
|
||||
"@editorjs/list": "1.10.0",
|
||||
"@editorjs/code": "2.9.3",
|
||||
"@editorjs/editorjs": "2.30.8",
|
||||
"@editorjs/header": "2.8.8",
|
||||
"@editorjs/inline-code": "1.5.1",
|
||||
"@editorjs/list": "2.0.4",
|
||||
"@editorjs/marker": "1.4.0",
|
||||
"@editorjs/paragraph": "^2.11.6",
|
||||
"@editorjs/underline": "1.1.0",
|
||||
"@editorjs/paragraph": "2.11.7",
|
||||
"@editorjs/underline": "1.2.1",
|
||||
"@nx/angular": "17.3.1",
|
||||
"@nx/eslint-plugin": "17.3.1",
|
||||
"@nx/js": "17.3.1",
|
||||
@ -103,10 +103,10 @@
|
||||
"commander": "12.0.0",
|
||||
"css-loader": "^7.1.2",
|
||||
"dotenv": "16.4.7",
|
||||
"editorjs-html": "3.4.3",
|
||||
"editorjs-html": "4.0.5",
|
||||
"editorjs-paragraph-with-alignment": "3.0.0",
|
||||
"editorjs-text-alignment-blocktune": "^1.0.3",
|
||||
"editorjs-text-color-plugin": "1.13.1",
|
||||
"editorjs-text-alignment-blocktune": "1.0.3",
|
||||
"editorjs-text-color-plugin": "2.0.4",
|
||||
"ejs": "^3.1.10",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
@ -4115,56 +4115,71 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@editorjs/code": {
|
||||
"version": "2.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/code/-/code-2.9.0.tgz",
|
||||
"integrity": "sha512-QNOWxF29j6mYl/gM5HJzeGOt3s4laoZCUbuRqj6RkIvLBWMU+ASwjckEiouA61hcYUOMfpw4vQjzhsfC7xm/vA==",
|
||||
"version": "2.9.3",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/code/-/code-2.9.3.tgz",
|
||||
"integrity": "sha512-nXUrK3CjhpubvShYtcbkpZ9SU15IYwmJOsWZrlWYSzy9unZBRQthii6eABndsCtODzzV0yiSKmTp00RQkFow3Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codexteam/icons": "^0.0.5"
|
||||
"@codexteam/icons": "^0.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@editorjs/code/node_modules/@codexteam/icons": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@codexteam/icons/-/icons-0.3.3.tgz",
|
||||
"integrity": "sha512-cp7mkZPgmBuSxigTm3Vb+DtVHYeX7qXfQd7o05vcLD8Ag5WvRlol2QSn5P10k0CDAJwmkH9nQGQLBycErS9lsQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@editorjs/editorjs": {
|
||||
"version": "2.30.5",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/editorjs/-/editorjs-2.30.5.tgz",
|
||||
"integrity": "sha512-sE7m/UPbuf+nSGjv9cmWggFsfvtYlgEX7PCby2lZWvOsOLbRxuLT+ZYlwbWshD+8BFJwiAmBj9e+ScZcOjCzeg==",
|
||||
"version": "2.30.8",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/editorjs/-/editorjs-2.30.8.tgz",
|
||||
"integrity": "sha512-ClFuxI1qZTfXPJTacQfsJtOUP6bKoIe6BQNdAvGsDTDVwMnZEzoaSOwvUpdZEE56xppVfQueNK/1MElV9SJKHg==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/@editorjs/header": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/header/-/header-2.8.1.tgz",
|
||||
"integrity": "sha512-y0HVXRP7m2W617CWo3fsb5HhXmSLaRpb9GzFx0Vkp/HEm9Dz5YO1s8tC7R8JD3MskwoYh7V0hRFQt39io/r6hA==",
|
||||
"version": "2.8.8",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/header/-/header-2.8.8.tgz",
|
||||
"integrity": "sha512-bsMSs34u2hoi0UBuRoc5EGWXIFzJiwYgkFUYQGVm63y5FU+s8zPBmVx5Ip2sw1xgs0fqfDROqmteMvvmbCy62w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codexteam/icons": "^0.0.5"
|
||||
"@codexteam/icons": "^0.0.5",
|
||||
"@editorjs/editorjs": "^2.29.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@editorjs/inline-code": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/inline-code/-/inline-code-1.5.0.tgz",
|
||||
"integrity": "sha512-5i6BCOG8eOg4/6qGoLJuL6XSZZg834zIByDW8K80doM1L7ss/VqtLY0nrB2Q5bfs1KA0tOlVHOfjE4JD4438FQ==",
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/inline-code/-/inline-code-1.5.1.tgz",
|
||||
"integrity": "sha512-XvKpqw9y1bOYgyuVUHGDuu7KlNWCYIXD5uU1Lpc4s4LJ8VN4TjWFGKJ3sS+LR7zzasWe8hu2ffR1JC6MHIS0EQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codexteam/icons": "^0.0.5"
|
||||
"@codexteam/icons": "^0.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@editorjs/inline-code/node_modules/@codexteam/icons": {
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@codexteam/icons/-/icons-0.3.3.tgz",
|
||||
"integrity": "sha512-cp7mkZPgmBuSxigTm3Vb+DtVHYeX7qXfQd7o05vcLD8Ag5WvRlol2QSn5P10k0CDAJwmkH9nQGQLBycErS9lsQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@editorjs/list": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/list/-/list-1.10.0.tgz",
|
||||
"integrity": "sha512-zXCHaNcIscpefnteBOS3x+98f/qBgEVsv+OvtKoTDZipMNqck2uVG+X2qMQr8xcwtJrj9ySX54lUac9FDlAHnA==",
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/list/-/list-2.0.4.tgz",
|
||||
"integrity": "sha512-KLrm/oti5DSx8coNvbgYOwpog3gsCVALoXquNKMvW7BLHeKTMAtg/tO/v7BipgV/EKk5CT+ocoofPtufDU9Irg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codexteam/icons": "^0.0.4"
|
||||
"@codexteam/icons": "^0.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@editorjs/list/node_modules/@codexteam/icons": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@codexteam/icons/-/icons-0.0.4.tgz",
|
||||
"integrity": "sha512-V8N/TY2TGyas4wLrPIFq7bcow68b3gu8DfDt1+rrHPtXxcexadKauRJL6eQgfG7Z0LCrN4boLRawR4S9gjIh/Q==",
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@codexteam/icons/-/icons-0.3.3.tgz",
|
||||
"integrity": "sha512-cp7mkZPgmBuSxigTm3Vb+DtVHYeX7qXfQd7o05vcLD8Ag5WvRlol2QSn5P10k0CDAJwmkH9nQGQLBycErS9lsQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
@ -4196,19 +4211,19 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@editorjs/underline": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/underline/-/underline-1.1.0.tgz",
|
||||
"integrity": "sha512-vQj2ROW1KreD31QHlhaPikmDJGWYzRBusN4Zyfwl9nIIQCByt4S8fZQpsrRvH4sct5mkirsHllNT00rJlqHK7Q==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@editorjs/underline/-/underline-1.2.1.tgz",
|
||||
"integrity": "sha512-LjJ01ia6Pj0Z/elifycp9+T1bQs0eXNnIcEYKOlk0sGHLy88DPcBOh9oz1i+uWarZ4AjGsvSMaptpWe+yQNsjQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@codexteam/icons": "^0.0.6"
|
||||
"@codexteam/icons": "^0.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@editorjs/underline/node_modules/@codexteam/icons": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@codexteam/icons/-/icons-0.0.6.tgz",
|
||||
"integrity": "sha512-L7Q5PET8PjKcBT5wp7VR+FCjwCi5PUp7rd/XjsgQ0CI5FJz0DphyHGRILMuDUdCW2MQT9NHbVr4QP31vwAkS/A==",
|
||||
"version": "0.3.3",
|
||||
"resolved": "https://registry.npmjs.org/@codexteam/icons/-/icons-0.3.3.tgz",
|
||||
"integrity": "sha512-cp7mkZPgmBuSxigTm3Vb+DtVHYeX7qXfQd7o05vcLD8Ag5WvRlol2QSn5P10k0CDAJwmkH9nQGQLBycErS9lsQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
@ -22890,9 +22905,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/editorjs-html": {
|
||||
"version": "3.4.3",
|
||||
"resolved": "https://registry.npmjs.org/editorjs-html/-/editorjs-html-3.4.3.tgz",
|
||||
"integrity": "sha512-HMqQ3BCE98uhSpJsbfH0c3CoMctUMCHlap2Eq/7/VjaHas+g3IJqyf+ERtMByoQCzvcW22ISYaZEeE7rGkd8Xg==",
|
||||
"version": "4.0.5",
|
||||
"resolved": "https://registry.npmjs.org/editorjs-html/-/editorjs-html-4.0.5.tgz",
|
||||
"integrity": "sha512-ImQYxB3fNCJcd+nJ+Vbne/6PxidO1cYByNpu9nBDStVabfjVrMW65BuR+IEZfOii8VKYH+CW/lYDb2GDlzZtDg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
@ -22911,9 +22926,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/editorjs-text-color-plugin": {
|
||||
"version": "1.13.1",
|
||||
"resolved": "https://registry.npmjs.org/editorjs-text-color-plugin/-/editorjs-text-color-plugin-1.13.1.tgz",
|
||||
"integrity": "sha512-iCK274omDhoU7/zIFwV1fP5ydgfObYXSGV+q2zlFq3D4JDnvtn0KP+6NPM1A4dDlxTczpywPByRKIwmf7z4CIg==",
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/editorjs-text-color-plugin/-/editorjs-text-color-plugin-2.0.4.tgz",
|
||||
"integrity": "sha512-QpibTkOxs3ndlKNOLT8ZlC4ktc3/eKIajiLO0Jm/hh9AJug/CrM1/rAvHy+ldfUKavbWeI+YZvgjad0YTyoyGw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
|
20
package.json
20
package.json
@ -79,14 +79,14 @@
|
||||
"@angular/cli": "~17.1.0",
|
||||
"@angular/compiler-cli": "17.1.3",
|
||||
"@chromatic-com/storybook": "1.7.0",
|
||||
"@editorjs/code": "2.9.0",
|
||||
"@editorjs/editorjs": "2.30.5",
|
||||
"@editorjs/header": "2.8.1",
|
||||
"@editorjs/inline-code": "1.5.0",
|
||||
"@editorjs/list": "1.10.0",
|
||||
"@editorjs/code": "2.9.3",
|
||||
"@editorjs/editorjs": "2.30.8",
|
||||
"@editorjs/header": "2.8.8",
|
||||
"@editorjs/inline-code": "1.5.1",
|
||||
"@editorjs/list": "2.0.4",
|
||||
"@editorjs/marker": "1.4.0",
|
||||
"@editorjs/paragraph": "^2.11.6",
|
||||
"@editorjs/underline": "1.1.0",
|
||||
"@editorjs/paragraph": "2.11.7",
|
||||
"@editorjs/underline": "1.2.1",
|
||||
"@nx/angular": "17.3.1",
|
||||
"@nx/eslint-plugin": "17.3.1",
|
||||
"@nx/js": "17.3.1",
|
||||
@ -123,10 +123,10 @@
|
||||
"commander": "12.0.0",
|
||||
"css-loader": "^7.1.2",
|
||||
"dotenv": "16.4.7",
|
||||
"editorjs-html": "3.4.3",
|
||||
"editorjs-html": "4.0.5",
|
||||
"editorjs-paragraph-with-alignment": "3.0.0",
|
||||
"editorjs-text-alignment-blocktune": "^1.0.3",
|
||||
"editorjs-text-color-plugin": "1.13.1",
|
||||
"editorjs-text-alignment-blocktune": "1.0.3",
|
||||
"editorjs-text-color-plugin": "2.0.4",
|
||||
"ejs": "^3.1.10",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint-config-prettier": "9.1.0",
|
||||
|
Loading…
x
Reference in New Issue
Block a user