Skip to content

feat(toolbar): add one-click clear format button with separate Tx icon#144

Open
lihehe11 wants to merge 1 commit into
floatboatai:mainfrom
lihehe11:feature/add-clear-format-btn
Open

feat(toolbar): add one-click clear format button with separate Tx icon#144
lihehe11 wants to merge 1 commit into
floatboatai:mainfrom
lihehe11:feature/add-clear-format-btn

Conversation

@lihehe11

@lihehe11 lihehe11 commented Jul 9, 2026

Copy link
Copy Markdown

Summary / 摘要

为编辑器工具栏新增一键清除文本格式按钮,剥离选中内容所有Markdown富文本样式,使用独立 T× 图标区分功能。

Changes / 修改内容

  1. packages/plugin-toolbar/src/icons.ts:新增 iconClearFormat 工具图标,显示 T×
  2. packages/plugin-toolbar/src/formatting.ts:实现 clearAllFormat 函数,通过原生接口剔除 * _ ` # 等格式标记
  3. packages/plugin-toolbar/src/toolbar-ui.ts:在文字颜色分组末尾新增清除格式按钮,UI风格与现有组件统一

Test / 自测验证

  1. 混合格式文本:**加粗** _斜体_ ==高亮== 选中后一键清除样式
  2. 单行彩色 span 标签文本,可正常剥离样式标记
  3. 空选区、多行混合文本均无运行报错

Screenshot / 效果截图

点击前带完整格式文本 点击清除后纯文本效果 点击前带完整格式文本 点击清除后纯文本效果
  1. 第一张:点击清除按钮前,完整保留颜色、加粗等富文本样式;
  2. 第二张:点击 T× 清除按钮后,所有格式标记剥离,仅保留纯文字内容。

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

2 participants