@@ -55,8 +55,8 @@ jQuery( document ).ready(
5555 var form = $ ( 'form.wpzinc-tinymce-popup' ) ;
5656
5757 // Build Shortcode.
58- var shortcode = '[' + $ ( 'input[name="shortcode"]' , $ ( form ) ) . val ( ) ,
59- shortcodeClose = ( $ ( 'input[name="close_shortcode"]' , $ ( form ) ) . val ( ) == '1' ? true : false ) ;
58+ var shortcode = '[' + $ ( 'input[name="shortcode"]' , $ ( form ) ) . val ( ) ,
59+ shortcodeEnclosedContent = false ;
6060
6161 $ ( 'input, select, textarea' , $ ( form ) ) . each (
6262 function ( i ) {
@@ -113,6 +113,12 @@ jQuery( document ).ready(
113113 val = val . trim ( ) ;
114114 }
115115
116+ // Skip if the shortcode attribute will be enclosed in the shortcode content.
117+ if ( $ ( this ) . data ( 'enclose' ) == '1' ) {
118+ shortcodeEnclosedContent = val ;
119+ return true ;
120+ }
121+
116122 // Append attribute and value to shortcode string.
117123 shortcode += ' ' + key . trim ( ) + '="' + val + '"' ;
118124 }
@@ -121,9 +127,9 @@ jQuery( document ).ready(
121127 // Close Shortcode.
122128 shortcode += ']' ;
123129
124- // If the shortcode includes a closing element , append it now.
125- if ( shortcodeClose ) {
126- shortcode += '[/' + $ ( 'input[name="shortcode"]' , $ ( form ) ) . val ( ) + ']' ;
130+ // If the shortcode includes enclosed content , append it now and close the shortcode .
131+ if ( shortcodeEnclosedContent ) {
132+ shortcode += shortcodeEnclosedContent + '[/' + $ ( 'input[name="shortcode"]' , $ ( form ) ) . val ( ) + ']' ;
127133 }
128134
129135 // Depending on the editor type, insert the shortcode.
0 commit comments