linkding icon indicating copy to clipboard operation
linkding copied to clipboard

Drag and Drop a link to the Linkding tab creates a bookmark

Open joel72265 opened this issue 1 year ago • 2 comments

To save a bookmark to Linkding, drag and drop the link to the Linkding tab this automatically linkding01 creates a bookmark

joel72265 avatar Apr 27 '23 11:04 joel72265

I don't think this is possible. Do you know of any website that works like that?

Dragging a link onto an open linkding page might be possible, but that would require you to have both windows open at once.

sissbruecker avatar May 18 '23 09:05 sissbruecker

Saw this issue and thought it sounds interesting. Just tried it real quick and found out what you could do is just having a linkding tab open and by hovering over it (with your link dragged) you could switch to that tab. Which then allows you to drop it on linkding.

https://github.com/sissbruecker/linkding/assets/110255203/8db9c6d0-b7ca-493e-acbe-8dd7f1451ae1

that's the demo code I used:

<!DOCTYPE html>

<html lang="en">
	<head>
		<meta charset="UTF-8"/>
		<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
		<title>linkding drag &amp; drop</title>
		<style>
			*{
				padding: 0;
				margin: 0;
				box-sizing: border-box;
			}
			html, body{
				height: 100%;
			}
			body{
				padding: 2em;
			}
			main{
				border: 4px solid red;
				background-color: #ddd;
				height: 100%;
			}
		</style>
	</head>
	<body>
		<main ondrop="dropHandler(event)" ondragover="dragOverHandler(event)"></main>
		<script>
			function dropHandler(e){
				e.preventDefault();

				if(e.dataTransfer.items){
					[...e.dataTransfer.items].forEach((item, i) =>{
						item.getAsString((s) =>{
							console.log(s);
						});
					});
					// could have instead used (to just get one string):
					// console.log(e.dataTransfer.getData("text"));
				}
			}

			function dragOverHandler(e){
				e.preventDefault();
			}
		</script>
	</body>
</html>

Might be a cool feature, not sure if it would be used a lot tho. At the moment, if your linkding tab is on "Add bookmark" you could already drop it into the URL text input.

vaijns avatar Feb 12 '24 18:02 vaijns

Seems niche and hard to discover indeed. Also not really more convenient than the browser extension or the bookmarklet. No plans to do this I'm afraid.

sissbruecker avatar Mar 17 '24 09:03 sissbruecker