Skip to content

Commit

Permalink
Merge pull request #400 from nhammadi/master
Browse files Browse the repository at this point in the history
Added image option that enables you to provide a custom image for split ...
  • Loading branch information
spocke committed Aug 27, 2014
2 parents 204df2a + 62146fa commit 336a3aa
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions js/tinymce/classes/ui/SplitButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,28 @@ define("tinymce/ui/SplitButton", [
* @method renderHtml
* @return {String} HTML representing the control.
*/
renderHtml: function() {
var self = this, id = self._id, prefix = self.classPrefix;
var icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + self.settings.icon : '';

return (
renderHtml: function () {
var self = this, id = self._id, prefix = self.classPrefix, image;
var icon = self.settings.icon;

image = self.settings.image;
if (image) {
icon = 'none';

// Support for [high dpi, low dpi] image sources
if (typeof image != "string") {
image = window.getSelection ? image[0] : image[1];
}

image = ' style="background-image: url(\'' + image + '\')"';
} else {
image = '';
}
icon = self.settings.icon ? prefix + 'ico ' + prefix + 'i-' + icon : '';
return (
'<div id="' + id + '" class="' + self.classes() + '" role="button" tabindex="-1">' +
'<button type="button" hidefocus="1" tabindex="-1">' +
(icon ? '<i class="' + icon + '"></i>' : '') +
(icon ? '<i class="' + icon + '"' + image + '></i>' : '') +
(self._text ? (icon ? ' ' : '') + self._text : '') +
'</button>' +
'<button type="button" class="' + prefix + 'open" hidefocus="1" tabindex="-1">' +
Expand All @@ -83,7 +97,7 @@ define("tinymce/ui/SplitButton", [
' <i class="' + prefix + 'caret"></i>' +
'</button>' +
'</div>'
);
);
},

/**
Expand Down

0 comments on commit 336a3aa

Please sign in to comment.