ユニバーサルエディターイベント events
リモートアプリのコンテンツや UI の変更に対応するのに使用できる、ユニバーサルエディターが送信する様々なイベントについて説明します。
はじめに introduction
アプリケーションでは、ページまたはコンポーネントの更新に関して様々な要件がある場合があります。したがって、ユニバーサルエディターは、定義済みのイベントをリモートアプリケーションに送信します。リモートアプリケーションに送信されたイベントに対するカスタムイベントリスナーがない場合、universal-editor-cors パッケージによって提供されるフォールバックイベントリスナーが実行されます。
すべてのイベントは、リモートページの影響を受ける DOM 要素で呼び出されます。イベントは、universal-editor-cors パッケージによって提供されるデフォルトのイベントリスナーが登録されている BODY 要素までバブルアップします。コンテンツ用のイベントと UI 用のイベントがあります。
すべてのイベントは命名規則に従います。
aue:<content-or-ui>-<event-name>
例えば、aue:content-update と aue:ui-select です。
イベントには、リクエストと応答のペイロードが含まれ、対応する呼び出しが成功するとトリガーされます。呼び出しとそのペイロードの例について詳しくは、ユニバーサルエディターの呼び出しドキュメントを参照してください。
コンテンツ更新イベント content-events
aue:content-add content-add
aue:content-add イベントは、コンテナに新しいコンポーネントを追加した際にトリガーされます。
ペイロードは、ユニバーサルエディターサービスからのコンテンツと、コンポーネント定義からのフォールバックコンテンツです。
{
    details: {
        request: request payload;   // what is sent to the service
        response: {                 // what is returned by the service
            resource: string;       // newly created content resource
            updates: [{
                resource: string;   // resource to update
                type: string;       // type of instrumentation
                content?: string;   // content to replace
            }]
        }
    }
}
            aue:content-details content-details
aue:content-details イベントは、プロパティパネルにコンポーネントを読み込んだ際にトリガーされます。
ペイロードは、コンポーネントのコンテンツであり、オプションでそのスキーマでもあります。
{
    details: {
        content: object             // content object
        model: [object]             // model object
        request: request payload;   // what is sent to the service
        response: response payload; // what is returned by the service
    }
}
            aue:content-move content-move
aue:content-move イベントは、コンポーネントを移動した際にトリガーされます。
ペイロードは、コンポーネント、ソースコンテナ、ターゲットコンテナです。
{
    details: {
        from: string;                   // container we move the component from
        component: string;              // component we move
        to: string;                     // container we move the component to
        before: string;                    // before which component shall we place the component
        request: request payload;       // what is sent to the service
        response: response payload;     // what is returned by the service
    }
}
            aue:content-patch content-patch
aue:content-patch イベントは、プロパティパネルでコンポーネントのデータを更新した際にトリガーされます。
ペイロードは、更新したプロパティの JSON パッチです。
{
    details: {
        patch: {
            name: string;               // attribute which is updated
            value: string;              // new value which is stored to the attribute
        },
        request: request payload;       // what is sent to the service
        response: response payload;     // what is returned by the service
    }
}
            aue:content-remove content-remove
aue:content-remove イベントは、コンポーネントをコンテナから削除した際にトリガーされます。
ペイロードは、削除したコンポーネントの項目 ID です。
{
    details: {
        resource: string;               // the resource which got removed
        request: request payload;       // what is sent to the service
        response: response payload;     // what is returned by the service
    }
}
            aue:content-update content-update
aue:content-update イベントは、コンポーネントのプロパティをコンテキスト内で更新した際にトリガーされます。
ペイロードは、更新した値です。
{
    details: {
        value: string;                  // updated value
        request: request payload;       // what is sent to the service
        response: response payload;     // what is returned by the service
    }
}
            ペイロードの受け渡し passing-payloads
すべてのコンテンツ更新イベントでは、リクエストしたペイロードと応答ペイロードがイベントに渡されます。例:更新呼び出しの場合:
リクエストペイロード:
{
  "connections": [
    {
      "name": "aemconnection",
      "protocol": "aem",
      "uri": "https://author-p7452-e12433.adobeaemcloud.com"
    }
  ],
  "target": {
    "resource": "urn:aemconnection:/content/dam/wknd-shared/en/magazine/arctic-surfing/aloha-spirits-in-northern-norway/jcr:content/data/master",
    "type": "text",
    "prop": "title"
  },
  "value": "Alhoa Spirit Northern Norway!"
}
            応答ペイロード
{
    "updates": [
        {
            "resource": "urn:aemconnection:/content/dam/wknd-shared/en/magazine/arctic-surfing/aloha-spirits-in-northern-norway/jcr:content/data/master",
            "prop": "title",
            "type": "text"
        }
    ]
}
            UI イベント ui-events
aue:ui-preview ui-preview
aue:ui-preview イベントは、ページの編集モードを プレビュー に変更した際にトリガーされます。
ペイロードは、このイベントの場合は空です。
{
    details: {}
}
            aue:ui-edit ui-edit
aue:ui-edit イベントは、ページの編集モードを 編集 に変更した際にトリガーされます。
ペイロードは、このイベントの場合は空です。
{
    details: {}
}
            aue:ui-viewport-change ui-viewport-change
aue:ui-viewport-change イベントは、ビューポートのサイズを変更した際にトリガーされます。
ペイロードは、ビューポートのディメンションです。
{
    details: {
        height: number?;        // height of the viewport. Undefined when fullscreen
        width: number?;         // width of the viewport. Undefined when fullscreen
    }
}
            aue:initialized initialized
aue:initialized イベントは、ユニバーサルエディターに正常に読み込まれたことをリモートページに通知するためにトリガーされます。
ペイロードは、このイベントの場合は空です。
{
    details: {}
}
            フォールバックイベントリスナー fallback-listeners
コンテンツの更新 content-update-fallbacks
aue:content-addaue:content-detailsaue:content-moveaue:content-patchaue:content-removeaue:content-updateinnerHTML を更新UI イベント ui-event-fallbacks
aue:ui-selectaue:ui-previewclass="adobe-ue-preview" を追加aue:ui-editclass=adobe-ue-edit" を追加aue:ui-viewport-changeaue:initialized