diff --git a/frontend/src/assets/style.scss b/frontend/src/assets/style.scss
index 00feab9d..ade18198 100644
--- a/frontend/src/assets/style.scss
+++ b/frontend/src/assets/style.scss
@@ -533,6 +533,9 @@ body.is-noscroll {
}
}
+.button.is-primary[disabled] {
+ border-color: $grey-light;
+}
.has-addons {
.controls .button.is-primary {
border-top-left-radius: 0;
diff --git a/frontend/src/components/Editor.vue b/frontend/src/components/Editor.vue
index 054a5acb..5bc7806f 100644
--- a/frontend/src/components/Editor.vue
+++ b/frontend/src/components/Editor.vue
@@ -4,7 +4,7 @@
-
+
@@ -27,10 +27,9 @@
-
+
-
+
@@ -41,22 +40,23 @@
- {{ $t('globals.terms.copyVisualTemplate') }}
+ {{ $t('campaigns.importVisualTemplate') }}
-
-
-
+
+ isVisualTplDisabled = false" name="template" :disabled="disabled"
+ class="copy-visual-template-list">
+
-
- {{ $t('globals.terms.apply') }}
+
+ {{ $t('globals.terms.import') }}
@@ -69,25 +69,25 @@
-
+
-
+
-
+
-
+
-
+
+ :content-type="self.contentType" :template-id="templateId" :body="self.body" />
@@ -118,6 +118,10 @@ export default {
title: { type: String, default: '' },
disabled: { type: Boolean, default: false },
templates: { type: Array, default: null },
+
+ // value is provided by the parent component.
+ // Throught the editor, `this.self` (a mutable clone of `value`) is used,
+ // instead of `this.value` directly.
value: {
type: Object,
default: () => ({
@@ -133,8 +137,8 @@ export default {
return {
isPreviewing: false,
isVisualTplSelector: false,
- isVisualTplApplied: false,
- contentType: this.$props.value.contentType,
+ isVisualTplDisabled: false,
+ contentTypeSel: this.$props.value.contentType,
templateId: '',
visualTemplateId: '',
};
@@ -142,79 +146,97 @@ export default {
methods: {
onContentTypeChange(to, from) {
- if (this.computedValue.body?.trim() === '') {
- this.computedValue.contentType = this.contentType;
- return;
- }
-
- // To avoid prompt loop.
- if (to === this.computedValue.contentType) {
- return;
- }
-
- // Content isn't empty. Warn.
+ // Ask for confirmation as pretty much all conversions are lossy.
+ const msgKey = to === 'visual' ? 'campaigns.confirmOverwriteContent' : 'campaigns.confirmSwitchFormat';
this.$utils.confirm(
- this.$t('campaigns.confirmSwitchFormat'),
+ this.$t(msgKey),
() => {
- this.computedValue.contentType = this.contentType;
+ this.convertContentType(to, from);
},
() => {
- this.contentType = from;
+ // Cancelled. Reset the