ProseMirror / prosemirror

The ProseMirror WYSIWYM editor
http://prosemirror.net/
MIT License
7.62k stars 336 forks source link

liftListItem lifts items out from the same level into the new list #1306

Closed MRJCrunch closed 2 years ago

MRJCrunch commented 2 years ago

I still reproduce the issue https://github.com/ProseMirror/prosemirror/issues/793

It is the record from the https://prosemirror.net/examples/basic/

https://user-images.githubusercontent.com/17198997/187721126-882a15b3-b034-4af8-9910-33ef6045b116.mov

image

I use "prosemirror-schema-list": "1.2.0"

marijnh commented 2 years ago

Are you sure you're running liftListItem here? Because that menu item in example-setup is simply bound to lift.

MRJCrunch commented 2 years ago

Yes, in my project I use liftListItem and result is the same

marijnh commented 2 years ago

Can you submit a test case that can be added to test/test-commands.ts in the prosemirror-schema-list repository that demonstrates this issue? I tried to create one from your screencast, but the command behaved as intended there.

MRJCrunch commented 2 years ago

I've created a test case here: https://github.com/ProseMirror/prosemirror-schema-list/pull/9

So from my point of view lifting the list from this state image

<ol>
  <li>
    <p>a</p>
    <ol>
      <li>
        <p>b</p>     <!-- lift this node -->
        <ol>
          <li>
            <p>c</p>
          </li>
        </ol>
      </li>
      <li>
        <p>d</p>
      </li>
    </ol>
  </li>
  <li>
    <p>e</p>
  </li>
</ol>

should work like this image

<ol>
  <li>
    <p>a</p>
  </li>
  <li>
    <p>b</p>
    <ol>
      <li>
        <p>c</p>
      </li>
      <li>
        <p>d</p>
      </li>
    </ol>
  </li>
  <li>
    <p>e</p>
  </li>
</ol>

but it works like this image

<ol>
  <li>
    <p>a</p>
  </li>
  <li>
    <p>b</p>
    <ol>
      <li>
        <p>c</p>
      </li>
    </ol>
    <ol>
      <li>
        <p>d</p>
      </li>
    </ol>
  </li>
  <li>
    <p>e</p>
  </li>
</ol>
marijnh commented 2 years ago

Thanks, that clarified it. Attached patch should help.