The OG template editor — WYSIWYG SVG canvas on the left, element library + property panel on the right.
Interaction model
- Click element on canvas → select (sets
:selected_id). - Click empty canvas → deselect.
- Add buttons in the toolbar push elements at default positions.
- Drag: handled by the
PhoenixKitOGCanvasJS hook (inline<script>, registered onwindow.PhoenixKitHooks). During drag the hook applies an SVG transform locally and only pushes a finalmove_elementevent on pointer-up — so we don't roundtrip on every pixel. - Resize: 8 corner/edge handles around the selected element. Same hook handles the pointer math.
- Keyboard: arrows nudge by 1px (10px with Shift);
Deleteremoves the selection;Escapedeselects;Ctrl+Ssaves. - Bindings dropdown: text elements expose a binding picker in the
property panel. Selecting one writes the token (e.g.
{post.title}) into thebindingfield; preview mode substitutes its example.
Save semantics
Changes are autosaved on a 800ms debounce. Manual save via Ctrl+S
or the "Save" button flushes immediately. A header pill shows
saved / saving / unsaved state.