From af14fff6c205ee54e0bd07f3d61ae42e0000d34f Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Mon, 3 Feb 2020 13:17:08 +0530 Subject: [PATCH] Refactor campaign content type references --- frontend/src/Campaign.js | 16 ++++++++-------- frontend/src/constants.js | 3 +++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/frontend/src/Campaign.js b/frontend/src/Campaign.js index 57dcb7b..6b4eb58 100644 --- a/frontend/src/Campaign.js +++ b/frontend/src/Campaign.js @@ -37,8 +37,8 @@ class Editor extends React.PureComponent { editor: null, quill: null, rawInput: null, - selContentType: "richtext", - contentType: "richtext", + selContentType: cs.CampaignContentTypeRichtext, + contentType: cs.CampaignContentTypeRichtext, body: "" } @@ -108,11 +108,11 @@ class Editor extends React.PureComponent { // Switching from richtext to html. let body = "" - if (this.state.selContentType === "html") { + if (this.state.selContentType === cs.CampaignContentTypeHTML) { body = this.state.quill.editor.container.firstChild.innerHTML // eslint-disable-next-line this.state.rawInput.value = body - } else if (this.state.selContentType === "richtext") { + } else if (this.state.selContentType === cs.CampaignContentTypeRichtext) { body = this.state.rawInput.value this.state.quill.editor.clipboard.dangerouslyPasteHTML(body, "raw") } @@ -135,8 +135,8 @@ class Editor extends React.PureComponent { style={{ minWidth: 200 }} value={this.state.selContentType} > - Rich Text - Raw HTML + Rich Text + Raw HTML {this.state.contentType !== this.state.selContentType && (
@@ -159,7 +159,7 @@ class Editor extends React.PureComponent {