diff options
author | Julius Härtl <jus@bitgrid.net> | 2019-06-24 19:55:50 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2019-06-24 22:24:18 +0300 |
commit | e38f89c215b9ba1c0ce89ccde552da0538b7b429 (patch) | |
tree | 5d415c1b41d380f219b98334477516b06391046d /src/EditorFactory.js | |
parent | 963f6fdcb2dfb421e494f1fbac862adac08585b8 (diff) |
Also open plain text files with the editor
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'src/EditorFactory.js')
-rw-r--r-- | src/EditorFactory.js | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/EditorFactory.js b/src/EditorFactory.js index 468a9bf99..3bd7b27fe 100644 --- a/src/EditorFactory.js +++ b/src/EditorFactory.js @@ -39,13 +39,10 @@ import MarkdownIt from 'markdown-it' import { MarkdownSerializer, defaultMarkdownSerializer } from 'prosemirror-markdown' -const createEditor = ({ content, onUpdate, extensions }) => { - extensions = extensions || [] - return new Editor({ - content: content, - onUpdate: onUpdate, - extensions: [ - new HardBreak(), +const createEditor = ({ content, onUpdate, extensions, enableRichEditing }) => { + let richEditingExtensions = [] + if (enableRichEditing) { + richEditingExtensions = [ new Heading(), new Code(), new Strong(), @@ -58,7 +55,16 @@ const createEditor = ({ content, onUpdate, extensions }) => { new CodeBlock(), new ListItem(), new Link(), - new Image(), + new Image() + ] + } + extensions = extensions || [] + return new Editor({ + content: content, + onUpdate: onUpdate, + extensions: [ + new HardBreak(), + ...richEditingExtensions, new History() ].concat(extensions) }) |