Node.js/NPM
NPMパッケージを使ってアプリケーションレベルでDocs Embedを統合する
手順
2
4
iframe を作成
const iframe = document.createElement("iframe");
iframe.src = gitbook.getFrameURL({
visitor: {
token: 'your-jwt-token', // 任意: Adaptive Content または認証アクセス用
unsignedClaims: { // 任意: 動的式用のカスタムクレーム
userId: '123',
plan: 'premium'
}
}
});
iframe.id = "gitbook-embed-container";
iframe.style.border = "none";
iframe.style.width = "100%";
iframe.style.height = "600px";5
6
7
埋め込みを設定
frame.configure({
tabs: ['assistant', 'docs'],
actions: [
{
icon: 'circle-question',
label: 'Contact Support',
onClick: () => window.open('https://support.example.com', '_blank')
}
],
greeting: { title: 'Welcome!', subtitle: 'How can I help?' },
suggestions: ['What is GitBook?', 'How do I get started?'],
tools: [/* ... */]
});API リファレンス
クライアントファクトリ
フレームクライアントのメソッド
設定オプション
tabs
tabsactions
actionsgreeting
greetingsuggestions
suggestionstools
toolsvisitor (認証付きアクセス)
visitor (認証付きアクセス)よくある落とし穴
最終更新
役に立ちましたか?