Resolved linter errors in koenig-toolbar.hbs

refs https://github.com/TryGhost/Ghost/issues/14101

- switched from the deprecated `{{action}}` helper to the `{{on}}` modifier
This commit is contained in:
Kevin Ansfield 2022-02-15 13:46:49 +00:00
parent 63d41e7255
commit 7e3565d71f
3 changed files with 24 additions and 10 deletions

View File

@ -1825,3 +1825,9 @@ remove|ember-template-lint|no-duplicate-landmark-elements|22|8|22|8|b46a5eafbe20
remove|ember-template-lint|no-duplicate-landmark-elements|37|8|37|8|54b2819b311941c35c0cc1d64e431ee9d9145b82|1643760000000|1646352000000|1648940400000|app/components/modal-import-members.hbs
remove|ember-template-lint|no-invalid-interactive|27|47|27|47|17660ddd048981e3ae59c14abced1e1966c8baa4|1644278400000|1646870400000|1649458800000|app/components/gh-member-label-input.hbs
remove|ember-template-lint|no-invalid-interactive|2|4|2|4|07ed10079a06774ee9528c2b13dc8178744f0a97|1644537600000|1647129600000|1649718000000|app/components/gh-posts-list-item.hbs
remove|ember-template-lint|no-action|38|16|38|16|b603c08c4edfd1d623d49632293b5cf89840abcf|1643760000000|1646352000000|1648940400000|lib/koenig-editor/addon/components/koenig-toolbar.hbs
remove|ember-template-lint|no-action|53|16|53|16|fad8d3312422c157eeeca904e9948fade6e26293|1643760000000|1646352000000|1648940400000|lib/koenig-editor/addon/components/koenig-toolbar.hbs
remove|ember-template-lint|no-action|7|12|7|12|fada170dae44678cba8240b4ae3233c631db4a6f|1644364800000|1646956800000|1649545200000|lib/koenig-editor/addon/components/koenig-toolbar.hbs
remove|ember-template-lint|no-action|17|12|17|12|b75d66d02a33b108a64bb94d494fa194434c82f9|1644364800000|1646956800000|1649545200000|lib/koenig-editor/addon/components/koenig-toolbar.hbs
remove|ember-template-lint|no-action|28|16|28|16|e5e787868d089ae3141666004a914deff774b489|1644364800000|1646956800000|1649545200000|lib/koenig-editor/addon/components/koenig-toolbar.hbs
remove|ember-template-lint|no-action|70|12|70|12|03d2eaf613eae8cb3ea3c821ba63544c730364c8|1644364800000|1646956800000|1649545200000|lib/koenig-editor/addon/components/koenig-toolbar.hbs

View File

@ -4,7 +4,7 @@
type="button"
title="Bold"
class="dib dim-lite link h9 w9 nudge-top--1"
{{action "_toggleMarkup" "strong"}}
{{on "click" (fn this._toggleMarkup "strong")}}
>
{{svg-jar "koenig/kg-bold" class=(concat (if this.activeMarkupTagNames.isStrong "fill-green-l2" "fill-white") " w4 h4")}}
</button>
@ -14,7 +14,7 @@
type="button"
title="Italic"
class="dib dim-lite link h9 w9 nudge-top--1"
{{action "_toggleMarkup" "em"}}
{{on "click" (fn this._toggleMarkup "em")}}
>
{{svg-jar "koenig/kg-italic" class=(concat (if (or this.activeMarkupTagNames.isEm this.activeMarkupTagNames.isI) "fill-green-l2" "fill-white") " w4 h4")}}
</button>
@ -25,7 +25,7 @@
type="button"
title="Heading One"
class="dib dim-lite link h9 w9 nudge-top--1"
{{action "_toggleHeaderSection" "h2"}}
{{on "click" (fn this._toggleHeaderSection "h2")}}
>
{{svg-jar "koenig/kg-heading-1" class=(concat (if this.activeSectionTagNames.isH2 "fill-green-l2" "fill-white") " w4 h4")}}
</button>
@ -35,7 +35,7 @@
type="button"
title="Heading Two"
class="dib dim-lite link h9 w9 nudge-top--1"
{{action "_toggleHeaderSection" "h3"}}
{{on "click" (fn this._toggleHeaderSection "h3")}}
data-test-button="toolbar-h3"
>
{{svg-jar "koenig/kg-heading-2" class=(concat (if this.activeSectionTagNames.isH3 "fill-green-l2" "fill-white") " w4 h4")}}
@ -51,7 +51,7 @@
type="button"
title="Quote"
class="dib dim-lite link h9 w9 nudge-top--1"
{{action "toggleQuoteSection"}}
{{on "click" this.toggleQuoteSection}}
>
{{#if this.activeSectionTagNames.isBlockquote}}
{{svg-jar "koenig/kg-quote-1" class="fill-green w4 h4"}}
@ -68,7 +68,7 @@
type="button"
title="Link"
class="dib dim-lite link h9 w9 nudge-top--1"
{{action "_editLink"}}
{{on "click" this._editLink}}
>
{{svg-jar "koenig/kg-link" class=(concat (if this.activeMarkupTagNames.isA "fill-green-l2" "fill-white") " w4 h4")}}
</button>

View File

@ -117,7 +117,9 @@ export default class KoenigToolbar extends Component {
}
@action
_toggleMarkup(markupName) {
_toggleMarkup(markupName, event) {
event?.preventDefault();
if (markupName === 'em' && this.activeMarkupTagNames.isI) {
markupName = 'i';
}
@ -126,7 +128,9 @@ export default class KoenigToolbar extends Component {
}
@action
toggleQuoteSection() {
toggleQuoteSection(event) {
event?.preventDefault();
let sectionName = 'blockquote';
if (this.activeSectionTagNames.isBlockquote) {
@ -143,7 +147,9 @@ export default class KoenigToolbar extends Component {
}
@action
_toggleHeaderSection(headingTagName) {
_toggleHeaderSection(headingTagName, event) {
event?.preventDefault();
let range = this.editorRange;
this.editor.run((postEditor) => {
this.toggleHeaderSection(headingTagName, postEditor, {force: true});
@ -152,7 +158,9 @@ export default class KoenigToolbar extends Component {
}
@action
_editLink() {
_editLink(event) {
event?.preventDefault();
this.editLink(this.editorRange);
}