PluginProbe
Parse.ly / 3.2.0
Parse.ly v3.2.0
3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 3.20.2 3.20.3 All 105 releases
wp-parsely / src / js / admin-settings.js

admin-settings.js in Parse.ly 3.2.0, at src/js/admin-settings.js

21 lines 545 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 document.querySelector( '.media-single-image button.browse' ).addEventListener( 'click', selectImage );
2
3 function selectImage() {
4 const optionName = this.dataset.option;
5
6 const imageFrame = wp.media( {
7 multiple: false,
8 library: {
9 type: 'image',
10 },
11 } );
12
13 imageFrame.on( 'select', function() {
14 const url = imageFrame.state().get( 'selection' ).first().toJSON().url;
15 const inputSelector = '#media-single-image-' + optionName + ' input.file-path';
16 document.querySelector( inputSelector ).value = url;
17 } );
18
19 imageFrame.open();
20 }
21