Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
import type { Editor, Range } from '@tiptap/core';
import type { EditorState } from '@tiptap/pm/state';
import { isInLiteralTextContext } from '../literal-text-context';
import { getEditorSourceMode } from './editor-mode-context';
import { allowOutsideComposition } from './suggestion-ime';
export function suggestionAllow({
editor,
state,
range,
isActive,
}: {
editor: Editor;
state: EditorState;
range: Range;
isActive?: boolean;
}): boolean {
if (getEditorSourceMode(editor)) return false;
if (!allowOutsideComposition({ editor, isActive })) return false;
return !isInLiteralTextContext(state, range.from, range.to);
}