Refactor campaign content type references
This commit is contained in:
parent
ec22170176
commit
af14fff6c2
|
@ -37,8 +37,8 @@ class Editor extends React.PureComponent {
|
||||||
editor: null,
|
editor: null,
|
||||||
quill: null,
|
quill: null,
|
||||||
rawInput: null,
|
rawInput: null,
|
||||||
selContentType: "richtext",
|
selContentType: cs.CampaignContentTypeRichtext,
|
||||||
contentType: "richtext",
|
contentType: cs.CampaignContentTypeRichtext,
|
||||||
body: ""
|
body: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,11 +108,11 @@ class Editor extends React.PureComponent {
|
||||||
|
|
||||||
// Switching from richtext to html.
|
// Switching from richtext to html.
|
||||||
let body = ""
|
let body = ""
|
||||||
if (this.state.selContentType === "html") {
|
if (this.state.selContentType === cs.CampaignContentTypeHTML) {
|
||||||
body = this.state.quill.editor.container.firstChild.innerHTML
|
body = this.state.quill.editor.container.firstChild.innerHTML
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
this.state.rawInput.value = body
|
this.state.rawInput.value = body
|
||||||
} else if (this.state.selContentType === "richtext") {
|
} else if (this.state.selContentType === cs.CampaignContentTypeRichtext) {
|
||||||
body = this.state.rawInput.value
|
body = this.state.rawInput.value
|
||||||
this.state.quill.editor.clipboard.dangerouslyPasteHTML(body, "raw")
|
this.state.quill.editor.clipboard.dangerouslyPasteHTML(body, "raw")
|
||||||
}
|
}
|
||||||
|
@ -135,8 +135,8 @@ class Editor extends React.PureComponent {
|
||||||
style={{ minWidth: 200 }}
|
style={{ minWidth: 200 }}
|
||||||
value={this.state.selContentType}
|
value={this.state.selContentType}
|
||||||
>
|
>
|
||||||
<Select.Option value="richtext">Rich Text</Select.Option>
|
<Select.Option value={ cs.CampaignContentTypeRichtext }>Rich Text</Select.Option>
|
||||||
<Select.Option value="html">Raw HTML</Select.Option>
|
<Select.Option value={ cs.CampaignContentTypeHTML }>Raw HTML</Select.Option>
|
||||||
</Select>
|
</Select>
|
||||||
{this.state.contentType !== this.state.selContentType && (
|
{this.state.contentType !== this.state.selContentType && (
|
||||||
<div className="actions">
|
<div className="actions">
|
||||||
|
@ -159,7 +159,7 @@ class Editor extends React.PureComponent {
|
||||||
<ReactQuill
|
<ReactQuill
|
||||||
readOnly={this.props.formDisabled}
|
readOnly={this.props.formDisabled}
|
||||||
style={{
|
style={{
|
||||||
display: this.state.contentType === "richtext" ? "block" : "none"
|
display: this.state.contentType === cs.CampaignContentTypeRichtext ? "block" : "none"
|
||||||
}}
|
}}
|
||||||
modules={this.quillModules}
|
modules={this.quillModules}
|
||||||
defaultValue={this.props.record.body}
|
defaultValue={this.props.record.body}
|
||||||
|
@ -594,7 +594,7 @@ class Campaign extends React.PureComponent {
|
||||||
: 0,
|
: 0,
|
||||||
record: {},
|
record: {},
|
||||||
formRef: null,
|
formRef: null,
|
||||||
contentType: "richtext",
|
contentType: cs.CampaignContentTypeRichtext,
|
||||||
previewRecord: null,
|
previewRecord: null,
|
||||||
body: "",
|
body: "",
|
||||||
currentTab: "form",
|
currentTab: "form",
|
||||||
|
|
|
@ -45,6 +45,9 @@ export const CampaignStatusRunning = "running"
|
||||||
export const CampaignStatusPaused = "paused"
|
export const CampaignStatusPaused = "paused"
|
||||||
export const CampaignStatusFinished = "finished"
|
export const CampaignStatusFinished = "finished"
|
||||||
export const CampaignStatusCancelled = "cancelled"
|
export const CampaignStatusCancelled = "cancelled"
|
||||||
|
export const CampaignContentTypeRichtext = "richtext"
|
||||||
|
export const CampaignContentTypeHTML = "html"
|
||||||
|
export const CampaignContentTypePlain = "plain"
|
||||||
|
|
||||||
export const SubscriptionStatusConfirmed = "confirmed"
|
export const SubscriptionStatusConfirmed = "confirmed"
|
||||||
export const SubscriptionStatusUnConfirmed = "unconfirmed"
|
export const SubscriptionStatusUnConfirmed = "unconfirmed"
|
||||||
|
|
Loading…
Reference in New Issue