• Hi. Great plugin – been using it for months now and love it. I’ve run into this issue before, but figured I’d ask you this time about it.

    In my custom theme, logged in users are able to add/remove/edit multiple posts on one page. An ajax call updates the html dynamically, without having to reload the page. Once the updated content appears, its html does not show any FEE span tags because it is being populated dynamically from an external php file. Reloading the page adds the proper FEE tags and the new content is now editable.

    Question: How can I re-initialize FEE after the page’s content is updated WITHOUT reloading the page so the new content’s fields are editable?

    P.S. Just donated $10 for your great work. Thanks!

    – Jeffrey

Viewing 1 replies (of 1 total)
  • Plugin Author scribu

    (@scribu)

    Once the updated content appears, its html does not show any FEE span tags because it is being populated dynamically from an external php file.

    Those spans tell the FEE javascript what is editable and what’s not, as well as other important bits about how to handle the editable parts.

    You could manually try to register a new field, but I don’t guarantee it will work:

    // Set the filter
    var filter = 'the_content';
    
    // Manually create a data object (see the data- attributes of the span tag)
    var data = {
      post_id: 123,
      type: 'rich',
    }
    
    // Choose the editable area; this is supposed to be the <span> element
    var $el = jQuery('#some-selector');
    
    // Create a new editor instance
    var editor = new FrontEndEditor.fieldTypes[data.type]();
    
    // Populate various other properties of the editor object
    editor = jQuery.extend(editor, {
    	el: $el,
    	data: data,
    	filter: filter,
    	type: data.type
    });
    
    // Ignite
    editor.start();

    It would be better if you made the AJAX requests to admin-ajax.php. Then you could just do apply_filters( 'the_content', ... );

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Front-end Editor] Re-initialize FEE after JQuery event?’ is closed to new replies.