How to save in new Aloha Editor 2.0?

135 views Asked by At

I'm using first version of Aloha Editor and now would like to update to new version.

In first version I used this script to read changes:

Aloha.ready(function() {
Aloha.require( ['aloha', 'aloha/jquery'], function( Aloha, jQuery) {

// save all changes after leaving an editable
Aloha.bind('aloha-editable-deactivated', function(){
var content = Aloha.activeEditable.getContents();
var contentId = Aloha.activeEditable.obj[0].id;
//var pageId = document.referrer;
//var pageId = window.location.pathname;
var pageId = location.pathname + location.search;
// textarea handling -- html id is "xy" and will be "xy-aloha" for the aloha editable
if ( contentId.match(/-aloha$/gi) ) {
contentId = contentId.replace( /-aloha/gi, '' );
}

var request = jQuery.ajax({
url: "editor_save.php",
type: "POST",
data: {
content : content,
contentId : contentId,
pageId : pageId
},
dataType: "html"
});

request.done(function(msg) {
jQuery("#log").html( msg ).show().delay(800).fadeOut();
});

request.error(function(jqXHR, textStatus) {
alert( "Request failed: " + textStatus );
});
});

});
});

I can't find anything about it in version 2.0 of this script.

0

There are 0 answers