21. Making use of execCommand
Good option to consider
Document to be opened in Design-mode
Throws security exceptions in most browsers
22. In an ideal world !
Y.on(“copy”, function(e) {
window.clipboard.copy(e.target.get(“innerHTML”);
e.preventDefault();
});
Y.on(“paste”, function(e) {
var d = window.clipboard.getData();
e.preventDefault();
});
25. Create hidden field with copy text
Y.on('keydown', function(event) {
var specialKey =event.ctrlKey, textNode, text;
if (event.keyCode == 67 && specialKey) {
textNode = Y.one('#copyText’);
/* Copy the contents of the contact bubble /
lozenge */
text = ‘Foo Bar <foobar@yahoo.com>’;
textNode.set('value’, text);
textNode.focus();
textNode.select();
}
}
37. Different from ZeroClipboard ?
• YUI Node infrastructure
• Normalizes event interface between the
flash and JS
• So any event can trigger copy
• Any flash event can be trapped by JS