flutter_quill_kit_clipboard

Rich clipboard support for flutter_quill_kit: paste HTML from other apps as formatted content, copy selections as HTML, and paste images — powered by quill_native_bridge.

Installation

flutter pub add flutter_quill_kit_clipboard

Requires flutter_quill_kit. See the platform support table below.

Quick start

import 'package:flutter_quill_kit/flutter_quill_kit.dart';
import 'package:flutter_quill_kit_clipboard/flutter_quill_kit_clipboard.dart';

final controller = QuillKitController(
  extensions: [
    ...QuillKitExtensions.standard(),
    ClipboardExtension(),
  ],
);

That's it: ClipboardExtension registers a RichClipboardService on the controller's EditorScope, replacing the core's plain-text-only service for that editor instance only.

The HTML ↔ Delta converters are also usable standalone:

final delta = const HtmlToDelta().convert('<p>Hello <b>world</b></p>');
final html = const DeltaToHtml().convert(delta);

Platform support

From the quill_native_bridge feature matrix:

Feature iOS Android macOS Windows Linux Web
Paste HTML
Copy as HTML
Paste image

Where a feature is unavailable the service degrades silently to plain text — no configuration or platform checks needed on your side.

Note on web

Web support relies on the browser's asynchronous Clipboard API. Browsers without it (or with it restricted, notably Firefox and Safari for some operations) fall back to plain text; a full fallback would require handling the DOM paste/copy events, which is outside this package's scope. Reading the clipboard may also prompt the user for permission.

What gets converted

HTML → Delta: bold/italic/underline/strike, inline code, sub/superscript, links, text and background colors (including rgb() styles), headers 1–6, paragraphs and <br>, nested ordered/bullet lists (depth → indent), checkbox task lists, blockquotes, <pre> code blocks, images (keeping width/height), text alignment, and RTL direction. Unknown tags — Word's o:p, Google Docs' wrapper tags — are descended into transparently, and whitespace is normalized per HTML rules.

Delta → HTML: the same feature set, emitted as semantic tags (strong, em, u, s, code, a, h1h6, ul/ol/li with checked items as disabled checkboxes, blockquote, pre, img, p), as a fragment — no <html> wrapper — which is what clipboards expect.

Testing your integration

RichClipboardService takes an injectable ClipboardGateway, so tests can fake the platform clipboard, and ClipboardExtension(service: ...) accepts a custom service outright:

final controller = QuillKitController(
  extensions: [ClipboardExtension(service: myFakeService)],
);

License

MIT — see LICENSE.

Libraries

flutter_quill_kit_clipboard
Rich clipboard support for flutter_quill_kit: paste HTML from other apps as formatted content, copy selections as HTML, and paste images — via quill_native_bridge, degrading to plain text on unsupported platforms.