Repository navigation
[6.x] Move CKEditor off jQuery and the Craft globals - #643
Merged
Merged
Conversation
The control panel's selector hands back plain element info and a meta object, so the image insert flow reads the asset's alt and transform from there rather than from a jQuery collection.
Selecting a mode now follows the listbox's change event rather than a click, so keyboard selection counts, and the generated editor module keeps $ bound for custom config JS that still uses it.
Replaces the progress bar under the field, which duplicated what the upload notification already reports. The placeholder goes in at the drop position and its source is swapped for the asset's once the upload lands; creating the owner's draft replaces the editor's value, so pending placeholders are put back after a reload.
Keeps the Craft.* and Garnish.* shape at the call sites, so the diff stays close to the original and CKEditor's own locale `t` is no longer shadowed. The generated editor module keeps a named import, since a namespace called Craft there would shadow the global for a field's custom config JS.
brianjhanson
commented
Nov 4, 2026
brianjhanson
left a comment
Contributor
Author
There was a problem hiding this comment.
@i-just this is a fairly straightforward rewrite of the javascript to move away from jQuery. It does rely on craftcms/cms#20359 which exposes a handful of functions necessary for this
Remove upload placeholders and their restoration hooks. Fix canceled toolbar animations, respect reduced motion, cache configuration lookups, and clone toolbar components directly. Repair corrupted strings and trim unused module declarations and dev exports. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
resources/assets/fieldsettings/vite/ held the output of the first Vite builds, from before outDir was switched to dist/. Nothing loads it, and it still contained the old jQuery/Velocity ToolbarBuilder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lock file still listed jQuery as a root peer dependency after it was removed from package.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing reads window.Craft any more, and the global const would hide a missing `import * as Craft from '@craftcms/cp'` from type-checking. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Web Animations API doesn't write in-between values to the inline style the way Velocity did, so releasing a source item mid-collapse snapped it back to full width. Read the margin from the computed style instead, which includes running animations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each modal mounts its own Vue app into a host element on <body>, which only the handle's destroy() removes, so every image or element link selection left one behind. Also stop passing closeOtherModals to the link selector, since the modal ignores it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The element editor panel never triggers beforeClose, so the cursor and focus weren't restored after creating an entry from the toolbar. Use the onClose setting instead, and place the cursor after the new card, adding a paragraph when no text block follows it. Canceling still returns the cursor to where it was. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every name used from @craftcms/cp in the TypeScript bundle has to be declared in craftcms-cp.d.ts and listed in vite.config.mts, and one missing from the Vite list is only noticed under the dev server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The row relied on Craft 5's .flex for its gap and wrapping, so in Craft 6 its items sat flush against each other and the sites dropdown stayed on the same line instead of breaking onto its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Without one, addActionsToChip() had nowhere to put the Replace and Remove actions, and its jQuery fallback no longer runs. Request the chip with its action menu, limited to the View and Edit actions, and add Replace and Remove to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Thanks, @brianjhanson, looks good! I pushed a few tweaks:
Since it's a draft, I won't merge it into |
brianjhanson
marked this pull request as ready for review
November 5, 2026 15:00
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.
Description
Moves CKEditor's control panel code onto the shared import-map modules, without requiring the Yii2 adapter's globals.
The toolbar now clones component nodes directly, caches button configuration lookups, and handles canceled animations without running their completion callbacks. Margin animations respect reduced motion. The TypeScript declarations and development re-exports cover only
tandactionClient, the APIs that bundle uses.Upload placeholders and their restoration hooks were removed. Pending uploads do not add temporary image data to the saved field value. User-authored JavaScript config can still use
$whenwindow.jQueryis available. This targets Craft 6, with no Craft 5 fallback.Depends on craftcms/cms#20359. The base branch also requires craftcms/cms#20328 for
HtmlSanitizerManager::config().Evidence
0b6eecffailed because canceling a toolbar drag hid its source item, and dropping an image serialized a temporary SVG data URI.After: Both checks pass. The same browser run also covers toolbar add/remove configuration updates, reduced-motion restoration with forced colors enabled, completed image insertion, default transforms, and failed/canceled uploads. It uses the real editor and Garnish libraries with a controlled upload boundary, not a live-server upload.
npm run typecheck,npm run check-prettier, andgit diff --checkpass.Related issues