htmlText constant

SimpleValueFormat<String> const htmlText

Key for rich text in form of html snippet. Make sure to include plainText version in clipboard as well, otherwise setting the content may fail on some platforms (i.e. Android). Note that if you wish to receive dropped HTML files use htmlFile format instead. htmlText is mostly meant for copying and pasting HTML snippets (which on some platforms require additional conversion).

Implementation

//.
/// Note that if you wish to receive dropped HTML files use [htmlFile] format
/// instead. `htmlText` is mostly meant for copying and pasting HTML snippets
/// (which on some platforms require additional conversion).
static const htmlText = SimpleValueFormat<String>(
  ios: SimplePlatformCodec<String>(
    formats: ['public.html'],
    onDecode: fromSystemUtf8,
    onEncode: htmlToSystem,
  ),
  macos: SimplePlatformCodec<String>(
    formats: ['public.html'],
    onDecode: fromSystemUtf8,
    onEncode: htmlToSystem,
  ),
  windows: SimplePlatformCodec<String>(
    onDecode: windowsHtmlFromSystem,
    onEncode: windowsHtmlToSystem,
    formats: [
      'text/html',
      cfHtml,
    ],
  ),
  fallback: SimplePlatformCodec<String>(
    formats: ['text/html'],
    onDecode: fromSystemUtf8,
  ),
);