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.

Bug: Invalid nodes nesting

See original GitHub issue

There’s an issue with copy-pasting when heading can end up nested into paragraphs. Same applies to all other sorts of invalid nesting (code block inside paragraph or list item, etc). Although we have several places assuming paragraph, heading, quote, code and list are either root-level children or nested into table cell, it’s not enforced in any way and you can replicate wrong nesting either by copy-pasting such content or by creating it via nodes api:

// Clipboard
<p><h1>Heading within paragraph</h1></p>
<ul>
  <li><h1>Heading within list</h1></li>
</ul>

...

// Api
$createParagraphNode().append(
  $createHeadingNode('h1').append(
    $createTextNode('Heading within paragraph')
  )
);

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
acywatsoncommented, Aug 19, 2022

Regarding the sanitization, what about a normalization API like slate’s? I’ve been looking for something like this myself, and it seems like it would benefit the core too.

About the problem of limiting functionality when putting this in the core, I guess it ties to the overarching question of how to make it more extendable and customizable. If there was a good system for that in place (I don’t know how that would look like), it wouldn’t be a big issue, and lexical could have sane defaults while still allowing for users to override and extend those defaults at will.

This is really interesting - especially this part:

https://docs.slatejs.org/concepts/11-normalizing#built-in-constraints

We actually share the majority of these constraints and it would be great to document them. I like the idea of generally being able to declare constraints or invariants and remediations for them through some API like this.

0reactions
thegreatercurvecommented, Nov 24, 2022

This should be fixed with schemas.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug: `validateDOMNesting` error produces wrong HTML ...
Client side rendering can work with improper tag nesting because the DOM apis do allow creating these invalid nestings "by hand" (with document....
Read more >
Why I'm getting Invalid NEST Error - Elasticsearch
Below is the error that I'm getting when trying to index, Invalid NEST response built from a unsuccessful low level call on POST: ......
Read more >
An invalid controller has been detected. Perhaps, one of ...
1 Answer 1 · I've just made a PR to improve the error message here: github.com/nestjs/nest/pull/10479 :) – Micael Levi. Oct 29 at...
Read more >
Db2 11 - コード - SQL エラー・コード
AN SQLSTATE OR SQLCODE VARIABLE DECLARATION IS IN A NESTED COMPOUND STATEMENT; -057. THE RETURN STATEMENT IN AN SQL FUNCTION MUST RETURN A...
Read more >
Invalid NEST response built from a unsuccessful (200) low ...
Elasticsearch .NET DocumentExists() returns error: Invalid NEST response built from a unsuccessful (200) low level call on HEAD.
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