Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Koenig - Standardise on <em> but allow <i> to be toggled off via toolbar
Browse files Browse the repository at this point in the history
refs TryGhost/Ghost#9505
- switch toolbar `I` button to toggle `<em>` instead of `<i>`, this standardises it with the <kbd>Meta+I</kbd> shortcut
- if the active markup is `<i>` instead of `<em>` then highlight the `I` button and allow it to be toggled off to prevent confusion
  • Loading branch information
kevinansfield committed Mar 15, 2018
1 parent 1842dab commit ff1d168
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lib/koenig-editor/addon/components/koenig-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ export default Component.extend({

actions: {
toggleMarkup(markupName) {
if (markupName === 'em' && this.get('activeMarkupTagNames.isI')) {
markupName = 'i';
}

this.toggleMarkup(markupName);
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<button
type="button"
title="Italic"
class="koenig-toolbar-btn koenig-toolbar-btn-italic {{if activeMarkupTagNames.isI "selected"}}"
{{action "toggleMarkup" "i"}}
class="koenig-toolbar-btn koenig-toolbar-btn-italic {{if (or activeMarkupTagNames.isEm activeMarkupTagNames.isI) "selected"}}"
{{action "toggleMarkup" "em"}}
>
I
</button>
Expand Down

0 comments on commit ff1d168

Please sign in to comment.