|
163 | 163 | // If no file selected, show placeholder |
164 | 164 | if ( ! attributes.attachmentId ) { |
165 | 165 | return el( MediaUploadCheck, null, |
166 | | - el( MediaUpload, { |
167 | | - onSelect: onSelectFile, |
168 | | - allowedTypes: [ 'application/zip', 'application/x-exe-learning' ], |
169 | | - value: attributes.attachmentId, |
170 | | - render: function( obj ) { |
171 | | - return el( Placeholder, { |
172 | | - icon: 'media-default', |
173 | | - label: __( 'eXeLearning Content', 'exelearning' ), |
174 | | - instructions: __( 'Upload or select a .elpx file from your media library', 'exelearning' ), |
175 | | - className: 'exelearning-upload-placeholder' |
176 | | - }, |
177 | | - el( 'div', { className: 'components-placeholder__controls' }, |
178 | | - el( Button, { |
| 166 | + el( Placeholder, { |
| 167 | + icon: 'media-default', |
| 168 | + label: __( 'eXeLearning Content', 'exelearning' ), |
| 169 | + instructions: __( 'Upload or select a .elpx file from your media library', 'exelearning' ), |
| 170 | + className: 'exelearning-upload-placeholder' |
| 171 | + }, |
| 172 | + el( 'div', { className: 'components-placeholder__controls' }, |
| 173 | + el( MediaUpload, { |
| 174 | + onSelect: onSelectFile, |
| 175 | + allowedTypes: [ 'application/zip', 'application/x-exe-learning' ], |
| 176 | + value: attributes.attachmentId, |
| 177 | + mode: 'upload', |
| 178 | + render: function( obj ) { |
| 179 | + return el( Button, { |
179 | 180 | isPrimary: true, |
180 | 181 | onClick: obj.open |
181 | | - }, __( 'Upload .elpx File', 'exelearning' ) ), |
182 | | - el( Button, { |
| 182 | + }, __( 'Upload .elpx File', 'exelearning' ) ); |
| 183 | + } |
| 184 | + }), |
| 185 | + el( MediaUpload, { |
| 186 | + onSelect: onSelectFile, |
| 187 | + allowedTypes: [ 'application/zip', 'application/x-exe-learning' ], |
| 188 | + value: attributes.attachmentId, |
| 189 | + mode: 'browse', |
| 190 | + render: function( obj ) { |
| 191 | + return el( Button, { |
183 | 192 | isSecondary: true, |
184 | 193 | onClick: obj.open, |
185 | 194 | style: { marginLeft: '10px' } |
186 | | - }, __( 'Media Library', 'exelearning' ) ) |
187 | | - ) |
188 | | - ); |
189 | | - } |
190 | | - }) |
| 195 | + }, __( 'Media Library', 'exelearning' ) ); |
| 196 | + } |
| 197 | + }) |
| 198 | + ) |
| 199 | + ) |
191 | 200 | ); |
192 | 201 | } |
193 | 202 |
|
|
0 commit comments