Pixso Open Documentation
guide
  • 中文
  • English
guide
  • 中文
  • English
  • Plugin API

    • Brief Introduction
    • Prerequisites
    • manifest
    • Development Guide
    • Change Log
    • Plugin API Documentation

      • Overview
      • Global Object

        • pixso
        • pixso.ui
        • pixso.host
        • pixso.mouse
        • pixso.editor
        • pixso.keyboard
        • pixso.fieldset
        • pixso.viewport
        • pixso.vectorEditor
        • pixso.clientStorage
        • pixso.serverStorage
      • Node Types

        • BooleanOperationNode
        • ComponentNode
        • ComponentSetNode
        • DocumentNode
        • EllipseNode
        • FrameNode
        • GroupNode
        • InstanceNode
        • LineNode
        • PageNode
        • PolygonNode
        • RectangleNode
        • SectionNode
        • SliceNode
        • StarNode
        • TextNode
        • VectorNode
      • Data Types

        • 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
        • StrokeCap
        • StrokeJoin
        • StyleChangeProperty
        • TextCase
        • TextDecoration
        • TextListOptions
        • ThemeType
        • ToolType
        • Transition
        • Trigger
        • Vector
    • Host API Documentation

      • Overview
      • Host API
  • Open API

    • OpenAPI Doc

CommandItem

CommandItem is the definition of a custom menu, tool or shortcut, and is applied to the following interfaces:

  • 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
interface CommandItem = {
  label: string;
  value: string;
  disabled?: boolean;
  description?: string;
  icon?: string | Uint8Array; // svg string or image binary data. PS: When iconUrl also exists, icon data will be used first.
  iconUrl?: string;
  children: Array<CommandItem>
};

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