mediawiki-extensions-Visual.../cut-copy-paste.js
2012-02-07 22:15:04 +00:00

31 lines
624 B
JavaScript

$(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);
});
});