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({
trademark: false,
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
suggestionstrademark
trademarktools
toolsvisitor (認証付きアクセス)
visitor (認証付きアクセス)よくある落とし穴
最終更新
役に立ちましたか?