use detach instead of remove

This commit is contained in:
Sanj 2011-10-21 01:38:04 +01:00
parent 50c51a26af
commit 597bb7aef4

View File

@ -304,10 +304,10 @@ Canvas.prototype.init = function() {
var height = parseInt(r.height) / 2;
// console.log("heightFOO: " + height);
var width = parseInt(r.width) / 2;
highest_index = getHighestIndex(c.jq);
new_index = parseInt(highest_index) + 1;
var highest_index = getHighestIndex(c.jq);
var new_index = parseInt(highest_index) + 1;
// console.log('index: ' + new_index);
i = new ImageBox(c, r, {css: {'z-index': "" + new_index, 'top':toPx((ev.pageY - top) - height), 'left': toPx((ev.pageX - left) - width)}});
var i = new ImageBox(c, r, {css: {'z-index': "" + new_index, 'top':toPx((ev.pageY - top) - height), 'left': toPx((ev.pageX - left) - width)}});
} else if (r.mime == 'audio' || r.mime == 'video') {
that.addMedia(r);
}
@ -317,15 +317,22 @@ Canvas.prototype.init = function() {
var top = $(this).position().top;
var left = $(this).position().left;
if (elem.hasClass('arabic')) {
t = new TextBox(c, {'html': '<p class="textbox_canvas_text">انقر على مربع التحرير</p>', 'css': {'direction': 'rtl'}});
var t = new TextBox(c, {'html': '<p class="textbox_canvas_text">انقر على مربع التحرير</p>', 'css': {
'direction': 'rtl',
'top': toPx((ev.pageY - top) - height),
'left': toPx((ev.pageX - left) - width)
}});
} else {
t = new TextBox(c);
var t = new TextBox(c, {'css': {
'top': toPx((ev.pageY - top) - height),
'left': toPx((ev.pageX - left) - width)
}});
}
width = parseInt(t.jq.css('width') / 2);
height = parseInt(t.jq.css('height') / 2);
var width = parseInt(t.jq.css('width') / 2);
var height = parseInt(t.jq.css('height') / 2);
t.setCSS({'top':toPx((ev.pageY - top) - height), 'left': toPx((ev.pageX - left) - width)});
highest_index = getHighestIndex(c.jq);
new_index = parseInt(highest_index) + 1;
var highest_index = getHighestIndex(c.jq);
var new_index = parseInt(highest_index) + 1;
t.setCSS({'z-index': new_index});
}
// console.log('dropper');
@ -417,13 +424,13 @@ Canvas.prototype.movePage = function(newOrder, dontSave) {
}
var currentIndex = this.jq.index('.canvas');
if (newOrder == 0) {
this.jq.remove().insertBefore($('.canvas').eq(0));
this.jq.detach().insertBefore($('.canvas').eq(0));
} else if (newOrder < currentIndex) {
var prevCanvas = $('.canvas').eq(newOrder - 1);
this.jq.remove().insertAfter(prevCanvas);
this.jq.detach().insertAfter(prevCanvas);
} else {
var prevCanvas = $('.canvas').eq(newOrder);
this.jq.remove().insertAfter(prevCanvas);
this.jq.detach().insertAfter(prevCanvas);
}
reorderEdgeArticle();
if (!dontSave) {