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 editor (variables + katex render)

Smaug6739f7207e80c5e7
diff --git a/frontend/components/MarkdownEditor/Editor.ts b/frontend/components/MarkdownEditor/Editor.ts
index 4d44edef..0ce0d1a5 100644
--- a/frontend/components/MarkdownEditor/Editor.ts
+++ b/frontend/components/MarkdownEditor/Editor.ts
@@ -67,9 +67,6 @@ export class Editor extends EventTarget {
case 'clear':
this.util.clear();
break;
- case 'block':
- this.util.inlineFormat('<div class="green custom-block"><p class="custom-block-title">Block name</p>', '</div>');
- break;
}
}
public handleKeydown(event: KeyboardEvent) {
diff --git a/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue b/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue
index 80e44487..8f1db4c1 100644
--- a/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue
+++ b/frontend/components/MarkdownEditor/LazyMarkdownEditor.vue
@@ -28,13 +28,9 @@ const textarea = ref<HTMLDivElement>();
const editor = new Editor(textarea, toolbar);
const emit = defineEmits(['save']);
-const update = () => {
- // Replace fix use of & in katex expressions
- document.value.content_html = compile(textarea.value?.innerHTML.replaceAll('&amp;', '&') || '');
-};
+const update = () => document.value.content_html = compile(textarea.value?.innerHTML || '');
const handleClick = () => editor.updateContextMenu();
-
const markdownPreview = ref<HTMLDivElement>();
editor.addEventListener('save', saveDocument);
diff --git a/frontend/components/MarkdownEditor/Utils.ts b/frontend/components/MarkdownEditor/Utils.ts
index 2c33cf47..41db5d1b 100644
--- a/frontend/components/MarkdownEditor/Utils.ts
+++ b/frontend/components/MarkdownEditor/Utils.ts
@@ -1,5 +1,3 @@
-let lastSelection: any = null;
-
class MarkdownUtil {
private editor: Ref<HTMLDivElement | undefined>;
diff --git a/frontend/helpers/markdown/index.ts b/frontend/helpers/markdown/index.ts
index 62adcd0a..842a00c0 100644
--- a/frontend/helpers/markdown/index.ts
+++ b/frontend/helpers/markdown/index.ts
@@ -63,6 +63,8 @@ function markdownItKatexPlugin(md: any) {
}
export default function compile(str: string = '', plugins: boolean = true): string {
+ // Replace fix use of & in katex expressions
+ str = str.replaceAll('&amp;', '&');
return md.render(str, {
html: true,
});