anytype-heart icon indicating copy to clipboard operation
anytype-heart copied to clipboard

Paste without formatting, without resetting text style

Open rly opened this issue 9 months ago • 1 comments

Have you read a contributing guide?

  • [x] I have read CONTRIBUTING.md
  • [x] I have searched the existing requests and didn't find any that were similar
  • [x] I have considered creating a pull request instead and want to proceed

Clear and concise description of the problem

Thank you for creating AnyType!

In the editor, if I have an empty Block with a particular style, e.g., Bulleted List or Title, and I paste without formatting (cmd-shift-v on mac), then the Block transforms into a Text styled block and the text is pasted. This is different behavior from every other editor I have used (MS Word, Google Docs, Notion, GitHub) where the pasted text adopts the current styling of the block.

Suggested solution

Like those other systems, I think AnyType should not change the style of the current Block to Text when pasting without formatting.

Alternative

No response

Additional context

Here is a screen capture of that behavior. Pasting without formatting into a non-empty Block is OK. All pastes were done with cmd-shift-v to remove formatting.

https://github.com/user-attachments/assets/f6385cca-51ea-47be-9ce6-122cdd1a2a00

rly avatar Mar 05 '25 22:03 rly

I suspect this is where the behavior is determined: https://github.com/anyproto/anytype-heart/blob/7001a695b1729fd2b430b82417227ffd1db2f5fc/core/block/editor/clipboard/paste.go#L135-L144

If changing this behavior makes sense, I am happy to take a stab at it.

rly avatar Mar 05 '25 22:03 rly