forked from scribu/wp-front-end-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Javascript API
scribu edited this page May 20, 2012
·
10 revisions
(introduced in 2.3-alpha)
When the page loads, FEE initialises all the editable fields marked with .fee-field
or .fee-group
classes.
Some plugins, such as Infinite Scroll, load additional content via AJAX. To make this content editable via FEE, you just need to make a single call:
FrontEndEditor.init_fields();
There are a few custom events fired for each editable element during the editing process:
-
'edit_start' - after the user clicked 'Edit', before getting the data via ajax
-
'edit_started' - after getting the data and initializing the form
-
'edit_save' - after the user clicked 'Save', before sending the data via ajax
-
'edit_saved' - after sending the data and updating the DOM
The following code shows how to access all the available information related to an event:
jQuery(document).bind('edit_saved', function(ev) {
var el = jQuery(ev.target);
// el.data('feeEditor') is the object associated to that DOM element
console.log(el.data());
});