# 2. The editor

The builder opens from **Edit with Jikji** on a post's edit screen (post types enabled in the settings) or from the Site Editor's "Edit with Jikji" for templates, parts and patterns ([Templates 6.2](06-templates.md#62-the-site-editor-is-the-entry-point)). The screen is a toolbar, a left panel, the canvas and a right panel; a footer line reports saves, warnings and errors.

## 2.1 The toolbar

| Left | |
|---|---|
| **+** Add block | Toggles the left panel to the block catalogue ([Blocks](03-blocks.md)): Layout, Basic, Media, Widgets, and **WordPress** blocks with search, categories and *Recent*. A block is added into the selected container, or after the selected element |
| **Navigator** | The element tree: select elements, drag to reorder or move them into another container, and see loop badges (↻ `$item` · N items) and expression errors |
| **Styles** | The classes the page uses; pick one to edit its global styles ([Styles 4.1](04-styles.md#41-id-styles-and-class-styles)) |
| **History** | The revision list (time, author, kind) with restore ([2.6](#26-saving-publishing-and-history)) |

| Centre | |
|---|---|
| **Canvas reload** | Re-renders the canvas (theme styles, samples, block previews) |
| Canvas size | Desktop, Tablet Portrait, Mobile Landscape, Mobile Portrait, or an exact **W** / **H** and a **%** zoom. The size also chooses the breakpoint you are editing ([Styles 4.3](04-styles.md#43-breakpoints-and-responsive-editing)) |

| Right | |
|---|---|
| **Undo** / **Redo** | Also Ctrl/⌘+Z and Ctrl/⌘+Y or Shift+Z (outside text inputs and the block editor) |
| **Back to WordPress admin** | The post's edit screen; for a template, part or pattern the document in the Site Editor |
| **Preview** | The draft as it will render — a page preview, or a template's preview on the site (parts and patterns ask on which page) |
| **View site** | The live page |
| **Save** | Validates and saves. On a draft page it only stores the document. On a published page it compiles and the live page changes at once (the button says so). A template document reads *Save draft* or *Save and publish* depending on its Jikji state. After a failed compile the footer shows the error and the button offers *Retry publish* |

## 2.2 The canvas

The canvas is an iframe with the theme's own stylesheets (loaded in the document's front-end context, so a page is styled as `is_page()`, a template under its sample query), the document's live styles and the block previews. Click to select, type into text blocks directly. Elements the page outputs dynamically are shown with **sample values** from the server: a bound text shows the evaluated value or a label chip, a loop shows its first item with a count badge, a block island shows the block as the front end renders it, a shortcode shows a static render. Scripts never run on the canvas; forms, players and the like are checked in Preview.

The canvas never executes PHP: Code blocks are placeholders, and the HTML of a `j:html` binding is shown with scripts stripped.

## 2.3 The right panel — Properties

With an element selected:

- **ID** — the server ID (`jk-…`), read-only.
- **Classes** — chips and **Add class**. A class name must be letters, digits, `-`, `_`, not start with a digit, at most 150 characters, and must not equal an element ID of the document. Click a chip to edit the class's global styles instead of the ID styles.
- **State** — Default, Hover, Keyboard focus, Focus inside, Pressed, Disabled, Current, Selected, Expanded, Open, Checked: the style sections then edit that state and the canvas shows the element in it ([Styles 4.4](04-styles.md#44-states)).
- The **style sections** — Layout, Flex/Grid Child, Spacing, Size, Position, Typography, Backgrounds, Borders, Box/Text Shadows, Transitions, Transforms, Filter, List Item, Advanced ([Styles 4.2](04-styles.md#42-the-style-panel)). Values are set for the breakpoint the canvas size selects.
- **Block settings** for the block kind — Media (Image: Media Library, Alt, Lazy load; Video: Autoplay, Muted, Controls), Link URL, Heading level, Icon (set, search), SVG (markup), Shortcode (tag completions), Code, Template Part (the part slug and a link to its editor).
- **Data** — Condition, Text, Attributes, Loop: the bindings of the element with a data picker ([Dynamic data 5.1](05-dynamic-data.md#51-context)). A bound text keeps its typed text as the canvas placeholder; a bound attribute keeps the static value as the placeholder.

Elements that are replaced on the page — a Template Part or a WordPress block — have no ID, class or styles of their own: their Properties tab shows a note and the Condition only.

## 2.4 The Block tab

Shown when the selected element is a WordPress block (a block island): the block card, the block canvas with the inspector, *Edit block* in a large modal, and **Remove block** ([Blocks 3.7](03-blocks.md#37-wordpress-blocks-block-islands)). The tab you chose stays while you move from island to island and returns to Properties on other elements.

## 2.5 The AI tab

Always present; it describes a change in words and the AI makes it with the editor's tools ([The AI tab](07-ai.md)).

## 2.6 Saving, publishing and history

- A **save** validates (structure, SVG sanitizing, the compiled PHP's syntax, style names, dropped CSS) and stores the document, the ID style rows and any changed class rows; warnings go to the footer. Each save that changes the document records a **revision** (the source HTML and a snapshot of its ID styles; the save kind is noted — publish or draft).
- **Publishing** compiles. A page publishes through WordPress (its status); a template, part or pattern through **Publish** in the template bar ([Templates 6.3](06-templates.md#63-template-documents-in-the-builder)). While a template's Jikji version is a draft, the site keeps using its blocks.
- **Optimistic locking**: the save carries the version you loaded; if someone else saved in between, the save is refused and you are told to reload.
- **History** (left panel) lists revisions and restores one: the restore is a new save of that revision's HTML and ID styles (class styles are global and are not restored — the panel shows what differs). The editor blocks input until the restored document is reloaded.
- The settings keep a number of revisions per document (20 by default; the latest published one always stays).

## 2.7 Template documents

A template, part or pattern adds the **template bar** above the canvas — kind and name, the state badge, *Preview on site…*, Publish/Unpublish and, for templates, the **Sample** selector that sets which post, archive or search the canvas and the data samples use ([Templates 6.3](06-templates.md#63-template-documents-in-the-builder), [6.6](06-templates.md#66-the-sample-query)).

## 2.8 Keyboard

| Keys | |
|---|---|
| Ctrl/⌘ + Z | Undo |
| Ctrl/⌘ + Y, Ctrl/⌘ + Shift + Z | Redo |
| Enter in the AI input | Send (Shift+Enter: new line) |
| Escape | Close pickers and prompts |

Inside a block island's editor the block editor's own shortcuts apply and its undo/redo feed the Jikji history.
