Editor
Editor 產品會將 Kaleidr 地圖編輯器掛載至您的頁面中。它採用
attach 接入方式 — MapLibre 與編輯器介面一起在父文件中運行,
並由您的應用程式控制。
決定是否能正常運作的三個關鍵因素
| 要素 | 說明 |
|---|---|
| 接入方式 | attach — 編輯器掛載在您的頁面內。MapLibre 不在 iframe 中運行,而是在父文件中運行。 |
| 所需範圍 | design — 金鑰必須包含 design 能力。 |
| 最低方案 | Pro — Free 方案的金鑰不允許使用 design 範圍。 |
瀏覽器能將 publishable 金鑰交換為工作階段之前,您的頁面來源必須
位於該金鑰的 origin allowlist 中。Editor 在父文件中運行的 MapLibre
還要求客戶 CSP 中包含 'wasm-unsafe-eval' — 請參閱
Content Security Policy。
各元件的位置
- SDK 參考 — Editor attach — 屬性、掛載
選項與 handle matrix(
destroy,setCamera)。 - 指南:
唯一需要的程式碼片段
最小可用的編輯器掛載。目前在掛載時支援 pitch 與 bearing;
掛載後的即時相機更新將隨 editor-ui SDK 版本提供,
該版本與本文件分開追蹤。
<div id="editor" style="height:640px"></div>
<script src="https://cdn.kaleidr.com/embed/v1/kaleidr.js"></script>
<script>
Kaleidr.mount('#editor', {
product: 'editor',
publishableKey: 'kld_pk_live_…',
});
</script>