Commit 8d7e9ae4 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

fix jwilkes/purr-data#6 by listening for a "paste" event inside boxes being...

fix jwilkes/purr-data#6 by listening for a "paste" event inside boxes being edited, and fetching only text from the clipboard
(need to investigate to make sure it works for drag/drop as well)
parent e27c50b2
......@@ -409,6 +409,12 @@ var canvas_events = (function() {
//evt.preventDefault();
return false;
},
text_paste: function(evt) {
pdgui.post("text_paste detected...");
evt.preventDefault;
document.execCommand("insertText", false,
e.clipboardData.getData("text"));
},
floating_text_click: function(evt) {
if (target_is_scrollbar(evt)) {
return;
......@@ -733,6 +739,7 @@ var canvas_events = (function() {
document.addEventListener("keydown", events.text_keydown, false);
document.addEventListener("keypress", events.text_keypress, false);
document.addEventListener("keyup", events.text_keyup, false);
document.addEventListener("paste", events.text_paste, false);
document.addEventListener("mousedown", events.text_mousedown, false);
document.addEventListener("mouseup", events.text_mouseup, false);
state = "text";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment