Opened 9 years ago
Closed 9 years ago
#35181 closed defect (bug) (invalid)
Using Lodash makes media_upload dialog unable to use
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4 |
Component: | Media | Keywords: | close |
Focuses: | Cc: |
Description
I'm writing a plugin with Angular and Wordpress. When i declared https://lodash.com/ the media_upload is unable to use. Medias will be shown up but you can't Pick them and the 'select' event will not be fired.
There is no error on javascript.
var frame = wp.media.frames.file_frame = wp.media({ library: { type: 'image' }, frame: 'select', multiple: true }); frame.off('select'); frame.open(); // this won't be triggered frame.on('select', function () {
If i remove lodash, everything is ok.
Thanks
Change History (2)
Note: See
TracTickets for help on using
tickets.
WordPress uses Underscore.js for the media modal. It uses the same _ variable as Lodash.
You need to use Lodash's noConflict mode in your application to prevent it from overwriting the variable: