4

Aviary Feather の統合に問題があります。私のjavascriptでは、次のようにFeathersを使用する必要があります:

// Aviary init
var featherProductEditor = new Aviary.Feather({
  apiKey: 'myapykey',
  apiVersion: 3,
  theme: 'dark',
  tools: 'all',
  appendTo: '',
  onSave: function(imageID, newURL) {
    // Do things for featherProductEditor
    console.log('featherProductEditor');
    // Close the editor
    featherProductEditor.close();
  }
});

// Aviary init
var featherContentBlockEditor = new Aviary.Feather({
  apiKey: 'myapykey',
  apiVersion: 3,
  theme: 'light',
  tools: 'all',
  appendTo: '',
  onSave: function(imageID, newURL) {
    // Do things for featherContentBlockEditor
    console.log('featherContentBlockEditor');
    // Close the editor
    featherContentBlockEditor.close();
  }
});

そして二人をフェザーと呼ぶ

featherProductEditor.launch({ ....

featherContentBlockEditor.launch({ ....

ただし、呼び出される唯一の「onSave*:」コールバックは、「featherContentBlockEditor」変数の 2 番目のものです。

なんで?どうすればこれを解決できますか?

4

3 に答える 3

3

最初の質問で、なぜ 2 番目だけonSaveが呼び出されるのですか?

内部的には、Aviary Web SDK はフェザー構成を に保存しAV.launchData、グローバル変数AVのエイリアスです。Aviaryこれは、Aviary.Feather関数のコード スニペットです。

AV.Feather = function (config) {
    ...
    AV.launchData = AV.util.extend(AV.baseConfig, config);
    ...
}

つまり、featherContentBlockEditorの構成が の構成をオーバーライドしfeatherProductEditorます。

AV.launchData.onSave()これは、各フェザーの作成後に追加することで確認できます。

2 番目の質問については、どうすれば解決できますか?

いいえ、SDK にハッキングしないとできません。これが Aviary Web SDK の仕組みAviary.Featherです。ページごとに のインスタンスを 1 つだけ定義します。

于 2014-06-19T03:20:13.133 に答える
0

特定のページに Aviary エディターのインスタンスを 1 つしか持つことができませんが、次を呼び出して再利用できます。

  editor.close(true); // passing true forces an immediate close without triggering shutdown animation
  editor.launch({ image: new_id, url: new_url });
于 2014-10-30T18:55:46.060 に答える