diff --git a/src/components/designer/editor-menu/editables/TextContent.vue b/src/components/designer/editor-menu/editables/TextContent.vue
index 19b60bb..2a6cbb5 100644
--- a/src/components/designer/editor-menu/editables/TextContent.vue
+++ b/src/components/designer/editor-menu/editables/TextContent.vue
@@ -84,10 +84,11 @@ watch(
diff --git a/src/composables/Designer.js b/src/composables/Designer.js
index 8361afc..5de5f6d 100644
--- a/src/composables/Designer.js
+++ b/src/composables/Designer.js
@@ -700,22 +700,28 @@ class Designer {
}
}
- async changeText() {
+ decodeHTML(html) {
+ const txt = document.createElement('textarea');
+ txt.innerHTML = html;
+ return txt.value;
+ }
+
+ async changeText(event) {
await this.nextTick;
- if (this.getTextAreaVueModel.value !== null) {
- let textContentElementClone = this.getTextAreaVueModel.value;
+ const textContentElementClone = event.target.value;
- // Replace newline characters with
tags
- textContentElementClone = textContentElementClone.replaceAll(
- /\r?\n/g,
- '
'
- );
+ // Convert newline characters to
tags when saving
+ const textContentWithBr = textContentElementClone.replaceAll(
+ /\r?\n/g,
+ '
'
+ );
- // text change
- this.getElement.value.innerHTML = textContentElementClone;
- this.store.commit('designer/setElement', this.getElement.value);
- }
+ // Update both the displayed content and the model
+ this.textContentVueModel = textContentWithBr;
+ this.getElement.value.innerHTML = textContentWithBr;
+
+ this.store.commit('designer/setElement', this.getElement.value);
}
previewCurrentDesign() {