# liferay/alloy-editor architecture

> Architecture diagram of the GitHub repository liferay/alloy-editor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/liferay/alloy-editor
- Repository: https://github.com/liferay/alloy-editor

## Overview

##### Main Components Identification

The system should be represented with these key components:

a. Core Layer:
- CKEditor Integration (/lib/ckeditor)
- Core Services (/src/core)
- OOP Implementation (/src/oop)

b. Plugin System:
- Plugin Manager (/src/plugins)
- Core Plugins (dragresize, embed, autolink, etc.)

c. UI Layer:
- React Components (/src/components)
- Toolbar System (/src/components/toolbars)
- Button System (/src/components/buttons)

d. Asset Management:
- Language Files (/src/assets/lang)

**┌─────────────────────────────────────────────────────┐**
- UI Layer (React)                  │
- ┬───────────────────┬────────────────┤
- Toolbars    │     Buttons      │  UI Bridge     │
- ┬───────┴───────┬───────────┴────────┬───────┘

**┌───────▼───────┬───────▼───────┬────────────▼───────┐**
- Core Layer   │Plugin System  │   Asset Manager    │
- ┼───────────────┼──────────────────┤
- CKEditor     │ Plugin Manager│    Languages     │
- Core Services│ Core Plugins  │    Styles        │
- ┴───────────────┴──────────────────┘

##### Interaction Flows

- Data flow between UI and Core Layer
- Plugin integration points
- Asset loading paths
- Event propagation

##### Key Elements to Highlight

a. Integration Points:
- CKEditor Bridge
- UI Bridge Components
- Plugin System Hooks

b. Core Features:
- Selection Management
- Toolbar Positioning
- Event Handling
- Asset Loading

##### Implementation Details

Notes about:
- React Component Architecture
- Plugin Extension System
- Internationalization Support
- Theme/Skin System

##### The asset management system

This will provide a comprehensive view of Alloy Editor's architecture while maintaining clarity about component relationships and data flow.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef plugin fill:#e67e22,stroke:#d35400,color:white
    classDef asset fill:#9b59b6,stroke:#8e44ad,color:white

    %% UI Layer
    subgraph UILayer["UI Layer (React)"]
        UI_COMP["React Components"]
        TOOLBAR["Toolbar System"]
        BUTTONS["Button System"]
        UI_BRIDGE["UI Bridge Components"]
        BASE_COMP["Base Components"]
    end

    %% Core Layer
    subgraph CoreLayer["Core Layer"]
        CKEDITOR["CKEditor Integration"]
        CORE["Core Services"]
        OOP["OOP Implementation"]
        SELECTION["Selection Management"]
    end

    %% Plugin System
    subgraph PluginSystem["Plugin System"]
        PLUGIN_MGR["Plugin Manager"]
        CORE_PLUGINS["Core Plugins"]
    end

    %% Asset Management
    subgraph AssetLayer["Asset Management"]
        LANG["Language Files"]
        STYLES["Icons & Styles"]
    end

    %% Relationships
    UI_COMP --> CORE
    TOOLBAR --> UI_COMP
    BUTTONS --> UI_COMP
    UI_BRIDGE --> CKEDITOR
    BASE_COMP --> UI_COMP
    CORE --> CKEDITOR
    PLUGIN_MGR --> CORE
    CORE_PLUGINS --> PLUGIN_MGR
    LANG --> UI_COMP
    STYLES --> UI_COMP
    OOP --> CORE
    SELECTION --> CORE

    %% Click Events
    click CKEDITOR "https://github.com/liferay/alloy-editor/tree/master/lib/ckeditor"
    click CORE "https://github.com/liferay/alloy-editor/tree/master/src/core"
    click OOP "https://github.com/liferay/alloy-editor/tree/master/src/oop"
    click PLUGIN_MGR "https://github.com/liferay/alloy-editor/tree/master/src/plugins"
    click UI_COMP "https://github.com/liferay/alloy-editor/tree/master/src/components"
    click TOOLBAR "https://github.com/liferay/alloy-editor/tree/master/src/components/toolbars"
    click BUTTONS "https://github.com/liferay/alloy-editor/tree/master/src/components/buttons"
    click LANG "https://github.com/liferay/alloy-editor/tree/master/src/assets/lang"
    click STYLES "https://github.com/liferay/alloy-editor/tree/master/src/assets/sass"
    click UI_BRIDGE "https://github.com/liferay/alloy-editor/tree/master/src/components/uibridge"
    click BASE_COMP "https://github.com/liferay/alloy-editor/tree/master/src/components/base"
    click SELECTION "https://github.com/liferay/alloy-editor/tree/master/src/selections"

    %% Style Applications
    class UI_COMP,TOOLBAR,BUTTONS,UI_BRIDGE,BASE_COMP ui
    class CKEDITOR,CORE,OOP,SELECTION core
    class PLUGIN_MGR,CORE_PLUGINS plugin
    class LANG,STYLES asset

    %% Legend
    subgraph Legend
        UI_LEGEND["UI Components"]:::ui
        CORE_LEGEND["Core Components"]:::core
        PLUGIN_LEGEND["Plugin System"]:::plugin
        ASSET_LEGEND["Asset Management"]:::asset
    end
```
