Fix plain text paste being ignored without markdown - #1178
Open
MatheusRich wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a Lexxy clipboard regression where pasting plain, non-URL text could be ignored when supportsMarkdown is false (e.g., markdown: false or richText: false) by capturing clipboard text synchronously and inserting it directly.
Changes:
- Replace the async
DataTransferItem#getAsStringplain-text paste path with a synchronousclipboardData.getData(...)read and direct text insertion. - Remove the now-dead rich-text fallback path for plain-text/URL-only clipboard payloads.
- Add a system regression test covering both
markdown: falseandrich-text: falseconfigurations.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/system/plain_text_paste_test.rb | Adds regression coverage ensuring plain-text paste works when markdown or rich-text mode is disabled. |
| src/editor/clipboard.js | Reads plain text synchronously from clipboardData and inserts captured text directly, avoiding stale DataTransfer reads. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Pasting plain, non-URL text did nothing whenever `supportsMarkdown` was false, which happens with `markdown: false` or in a plain-text-only editor (`richText: false`). `#pastePlainTextOrURL` resolves the clipboard text through the asynchronous `item.getAsString` callback. The non-markdown branch ignored that resolved text and handed the whole `clipboardData` to `$insertDataTransferForRichText` instead. By the time the callback ran, the paste event was over, so that DataTransfer read back empty and nothing got inserted. The URL and Markdown branches worked because they already used the resolved text string. This commit inserts the resolved text in the non-markdown branch too, rather than re-reading the stale clipboard, and drops the now-unused rich-text path.
MatheusRich
force-pushed
the
fix-plain-text-paste-with-markdown-disabled
branch
from
July 2, 2026 19:46
4baa2e6 to
1b1de59
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1055
Pasting plain, non-URL text did nothing whenever
supportsMarkdownwas false, which happens withmarkdown: falseor in a plain-text-only editor (richText: false).#pastePlainTextOrURLresolves the clipboard text through the asynchronousitem.getAsStringcallback. The non-markdown branch ignored that resolved text and handed the wholeclipboardDatato$insertDataTransferForRichTextinstead. By the time the callback ran, the paste event was over, so that DataTransfer read back empty and nothing got inserted. The URL and Markdown branches worked because they already used the resolved text string.This PR inserts the resolved text in the non-markdown branch too, rather than re-reading the stale clipboard, and drops the now-unused rich-text path.
A Playwright regression (
programmatic_insert_fallback) showed why the earlier synchronous-read approach was wrong: the URL paste path relies onitem.getAsStringrunning after the paste command handler, so thelexxy:insert-linkreplacement fires correctly. The async callback is kept intact; only the non-markdown branch changed.