0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-18 02:21:47 -05:00

Renamed {{scroll-to}}'s shouldScroll argument to when

no issue

- `when` makes the modifier a little easier to read for it's typical use-case, eg:
  - `{{scroll-to when=(eq entry.slug this.entry)}}`
  - `{{scroll-to when=(eq this.focusArea "analytics")}}`
This commit is contained in:
Kevin Ansfield 2022-11-11 11:53:53 +00:00
parent b047589cbc
commit 2d6f48093e
2 changed files with 4 additions and 4 deletions

View file

@ -1,9 +1,9 @@
import getScrollParent from 'ghost-admin/utils/get-scroll-parent';
import {modifier} from 'ember-modifier';
export default modifier((element, positional, {shouldScroll = true}) => {
if (shouldScroll) {
// setTimeout needed to ensure layout has finished and we have accurate
export default modifier((element, positional, {when = true}) => {
if (when) {
// setTimeout needed to ensure layout has finished and we have accurate positioning
setTimeout(() => {
const scrollParent = getScrollParent(element);
const y = element.offsetTop;

View file

@ -7,7 +7,7 @@
<div class="gh-about-container">
<section class="gh-whats-new gh-about-box" {{did-insert (perform this.whatsNew.updateLastSeen)}}>
{{#each this.whatsNew.entries as |entry|}}
<div class="gh-wn-entry" {{scroll-to shouldScroll=(eq entry.slug this.entry)}}>
<div class="gh-wn-entry" {{scroll-to when=(eq entry.slug this.entry)}}>
<a href="{{entry.url}}">
<h4>{{moment-format entry.published_at "DD MMMM YYYY"}}</h4>
<h1>{{entry.title}}</h1>