#33096 closed defect (bug) (fixed)
Don't use hidden #post_ID input field to get mce-view embed postID
Reported by: | rhurling | Owned by: | iseulde |
---|---|---|---|
Milestone: | 4.3 | Priority: | normal |
Severity: | normal | Version: | 3.9 |
Component: | TinyMCE | Keywords: | has-patch |
Focuses: | javascript | Cc: |
Description
The mce-view embeds use postID = $( '#post_ID' ).val() || 0
to get the ID of the current post (see https://core.trac.wordpress.org/browser/trunk/src/wp-includes/js/mce-view.js#L731).
Everything else I could find used wp.media.view.settings.post.id
.
I think it would be better to either use wp.media.view.settings.post.id
in the callbacks that use the current postID variable or switch to something that is localized to the script (brought up by @iseulde; https://wordpress.slack.com/archives/core-editor/p1437654722000160).
I will add a patch which uses wp.media.view.settings.post.id
, because I'm not sure what else I would have to change to use a localize the script.
Attachments (3)
Change History (9)
This ticket was mentioned in Slack in #core-editor by rhurling. View the logs.
9 years ago
#2
@
9 years ago
- Component changed from Editor to TinyMCE
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
- Version changed from 4.2.2 to 3.9
There's also wp.media.model.settings.post.id
. We can't use any of these because the script does not depend on media-*.js
. It needs its own setting.
It looks like your patch is reversed or something.
Patch which removes the postID variable and uses wp.media.view.settings.post.id