From 672e5874fb7a9537d13a9d26e61320c9bff9d4c7 Mon Sep 17 00:00:00 2001 From: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com> Date: Thu, 29 Jul 2021 11:53:28 +0530 Subject: [PATCH] fix: Appending markdown as HTML into editor (#2720) --- .../components/widgets/WootWriter/Editor.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/app/javascript/dashboard/components/widgets/WootWriter/Editor.vue b/app/javascript/dashboard/components/widgets/WootWriter/Editor.vue index ab4f5b5f1..76939bbb7 100644 --- a/app/javascript/dashboard/components/widgets/WootWriter/Editor.vue +++ b/app/javascript/dashboard/components/widgets/WootWriter/Editor.vue @@ -139,8 +139,17 @@ export default { value(newValue = '') { if (newValue !== this.lastValue) { const { tr } = this.state; - tr.insertText(newValue, 0, tr.doc.content.size); - this.state = this.view.state.apply(tr); + if (this.isFormatMode) { + this.state = createState( + newValue, + this.placeholder, + this.plugins, + this.isFormatMode + ); + } else { + tr.insertText(newValue, 0, tr.doc.content.size); + this.state = this.view.state.apply(tr); + } this.view.updateState(this.state); } },