Repository navigation
Conversation
Open
1 of 3 tasks
Contributor
Adds an "Assistant" dropdown to the toolbar of the full editor, the entry point for the AI text transform actions of the work package description editor. The plugin asks the core's aiActions service for the actions of the current resource and field, adds nothing while that list is empty, and hands the selected action back to the service. The dropdown is appended to the toolbar element outside the item collections, so CKEditor's overflow grouping never moves it into the "Show more items" menu; a maxWidth round trip makes the toolbar regroup its items when the dropdown appears, since grouping is otherwise only recomputed on resize. The icon is the single sparkle Octicon the Artificial Intelligence section of the administration uses, shown without a caption and with a tooltip. The button is reachable with Tab, its entries carry menu item roles, and it is disabled with its menu closed while the editor is read-only or in source mode. Actions that resolve after the plugin was destroyed are dropped, and the plugin removes its dropdown and listeners on destroy. Paired with the core pull request that carries the rebuilt bundle. https://community.openproject.org/work_packages/77784
tangopium
force-pushed
the
feature/ai-101-ai-actions-dropdown
branch
from
October 13, 2026 07:33
b6a5299 to
5c1b3dd
Compare
Collaborator
Author
|
Ported to the TypeScript and esbuild layout and rebased on master in 5c1b3dd. The dropdown now sits on the toolbar element outside the grouped items (it has to stay visible at every width) and uses the sparkle Octicon of the AI administration section; the paired core PR opf/openproject#25770 carries the bundle rebuilt from this branch. |
At the right end of the toolbar the menu used to grow outwards and was clipped by the work package pane, since CKEditor only checks the viewport when it picks a panel side. The panel now opens towards the toolbar, mirrored for right-to-left languages. https://community.openproject.org/work_packages/77784
The main part shows the sparkle icon with the name of the action the user ran last (the first action until then) and runs it on click; the arrow opens the list of actions. The core service decides which action to show through the new optional `defaultAction`, so cores without it still show the first action. The sparkle now sits in a 20 unit viewBox like CKEditor's own icons, which renders it smaller. Changing the label can change the button width, so the toolbar is nudged to regroup after every selection as well. https://community.openproject.org/wp/AI-101
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket
https://community.openproject.org/wp/AI-101
Paired core PR: opf/openproject#25770 (carries the rebuilt bundle; merge both together, never one alone).
What are you trying to accomplish?
Adds an "Assistant" split button at the right end of the full editor toolbar, the entry point for the AI text transform actions of the work package description editor. Ported to the TypeScript and esbuild layout after #135 to #139.
src/plugins/op-ai-actions/op-ai-actions.ts: split button built fromcreateDropdownwithSplitButtonViewandaddListToDropdown. It asks the core'saiActionsservice (reached through the plugin context) for the actions of the current resource and field, adds nothing while the list is empty, and hands the selected action back to the service'srun. The main part shows the sparkle icon and the name of the action to run: the one the core's optionaldefaultActionpicks (the action run last, else the first), following every selection from the list. Clicking it runs that action; the arrow opens the list. The button carries an "Assistant" tooltip and is disabled while the editor is read-only or in source mode.maxWidthnudge makes CKEditor regroup its items when the dropdown appears and after every label change.src/icons/sparkle.svgis the single sparkle Octicon of the Artificial Intelligence administration section, placed in a 20 unit viewBox like CKEditor's own icons so it renders at their size; registration inop-plugins.ts,aiActionstyped inop-types.ts.tests/plugins/op-ai-actions.test.tscovers the absent state, the pinned placement and regrouping, the shown action and its fallbacks, the main button and the list, keyboard reachability, the read-only and source mode states and the lifecycle;tests/stubs/svg.tsand ajest.config.jsmapping make the icon import testable.What approach did you choose and why?
The plugin is kept thin on purpose: it renders labels and reports a selection, nothing more. Which actions exist, whether the assistant is available, and what happens on selection all live in the core, so iterating on the editor behaviour does not need a bundle rebuild. On cores that provide no
aiActionsservice the plugin registers nothing, so older OpenProject versions bundling this build see no change.The caption
js.editor.ai_actions.captioncomes from the core's locale, like the other toolbar captions.