1.0.2 • Published 5 months ago

@easy-editor/plugin-dashboard v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

@easy-editor/plugin-dashboard

Dashboard plugin for EasyEditor. This plugin provides dashboard functionality for managing elements on a canvas-like editor interface, with features like:

  • Element positioning and drag-and-drop
  • Grouping and ungrouping elements
  • Element layering (move to top, bottom, etc.)
  • Guidelines and element alignment
  • Visual feedback and layout management

Features

Positioning and Movement

The dashboard plugin handles precise positioning of elements on your canvas with:

  • Drag-and-drop movement with position tracking
  • Automatic alignment guides with element snapping
  • Coordinate-based positioning with x, y, width, and height properties

Element Grouping

Easily organize your design by grouping elements together:

ActionDescription
Group ElementsCombine multiple elements into a single manageable group
UngroupSplit a group back into individual elements
Nested GroupsSupport for groups within groups

Element Layering

Control the stacking order of elements on your dashboard:

MethodDescription
levelTop()Move element to the front
levelBottom()Send element to the back
levelUp()Move element up one layer
levelDown()Move element down one layer
moveToLevel(level)Move element to a specific layer

Guide Lines

The plugin provides smart guide lines that help with precise element alignment:

  • Automatic alignment to element edges and centers
  • Configurable guide lines at specific positions
  • Visual feedback during element movement

Usage Example

import { DashboardPlugin } from '@easy-editor/plugin-dashboard';

// Define your group component metadata
const groupMeta = {
  componentName: 'Group',
  title: 'Group',
  category: 'inner',
  configure: {
    advanced: {
      view: GroupComponent
    }
  }
};

// Initialize the plugin with required configuration
DashboardPlugin({
  group: {
    meta: groupMeta,
    initSchema: {
      componentName: 'Group',
      title: 'Group',
      isGroup: true,
    },
  }
})

Configuration Options

The plugin accepts a configuration object with the following properties:

Group Component

The group property is required and defines how groups will be handled in the dashboard:

{
  group: {
    // Component metadata for the group
    meta: ComponentMetadata;

    // Initial schema for new groups
    initSchema: NodeSchema;
  }
}

API Extensions

The dashboard plugin extends several core interfaces with additional methods:

Document Extensions

  • document.group(nodeIdList) - Group multiple nodes together
  • document.ungroup(group) - Ungroup a group node

Node Extensions

  • node.isGroup - Boolean indicating if node is a group
  • node.getDashboardRect() - Get positioning rectangle
  • node.updateDashboardRect(rect) - Update positioning
  • node.getNodesInGroup() - Get direct child nodes in a group
  • node.getAllNodesInGroup() - Get all nested nodes in a group
  • node.getCurrentGroup() - Get immediate parent group
  • node.getTopGroup() - Get top-most parent group
  • node.getAllGroups() - Get all parent groups

Designer Extensions

  • designer.guideline - Access to guidelines functionality
1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

6 months ago

0.0.17

6 months ago

0.0.16

7 months ago

0.0.15

7 months ago

0.0.14

8 months ago

0.0.13

8 months ago

0.0.12

8 months ago

0.0.11

8 months ago

0.0.10

8 months ago

0.0.9

8 months ago

0.0.8

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.2

9 months ago

0.0.2-alpha.2

9 months ago

0.0.2-alpha.1

9 months ago

0.0.2-alpha.0

9 months ago

0.0.1

9 months ago