diff --git a/cut-copy-paste.html b/cut-copy-paste.html new file mode 100644 index 0000000000..5a53b9be2a --- /dev/null +++ b/cut-copy-paste.html @@ -0,0 +1,16 @@ + + + + -----cut-----copy-----paste----- + + + + + +
+

Here is some text. I dare you to mess with me.

+

More text here. Don't you dare!

+
+
+ + \ No newline at end of file diff --git a/cut-copy-paste.js b/cut-copy-paste.js new file mode 100644 index 0000000000..c58dd38c0e --- /dev/null +++ b/cut-copy-paste.js @@ -0,0 +1,31 @@ +$(function() { + var paste = {}; + + $('#editor') + .on('copy', function(event) { + var range = rangy.getSelection().getRangeAt(0); + var key = range.toString().replace(/( |\r\n|\n|\r|\t)/gm,""); + + paste = {}; + paste[key] = 'some wikidom'; + }) + .on('paste', function(event) { + $('#paste').html(''); + $('#paste').focus(); + + setTimeout(function() { + var key = $('#paste').text().replace(/( |\r\n|\n|\r|\t)/gm,""); + + console.log(paste); + + if (paste[key]) { + alert('you pasted from wikidom'); + } else { + alert('i don\'t know where you pasted from'); + } + + }, 1); + }); + + +}); \ No newline at end of file