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

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

      • 概述
      • 全局对象

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

        • BooleanOperationNode
        • ComponentNode
        • ComponentSetNode
        • DocumentNode
        • EllipseNode
        • 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
    • 更新日志

CommandItem

CommandItem 为自定义菜单、工具或快捷方式的定义,应用于以下接口:

  • pixso.setTopTools(tools: Tool[]): void
  • pixso.setBottomTools(tools: Tool[]): void
  • pixso.stickyToolbar.open(tools: Tool[]): void
  • pixso.setContextMenus(menus: ContextMenuItem[]): void
  • pixso.setShortcuts(shortcuts: ShortcutItem[]): void
// 菜单项
type CommandItem = {
  label: string;
  value: string;
  disabled?: boolean;
  description?: string;
  icon?: string | Uint8Array; // svg字符串 或 图片二进制数据。PS:iconUrl也存在时,优先使用icon数据
  iconUrl?: string;
};

// 不携带图标的菜单项
type CommandItemWithoutIcon = Omit<CommandItem, "icon" | "iconUrl">;

// 分割线
type SeparatorItem = {
  separator: true;
};

ToolItem

type ToolItem =
  | SeparatorItem
  | (CommandItem & {
      children?: Array<ToolItem>;
    });

ContextMenuItem

type ContextMenuItem =
  | SeparatorItem
  | (CommandItemWithoutIcon & {
      children?: Array<ContextMenuItem>;
    });

ShortcutItem

type SubShortcutItem = CommandItemWithoutIcon & {
  children?: Array<SubShortcutItem>;
};

type ShortcutItem = CommandItem & {
  children?: Array<SubShortcutItem>;
};
Prev
BlendMode
Next
ComponentProperties-Related