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
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- ajaxurl not defined on front end
- Add custom TinyMCE 4 Button, Usable since WordPress 3.9-beta1
- Plugin API for easy admin list table generation, handling & exporting of MySQL tables?
- How to implement color picker from wordpress in my plugin?
- Add tinymce buttons to caption textarea in media uploader
- Is it save to require plugin.php early to be able to use get_plugin_data() earlier?
- WP Cron doesn’t save or in post body
- How to prevent loading of all plugin’s resources?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- Problems with removing admin bar
- Check if I am in the Admin Panel (wp-admin)?
- Using Ajax call in jQuery doesn’t work in widget
- Bridge WordPress Media API with custom tinyMCE plugin [closed]
- What’s the better way to add an inline script?
- How to redirect to action on custom page within admin section
- Ajax in WordPress – path issue
- Gutenberg: useDispatch is not a function – @wordpress/data included
- how to include javascript file and css file in wordpress
- JQuery not working on WordPress Admin page [closed]
- Can I individually style items in the backend widget list?
- Why is my javascript not invoked in my hooks except wp_head?
- Issue plugin commands in admin settings page
- Programmatically modify an admin page UI of a WordPress site from my WordPress plugin
- Global State During an Admin Post
- Render content after post title in wp-admin
- how to search users by ajax live search
- Is it possible to restrict all admin pages except theme customisation and storefront using plugin?
- Display WordPress the_content() via data attributes
- WordPress custom taxonomy check box to dropdown
- Creating Admin Plugin – Content of a page is displayed at global scope as well
- Issue with contextual help overwriting existing content
- How do I link to a php file in my plugin directory?
- jQuery instantly executes (a button click and css change) on load
- Loading custom js file on the admin page through plugin
- making a plugin that moves other plugins wp_head actions to wp_footer
- Moving/dragging a metabox removes TinyMCE’s content
- Filter for admin (back end) ‘reply to’ comment
- Redirect in WordPress plugin
- How to add custom view links to wp-admin/post.php?
- Gutenberg – is it ok to load dependencies multiple times?
- Preventing double loading JS scripts (like React) when developing for Gutenberg
- Referencing files in JavaScript in WordPress Plugin
- How can I allow the user to press enter without creating a new element in the editor?
- How to localize data array in plugin’s option page
- Ajax on the Administration Side of plugin – returns 0
- What happens/fires when you select a block in the editor?
- Reading plugin settings in esnext wordpress block
- setTimeout not working in jquery
- Dynamically modify content added to table via javascript
- Javascript scroll eventHandler only working when I’m logged in in WordPress
- Pass javascript result to shortcode executer function
- Add language localisation to javascript alert?
- How to display archive by selecting year and then selecting month
- Ajax call not working with
- Why this plugin is not working?
- Cannot echo a JS variable to a jQuery plugin coming from wp_localize_script
- modify buddpress adminbar only in admin pages
- Prevent posts from being published if the ‘Uncategorized’-category or no category is selected
- How to change the headline title for an admin page in a plugin?
- How do I access the contents of WordPress Classic editor in admin area with JavaScript?
- Trigger a JavaScript function based on the data fetched from Woo commerce hook