Pixso 开放文档
插件 API
官方工具集
  • 中文
  • English
插件 API
官方工具集
  • 中文
  • English
  • 插件 API

    • 简介
    • 预备知识
    • manifest
    • 开发指南
    • 更新日志
    • Plugin API 文档

      • 概述
      • 全局对象

        • pixso
        • pixso.ui
        • pixso.host
        • pixso.mouse
        • pixso.editor
        • pixso.codegen
        • pixso.keyboard
        • pixso.fieldset
        • pixso.viewport
        • pixso.vectorEditor
        • pixso.stickyToolbar
        • pixso.clientStorage
        • pixso.serverStorage
      • 节点类型

        • BooleanOperationNode
        • ComponentNode
        • ComponentSetNode
        • DocumentNode
        • EllipseNode
        • FolderNode
        • FrameNode
        • GroupNode
        • InstanceNode
        • LineNode
        • PageNode
        • PolygonNode
        • RectangleNode
        • SectionNode
        • SliceNode
        • StarNode
        • TextNode
        • VectorNode
      • 样式类型

        • PaintStyle
        • TextStyle
        • EffectStyle
        • GridStyle
      • 数据类型

        • Action
        • ArcData
        • BlendMode
        • CommandItem
        • ComponentProperties-Related
        • Constraints
        • DialogType
        • DocumentationLink
        • Effect
        • EmbedData
        • ExportSettings
        • FontName
        • Guide
        • HandleMirroring
        • HyperlinkTarget
        • Image
        • LayoutGrid
        • LetterSpacing
        • Library
        • LineHeight
        • NodeChangeProperty
        • OverflowDirection
        • Overlay
        • Paint
        • PublishStatus
        • Reaction
        • Rect-related
        • RGB & RGBA
        • StickyToolbar
        • StrokeCap
        • StrokeJoin
        • StyleChangeProperty
        • TextCase
        • TextDecoration
        • TextListOptions
        • ThemeType
        • ToolType
        • Transition
        • Trigger
        • Vector
    • Host API 文档

      • 概述
      • Host API
  • 服务端 API

    • OpenAPI 文档
    • OpenAPI 文档
    • 事件订阅
    • 事件订阅
  • 客户端 API

    • 简介
    • 唤醒客户端
    • Web API
    • 更新日志
  • 其他 API

    • 预览模式
    • iframe 导入

iframe 导入

地址: ${domain_name}/app/import

  1. 通过 OpenAPI 生成文件 file_key, 将数据给到 Pixso

    文件类型: 设计文件(10)(默认)、原型文件(11)、白板文件(20)、AxureHtml 文件(31)

  2. Pixso 解析文件后进行上传操作,并将文件状态返回给外部,当对应 file_key 状态为 success 时,导入成功

// DC 发送 文件信息 给到 Pixso
interface FileConvertReqMsg {
    name: "/file/convert";
    type: "msg-api";
    data: {
        files: {
            fileKey: string,
            name: string, // 必须带文件后缀名
            buffer: ArrayBuffer,
        }[],
    };
}

enum ProgreesMessage {
    NONE = "",
    // 解压
    DECOMPRESS = "DECOMPRESS",
    // 解析
    PARSE_FILE = "PARSE_FILE",
    // 上传封面图
    UPLOAD_PREVIEW = "UPLOAD_PREVIEW",
    // 上传文件
    UPLOAD_FILE = "UPLOAD_FILE",
    // 上传图片
    UPLOAD_IMAGES = "UPLOAD_IMAGES",
}

// Pixso 将文件导入状态返回给 外部 (每个文件状态改变都会通知)
interface FileConvertResMsg {
    name: "/file/convert";
    type: "msg-event";
    data: {
        fileKey: string,
        status: "loading" | "success" | "error",
        // status 为 loading 时, message 枚举值如下:
        // DECOMPRESS 解压文件
        // PARSE_FILE 解析文件
        // UPLOAD_PREVIEW 上传封面图
        // UPLOAD_FILE 上传文件
        // UPLOAD_IMAGES 上传图片
        // status 为 error 时,message 为报错的原因
        message?: ProgreesMessage | string,
        // 进度,状态为 loading 时返回, 解析图片是 1/n 的进度,其余都是百分比进度
        progress?: string,
    };
}

eg:

iframe.contentWindow.postMessage({
    name: "/file/convert";
    type: "msg-api";
    data: {
        files: [{
            fileKey: string,
            name: "pixso.pix", // 必须带文件后缀名
            buffer: ArrayBuffer,
            isHtml: true, // 是否将 axure 文件当成 html 文件导入
        }],
    };
}, *);
Prev
预览模式