Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Fix debounce of markdown editor edit

Smaug6739256783c181ce
diff --git a/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue b/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue
index 3154652d..1ebf3ccd 100644
--- a/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue
+++ b/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue
@@ -311,9 +311,7 @@ watch(useColorMode(), mode => {
});
const updateListener = EditorView.updateListener.of(v => {
if (v.docChanged) {
- const content = v.state.doc.toString();
- document.value.content_markdown = content;
- document.value.content_html = compile(content);
+ updateDocumentContent();
autoSaveConditional();
}
});
@@ -383,11 +381,11 @@ function autoSaveConditional() {
}
}
-function updateDocumentContent() {
+const updateDocumentContent = debounce(() => {
const content = editorView.value?.state.doc.toString() || '';
document.value.content_markdown = content;
document.value.content_html = compile(content);
-}
+}, 100);
const save = debounce(() => {
updateDocumentContent();