Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Commit

Permalink
Add slate-edit-code to example
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyPesse committed Jul 30, 2016
1 parent 5b8ecae commit ac5b4b0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
14 changes: 10 additions & 4 deletions example/main.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
const React = require('react');
const ReactDOM = require('react-dom');
const Slate = require('slate');
const Prism = require('../');
const PluginEditCode = require('slate-edit-code');
const PluginPrism = require('../');

const stateJson = require('./state');

const onlyInCode = (node => node.type === 'code_block');

const plugins = [
Prism({
onlyIn: (node => node.type === 'code_block'),
getSyntax: (node => node.data.get('syntax'))
PluginPrism({
onlyIn: onlyInCode,
getSyntax: (node => node.data.get('syntax'))
}),
PluginEditCode({
onlyIn: onlyInCode
})
];

Expand Down
10 changes: 9 additions & 1 deletion example/state.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
}
]
},
{
"kind": "text",
"ranges": [
{
"text": "Syntax can be set on a per-block basis:"
}
]
},
{
"kind": "block",
"type": "code_block",
Expand All @@ -36,7 +44,7 @@
"kind": "text",
"ranges": [
{
"text": "<b>Hello World</b>"
"text": "<!-- Some HTML -->\n<b>Hello World</b>"
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"eslint-plugin-react": "^5.2.2",
"react": "^15.3.0",
"react-dom": "^15.3.0",
"slate": "^0.10.1"
"slate": "^0.10.1",
"slate-edit-code": "^0.1.0"
},
"scripts": {
"prepublish": "babel ./lib --out-dir ./dist",
Expand Down

0 comments on commit ac5b4b0

Please sign in to comment.