Skip to content

[Feature Request]: Pasting Text into Affine Doesn't Auto-Format as Code Block #11858

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

Open
1 task
largedeer opened this issue Apr 21, 2025 · 2 comments
Open
1 task
Assignees
Labels
story Features perceivable by end-users

Comments

@largedeer
Copy link

Description

Description

When pasting plain text (e.g., code snippets) into Affine, the content remains in a standard Text Block instead of automatically converting to a Code Block format. This requires manual reformatting, reducing efficiency.

Steps to Reproduce

  1. Copy a code snippet (e.g., console.log("Hello")).
  2. Paste it into an Affine Text Block.
  3. Actual Result: The text retains default formatting (not a Code Block).
  4. Expected Result: Auto-detection as a Code Block (or an option to convert easily).

Original Format:
Image

After Copy to Affine:
Image

Use case

Proposed Solutions

  1. Auto-Detection: Detect code-like patterns (indentation, symbols like {}()) and prompt to convert to Code Block.
  2. Shortcut Support: Add Ctrl/Cmd + Shift + C to convert selected Text Blocks to Code Blocks.
  3. Right-Click Menu: Add a "Paste as Code" option during pasting.

Anything else?

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@largedeer largedeer added the story Features perceivable by end-users label Apr 21, 2025
@github-project-automation github-project-automation bot moved this to 🆕 *Untriaged in AFFiNE Project Apr 21, 2025
@affine-issue-bot
Copy link

Issue Status: 🆕 *Untriaged

*🆕 Untriaged

The team has not yet reviewed the issue. We usually do it within one business day.
Docs: https://github.com/toeverything/AFFiNE/blob/canary/docs/issue-triaging.md

This is an automatic reply by the bot.

@largedeer
Copy link
Author

Try the newer version 0.21.3, seems the issue got fixed.
However the property of the code block is not correct. The original code block(python) was converted to plane text after paste to AFFiNE.

Original Block

Image

After paste to AFFiNE

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
story Features perceivable by end-users
Projects
Status: 🆕 *Untriaged
Development

No branches or pull requests

2 participants