[wp-trac] [WordPress Trac] #17133: Code Editor: Register ctrl + s event for plugin/theme editor
WordPress Trac
noreply at wordpress.org
Tue Sep 19 07:53:18 UTC 2017
#17133: Code Editor: Register ctrl + s event for plugin/theme editor
-------------------------------------------------+-------------------------
Reporter: jcnetsys | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 4.9
Component: Plugins | Version: 3.1
Severity: normal | Resolution:
Keywords: has-ux-feedback has-patch needs- | Focuses:
refresh | administration
-------------------------------------------------+-------------------------
Comment (by westonruter):
I suggest registering the shortcut via the `extraKeys` config for
CodeMirror.
An example of this is even in the release notes:
https://codemirror.net/doc/upgrade_v2.2.html
{{{
extraKeys: {
"Ctrl-S": function(instance) { saveText(instance.getValue()); },
"Ctrl-/": "undo"
}
}}}
For our purposes, the function would need to:
1. Check to see if there are linter errors. If not, then abort.
2. Make sure the CodeMirror text has been written back into the
`textarea`.
3. Submit the form.
The patch would be written for https://github.com/WordPress/wordpress-
develop/blob/master/src/wp-admin/js/code-editor.js
--
Ticket URL: <https://core.trac.wordpress.org/ticket/17133#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list