Skip to content

Commit

Permalink
Add update handler to cell based markdown editor
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Jan 20, 2025
1 parent 1a44464 commit 73bb860
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/src/components/Markdown/Editor/CellCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
10 changes: 9 additions & 1 deletion client/src/components/Markdown/Editor/CellEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
</script>
Expand Down

0 comments on commit 73bb860

Please sign in to comment.