Issues with gapCursor

Hello!

I’m currently working on an extension (3 new node types in fact) and having issues with gapCursor. Here’s more details on my setup:

Let’s call my extensions:

  • wrapper (content: ‘header panel’)
  • header (content: ‘block*’)
  • panel (content: ‘block*’)

I’m using latest tiptap2 packages.

When inserting new content, it’s like this:

{
  type: 'wrapper',
  content: [
    {
      type: 'header',
      content: ...
    },
    {
      type: 'panel',
      content: ...
    },
  ],
}

All node types have the following properties:

  • isolating: true
  • allowGapCursor: false
  • selectable: false

My issue is that in 3 different scenarios, I’m still getting a gapCursor (even if allowGapCursor is false), but as soon as this gapCursor appears, it breaks the editor, everything stops working, I need to reload to fix it. These scenarios are:

  • If my wrapper node is the first node of the document and I do “arrow up” or “arrow left”
  • If my wrapper node is the last node of the document and I try to go further down
  • If I have 2 consecutive wrapper nodes, when traversing from one to the other using the arrows

When the editor breaks, I get the following trace

index.es.js?576a:1127 Uncaught TypeError: this.widget.type.destroy is not a function
    at WidgetViewDesc.destroy (index.es.js?576a:1127)
    at ViewTreeUpdater.destroyBetween (index.es.js?576a:1762)
    at ViewTreeUpdater.updateNextNode (index.es.js?576a:1877)
    at eval (index.es.js?576a:1341)
    at iterDeco (index.es.js?576a:1990)
    at NodeViewDesc.updateChildren (index.es.js?576a:1325)
    at NodeViewDesc.updateInner (index.es.js?576a:1421)
    at NodeViewDesc.update (index.es.js?576a:1413)
    at EditorView.updateStateInner (index.es.js?576a:5026)
    at EditorView.updateState (index.es.js?576a:4978)

anyone have an idea about what I’m doing wrong / what I can do to fix this?

Thanks a lot!

Could you set up a minimal example script that I can use to reproduce this error?

Hello,

After some testing, I can tell that the issue occurs when “isolating” is “true”. If this is false, no gapCursor issues. I’m wondering if this can be caused by the fact that I’m within node-view-wrapper nodes (vue2) …?

For now, I went around the issue by keeping isolating to false and implementing isolating for my extension by myself (using addKeyboardShortcuts)

I’ll still try to make a codepen to reproduce the issue as I’d like to know the real issue behind that.

Thanks!