WordPress.org

Make WordPress Core

Changes between Version 3 and Version 4 of Ticket #31157, comment 5


Ignore:
Timestamp:
02/11/2015 03:36:28 PM (5 years ago)
Author:
nonverbla
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31157, comment 5

    v3 v4  
    33tinymce.on('AddEditor', function(event) {
    44
    5   // stores the editor instance
    65  var editor = event.editor;
    76
    8   // always do this when the editor looses focus
    9   editor.on('blur', function (event) {
     7  editor.on('getContent', function (e) {
    108
    11     // get the contents, but get them raw! All other formats fail to return the   we are looking for
    129    var content = editor.getContent({format: "raw", no_events: 1});
    13 
    14     // now replace that sucker
    15     content = content.replace(/ /ig, ' ');
    16 
    17     //... and re-set the content
    18     editor.setContent( content, {no_events: 1} );
     10    e.content = content.replace(/ /ig, ' ');
    1911   
    2012  });