Skip to content

Editor fixes: isolate native events, label every slot type, theme closure - #5

Merged
do-io merged 1 commit into
mainfrom
fix/editor-2.2
Oct 8, 2026
Merged

do-io merged 1 commit into
mainfrom
fix/editor-2.2

Conversation

@do-io

@do-io do-io commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

The three things found when the editor was tried in a real Marketing admin on staging, for a 2.2.0 release.

  1. A console error on blur. The browser's own change event from an input inside the editor bubbled up to <odden-mail-editor>, where the Filament component read event.detail.slots and threw a TypeError. The editor now stops native change and input events at its root (a surrounding form no longer sees every keystroke either), and the Filament component ignores any event that is not the editor's own CustomEvent with a document. In the workbench: 0 native events escape, and no page errors.
  2. Blocks the editor cannot edit yet showed their raw type ("testimonial", "social links"). The schema export now has a labels map for every slot type (SlotType::label()), and the editor uses it. Additive: the schema version stays 1.
  3. The preview ignored the template's theme. MailEditor::theme() now takes an array or a closure, evaluated for every preview (fn (Get $get): array => $get('theme') ?? []). The field's theme is applied on the server and wins over a theme sent by the browser, so the Alpine component no longer sends one.

Tests: 111 PHP (new: labels for all 29 types; closure theme re-evaluated per preview; the field's theme beats a browser theme; a closure returning null means no theme) and 21 JS pass; PHPStan and Pint pass; resources/dist rebuilt and checked. Checked in a browser in the Filament workbench (now with an undescribed testimonial block).

Needs a crm-pro change to use the theme closure (one line in MarketingTemplateResource, plus a Livewire test that the form's theme reaches the preview), then the 2.2.0 tag and bumps.

🤖 Generated with Claude Code

…sure

- The browser's native change and input events from the editor's fields no longer bubble out of it, and the
  Filament component ignores any event that is not the editor's own. This removed a TypeError on blur.
- The schema export carries a label for every slot type, so a block that is not editable yet shows its name.
- MailEditor::theme() accepts a closure, evaluated for each preview and winning over a theme from the browser,
  so the preview can follow the form's theme fields.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@do-io
do-io merged commit 5b4015b into main Oct 8, 2026
14 checks passed
@do-io
do-io deleted the fix/editor-2.2 branch October 11, 2026 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant