In certain cases, the backspace key becomes ineffective, which may be related to different methods of Selection

I attempted to build a prosemirror editor, but when my cursor is reset to the end of the doc, the backspace key cannot be used. Kapture 2024-11-14 at 18.22.57

// ineffective code
import './index.css';

import { Editor, } from '../../src/editor';
import { SchemaV1 } from '../../src/editor/schema/v1';
import { Selection } from "@tiptap/pm/state"

const app = document.querySelector('#root')!
const editorDom = document.createElement('div')
app.appendChild(editorDom)

const editor = new Editor(editorDom, SchemaV1)
  .setContent('abcd')

editorDom.addEventListener("click", () => {
  const sel = Selection.atEnd(editor.view.state.doc)
  console.log(sel)
  // debugger
  editor.setSelection(sel)
  console.log(editor.view.state.toJSON())
})

However, if I only change the export location of Selection, exporting Selection from my packaged package (which may mean using the same Selection constructor as the package), at this time, the backspace is effective. Kapture 2024-11-14 at 18.27.15

// effective code
import './index.css';

import { Editor, Selection } from '../../src/editor';
import { SchemaV1 } from '../../src/editor/schema/v1';
// import { Selection } from "@tiptap/pm/state"

const app = document.querySelector('#root')!
const editorDom = document.createElement('div')
app.appendChild(editorDom)

const editor = new Editor(editorDom, SchemaV1)
  .setContent('abcd')

editorDom.addEventListener("click", () => {
  const sel = Selection.atEnd(editor.view.state.doc)
  console.log(sel)
  // debugger
  editor.setSelection(sel)
  console.log(editor.view.state.toJSON())
})

reproduction url

git@github.com:miaobuao/prosemirror-setSelection-reproduction.git