From 4cb13ee5cac43df6c7ebdb9b9bdf987009fd5399 Mon Sep 17 00:00:00 2001 From: Velten Heyn Date: Thu, 25 Apr 2019 02:16:41 +0200 Subject: [PATCH] Add path to Range Points (#2537) * Add path to Range Points Otherwise https://github.com/ianstormtaylor/slate/blob/5d0f53da3ffd6016b779551c065fdc874ea4baf7/packages/slate-react/src/components/text.js#L122 crashes * Make prettier happy * prettier knows what prettier knows So shut up and delete the fucking whitespace ;) --- packages/slate-react-placeholder/src/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/slate-react-placeholder/src/index.js b/packages/slate-react-placeholder/src/index.js index e2649abd3..628692f34 100644 --- a/packages/slate-react-placeholder/src/index.js +++ b/packages/slate-react-placeholder/src/index.js @@ -48,11 +48,16 @@ function SlateReactPlaceholder(options = {}) { } const others = next() + const document = editor.value.document const first = node.getFirstText() const last = node.getLastText() const decoration = { - anchor: { key: first.key, offset: 0 }, - focus: { key: last.key, offset: last.text.length }, + anchor: { key: first.key, offset: 0, path: document.getPath(first.key) }, + focus: { + key: last.key, + offset: last.text.length, + path: document.getPath(last.key), + }, mark: placeholderMark, }