Skip to content

Commit

Permalink
Merge branch 't/9029b'
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Feb 8, 2013
2 parents 5396dd9 + bf44b91 commit f734990
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CKEditor 4 Changelog

* [#9779](http://dev.ckeditor.com/ticket/9779): Fixed overriding CKEDITOR.getUrl with CKEDITOR_GETURL.
* [#9772](http://dev.ckeditor.com/ticket/9772): Custom buttons in dialog footer have different look and size (Moono, Kama).

* [#9029](http://dev.ckeditor.com/ticket/9029): Custom styles added with styleSet.add() are displayed in wrong order.

## CKEditor 4.0.1

Expand Down
14 changes: 5 additions & 9 deletions plugins/stylescombo/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@
style._name = styleName;
style._.enterMode = config.enterMode;

// Weight is used to sort styles (#9029).
style._.weight = i + ( style.type == CKEDITOR.STYLE_OBJECT ? 1 : style.type == CKEDITOR.STYLE_BLOCK ? 2 : 3 ) * 1000;

stylesList.push( style );
}

// Sorts the Array, so the styles get grouped by type.
stylesList.sort( sortStyles );
// Sorts the Array, so the styles get grouped by type in proper order (#9029).
stylesList.sort( function( styleA, styleB ) { return styleA._.weight - styleB._.weight; } );
}

callback && callback();
Expand Down Expand Up @@ -176,11 +179,4 @@
});
}
});

function sortStyles( styleA, styleB ) {
var typeA = styleA.type,
typeB = styleB.type;

return typeA == typeB ? 0 : typeA == CKEDITOR.STYLE_OBJECT ? -1 : typeB == CKEDITOR.STYLE_OBJECT ? 1 : typeB == CKEDITOR.STYLE_BLOCK ? 1 : -1;
}
})();

0 comments on commit f734990

Please sign in to comment.