[PR #2464] [MERGED] Support code block #5245

Closed
opened 2026-03-23 22:17:53 +00:00 by mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/AppFlowy-IO/AppFlowy/pull/2464
Author: @qinluhe
Created: 5/5/2023
Status: Merged
Merged: 5/10/2023
Merged by: @qinluhe

Base: developHead: feat/code-block


📝 Commits (1)

📊 Changes

29 files changed (+893 additions, -400 deletions)

View changed files

📝 frontend/appflowy_tauri/package.json (+2 -0)
📝 frontend/appflowy_tauri/pnpm-lock.yaml (+13 -0)
📝 frontend/appflowy_tauri/src/appflowy_app/components/document/BlockSelection/BlockSelection.hooks.tsx (+7 -9)
📝 frontend/appflowy_tauri/src/appflowy_app/components/document/CalloutBlock/CalloutBlock.hooks.ts (+0 -1)
frontend/appflowy_tauri/src/appflowy_app/components/document/CodeBlock/CodeBlock.hooks.ts (+88 -0)
frontend/appflowy_tauri/src/appflowy_app/components/document/CodeBlock/SelectLanguage.tsx (+44 -0)
frontend/appflowy_tauri/src/appflowy_app/components/document/CodeBlock/elements.tsx (+43 -0)
📝 frontend/appflowy_tauri/src/appflowy_app/components/document/CodeBlock/index.tsx (+38 -2)
📝 frontend/appflowy_tauri/src/appflowy_app/components/document/DocumentTitle/index.tsx (+1 -1)
📝 frontend/appflowy_tauri/src/appflowy_app/components/document/Node/index.tsx (+12 -5)
📝 frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/TextBlock.hooks.ts (+3 -20)
frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/events/Actions.hooks.ts (+0 -75)
📝 frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/events/Events.hooks.ts (+56 -66)
📝 frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/events/TurnIntoEvents.hooks.ts (+13 -3)
📝 frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/index.tsx (+2 -2)
📝 frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/Text/TextInput.hooks.ts (+44 -52)
frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/Text/useTextEvents.ts (+103 -0)
frontend/appflowy_tauri/src/appflowy_app/constants/document/code.ts (+92 -0)
📝 frontend/appflowy_tauri/src/appflowy_app/constants/document/config.ts (+4 -0)
📝 frontend/appflowy_tauri/src/appflowy_app/constants/document/text_block.ts (+1 -0)

...and 9 more files

📄 Description

This branch is based on https://github.com/AppFlowy-IO/AppFlowy/pull/2457

Feature Preview

  • Support turn into code block via ```
  • Support change language for the code block
  • Support turn to TextBlock when pressing Backspace
  • Support multiple languages
  • Support indent and outdent
image

PR Checklist

  • My code adheres to the AppFlowy Style Guide
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/AppFlowy-IO/AppFlowy/pull/2464 **Author:** [@qinluhe](https://github.com/qinluhe) **Created:** 5/5/2023 **Status:** ✅ Merged **Merged:** 5/10/2023 **Merged by:** [@qinluhe](https://github.com/qinluhe) **Base:** `develop` ← **Head:** `feat/code-block` --- ### 📝 Commits (1) - [`224e5c2`](https://github.com/AppFlowy-IO/AppFlowy/commit/224e5c23fbe72313a806b52a3df01d81635e3aec) feat: support code block ### 📊 Changes **29 files changed** (+893 additions, -400 deletions) <details> <summary>View changed files</summary> 📝 `frontend/appflowy_tauri/package.json` (+2 -0) 📝 `frontend/appflowy_tauri/pnpm-lock.yaml` (+13 -0) 📝 `frontend/appflowy_tauri/src/appflowy_app/components/document/BlockSelection/BlockSelection.hooks.tsx` (+7 -9) 📝 `frontend/appflowy_tauri/src/appflowy_app/components/document/CalloutBlock/CalloutBlock.hooks.ts` (+0 -1) ➕ `frontend/appflowy_tauri/src/appflowy_app/components/document/CodeBlock/CodeBlock.hooks.ts` (+88 -0) ➕ `frontend/appflowy_tauri/src/appflowy_app/components/document/CodeBlock/SelectLanguage.tsx` (+44 -0) ➕ `frontend/appflowy_tauri/src/appflowy_app/components/document/CodeBlock/elements.tsx` (+43 -0) 📝 `frontend/appflowy_tauri/src/appflowy_app/components/document/CodeBlock/index.tsx` (+38 -2) 📝 `frontend/appflowy_tauri/src/appflowy_app/components/document/DocumentTitle/index.tsx` (+1 -1) 📝 `frontend/appflowy_tauri/src/appflowy_app/components/document/Node/index.tsx` (+12 -5) 📝 `frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/TextBlock.hooks.ts` (+3 -20) ➖ `frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/events/Actions.hooks.ts` (+0 -75) 📝 `frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/events/Events.hooks.ts` (+56 -66) 📝 `frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/events/TurnIntoEvents.hooks.ts` (+13 -3) 📝 `frontend/appflowy_tauri/src/appflowy_app/components/document/TextBlock/index.tsx` (+2 -2) 📝 `frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/Text/TextInput.hooks.ts` (+44 -52) ➕ `frontend/appflowy_tauri/src/appflowy_app/components/document/_shared/Text/useTextEvents.ts` (+103 -0) ➕ `frontend/appflowy_tauri/src/appflowy_app/constants/document/code.ts` (+92 -0) 📝 `frontend/appflowy_tauri/src/appflowy_app/constants/document/config.ts` (+4 -0) 📝 `frontend/appflowy_tauri/src/appflowy_app/constants/document/text_block.ts` (+1 -0) _...and 9 more files_ </details> ### 📄 Description <!--- Thank you for submitting a pull request to AppFlowy. The team will dedicate their best efforts to reviewing and approving your pull request. If you have any questions about the project or feedback for us, please join our [Discord](https://discord.gg/wdjWUXXhtw). --> This branch is based on https://github.com/AppFlowy-IO/AppFlowy/pull/2457 <!--- If your pull request adds a new feature, please drag and drop a video into this section to showcase what you've done! If not, you may delete this section. --> ### Feature Preview - [x] Support turn into code block via ` ``` ` - [x] Support change language for the code block - [x] Support turn to TextBlock when pressing `Backspace` - [x] Support multiple languages - [x] Support `indent` and `outdent` <img width="831" alt="image" src="https://user-images.githubusercontent.com/108015703/236519659-7b18b082-bab6-4f9f-945d-20aa27a1ec1f.png"> <!--- List at least one issue here that this PR addresses. If it fixes the issue, please use the [fixes](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests) keyword to close the issue. For example: fixes https://github.com/AppFlowy-IO/AppFlowy/pull/2106 --> --- <!--- Before you mark this PR ready for review, run through this checklist! --> #### PR Checklist - [ ] My code adheres to the [AppFlowy Style Guide](https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/software-contributions/submitting-code/style-guides) - [ ] I've listed at least one issue that this PR fixes in the description above. - [ ] I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes. - [ ] All existing tests are passing. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
mirror 2026-03-23 22:17:53 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AppFlowy-IO/AppFlowy#5245
No description provided.