#35630 closed enhancement (fixed)
oEmbed Link Handling Can't Be Refired
Reported by: | JamesDiGioia | Owned by: | swissspidy |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | 4.4 |
Component: | Embeds | Keywords: | has-patch commit |
Focuses: | Cc: |
Description
On page load, the oEmbed script adds a click handler to anchor tags to postMessage to the parent window to handle and redirect the user. I have two questions/issues about this.
First, i'm doing syntax highlighting in the iframe, and part of that is to add (if the user is logged in) a link to the edit the code on the backend. Because the initial oEmbed script has already run by the time this happens, I have to manually add that handler myself, which results in some code duplication between my plugin and WordPress. Is it possible to mitigate this issue by making the mechanism available outside of the IIFE scope?
Attachments (3)
Change History (13)
#1
@
9 years ago
- Keywords needs-patch added
- Milestone changed from Awaiting Review to Future Release
- Owner set to swissspidy
- Status changed from new to assigned
#2
@
9 years ago
- Keywords has-patch added; needs-patch removed
First patch, but I think I did this right. I didn't really see a way to simplify the logic that much, since we still need to check the parentNode.
#3
@
9 years ago
Friend of mine suggested the diff name needs to be <ticket#>.<patch#>.diff
. This rectifies that and removes the extra line break I added by accident.
This ticket was mentioned in Slack in #core by chriscct7. View the logs.
9 years ago
#6
@
9 years ago
- Milestone changed from Future Release to 4.5
- Status changed from assigned to reviewing
#7
@
9 years ago
- Keywords commit added
I haven't found any problems with document.addEventListener()
being slow or anything, so that looks good to me.
Thanks for your report. Supporting lazy-loaded content sounds like something we should support automatically.
We're currently using
whereas we might just use something like
This would require/allow us to to simplify the logic inside
linkClickHandler()
.If this is already enough, we could look into making things available under the
wp
namespace at a later point, e.g. functions likewp.embed.send_some_stuff()
.