From c63b9aafc94a9b22e3fc888f6e09dac64b0afa41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Tue, 12 Feb 2019 22:22:56 +0100 Subject: [PATCH] add blur function, fix #196 --- README.md | 5 +++-- packages/tiptap/src/Editor.js | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b5c68ac8..45818d7f 100644 --- a/README.md +++ b/README.md @@ -87,8 +87,9 @@ export default { | `registerPlugin` | `plugin` | Register a Prosemirror plugin. | | `getJSON` | – | Get the current content as JSON. | | `getHTML` | – | Get the current content as HTML. | -| `focus` | — | Focus the editor | -| `destroy` | – | Destroys the editor. | +| `focus` | – | Focus the editor. | +| `blur` | – | Blur the editor. | +| `destroy` | – | Destroy the editor. | ## Components diff --git a/packages/tiptap/src/Editor.js b/packages/tiptap/src/Editor.js index b4315658..3b6b3ca4 100644 --- a/packages/tiptap/src/Editor.js +++ b/packages/tiptap/src/Editor.js @@ -298,6 +298,10 @@ export default class Editor { this.view.focus() } + blur() { + this.view.dom.blur() + } + getHTML() { const div = document.createElement('div') const fragment = DOMSerializer