kinda weird but dragging content to the bottom can break browser functionality so this is a bodge

drag-to-bottom
John McLear 2013-04-07 20:28:21 +01:00
parent f135f79d13
commit 1f4d11a960
1 changed files with 15 additions and 1 deletions

View File

@ -1585,7 +1585,21 @@ function Ace2Inner(){
b = range[1]; b = range[1];
var firstDirtyNode = (((a === 0) && root.firstChild) || getCleanNodeByKey(rep.lines.atIndex(a - 1).key).nextSibling); var firstDirtyNode = (((a === 0) && root.firstChild) || getCleanNodeByKey(rep.lines.atIndex(a - 1).key).nextSibling);
firstDirtyNode = (firstDirtyNode && isNodeDirty(firstDirtyNode) && firstDirtyNode); firstDirtyNode = (firstDirtyNode && isNodeDirty(firstDirtyNode) && firstDirtyNode);
var lastDirtyNode = (((b == rep.lines.length()) && root.lastChild) || getCleanNodeByKey(rep.lines.atIndex(b).key).previousSibling); // top.console.log("b", b);
// top.console.log("foo", rep.lines.atIndex(b));
// top.console.log("mheh", getCleanNodeByKey(rep.lines.atIndex(b)));
try{
var isSane = getCleanNodeByKey(rep.lines.atIndex(b).key);
}catch(e){
top.console.error("Line key "+b+" doesn't exist in DOM, Dragging to the bottom line is currently broken");
top.location.reload();
}
// top.console.log("sane?", isSane);
if(isSane){
var lastDirtyNode = (((b == rep.lines.length()) && root.lastChild) || getCleanNodeByKey(rep.lines.atIndex(b).key).previousSibling);
}else{
var lastDirtyNode = ((b == rep.lines.length()) && root.lastChild);
}
lastDirtyNode = (lastDirtyNode && isNodeDirty(lastDirtyNode) && lastDirtyNode); lastDirtyNode = (lastDirtyNode && isNodeDirty(lastDirtyNode) && lastDirtyNode);
if (firstDirtyNode && lastDirtyNode) if (firstDirtyNode && lastDirtyNode)
{ {