From 806ffc38df872a30aa65d0a092039071cf4689ac Mon Sep 17 00:00:00 2001 From: Ian Storm Taylor Date: Mon, 11 Jul 2016 16:44:37 -0700 Subject: [PATCH] add blur/focus, add dist --- Makefile | 2 +- lib/components/editor.js | 26 ++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ca2be86de..caa6f6992 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ check: lint test # Remove the generated files. clean: - @ rm -rf ./dist + @ rm -rf ./dist ./node_modules # Build the source. dist: $(shell find ./lib) package.json diff --git a/lib/components/editor.js b/lib/components/editor.js index 7398a9933..4d917dd7e 100644 --- a/lib/components/editor.js +++ b/lib/components/editor.js @@ -54,6 +54,32 @@ class Editor extends React.Component { this.setState({ state: this.resolveState(props.state) }) } + /** + * Blur the editor. + */ + + blur = () => { + const state = this.state.state + .transform() + .blur() + .apply() + + this.onChange(state) + } + + /** + * Focus the editor. + */ + + focus = () => { + const state = this.state.state + .transform() + .focus() + .apply() + + this.onChange(state) + } + /** * Get the editor's current `state`. * diff --git a/package.json b/package.json index 4f1cb06d5..ec4fa0d49 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "license": "MIT", "repository": "git://github.com/ianstormtaylor/slate.git", - "main": "./lib/index.js", + "main": "./dist/index.js", "scripts": { "prepublish": "make dist", "test": "make check"