diff --git a/example/main.js b/example/main.js index e5ec6c5..6dded1f 100644 --- a/example/main.js +++ b/example/main.js @@ -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 }) ]; diff --git a/example/state.json b/example/state.json index d2fdb25..972e7ea 100644 --- a/example/state.json +++ b/example/state.json @@ -27,6 +27,14 @@ } ] }, + { + "kind": "text", + "ranges": [ + { + "text": "Syntax can be set on a per-block basis:" + } + ] + }, { "kind": "block", "type": "code_block", @@ -36,7 +44,7 @@ "kind": "text", "ranges": [ { - "text": "Hello World" + "text": "\nHello World" } ] } diff --git a/package.json b/package.json index 6b7785e..084ed07 100644 --- a/package.json +++ b/package.json @@ -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",