[wp-trac] [WordPress Trac] #17133: Code Editor: Register ctrl + s event for plugin/theme editor
WordPress Trac
noreply at wordpress.org
Tue Feb 3 05:53:32 UTC 2026
#17133: Code Editor: Register ctrl + s event for plugin/theme editor
-------------------------------------+-------------------------------------
Reporter: jcnetsys | Owner: westonruter
Type: enhancement | Status: accepted
Priority: normal | Milestone: 7.0
Component: Plugins | Version: 3.1
Severity: normal | Resolution:
Keywords: has-ux-feedback has- | Focuses: javascript,
patch has-test-info needs-testing | administration
-------------------------------------+-------------------------------------
Changes (by westonruter):
* keywords: has-ux-feedback has-patch has-test-info => has-ux-feedback
has-patch has-test-info needs-testing
Comment:
Surprisingly (or not), the patch from 7 years ago applied cleanily! (Not
surprising since the Code Editor basically hasn't been touched in that
amount of time, but this is changing with 7.0!) I applied the patch to a
new PR and iterated. It is now ready for testing and review:
https://github.com/WordPress/wordpress-develop/pull/10851
As a significant change in addition the original patch, there is now a
Ctrl/Cmd+S event listener for the overall page and not just for CodeMirror
itself. This is critical for when a user has syntax highlighting turned
off (in which there is no CodeMirror) as well as when the user is not
focused in the editor.
Another key addition needed was how to deal with linting errors. With
[attachment:"17133.diff"], attempting to save with a shortcut would just
silently do nothing. The linting error notice would not appear because the
user would still be focused in the editor. So now the error notice is
displayed when a save operation occurs.
I noticed that when using the keyboard shortcut to save a file, I would
sometimes get an autocomplete hint showing up. This resulted in a change
to that logic to instead use the `inputRead` event for CodeMirror instead
of `keyup`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/17133#comment:41>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list