Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logger to TinyMCE to test, learn and debug. #118

Merged
merged 1 commit into from
Feb 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions shared/tinymce/logger.js
Original file line number Diff line number Diff line change
@@ -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 );
} );
} );
} );
1 change: 1 addition & 0 deletions tinymce/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<p>Many entrepreneurs idolize Steve Jobs. He’s such a <a href="">perfectionist</a>, they say. Nothing leaves the doors of 1 Infinite Loop in Cupertino without a polish and finish that makes geeks everywhere drool. No compromise!</p>
</section>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tinymce/4.5.3/tinymce.min.js"></script>
<script src="../shared/tinymce/logger.js"></script>
<script src="tinymce-config.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions tinymce/tinymce-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down