therealglazou / bluegriffon

BlueGriffon, the Web editor
Mozilla Public License 2.0
303 stars 72 forks source link

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

Closed garretwilson closed 8 years ago

garretwilson commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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 commented 8 years ago

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.)