Skip to content

basicwidget: parse the clipboard's HTML on paste #455

Description

@hajimehoshi

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • Android
  • iOS
  • Web Browsers

What feature would you like to be added?

Parsing of the clipboard's HTML representation when pasting into a rich-text-editable text widget, so that styled text copied from other applications (browsers, word processors, or another guigui app) keeps its formatting.

Scope:

  • A small whitelist of tags and inline style properties mapped onto the ranged style model: b/strong (weight), i/em (italic), u (underline), s/del (strikethrough), span with color, background-color, and font-size (mapped to the scale multiplier), plus br and block boundaries as line breaks. Everything else is stripped to its text content.
  • Paste preference stays: internal rich clipboard slot (full in-app fidelity) → HTML parse → plain text. Paste Without Styles (Shift+mod+V) continues to bypass all styling.
  • The parser operates on clipboard.Contents.HTML, so it is platform-independent; availability follows the platform clipboard support (checked above).

Why is this needed?

The HTML write side already exists: copying styled text puts a text/html representation on the system clipboard, so other applications receive guigui's formatting. The read direction is missing — pasting styled content from an external application currently flattens it to plain text. Parsing the HTML flavor completes the cross-application rich text round trip for the rich text editor (#131, example/richtexteditor).


Filed by Claude (Claude Code) on behalf of @hajimehoshi.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions