TinyMCE:API/tinymce.Editor/onKeyPress

From Moxiecode Documentation Wiki

Jump to: navigation, search

Contents

Event: onKeyPress

Summary

This event gets executed when the user pressed down a key inside the editor.

Syntax

event_callback(<tinymce.Editor> ed, <Event> e)

Parameters

ed
Sender object/Editor instance that the event occurred in.
e
DOM Event object, includes things like keyCode for the event.

Examples

// Adds an observer to the onKeyPress event using tinyMCE.init
tinyMCE.init({
   ...
   setup : function(ed) {
      ed.onKeyPress.add(function(ed, e) {
          console.debug('Key press event: ' + e.keyCode);
      });
   }
});

// Adds an observer to the onKeyPress event using the render method
var ed = new tinymce.Editor('someid', {
   .. Some settings
});

ed.onKeyPress.add(function(ed, e) {
   console.debug('Key press event: ' + e.keyCode);
});

ed.render();
Personal tools