Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add icons to type switcher #257

Merged
merged 1 commit into from
Mar 13, 2017
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
28 changes: 28 additions & 0 deletions shared/tinymce/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,34 @@
}
} ) );

tinymce.ui.Factory.add( 'menuitem', tinymce.ui.MenuItem.extend( {
renderHtml: function () {
var self = this, id = self._id, settings = self.settings, prefix = self.classPrefix;

var icon = this.settings.icon;
var text = this.settings.text;
var html = '';

if ( icon ) {
html += (
'<svg width="24" height="24" class="gridicon ' + icon + '">' +
'<use xlink:href="../shared/gridicons.svg#' + icon + '"></use>' +
'</svg>'
);
}

if ( text ) {
html += '<span class="' + prefix + 'txt">' + this.encode( text ) + '</span>';
}

return (
'<div id="' + id + '" class="' + self.classes + '" tabindex="-1">' +
html +
'</div>'
);
}
} ) );

tinymce.PluginManager.add( 'toolbar', function( editor ) {
var each = tinymce.each;
var DOM = tinymce.DOM;
Expand Down
10 changes: 8 additions & 2 deletions tinymce-single/tinymce/block.css
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ div.mce-inline-toolbar-grp.block-toolbar > div.mce-stack-layout {
text-transform: uppercase;
}

.mce-menu-item .mce-txt,
.insert-menu .mce-txt {
font-size: 16px;
text-align: inherit;
Expand All @@ -330,6 +331,7 @@ div.mce-inline-toolbar-grp.block-toolbar > div.mce-stack-layout {
line-height: 16px;
width: 120px;
padding: 4px;
display: inline-block;
}

.insert-menu .mce-btn-has-text svg.gridicons-heading {
Expand All @@ -352,13 +354,17 @@ div.mce-inline-toolbar-grp.block-toolbar > div.mce-stack-layout {
background-color: #fff;
border: 1px solid #e1e6ea;
box-shadow: 0px 3px 20px rgba( 18, 24, 30, .1 ), 0px 1px 3px rgba( 18, 24, 30, .1 );
margin-top: 2px;
margin-top: 3px;
margin-left: -1px;
}

.mce-listbox .mce-txt {
display: none;
}

.mce-menu-item {
padding: 4px;
padding: 6px;
position: relative;
background: none;
color: #12181e;
}
1 change: 1 addition & 0 deletions tinymce-single/tinymce/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
values: textBlocks.map( function( settings ) {
return {
text: settings.displayName,
icon: settings.icon,
value: settings._id
}
} ),
Expand Down