当前位置: 首页 > Skill >

Slide Editor

Slide Editor

Slide Editor

Visual editor for HTML presentations. Self-contained, offline-capable, designed for AI agent control. HTML 演示文稿可视化编辑器,自包含可离线,支持 AI Agent 控制。

0.2.0 2026.11.23 687
获取Skill文件查看使用说明
作 者:沈知 许可证: 更新时间:2026.11.23
本文目录展开

Slide Editor

中文 | English

English

Visual editor for HTML presentations. Self-contained, offline-capable, designed for both AI agent control and direct user manipulation.

Installation

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

Quick Start

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:

  1. Inject the editor bundle into the HTML file
  2. Automatically open the browser with editor enabled

CLI Commands

# 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

User Interaction

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

Toolbar Buttons

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

Workflow

  1. Inject: Run inject.ts with --open flag
  2. Edit: Make changes in browser (editor auto-enables)
  3. Export: Click Export button
  4. Done: File is downloaded to your downloads folder

API Reference

All methods available via window.__openclawEditor:

Core

  • enable() / disable() - Toggle editor
  • isEnabled() - Check if active

Slides

  • addSlide(index?) - Add new slide
  • deleteSlide(index) - Delete slide
  • moveSlide(from, to) - Reorder slide
  • duplicateSlide(index) - Copy slide
  • getSlides() - Get all slides
  • getCurrentSlide() / setCurrentSlide(index) - Get/set current

Elements

  • addText(options) - Add text box
  • addImage(options) - Add image (supports local file via File picker)
  • deleteElement(id) / deleteSelected() - Delete
  • moveElement(id, x, y) - Move
  • resizeElement(id, w, h) - Resize
  • setTextContent(id, content) - Set text
  • setStyle(id, styles) - Apply CSS
  • cropImage(id, rect) - Crop image
  • bringToFront(id) / sendToBack(id) - Layer order

Selection

  • selectElement(id) / deselectAll()
  • getSelectedElement() / getSelectedElements()

History

  • undo() / redo()
  • canUndo() / canRedo()

Export

  • export() - Export clean HTML
  • exportWithEditor() - Export with editor embedded

Type Definitions

interface 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;
}

Examples

// 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

这将:

  1. 将编辑器包注入到 HTML 文件中
  2. 自动打开浏览器并启用编辑器

CLI 命令

# 完整流程:注入 + 启用 + 打开(推荐)
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 文件

工作流程

  1. 注入:使用 --open 标志运行 inject.ts
  2. 编辑:在浏览器中进行更改(编辑器自动启用)
  3. 导出:点击导出按钮
  4. 完成:文件下载到你的下载文件夹

API 参考

所有方法通过 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) - 应用 CSS
  • cropImage(id, rect) - 裁剪图片
  • bringToFront(id) / sendToBack(id) - 图层顺序

选择

  • selectElement(id) / deselectAll()
  • getSelectedElement() / getSelectedElements()

历史

  • undo() / redo()
  • canUndo() / canRedo()

导出

  • export() - 导出干净的 HTML
  • exportWithEditor() - 导出带编辑器的 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();

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,015
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,003
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,001
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,000
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,000
Docker私有仓库搭建、镜像上传排错及删除方法

本文介绍如何在CentOS环境下部署Docker私有仓库,解决因HTTPS协议导致的镜像推送失败问题,并说明如何通过第三方工具实现本地仓库中镜像的删除操作。

2026.06.12 1,000
Skill 文件
  • SKILL.md
    • Slide Editor
    • English
      • Installation
      • Quick Start
      • CLI Commands
      • User Interaction
      • Toolbar Buttons
      • Workflow
      • API Reference
        • Core
        • Slides
        • Elements
        • Selection
        • History
        • Export
      • Type Definitions
      • Examples
    • 中文
      • 安装
      • 快速开始
      • CLI 命令
      • 用户操作
      • 工具栏按钮
      • 工作流程
      • API 参考
        • 核心
        • 幻灯片
        • 元素
        • 选择
        • 历史
        • 导出
      • 示例
  • 项目或源文件

相关 Skill

更多
Acp Adapter Layer Acp Adapter Layer 面向AI原生全栈软件工厂的ACP(Agent Control Protocol)适配层——实现ASF多智能体工作流与Op...的无缝集成。
YouTube 幻灯片提取 YouTube 幻灯片提取 Extract, crop, deduplicate, timestamp, and package presentation slides shown in YouTube talks or local conference recordings. Use when a user provides a YouTube/video URL or local video and asks to recover the speaker's projected deck, extract ordered slide images, identify slide-change timestamps, create a contact sheet, or produce a pixel-faithful HTML or image-based PowerPoint reconstruction.
Ekybot Connector Ekybot Connector Connect OpenClaw to Ekybot for remote agent control, Companion machine health, and project memory sync. Use when installing/configuring the connector, valida...
Agent Control Agent Control 通过简短指令管理 OpenClaw 独立智能体。适用于创建、列出、切换、绑定、删除智能体,或将频道路由至特定对象等操作。
Digital Finance Presentation Skill Digital Finance Presentation Skill SAP企业超宽演示生成器,配备AI赋能方法论,为企业峰会、财务数字化等场景生成专业演示文稿。