question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MenuBubble: Error in v-on handler: "IndexSizeError: Failed to execute 'setStart' on 'Range'

See original GitHub issue

Describe the bug

using the editor-menu-bubble for adding a Link will result in the following error:

Error in v-on handler: "IndexSizeError: Failed to execute 'setStart' on 'Range': The offset 4294967295 is larger than the node's length (16)."

Steps to Reproduce / Codesandbox Example

Browser: Chrome (Google Chrome, Vivaldi):

      <div
        class="menububble"
        :class="{ 'is-active': menu.isActive }"
        :style="`left: ${menu.left}px; bottom: ${menu.bottom}px;`"
      >

        <form class="menububble__form" v-if="linkMenuIsActive" @submit.prevent="setLinkUrl(commands.link, linkUrl)">
          <input class="menububble__input" type="text" v-model="linkUrl" placeholder="https://" ref="linkInput" @keydown.esc="hideLinkMenu"/>
          <button class="menububble__button" @click="setLinkUrl(commands.link, null)" type="button">
            <icon name="remove" />
          </button>
        </form>

        <template v-else>
          <button
            class="menububble__button"
            @click="showLinkMenu(getMarkAttrs('link'))"
            :class="{ 'is-active': isActive.link() }"
          >
            <span>{{ isActive.link() ? 'Update Link' : 'Add Link'}}</span>
            <icon name="link" />
          </button>
        </template>

      </div>
    </editor-menu-bubble>

Screenshots

Screen Shot 2021-01-25 at 12 56 36

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:29 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
MarcelloTheArcanecommented, Mar 1, 2021

It’s an overflow issue, because Math.pow(2, 32) - 1 === 4294967295

Looking at the traces quickly, it seems like this function triggers it every time from is -1:

https://github.com/ueberdosis/tiptap/blob/3b8ba27cc8871a7b8949fc423a8335edf7f9c3c8/packages/tiptap/src/Plugins/MenuBubble.js#L3-L8

image

As -1 is truthy, I think you need to use Math.max(from, 0) or from > 0 ? from : 0 instead.

This may be a red herring of course!

5reactions
kevin-lynchcommented, Feb 17, 2021

Same problem here using these versions:

tiptap: 1.32.1 tiptap-commands: 1.17.1 tiptap-extensions: 1.35.1

The link is inserted correctly though.

If you downgrade to the following build versions and ensure you recompile all of your assets post downgrade, it should solve the issue.

tiptap @1.31.0 tiptap-extensions@1.34.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when trying to use setStart and setEnd on Range ...
Uncaught IndexSizeError: Failed to execute 'setEnd' on 'Range': The offset 2 is larger than or equal to the node's length (0). Here is...
Read more >
Failed to execute 'setStart' on 'Range': The offset 4294967295 ...
Uncaught IndexSizeError: Failed to execute 'setStart' on 'Range': The offset 4294967295 is invalid. at VeSelectionState.ve.SelectionState.
Read more >
Range.setStart() - Web APIs | MDN
The Range.setStart() method sets the start position of a Range.
Read more >
#12152 (Failed to execute 'setStart' on 'Range': The offset 2 is ...
In chrome it gives following error. Uncaught IndexSizeError: Failed to execute 'setStart' on 'Range': The offset 111 is larger than or equal to...
Read more >
TextView exception: Failed to execute 'setStart' on 'Range'
The following exception was recorded by our analytics 8 times in the last week, in Chrome: Uncaught IndexSizeError: Failed to execute ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found