@@ -35,7 +35,6 @@ function openCode (component) {
3535 var $html = $component . find ( '.html' )
3636 $component . find ( '.result' ) . first ( ) . appendTo ( $html )
3737 }
38-
3938 updateMixin ( component , $component )
4039
4140 $component . removeClass ( 'loading' )
@@ -209,14 +208,15 @@ function renderBlock (schema, component, $component) {
209208 * @return {string } Mixin string
210209 */
211210function getMixinString ( schema , component ) {
212- var str = component + '('
213-
214- $ . each ( schema . params , function ( key , val ) {
215- str += key + ', '
216- } )
217-
218- str = str . slice ( 0 , - 2 ) + ')'
219-
211+ var str = component
212+ if ( Object . keys ( schema . params ) . length ) {
213+ str += '('
214+ $ . each ( schema . params , function ( key , val ) {
215+ str += key + ', '
216+ } )
217+
218+ str = str . slice ( 0 , - 2 ) + ')'
219+ }
220220 return str
221221}
222222
@@ -265,21 +265,23 @@ function writeMixinCall (component, $component) {
265265 var fields = $component . find ( 'form' ) . serializeArray ( )
266266 var block = $component . find ( '[name=blockField]' ) . val ( )
267267
268- var str = '+' + component + '('
269-
270- $ . each ( fields , function ( index , field ) {
271- // If it's boolean or json object/array don't wrap quotes around it
272- if ( field . value === 'true' || field . value === 'false' || field . value . match ( / ^ \{ | \[ / ) ) {
273- str = str += field . value + ', '
274- } else if ( field . value === '' || typeof ( field . value ) === 'undefined' ) {
275- str = str += 'null , '
276- } else {
277- str = str += '\'' + field . value + '\' , '
278- }
279- } )
280-
281- str = str . slice ( 0 , - 2 ) + ')'
268+ var str = '+' + component
269+ if ( fields . length ) {
270+ str += '('
271+
272+ $ . each ( fields , function ( index , field ) {
273+ // If it's boolean or json object/array don't wrap quotes around it
274+ if ( field . value === 'true ' || field . value === 'false' || field . value . match ( / ^ \{ | \[ / ) ) {
275+ str = str += field . value + ' , '
276+ } else if ( field . value === '' || typeof ( field . value ) === 'undefined' ) {
277+ str = str += 'null , '
278+ } else {
279+ str = str += '\'' + field . value + '\', '
280+ }
281+ } )
282282
283+ str = str . slice ( 0 , - 2 ) + ')'
284+ }
283285 if ( block ) {
284286 // If the block contains tabs we shouldn't escape
285287 // it, because it might contain another mixin
0 commit comments