{ "issue": { "url": "https://api.github.com/repos/laurent22/joplin/issues/15268", "repository_url": "https://api.github.com/repos/laurent22/joplin", "labels_url": "https://api.github.com/repos/laurent22/joplin/issues/15268/labels{/name}", "comments_url": "https://api.github.com/repos/laurent22/joplin/issues/15268/comments", "events_url": "https://api.github.com/repos/laurent22/joplin/issues/15268/events", "html_url": "https://github.com/laurent22/joplin/pull/15268", "id": 4382859047, "node_id": "PR_kwDOBLftOs7YVFTG", "number": 15268, "title": "Desktop: Preserve leading/trailing whitespace on paste in Rich Text E…", "user": { "login": "mayhemking007", "id": 84394327, "node_id": "MDQ6VXNlcjg0Mzk0MzI3", "avatar_url": "https://avatars.githubusercontent.com/u/84394327?v=4", "gravatar_id": "", "url": "https://api.github.com/users/mayhemking007", "html_url": "https://github.com/mayhemking007", "followers_url": "https://api.github.com/users/mayhemking007/followers", "following_url": "https://api.github.com/users/mayhemking007/following{/other_user}", "gists_url": "https://api.github.com/users/mayhemking007/gists{/gist_id}", "starred_url": "https://api.github.com/users/mayhemking007/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/mayhemking007/subscriptions", "organizations_url": "https://api.github.com/users/mayhemking007/orgs", "repos_url": "https://api.github.com/users/mayhemking007/repos", "events_url": "https://api.github.com/users/mayhemking007/events{/privacy}", "received_events_url": "https://api.github.com/users/mayhemking007/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "labels": [ { "id": 519700741, "node_id": "MDU6TGFiZWw1MTk3MDA3NDE=", "url": "https://api.github.com/repos/laurent22/joplin/labels/bug", "name": "bug", "color": "cf353b", "default": true, "description": "It's a bug" }, { "id": 1080341216, "node_id": "MDU6TGFiZWwxMDgwMzQxMjE2", "url": "https://api.github.com/repos/laurent22/joplin/labels/desktop", "name": "desktop", "color": "ffc274", "default": false, "description": "All desktop platforms" }, { "id": 1366672371, "node_id": "MDU6TGFiZWwxMzY2NjcyMzcx", "url": "https://api.github.com/repos/laurent22/joplin/labels/editor", "name": "editor", "color": "91ca55", "default": false, "description": "" } ], "state": "closed", "locked": false, "assignees": [], "milestone": null, "comments": 3, "created_at": "2026-05-05T09:07:04Z", "updated_at": "2026-05-05T09:34:12Z", "closed_at": "2026-05-05T09:33:32Z", "assignee": null, "author_association": "NONE", "active_lock_reason": null, "draft": false, "pull_request": { "url": "https://api.github.com/repos/laurent22/joplin/pulls/15268", "html_url": "https://github.com/laurent22/joplin/pull/15268", "diff_url": "https://github.com/laurent22/joplin/pull/15268.diff", "patch_url": "https://github.com/laurent22/joplin/pull/15268.patch", "merged_at": null }, "body": "## Summary\r\n\r\nFixes #15093 issue where leading and trailing whitespace is removed when pasting text in the Rich Text Editor.\r\n\r\n---\r\n\r\n## Problem\r\n\r\nWhen pasting text that contains leading or trailing spaces (e.g., `\" Hello\"` or `\"• \"`), the whitespace is stripped.\r\n\r\nThis happens because pasted HTML is converted to Markdown and back to HTML, and the Markdown conversion does not preserve boundary whitespace.\r\n\r\n---\r\n\r\n## Solution\r\n\r\n- Detect boundary whitespace in pasted HTML (` `, ` `, etc.)\r\n- Skip HTML → Markdown → HTML conversion when such whitespace is present\r\n- Allow the original HTML to pass through so spacing is preserved\r\n\r\nThis ensures that user intent (e.g., bullet spacing `\"• \"`) is respected.\r\n\r\n---\r\n\r\n## Changes\r\n\r\n- Updated `processPastedHtml` to conditionally skip Markdown conversion when boundary whitespace is detected\r\n- Added test coverage for:\r\n - Leading whitespace\r\n - Trailing whitespace\r\n - Both sides\r\n - Bullet + space (`• `)\r\n\r\n---\r\n\r\n## Before\r\n\r\n\r\nhttps://github.com/user-attachments/assets/397e45be-d10b-4883-aea3-146d0485298f\r\n\r\n\r\n---\r\n\r\n## After\r\n\r\n\r\nhttps://github.com/user-attachments/assets/ead803f2-8210-4902-b58a-aa499d45b86a\r\n\r\n\r\n---\r\n\r\n## Testing\r\n\r\n### Automated Tests\r\n\r\n- Added new test case in `resourceHandling.test.ts`\r\n- All tests pass:\r\n```\r\nyarn test resourceHandling\r\n```\r\n\r\n### Manual Testing\r\n\r\n1. Paste text with leading spaces → preserved \r\n2. Paste text with trailing spaces → preserved \r\n3. Paste `\"• \"` → space preserved \r\n4. Paste normal text → unchanged \r\n5. Paste formatted HTML → no regression observed \r\n\r\n---\r\n\r\n## Notes\r\n\r\n- The fix is scoped only to paste handling and does not modify global HTML ↔ Markdown conversion logic\r\n- Existing behavior remains unchanged for normal paste scenarios", "closed_by": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/15268/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "timeline_url": "https://api.github.com/repos/laurent22/joplin/issues/15268/timeline", "performed_via_github_app": null, "state_reason": null }, "comments": [ { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/4377924046", "html_url": "https://github.com/laurent22/joplin/pull/15268#issuecomment-4377924046", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/15268", "id": 4377924046, "node_id": "IC_kwDOBLftOs8AAAABBPHRzg", "user": { "login": "github-actions[bot]", "id": 41898282, "node_id": "MDM6Qm90NDE4OTgyODI=", "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4", "gravatar_id": "", "url": "https://api.github.com/users/github-actions%5Bbot%5D", "html_url": "https://github.com/apps/github-actions", "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers", "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}", "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}", "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions", "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs", "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos", "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}", "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events", "type": "Bot", "user_view_type": "public", "site_admin": false }, "created_at": "2026-05-05T09:11:09Z", "updated_at": "2026-05-05T09:34:12Z", "body": "All contributors have signed the CLA ✍️ ✅
Posted by the ****CLA Assistant Lite bot****.", "author_association": "CONTRIBUTOR", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/4377924046/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": { "id": 15368, "client_id": "Iv1.05c79e9ad1f6bdfa", "slug": "github-actions", "node_id": "MDM6QXBwMTUzNjg=", "owner": { "login": "github", "id": 9919, "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=", "avatar_url": "https://avatars.githubusercontent.com/u/9919?v=4", "gravatar_id": "", "url": "https://api.github.com/users/github", "html_url": "https://github.com/github", "followers_url": "https://api.github.com/users/github/followers", "following_url": "https://api.github.com/users/github/following{/other_user}", "gists_url": "https://api.github.com/users/github/gists{/gist_id}", "starred_url": "https://api.github.com/users/github/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/github/subscriptions", "organizations_url": "https://api.github.com/users/github/orgs", "repos_url": "https://api.github.com/users/github/repos", "events_url": "https://api.github.com/users/github/events{/privacy}", "received_events_url": "https://api.github.com/users/github/received_events", "type": "Organization", "user_view_type": "public", "site_admin": false }, "name": "GitHub Actions", "description": "Automate your workflow from idea to production", "external_url": "https://help.github.com/en/actions", "html_url": "https://github.com/apps/github-actions", "created_at": "2018-07-30T09:30:17Z", "updated_at": "2026-05-05T14:51:38Z", "permissions": { "actions": "write", "administration": "read", "artifact_metadata": "write", "attestations": "write", "checks": "write", "code_quality": "write", "contents": "write", "copilot_requests": "write", "deployments": "write", "discussions": "write", "issues": "write", "merge_queues": "write", "metadata": "read", "models": "read", "packages": "write", "pages": "write", "pull_requests": "write", "repository_hooks": "write", "repository_projects": "write", "security_events": "write", "statuses": "write", "vulnerability_alerts": "read" }, "events": [ "branch_protection_rule", "check_run", "check_suite", "create", "delete", "deployment", "deployment_status", "discussion", "discussion_comment", "fork", "gollum", "issues", "issue_comment", "label", "merge_group", "milestone", "page_build", "public", "pull_request", "pull_request_review", "pull_request_review_comment", "push", "registry_package", "release", "repository", "repository_dispatch", "status", "watch", "workflow_dispatch", "workflow_run" ] } }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/4377958169", "html_url": "https://github.com/laurent22/joplin/pull/15268#issuecomment-4377958169", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/15268", "id": 4377958169, "node_id": "IC_kwDOBLftOs8AAAABBPJXGQ", "user": { "login": "mayhemking007", "id": 84394327, "node_id": "MDQ6VXNlcjg0Mzk0MzI3", "avatar_url": "https://avatars.githubusercontent.com/u/84394327?v=4", "gravatar_id": "", "url": "https://api.github.com/users/mayhemking007", "html_url": "https://github.com/mayhemking007", "followers_url": "https://api.github.com/users/mayhemking007/followers", "following_url": "https://api.github.com/users/mayhemking007/following{/other_user}", "gists_url": "https://api.github.com/users/mayhemking007/gists{/gist_id}", "starred_url": "https://api.github.com/users/mayhemking007/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/mayhemking007/subscriptions", "organizations_url": "https://api.github.com/users/mayhemking007/orgs", "repos_url": "https://api.github.com/users/mayhemking007/repos", "events_url": "https://api.github.com/users/mayhemking007/events{/privacy}", "received_events_url": "https://api.github.com/users/mayhemking007/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2026-05-05T09:16:12Z", "updated_at": "2026-05-05T09:16:12Z", "body": "I have read the CLA Document and I hereby sign the CLA", "author_association": "NONE", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/4377958169/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null }, { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/4378070406", "html_url": "https://github.com/laurent22/joplin/pull/15268#issuecomment-4378070406", "issue_url": "https://api.github.com/repos/laurent22/joplin/issues/15268", "id": 4378070406, "node_id": "IC_kwDOBLftOs8AAAABBPQNhg", "user": { "login": "laurent22", "id": 1285584, "node_id": "MDQ6VXNlcjEyODU1ODQ=", "avatar_url": "https://avatars.githubusercontent.com/u/1285584?v=4", "gravatar_id": "", "url": "https://api.github.com/users/laurent22", "html_url": "https://github.com/laurent22", "followers_url": "https://api.github.com/users/laurent22/followers", "following_url": "https://api.github.com/users/laurent22/following{/other_user}", "gists_url": "https://api.github.com/users/laurent22/gists{/gist_id}", "starred_url": "https://api.github.com/users/laurent22/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/laurent22/subscriptions", "organizations_url": "https://api.github.com/users/laurent22/orgs", "repos_url": "https://api.github.com/users/laurent22/repos", "events_url": "https://api.github.com/users/laurent22/events{/privacy}", "received_events_url": "https://api.github.com/users/laurent22/received_events", "type": "User", "user_view_type": "public", "site_admin": false }, "created_at": "2026-05-05T09:33:32Z", "updated_at": "2026-05-05T09:33:32Z", "body": "Thanks for the contribution. We’re closing this PR because it does not follow the project’s contribution policy: it is not based on a triaged, accepted issue and does not address a concrete problem agreed upon by maintainers.\r\n\r\nWhile the change itself is not necessarily incorrect, reviewing and maintaining such PRs takes time away from higher-priority work.\r\n\r\nPlease see our [Contribution Scope Policy](https://joplinapp.org/help/dev/#contribution-scope) for details on what kinds of contributions we accept.\r\n\r\nIf you intend to participate in GSoC, please make sure you read our [GSoC guidelines](https://github.com/joplin/gsoc).\r\n\r\nAnd [please pay attention to our AI policy](https://github.com/joplin/gsoc/blob/master/ai_policy.md).\r\n", "author_association": "OWNER", "reactions": { "url": "https://api.github.com/repos/laurent22/joplin/issues/comments/4378070406/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 }, "performed_via_github_app": null } ] }