diff --git a/Makefile b/Makefile index e84698d5c..45ad6a1f7 100644 --- a/Makefile +++ b/Makefile @@ -31,10 +31,6 @@ dist: $(shell find ./lib) example-auto-markdown: @ $(browserify) --debug --transform babelify --outfile ./examples/auto-markdown/build.js ./examples/auto-markdown/index.js -# Build the basic example. -example-basic: - @ $(browserify) --debug --transform babelify --outfile ./examples/basic/build.js ./examples/basic/index.js - # Build the plain-text example. example-plain-text: @ $(browserify) --debug --transform babelify --outfile ./examples/plain-text/build.js ./examples/plain-text/index.js @@ -70,10 +66,6 @@ test-server: watch-example-auto-markdown: @ $(MAKE) example-auto-markdown browserify=$(watchify) -# Watch the basic example. -watch-example-basic: - @ $(MAKE) example-basic browserify=$(watchify) - # Watch the plain-text example. watch-example-plain-text: @ $(MAKE) example-plain-text browserify=$(watchify) diff --git a/examples/auto-markdown/index.js b/examples/auto-markdown/index.js index 6a29f94dd..8567ce518 100644 --- a/examples/auto-markdown/index.js +++ b/examples/auto-markdown/index.js @@ -1,84 +1,9 @@ -import Editor, { Mark, Raw } from '../..' +import Editor, { Raw } from '../..' import React from 'react' import ReactDOM from 'react-dom' import keycode from 'keycode' - -/** - * Define the initial state. - * - * @type {Object} state - */ - -const state = { - nodes: [ - { - type: 'paragraph', - nodes: [ - { - type: 'text', - ranges: [ - { - text: 'The editor gives you full control over the logic you can add. For example, it\'s fairly common to want to add markdown-like shortcuts to editors. So that, when you start a line with "> " you get a blockquote that looks like this:', - } - ] - } - ] - }, - { - type: 'block-quote', - nodes: [ - { - type: 'text', - ranges: [ - { - text: 'A wise quote.' - } - ] - } - ] - }, - { - type: 'paragraph', - nodes: [ - { - type: 'text', - ranges: [ - { - text: 'Order when you start a line with "## " you get a level-two heading, like this:', - } - ] - } - ] - }, - { - type: 'heading-two', - nodes: [ - { - type: 'text', - ranges: [ - { - text: 'Try it out!' - } - ] - } - ] - }, - { - type: 'paragraph', - nodes: [ - { - type: 'text', - ranges: [ - { - text: 'Try it out for yourself! Try starting a new line with ">", "-", or "#"s.' - } - ] - } - ] - } - ] -} +import state from './state.json' /** * Define our example app. diff --git a/examples/auto-markdown/state.json b/examples/auto-markdown/state.json new file mode 100644 index 000000000..65a13faf7 --- /dev/null +++ b/examples/auto-markdown/state.json @@ -0,0 +1,69 @@ +{ + "nodes": [ + { + "type": "paragraph", + "nodes": [ + { + "type": "text", + "ranges": [ + { + "text": "The editor gives you full control over the logic you can add. For example, it's fairly common to want to add markdown-like shortcuts to editors. So that, when you start a line with \"> \" you get a blockquote that looks like this:" + } + ] + } + ] + }, + { + "type": "block-quote", + "nodes": [ + { + "type": "text", + "ranges": [ + { + "text": "A wise quote." + } + ] + } + ] + }, + { + "type": "paragraph", + "nodes": [ + { + "type": "text", + "ranges": [ + { + "text": "Order when you start a line with \"## \" you get a level-two heading, like this:" + } + ] + } + ] + }, + { + "type": "heading-two", + "nodes": [ + { + "type": "text", + "ranges": [ + { + "text": "Try it out!" + } + ] + } + ] + }, + { + "type": "paragraph", + "nodes": [ + { + "type": "text", + "ranges": [ + { + "text": "Try it out for yourself! Try starting a new line with \">\", \"-\", or \"#\"s." + } + ] + } + ] + } + ] +} diff --git a/examples/basic/index.css b/examples/basic/index.css deleted file mode 100644 index 3a4e7ef3c..000000000 --- a/examples/basic/index.css +++ /dev/null @@ -1,24 +0,0 @@ - -html { - background: #eee; - padding: 20px; -} - -main { - background: #fff; - padding: 10px; - max-width: 40em; - margin: 0 auto; -} - -p { - margin: 0; -} - -pre { - margin: 0; -} - -main * + * { - margin-top: 1em; -} diff --git a/examples/basic/index.html b/examples/basic/index.html deleted file mode 100644 index d0026b102..000000000 --- a/examples/basic/index.html +++ /dev/null @@ -1,11 +0,0 @@ - -
- -
-
- {props.children}
-
-
- )
- }
- }
- case 'paragraph': {
- return (props) => {
- return (
- - {props.children} -
- ) - } - } - } - } - - renderMark(mark) { - switch (mark.type) { - case 'bold': { - return { - fontWeight: 'bold' - } - } - } - } - -} - -/** - * Attach. - */ - -const app =