#31373 closed task (blessed) (fixed)
Revamp Press This
Reported by: | michael-arestad | Owned by: | azaozz |
---|---|---|---|
Milestone: | 4.2 | Priority: | normal |
Severity: | normal | Version: | 4.2 |
Component: | Press This | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
This will be used as the master tracking ticket for the Press This Revamp feature plugin, which has been approved for merge in the 4.2 release.
- GitHub Repo: https://github.com/MichaelArestad/Press-This
- Plugin Page: https://wordpress.org/plugins/press-this/
Attachments (18)
Change History (84)
#3
@
10 years ago
Tickets that can be modified once this is merged in:
Fixed:
#16922 - PT needs a class for the source attribution
#16935 - Selected text wrapped in blockquote
#18937 - Style PT header like admin bar
#27529 - Update media icons
Need Reporter Feedback:
#16940 - Does the new bookmarklet cause problems for mod_security?
IMO wontfix:
#7605 - Ability to edit slug via PT pop-up
#14650 - PT to use post-new.php
Should get a response updated with where PT now stands and the future roadmap:
#26681 - Grab HTML with selected text
#30803 - Selected image not used as featured image
#28873 - Improve keyboard accessibility of adding PT JS
#26794 - Remove PT code from Settings->Writing
Remaining tickets, as of now:
#14164 - do_meta_boxes on PT page
#12017 - Add site selector for multisite to allow one bookmarklet to be used on any blog user has an acceptable role on.
#6
@
10 years ago
In 31373.patch: the plugin converted to a core patch (160KB...). Still some things to iron out/decide.
#7
@
10 years ago
@drewapicture: your version of the patch is at least missing src/wp-admin/js/bookmarklet.js
, which leads to the following when someone drags the bookmarklet to their bookmark bar:
https://src.wordpress-develop.dev/wp-admin/%3Cbr%20/%3E%3Cb%3EWarning%3C/b%3E:%20%20file_get_contents( /srv/www/wordpress-develop/src/wp-admin/js/bookmarklet.js):%20failed%20to%20open%20stream:%20No%20such %20file%20or%20directory%20in%20%3Cb%3E/srv/www/wordpress-develop/src/wp-includes/link-template.php%3C /b%3E%20on%20line%20%3Cb%3E2640%3C/b%3E%3Cbr%20/%3Ejavascript:
#8
@
10 years ago
@azaozz: your version works great!
Couple of things to think about:
- will have to tweak the logic that leads to the "you should upgrade your bookmarklet" notice, as it seems to show at al times now, despite having the right version: https://cloudup.com/cixoVM9Ar2K
- the tools.php screen could now use a design pass altogether to make its sections more consistent: https://cloudup.com/cGePU4Ai5eA
#9
@
10 years ago
Upgrade notice: the culprit is !==
and different types between data.v
and data._version
.
Using parseInt()
when comparing them makes the problem go away.
src/wp-admin/js/press-this.php
-> L640 (in 31373.patch):
// Prompt user to upgrade their bookmarklet if there is a version mismatch. if ( data.v && data._version && parseInt( data.v ) !== parseInt( data._version ) ) {
#10
@
10 years ago
In 31373.4.patch: some css fixes/enhancements for the Tools screen by @michael-arestad.
This ticket was mentioned in Slack in #core by azaozz. View the logs.
10 years ago
#12
@
10 years ago
I've already found a few bugs. I created tickets against trunk in the Press This component. The titles are prefixed with "Press This:".
Tab order bug in Safari
Black border in IE
Convert categories list to li because of major display bugs
More testing in a bit.
#21
@
10 years ago
Added patch for 31456 (which is an awesome number) that just adds a class to make alert styles work properly.
#25
@
10 years ago
Open question on styling of tools.php with the "new" style of the Press This area in #31462
#30
in reply to:
↑ 28
@
10 years ago
Replying to ocean90:
- Add missing actions for printing styles/scripts.
Not sure this is a good idea. Many plugins do many things in the admin. Actually was thinking we shouldn't fire any of the default admin actions but only Press This specific actions.
- Since
$hook_suffix
is null, hardcodepress-this.php
.
$hook_suffix
is set in wp-admin/admin.php
loaded from press-this.php
: https://core.trac.wordpress.org/browser/trunk/src/wp-admin/press-this.php#L12
If it is not set in some circumstances, we still need to set it globally as many plugins use it to determine when to output scripts/styles and some are probably looking at the global.
- Restore body classes, add filter.
Again, not sure that is "wise", at least not for all the body classes :) For example currently Press This doesn't support admin colors (the PT css is completely separate from the rest of wp-admin.css). Having a color class may trigger something we don't want. If a plugin adds something that triggers on a particular body class, and expects wp-admin.css to be loaded, it will fail and might affect Press This.
Was thinking we could/should move the HTML generation inside press-this.php, so it is inline with the rest of the admin "entry points" (the way it used to be). That means it will run directly in global scope, like the rest of wp-admin.
#31
@
10 years ago
Actually $hook_suffix
should never be null, admin.php
should always be loaded (in global scope) before calling WP_Press_This::html()
.
@
10 years ago
Cleans ip the use of unnecessary ( vartest && vartest.length )
in JS in press-this.php, as Ox did in bookmarklet.
@
10 years ago
Same as length-less.diff, but with ticket name in file (can't delete/overwrite other one, sorry)
@
10 years ago
Fixes a bug where we test for empty( $key )
, but $key can legitimately be 0
for the 1st key of an indexed array (_embed, _img).
@
10 years ago
Adds DailyMotion embed detection in non-DailyMotion pages (as we do for others). Will discover DM embeds on any site/page.
#40
@
10 years ago
Added 2 more small patches:
- 31373-empty-fix.diff: Tweaks an
empty()
test. - 31373-dailymotion.diff: Better DailyMotion embed support.
The equivalent of the length-less patches was committed in r31613.
@
10 years ago
Adds support for Youtube playlists (supported by editor as WP embed), on youtube.com or when iframe embed is found on target page.
#41
@
10 years ago
Added 31373-ytplaylists.diff to add support for Youtube playlists.
#45
@
10 years ago
Related: #31558.
In this ticket I've proposed a fix for an issue with duplicate initialization of tagBox
in wp-admin/js/tags-box.js
.
#46
@
10 years ago
In 31373.8.patch:
- Move filtering of the data from JS to PHP. No need to send all data to JS and filter it there, can send only useful data.
- Clean up the links passed from the bookmarklet. We are using only
canonical
, if found. - Load the suggested title and post content from PHP, no need to send to JS first.
#48
follow-up:
↓ 49
@
10 years ago
In 31373.9.patch: fixed few typos and inconsistencies, added bookmarklet.min.js so it can be tested easier (no need to run grunt precommit before updating the bookmarklet).
@
10 years ago
Same as 31373.9.patch, but with WP_Press_This::get_embeds()
fixed (needed to use $data['_embed']
, not $data['_embeds']
).
#49
in reply to:
↑ 48
@
10 years ago
Replying to azaozz:
In 31373.9.patch: fixed few typos and inconsistencies, added bookmarklet.min.js so it can be tested easier (no need to run grunt precommit before updating the bookmarklet).
See 31373.10.patch for a small fix to WP_Press_This::get_embeds()
.
#50
follow-up:
↓ 52
@
10 years ago
Alternatively, and maybe for the better, we could also standardize on the use of _embeds
and _images
for those keys everywhere (bookmarklet, app JS/PHP), instead of now _img
, _embed
, _images
, and _embeds
. We uglify the bookmarklet now, so we no longer need to save on characters there. :)
#52
in reply to:
↑ 50
@
10 years ago
Replying to stephdau:
...we could also standardize on the use of
_embeds
and_images
for those keys everywhere (bookmarklet, app JS/PHP), instead of now_img
,_embed
.
Right, good idea. Done in the commit. Also, thanks for the typo fixes :)
#53
@
10 years ago
We're having a problem with UTF-8 URLs: the characters are being stripped by sanitize_text_field()
in WP_Press_This::_limit_string()
right after the URL was html entity decoded, with UTF-8 compatibility, because WP_Press_This::_limit_url()
uses it.
So the URL http://tekartist.org/2015/03/10/%e2%99%ab-phantogram-when-im-small-live-at-kexp/ becomes http://tekartist.org/2015/03/10/-phantogram-when-im-small-live-at-kexp/ after sanitization, which leads to a 404. The bookmarklet appears to work on that URL because it passes some valid meta data and does not fetch the source, but the attribution link is bad. If you use the same URL in the "Scan URL" form, the fetch fails altogether, for the same reason.
Should we consider not running sanitize_text_field()
on strings that look like URL?
Index: src/wp-admin/includes/class-wp-press-this.php =================================================================== --- src/wp-admin/includes/class-wp-press-this.php (revision 31694) +++ src/wp-admin/includes/class-wp-press-this.php (working copy) @@ -330,8 +330,10 @@ $return = $value; } - $return = html_entity_decode( $return, ENT_QUOTES, 'UTF-8' ); - $return = sanitize_text_field( trim( $return ) ); + $return = trim( html_entity_decode( $return, ENT_QUOTES, 'UTF-8' ) ); + if ( ! preg_match( '/^https?:/', $return ) ) { + $return = sanitize_text_field( $return ); + } } return $return;
Or simply stop WP_Press_This::_limit_url()
from using WP_Press_This::_limit_string()
, since it starts with an is_string()
test?
Index: src/wp-admin/includes/class-wp-press-this.php =================================================================== --- src/wp-admin/includes/class-wp-press-this.php (revision 31694) +++ src/wp-admin/includes/class-wp-press-this.php (working copy) @@ -342,8 +342,6 @@ return ''; } - $url = $this->_limit_string( $url ); - // HTTP 1.1 allows 8000 chars but the "de-facto" standard supported in all current browsers is 2048. if ( mb_strlen( $url ) > 2048 ) { return ''; // Return empty rather than a trunacted/invalid URL
#54
@
10 years ago
Also added 2 small patches:
- 31373-wpcom-stats.diff: Better matching for WordPress.com stats gifs.
- 31373-better-embeds-and-docs.diff: Better Youtube URL matching, and better embed docs.
#59
follow-up:
↓ 60
@
9 years ago
Dont know where to ask. Sorry if it is wrong place.
Did you reconsider making it easy to change CSS style of Press This editor container ? (press-this-editor.css)
Wordpress is about web editors beginners. And I personally find it very scary that they are faced with one screen where they have to insert something publicly visible on their websites, but CSS style of text formatting is light years away from style of their websites.
#60
in reply to:
↑ 59
@
9 years ago
Replying to Stagger Lee:
Did you reconsider making it easy to change CSS style of Press This editor...
Not sure what you mean by "make it easy". It is as easy as using a filter to pass another stylesheet URL. You can use one of the specific Press This actions and add another URL with mce_css
. Something like this should work fine:
add_action( 'admin_head-press-this.php', 'my_pt_styles' ); function my_pt_styles() { add_filter( 'mce_css', 'my_press_this_editor_css' ); } function my_press_this_editor_css( $css ) { if ( ! empty( $css ) { $css .= ','; } $css .= plugins_url( 'my-subdir/my-pt-style.css', __file__ ); return $css; }
#61
@
9 years ago
Thak you. Will save snippet and use it. Best to link to editor style Advanced TinyMce plugin use, and both are done at once. Change path to theme root.
One more thing. Breaks and paragraphs in text. Can you bring it back and respect as it is on remote website ?
One question here is to be asked. Is it more harm done for look of post by few small problems on remote website, or it is more harm done by putting all text in one paragraph without any spacing. Think answer is oblivious, but it is just my personal opinion.
#62
@
9 years ago
One more thing. Breaks and paragraphs in text. Can you bring it back and respect as it is on remote website ?
I'm not sure I understand. Can you give an example?
#63
follow-up:
↓ 64
@
9 years ago
Let us say you want to copy one editorial from Guardian newspapper. When all in Press This is finished all text ends in just one paragraph. No breaks, no lines, no other paragraphs as on original remote website (post).
If you use TinyMce Advanced plugin and button in editor "Ad as text" or what it is called dont remember now, before pasting text. After text pasting all breaks and paragraphs from remote website are preserved.
Mathematically speaking it takes much, much, much less time to fix formatting when just copy/paste text from remote website, than when dealing with Press This.
#64
in reply to:
↑ 63
@
9 years ago
Replying to Stagger Lee:
Let us say you want to copy one editorial from Guardian newspapper. When all in Press This is finished all text ends in just one paragraph. No breaks, no lines, no other paragraphs as on original remote website (post).
@michaelarestad FWIW, I've seen this too. The formatting is correct in the Press This editor but once you make it over to the standard editor, all the formatting tags are in place but it's a giant block of text and markup with no line breaks or indentation. Haven't yet had a chance to track down where it's happening (it doesn't always).
#21551 was marked as a duplicate.