演示模式
UniverSlidesUIPlugin 会为当前演示文稿注册播放能力。播放按幻灯片顺序进行,跳过标记为跳过的页面,并在每次移动时应用解析后的切换效果。
开始播放
TypeScript
const presentation = univerAPI.getActivePresentation()if (presentation) { await univerAPI.executeCommand('slide.operation.presentation.start', { unitId: presentation.getId(), fromBeginning: true, })}设置 fromBeginning: false 可从当前幻灯片开始;传入 startSlideId 可指定一张可见幻灯片。
导航与停止
TypeScript
await univerAPI.executeCommand('slide.operation.presentation.next')await univerAPI.executeCommand('slide.operation.presentation.previous')await univerAPI.executeCommand('slide.operation.presentation.go-to-slide', { slideId: 'summary-slide',})await univerAPI.executeCommand('slide.operation.presentation.stop')到达最后一张可见幻灯片后再次执行下一页会停止播放;在第一页执行上一页会返回 false。
浏览器行为
全屏和双屏演示依赖浏览器 API。请直接在用户手势中打开观众窗口,避免被弹窗拦截。只读 Slides UI 只要注册了 UI 插件并关闭编辑,也可以运行演示模式。
你觉得这篇文档如何?