Skip to content

Commit

Permalink
GN-5153: only trigger event handlers of snippet actions once (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
elpoelma authored Nov 5, 2024
1 parent 9d7a32b commit 3941b65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-pillows-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lblod/ember-rdfa-editor-lblod-plugins': patch
---

Ensure that the event handlers of snippet actions are only triggered once
16 changes: 5 additions & 11 deletions addon/components/snippet-plugin/nodes/snippet.gts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { recalculateNumbers } from '@lblod/ember-rdfa-editor-lblod-plugins/plugi
interface ButtonSig {
Args: {
isActive: boolean;
onClick: () => void;
icon: AuIconSignature['Args']['icon'];
helpText: string;
};
Expand All @@ -41,13 +40,8 @@ interface ButtonSig {

const SnippetButton: TemplateOnlyComponent<ButtonSig> = <template>
{{#if @isActive}}
<button
class='say-snippet-button'
type='button'
{{on 'click' @onClick}}
...attributes
>
<AuIcon @icon={{@icon}} @size='large' {{on 'click' @onClick}} />
<button class='say-snippet-button' type='button' ...attributes>
<AuIcon @icon={{@icon}} @size='large' />
<div class='say-snippet-button-text'>
{{t @helpText}}
</div>
Expand Down Expand Up @@ -169,21 +163,21 @@ export default class SnippetNode extends Component<Signature> {
<SnippetButton
@icon={{SynchronizeIcon}}
@helpText='snippet-plugin.snippet-node.change-fragment'
@onClick={{this.editFragment}}
{{on 'click' this.editFragment}}
@isActive={{this.isActive}}
/>
<SnippetButton
@icon={{BinIcon}}
@helpText='snippet-plugin.snippet-node.remove-fragment'
@onClick={{this.deleteFragment}}
{{on 'click' this.deleteFragment}}
@isActive={{this.isActive}}
class='say-snippet-remove-button'
/>
{{#if this.allowMultipleSnippets}}
<SnippetButton
@icon={{AddIcon}}
@helpText='snippet-plugin.snippet-node.add-fragment'
@onClick={{this.addFragment}}
{{on 'click' this.addFragment}}
@isActive={{this.isActive}}
/>
{{/if}}
Expand Down

0 comments on commit 3941b65

Please sign in to comment.