WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 5 years ago

#23299 closed defect (bug) (fixed)

Definition List in Editor

Reported by: gputignano Owned by: katieburch
Milestone: 4.5 Priority: low
Severity: minor Version: 2.2
Component: Editor Keywords: has-patch good-first-bug commit
Focuses: Cc:

Description

After switch from Text to Visual and then from Visual to Text the formatting of the definition list is lost.

Attachments (3)

23299.patch (1.3 KB) - added by ocean90 8 years ago.
23299.2.patch (1.3 KB) - added by ocean90 8 years ago.
23299.diff (1.0 KB) - added by katieburch 5 years ago.

Download all attachments as: .zip

Change History (16)

@ocean90
8 years ago

#1 follow-up: @ocean90
8 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 3.6
  • Severity changed from major to normal
  • Version changed from 3.5 to 2.2

Input:

<dl>
<dt>Foo</dt>
<dd>Bar Foo Bar</dd>
</dl>

Expected output:

<dl>
	<dt>Foo</dt>
	<dd>Bar Foo Bar</dd>
</dl>

Actual output:

<dl><dt>Foo</dt><dd>Bar Foo Bar</dd></dl>

---

The expected output comes from the output of an (un)ordered list. So we should be able to do the same for definition lists.

23299.patch adds just the new line for each element. Seems like the tab indention is handled in TinyMCE; azaozz, help?

#2 in reply to: ↑ 1 ; follow-up: @ocean90
8 years ago

Replying to ocean90:

Seems like the tab indention is handled in TinyMCE; azaozz, help?

Strike that. Done in 23299.2.patch.

@ocean90
8 years ago

#3 in reply to: ↑ 2 @azaozz
8 years ago

  • Keywords needs-testing added
  • Priority changed from normal to low
  • Severity changed from normal to minor

Strike that. Done in 23299.2.patch.

Yep, HTML white space in the Text editor is controlled by pre_wpautop(). However the changes there are permanent, post_content is saved exactly as shown (whether the user switches to the Text editor or not) so any changes there will affect the PHP wpautop() and how the content is displayed on the front-end.

In this particular case nothing seems to break. Note that <dl> is not handled in TinyMCE by default, pasting <dl> in the Text editor and trying to edit it from the Visual editor won't work well. There is a TinyMCE plugin that handles it but it's not included by default.

#4 @ocean90
7 years ago

  • Milestone changed from 3.6 to Future Release
  • Type changed from defect (bug) to enhancement

#5 @ocean90
6 years ago

Related: #28939

#6 @iseulde
6 years ago

  • Type changed from enhancement to defect (bug)

#7 @swissspidy
5 years ago

  • Keywords needs-refresh added; needs-testing removed

#8 @swissspidy
5 years ago

  • Keywords good-first-bug added

Patch doesn't apply cleanly anymore as the wp-admin/js/editor.js has changed a bit over the year.

#9 @voldemortensen
5 years ago

  • Owner set to katieburch
  • Status changed from new to assigned

@katieburch
5 years ago

#10 @katieburch
5 years ago

  • Keywords needs-refresh removed

Refreshed patch

This ticket was mentioned in Slack in #core by voldemortensen. View the logs.


5 years ago

#12 @swissspidy
5 years ago

  • Keywords commit added
  • Milestone changed from Future Release to 4.5

Just tested 23299.diff.

Input:

<dl>
<dt>Foo</dt>
<dd>Bar Foo Bar</dd>
</dl>

Actual output:

<dl>
	<dt>Foo</dt>
	<dd>Bar Foo Bar</dd>
</dl>

Conclusion: It works like a charm.

#13 @swissspidy
5 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 35999:

Editor: Correctly indent definition lists when switching from the visual to the text editor.

Props ocean90, katieburch.
Fixes #23299.

Note: See TracTickets for help on using tickets.