1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-27 09:04:31 +02:00

add blur/focus, add dist

This commit is contained in:
Ian Storm Taylor
2016-07-11 16:44:37 -07:00
parent 114d712d19
commit 806ffc38df
3 changed files with 28 additions and 2 deletions

View File

@@ -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

View File

@@ -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`.
*

View File

@@ -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"