|
@@ -22,14 +22,16 @@ import { FoldDrawio, useFoldDrawio } from './utils/fold-drawio';
|
|
|
import { useGetDoc, type GetDoc } from './utils/get-doc';
|
|
import { useGetDoc, type GetDoc } from './utils/get-doc';
|
|
|
import { useInitDoc, type InitDoc } from './utils/init-doc';
|
|
import { useInitDoc, type InitDoc } from './utils/init-doc';
|
|
|
import { useInsertMarkdownElements, type InsertMarkdowElements } from './utils/insert-markdown-elements';
|
|
import { useInsertMarkdownElements, type InsertMarkdowElements } from './utils/insert-markdown-elements';
|
|
|
|
|
+import { insertNewlineContinueMarkup } from './utils/insert-newline-continue-markup';
|
|
|
import { useInsertPrefix, type InsertPrefix } from './utils/insert-prefix';
|
|
import { useInsertPrefix, type InsertPrefix } from './utils/insert-prefix';
|
|
|
import { useInsertText, type InsertText } from './utils/insert-text';
|
|
import { useInsertText, type InsertText } from './utils/insert-text';
|
|
|
import { useReplaceText, type ReplaceText } from './utils/replace-text';
|
|
import { useReplaceText, type ReplaceText } from './utils/replace-text';
|
|
|
import { useSetCaretLine, type SetCaretLine } from './utils/set-caret-line';
|
|
import { useSetCaretLine, type SetCaretLine } from './utils/set-caret-line';
|
|
|
|
|
|
|
|
|
|
+
|
|
|
const markdownKeymap = [
|
|
const markdownKeymap = [
|
|
|
{ key: 'Backspace', run: deleteMarkupBackward },
|
|
{ key: 'Backspace', run: deleteMarkupBackward },
|
|
|
- { key: 'Enter', run: }
|
|
|
|
|
|
|
+ { key: 'Enter', run: insertNewlineContinueMarkup },
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
const markdownHighlighting = HighlightStyle.define([
|
|
const markdownHighlighting = HighlightStyle.define([
|
|
@@ -61,8 +63,8 @@ export type UseCodeMirrorEditor = {
|
|
|
|
|
|
|
|
const defaultExtensions: Extension[] = [
|
|
const defaultExtensions: Extension[] = [
|
|
|
EditorView.lineWrapping,
|
|
EditorView.lineWrapping,
|
|
|
- markdown({ base: markdownLanguage, codeLanguages: languages }),
|
|
|
|
|
- // keymap.of(markdownKeymap),
|
|
|
|
|
|
|
+ markdown({ base: markdownLanguage, codeLanguages: languages, addKeymap: false }),
|
|
|
|
|
+ keymap.of(markdownKeymap),
|
|
|
keymap.of([indentWithTab]),
|
|
keymap.of([indentWithTab]),
|
|
|
Prec.lowest(keymap.of(defaultKeymap)),
|
|
Prec.lowest(keymap.of(defaultKeymap)),
|
|
|
syntaxHighlighting(markdownHighlighting),
|
|
syntaxHighlighting(markdownHighlighting),
|