Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Refactor campaign content type references

Kailash Nadhaf14fff6c205
diff --git a/frontend/src/Campaign.js b/frontend/src/Campaign.js
index 57dcb7b8..6b4eb58d 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}
>
- <Select.Option value="richtext">Rich Text</Select.Option>
- <Select.Option value="html">Raw HTML</Select.Option>
+ <Select.Option value={ cs.CampaignContentTypeRichtext }>Rich Text</Select.Option>
+ <Select.Option value={ cs.CampaignContentTypeHTML }>Raw HTML</Select.Option>
</Select>
{this.state.contentType !== this.state.selContentType && (
<div className="actions">
@@ -159,7 +159,7 @@ class Editor extends React.PureComponent {
<ReactQuill
readOnly={this.props.formDisabled}
style={{
- display: this.state.contentType === "richtext" ? "block" : "none"
+ display: this.state.contentType === cs.CampaignContentTypeRichtext ? "block" : "none"
}}
modules={this.quillModules}
defaultValue={this.props.record.body}
@@ -594,7 +594,7 @@ class Campaign extends React.PureComponent {
: 0,
record: {},
formRef: null,
- contentType: "richtext",
+ contentType: cs.CampaignContentTypeRichtext,
previewRecord: null,
body: "",
currentTab: "form",
diff --git a/frontend/src/constants.js b/frontend/src/constants.js
index d63ad02a..1dc8342a 100644
--- a/frontend/src/constants.js
+++ b/frontend/src/constants.js
@@ -45,6 +45,9 @@ export const CampaignStatusRunning = "running"
export const CampaignStatusPaused = "paused"
export const CampaignStatusFinished = "finished"
export const CampaignStatusCancelled = "cancelled"
+export const CampaignContentTypeRichtext = "richtext"
+export const CampaignContentTypeHTML = "html"
+export const CampaignContentTypePlain = "plain"
export const SubscriptionStatusConfirmed = "confirmed"
export const SubscriptionStatusUnConfirmed = "unconfirmed"