Skip to content

refactor: remove Alert and BlockquoteFigure extensions along with related styles and dependencies#307

Merged
xun082 merged 1 commit into
mainfrom
refactor/alert
Feb 11, 2026
Merged

refactor: remove Alert and BlockquoteFigure extensions along with related styles and dependencies#307
xun082 merged 1 commit into
mainfrom
refactor/alert

Conversation

@xun082

@xun082 xun082 commented Feb 11, 2026

Copy link
Copy Markdown
Owner

PR 描述

PR 类型

  • 🐛 Bug 修复
  • ✨ 新功能
  • 💄 UI/UX 改进
  • ♻️ 重构
  • 🚀 性能优化
  • 📝 文档更新
  • 🔄 其他

Issue 关联

Closes #

其他信息

@netlify

netlify Bot commented Feb 11, 2026

Copy link
Copy Markdown

Deploy Preview for ornate-blancmange-89db6b failed. Why did it fail? →

Name Link
🔨 Latest commit 22277a7
🔍 Latest deploy log https://app.netlify.com/projects/ornate-blancmange-89db6b/deploys/698c7cc88545d5000808bdff

@xun082 xun082 merged commit cbbd047 into main Feb 11, 2026
0 of 6 checks passed
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @xun082, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request streamlines the editor's functionality by removing unused or redundant extensions like Alert and BlockquoteFigure, thereby reducing the codebase and simplifying styling. Concurrently, it introduces significant enhancements to the user experience through automatic Markdown link conversion and improved clipboard handling for Markdown content. The stability of the editor's UI components, specifically the bubble menu, has also been bolstered to ensure a smoother editing workflow.

Highlights

  • Removed Alert and BlockquoteFigure Extensions: The Alert and BlockquoteFigure extensions, along with all their associated files, styles, and dependencies, have been completely removed from the application. This includes their definitions, components, CSS, and references in the extension kit and slash commands.
  • Enhanced Link Functionality: The Link extension now automatically converts Markdown link syntax [text](url) into a rich text link as the user types, improving the editing experience. It also ensures that parent Link extension plugins are properly retained.
  • Improved Markdown Clipboard Serialization: A new clipboardTextSerializer has been implemented in the MarkdownPaste extension, allowing content copied from the editor to be serialized into a comprehensive Markdown format, supporting various block and inline elements.
  • Stabilized Bubble Menu Selection: The CustomBubbleMenu component has been made more robust by adding try-catch blocks and boundary checks (clampedFrom, clampedTo) when calculating selection coordinates, preventing potential errors and improving stability.
  • Simplified Blockquote Styling: The CSS for blockquotes has been refactored to remove specific styles for the blockquoteFigure and apply more general, cleaner styles directly to the standard blockquote element.
Changelog
  • apps/DocFlow/package.json
    • Removed the '@syncflow/alert' dependency.
  • apps/DocFlow/src/components/menus/TextMenu/BubbleMenu.tsx
    • Added try-catch blocks and boundary checks to getBoundingClientRect for improved robustness.
  • apps/DocFlow/src/extensions/Alert/Alert.ts
    • Removed the Alert extension definition.
  • apps/DocFlow/src/extensions/Alert/AlertComponent.tsx
    • Removed the Alert React component.
  • apps/DocFlow/src/extensions/Alert/alert.css
    • Removed Alert-specific CSS styles.
  • apps/DocFlow/src/extensions/Alert/index.ts
    • Removed exports for the Alert extension.
  • apps/DocFlow/src/extensions/BlockquoteFigure/BlockquoteFigure.ts
    • Removed the BlockquoteFigure extension definition.
  • apps/DocFlow/src/extensions/BlockquoteFigure/Quote/Quote.ts
    • Removed the Quote extension definition.
  • apps/DocFlow/src/extensions/BlockquoteFigure/Quote/index.ts
    • Removed exports for the Quote extension.
  • apps/DocFlow/src/extensions/BlockquoteFigure/QuoteCaption/QuoteCaption.ts
    • Removed the QuoteCaption extension definition.
  • apps/DocFlow/src/extensions/BlockquoteFigure/QuoteCaption/index.ts
    • Removed exports for the QuoteCaption extension.
  • apps/DocFlow/src/extensions/BlockquoteFigure/index.ts
    • Removed exports for the BlockquoteFigure extension.
  • apps/DocFlow/src/extensions/Link/Link.ts
    • Added handleTextInput to automatically convert Markdown link syntax to rich text.
    • Preserved parent Link extension plugins.
  • apps/DocFlow/src/extensions/MarkdownPaste/MarkdownPaste.ts
    • Added clipboardTextSerializer to serialize editor content to Markdown.
    • Updated type import to include Mark.
  • apps/DocFlow/src/extensions/SlashCommand/groups.ts
    • Removed all Alert-related commands from the slash command groups.
    • Updated the blockquote command to use toggleBlockquote instead of setBlockquote.
  • apps/DocFlow/src/extensions/extension-kit.ts
    • Removed imports and usage of BlockquoteFigure and Alert extensions.
  • apps/DocFlow/src/extensions/index.ts
    • Removed exports for BlockquoteFigure, Quote, QuoteCaption, and Alert.
  • apps/DocFlow/src/styles/index.css
    • Removed the import for '@syncflow/alert/styles'.
  • apps/DocFlow/src/styles/partials/blocks.css
    • Refactored blockquote styles, removing blockquoteFigure specific rules and applying general styles to blockquote.
  • apps/DocFlow/src/styles/partials/placeholder.css
    • Removed the placeholder content for blockquote + figcaption.
  • pnpm-lock.yaml
    • Removed the dependency entry for '@syncflow/alert'.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

这个 PR 的主要目标是移除 AlertBlockquoteFigure 扩展,相关的依赖和样式也一并被清理,这使得代码库更加整洁。除此之外,PR 还引入了一些不错的新功能,比如 Markdown 格式链接的自动转换和复制内容为 Markdown 的能力,提升了编辑体验。代码整体质量很高。

为了让代码审查更高效、变更更原子化,建议未来将类似的大型重构和新功能开发拆分到不同的 PR 中提交。

Comment on lines 93 to 114
getBoundingClientRect: () => {
const start = view.coordsAtPos(from);
const end = view.coordsAtPos(to);

return {
top: Math.min(start.top, end.top),
bottom: Math.max(start.bottom, end.bottom),
left: Math.min(start.left, end.left),
right: Math.max(start.right, end.right),
width: Math.abs(end.right - start.left),
height: Math.abs(end.bottom - start.top),
x: Math.min(start.left, end.left),
y: Math.min(start.top, end.top),
};
try {
const docSize = state.doc.content.size;
const clampedFrom = Math.max(0, Math.min(from, docSize));
const clampedTo = Math.max(0, Math.min(to, docSize));
const start = view.coordsAtPos(clampedFrom);
const end = view.coordsAtPos(clampedTo);

return {
top: Math.min(start.top, end.top),
bottom: Math.max(start.bottom, end.bottom),
left: Math.min(start.left, end.left),
right: Math.max(start.right, end.right),
width: Math.abs(end.right - start.left),
height: Math.abs(end.bottom - start.top),
x: Math.min(start.left, end.left),
y: Math.min(start.top, end.top),
};
} catch {
return new DOMRect();
}
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

updateMenu 方法中,getBoundingClientRect 的实现(L93-L113)与 autoUpdate 中的实现(L172-L195)几乎完全相同。这种代码重复会增加维护成本,当需要修改此逻辑时,可能需要在两个地方进行同步修改。

建议将这部分重复的逻辑提取到一个独立的辅助函数中,然后在两个地方调用它,以提高代码的可维护性和复用性。

Comment on lines +570 to +572
case 'underline':
result = `<u>${result}</u>`;
break;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在将内容序列化为 Markdown 时,下划线(underline)格式被转换为了 HTML 的 <u> 标签。然而,<u> 并不是标准的 Markdown 语法,这可能导致在不支持 HTML 的 Markdown 渲染器中显示不正确。

建议直接将带下划线的文本作为普通文本处理,以保证更好的兼容性。如果确实需要保留此格式,可以考虑添加注释说明其目的。

Suggested change
case 'underline':
result = `<u>${result}</u>`;
break;
case 'underline':
// Underline is not a standard Markdown format, so it's serialized as plain text.
break;

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

Successfully merging this pull request may close these issues.

1 participant