Install
openclaw skills install slide-editorVisual editor for HTML presentations. Self-contained, offline-capable, designed for AI agent control. HTML 演示文稿可视化编辑器,自包含可离线,支持 AI Agent 控制。
openclaw skills install slide-editorVisual editor for HTML presentations. Self-contained, offline-capable, designed for both AI agent control and direct user manipulation.
Prerequisites: Install bun first (required for running the injector).
# macOS/Linux
curl -fsSL https://bun.sh/install | bash
# Windows (PowerShell)
powershell -c "irm bun.sh/install.ps1 | iex"
# Or use npm
npm install -g bun
Then install and build:
# Clone or download this project
cd slide-editor
# Install dependencies and build (use bun, not npm)
bun install
bun run build
When user wants to visually edit an HTML presentation:
# Inject editor and open in browser (one command)
bun ~/projects/slide-editor/inject.ts <html-file> --inline --enable --open
This will:
# Full workflow: inject + enable + open (recommended)
bun ~/projects/slide-editor/inject.ts presentation.html --inline --enable --open
# Inline mode (single file, portable)
bun ~/projects/slide-editor/inject.ts presentation.html --inline --enable
# Link mode (separate bundle file)
bun ~/projects/slide-editor/inject.ts presentation.html --link --enable
# Remove editor from HTML
bun ~/projects/slide-editor/inject.ts presentation.html --remove
| Action | How |
|---|---|
| Select | Click on element |
| Move | Drag selected element |
| Resize | Drag 8 corner handles |
| Edit text | Double-click text |
| Delete | Delete/Backspace key |
| Undo | Ctrl/Cmd + Z |
| Redo | Ctrl/Cmd + Shift + Z |
| Toggle Panel | P key or Panel button |
| Toggle Theme | T key or Theme button |
| Deselect | Escape |
| Button | Function |
|---|---|
| T | Add text box |
| Image | Add image (file picker) |
| Trash | Delete selected |
| Undo/Redo | History controls |
| Panel | Toggle properties panel |
| Theme | Toggle light/dark/auto theme |
| Export | Export as new HTML file |
--open flagAll methods available via window.__openclawEditor:
enable() / disable() - Toggle editorisEnabled() - Check if activeaddSlide(index?) - Add new slidedeleteSlide(index) - Delete slidemoveSlide(from, to) - Reorder slideduplicateSlide(index) - Copy slidegetSlides() - Get all slidesgetCurrentSlide() / setCurrentSlide(index) - Get/set currentaddText(options) - Add text boxaddImage(options) - Add image (supports local file via File picker)deleteElement(id) / deleteSelected() - DeletemoveElement(id, x, y) - MoveresizeElement(id, w, h) - ResizesetTextContent(id, content) - Set textsetStyle(id, styles) - Apply CSScropImage(id, rect) - Crop imagebringToFront(id) / sendToBack(id) - Layer orderselectElement(id) / deselectAll()getSelectedElement() / getSelectedElements()undo() / redo()canUndo() / canRedo()export() - Export clean HTMLexportWithEditor() - Export with editor embeddedinterface TextOptions {
x?: number; y?: number;
width?: number; height?: number;
content?: string;
fontSize?: string;
color?: string;
fontWeight?: string;
textAlign?: 'left' | 'center' | 'right';
}
interface ImageOptions {
x?: number; y?: number;
width?: number; height?: number;
src: string; // URL or data URI
alt?: string;
}
interface CropRect {
x: number; y: number;
width: number; height: number;
}
// Add text
window.__openclawEditor.addText({
x: 100, y: 200, width: 400,
content: 'Hello World',
fontSize: '48px'
});
// Move element
window.__openclawEditor.moveElement('editor-el-1', 150, 250);
// Export
const html = window.__openclawEditor.export();
HTML 演示文稿的可视化编辑器。自包含、可离线使用,支持 AI Agent 控制和直接用户操作。
前置条件:先安装 bun(运行注入器必需)。
# macOS/Linux
curl -fsSL https://bun.sh/install | bash
# Windows (PowerShell)
powershell -c "irm bun.sh/install.ps1 | iex"
# 或使用 npm
npm install -g bun
然后安装和构建:
# 克隆或下载此项目
cd slide-editor
# 安装依赖并构建(使用 bun,不要用 npm)
bun install
bun run build
当用户想要可视化编辑 HTML 演示文稿时:
# 注入编辑器并在浏览器中打开(一条命令)
bun ~/projects/slide-editor/inject.ts <html文件> --inline --enable --open
这将:
# 完整流程:注入 + 启用 + 打开(推荐)
bun ~/projects/slide-editor/inject.ts presentation.html --inline --enable --open
# 内联模式(单文件,便携)
bun ~/projects/slide-editor/inject.ts presentation.html --inline --enable
# 链接模式(独立的 bundle 文件)
bun ~/projects/slide-editor/inject.ts presentation.html --link --enable
# 从 HTML 中移除编辑器
bun ~/projects/slide-editor/inject.ts presentation.html --remove
| 操作 | 方法 |
|---|---|
| 选择 | 点击元素 |
| 移动 | 拖拽选中的元素 |
| 调整大小 | 拖拽 8 个角点手柄 |
| 编辑文本 | 双击文本 |
| 删除 | Delete/Backspace 键 |
| 撤销 | Ctrl/Cmd + Z |
| 重做 | Ctrl/Cmd + Shift + Z |
| 切换面板 | P 键或面板按钮 |
| 切换主题 | T 键或主题按钮 |
| 取消选择 | Escape |
| 按钮 | 功能 |
|---|---|
| T | 添加文本框 |
| 图片 | 添加图片(文件选择器) |
| 垃圾桶 | 删除选中 |
| 撤销/重做 | 历史控制 |
| 面板 | 切换属性面板 |
| 主题 | 切换亮/暗/自动主题 |
| 导出 | 导出为新的 HTML 文件 |
--open 标志运行 inject.ts所有方法通过 window.__openclawEditor 访问:
enable() / disable() - 切换编辑器isEnabled() - 检查是否激活addSlide(index?) - 添加新幻灯片deleteSlide(index) - 删除幻灯片moveSlide(from, to) - 重新排序幻灯片duplicateSlide(index) - 复制幻灯片getSlides() - 获取所有幻灯片getCurrentSlide() / setCurrentSlide(index) - 获取/设置当前幻灯片addText(options) - 添加文本框addImage(options) - 添加图片(支持通过文件选择器选择本地文件)deleteElement(id) / deleteSelected() - 删除moveElement(id, x, y) - 移动resizeElement(id, w, h) - 调整大小setTextContent(id, content) - 设置文本setStyle(id, styles) - 应用 CSScropImage(id, rect) - 裁剪图片bringToFront(id) / sendToBack(id) - 图层顺序selectElement(id) / deselectAll()getSelectedElement() / getSelectedElements()undo() / redo()canUndo() / canRedo()export() - 导出干净的 HTMLexportWithEditor() - 导出带编辑器的 HTML// 添加文本
window.__openclawEditor.addText({
x: 100, y: 200, width: 400,
content: '你好世界',
fontSize: '48px'
});
// 移动元素
window.__openclawEditor.moveElement('editor-el-1', 150, 250);
// 导出
const html = window.__openclawEditor.export();