Как получить доступ к методу экспорта photoeditorsdk, чтобы получить URL изображения? - PullRequest
0 голосов
/ 14 января 2019

Я не могу получить обновленный URL-адрес изображения из photoedior SDK.

это для интеграции фоторедактора SDK с угловым


let templateStr: string = `
  <ngui-react
    [reactComponent]="reactComponent"
    [reactProps]="reactProps">
  </ngui-react>
`;

export class PhotoEditorSDKDesktopUIComponent {
    reactComponent: React.Component;
    @Input() imageUrl;
    reactProps: any;
    @Input() license: string = license;
    constructor() {}

  ngOnChanges(changes): void {
    let firstNumber, secondNumber;
    const { derivativeUrl, sequence, name, code } = this.imageUrl;
    if (code) {
      [firstNumber, secondNumber] = code && code.split('X');
    }
    const image = new Image();
    image.crossOrigin = 'Anonymous';

    const defaultProps = {
      // license: license,
      assets: {
        baseUrl: '/assets/photoeditorsdk' // see angular-cli.json for configuraton
      },
      style: {
        width: 1024,
        height: 576
      },
      editor: {
        enableSave: true,
        enableExport: true,
        forceCrop: false,
        image: image,
        export: {
          fileBasename: 'pesdk-doc',
          format: 'image/jpeg',
          type: 'data-url',
          download: false
        },
        save: {
          fileBasename: 'pesdk-doc',
          download: false,
          format: 'text/json',
          image: true
        },
        controlsOptions: {
          transform: {
            categories: [
              {
                identifier: name,
                defaultName: code,
                ratios: [
                  {
                    identifier: name, 
                    defaultName: name, 
                    ratio: Number(firstNumber) / Number(secondNumber)
                  }
                ]
              }
            ]
          },
          replaceCategories: false
        }
      }
    };

    const licenseProps = {
      license: this.license
    };
    defaultProps.editor.image['src'] = s3Prefix + derivativeUrl;
    this.reactComponent = PhotoEditorDesktopUI.ReactComponent; 
    this.reactProps = { ...defaultProps, ...licenseProps };
  }
}

Я не уверен, где написать функцию экспорта, чтобы получить ответ от photoeditorsdk? Любая помощь будет отличной, спасибо! событие не может получить доступ к методу сохранения, а также не уверен, где что-то не так.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...