Added transparency grid and event tracking to Image Editor (#16959)

This commit is contained in:
Nick Moreton 2023-06-07 16:05:38 +01:00 committed by GitHub
parent 9da246ac84
commit c4629e0118
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
import Component from '@glimmer/component';
import trackEvent from '../utils/analytics';
import {action} from '@ember/object';
import {inject} from 'ghost-admin/decorators/inject';
import {inject as service} from '@ember/service';
@ -144,10 +145,11 @@ export default class KoenigImageEditor extends Component {
if (!imageUrl.searchParams.has('v')) {
imageUrl.searchParams.set('v', Date.now());
}
trackEvent('Image Edit Button Clicked', {location: 'admin'});
const imageSrc = imageUrl.href;
const editor = window.pintura.openDefaultEditor({
src: imageSrc,
enableTransparencyGrid: true,
util: 'crop',
utils: [
'crop',
@ -214,6 +216,7 @@ export default class KoenigImageEditor extends Component {
if (this.args.saveUrl) {
uploader.setFiles([result.dest]);
}
trackEvent('Image Edit Saved', {location: 'admin'});
} catch (e) {
// Failed to save edited image
}