# :icon-browser: Web Editor

The web editor provides a full browser-based GUI for managing advancements. It communicates with the server via a REST API.

* * *

#### 

**Workflow**

1. **Upload:** Run `/padv editor` to upload current advancements to the API
2. **Authorize:** Run `/padv editor-trust <code>` to authorize your browser (code shown in editor)
3. **Edit:** Use the web editor at the provided URL
4. **Apply:** Copy the `/padv apply <token>` command and run it on the server

* * *

#### 

**Editor Features**

- **Sidebar:** Tab selector dropdown at the top + advancement list filtered by selected tab
- **Tree View:** Visual hierarchy with connection lines, drag-and-drop positioning, zoom/pan
- **5-tab Editor:** Basic, Trigger, Display, Rewards, Advanced
- **Search & Filter:** Search advancements by name or ID
- **Import/Export:** Full JSON import and export
- **Tab Management:** Create, rename, configure, and delete tabs
- **Icon Picker:** Browse all Minecraft items with textures
- **Stale Session Detection:** Warns if server data was modified externally
- **Auto-refresh:** Detects server reloads and warns the user

* * *

#### 

**v2.1+ Features**

**Color Code Preview** (v2.1+): The editor renders all color formats in real-time:
- Title and description fields show live `mcPreview()` with 🖌️ color/format picker (16 swatches + 6 format buttons)
- Broadcast message field also has live preview + picker
- Color preview in sidebar list, tree view nodes, and tooltips
- Supports `&0`-`&f` legacy codes, `&#RRGGBB` hex, MiniMessage tags (`<gradient>`, `<rainbow>`, `<bold>`, `<light_purple>`, etc.)

Three fields are version-gated and require plugin v2.1+ (the editor detects the plugin version from the `__version__` field in session data):

| Field | Location | Description |
|-------|----------|-------------|
| **Tab Position** | Tab Settings > General | Sets the `tabOrder` for the tab selector GUI sorting. Lower numbers appear first. |
| **Root Icon Custom Model Data** | Tab Settings > Display | Custom model data for the tab root icon (ItemsAdder/Oraxen). |

When running plugin v2.0, these fields show "Requires plugin v2.1+" placeholders.

**Tab Settings modal** (v2.1+): The tab settings dialog now has internal tab navigation (General / Display / Advanced) for better organization.

**Inline command editing** (v2.1+): Reward commands in the Rewards tab are now editable inline without opening a separate modal.

* * *

#### 

**Trust System**

The first time you open the web editor, it generates a trust code. You must run `/padv editor-trust <code>` on the server to authorize the browser session. Trust codes are stored in `editor-trusted.json`.

* * *

#### 

**Apply Command**

```bash
/padv apply <token>
/padv apply <token> --force    # Skip stale session check
```

The apply command:
1. Downloads the editor data from the API
2. Parses the JSON into advancement objects
3. Saves all tabs to their respective files
4. Removes tab files that no longer exist
5. Reloads the plugin (1 tick delay)
6. Re-shows all tabs to online players

* * *

#### 

**Configuration**

```yaml
editor:
  enabled: true
  api-url: "https://api.skyxnetwork.net"
  editor-url: "https://skyxnetwork.net/editor"
  debug: false
```
