-
Notifications
You must be signed in to change notification settings - Fork 8
Attach visual editor elements to AI Assistant Context #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR extends the Directus visual editing overlay to integrate with the AI Assistant by adding an AI context button and corresponding messaging types, plus updates to the example Nuxt CMS schema/config to support the new features and some Directus settings.
Changes:
- Add AI-related message types (
add-to-context,highlight-element,aiEnabled,Rect, etc.) and wire them throughDirectusFrame,EditableElement,EditableStore, andOverlayElementto support AI context selection and highlighting. - Update overlay styling and layout to support a second “AI” button and an AI-context highlight state, along with a small tweak to the Nuxt base layout so header/footer render independently of loading state.
- Refresh generated Directus schema types (including new AI/visual editor settings, collection enum, and stricter field types) and pin Nuxt app dependencies to exact versions; adjust CSP to allow framing from localhost Directus.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
test-website/simple-cms/nuxt/shared/types/schema.ts |
Regenerated Directus schema types, adding form submission types, refined field shapes (e.g., social_links, DirectusField.searchable), new AI/visual-editor settings, a CollectionNames enum, and removing seo fields from Page/Post. |
test-website/simple-cms/nuxt/package.json |
Pins dev/runtime dependencies (Nuxt app, ESLint, Directus tooling, form libs, etc.) to exact versions for reproducible installs. |
test-website/simple-cms/nuxt/nuxt.config.ts |
Relaxes CSP frame-ancestors to additionally allow framing from http://localhost:8080 for local Directus integration. |
test-website/simple-cms/nuxt/app/layouts/default.vue |
Simplifies layout conditional rendering so NavigationBar and Footer are gated directly by siteError/status but no longer wrapped in an extra v-else container. |
src/lib/types/index.ts |
Re-exports new Directus-shared types (AddToContextData, HighlightElementData, ConfirmData, Rect) for use across the overlay code. |
src/lib/types/directus.ts |
Defines shared protocol types for AI-related actions (Rect, AddToContextData, HighlightElementData, ConfirmData) and extends ReceiveAction/SendAction unions for add-to-context and highlight-element. |
src/lib/overlay-manager.ts |
Introduces shared button class, AI button/icon CSS variables, AI-context styling (different border color and always-visible AI button), and hover interactions using color-mix and :has() so edit and AI buttons visually coordinate. |
src/lib/overlay-element.ts |
Adds optional AI button creation controlled via OverlayElementOptions.aiEnabled, exposes aiButton, and supports toggling an AI-context CSS class on the overlay rectangle. |
src/lib/editable-store.ts |
Tracks the currently AI-highlighted element, adds lookup by collection/item/fields, and exposes highlightElement/setElementInAiContext to switch AI-context highlighting on specific editables. |
src/lib/editable-element.ts |
Creates overlays with AI buttons when enabled, wires AI button clicks to send add-to-context data (including a Rect and display label) to Directus, and fixes hover listener removal by storing bound handlers. |
src/lib/directus-frame.ts |
Extends the messaging layer to capture AI configuration from confirm (e.g., aiEnabled), expose isAiEnabled(), and handle incoming highlight-element messages to instruct EditableStore which element to visually mark for AI context. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 11 out of 12 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
formfcw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @bryantgillespie ❤️ Great work!
A few minor requests and a few questions.
* fix: update button const names for consistency * rename aiContext to highlightActive for better reusability Also: - removed the extra css var - removed the style that displayed the ai button * bring back css reset for pseudos so they don’t get overwritten * use separate background size CSS variable for ai button for consistency * reuse buttonWidth css var, introduce buttonGap var and set it to 4px (instead of 8px) * update button background color variables for consistency Also: - extracted edit and ai button color vars as const for reusability - used the color mix var definition from directus for hover color - refactored all selectors that use opacity: 1
Co-authored-by: Florian C. Wachmann <dev@formfcw.com>
Co-authored-by: Florian C. Wachmann <dev@formfcw.com>
Co-authored-by: Florian C. Wachmann <dev@formfcw.com>
Co-authored-by: Florian C. Wachmann <dev@formfcw.com>
Co-authored-by: Florian C. Wachmann <dev@formfcw.com>
Co-authored-by: Florian C. Wachmann <dev@formfcw.com>
Co-authored-by: Florian C. Wachmann <dev@formfcw.com>
Co-authored-by: Florian C. Wachmann <dev@formfcw.com>
Co-authored-by: Florian C. Wachmann <dev@formfcw.com>
Co-authored-by: Florian C. Wachmann <dev@formfcw.com>
Co-authored-by: Florian C. Wachmann <dev@formfcw.com>
Co-authored-by: Florian C. Wachmann <dev@formfcw.com>
|
Ready for another round @formfcw |
Scope
What's changed:
Needs to go alongside this core PR
directus/directus#26512
Potential Risks / Drawbacks
Review Notes / Questions
Fixes #<num>