Skip to content

Commit

Permalink
feat: show 'Cmd' instead of 'Ctrl' in shortcut tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-D committed May 2, 2019
1 parent 08793fd commit 2f9c888
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/trumbowyg.js
Expand Up @@ -432,7 +432,10 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
t.pasteHandlers = [].concat(t.o.pasteHandlers);

// Check if browser is IE
t.isIE = (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') !== -1);
t.isIE = navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') !== -1;

// Check if we are on macOs
t.isMac = navigator.platform.toUpperCase().indexOf('MAC') !== -1;

t.init();
};
Expand Down Expand Up @@ -786,7 +789,7 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {
html: t.hasSvg && hasIcon ?
'<svg><use xlink:href="' + t.svgPath + '#' + prefix + (btn.ico || btnName).replace(/([A-Z]+)/g, '-$1').toLowerCase() + '"/></svg>' :
t.hideButtonTexts ? '' : (btn.text || btn.title || t.lang[btnName] || btnName),
title: (btn.title || btn.text || textDef) + ((btn.key) ? ' (Ctrl + ' + btn.key + ')' : ''),
title: (btn.title || btn.text || textDef) + (btn.key ? ' (' + (t.isMac ? 'Cmd' : 'Ctrl') + ' + ' + btn.key + ')' : ''),
tabindex: -1,
mousedown: function () {
if (!isDropdown || $('.' + btnName + '-' + prefix + 'dropdown', t.$box).is(':hidden')) {
Expand Down Expand Up @@ -851,9 +854,11 @@ Object.defineProperty(jQuery.trumbowyg, 'defaultOptions', {

return $('<button/>', {
type: 'button',
class: prefix + btnName + '-dropdown-button' + (btn.ico ? ' ' + prefix + btn.ico + '-button' : ''),
html: t.hasSvg && hasIcon ? '<svg><use xlink:href="' + t.svgPath + '#' + prefix + (btn.ico || btnName).replace(/([A-Z]+)/g, '-$1').toLowerCase() + '"/></svg>' + (btn.text || btn.title || t.lang[btnName] || btnName) : (btn.text || btn.title || t.lang[btnName] || btnName),
title: ((btn.key) ? ' (Ctrl + ' + btn.key + ')' : null),
class: prefix + btnName + '-dropdown-button ' + (btn.class || '') + (btn.ico ? ' ' + prefix + btn.ico + '-button' : ''),
html: t.hasSvg && hasIcon ?
'<svg><use xlink:href="' + t.svgPath + '#' + prefix + (btn.ico || btnName).replace(/([A-Z]+)/g, '-$1').toLowerCase() + '"/></svg>' + (btn.text || btn.title || t.lang[btnName] || btnName) :
(btn.text || btn.title || t.lang[btnName] || btnName),
title: (btn.key ? '(' + (t.isMac ? 'Cmd' : 'Ctrl') + ' + ' + btn.key + ')' : null),
style: btn.style || null,
mousedown: function () {
$('body', t.doc).trigger('mousedown');
Expand Down

0 comments on commit 2f9c888

Please sign in to comment.