From e348de5641f58388cd245b50104127c0290cd194 Mon Sep 17 00:00:00 2001 From: Sanj Date: Fri, 14 Sep 2012 14:49:43 +0530 Subject: [PATCH] make aloha work for new text boxes added to page --- edgware/static/js/editor.js | 8 +++++--- edgware/templates/editor.html | 17 ----------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/edgware/static/js/editor.js b/edgware/static/js/editor.js index 2a35035..ed8853a 100644 --- a/edgware/static/js/editor.js +++ b/edgware/static/js/editor.js @@ -1,8 +1,8 @@ (function($) { - + var $aloha; Aloha.ready(function() { - var $aloha = Aloha.jQuery; + $aloha = Aloha.jQuery; $aloha('.textbox_canvas_content').aloha(); Aloha.bind("aloha-smart-content-changed", function(e, obj) { @@ -700,7 +700,9 @@ TextBox.prototype.init = function() { // thisBox.updateCSS(css); } }); - //Aloha.jQuery(e).find(".textbox_canvas_content").aloha(); + if (typeof($aloha) !== 'undefined') { + $aloha(e).find(".textbox_canvas_content").aloha(); + } return e; }; diff --git a/edgware/templates/editor.html b/edgware/templates/editor.html index 6414ff2..89e9686 100644 --- a/edgware/templates/editor.html +++ b/edgware/templates/editor.html @@ -57,23 +57,6 @@ var $ = Aloha.jQuery; $('.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")); - }); - });