Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
clipboardData.getHtml()
#1
I had copied some html into the clipboard (from the browser) which contained <a href="xyz">abc</a> and then in my LA function did print.it(clipboard.Html()); - expecting it would give me the "raw" html code - but I got the same result as with clipboard.Text(); - am I understanding it wrong or could there be a bug?
#2
Example. In Chrome select some text or link. Run this script.
 
Code:
Copy      Help
print.it(clipboardData.getHtml());

It prints
 
Code:
Copy      Help
<html>
<body>
<!--StartFragment--><strong style="color: rgb(51, 51, 51); font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 13px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial;"><a href="https://www.libreautomate.com/forum/forumdisplay.php?fid=19" style="color: rgb(0, 114, 188); text-decoration: none;">Help (LA)</a></strong><!--EndFragment-->
</body>
</html>

It is correct.
#3
Oh right - I found my fault: I had queried clipboard.text before that - and that "transformed" the content and removed the html. (I had not expected looking at the property would change the clipboard)   After moving that line I'm seeing the expected result.
#4
clipboard.text does not change the clipboard data.

Code:
Copy      Help
print.it(clipboard.text);
print.it("-------");
print.it(clipboardData.getHtml());
#5
you're right - I got lost in my own code. I had overwritten it myself and did not notice - sorry for spreading invalid statements! Sad


Forum Jump:


Users browsing this thread: 1 Guest(s)