Ghost/ghost/admin/app/components/gh-site-iframe.js
Kevin Ansfield b4a6eb594d Converted <GhSiteIframe> to a glimmer component
no issue

- updated to class syntax and glimmer component behaviour
- tidied up and standardised usage of the component
2021-05-18 16:08:13 +01:00

24 lines
691 B
JavaScript

import Component from '@glimmer/component';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
export default class GhSiteIframeComponent extends Component {
@service config;
get srcUrl() {
return this.args.src || `${this.config.get('blogUrl')}/`;
}
@action
resetSrcAttribute(iframe) {
// reset the src attribute each time the guid changes - allows for
// a click on the navigation item to reset back to the homepage
if (this.args.guid !== this._lastGuid) {
if (iframe) {
iframe.src = this.srcUrl;
}
}
this._lastGuid = this.args.guid;
}
}