Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ We've removed the compatibility shim for the magical `content` attribute. If you
* Added Spanish translation.
* Bug fix: Prevent fataling when editor is loaded in the frontend context.
* Bug fix: Color field should also support `meta` argument.
* Bug fix: Remove trailing whitespace from shortcodes without attributes.

### 0.3 (April 27, 2015) ###
* **Breaking change**: We've removed the compatibility shim for the magical `content` attribute. If you were using this to support editing inner content, you'll need to change your UI registration to use `inner_content`.
Expand Down
10 changes: 9 additions & 1 deletion js-tests/build/specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ describe( "Shortcode Model", function() {
_shortcode.get('inner_content').unset( 'value' );
expect( _shortcode.formatShortcode() ).toEqual( '[test_shortcode attr="test value"]' );

// Test without attributes
_shortcode.get( 'attrs' ).first().unset( 'value' );
expect( _shortcode.formatShortcode() ).toEqual( '[test_shortcode]' );

});

});
Expand Down Expand Up @@ -457,7 +461,11 @@ Shortcode = Backbone.Model.extend({
content = this.get( 'inner_content' ).get( 'value' );
}

template = "[{{ shortcode }} {{ attributes }}]"
if ( attrs.length > 0 ) {
template = "[{{ shortcode }} {{ attributes }}]"
} else {
template = "[{{ shortcode }}]"
}

if ( content && content.length > 0 ) {
template += "{{ content }}[/{{ shortcode }}]"
Expand Down
4 changes: 4 additions & 0 deletions js-tests/src/shortcodeModelSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ describe( "Shortcode Model", function() {
_shortcode.get('inner_content').unset( 'value' );
expect( _shortcode.formatShortcode() ).toEqual( '[test_shortcode attr="test value"]' );

// Test without attributes
_shortcode.get( 'attrs' ).first().unset( 'value' );
expect( _shortcode.formatShortcode() ).toEqual( '[test_shortcode]' );

});

});
6 changes: 5 additions & 1 deletion js/build/field-attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,11 @@ Shortcode = Backbone.Model.extend({
content = this.get( 'inner_content' ).get( 'value' );
}

template = "[{{ shortcode }} {{ attributes }}]"
if ( attrs.length > 0 ) {
template = "[{{ shortcode }} {{ attributes }}]"
} else {
template = "[{{ shortcode }}]"
}

if ( content && content.length > 0 ) {
template += "{{ content }}[/{{ shortcode }}]"
Expand Down
6 changes: 5 additions & 1 deletion js/build/field-color.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ Shortcode = Backbone.Model.extend({
content = this.get( 'inner_content' ).get( 'value' );
}

template = "[{{ shortcode }} {{ attributes }}]"
if ( attrs.length > 0 ) {
template = "[{{ shortcode }} {{ attributes }}]"
} else {
template = "[{{ shortcode }}]"
}

if ( content && content.length > 0 ) {
template += "{{ content }}[/{{ shortcode }}]"
Expand Down
6 changes: 5 additions & 1 deletion js/build/shortcode-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ Shortcode = Backbone.Model.extend({
content = this.get( 'inner_content' ).get( 'value' );
}

template = "[{{ shortcode }} {{ attributes }}]"
if ( attrs.length > 0 ) {
template = "[{{ shortcode }} {{ attributes }}]"
} else {
template = "[{{ shortcode }}]"
}

if ( content && content.length > 0 ) {
template += "{{ content }}[/{{ shortcode }}]"
Expand Down
6 changes: 5 additions & 1 deletion js/src/models/shortcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,11 @@ Shortcode = Backbone.Model.extend({
content = this.get( 'inner_content' ).get( 'value' );
}

template = "[{{ shortcode }} {{ attributes }}]"
if ( attrs.length > 0 ) {
template = "[{{ shortcode }} {{ attributes }}]"
} else {
template = "[{{ shortcode }}]"
}

if ( content && content.length > 0 ) {
template += "{{ content }}[/{{ shortcode }}]"
Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ We've removed the compatibility shim for the magical `content` attribute. If you
* Added Spanish translation.
* Bug fix: Prevent fataling when editor is loaded in the frontend context.
* Bug fix: Color field should also support `meta` argument.
* Bug fix: Remove trailing whitespace from shortcodes without attributes.

= 0.3 (April 27, 2015) =
* **Breaking change**: We've removed the compatibility shim for the magical `content` attribute. If you were using this to support editing inner content, you'll need to change your UI registration to use `inner_content`.
Expand Down