Skip to content

Commit

Permalink
WIP replace usages of action helper
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemelia committed Sep 17, 2023
1 parent 9766b8a commit 6ddf169
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions addon/components/mobiledoc-link-prompt/template.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<form>
{{input value=this.href}}
<button {{action attrs.on-submit this.href}} type="submit">Link</button>
<button type="submit" {{action attrs.on-cancel}}>Cancel</button>
<button {{on 'click' (fn attrs.on-submit this.href)}} type="submit">Link</button>
<button type="submit" {{on 'click' attrs.on-cancel}}>Cancel</button>
</form>
24 changes: 12 additions & 12 deletions addon/components/mobiledoc-toolbar/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
type="button"
title="Bold"
class="mobiledoc-toolbar__button {{if @editor.activeMarkupTagNames.isStrong 'active'}}"
{{action @editor.toggleMarkup 'strong'}}>
{{on 'click' (fn @editor.toggleMarkup 'strong')}}>
Bold
</button>
</li>
Expand All @@ -12,7 +12,7 @@
type="button"
title="Italic"
class="mobiledoc-toolbar__button {{if @editor.activeMarkupTagNames.isEm 'active'}}"
{{action @editor.toggleMarkup 'em'}}>
{{on 'click' (fn @editor.toggleMarkup 'em')}}>
Italic
</button>
</li>
Expand All @@ -21,7 +21,7 @@
type="button"
title="Link"
class="mobiledoc-toolbar__button {{if @editor.activeMarkupTagNames.isA 'active'}}"
{{action @editor.toggleLink}}>
{{on 'click' @editor.toggleLink}}>
Link
</button>
</li>
Expand All @@ -30,7 +30,7 @@
type="button"
title="Heading"
class="mobiledoc-toolbar__button {{if @editor.activeSectionTagNames.isH1 'active'}}"
{{action @editor.toggleSection 'h1'}}>
{{on 'click' (fn @editor.toggleSection 'h1')}}>
Headline
</button>
</li>
Expand All @@ -39,7 +39,7 @@
type="button"
title="Subheading"
class="mobiledoc-toolbar__button {{if @editor.activeSectionTagNames.isH2 'active'}}"
{{action @editor.toggleSection 'h2'}}>
{{on 'click' (fn @editor.toggleSection 'h2')}}>
Subheadline
</button>
</li>
Expand All @@ -48,7 +48,7 @@
type="button"
title="Block Quote"
class="mobiledoc-toolbar__button {{if @editor.activeSectionTagNames.isBlockquote 'active'}}"
{{action @editor.toggleSection 'blockquote'}}>
{{on 'click' (fn @editor.toggleSection 'blockquote')}}>
<i class="icon-quote-block"></i>
Blockquote
</button>
Expand All @@ -58,7 +58,7 @@
type="button"
title="Pull Quote"
class="mobiledoc-toolbar__button {{if @editor.activeSectionTagNames.isPullQuote 'active'}}"
{{action @editor.toggleSection 'pull-quote'}}>
{{on 'click' (fn @editor.toggleSection 'pull-quote')}}>
Pull-quote
</button>
</li>
Expand All @@ -67,7 +67,7 @@
type="button"
title="List"
class="mobiledoc-toolbar__button {{if @editor.activeSectionTagNames.isUl 'active'}}"
{{action @editor.toggleSection 'ul'}}>
{{on 'click' (fn @editor.toggleSection 'ul')}}>
Unordered List
</button>
</li>
Expand All @@ -76,7 +76,7 @@
type="button"
title="Numbered List"
class="mobiledoc-toolbar__button {{if @editor.activeSectionTagNames.isOl 'active'}}"
{{action @editor.toggleSection 'ol'}}>
{{on 'click' (fn @editor.toggleSection 'ol')}}>
Ordered List
</button>
</li>
Expand All @@ -85,7 +85,7 @@
type="button"
title="Align Left"
class="mobiledoc-toolbar__button {{if (includes @editor.activeSectionAttributes.textAlign 'left') 'active'}}"
{{action @editor.setAttribute 'text-align' 'left'}}>
{{on 'click' (fn @editor.setAttribute 'text-align' 'left')}}>
Align Left
</button>
</li>
Expand All @@ -94,7 +94,7 @@
type="button"
title="Align Center"
class="mobiledoc-toolbar__button {{if (includes @editor.activeSectionAttributes.textAlign 'center') 'active'}}"
{{action @editor.setAttribute 'text-align' 'center'}}>
{{on 'click' (fn @editor.setAttribute 'text-align' 'center')}}>
Align Center
</button>
</li>
Expand All @@ -103,7 +103,7 @@
type="button"
title="Align Right"
class="mobiledoc-toolbar__button {{if (includes @editor.activeSectionAttributes.textAlign 'right') 'active'}}"
{{action @editor.setAttribute 'text-align' 'right'}}>
{{on 'click' (fn @editor.setAttribute 'text-align' 'right')}}>
Align Right
</button>
</li>
Expand Down
2 changes: 0 additions & 2 deletions addon/components/tether-to-selection/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { assert } from '@ember/debug';
import Component from '@ember/component';
import { computed } from '@ember/object';
import { htmlSafe } from '@ember/string';
import layout from './template';

const DIALOG_MARGIN = 16;

Expand All @@ -24,7 +23,6 @@ function isOutOfBounds(rect, boundingRect) {
}

export default Component.extend({
layout,
classNames: ['mobiledoc-selection-tether'],
attributeBindings: ['style'],
dialogAnchor: null,
Expand Down
1 change: 0 additions & 1 deletion addon/components/tether-to-selection/template.hbs

This file was deleted.

2 changes: 1 addition & 1 deletion tests/dummy/app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<MobiledocEditor @on-change={{action 'onChange'}} />
<MobiledocEditor @on-change={{this.onChange}} />

<div id="has-changed">HAS CHANGED {{this.changeCount}}</div>

0 comments on commit 6ddf169

Please sign in to comment.