From 73bb8606d8fb96e9f5b252bd84f554b5ce241064 Mon Sep 17 00:00:00 2001 From: guerler Date: Mon, 20 Jan 2025 14:07:02 -0500 Subject: [PATCH] Add update handler to cell based markdown editor --- client/src/components/Markdown/Editor/CellCode.vue | 2 +- client/src/components/Markdown/Editor/CellEditor.vue | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/src/components/Markdown/Editor/CellCode.vue b/client/src/components/Markdown/Editor/CellCode.vue index 300dbe20f00e..aa01ea6b2e06 100644 --- a/client/src/components/Markdown/Editor/CellCode.vue +++ b/client/src/components/Markdown/Editor/CellCode.vue @@ -7,7 +7,7 @@ import ace from "ace-builds"; import { debounce } from "lodash"; import { onBeforeUnmount, onMounted, ref, watch } from "vue"; -const DELAY = 3000; +const DELAY = 300; const props = defineProps({ theme: { diff --git a/client/src/components/Markdown/Editor/CellEditor.vue b/client/src/components/Markdown/Editor/CellEditor.vue index f497b6b989ea..19ca3a3349a6 100644 --- a/client/src/components/Markdown/Editor/CellEditor.vue +++ b/client/src/components/Markdown/Editor/CellEditor.vue @@ -66,7 +66,15 @@ function onChange(cellIndex: number, cellContent: string) { } function onUpdate() { - const newMarkdownText = ""; + let newMarkdownText = ""; + cells.value.forEach((cell) => { + if (cell.name === "markdown") { + newMarkdownText += cell.content; + } else { + newMarkdownText += `\`\`\`${cell.name}\n` + cell.content + "\n```"; + } + newMarkdownText += "\n\n"; + }); emit("update", newMarkdownText); }