From 4558ad639473035f59209e73711fc98b1661bd08 Mon Sep 17 00:00:00 2001 From: Max Reynolds Date: Tue, 2 Mar 2021 09:49:37 +0000 Subject: [PATCH] Constrain `from` to non-negative numbers Fix #954 --- packages/tiptap/src/Plugins/MenuBubble.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tiptap/src/Plugins/MenuBubble.js b/packages/tiptap/src/Plugins/MenuBubble.js index 24351d4905..1964df4e59 100644 --- a/packages/tiptap/src/Plugins/MenuBubble.js +++ b/packages/tiptap/src/Plugins/MenuBubble.js @@ -3,7 +3,7 @@ import { Plugin, PluginKey } from 'prosemirror-state' function textRange(node, from, to) { const range = document.createRange() range.setEnd(node, to == null ? node.nodeValue.length : to) - range.setStart(node, from || 0) + range.setStart(node, Math.max(from, 0)) return range }