diff --git a/shared/tinymce/logger.js b/shared/tinymce/logger.js new file mode 100644 index 00000000000000..c88644de68ca2b --- /dev/null +++ b/shared/tinymce/logger.js @@ -0,0 +1,20 @@ +// For testing, learning and debugging. Feel free to add. +// See https://www.tinymce.com/docs/advanced/events/ +window.tinymce.PluginManager.add( 'logger', function( editor ) { + var types = { + selectionChange: 'fires when the selection changes.', + nodeChange: 'fires when the selection and the node changes. Use `event.element`.', + beforePastePreProcess: 'gives raw paste content before processing.', + pastePostProcess: 'gives paste content after processing. Use `event.node.innerHTML`.', + beforeSetContent: 'fires before content is set in the editor. Can be used for manipulation.', + setContent: 'fires after content is set in the editor.', + beforeExecCommand: 'fires before commands are executed.', + execCommand: 'fires after commands are executed.' + }; + + window.tinymce.each( types, function( info, type ) { + editor.on( type, function( event ) { + console.log( type, info, event ); + } ); + } ); +} ); diff --git a/tinymce/index.html b/tinymce/index.html index e6fea2551dcc51..477938cb69f996 100644 --- a/tinymce/index.html +++ b/tinymce/index.html @@ -11,6 +11,7 @@

Many entrepreneurs idolize Steve Jobs. He’s such a perfectionist, they say. Nothing leaves the doors of 1 Infinite Loop in Cupertino without a polish and finish that makes geeks everywhere drool. No compromise!

+ diff --git a/tinymce/tinymce-config.js b/tinymce/tinymce-config.js index 0ae1fe163427de..332385a27b52ef 100644 --- a/tinymce/tinymce-config.js +++ b/tinymce/tinymce-config.js @@ -7,6 +7,7 @@ window.tinymce.init( { keep_styles: false, menubar: false, object_resizing: false, + plugins: [ 'logger', 'paste' ], schema: 'html5-strict', selector: 'section', theme: false,