-
-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected behavior in node view where this.dom
a bare div
#1505
Comments
Your node types don't seem to have any parse rules associated with them at all. You're going to want your document to be representable as HTML, and parseable from HTML. |
Oh, they do in our application, I just omitted from the repro example. Here's an updated one with parseDOM & toDOM included in the node specs: https://jsfiddle.net/hct596jb/6/ |
What appears to be happening is that that Chrome 'normalizes' out the attribute-less I recommend just putting on that class name. We do rely on the native backspace implementation, and when that does weird things, working around them is more or less the only option. |
👍 thanks for the quick response and for taking a look. |
I have a node view whose
dom
looks like this:with
contentDOM
equal to theclass=content
child node. The node this is used for contains rich text (essentiallyblock+
). I'm seeing very strange behavior: if there are two paragraphs in the node, with the second having a single character, then deleting that character causes a very incorrect change to the document.Some observations:
div
seems to prevent the unexpected behavior.For my purposes, I think 4 is probably going to be sufficient to fix the issue (and really, having a class name on that node is better for me anyway). But I wanted to report it in case this is revealing an issue where an unusual-but-correct set of mutations--or a bug in Safari and Chrome's MutationObserver implementation?--aren't getting handled correctly in ProseMirror.
Minimal repro: https://jsfiddle.net/t1wh7543/17/
(here's the repro code in case the link doesn't work)
const mySchema = new prosemirrorModel.Schema({ nodes: { doc: { content: "section+" }, section: { content: "paragraph+" }, paragraph: { content: "text*", toDOM: () => ["p", 0] }, text: { inline: true }, }, marks: { strong: { toDOM: () => ["b", { contenteditable: false }, 0], parseDOM: [{ tag: "b" }], }, }, })
The text was updated successfully, but these errors were encountered: