[wp-trac] [WordPress Trac] #27473: Thickbox width and height parameters are ignored when using TB_iframe
WordPress Trac
noreply at wordpress.org
Sat May 31 16:55:42 UTC 2014
#27473: Thickbox width and height parameters are ignored when using TB_iframe
--------------------------+------------------------------
Reporter: harmr | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.8
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by afercia):
hi,
seems tb_position() in thickbox.js is not executed at all when in the same
admin page both thickbox.js and media-upload.js are enqueued.
As far as I can see, the tb_position() function in:
/wp-includes/js/thickbox/thickbox.js
is then overridden in:
/wp-admin/js/media-upload.js
/wp-admin/js/plugin-install.js
/wp-admin/js/theme.js
For example, in a edit post page, both thickbox.js and media-upload.js are
enqueued. Say we add a button that opens a thickbox, specifying width and
height as per the documentation, it won't work.
That's because the first tb_position() in thickbox.js is replaced by the
tb_position() function in media-upload.js which first gets the global
tb_position object (the function from thickbox.js) and then assigns a new
function.
So, when the window is larger than 720px, the thickbox width will be 670px
( W - 50 ) as set by tb_position() in media-upload.js.
For a quick check, just rename/prefix all the occurrences of 'tb_position'
in thickbox.js and it will work.
For a fix, I don't know if and where the tb_position() functions in
media-upload.js, plugin-install.js, theme.js
are still used or not. maybe just prefix them or remove them if not used?
Last but not least (sorry for TL;DR).
In the documentation at http://codex.wordpress.org/ThickBox there's an
example about "Loading inline content" which is a bit misleading and if
used that way it will make tb_parseQuery() fail,
For example. if the admin page URL already has a query string, e.g.:
?post=4524&action=edit
using the example link:
#TB_inline?width=840&height=640&inlineId=my-thickbox
will return no width:
Pairs:
["post=4524", "action=edit#TB_inline?width=840", "height=640", "inlineId
=my-thickbox"]
Params:
{post: "4524", action: "edit", height: "640", inlineId: "my-thickbox"}
using:
#TB_inline&width=840&height=640&inlineId=my-thickbox
will return:
Pairs:
["post=4524", "action=edit#TB_inline", "width=840", "height=640",
"inlineId=my-thickbox"]
Params:
{post: "4524", action: "edit#TB_inline", width: "840", height: "640",
inlineId: "my-thickbox"}
using:
#TB_inline=true&width=840&height=640&inlineId=my-thickbox
Pairs:
["post=4524", "action=edit#TB_inline=true", "width=840", "height=640",
"inlineId=my-thickbox"]
Params:
{post: "4524", width: "840", height: "640", inlineId: "my-thickbox"}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27473#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list