Skip to content

Commit 427b77c

Browse files
committed
Stop calling onSave callback in onBlur. Fix #173
1 parent 40c15ef commit 427b77c

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
55
## Unreleased
66

7+
### Fixed
8+
9+
- Stop unnecessarily calling `onSave` in the editor’s `onBlur` ([#173](https://github.com/springload/draftail/issues/173)).
10+
711
## [[v1.0.0]](https://github.com/springload/draftail/releases/tag/v1.0.0)
812

913
> This release is functionally identical to the last one, `v0.17.2`.

lib/components/DraftailEditor.js

-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ class DraftailEditor extends Component {
114114
this.setState({
115115
hasFocus: false,
116116
});
117-
118-
this.saveState();
119117
}
120118

121119
onTab(event) {

lib/components/DraftailEditor.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ describe("DraftailEditor", () => {
417417
expect(wrapper.state("hasFocus")).toBe(false);
418418
});
419419

420-
it("onBlur calls onSave", () => {
420+
it("onBlur does not call onSave (#173)", () => {
421421
const onSave = jest.fn();
422422
const wrapper = shallowNoLifecycle(<DraftailEditor onSave={onSave} />);
423423

@@ -435,7 +435,7 @@ describe("DraftailEditor", () => {
435435
wrapper.instance().onChange(editorState);
436436

437437
wrapper.instance().onBlur();
438-
expect(onSave).toHaveBeenCalled();
438+
expect(onSave).not.toHaveBeenCalled();
439439
});
440440

441441
it("onTab", () => {

0 commit comments

Comments
 (0)