mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 10:59:30 +03:00
b21e46aa39
refs https://github.com/TryGhost/Ghost/issues/9505 - use `{{gh-scroll-trigger}}` components at top and bottom of the markdown card when in edit mode so that styles can be applied to the `.editor-toolbar` element to keep the toolbar fixed at the bottom of the screen whilst scrolling
45 lines
995 B
JavaScript
45 lines
995 B
JavaScript
import Component from '@ember/component';
|
|
import InViewportMixin from 'ember-in-viewport';
|
|
|
|
export default Component.extend(InViewportMixin, {
|
|
|
|
enter() {},
|
|
exit() {},
|
|
registerElement() {},
|
|
|
|
didInsertElement() {
|
|
let offset = this.get('triggerOffset') || {};
|
|
|
|
// if triggerOffset is a number we use it for all dimensions
|
|
if (typeof offset === 'number') {
|
|
offset = {
|
|
top: offset,
|
|
bottom: offset,
|
|
left: offset,
|
|
right: offset
|
|
};
|
|
}
|
|
|
|
this.set('viewportSpy', true);
|
|
this.set('viewportTolerance', {
|
|
top: offset.top,
|
|
bottom: offset.bottom,
|
|
left: offset.left,
|
|
right: offset.right
|
|
});
|
|
|
|
this._super(...arguments);
|
|
|
|
this.registerElement(this.element);
|
|
},
|
|
|
|
didEnterViewport() {
|
|
return this.enter();
|
|
},
|
|
|
|
didExitViewport() {
|
|
return this.exit();
|
|
}
|
|
|
|
});
|