mirror of
https://github.com/wassname/HackFlowy.git
synced 2026-06-27 16:00:04 +08:00
misc changes SortTimeStamps,CursorDownArrow,DragDropPolish
This commit is contained in:
@@ -165,7 +165,7 @@ socket.on("revHistory", function(data){
|
||||
console.log(timeHash);
|
||||
|
||||
var list = "";
|
||||
_.each(Object.keys(timeHash), function(timestamp){
|
||||
_.each(Object.keys(timeHash).sort(), function(timestamp){
|
||||
list += "<li><a class='timestamp'>"+timestamp+"</a></li>";
|
||||
})
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ keydownHandler = function(event){ //the entire body is wrapped in this.
|
||||
if(event.which == 13){event.preventDefault();}
|
||||
|
||||
voInitializer(that, event);
|
||||
console.log("ABOUT TO PROCESS INPUT");
|
||||
// console.log("ABOUT TO PROCESS INPUT");
|
||||
|
||||
/*
|
||||
// INPUT_PROCESSED = false;
|
||||
@@ -178,8 +178,10 @@ if((vo.hitTab && event.shiftKey) || (event.keyCode == 37 && event.shiftKey)){//
|
||||
return;
|
||||
}
|
||||
|
||||
if(event.keyCode == 38){//up
|
||||
if( vo.thisLI.isLastViz() ){
|
||||
|
||||
if(event.keyCode == 38){//cursor Up
|
||||
debugger;
|
||||
if( vo.thisLI.isFirstViz()){
|
||||
vo.thisLI.parent().parent().children().children("textarea").focus();
|
||||
}
|
||||
else{
|
||||
@@ -187,9 +189,13 @@ if((vo.hitTab && event.shiftKey) || (event.keyCode == 37 && event.shiftKey)){//
|
||||
}
|
||||
}
|
||||
if(event.keyCode == 40){ //down
|
||||
//if(thisLI.collapsed || empty)
|
||||
vo.thisLI.next().children().children("textarea").focus();
|
||||
//else => (focus on next El)
|
||||
debugger;
|
||||
if(vo.thisLI.children("ul").children(":visible").length != 0){
|
||||
vo.thisLI.children("ul").children(":first").children().children("textarea").focus();
|
||||
}
|
||||
else{
|
||||
vo.thisLI.next().children().children("textarea").focus();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,10 @@ dragState.thisModel = null;
|
||||
dragState.thisLI = null;
|
||||
dragState.dragIndex = null;
|
||||
|
||||
$('body').on('click', ".handle", function(e){
|
||||
if(dragging){e.preventDefault()}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('body').on("mousedown", ".handle", function(e){
|
||||
@@ -37,6 +41,8 @@ $('body').on("mousedown", ".handle", function(e){
|
||||
dragState.dragIndex = dragState.thisLI.index();
|
||||
dragState.oldParModel = nodesCollection.findWhere({_id: dragState.thisLI.parent().attr("data-id") });
|
||||
|
||||
dragState.topPos = $(dragState.thisLI).offset().top; //rec.top;
|
||||
dragState.botPos = dragState.topPos + $(dragState.thisLI).outerHeight();
|
||||
|
||||
var firstLI = $(".root").children(":visible:first");
|
||||
var firstEntry = [0, firstLI, "above"];
|
||||
@@ -61,6 +67,10 @@ $('body').on("mousedown", ".handle", function(e){
|
||||
var opened = !collapsed;
|
||||
var last = li.isLastViz();
|
||||
|
||||
if(thisTop>=dragState.topPos && thisTop<=dragState.botPos){//it's in the dragged sub-tree
|
||||
return;
|
||||
}
|
||||
|
||||
if( !(opened || last) ){
|
||||
var entry = [ thisTop , li , "below" ];
|
||||
containerArray.push(entry);
|
||||
@@ -105,11 +115,12 @@ $('body').on("mousedown", ".handle", function(e){
|
||||
|
||||
|
||||
$(document).mouseup(function(e){
|
||||
e.stopPropagation();
|
||||
clicking = false;
|
||||
$('.clickStatus').text('mouseup');
|
||||
|
||||
if(!dragging){return;}
|
||||
dragging = false;
|
||||
setTimeout(function(){dragging = false}, 1);
|
||||
|
||||
var entry = returnDropEntry(e.pageY);
|
||||
var dropLI = entry[1];
|
||||
@@ -126,6 +137,9 @@ $(document).mouseup(function(e){
|
||||
}
|
||||
console.log(dragState);
|
||||
moveNode(dragState.thisModel, dragState.dragIndex, dragState.oldParModel, dragState.newParModel, dragState.dropIndex, true);
|
||||
|
||||
$(dropLI).removeClass("selectedAboveDrop")
|
||||
$(dropLI).removeClass("selectedBelowDrop");
|
||||
});
|
||||
|
||||
$(document).on("mousemove" ,function(e){
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
|
||||
|
||||
|
||||
|
||||
.root ul {
|
||||
position: relative;
|
||||
right: 9px; /*controls positioning of border*/
|
||||
/*border-left: 1px solid grey;*/
|
||||
|
||||
|
||||
padding-left: 25px;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
padding-left: 25px; padding-top: 1px; padding-bottom: 1px;
|
||||
|
||||
list-style-type: square;
|
||||
}
|
||||
@@ -18,14 +12,10 @@
|
||||
|
||||
.root li {
|
||||
position: relative;
|
||||
/*box-shadow: 0px 1px 0px blue;*/
|
||||
|
||||
padding: 0;
|
||||
padding-top: 0px;
|
||||
|
||||
margin: 0;
|
||||
margin-left: 10px;
|
||||
margin-bottom: 3px;
|
||||
margin: 0; margin-left: 10px; margin-bottom: 3px;
|
||||
|
||||
background-repeat: no-repeat;
|
||||
list-style: none;
|
||||
|
||||
Reference in New Issue
Block a user