getCopyPasteHTMLNode();
The getCopyPasteHTMLNode method returns a DOM block item that contains formatted text from the clipboard.
The method returns a DOM element containing the <div> tag.
To execute the example, the HTML page must contain the link to the PP.js script file. Create clipboard, copy formatted text to clipboard as HTML markup, and show it in the <div> block:
// Create clipboard var clipboard = new PP.Ui.Clipboard() // Copy an HTML markup fragment in the clipboard clipboard.copy("<i>text<i>", true); // Get and show a block with markup var node = clipboard.getCopyPasteHTMLNode(); node.style.opacity = 1; node.style.width = "50px"; node.style.height = "50px"; node.style.height = "50px"; node.style.zIndex = 0; node.style.top = "0px"; node.style.left = "0px"; node.style.border = "1px solid #000000" document.body.appendChild(node); console.log("Formatted text (HTML) is in the clipboard: " + node.innerHTML);
After executing the example a clipboard is created, then the clipboard and its contents are displayed in the <div> tag:
Formatted text stored in the clipboard is displayed tot he browser console:
Formatted text (HTML) in the clipboard: <i>text</i>
See also: