make aloha work for new text boxes added to page

This commit is contained in:
Sanj 2012-09-14 14:49:43 +05:30
parent 045664b54f
commit e348de5641
2 changed files with 5 additions and 20 deletions

View File

@ -1,8 +1,8 @@
(function($) { (function($) {
var $aloha;
Aloha.ready(function() { Aloha.ready(function() {
var $aloha = Aloha.jQuery; $aloha = Aloha.jQuery;
$aloha('.textbox_canvas_content').aloha(); $aloha('.textbox_canvas_content').aloha();
Aloha.bind("aloha-smart-content-changed", function(e, obj) { Aloha.bind("aloha-smart-content-changed", function(e, obj) {
@ -700,7 +700,9 @@ TextBox.prototype.init = function() {
// thisBox.updateCSS(css); // thisBox.updateCSS(css);
} }
}); });
//Aloha.jQuery(e).find(".textbox_canvas_content").aloha(); if (typeof($aloha) !== 'undefined') {
$aloha(e).find(".textbox_canvas_content").aloha();
}
return e; return e;
}; };

View File

@ -57,23 +57,6 @@
var $ = Aloha.jQuery; var $ = Aloha.jQuery;
$('.textbox_canvas_content').aloha(); $('.textbox_canvas_content').aloha();
Aloha.bind("aloha-smart-content-changed", function(e, obj) {
//var $editable = $(obj.editable.obj);
//console.log(e, obj);
var edited_obj = jQuery(obj.editable.obj);
var html = edited_obj.html();
var boxJq = edited_obj.parents('.box');
var boxIndex = parseInt(boxJq.attr("data-index"));
var canvasIndex = boxJq.parents('.canvas').attr("data-index");
if (boxJq.hasClass("textBox")) {
var thisBox = edgeArticle[canvasIndex].textBoxes[boxIndex];
}
thisBox.setHTML(html);
// console.log($editable.attr("data-field"));
});
}); });
</script> </script>