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

copying <dfn> into a list improperly duplicates tags #12

Closed
garretwilson opened this issue Jan 16, 2016 · 3 comments
Closed

copying <dfn> into a list improperly duplicates tags #12

garretwilson opened this issue Jan 16, 2016 · 3 comments

Comments

@garretwilson
Copy link

Let's say I start with the following list:

<ul>
  <li><dfn>bar</dfn></li>
</ul>

Let's say elsewhere I have the following paragraph:

<p>blah blah blah <dfn>foo</dfn> blah blah blah</p>

I then:

  1. Select <dfn>foo</dfn> in the WYSIWYG view and copy it.
  2. Go to the beginning of bar in the above list and hit Enter to create a new line.
  3. Paste the contents.

I expect to see this:

<ul>
  <li><dfn>foo</dfn></li>
  <li><dfn>bar</dfn></li>
</ul>

But what I actually get is this:

<ul>
  <li><dfn>foo</dfn><br />
    <dfn></dfn></li>
  <li><dfn>short-circuiting</dfn></li>
</ul>

This messy stuff happens all over the place when I am working with lists.

Note that the Markup Cleaner tool does not remove the extra <br /> tags. See #9.

@therealglazou
Copy link
Owner

A few things here...

  1. I don't see the <br /> elements you're mentioning
  2. if you place the caret at the begin of bar, you're in effect placing the collapsed selection INSIDE the dfn element and before the first character. So you end with two nested dfn elements. According to the HTML document model, this is wrong. But we have no way to allow pasting and be model-compliant here, hence the result.

To paste your <dfn>foo</dfn> correctly, place the caret inside the other dfn element, hit the ESC key to select the whole element and then the left arrow key to place the selection BEFORE the element (and not inside it like above).

Closing as there is nothing I can do here.

@garretwilson
Copy link
Author

Closing as there is nothing I can do here.

There is indeed something you can do here. Add the rule: "if the cursor is at the beginning of a series of inline elements and the user hits Enter, don't create a whole list of empty inline elements, as it is obvious that the user wants the newline to take place before them."

That is, if I my cursor is here:

<li><dfn><code><span>|foobar

If I hit Enter, it is obvious that I want to create this:

<li>
<li><dfn><code><span>|foobar...

and not

<li><dfn><code><span></span></code></dfn><br/>
  <dfn><code><span>|foobar...</li>

@garretwilson
Copy link
Author

To paste your foo correctly, place the caret inside the other dfn element, hit the ESC key to select the whole element and then the left arrow key to place the selection BEFORE the element (and not inside it like above).

Ah, that's a very good tip. Thanks. It seems to be working; I'll keep testing it. (Still the suggestion I indicated above could make it all more user friendly.)

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