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:
2
Makefile
2
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
|
||||
|
@@ -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`.
|
||||
*
|
||||
|
@@ -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"
|
||||
|
Reference in New Issue
Block a user