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 markdown editor types

Smaug67397f5a9f820f7e
diff --git a/frontend/app/components/MarkdownEditor/modules/editorState.ts b/frontend/app/components/MarkdownEditor/modules/editorState.ts
index bdb7028c..26c17523 100644
--- a/frontend/app/components/MarkdownEditor/modules/editorState.ts
+++ b/frontend/app/components/MarkdownEditor/modules/editorState.ts
@@ -1,5 +1,5 @@
import { EditorView, keymap, highlightSpecialChars, drawSelection, lineNumbers, type KeyBinding } from '@codemirror/view';
-import { EditorState, Compartment } from '@codemirror/state';
+import { EditorState, Compartment, type Extension } from '@codemirror/state';
import { defaultKeymap, history, historyKeymap, indentWithTab } from '@codemirror/commands';
import { highlightSelectionMatches, searchKeymap } from '@codemirror/search';
import { autocompletion } from '@codemirror/autocomplete';
@@ -7,10 +7,10 @@ import { markdown, markdownLanguage } from '@codemirror/lang-markdown';
export interface CreateEditorStateParams {
initialDoc: string;
- preferences: any;
- themeExtension: any;
+ preferences: ReturnType<typeof import('~/composables/Preferences').usePreferences>;
+ themeExtension: Extension;
keymaps: readonly KeyBinding[];
- snippetSource: any;
+ snippetSource: object;
onDocChanged: () => void;
uploadsHandlers: ReturnType<typeof EditorView.domEventHandlers>;
}
diff --git a/frontend/app/components/MarkdownEditor/modules/editorUtils.ts b/frontend/app/components/MarkdownEditor/modules/editorUtils.ts
index 18987c16..b488f8b8 100644
--- a/frontend/app/components/MarkdownEditor/modules/editorUtils.ts
+++ b/frontend/app/components/MarkdownEditor/modules/editorUtils.ts
@@ -43,7 +43,7 @@ function isInsideMath(context: CompletionContext): boolean {
return singleCountBefore % 2 === 1;
}
-export function createSnippetSource(preferences: any) {
+export function createSnippetSource(preferences: ReturnType<typeof import('~/composables/Preferences').usePreferences>) {
return function snippetSource(context: CompletionContext) {
if (!preferences.get('editorSnippetsEnabled').value) return null;
const allSnippets = preferences.get('snippets').value;
@@ -56,7 +56,7 @@ export function createSnippetSource(preferences: any) {
return {
from: word ? word.from : context.pos,
options: [
- ...allSnippets.map((s: any) => ({
+ ...allSnippets.map(s => ({
label: s.id,
detail: 'Snippet',
type: 'snippet',