plate icon indicating copy to clipboard operation
plate copied to clipboard

List Bug with <p>

Open marcibk opened this issue 3 years ago • 2 comments

Hi there,

https://codesandbox.io/s/sandpack-project-forked-4lqprb?file=/App.tsx

Once you type in "1." and then delete the list is still there. On my local project I even get Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>.. Plate puts the list in a p tag then. The initial value of the editor is "[{ children: [{ text: '' }], type: "p"}]" . This problem only occurs on the first line of an empty editor. Once you press enter and write on the second line the problem is not existent anymore. Any help? Thanks :)

P-178

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar

marcibk avatar Nov 25 '22 14:11 marcibk

We also encountered this problem.

Our workaround was to place createResetNodePlugin() before createListPlugin() in the plugins array. But I would still consider it a bug because it is not very intuitive and not mentioned anywhere in the docs.

JannesMeyer avatar Nov 28 '22 11:11 JannesMeyer

Our workaround was to place createResetNodePlugin() before createListPlugin() in the plugins array. But I would still consider it a bug because it is not very intuitive and not mentioned anywhere in the docs.

I wonder if a good solution to this kind of problem would be to document plugin dependencies in the plugin system itself, throwing a warning at runtime if the dependencies aren't met?

Something like this:

const createMyPlugin = createPluginFactory({
  key: KEY_MY_PLUGIN,
  dependencies: {
    requires: [KEY_PLUGIN_1],
    incompatible: [KEY_PLUGIN_2],
    before: [KEY_PLUGIN_3],
    after: [KEY_PLUGIN_4],
  },
});

As another example, I have a custom plugin in my app that needs to go before the blockquote plugin (for some strange reason that I don't remember). 😆

12joan avatar Jul 07 '23 16:07 12joan