From ba75623f868763efe54dfb4ffbb50876b1521262 Mon Sep 17 00:00:00 2001 From: Tomas Bures Date: Sat, 24 Feb 2018 21:59:00 +0100 Subject: [PATCH] Integrated CKEditor for templates. We might need to move it to a sandbox later to make it secure. --- client/package.json | 1 + client/src/lib/form.js | 4 +- client/src/templates/CUD.js | 222 +++++++++++++++++--------------- client/src/templates/helpers.js | 7 +- client/webpack.config.js | 5 + 5 files changed, 129 insertions(+), 110 deletions(-) diff --git a/client/package.json b/client/package.json index 9919bb63..1f6834f6 100644 --- a/client/package.json +++ b/client/package.json @@ -28,6 +28,7 @@ "querystringify": "^1.0.0", "react": "^15.6.1", "react-ace": "^5.1.0", + "react-ckeditor-component": "^1.0.7", "react-day-picker": "^6.1.0", "react-dnd-html5-backend": "^2.4.1", "react-dnd-touch-backend": "^0.3.13", diff --git a/client/src/lib/form.js b/client/src/lib/form.js index dc65bd1d..a6f38d72 100644 --- a/client/src/lib/form.js +++ b/client/src/lib/form.js @@ -863,7 +863,9 @@ class CKEditor extends Component { return wrapInput(id, htmlId, owner, props.format, '', props.label, props.help, owner.updateFormValue(id, evt.editor.getData())} + events={{ + "change": evt => owner.updateFormValue(id, evt.editor.getData()) + }} content={owner.getFormValue(id)} config={{width: '100%', height: props.height}} /> diff --git a/client/src/templates/CUD.js b/client/src/templates/CUD.js index f0a42ea9..130128f5 100644 --- a/client/src/templates/CUD.js +++ b/client/src/templates/CUD.js @@ -159,6 +159,120 @@ export default class CUD extends Component { const typeKey = this.getFormValue('type'); + let editForm = null; + if (isEdit && typeKey) { + editForm =
+ +
+ } + + return (
{canDelete && @@ -190,113 +304,7 @@ export default class CUD extends Component { - -