Difference between "html" and "htmlText" in clipboardData?

Mark Waddingham mark at livecode.com
Thu Feb 2 03:28:31 EST 2017


On 2017-02-02 01:46, Richard Gaskin via use-livecode wrote:
> The Dictionary entry for clipboardData lists these among the array 
> keys:
> 
> - htmlText: LiveCode HTML text
> - html: styled text in LiveCode HTML format

That dictionary entry could do with a little refinement :)

> What is the difference between "LiveCode HTML text" and "LiveCode HTML 
> format"?

Nothing - they are the same format in that context (the clipboardData). 
However,
you should use 'htmlText' and 'rtfText' in preference to 'html' and 
'rtf' as they
are the new names.

> If there is no difference and they're both LC's htmlText, why two key 
> names?

The difference comes about when you use 'the fullClipboardData'.

The fullClipboardData gives you access both to the engine's synthesized 
data
formats and the original data that was placed on the clipboard.

In this context:

   - rtfText: LiveCode's rtfText format
   - htmlText: LiveCode's htmlText format
   - styledText: LiveCode's (array-based) styledText format
   - html: Only present if the data on the clipboard is actually HTML
   - rtf: Only present if the data on the clipboard is actually RTF

This is explained in more detail in the fullClipboardData entry.

I'd generally recommend not using 'the clipboardData' for new apps, and 
using
'the fullClipboardData' instead. It allows you to put multiple distinct 
data
types on the clipboard, and does not use any 'legacy' rules to determine 
what
keys appear ('the clipboardData' only allows a single actual datatype, 
so uses
priority rules to determine which you see).

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the Use-livecode mailing list