@@ -102,17 +102,24 @@ jQuery(document).ready( function($) {
102
102
event . preventDefault ( ) ;
103
103
} ) ;
104
104
$ ( '#insert' ) . click ( function ( event ) {
105
- if ( $ ( 'input[type=submit]:visible' ) . length > 0 ) {
106
- if ( $ ( '.picked textarea[name=after-save]' ) . length > 0 ) $ ( '.picked textarea[name=after-save]' ) . hide ( ) . val ( escape ( $ ( '.picked textarea[name=after-save]' ) . val ( ) . replace ( / \n / g, '<br>' ) ) ) ;
107
- var shortcode = '' ;
108
- shortcode += '<img class="salsa mceItem" style="border: 1px dashed #888;" title="salsa data=\' ' ;
109
- var serial = JSON . stringify ( $ ( '.picked' ) . serializeArray ( ) ) ;
110
- shortcode += serial . substring ( 1 , serial . length - 1 ) . replace ( / & / g, "&" ) . replace ( / > / g, ">" ) . replace ( / < / g, "<" ) . replace ( / " / g, """ ) ; ;
111
- shortcode += ' \' " src="' + SalsaPressVars . stylesheet_directory + 'images/salsaembed.png" alt="" data-mce-src="' + SalsaPressVars . stylesheet_directory + 'images/salsaembed.png" data-mce-style="border: 1px dashed #888;">' ;
112
- wind . send_to_editor ( shortcode ) ;
113
- }
114
- event . stopPropagation ( ) ;
115
- return false ;
105
+ if ( $ ( 'input[type=submit]:visible' ) . length > 0 ) {
106
+ var is_tinymce_active = ( typeof window . parent . tinyMCE != "undefined" ) && window . parent . tinyMCE . activeEditor && ! w
107
+ if ( $ ( '.picked textarea[name=after-save]' ) . length > 0 ) $ ( '.picked textarea[name=after-save]' ) . hide ( ) . val ( escape ( $
108
+ var serial = JSON . stringify ( $ ( '.picked' ) . serializeArray ( ) )
109
+ serial = serial . substring ( 1 , serial . length - 1 ) ;
110
+ if ( is_tinymce_active ) {
111
+ var shortcode = '<img class="salsa mceItem" style="border: 1px dashed #888;" title="' ;
112
+ shortcode += "salsa data='"
113
+ shortcode += serial . replace ( / & / g, "&" ) . replace ( / > / g, ">" ) . replace ( / < / g, "<" ) . replace ( / " / g, """ )
114
+ shortcode += "'"
115
+ shortcode += '" src="' + SalsaPressVars . stylesheet_directory + 'images/salsaembed.png" alt="" data-mce-src="' + Sals
116
+ } else {
117
+ var shortcode = [ "[salsa data=" , serial , "]" ] . join ( "'" )
118
+ }
119
+ wind . send_to_editor ( shortcode ) ;
120
+ }
121
+ event . stopPropagation ( ) ;
122
+ return false ;
116
123
} ) ;
117
124
$ ( '#cancel' ) . click ( function ( event ) {
118
125
w . tb_remove ( ) ;
0 commit comments