ai_editor_actions
AI Editor Actions adds an "AI Actions" dropdown to CKEditor 5 that runs user-defined AI text transformations - rephrase, fix grammar, translate, summarize, change tone, and more - on the selected text or, with nothing selected, on the whole document. Generation happens in place, right in the editor: a spinner shows while the AI runs, then the result replaces the text and is highlighted as a tracked change you can review, walk through its history, flip back to the original, regenerate or keep.
The actions themselves are content, not code. Every editor with permission builds their own library of transformations straight from the editor and, optionally, shares them with selected roles - so each team can shape the AI tools that fit their content, without a developer.
Key features
- AI Actions dropdown in CKEditor 5 listing the actions available to the current user, plus a free-form "Ask AI..." option (a small inline input, no dialog).
- In-place generation: picking an action runs the AI through a CSRF-guarded endpoint and drops the result straight into the editor, with a spinner while it works - no popup to confirm.
- Tracked changes with history: each result is highlighted and shows a small toolbar - previous/next (walk the generation history), Show original / Show AI version, Regenerate, Discard and Keep. Pending changes are locked against accidental edits until you decide, and the highlight is never saved with the content.
- User-owned actions: actions are content entities. Users create their own from the editor ("Add Action...") and, with an extra permission, share them with selected roles. Private actions stay private to their owner.
- Categories: group actions into submenus in the dropdown and sections on the admin listing; uncategorized actions stay at the top level.
- Selection menu (optional): selecting text pops up a small AI Actions menu right at the selection, so an action can be picked where it is needed. Toggle it on the settings page.
- Per-action AI provider: each action chooses which configured AI provider and model processes it, preselecting the site's default chat model.
- Whole-document mode: with nothing selected, an action runs on the entire editor content and applies as one tracked change.
- Survives Preview and refresh: pending tracked changes are snapshotted per browser tab and restored when you return from the node preview or reload the page - until the content is saved.
- Abuse protection: input length caps, instruction length caps and a configurable per-user hourly rate limit on AI requests.
Screenshots
Requirements
- Drupal 10.6+, 11.3+ or 12.
- The AI (ai) module with a configured provider (for example AI Provider OpenAI) and a default chat model set in the AI module settings. If none is configured, the module warns on the status report.
- CKEditor 5, Editor and Filter (Drupal core modules).
Installation
Install as you would any contributed module.
composer require drupal/ai_editor_actions drush en ai_editor_actions
On installation the module creates five starter categories with twelve actions - Rewrite (Rephrase, Fix grammar & spelling, Simplify), Length (Shorten, Expand), Analyze (Summarize, Highlight key points), Tone (Professional tone, Friendly tone) and Translate (Spanish, French, German) - owned by the site administrator and shared with authenticated users.
Configuration
- Configure your AI provider and set a default chat model at Administration > Configuration > AI (
/admin/config/ai/settings). - Add the AI Actions button to the CKEditor 5 toolbar of the text formats that should offer it, at Administration > Configuration > Content authoring > Text formats and editors.
- Grant the module's permissions to the appropriate roles.
- Manage actions and categories at Administration > Configuration > Content authoring > AI Editor Actions.
- Review the Settings tab: maximum input length, requests per hour (per-user rate limit, 0 = unlimited), the system prompt, and whether the selection menu is shown.
Usage
- Edit content using a text format that has the AI Actions button.
- Select some text (or select nothing to work on the whole document) and pick an action from the AI Actions dropdown. For Ask AI..., type what you want in the inline input and press Generate.
- A spinner shows while the AI runs, then the result replaces the text and is highlighted.
- Use the toolbar on the change to walk the history with the previous/next arrows, Show original / Show AI version, Regenerate a fresh version, Discard to put the original text back, or Keep the change.
- Saving the content stores whichever version is displayed; the highlight itself is never saved.
Users who may create actions also see Add Action... (create a new action without leaving the editor) and List Actions... (open the management listing in a new tab).
Built with AI assistance