ProseMirror / prosemirror

The ProseMirror WYSIWYM editor
http://prosemirror.net/
MIT License
7.62k stars 336 forks source link

Getting "Cannot read properties of null (reading 'nodeType')" when trying to do cntl+A, cntl+c and cntl+v #1488

Open Rsi-madhuri opened 2 days ago

Rsi-madhuri commented 2 days ago

Bug Description

When trying to do cntl+A, cntl+c and cntl+v in proseMirror editor. It is showing error- Cannot read properties of null (reading 'nodeType').

This is happening when I have header content which is non-editable and main content which is editable. When I try to do cntl+A, cntl+c and cntl+v. It is selecting only main content which is expected but throwing above error.

The issue is coming from prosemirror-model/dist/index.js file where inside renderSpec function where in line no 3393 if (structure.nodeType != null) return { dom: structure }; here structure is coming as null.

Browser Used

Chrome

Expected Behavior

When we do cntl+A, cntl+c and cntl+v, all selected text should be copied and pasted in editor instead of throwing error.

marijnh commented 2 days ago

here structure is coming as null.

That might be coming from your code. Have you tried reducing this to the minimal code needed to trigger it?