mirror of https://github.com/laurent22/joplin.git
Chore: Force syntax tree generation after creating editor in test units (#6783)
parent
e784e8c947
commit
c6b91cdc5d
|
@ -1,13 +1,13 @@
|
|||
import { markdown } from '@codemirror/lang-markdown';
|
||||
import { GFM as GithubFlavoredMarkdownExt } from '@lezer/markdown';
|
||||
import { indentUnit } from '@codemirror/language';
|
||||
import { forceParsing, indentUnit } from '@codemirror/language';
|
||||
import { SelectionRange, EditorSelection, EditorState } from '@codemirror/state';
|
||||
import { EditorView } from '@codemirror/view';
|
||||
import { MarkdownMathExtension } from './markdownMathParser';
|
||||
|
||||
// Creates and returns a minimal editor with markdown extensions
|
||||
const createEditor = (initialText: string, initialSelection: SelectionRange): EditorView => {
|
||||
return new EditorView({
|
||||
const editor = new EditorView({
|
||||
doc: initialText,
|
||||
selection: EditorSelection.create([initialSelection]),
|
||||
extensions: [
|
||||
|
@ -18,6 +18,9 @@ const createEditor = (initialText: string, initialSelection: SelectionRange): Ed
|
|||
EditorState.tabSize.of(4),
|
||||
],
|
||||
});
|
||||
|
||||
forceParsing(editor);
|
||||
return editor;
|
||||
};
|
||||
|
||||
export default createEditor;
|
||||
|
|
Loading…
Reference in New Issue