From d4b003862df570e3654f0e36fc8a02a3d0ba4a9f Mon Sep 17 00:00:00 2001 From: themithy <11431578+themithy@users.noreply.github.com> Date: Mon, 19 Aug 2019 18:03:49 +0200 Subject: [PATCH] Add point normalization to addAnnotation. (#2914) --- packages/slate/src/models/value.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/slate/src/models/value.js b/packages/slate/src/models/value.js index 41bb47b05..f74414fc0 100644 --- a/packages/slate/src/models/value.js +++ b/packages/slate/src/models/value.js @@ -429,8 +429,9 @@ class Value extends Record(DEFAULTS) { addAnnotation(annotation) { annotation = Annotation.create(annotation) let value = this - let { annotations } = value + let { annotations, document } = value const { key } = annotation + annotation = annotation.updatePoints(point => point.normalize(document)) annotations = annotations.set(key, annotation) value = value.set('annotations', annotations) return value