Browse Source

draggable works, clean up jquery noconflict behaviour, remove un-needed plugins

master
Sanj 12 years ago
parent
commit
045664b54f
  1. 39
      edgware/static/js/editor.js
  2. 18
      edgware/templates/editor.html

39
edgware/static/js/editor.js

@ -1,4 +1,42 @@
(function($) {
Aloha.ready(function() {
var $aloha = Aloha.jQuery;
$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"));
});
Aloha.bind("aloha-editable-activated", function(event, properties) {
var thisElem = properties.editable;
var thisBox = $(thisElem.obj).parents(".box");
thisBox.draggable("disable");
});
Aloha.bind("aloha-editable-deactivated", function(event, properties) {
var thisElem = properties.editable;
var thisBox = $(thisElem.obj).parents(".box");
thisBox.draggable("enable");
});
});
//var ARTICLE_ID = 0;
var BASE_URL = "http://edgwareroad.org/edit/"
var edgeArticle = window.edgeArticle = [];
@ -662,6 +700,7 @@ TextBox.prototype.init = function() {
// thisBox.updateCSS(css);
}
});
//Aloha.jQuery(e).find(".textbox_canvas_content").aloha();
return e;
};

18
edgware/templates/editor.html

@ -33,29 +33,23 @@
common/table,
common/list,
common/link,
common/highlighteditables,
common/undo,
common/contenthandler,
common/paste,
extra/cite,
common/characterpicker,
common/commands,
common/block,
common/image,
common/abbr,
common/horizontalruler,
common/align,
extra/formatlesspaste,
extra/toc,
extra/headerids,
extra/listenforcer,
extra/metaview,
extra/numerated-headers,
extra/ribbon,
extra/wai-lang,
extra/flag-icons,
extra/linkbrowser,
extra/imagebrowser,
extra/cite"></script>
<script>
Aloha.settings.jQuery = $.noConflict();
@ -93,12 +87,12 @@
font-size: 14px;
}
</style>
<script language="Javascript">
jQuery(function(){
jQuery('img').Jcrop();
});
<script language="text/javascript">
(function($) {
$(function(){
$('img').Jcrop();
});
})(jQuery);
</script>
<script type="text/javascript">

Loading…
Cancel
Save