updateContent

コンテンツエディタで、拡張 CMS ワークスペースのコンテンツ項目の titlecontentBody を更新します。ユーザが、コンテンツエディタで [保存] をクリックすると、更新が永続化されます。

this.context.data.schema.schema.properties を使用することで、コンテンツタイプの contentBody プロパティ項目のリストを返すことができます。

構文 

1import { LightningElement, wire } from 'lwc';
2import { updateContent }  from experience/cmsEditorApi;
3class Example extends LightningElement{
4  // change the content in the editor
5  updateContent({
6    "title": "new title",
7    "contentBody: {
8      "name": "New name",
9      "description": "New description",
10      "excerpt": "new-excerpt"
11    }
12  }).then(() => {
13      //handle success
14  })
15}

パラメータ 

  • contentBody — (省略可能) コンテンツ本文の JSON 表現。コンテンツタイプによって返されるデータは異なります。Salesforce ヘルプの「Salesforce CMS のコンテンツに対応する JSON ファイル形式」を参照してください。
  • title — (省略可能) エディタ内のコンテンツ項目の新しいタイトル。

戻り値 

  • updateContent 応答が返されたときに解決される Promise オブジェクト。
  • error — 無効な項目に対する検証エラー。

The Japanese Summer '24 guide is now live

日本語の Summer '24 ガイドが公開されました! 「Component Reference (コンポーネントリファレンス)」は、以前と同様にコンポーネントライブラリにあります。