Skip to content

paste as plain text #1147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
lvmm opened this issue Oct 21, 2022 · 11 comments
Closed
2 tasks done

paste as plain text #1147

lvmm opened this issue Oct 21, 2022 · 11 comments

Comments

@lvmm
Copy link

lvmm commented Oct 21, 2022

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for a feature request that matches the one I want to file, without success.

Is your feature request related to a problem? Please describe.
When draw.io pastes text into a diagram it pastes it as formatted text (i.e. with font, colour, etc), which is often not what is required. When I paste text into the text block, I usually want its formatting to match that of the existing text or the current diagram style, not the source document.

Describe the solution you'd like
I'd like to have a 'paste as plain text' option and hotkey e.g. ctrl-shift-v

Describe alternatives you've considered
Pasting text into a third program to strip formatting and then copy-pasting it into draw.io.

@stale
Copy link

stale bot commented Apr 19, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. See the FAQ for more information.

@stale stale bot added the wontfix label Apr 19, 2023
@davidjgraph
Copy link
Contributor

Ctrl+Shift+V is paste without formatting.

@Hronom
Copy link

Hronom commented Mar 26, 2025

Please add an additional item in the right-click submenu to Paste as plain text e.g. like in Google Chrome browser.
Here is the screenshot:
Image

Right now there are only Paste item that is persisting formating:
Image

I'm very miss this menu. This is in addition to a hotkey combination.

@Hronom
Copy link

Hronom commented Mar 26, 2025

cc @davidjgraph please re-open this task. Really very needed, thanks!

For me personally it's a blocker for usage of drawio-desktop. (Yes I'm a mouse user)

@davidjgraph
Copy link
Contributor

We have tens of millions of users, a blocker for one user doesn't get issued re-opened. I'm not re-opening for 2 votes.

But realistically, it hasn't been looked at for 3 years, it's not going to happen in the next 3 either.

@Hronom
Copy link

Hronom commented Mar 26, 2025

@davidjgraph is it a big effort for a maintainer? I can try to take a look, but I'm not familiar with code base

@Hronom
Copy link

Hronom commented Mar 27, 2025

By using ChatGPT I added it locally in the next way electron.js:

// Configure context menu for text fields
contextMenu({
	showCopyImage: false,
	showLookUpSelection: false,
	showSearchWithGoogle: false,
	showCopyLink: false,
	append: (defaultActions, params, browserWindow) => [
		{
			label: 'Paste as plain text',
			// Only show this item when there's a text in the clipboard
			visible: clipboard.availableFormats().includes('text/plain'),
			click: () => {
				// Execute the paste command in the focused window
				browserWindow.webContents.pasteAndMatchStyle();
			}
		}
	]
});

Checked locally and it seems like it works as expected:
Image

However I don't like that it's added at the bottom of a menu, I expect to have it right after Paste item.
After reading README.md of electron-context-menu it seems like there is no nice way to add it right after Paste item without modification menu that is not recommended here.

I decided to ask the maintainers of electron-context-menu to add a parameter that can help to enable it without menu modification. Created ticket here sindresorhus/electron-context-menu#193

I don't know an Electron framework as the same as JavaScript, so for me it seems like we need to wait devs of electron-context-menu to introduce something like showPasteAndMatchStyle option, so we can use it and follow recommended approach.

@davidjgraph
Copy link
Contributor

davidjgraph commented Mar 27, 2025

You're not understanding the point, we're not going to add a menu option because two people have asked for it. That's not how a large software project runs. We'd end up with hundreds of items in the context menu.

@Hronom
Copy link

Hronom commented Mar 27, 2025

@davidjgraph yes your statement is correct, but I'm not asking for a complete new feature. What I pointed out in this project as drawio-desktop miss feature parity with a web version of drawio. Others people probably just fallback to the web version(like I do).

That's not how a large software project runs. We'd end up with hundreds of items in the context menu.

Please don't be broad, Paste as plain text a pretty standard item in a right-click context menu.
Google Chrome and Mozilla Firefox have it(check my screenshots). I believe the user base of Google Chrome and Mozilla Firefox much more then drawio-desktop application and this browsers doesn't have a concern about this menu item.

So if we do not go broad and be specific to the ask - then we clearly see that Paste as plain text is a standard item available in modern browsers and other desktop applications like LibreOffice.

I really like draw.io and drawio-desktop a lot, so I wanna see drawio-desktop to be a good tool and make it support all capabilities that have a browser version as same as good platform integration with a system.

@davidjgraph davidjgraph reopened this Mar 27, 2025
@davidjgraph
Copy link
Contributor

Fair point, but I can't take openAI code, it's not production quality.

@Hronom
Copy link

Hronom commented Mar 27, 2025

@davidjgraph as an alternative we can wait for this ticket and then add it in drawio-desktop without dramatic changes in the code. (Please put like on that ticket).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants