the TinyMCE Editor has its own keydown event handler and its hooked to a function on initiation so to do that you can create a tinymce plugin or use the wordpress initiation of it with tiny_mce_before_init
hook like this:
add_filter( 'tiny_mce_before_init', 'wpse24113_tiny_mce_before_init' );
function wpse24113_tiny_mce_before_init( $initArray )
{
$initArray['setup'] = <<<JS
[function(ed) {
ed.onKeyDown.add(function(ed, e) {
//your function goes here
console.debug('Key down event: ' + e.keyCode);
});
}][0]
JS;
return $initArray;
}
Related Posts:
- API to trigger prompt on leaving page
- Is it possible to reuse wp.media.editor Modal for dialogs other than media
- How to include jQuery and JavaScript files correctly?
- How to provide translations for a WordPress TinyMCE plugin?
- Test to see if jQuery or Prototype is queued by another plugin?
- jQuery in header or footer
- Add a jQuery function to admin pages
- How to Add a .js file Only in one specific Page Dynamically to Head
- How to trap “Publish” button to check for meta box validation?
- Use js script from one plugin in another plugin
- Making a custom widget that includes a tinymce and works in Site Origin Page Builder
- Mixing Regular Javascript With jQuery in a Plugin
- How to run a external JavaScript file on wp-admin if admin, and other if normal user?
- Is there an event or an other method that tells me the preview is loaded?
- javascript datatables in a plugin
- Inserting code to HTML view from a pop up initiated from visual view
- Plugin – Make sure jquery is loaded in my settings page plus my JS file
- should i be checking for jquery before enqueing it in a plugin
- Data not insert and update through ajax and jQuery in admin page?
- Need help about understand api, wp, $ syntax in WordPress plugin script
- Insert Into Post Not Working For Audio File Using jQuery
- jQuery UI tab does not work in the plugin page
- Get cat parameter from admin-ajax
- wp.media gallery collection sometimes undefined
- Query String Filtering API
- Multiple TinyMCE on button click is initialized and appended but why only last one is writeable?
- How to properly enqueue jQuery knob on WordPress without conflict?
- jQueryUI draggable doesn’t work in WordPress plugin
- Filterable posts using categories
- How to get values from Tinymce visual editor popup?
- Add a Script button in W3 Total Cache plugin not working due to conflicting jQuery version
- Issue with iframe in TinyMCE
- Ajax in Plugins: returns the whole page
- Loading jQuery library from WordPress admin
- How do I use (or mimic) document.getElementById() on a page loaded from WordPress database?
- How to get the value entered in the input field in wordpres
- How react js and other Javascript Technologies works on WordPress plugin?
- Insert meta-description into Yoast-SEO input-field via JavaScript
- escape html in jQuery for WordPress
- Jquery php request is returning a weird result
- Getting incorrect filepath inside custom block front-end output using @wordpress/create-block tutorial
- Trigger function on Remove block or add new block in Gutenberg JavaScript
- Rerender core Templates with with ToggleControl but it doesnt recognize block type
- WordPress admin panel not working
- HTMLCollection not counting right in editor? / for loop not working on elements in DOM
- converting a node.js project into a wp plugin
- What happens/fires when you select a block in the editor?
- Is “document loaded” different on admin side than public side?
- How to use setAttributes outside of the edit function return
- why is apiFetch throwing Unhandled Promise Rejection: TypeError: Object is not a function
- Reading plugin settings in esnext wordpress block
- Add New Button in Admin Panel
- $ is not defined [duplicate]
- setTimeout not working in jquery
- Dynamically modify content added to table via javascript
- WordPress Jquery with heade and footer sritp plugin
- I cant add is_admin control to plugin
- 400 Bad Request and illegal invocation in wp_ajax based on processData set to false or true
- Load script on frontend from widget plugin
- WordPress Ajax not returning Response
- Using wp_editor() when not logged stopped working
- WordPress with React: Saving and Using Data Collected with fetch
- Append php file to footer
- XMLHttpRequest to open PHP file responds with Missing Page
- Javascript scroll eventHandler only working when I’m logged in in WordPress
- Replace the WordPress Media Library Uploader
- Change Label of custom post type
- TinyMCE 4.7.11 – Enable hidden WordPress core plugins? (referencing a wp-includes from plugin.php)
- Using JavaScript in WordPress page to call for server data using AJAX
- wp_ajax add_action fuction won’t fire on custom jQuery action
- Pass javascript result to shortcode executer function
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Add language localisation to javascript alert?
- Stop unauthorised file access
- How to enable or disable check boxes in custom post type
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- replacing jquery google cdn with a new version dynamically
- Redirect with message after admin_post.php
- Uncaught ReferenceError: kpoejy is not defined
- WordPress function is not called and ajax return 0
- How to display archive by selecting year and then selecting month
- Ajax call not working with
- Remove from a div by class name from post page if post author role is not administrator
- How to display properly exception or echo string after posting in plugin?
- How can I add the Post ID to Class Name in Jquery?
- Same header/footer in Admin, across all network sites in multisite
- Get (eventual) permalink from post within Edit Post in Admin panel
- get_option() is undefined in TinymceWindowManager
- Javascript in plugin not working
- Plugin dev: How to multiply instances of a plugin in the same metabox?
- Template file structure , wordpress hook for altering the template
- Add Button to TinyMCE Custom Menu
- How to add conent (text) to Add New pages form of admin in WordPress
- Forcing ALL plugin Admin menus into a separate menu
- Script work on non logged in user but not work for logged in user?
- Uncaught TypeError: undefined is not a function (shortcode-box)
- Why this plugin is not working?
- Ajax, jQuery and WordPress
- How do I call the dashboard’s sortable javascript in a plugin page?
- Why if i enqueue the tinymce script i get undefined error