From aa53f54a2a176fe1fdcfab4e5f4c5a3eda19885c Mon Sep 17 00:00:00 2001 From: mcguffin Date: Fri, 27 Oct 2023 09:05:08 +0200 Subject: [PATCH] use attachmentDisplaySettings on TinyMCE paste #57 --- src/js/lib/uploader.js | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/js/lib/uploader.js b/src/js/lib/uploader.js index 58d1770..31f6055 100644 --- a/src/js/lib/uploader.js +++ b/src/js/lib/uploader.js @@ -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] ) }