mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-09-22 01:08:44 +00:00
Correct handling of pasting tiddlers (#7215)
* First Pass Implementation * Fix Check * Fix Style * Update drag-drop interop example to support copy tiddlers to clipboard --------- Co-authored-by: jeremy@jermolene.com <jeremy@jermolene.com>
This commit is contained in:
co-authored by
jeremy@jermolene.com
parent
474b73bdbe
commit
e66e791944
@@ -15,6 +15,10 @@
|
||||
<div id="draggable" draggable="true">
|
||||
Drag me to a TiddlyWiki window
|
||||
</div>
|
||||
<button id="copy">
|
||||
Click to copy two tiddlers to the clipboard
|
||||
</button>
|
||||
|
||||
</body>
|
||||
<script>
|
||||
|
||||
@@ -30,6 +34,18 @@
|
||||
event.stopPropagation();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
document.getElementById("copy").addEventListener("click",function(event) {
|
||||
|
||||
function listener(event) {
|
||||
event.clipboardData.setData("URL","data:text/vnd.tiddler," + encodeURIComponent(JSON.stringify(tiddlerData)));
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
document.addEventListener("copy",listener);
|
||||
document.execCommand("copy");
|
||||
document.removeEventListener("copy",listener);
|
||||
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user