From 4f1dfbc1ff6ed72adda54d5870fd04f2180862a0 Mon Sep 17 00:00:00 2001 From: Max Reynolds Date: Mon, 29 Mar 2021 20:07:28 +0100 Subject: [PATCH] Constrain `from` to non-negative numbers (#987) 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 24351d490..1964df4e5 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 }