Fixes code blocks (#554)

* Fixes code blocks

* Flow ignore uncompiled files

* 💚

* big > bug
This commit is contained in:
Tom Moor
2018-02-04 12:30:22 -08:00
committed by GitHub
parent ba602861af
commit f076582ce4
9 changed files with 40 additions and 31 deletions

View File

@ -3,7 +3,7 @@ import InsertImages from '@tommoor/slate-drop-or-paste-images';
import PasteLinkify from 'slate-paste-linkify';
import CollapseOnEscape from 'slate-collapse-on-escape';
import TrailingBlock from 'slate-trailing-block';
import EditCode from 'slate-edit-code';
import EditCode from '@tommoor/slate-edit-code';
import Prism from 'slate-prism';
import EditList from './plugins/EditList';
import KeyboardShortcuts from './plugins/KeyboardShortcuts';
@ -15,8 +15,6 @@ type Options = {
onImageUploadStop: () => void,
};
const onlyInCode = node => node.type === 'code';
const createPlugins = ({ onImageUploadStart, onImageUploadStop }: Options) => {
return [
PasteLinkify({
@ -37,14 +35,14 @@ const createPlugins = ({ onImageUploadStart, onImageUploadStop }: Options) => {
}),
EditList,
EditCode({
onlyIn: onlyInCode,
containerType: 'code',
lineType: 'code-line',
exitBlocktype: 'paragraph',
allowMarks: false,
selectAll: true,
}),
Prism({
onlyIn: onlyInCode,
onlyIn: node => node.type === 'code',
getSyntax: node => 'javascript',
}),
CollapseOnEscape({ toEdge: 'end' }),