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

Bug - Removing multiple list-items removes markup from other lists #4837

Open
ppdeblieck opened this Issue Feb 18, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@ppdeblieck
Copy link

ppdeblieck commented Feb 18, 2019

When removing multiple list-items by making a selection and pressing backspace or delete on the keyboard the markup is changed in other nested lists (li-items are removed) and the style="list-style-type: none;" attribute is added.

Example: http://fiddle.tinymce.com/uCgaab/2

List with the following markup:

<ol>
    <li>
        <ol>
            <li>AA</li>
        </ol>
    </li>
    <li>
        <ol>
            <li>BA</li>
        </ol>
    </li>
</ol>

After removing a selection in the first list the nested list will become:

<ol>
    <li style="list-style-type: none;">
        <ol>
            <li>AA</li>
        </ol>
        <ol>
            <li>BA</li>
        </ol>
    </li>
</ol>

I've tests in the 4.* and the 5.* versions of TinyMCE in Chrome, Firefox, Internet Explorer and Edge. Every version seems to be affected.

@SimonFc

This comment has been minimized.

Copy link
Contributor

SimonFc commented Feb 18, 2019

This is by design although it shouldn't be a problem to make the lists plugin not apply the styling if this behavior is needed. In what scenario does this become a problem? (You wouldn't be able to create the list you give as an example using Tiny)

@ppdeblieck

This comment has been minimized.

Copy link
Author

ppdeblieck commented Feb 18, 2019

I don't know exactly how the html was created, but I noticed this issue when making some textual adjustments in it. When editing (valid) html removing a list-item at one place should never destroy other unrelated html.

Trying to create the markup in Tiny I noticed a similar/related issue. Go to the example http://fiddle.tinymce.com/uCgaab/2, place your cursor in List 1, before A and click the "Increase indent"-button. Result is that the first <li> becomes <li style="list-style-type: none;">

@SimonFc

This comment has been minimized.

Copy link
Contributor

SimonFc commented Feb 18, 2019

Yeah you can set the content of the editor directly to be a certain way but it's nothing that can be created using the interface.

Insert text -> Insert list -> Indent creates the following html for me:

<ol>
  <li style="list-style-type: none;">
    <ol>
      <li>AA</li>
      <li>BA</li>
    </ol>
  </li>
</ol>

Neither Docs nor Word style the "outmost" items when you're identing more than one level. Granted, they're doing it in another way(with Docs using divs instead of actual lists/list items), but the visual result is the same.

It would be strange to have a list displayed as

1.  1. AA
    2. BA

instead of

    1. AA
    2. BA

What you see as Tiny destroying unrelated html is a normalization process done by the lists plugin. I shall see if there might be some changes we would want to make to this but as far as normal usage goes I think it's already close to what an end-user would expect?
@ppdeblieck

This comment has been minimized.

Copy link
Author

ppdeblieck commented Feb 19, 2019

I tried, and came up with a way to create the initial example using Tiny.

See http://fiddle.tinymce.com/wCgaab

  • Place cursor on the empty line 1
  • Make a text selection by holding shift + right arrowkey
  • Press spacebar
  • Result is a ordered list only containing another ordered list

Start

<ol>
	<li><br />
		<ol>
			<li>B</li>
			<li>C</li>
		</ol>
	</li>
	<li><br />
		<ol>
			<li>E</li>
			<li>F</li>
		</ol>
	</li>
</ol>

Result (
's are removed)

<ol>
	<li>
		<ol>
			<li>B</li>
			<li>C</li>
		</ol>
	</li>
	<li>
		<ol>
			<li>E</li>
			<li>F</li>
		</ol>
	</li>
</ol>

It is strange however when you modify another list by deleting some list-items a completely unralated list is also affected. An end user can expect that the element he/she is editing will be modified; a completely different element at the bottom of the same page doesn't seem like wanted behaviour.

@SimonFc

This comment has been minimized.

Copy link
Contributor

SimonFc commented Feb 19, 2019

@ppdeblieck
I have looked at it closer now and the normalization behavior of applying list-style-type: none; (and modifying the structure) will remain unless there's a use case that warrants something else. With it affecting "unrelated content" is just the result of normalizing something that was incorrect in the first place - there's a lot of work like this going on in Tiny.

This means that, yes, the example you gave now is a bug. We're going to rework the lists plugin in the near future and I shall see if we can make the normalization process capture this scenario as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.