WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#31493 closed defect (bug) (fixed)

Press This: Remove classes from suggested blockquote and source

Reported by: Michael Arestad Owned by: azaozz
Milestone: 4.2 Priority: normal
Severity: normal Version: 4.2
Component: Press This Keywords: has-patch
Focuses: Cc:

Description

While I can see these classes being handy, we probably shouldn't keep them around.

Attachments (5)

31493.patch (959 bytes) - added by Michael Arestad 5 years ago.
31493.2.patch (1.2 KB) - added by kraftbj 5 years ago.
Refresh of patch after [31595]
31493.3.patch (3.2 KB) - added by kraftbj 5 years ago.
31493.4.patch (2.8 KB) - added by kraftbj 5 years ago.
Same as .3 except default to em instead of cite and removes unintentional inclusion of testing code from hello.php
31493.5.patch (2.7 KB) - added by azaozz 5 years ago.

Download all attachments as: .zip

Change History (13)

#1 @Michael Arestad
5 years ago

  • Keywords has-patch added

#2 @ocean90
5 years ago

A class for the source paragraph was requested in #16922.

#3 @Michael Arestad
5 years ago

I'm aware. I don't see a huge reason for Press This to add extra classes the full editor doesn't add. I don't think the majority would use it.

I'm also still on the fence for the cite tag since you can't remove it without hopping into the text editor and the cite tag's default styles tend to appear to be italic. Seems confusing.

#4 @kraftbj
5 years ago

Personally, I like the cite tag since it has a semantic purpose. The particular classes, hearing feedback that it's a lot of cruft on the front end, can be dropped.

A middle ground: a filter, etc that would allow classes to be set if desired by a third-party plugin (noting that I haven't checked the current status of the code and what filters have already been added).

#5 @danielbachhuber
5 years ago

Could we have a filter for the entirety of the default text? Something like:

$default_text = apply_filters( 'press_this_default_text', $default_text, $all_variables );

I'd like to be able to keep my current format.

A stretch goal would be a filter for the sniffing action too — Fusion would like to reuse Press This for our quote, link, and note custom post types.

@kraftbj
5 years ago

Refresh of patch after [31595]

@kraftbj
5 years ago

#6 @kraftbj
5 years ago

31493.3 acknowledges @danielbachhuber point of a "legacy" mode:

* Renames `press_this_suggested_html` filter to `press_this_suggested_source_html`.
* Adds `press_this_suggested_default_html` filter to modify the wrapper/html associated with the blockquote.
* Continues the original patch of removing the default classes on both items.

"Legacy" mode could be done via a couple of filters, e.g.

add_filter( 'press_this_suggested_default_html', 'bk_pt_legacy_default' );
function bk_pt_legacy_default() {
$default_html = '';
return $default_html;
}

add_filter( 'press_this_suggested_source_html', 'bk_pt_legacy_source' );
function bk_pt_legacy_source() {
$source_html = '<a href="%1$s">%2$s</a>';
return $source_html;
}

@kraftbj
5 years ago

Same as .3 except default to em instead of cite and removes unintentional inclusion of testing code from hello.php

@azaozz
5 years ago

#7 @azaozz
5 years ago

  • Milestone changed from Awaiting Review to 4.2

In 31493.5.patch: use one filter for the suggested html in the editor, and an associative array as param.

#8 @azaozz
5 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 31601:

Press This:

  • Remove classes from suggested HTML for the editor.
  • Improve the filter, pass an associative array as param.
  • Use <em> instead of <cite>.

Props Michael-Arestad, kraftbj. Fixes #31493.

Note: See TracTickets for help on using tickets.