Skip to content

Commit

Permalink
use attachmentDisplaySettings on TinyMCE paste #57
Browse files Browse the repository at this point in the history
  • Loading branch information
mcguffin committed Oct 27, 2023
1 parent 462ee53 commit aa53f54
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/js/lib/uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,35 @@ const Uploader = {

const newElement = document.createElement('p')
const attachment = args.attachment.attributes
const link = getUserSetting( 'urlbutton', 'none' )

if ( 'image' === attachment.type ) {
newElement.innerHTML = wp.media.string.image( { link: 'none' }, attachment )
newElement.innerHTML = wp.media.string.image( {
link,
align: getUserSetting( 'align', 'none' ),
size: getUserSetting( 'imgsize', 'medium' ),
}, attachment )

} else if ( 'video' === attachment.type ) {
newElement.innerHTML = wp.media.string.video( { link: 'embed' }, attachment )
newElement.innerHTML = wp.media.string.video( {
link: link !== 'none'
? link
: 'embed'
}, attachment )

} else if ( 'audio' === attachment.type ) {
newElement.innerHTML = wp.media.string.audio( { link: 'embed' }, attachment )
newElement.innerHTML = wp.media.string.audio( {
link: link !== 'none'
? link
: 'embed'
}, attachment )

} else {
newElement.innerHTML = wp.media.string.link( {}, attachment )
newElement.innerHTML = wp.media.string.link( {
link: link !== 'none'
? link
: 'file'
}, attachment )
}
progress.replaceWith( newElement.childNodes[0] )
}
Expand Down

0 comments on commit aa53f54

Please sign in to comment.