{
	"issue": {
		"url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
		"repository_url": "https://api.github.com/repos/laurent22/joplin",
		"labels_url": "https://api.github.com/repos/laurent22/joplin/issues/7751/labels{/name}",
		"comments_url": "https://api.github.com/repos/laurent22/joplin/issues/7751/comments",
		"events_url": "https://api.github.com/repos/laurent22/joplin/issues/7751/events",
		"html_url": "https://github.com/laurent22/joplin/pull/7751",
		"id": 1578512108,
		"node_id": "PR_kwDOBLftOs5JpquU",
		"number": 7751,
		"title": "Desktop: Allow 'Paste as Text' on the Rich Text Editor",
		"user": {
			"login": "pedr",
			"id": 5051088,
			"node_id": "MDQ6VXNlcjUwNTEwODg=",
			"avatar_url": "https://avatars.githubusercontent.com/u/5051088?v=4",
			"gravatar_id": "",
			"url": "https://api.github.com/users/pedr",
			"html_url": "https://github.com/pedr",
			"followers_url": "https://api.github.com/users/pedr/followers",
			"following_url": "https://api.github.com/users/pedr/following{/other_user}",
			"gists_url": "https://api.github.com/users/pedr/gists{/gist_id}",
			"starred_url": "https://api.github.com/users/pedr/starred{/owner}{/repo}",
			"subscriptions_url": "https://api.github.com/users/pedr/subscriptions",
			"organizations_url": "https://api.github.com/users/pedr/orgs",
			"repos_url": "https://api.github.com/users/pedr/repos",
			"events_url": "https://api.github.com/users/pedr/events{/privacy}",
			"received_events_url": "https://api.github.com/users/pedr/received_events",
			"type": "User",
			"user_view_type": "public",
			"site_admin": false
		},
		"labels": [],
		"state": "closed",
		"locked": true,
		"assignee": null,
		"assignees": [],
		"milestone": null,
		"comments": 17,
		"created_at": "2023-02-09T20:06:39Z",
		"updated_at": "2023-02-13T19:28:02Z",
		"closed_at": "2023-02-13T19:16:33Z",
		"author_association": "COLLABORATOR",
		"sub_issues_summary": {
			"total": 0,
			"completed": 0,
			"percent_completed": 0
		},
		"active_lock_reason": null,
		"draft": false,
		"pull_request": {
			"url": "https://api.github.com/repos/laurent22/joplin/pulls/7751",
			"html_url": "https://github.com/laurent22/joplin/pull/7751",
			"diff_url": "https://github.com/laurent22/joplin/pull/7751.diff",
			"patch_url": "https://github.com/laurent22/joplin/pull/7751.patch",
			"merged_at": "2023-02-13T19:16:33Z"
		},
		"body": "This functionality should be helpful when the user has copied some content from a webpage and doesn't want the original style to be pasted over inside the Rich Text Editor. It will be helpful in these cases because the user will not have to manually remove the styles from the content.\r\n\r\nOn this PR I'm:\r\n\r\n- Creating a new option inside the Edit menu `Paste as text`\r\n- Creating a new NoteEditor Command `pasteAsText`\r\n- Modifying the TinyMCE component to intercept the `pasteAsText` command and execute the functionality\r\n\r\n![Screenshot from 2023-02-09 16-48-22](https://user-images.githubusercontent.com/5051088/217924372-9d7bec06-48ec-44f6-abd3-617f9e2d54e1.png)\r\n\r\n\r\n## Testing:\r\n\r\nI didn't create any automated tests, but I'm open to suggestions on how to add to this case. I think something we could do is to refactor the `useImperactiveHandler` as a custom hook, making it possible to add tests only to this part of the component, for now.\r\n\r\nhttps://github.com/laurent22/joplin/blob/8c2060efbaf3103cd32c4c3b5b653e56027882b5/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx#L183\r\n\r\nManual testing:\r\n\r\n- If the Markdown Editor is active, the option should be disabled (since it would not be clear if the user pasting as text would want to remove Markdown or HTML tags)\r\n- If the Rich Text Editor is active, the option should be enabled\r\n- If the copied content is only one paragraph long (meaning, it does not have new lines in between) the content should be \"inlined\" where the cursor is.\r\n- If the content has multiple paragraphs, the content will be pasted as plain text, but each paragraph on its own line\r\n- If the copied content includes an image, the image will be pasted as the alt text supplied\r\n- if the copied content is only an image, the pasted content will be nothing",
		"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/7751/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/7751/timeline",
		"performed_via_github_app": null,
		"state_reason": null
	},
	"comments": [
		{
			"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1424744713",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1424744713",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1424744713,
			"node_id": "IC_kwDOBLftOs5U6-EJ",
			"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": "2023-02-09T20:06:52Z",
			"updated_at": "2023-02-13T18:30:27Z",
			"author_association": "CONTRIBUTOR",
			"body": "****CLA Assistant Lite bot**** All contributors have signed the CLA  ✍️ ✅",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1424744713/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/1424747906",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1424747906",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1424747906,
			"node_id": "IC_kwDOBLftOs5U6-2C",
			"user": {
				"login": "pedr",
				"id": 5051088,
				"node_id": "MDQ6VXNlcjUwNTEwODg=",
				"avatar_url": "https://avatars.githubusercontent.com/u/5051088?v=4",
				"gravatar_id": "",
				"url": "https://api.github.com/users/pedr",
				"html_url": "https://github.com/pedr",
				"followers_url": "https://api.github.com/users/pedr/followers",
				"following_url": "https://api.github.com/users/pedr/following{/other_user}",
				"gists_url": "https://api.github.com/users/pedr/gists{/gist_id}",
				"starred_url": "https://api.github.com/users/pedr/starred{/owner}{/repo}",
				"subscriptions_url": "https://api.github.com/users/pedr/subscriptions",
				"organizations_url": "https://api.github.com/users/pedr/orgs",
				"repos_url": "https://api.github.com/users/pedr/repos",
				"events_url": "https://api.github.com/users/pedr/events{/privacy}",
				"received_events_url": "https://api.github.com/users/pedr/received_events",
				"type": "User",
				"user_view_type": "public",
				"site_admin": false
			},
			"created_at": "2023-02-09T20:09:49Z",
			"updated_at": "2023-02-09T20:09:49Z",
			"author_association": "COLLABORATOR",
			"body": "I have read the CLA Document and I hereby sign the CLA",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1424747906/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/1425133702",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1425133702",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1425133702,
			"node_id": "IC_kwDOBLftOs5U8dCG",
			"user": {
				"login": "wh201906",
				"id": 62299611,
				"node_id": "MDQ6VXNlcjYyMjk5NjEx",
				"avatar_url": "https://avatars.githubusercontent.com/u/62299611?v=4",
				"gravatar_id": "",
				"url": "https://api.github.com/users/wh201906",
				"html_url": "https://github.com/wh201906",
				"followers_url": "https://api.github.com/users/wh201906/followers",
				"following_url": "https://api.github.com/users/wh201906/following{/other_user}",
				"gists_url": "https://api.github.com/users/wh201906/gists{/gist_id}",
				"starred_url": "https://api.github.com/users/wh201906/starred{/owner}{/repo}",
				"subscriptions_url": "https://api.github.com/users/wh201906/subscriptions",
				"organizations_url": "https://api.github.com/users/wh201906/orgs",
				"repos_url": "https://api.github.com/users/wh201906/repos",
				"events_url": "https://api.github.com/users/wh201906/events{/privacy}",
				"received_events_url": "https://api.github.com/users/wh201906/received_events",
				"type": "User",
				"user_view_type": "public",
				"site_admin": false
			},
			"created_at": "2023-02-10T03:45:36Z",
			"updated_at": "2023-02-10T03:48:41Z",
			"author_association": "CONTRIBUTOR",
			"body": "If I remember it correctly the `Ctrl+Shift+V` is also for \"Paste as Text\".\r\n#7045",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1425133702/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/1425152918",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1425152918",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1425152918,
			"node_id": "IC_kwDOBLftOs5U8huW",
			"user": {
				"login": "tomasz1986",
				"id": 5626656,
				"node_id": "MDQ6VXNlcjU2MjY2NTY=",
				"avatar_url": "https://avatars.githubusercontent.com/u/5626656?v=4",
				"gravatar_id": "",
				"url": "https://api.github.com/users/tomasz1986",
				"html_url": "https://github.com/tomasz1986",
				"followers_url": "https://api.github.com/users/tomasz1986/followers",
				"following_url": "https://api.github.com/users/tomasz1986/following{/other_user}",
				"gists_url": "https://api.github.com/users/tomasz1986/gists{/gist_id}",
				"starred_url": "https://api.github.com/users/tomasz1986/starred{/owner}{/repo}",
				"subscriptions_url": "https://api.github.com/users/tomasz1986/subscriptions",
				"organizations_url": "https://api.github.com/users/tomasz1986/orgs",
				"repos_url": "https://api.github.com/users/tomasz1986/repos",
				"events_url": "https://api.github.com/users/tomasz1986/events{/privacy}",
				"received_events_url": "https://api.github.com/users/tomasz1986/received_events",
				"type": "User",
				"user_view_type": "public",
				"site_admin": false
			},
			"created_at": "2023-02-10T04:16:27Z",
			"updated_at": "2023-02-10T04:19:35Z",
			"author_association": "NONE",
			"body": "> If I remember it correctly the `Ctrl+Shift+V` is also for \"Paste as Text\". #7045\r\n\r\nThis is true. Wouldn't it be possible for the command to simply pass `Ctrl+Shift+V` (or whatever the OS uses, e.g. on macOS it appears to be `Option+Shift+Command+V`) to the application and let the OS handle it instead of trying to reinvent the wheel?\r\n\r\nHaving the command itself available in plain sight is still useful, e.g. for a) average users who aren't aware of any advanced keyboard shortcuts or b) touch screen devices with no physical keyboard attached (which applies to myself too). It's good for accessibility also (as there are people who simply can't use a physical keyboard due to disabilities and such).",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1425152918/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/1425153957",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1425153957",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1425153957,
			"node_id": "IC_kwDOBLftOs5U8h-l",
			"user": {
				"login": "wh201906",
				"id": 62299611,
				"node_id": "MDQ6VXNlcjYyMjk5NjEx",
				"avatar_url": "https://avatars.githubusercontent.com/u/62299611?v=4",
				"gravatar_id": "",
				"url": "https://api.github.com/users/wh201906",
				"html_url": "https://github.com/wh201906",
				"followers_url": "https://api.github.com/users/wh201906/followers",
				"following_url": "https://api.github.com/users/wh201906/following{/other_user}",
				"gists_url": "https://api.github.com/users/wh201906/gists{/gist_id}",
				"starred_url": "https://api.github.com/users/wh201906/starred{/owner}{/repo}",
				"subscriptions_url": "https://api.github.com/users/wh201906/subscriptions",
				"organizations_url": "https://api.github.com/users/wh201906/orgs",
				"repos_url": "https://api.github.com/users/wh201906/repos",
				"events_url": "https://api.github.com/users/wh201906/events{/privacy}",
				"received_events_url": "https://api.github.com/users/wh201906/received_events",
				"type": "User",
				"user_view_type": "public",
				"site_admin": false
			},
			"created_at": "2023-02-10T04:18:35Z",
			"updated_at": "2023-02-10T04:18:35Z",
			"author_association": "CONTRIBUTOR",
			"body": "Yeah that's true.",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1425153957/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/1425727820",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1425727820",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1425727820,
			"node_id": "IC_kwDOBLftOs5U-uFM",
			"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": "2023-02-10T12:12:43Z",
			"updated_at": "2023-02-10T12:12:43Z",
			"author_association": "OWNER",
			"body": "> Having the command itself available in plain sight is still useful, e.g. for a) average users who aren't aware of any advanced keyboard shortcuts or b) touch screen devices with no physical keyboard attached (which applies to myself too). It's good for accessibility also (as there are people who simply can't use a physical keyboard due to disabilities and such).\r\n\r\nExactly, this is the main reason we have this. Some users know about Ctrl+Shift+V but not everybody, so having it as an option helps",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1425727820/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/1425733005",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1425733005",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1425733005,
			"node_id": "IC_kwDOBLftOs5U-vWN",
			"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": "2023-02-10T12:17:42Z",
			"updated_at": "2023-02-10T12:17:42Z",
			"author_association": "OWNER",
			"body": "Seems to work fine @pedr, thank you. However I see there's already a `pasteAsPlainText()` function in that component, could you re-use it please?\r\n\r\nAlso could you try to associate a Ctrl+Shift+V shortcut with this command and see if it still works? It's handled natively on Windows and Linux so we need to check that it didn't break if we associate a shortcut",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1425733005/reactions",
				"total_count": 1,
				"+1": 1,
				"-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/1425860722",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1425860722",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1425860722,
			"node_id": "IC_kwDOBLftOs5U_Ohy",
			"user": {
				"login": "pedr",
				"id": 5051088,
				"node_id": "MDQ6VXNlcjUwNTEwODg=",
				"avatar_url": "https://avatars.githubusercontent.com/u/5051088?v=4",
				"gravatar_id": "",
				"url": "https://api.github.com/users/pedr",
				"html_url": "https://github.com/pedr",
				"followers_url": "https://api.github.com/users/pedr/followers",
				"following_url": "https://api.github.com/users/pedr/following{/other_user}",
				"gists_url": "https://api.github.com/users/pedr/gists{/gist_id}",
				"starred_url": "https://api.github.com/users/pedr/starred{/owner}{/repo}",
				"subscriptions_url": "https://api.github.com/users/pedr/subscriptions",
				"organizations_url": "https://api.github.com/users/pedr/orgs",
				"repos_url": "https://api.github.com/users/pedr/repos",
				"events_url": "https://api.github.com/users/pedr/events{/privacy}",
				"received_events_url": "https://api.github.com/users/pedr/received_events",
				"type": "User",
				"user_view_type": "public",
				"site_admin": false
			},
			"created_at": "2023-02-10T14:07:42Z",
			"updated_at": "2023-02-10T14:07:42Z",
			"author_association": "COLLABORATOR",
			"body": "I made the suggested modifications. \r\n\r\nI moved the `pasteAsPlainText` function out of the hook it was declared to become accessible to other parts of the components. I wasn't sure, in this case, if it was better to move the function `pasteAsPlainText` outside of the React component and pass `editor` as a parameter or just create a plain function wrapped in a `useCallback`, so I end up opting in for the second option.\r\n\r\nI also added the shortcuts and tested them in my Ubuntu system, when you use `Ctrl+Shift+V` the `onPaste` function is called without the `text/html` format, which end up with a result similar to the Paste as text button. I don't have a Mac, so I couldn't test on that machine.\r\n\r\nOne thing I noticed that is different between the OS shortcut and the Paste as Text button is that when you copy an image, without any other HTML, the `Ctrl+Shift+V` will paste the image, while the Paste as Text will not. This happens because when the Ctrl+Shift+V is pressed the `onPaste` function is called and it is set up to handle images. \r\n\r\nI could make some modifications for the Paste as text button to have the same behavior, by mocking a ClipboardEvent and calling the `onPaste` function in the `pasteAsText` handler instead of the `pasteAsPlainText` function, but I didn't think it would be necessary, but I'm open to suggestions.",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1425860722/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/1426074087",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1426074087",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1426074087,
			"node_id": "IC_kwDOBLftOs5VACnn",
			"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": "2023-02-10T16:48:22Z",
			"updated_at": "2023-02-10T16:48:22Z",
			"author_association": "OWNER",
			"body": "> One thing I noticed that is different between the OS shortcut and the Paste as Text button is that when you copy an image, without any other HTML, the `Ctrl+Shift+V` will paste the image, while the Paste as Text will not. This happens because when the Ctrl+Shift+V is pressed the `onPaste` function is called and it is set up to handle images.\r\n\r\nThat's a good point, and I think we should have the same behaviour for the shortcut and menu item. Could you setup to also call onPaste then?",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1426074087/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/1426224717",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1426224717",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1426224717,
			"node_id": "IC_kwDOBLftOs5VAnZN",
			"user": {
				"login": "pedr",
				"id": 5051088,
				"node_id": "MDQ6VXNlcjUwNTEwODg=",
				"avatar_url": "https://avatars.githubusercontent.com/u/5051088?v=4",
				"gravatar_id": "",
				"url": "https://api.github.com/users/pedr",
				"html_url": "https://github.com/pedr",
				"followers_url": "https://api.github.com/users/pedr/followers",
				"following_url": "https://api.github.com/users/pedr/following{/other_user}",
				"gists_url": "https://api.github.com/users/pedr/gists{/gist_id}",
				"starred_url": "https://api.github.com/users/pedr/starred{/owner}{/repo}",
				"subscriptions_url": "https://api.github.com/users/pedr/subscriptions",
				"organizations_url": "https://api.github.com/users/pedr/orgs",
				"repos_url": "https://api.github.com/users/pedr/repos",
				"events_url": "https://api.github.com/users/pedr/events{/privacy}",
				"received_events_url": "https://api.github.com/users/pedr/received_events",
				"type": "User",
				"user_view_type": "public",
				"site_admin": false
			},
			"created_at": "2023-02-10T19:08:57Z",
			"updated_at": "2023-02-10T19:08:57Z",
			"author_association": "COLLABORATOR",
			"body": "I made the change to make the `onPaste` function work with the new pasteAsText command. For that I created a function that generates a synthetic clipboard event, filtering out any formats that are `text/html`. I'm sending this Event with the clipboard data because the `onPaste` uses the `event.clipboardData` to choose if should render the clipboard content as HTML or plain text.",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1426224717/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/1427122062",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1427122062",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1427122062,
			"node_id": "IC_kwDOBLftOs5VECeO",
			"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": "2023-02-12T20:13:05Z",
			"updated_at": "2023-02-12T20:13:05Z",
			"author_association": "OWNER",
			"body": "Thanks for the update @pedr. The createSyntheticEvent thing feels a bit like a hack but I can see how you got there, as it means we don't need to change too much to the existing logic, so that's reasonable. One problem though: there's now two onPaste functions in your code - I assume you want to remove one?",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1427122062/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/1427835614",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1427835614",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1427835614,
			"node_id": "IC_kwDOBLftOs5VGwre",
			"user": {
				"login": "pedr",
				"id": 5051088,
				"node_id": "MDQ6VXNlcjUwNTEwODg=",
				"avatar_url": "https://avatars.githubusercontent.com/u/5051088?v=4",
				"gravatar_id": "",
				"url": "https://api.github.com/users/pedr",
				"html_url": "https://github.com/pedr",
				"followers_url": "https://api.github.com/users/pedr/followers",
				"following_url": "https://api.github.com/users/pedr/following{/other_user}",
				"gists_url": "https://api.github.com/users/pedr/gists{/gist_id}",
				"starred_url": "https://api.github.com/users/pedr/starred{/owner}{/repo}",
				"subscriptions_url": "https://api.github.com/users/pedr/subscriptions",
				"organizations_url": "https://api.github.com/users/pedr/orgs",
				"repos_url": "https://api.github.com/users/pedr/repos",
				"events_url": "https://api.github.com/users/pedr/events{/privacy}",
				"received_events_url": "https://api.github.com/users/pedr/received_events",
				"type": "User",
				"user_view_type": "public",
				"site_admin": false
			},
			"created_at": "2023-02-13T12:10:09Z",
			"updated_at": "2023-02-13T12:10:09Z",
			"author_association": "COLLABORATOR",
			"body": "I guess in this case would have been better if I had refactored the onPaste function instead of just complying with the existing code, do you think I should still do this on this PR?",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1427835614/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/1427852547",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1427852547",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1427852547,
			"node_id": "IC_kwDOBLftOs5VG00D",
			"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": "2023-02-13T12:22:37Z",
			"updated_at": "2023-02-13T12:22:37Z",
			"author_association": "OWNER",
			"body": "We can't leave it as it is in this pull request, because now there two onPaste functions:\r\n\r\nHere: https://github.com/laurent22/joplin/blob/fb977013788f3b287f2a547402500d9e98f71c4f/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx#L1056\r\n\r\nAnd here: https://github.com/laurent22/joplin/blob/fb977013788f3b287f2a547402500d9e98f71c4f/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx#L200\r\n\r\nSo I don't know the details, but one of them has to go, and perhaps it indeed means refactoring something.",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1427852547/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/1428168713",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1428168713",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1428168713,
			"node_id": "IC_kwDOBLftOs5VICAJ",
			"user": {
				"login": "pedr",
				"id": 5051088,
				"node_id": "MDQ6VXNlcjUwNTEwODg=",
				"avatar_url": "https://avatars.githubusercontent.com/u/5051088?v=4",
				"gravatar_id": "",
				"url": "https://api.github.com/users/pedr",
				"html_url": "https://github.com/pedr",
				"followers_url": "https://api.github.com/users/pedr/followers",
				"following_url": "https://api.github.com/users/pedr/following{/other_user}",
				"gists_url": "https://api.github.com/users/pedr/gists{/gist_id}",
				"starred_url": "https://api.github.com/users/pedr/starred{/owner}{/repo}",
				"subscriptions_url": "https://api.github.com/users/pedr/subscriptions",
				"organizations_url": "https://api.github.com/users/pedr/orgs",
				"repos_url": "https://api.github.com/users/pedr/repos",
				"events_url": "https://api.github.com/users/pedr/events{/privacy}",
				"received_events_url": "https://api.github.com/users/pedr/received_events",
				"type": "User",
				"user_view_type": "public",
				"site_admin": false
			},
			"created_at": "2023-02-13T15:44:50Z",
			"updated_at": "2023-02-13T15:51:34Z",
			"author_association": "COLLABORATOR",
			"body": "@laurent22\r\nI removed the duplicated function and made changes to enable the Paste as Text option in the right-click. \r\n\r\nTo be able to Paste as Text from the context menu I added a new property to the ContextMenuOptions that sends an event to the text editor (so I made changes in other files that use this type too).\r\nhttps://github.com/laurent22/joplin/blob/1c200c3b66fda0e1729a3c2da1f370efe7c76ae9/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.ts#L68-L83\r\n\r\nI also added a new event handler to the editor called `pasteAsText` because I couldn't find a way to create the `editor.fire('paste')` with a clipboard event (I think it might not be possible). The new event is just a proxy for calling `onPaste` with the `createSyntheticClipboardEventWithoutHTML` as an argument and calling `onChangeHandler` afterward.\r\n\r\nhttps://github.com/laurent22/joplin/blob/1c200c3b66fda0e1729a3c2da1f370efe7c76ae9/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx#L1085-L1096\r\n\r\nI don't understand why, but without `onChangeHandler` each time \"Paste as text\" option was called from the Context Menu, it would be triggered 3 more times in the next call, like if we were adding a new event handler without removing the old ones.\r\n\r\nIf you think the implementation is a little confusing I can revert the last commit.",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1428168713/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/1428256017",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1428256017",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1428256017,
			"node_id": "IC_kwDOBLftOs5VIXUR",
			"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": "2023-02-13T16:35:30Z",
			"updated_at": "2023-02-13T16:35:30Z",
			"author_association": "OWNER",
			"body": "@pedr, just to keep thing clearer, could you keep your context menu changes but put them in a separate pull request please? I think your other changes are good to merge, and we can deal with the rest in a separate PR",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1428256017/reactions",
				"total_count": 1,
				"+1": 1,
				"-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/1428464148",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1428464148",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1428464148,
			"node_id": "IC_kwDOBLftOs5VJKIU",
			"user": {
				"login": "pedr",
				"id": 5051088,
				"node_id": "MDQ6VXNlcjUwNTEwODg=",
				"avatar_url": "https://avatars.githubusercontent.com/u/5051088?v=4",
				"gravatar_id": "",
				"url": "https://api.github.com/users/pedr",
				"html_url": "https://github.com/pedr",
				"followers_url": "https://api.github.com/users/pedr/followers",
				"following_url": "https://api.github.com/users/pedr/following{/other_user}",
				"gists_url": "https://api.github.com/users/pedr/gists{/gist_id}",
				"starred_url": "https://api.github.com/users/pedr/starred{/owner}{/repo}",
				"subscriptions_url": "https://api.github.com/users/pedr/subscriptions",
				"organizations_url": "https://api.github.com/users/pedr/orgs",
				"repos_url": "https://api.github.com/users/pedr/repos",
				"events_url": "https://api.github.com/users/pedr/events{/privacy}",
				"received_events_url": "https://api.github.com/users/pedr/received_events",
				"type": "User",
				"user_view_type": "public",
				"site_admin": false
			},
			"created_at": "2023-02-13T18:38:50Z",
			"updated_at": "2023-02-13T18:38:50Z",
			"author_association": "COLLABORATOR",
			"body": "I'm sorry, Laurent, I end up changing the code again. When I was doing some tests with the Context Menu implementation I realized that instead of moving the `onPaste` function outside of the `useEffect` I could just call the fire event from the editor.\r\n\r\nhttps://github.com/laurent22/joplin/blob/5877a77c4e6df97a4146bbfd50cb1273d3f96329/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx#L273\r\n\r\nhttps://github.com/laurent22/joplin/blob/5877a77c4e6df97a4146bbfd50cb1273d3f96329/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx#L1083-L1087\r\n\r\nhttps://github.com/laurent22/joplin/blob/5877a77c4e6df97a4146bbfd50cb1273d3f96329/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.tsx#L1092\r\n\r\nI think this is a improvement over the last version since:\r\n- it doesn't lose the git history of the `onPaste` which could be helpful in a future refactor of this function\r\n- it brings code that is similar closer together\r\n- makes it simpler since we don't have to wrap functions over useCallback\r\n\r\nI also fixed the hotkey for paste as text in macos:\r\nhttps://github.com/laurent22/joplin/blob/5877a77c4e6df97a4146bbfd50cb1273d3f96329/packages/lib/services/KeymapService.ts#L26",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1428464148/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/1428514939",
			"html_url": "https://github.com/laurent22/joplin/pull/7751#issuecomment-1428514939",
			"issue_url": "https://api.github.com/repos/laurent22/joplin/issues/7751",
			"id": 1428514939,
			"node_id": "IC_kwDOBLftOs5VJWh7",
			"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": "2023-02-13T19:16:21Z",
			"updated_at": "2023-02-13T19:16:21Z",
			"author_association": "OWNER",
			"body": "It's a cleaner solution indeed, and more consistent with the rest of the code. It all looks good now so let's merge. Thanks @pedr!",
			"reactions": {
				"url": "https://api.github.com/repos/laurent22/joplin/issues/comments/1428514939/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
		}
	]
}