mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-03 04:27:53 +00:00
feat: Add support for rich content for message in ongoing campaigns (#2577)
This commit is contained in:
@@ -57,6 +57,7 @@ export default {
|
|||||||
value: { type: String, default: '' },
|
value: { type: String, default: '' },
|
||||||
placeholder: { type: String, default: '' },
|
placeholder: { type: String, default: '' },
|
||||||
isPrivate: { type: Boolean, default: false },
|
isPrivate: { type: Boolean, default: false },
|
||||||
|
isFormatMode: { type: Boolean, default: false },
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -280,4 +281,25 @@ export default {
|
|||||||
padding: 0 var(--space-smaller);
|
padding: 0 var(--space-smaller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.editor-wrap {
|
||||||
|
margin-bottom: var(--space-normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
.message-editor {
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: var(--border-radius-normal);
|
||||||
|
padding: 0 var(--space-slab);
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor_warning {
|
||||||
|
border: 1px solid var(--r-400);
|
||||||
|
}
|
||||||
|
|
||||||
|
.editor-warning__message {
|
||||||
|
color: var(--r-400);
|
||||||
|
font-weight: var(--font-weight-normal);
|
||||||
|
padding: var(--space-smaller) 0 0 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -16,7 +16,21 @@
|
|||||||
@blur="$v.title.$touch"
|
@blur="$v.title.$touch"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<label :class="{ error: $v.message.$error }">
|
<label v-if="isOngoingType" class="editor-wrap">
|
||||||
|
{{ $t('CAMPAIGN.ADD.FORM.MESSAGE.LABEL') }}
|
||||||
|
<woot-message-editor
|
||||||
|
v-model="message"
|
||||||
|
class="message-editor"
|
||||||
|
:class="{ editor_warning: $v.message.$error }"
|
||||||
|
:placeholder="$t('CAMPAIGN.ADD.FORM.MESSAGE.PLACEHOLDER')"
|
||||||
|
@blur="$v.message.$touch"
|
||||||
|
/>
|
||||||
|
<span v-if="$v.message.$error" class="editor-warning__message">
|
||||||
|
{{ $t('CAMPAIGN.ADD.FORM.MESSAGE.ERROR') }}
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<label v-else :class="{ error: $v.message.$error }">
|
||||||
{{ $t('CAMPAIGN.ADD.FORM.MESSAGE.LABEL') }}
|
{{ $t('CAMPAIGN.ADD.FORM.MESSAGE.LABEL') }}
|
||||||
<textarea
|
<textarea
|
||||||
v-model="message"
|
v-model="message"
|
||||||
@@ -141,12 +155,18 @@
|
|||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { required, url, minLength } from 'vuelidate/lib/validators';
|
import { required, url, minLength } from 'vuelidate/lib/validators';
|
||||||
import alertMixin from 'shared/mixins/alertMixin';
|
import alertMixin from 'shared/mixins/alertMixin';
|
||||||
|
import WootMessageEditor from 'dashboard/components/widgets/WootWriter/Editor';
|
||||||
import campaignMixin from 'shared/mixins/campaignMixin';
|
import campaignMixin from 'shared/mixins/campaignMixin';
|
||||||
import WootDateTimePicker from 'dashboard/components/ui/DateTimePicker.vue';
|
import WootDateTimePicker from 'dashboard/components/ui/DateTimePicker.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { WootDateTimePicker },
|
components: {
|
||||||
|
WootDateTimePicker,
|
||||||
|
WootMessageEditor,
|
||||||
|
},
|
||||||
|
|
||||||
mixins: [alertMixin, campaignMixin],
|
mixins: [alertMixin, campaignMixin],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
senderList: {
|
senderList: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@@ -287,3 +307,8 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
::v-deep .ProseMirror-woot-style {
|
||||||
|
height: 8rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import Spinner from 'shared/components/Spinner.vue';
|
|||||||
import Label from 'dashboard/components/ui/Label';
|
import Label from 'dashboard/components/ui/Label';
|
||||||
import EmptyState from 'dashboard/components/widgets/EmptyState.vue';
|
import EmptyState from 'dashboard/components/widgets/EmptyState.vue';
|
||||||
import WootButton from 'dashboard/components/ui/WootButton.vue';
|
import WootButton from 'dashboard/components/ui/WootButton.vue';
|
||||||
|
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin';
|
||||||
import UserAvatarWithName from 'dashboard/components/widgets/UserAvatarWithName';
|
import UserAvatarWithName from 'dashboard/components/widgets/UserAvatarWithName';
|
||||||
import campaignMixin from 'shared/mixins/campaignMixin';
|
import campaignMixin from 'shared/mixins/campaignMixin';
|
||||||
import timeMixin from 'dashboard/mixins/time';
|
import timeMixin from 'dashboard/mixins/time';
|
||||||
@@ -32,7 +33,9 @@ export default {
|
|||||||
Spinner,
|
Spinner,
|
||||||
VeTable,
|
VeTable,
|
||||||
},
|
},
|
||||||
mixins: [clickaway, timeMixin, campaignMixin],
|
|
||||||
|
mixins: [clickaway, timeMixin, campaignMixin, messageFormatterMixin],
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
campaigns: {
|
campaigns: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@@ -92,11 +95,16 @@ export default {
|
|||||||
align: 'left',
|
align: 'left',
|
||||||
width: 350,
|
width: 350,
|
||||||
renderBodyCell: ({ row }) => {
|
renderBodyCell: ({ row }) => {
|
||||||
|
if (row.message) {
|
||||||
return (
|
return (
|
||||||
<div class="text-truncate">
|
<div class="text-truncate">
|
||||||
<span title={row.message}>{row.message}</span>
|
<span
|
||||||
|
domPropsInnerHTML={this.formatMessage(row.message)}
|
||||||
|
></span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
return '';
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -12,16 +12,17 @@
|
|||||||
:placeholder="$t('CAMPAIGN.ADD.FORM.TITLE.PLACEHOLDER')"
|
:placeholder="$t('CAMPAIGN.ADD.FORM.TITLE.PLACEHOLDER')"
|
||||||
@blur="$v.title.$touch"
|
@blur="$v.title.$touch"
|
||||||
/>
|
/>
|
||||||
<label :class="{ error: $v.message.$error }">
|
<label class="editor-wrap">
|
||||||
{{ $t('CAMPAIGN.ADD.FORM.MESSAGE.LABEL') }}
|
{{ $t('CAMPAIGN.ADD.FORM.MESSAGE.LABEL') }}
|
||||||
<textarea
|
<woot-message-editor
|
||||||
v-model.trim="message"
|
v-model.trim="message"
|
||||||
rows="5"
|
class="message-editor"
|
||||||
type="text"
|
:is-format-mode="true"
|
||||||
|
:class="{ editor_warning: $v.message.$error }"
|
||||||
:placeholder="$t('CAMPAIGN.ADD.FORM.MESSAGE.PLACEHOLDER')"
|
:placeholder="$t('CAMPAIGN.ADD.FORM.MESSAGE.PLACEHOLDER')"
|
||||||
@input="$v.message.$touch"
|
@input="$v.message.$touch"
|
||||||
/>
|
/>
|
||||||
<span v-if="$v.message.$error" class="message">
|
<span v-if="$v.message.$error" class="editor-warning__message">
|
||||||
{{ $t('CAMPAIGN.ADD.FORM.MESSAGE.ERROR') }}
|
{{ $t('CAMPAIGN.ADD.FORM.MESSAGE.ERROR') }}
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
@@ -92,8 +93,12 @@
|
|||||||
<script>
|
<script>
|
||||||
import { mapGetters } from 'vuex';
|
import { mapGetters } from 'vuex';
|
||||||
import { required, url, minLength } from 'vuelidate/lib/validators';
|
import { required, url, minLength } from 'vuelidate/lib/validators';
|
||||||
|
import WootMessageEditor from 'dashboard/components/widgets/WootWriter/Editor';
|
||||||
import alertMixin from 'shared/mixins/alertMixin';
|
import alertMixin from 'shared/mixins/alertMixin';
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
WootMessageEditor,
|
||||||
|
},
|
||||||
mixins: [alertMixin],
|
mixins: [alertMixin],
|
||||||
props: {
|
props: {
|
||||||
selectedCampaign: {
|
selectedCampaign: {
|
||||||
@@ -209,3 +214,8 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
::v-deep .ProseMirror-woot-style {
|
||||||
|
height: 8rem;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user