mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-28 09:29:49 +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.
|
# Remove the generated files.
|
||||||
clean:
|
clean:
|
||||||
@ rm -rf ./dist
|
@ rm -rf ./dist ./node_modules
|
||||||
|
|
||||||
# Build the source.
|
# Build the source.
|
||||||
dist: $(shell find ./lib) package.json
|
dist: $(shell find ./lib) package.json
|
||||||
|
@@ -54,6 +54,32 @@ class Editor extends React.Component {
|
|||||||
this.setState({ state: this.resolveState(props.state) })
|
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`.
|
* Get the editor's current `state`.
|
||||||
*
|
*
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "git://github.com/ianstormtaylor/slate.git",
|
"repository": "git://github.com/ianstormtaylor/slate.git",
|
||||||
"main": "./lib/index.js",
|
"main": "./dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublish": "make dist",
|
"prepublish": "make dist",
|
||||||
"test": "make check"
|
"test": "make check"
|
||||||
|
Reference in New Issue
Block a user