Skip to content
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

Deserialization results in broken plugin functionality #33

Open
barrymun opened this issue May 8, 2019 · 0 comments
Open

Deserialization results in broken plugin functionality #33

barrymun opened this issue May 8, 2019 · 0 comments

Comments

@barrymun
Copy link

barrymun commented May 8, 2019

When deserializing some html so that it can be used with a slatejs editor inner list-items are lost. Using the following sample html:

<ol>
  <li>
    one
    <ol>
      <li>
         two
      </li>
    </ol>
  </li>
</ol>

Here, the ordered list within the list-item containing "one" will be lost as this seems to be part of the slate architecture.

Looking at the above sample code, wrapping the "one" in a div (as part of the deserialization process) will preserve the inner ordered list, but now the list slate-list-plugin will not work as intended - the plugin will not allow you to add or remove new list-items and does not seem to recognize the structure as a list because the inner list-item "two" will now also be wrapped in a div.

When loading some Value like the following into the editor, however, everything works as intended and the above issue is not encountered (like in the example):

{"object":"value","document":{"object":"document","data":{},"nodes":[{"object":"block","type":"ordered-list","data":{},"nodes":[{"object":"block","type":"list-item","data":{},"nodes":[{"object":"block","type":"list-item-child","data":{},"nodes":[{"object":"text","leaves":[{"object":"leaf","text":"one","marks":[]}]}]},{"object":"block","type":"ordered-list","data":{},"nodes":[{"object":"block","type":"list-item","data":{},"nodes":[{"object":"block","type":"list-item-child","data":{},"nodes":[{"object":"text","leaves":[{"object":"leaf","text":"two","marks":[]}]}]}]}]}]}]}]}}

Was looking through the codebase for a sample deserialization method but could not find one, but this seems to be an issue with deserialization.

@barrymun barrymun changed the title Deserialization results in the loss of an inner list item Deserialization results in broken plugin functionality May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant