Skip to content

Commit

Permalink
add workaround for embroider issue with ember-velcro
Browse files Browse the repository at this point in the history
  • Loading branch information
elpoelma committed Oct 20, 2023
1 parent d2e669b commit b6e2d7b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions addon/components/hover-tooltip.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Velcro @placement={{this.placement}} as |velcro|>
<this.Velcro @placement={{this.placement}} as |velcro|>
{{#let velcro.loop as |loop|}}
{{yield (hash velcroHook=velcro.hook handleHover=(modifier this.hover)) to='hover' }}
{{#if this.tooltipOpen}}
{{yield loop to='tooltip'}}
{{/if}}
{{/let}}
</Velcro>
</this.Velcro>
2 changes: 2 additions & 0 deletions addon/components/hover-tooltip.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import Component from '@glimmer/component';
import { modifier } from 'ember-modifier';
import { tracked } from '@glimmer/tracking';
import { Velcro } from 'ember-velcro';

interface Args {
placement?: string;
}

export default class HoverTooltip extends Component<Args> {
Velcro = Velcro;
hover = modifier(
(element) => {
element.addEventListener('mouseenter', this.showTooltip);
Expand Down
6 changes: 3 additions & 3 deletions addon/components/variable-plugin/date/edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@onChange={{this.changeIncludeTime}}
/>
{{#if this.isCustom}}
<Velcro @placement="top" @offsetOptions={{hash mainAxis=10}} as |velcro|>
<this.Velcro @placement="top" @offsetOptions={{hash mainAxis=10}} as |velcro|>
<AuBadge
@size="small"
@icon="info-circle"
Expand All @@ -40,7 +40,7 @@
{{t 'date-plugin.card.info-custom-time'}}
</AuPill>
{{/if}}
</Velcro>
</this.Velcro>
{{/if}}
</AuFormRow>
</VariablePlugin::Date::DateTimePicker>
Expand All @@ -67,7 +67,7 @@
@onChange={{this.setDateFormatFromKey}}
/>
</AuFormRow>
{{/if}}
{{/if}}
{{#if (eq this.dateFormatType "custom")}}
<AuFormRow @alignment="post">
<AuButton @skin="secondary" @icon="info-circle"
Expand Down
3 changes: 3 additions & 0 deletions addon/components/variable-plugin/date/edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ import {
formatContainsTime,
validateDateFormat,
} from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/date-helpers';
import { Velcro } from 'ember-velcro';

type Args = {
controller: SayController;
options: DateOptions;
};
const SECONDS_REGEX = new RegExp('[sStT]|p{2,}');
export default class DateEditComponent extends Component<Args> {
Velcro = Velcro;

@service
declare intl: IntlService;

Expand Down
4 changes: 2 additions & 2 deletions addon/components/variable-plugin/number/nodeview.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Velcro
<this.Velcro
@placement='bottom-start'
@offsetOptions={{hash mainAxis=3}} as |velcro|
>
Expand Down Expand Up @@ -57,4 +57,4 @@
</AuCard>
</div>
{{/if}}
</Velcro>
</this.Velcro>
3 changes: 3 additions & 0 deletions addon/components/variable-plugin/number/nodeview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { localCopy } from 'tracked-toolbox';
import { isBlank } from '@ember/utils';
import { isNumber } from '@lblod/ember-rdfa-editor-lblod-plugins/utils/strings';
import { numberToWords } from '@lblod/ember-rdfa-editor-lblod-plugins/plugins/variable-plugin/utils/number-to-words';
import { Velcro } from 'ember-velcro';

type Args = {
getPos: () => number | undefined;
Expand All @@ -24,6 +25,8 @@ type Args = {
};

export default class NumberNodeviewComponent extends Component<Args> {
Velcro = Velcro;

@localCopy('args.node.attrs.value', '') declare inputNumber: string;
@localCopy('args.node.attrs.writtenNumber', false)
declare writtenNumber: boolean;
Expand Down

0 comments on commit b6e2d7b

Please sign in to comment.