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

Get rid of the wrapper() method #2

Open
hanspagel opened this issue Jan 25, 2022 · 1 comment
Open

Get rid of the wrapper() method #2

hanspagel opened this issue Jan 25, 2022 · 1 comment
Assignees

Comments

@hanspagel
Copy link
Contributor

I’d like to get rid of the wrapper() method. It’s used - for example - to move the content of list items in a paragraph.

I’m afraid we’d need to add broad support for the content attribute from ProseMirror to achieve that though.

@Coding-Kiwi
Copy link

Coding-Kiwi commented May 13, 2023

I'm not sure but I think the wrapper causes some issues for me. I'm currently trying to migrate from html to tiptap doc and when I try to import html with nested lists stuff breaks.

Given a nested list:

<ul>
  <li>
    <p>This is a test</p>
    <ul>
     <li>Subitem</li>
   </ul>
  </li>
</ul>

The wrapper adds a paragraph because the childnodelength is no longer 1:

<ul>
  <li>
    <p> <-- added
    <p>This is a test</p>
    <ul>
      <li>Subitem</li>
    </ul>
    </p> <-- added
  </li>
</ul>

When I convert this to a doc json and load it into the frontend tiptap it works but as soon as I edit the list, all subitems are merged into a single paragraph and I get Invalid content for node paragraph errors

I disabled the wrapper and now I have no problems

class CustomExtensionextends Extension {
    public static $name = 'custom';

    public function addExtensions() {
        return [
            new CustomListItem (),
        ];
    }
}

class CustomListItem extends ListItem {
    public static function wrapper($DOMNode) {
        return null;
    }
}

new Editor([
            "extensions" => [
                new CustomExtension(),
                new StarterKit([
                    "listItem" => false
                ])
            ]
]);

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

2 participants