From 4620b963937386df60d3c40b10c9649d7d6647de Mon Sep 17 00:00:00 2001 From: Serhii Pylypchuk Date: Fri, 22 May 2026 11:56:51 +0300 Subject: [PATCH 1/2] [add] document copy and paste behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - new "Copy and paste" section in index.md describing system shortcuts, toolbar/menubar entries, plain-text + HTML clipboard payload, paste fallback to plain text, and behavior across RichText instances and external sources - note that the toolbar Paste button uses the async Clipboard API (plain text only), while Ctrl+V / ⌘V receives full HTML --- docs/index.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/index.md b/docs/index.md index d6a84fe..ca37622 100644 --- a/docs/index.md +++ b/docs/index.md @@ -85,6 +85,25 @@ The RichText editor supports [parsing](api/methods/set-value.md) and [serializat ![Text format](./assets/richtext/text_format.png) +## Copy and paste + +The RichText editor supports clipboard operations through standard system shortcuts (`Ctrl+C` / `Ctrl+X` / `Ctrl+V` on Windows/Linux, `⌘C` / `⌘X` / `⌘V` on macOS), the corresponding [toolbar](api/config/toolbar.md) buttons, and the [menubar](api/config/menubar.md) entries. + +When content is copied or cut, RichText writes two representations to the system clipboard: + +- a **plain text** version for compatibility with simple targets (terminals, code editors, plain inputs) +- an **HTML** version that carries all inline and block formatting (bold, italic, underline, strikethrough, font family, font size, text and background color, headings, blockquotes, lists, alignment, indentation, line height, links, and images) + +On paste, the editor reads the HTML version when it is available and falls back to plain text otherwise. This means that: + +- Copying between two RichText instances (in the same document or on different pages) preserves the original formatting. +- Pasting from external sources that publish HTML to the clipboard (most browsers, word processors, and editors) also preserves the recognized formatting. Styles that have no direct counterpart in RichText are dropped during normalization. +- Pasting from a plain-text source produces a plain paragraph, as expected. + +:::note +The toolbar **Paste** button uses the asynchronous Clipboard API, which exposes plain text only. To paste formatted content, use the `Ctrl+V` / `⌘V` shortcut, which receives the full HTML payload directly from the browser's clipboard event. +::: + ## Keyboard shortcuts The RichText editor supports a set of common keyboard shortcuts for faster formatting and editing. The shortcuts follow platform conventions and are available on both **Windows/Linux** (`Ctrl`) and **macOS** (`⌘`). From 575a11d6a02912d0a36479d71d7f338d657345fc Mon Sep 17 00:00:00 2001 From: Serhii Pylypchuk Date: Fri, 22 May 2026 17:41:55 +0300 Subject: [PATCH 2/2] [update] address review on copy and paste section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - macOS shortcuts now follow Ctrl+C style: ⌘+C / ⌘+X / ⌘+V (incl. the note about ⌘+V) - clarify that pasting from any external source is processed as plain text; previous wording about HTML-aware external paste was incorrect - drop the separate plain-text-source bullet; external-source behavior is now one line --- docs/index.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/index.md b/docs/index.md index ca37622..7ab48e4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -87,21 +87,20 @@ The RichText editor supports [parsing](api/methods/set-value.md) and [serializat ## Copy and paste -The RichText editor supports clipboard operations through standard system shortcuts (`Ctrl+C` / `Ctrl+X` / `Ctrl+V` on Windows/Linux, `⌘C` / `⌘X` / `⌘V` on macOS), the corresponding [toolbar](api/config/toolbar.md) buttons, and the [menubar](api/config/menubar.md) entries. +The RichText editor supports clipboard operations through standard system shortcuts (`Ctrl+C` / `Ctrl+X` / `Ctrl+V` on Windows/Linux, `⌘+C` / `⌘+X` / `⌘+V` on macOS), the corresponding [toolbar](api/config/toolbar.md) buttons, and the [menubar](api/config/menubar.md) entries. When content is copied or cut, RichText writes two representations to the system clipboard: - a **plain text** version for compatibility with simple targets (terminals, code editors, plain inputs) - an **HTML** version that carries all inline and block formatting (bold, italic, underline, strikethrough, font family, font size, text and background color, headings, blockquotes, lists, alignment, indentation, line height, links, and images) -On paste, the editor reads the HTML version when it is available and falls back to plain text otherwise. This means that: +Paste behavior depends on the source of the clipboard payload: -- Copying between two RichText instances (in the same document or on different pages) preserves the original formatting. -- Pasting from external sources that publish HTML to the clipboard (most browsers, word processors, and editors) also preserves the recognized formatting. Styles that have no direct counterpart in RichText are dropped during normalization. -- Pasting from a plain-text source produces a plain paragraph, as expected. +- Pasting between two RichText instances (in the same document or on different pages) uses the HTML representation and preserves the original formatting. +- Pasting from any external source — including browsers, word processors, and other editors — is processed as plain text. The inserted content is added as text without external formatting. :::note -The toolbar **Paste** button uses the asynchronous Clipboard API, which exposes plain text only. To paste formatted content, use the `Ctrl+V` / `⌘V` shortcut, which receives the full HTML payload directly from the browser's clipboard event. +The toolbar **Paste** button uses the asynchronous Clipboard API, which exposes plain text only. To paste content copied from another RichText with its formatting preserved, use the `Ctrl+V` / `⌘+V` shortcut, which receives the full HTML payload directly from the browser's clipboard event. ::: ## Keyboard shortcuts