mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
preliminary js for handling drops on the tree (r=saari).
This commit is contained in:
parent
e4bbb475eb
commit
ed2521b11f
@ -24,7 +24,13 @@
|
||||
Script for the bookmarks properties window
|
||||
*/
|
||||
|
||||
|
||||
function TopLevelDrag ( event )
|
||||
{
|
||||
dump("TOP LEVEL bookmarks window got a drag\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function BeginDragTree ( event )
|
||||
{
|
||||
//XXX we rely on a capturer to already have determined which item the mouse was over
|
||||
@ -142,7 +148,22 @@ this doesn't work anymore (target is null), not sure why.
|
||||
|
||||
} // DragOverTree
|
||||
|
||||
|
||||
function DropOnTree ( event )
|
||||
{
|
||||
// id (url) is on the <treeitem> which is two levels above the <treecell> which is
|
||||
// the target of the event.
|
||||
var treeItem = event.target.parentNode.parentNode;
|
||||
var id = treeItem.getAttribute("id");
|
||||
var dropBefore = treeItem.getAttribute("dd-droplocation");
|
||||
var dropOn = treeItem.getAttribute("dd-dropon");
|
||||
dump("**** before is " + dropBefore + " on is " + dropOn + "\n");
|
||||
var beforeString = "before";
|
||||
if ( dropBefore == "false" )
|
||||
beforeString = "after";
|
||||
dump ( "*** tree drop " + beforeString + " target [" + id + "]\n" );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function copySelectionToClipboard()
|
||||
{
|
||||
|
@ -24,7 +24,13 @@
|
||||
Script for the bookmarks properties window
|
||||
*/
|
||||
|
||||
|
||||
function TopLevelDrag ( event )
|
||||
{
|
||||
dump("TOP LEVEL bookmarks window got a drag\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function BeginDragTree ( event )
|
||||
{
|
||||
//XXX we rely on a capturer to already have determined which item the mouse was over
|
||||
@ -142,7 +148,22 @@ this doesn't work anymore (target is null), not sure why.
|
||||
|
||||
} // DragOverTree
|
||||
|
||||
|
||||
function DropOnTree ( event )
|
||||
{
|
||||
// id (url) is on the <treeitem> which is two levels above the <treecell> which is
|
||||
// the target of the event.
|
||||
var treeItem = event.target.parentNode.parentNode;
|
||||
var id = treeItem.getAttribute("id");
|
||||
var dropBefore = treeItem.getAttribute("dd-droplocation");
|
||||
var dropOn = treeItem.getAttribute("dd-dropon");
|
||||
dump("**** before is " + dropBefore + " on is " + dropOn + "\n");
|
||||
var beforeString = "before";
|
||||
if ( dropBefore == "false" )
|
||||
beforeString = "after";
|
||||
dump ( "*** tree drop " + beforeString + " target [" + id + "]\n" );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function copySelectionToClipboard()
|
||||
{
|
||||
|
@ -31,7 +31,8 @@
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:web="http://home.netscape.com/WEB-rdf#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
width="500" height="400" x="20" y="20" persist="width height x y" align="vertical">
|
||||
width="500" height="400" x="20" y="20" persist="width height x y" align="vertical"
|
||||
ondraggesture="return TopLevelDrag(event);">
|
||||
|
||||
<html:script src="chrome://bookmarks/content/bookmarks.js"/>
|
||||
|
||||
@ -80,7 +81,8 @@
|
||||
onclick="if (event.clickCount == 2) return OpenURL(event, event.target.parentNode.parentNode, 'bookmarksTree');"
|
||||
style="width:100%;height:100%"
|
||||
ondragover="return DragOverTree(event);"
|
||||
ondraggesture="return BeginDragTree(event);">
|
||||
ondraggesture="return BeginDragTree(event);"
|
||||
ondragdrop="return DropOnTree(event);">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
|
Loading…
Reference in New Issue
Block a user