Commit Graph

67 Commits (d6489283b854adab76e1779fd85c9478f493f79e)

Author SHA1 Message Date
Ryan Wang 1852784a4c
chore: bump vue version to 3.5.11 (#6764)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

Bump vue version to [3.5.11](https://github.com/vuejs/core/blob/main/CHANGELOG.md#3511-2024-10-03)

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-10-04 12:22:43 +00:00
Ryan Wang fd40770ebc
chore: bump vue version to 3.5 (#6696)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.20.x

#### What this PR does / why we need it:

升级 UI 项目的 Vue 版本至 3.5.x。

#### Does this PR introduce a user-facing change?

```release-note
升级 UI 项目的 Vue 版本至 3.5.x。
```
2024-09-26 08:11:31 +00:00
Ryan Wang 46793af0bd
fix: correct ordered list styling issue in editor (#6656)
#### What type of PR is this?

/area ui
/kind bug
/milestone 2.20.x

#### What this PR does / why we need it:

修复编辑器中有序列表的样式问题。

#### Which issue(s) this PR fixes:

Fixes #6615 

#### Does this PR introduce a user-facing change?

```release-note
修复编辑器中有序列表的样式问题。
```
2024-09-13 09:40:26 +00:00
John Niang 7281a48325
Prepare for developing 2.20.0 (#6575)
#### What type of PR is this?

/kind cleanup
/area core

#### What this PR does / why we need it:

This PR bumps all version to 2.20.0 to prepare for next development.

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-09-02 09:41:37 +00:00
Takagi 142f46b435
fix: solving the issue of the default editor format brush being incorectly filtered (#6566)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.19.x

#### What this PR does / why we need it:

为默认编辑器格式刷及清除格式扩展增加 name,用于解决其重名而导致被错误过滤的问题

Fixes #6562 

#### How to test it?

查看默认编辑中格式刷及清除格式功能是否存在且运行正常。

#### Does this PR introduce a user-facing change?
```release-note
解决默认编辑器格式刷及清除格式功能不存在的问题
```
2024-09-01 15:07:36 +00:00
Takagi 856d61537d
fix: resolve error when deleting images in default editor (#6551)
#### What type of PR is this?

/kind bug
/area editor
/area ui
/milestone 2.19.x

#### What this PR does / why we need it:

在上传的文件中执行 `resetUpload` 方法之前,提前验证是否可以进行更新。

#### How to test it?

测试删除图片或变更图片位置时,默认编辑器是否会进行报错。

#### Does this PR introduce a user-facing change?
```release-note
解决默认编辑器删除图片后报错的问题
```
2024-08-30 09:25:28 +00:00
Takagi 21db06a507
refactor: editor code block to be extensible by plugins (#6428)
#### What type of PR is this?

/kind improvement
/area editor
/area ui

#### What this PR does / why we need it:

此 PR 重构了默认编辑器中代码块的相关代码,使编辑器能够被插件扩展。这样做的优点是当用户使用例如 [highlightjs](https://github.com/halo-sigs/plugin-highlightjs) 这类的高亮插件时,可以保证在 Console 端选择的语言及主题可以在主题端完美适配。

具体做了以下几处重构:

1. 在默认编辑器的代码块中,不再提供高亮样式,代码块高亮将完全交由插件来适配。(但可以在默认的代码块中自定义输入语言,主题端自行处理)。
2. 为了防止出现重复的插件功能,将会根据插件优先级及加载顺序(后加载优先级高于先加载),对同类型且同名的插件进行过滤,只保留一个。
3. 重构代码块 `Select` 组件,使得选择语言或主题更加方便。
4. 为代码块提供主题的扩展设置项。

建议在此 PR 合并之后,由 Halo 默认提供一个高亮插件作为预设插件,这样可以用于解决原有功能升级之后丢失的问题。

<img width="1067" alt="image" src="https://github.com/user-attachments/assets/f9e2c5eb-a48a-4d2c-9fee-442e9d16ef19">

#### How to test it?

测试是否会改变已有代码块的语言等。
测试使用第三方插件之后,是否具有高亮。
设置高亮语言后,保存并刷新,查看高亮语言是否存在。主题同理。
查看主题端是否能够正常渲染。

#### Does this PR introduce a user-facing change?
```release-note
重构默认编辑器代码块使其能够被插件扩展。
```
2024-08-26 02:55:13 +00:00
Takagi d9bc8cfd03
chore: upgrade tiptap to 2.6.5 (#6503)
#### What type of PR is this?

/kind improvement
/area ui
/milestone 2.19.x

#### What this PR does / why we need it:

升级 tiptap 相关依赖至 [2.6.5](https://github.com/ueberdosis/tiptap/releases/tag/v2.6.5)

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-08-23 07:36:58 +00:00
Takagi 9b99698f1c
pref: use whitelist for allowed href values (#6499)
#### What type of PR is this?

/kind improvement
/area editor
/milestone 2.19.x

#### What this PR does / why we need it:

使用白名单校验替换原有的黑名单校验,解决 a 标签潜在的安全问题。

移除自定义的解决方案,使用 Tiptap 所提供的白名单方案。

#### How to test it?

测试 a 标签的 href 链接是否会受到 xss 的影响。

同时测试 #5479 的情况是否还会发生。即默认富文本编辑器中当链接为纯数字时是否还会报错。

#### Does this PR introduce a user-facing change?
```release-note
使用白名单校验 a 标签的 href 用于解决潜在的安全问题。
```
2024-08-23 04:46:57 +00:00
Ryan Wang a938712739
chore: bump vite-related dependencies (#6482)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.19.x

#### What this PR does / why we need it:

Bump vite-related dependencies

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-08-20 03:28:47 +00:00
Takagi 94f28cc76e
fix: backspace on empty line doesn’t return to previous list item (#6445)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.19.x

#### What this PR does / why we need it:

修复默认编辑器中,当在列表的下一空白行使用退格键时,会导致无法回退至列表项中的问题。

#### How to test it?

1. 在编辑器中增加一个列表项。
2. 按两次回车跳出列表编辑器。
3. 按退格键。

查看退格键是否按一次就可以回到列表项,并且再次按时执行列表项的删除。

#### Which issue(s) this PR fixes:

Fixes #6263

#### Does this PR introduce a user-facing change?
```release-note
解决默认编辑器中在空白行中按退格键无法回退到列表项中的问题
```
2024-08-08 08:22:38 +00:00
John Niang 5147d3efff
Prepare for developing 2.19.0 (#6429)
#### What type of PR is this?

/kind cleanup
/area core

#### What this PR does / why we need it:

This is a regular updates after a new release.

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-08-02 04:56:14 +00:00
Takagi 52feea8553
fix: solve the problem that highlighting will prevent the keys (#6387)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.18.x

#### What this PR does / why we need it:

此 PR 解决了使用高亮插件之后按 `up` 或 `down` 按键被阻止的问题。

此问题的来源为 https://github.com/halo-sigs/richtext-editor/pull/56 ,在此前的 PR 中为了解决设置字体大小后再次设置高亮,会导致高亮无法完全笼罩字体的问题。

但经过仔细排查,发现上述问题之前的解决方式有误,正确的原因应该是设置字体大小的 `span` 标签与设置高亮的 `mark` 标签顺序相反导致。如下所示:

<img width="1019" alt="image" src="https://github.com/user-attachments/assets/90c0926e-caab-40b6-91ae-97c075ef7225">

正确的情况应该是在 `span` 中包裹 `mark`。此 PR 提升了 `TextStyle` 的优先级,结果如下所示:

<img width="1022" alt="image" src="https://github.com/user-attachments/assets/e5e61d54-defd-493b-818c-c09faf55a7c1">

#### How to test it?

测试对文本使用高亮功能之后按 `up` 或 `down` 按键是否生效。
测试对在文本设置大小之后,使用高亮、删除线等样式是否正确。

#### Which issue(s) this PR fixes:

Fixes #6381 

#### Does this PR introduce a user-facing change?
```release-note
解决默认编辑器中对文本使用高亮会导致按键被阻止的问题
```
2024-07-29 12:57:54 +00:00
Takagi fae5bf7ce9
fix: list items require multiple backspace presses to delete (#6408)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.18.x

#### What this PR does / why we need it:

目前当编辑器中列表内容为空时,需要按退格键多次才能删除掉此列表内容。

本 PR 在执行单行删除逻辑之前,会检查列表是否处于活动状态,如果是则不再执行单行删除的逻辑。列表会执行 ListKeyMap 相关快捷键。

#### How to test it?

1. 在默认富文本键入一个列表。
2. 使用退格键删除这个列表。
3. 查看是否可以一次就删除。

#### Which issue(s) this PR fixes:

Fixes #6389 

#### Does this PR introduce a user-facing change?
```release-note
修复默认编辑器中列表项需要按多次退格键才可以删除的问题
```
2024-07-29 12:41:54 +00:00
Ryan Wang 2b32715184
refactor: remove padding style from editor column block (#6407)
#### What type of PR is this?

/area editor
/kind improvement
/milestone 2.18.x

#### What this PR does / why we need it:

移除编辑器 Column 的默认 padding 样式。

See https://github.com/halo-dev/halo/issues/6377#issue-2428912807

#### Which issue(s) this PR fixes:

Fixes #6377 

#### Does this PR introduce a user-facing change?

```release-note
移除编辑器分栏卡片的默认 padding 样式。
```
2024-07-29 10:15:53 +00:00
Ryan Wang 429b832ba8
chore: bump tiptap version to 2.5.7 (#6403)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.18.x

#### What this PR does / why we need it:

升级 tiptap 的相关依赖至 2.5.7。

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-07-29 10:11:53 +00:00
Takagi 59b3f460fb
feat: add the first line indent to the Tab shortcut key (#6388)
#### What type of PR is this?

/kind feature
/area editor

#### What this PR does / why we need it:

支持在默认编辑器中使用 Tab 键实现首行缩进的功能。

当光标处于文本首行时,按下 Tab 键会触发首行缩进。
在首行缩进的情况下或者选中一段文本,再次按下 Tab 键会触发整段缩进。

#### How to test it?

测试文本块及区域标题块首行按下 Tab 键是否可以正常触发首行缩进

#### Which issue(s) this PR fixes:

Fixes #6316 

#### Does this PR introduce a user-facing change?
```release-note
默认编辑器增加 Tab 快捷键首行缩进功能
```
2024-07-29 04:47:52 +00:00
Ryan Wang 3c6df3b03c
chore: bump tiptap version to 2.5.1 (#6327)
#### What type of PR is this?

/area ui
/area editor
/kind improvement
/milestone 2.18.x

#### What this PR does / why we need it:

升级 Tiptap 相关依赖至 [2.5.0](https://tiptap.dev/blog/release-notes/say-hello-to-tiptap-2-5-our-most-performant-editor-yet)


#### Does this PR introduce a user-facing change?

```release-note
升级 Tiptap 相关依赖至 [2.5.0](https://tiptap.dev/blog/release-notes/say-hello-to-tiptap-2-5-our-most-performant-editor-yet)
```
2024-07-16 09:35:27 +00:00
Takagi 0f01006606
fix: bubble menu not appearing when crossing lines in editor (#6268)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.18.x

#### What this PR does / why we need it:

在默认编辑器中,选中一个跨多个节点的 text 时,selection 会变为 RangeSelection,此时冒泡菜单将不会出现。

此 RP 将 RangeSelection 添加至 text 的冒泡菜单验证中,使得冒泡菜单可以出现。

#### How to test it?

测试跨行选中多个无序列表时,是否出现冒泡菜单。

#### Which issue(s) this PR fixes:

Fixes #6267 

#### Does this PR introduce a user-facing change?
```release-note
修复默认编辑器中跨行选择节点时冒泡菜单无法出现的问题
```
2024-07-05 10:29:07 +00:00
John Niang 284417ae8b
Prepare for developing 2.18.0 (#6259)
#### What type of PR is this?

/kind cleanup
/area core

#### What this PR does / why we need it:

This PR bumps Halo version into 2.18.0 for next development iteration.

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-07-04 02:36:31 +00:00
Takagi 0f6722a37e
pref: add the option to open a new window to the picture jump link (#6170)
#### What type of PR is this?

/kind improvement
/area editor
/milestone 2.17.x

#### What this PR does / why we need it:

为图片跳转链接增加在新窗口打开的选项。

#### How to test it?

测试新窗口打开是否正常可用。

#### Which issue(s) this PR fixes:

Fixes #6109 

#### Does this PR introduce a user-facing change?
```release-note
默认编辑器图片跳转链接支持配置新窗口打开
```
2024-06-27 10:04:54 +00:00
Ryan Wang 4d22bc3bbb
refactor: improve the content area width of the editor for low-resolution screens (#6175)
#### What type of PR is this?

/area ui
/area editor
/kind improvement
/milestone 2.17.x

#### What this PR does / why we need it:

优化文章编辑器内容区域在低分屏下的表现。

默认:

<img width="1898" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/bfca69e5-29cf-45d9-8757-0952fd2a129c">


小屏幕:

<img width="1043" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/88efbeed-fe0c-4b78-b435-f6352dbd8d27">


#### Which issue(s) this PR fixes:

Fixes https://github.com/halo-dev/halo/issues/6172

#### Special notes for your reviewer:

建议测试在各个屏幕下的表现。

#### Does this PR introduce a user-facing change?

```release-note
优化文章编辑器内容区域在低分屏下的表现。
```
2024-06-27 09:46:54 +00:00
Takagi ab14157def
pref: add folding function to code blocks (#6177)
#### What type of PR is this?

/kind improvement
/area editor
/milestone 2.17.x

#### What this PR does / why we need it:

为默认编辑器代码块增加折叠功能。

<img width="892" alt="image" src="https://github.com/halo-dev/halo/assets/31335418/8325cba9-08ce-4bd7-98b6-6bc28fe52daf">

#### How to test it?

测试折叠功能是否可用。
测试重新打开文章之后代码块是否仍旧处于折叠状态。

#### Which issue(s) this PR fixes:

Fixes #6166

#### Does this PR introduce a user-facing change?
```release-note
为默认编辑器代码块增加折叠功能
```
2024-06-27 09:42:54 +00:00
Takagi cc36ddaec5
pref: block-level content actively sets fakeSelection (#6162)
#### What type of PR is this?

/kind improvement
/area editor
/milestone 2.17.x

#### What this PR does / why we need it:

由于 RangeSelection 可能将一些并不想展示为模拟选中效果的节点进行了转换,因此将 RangeSelection 中模拟选中的效果,由默认的自动设置为 true,变为 false。

之后需要由节点自行设置 `fakeSelection: true` 后才会展示为模拟选中的效果,否则保持原本的选择样式。

#### How to test it?

测试使用 Mod-a 全选后,listItem 等节点是否会展示为模拟选中的效果。

#### Does this PR introduce a user-facing change?
```release-note
None
```
2024-06-27 07:14:55 +00:00
Takagi 73798e86c6
feat: add gap cursor for top-level block nodes in default editor (#6103)
#### What type of PR is this?

/kind feature
/area editor
/milestone 2.17.x

#### What this PR does / why we need it:

目前想对块级节点进行换行是一件比较困难的事情,尤其是两个相邻的块级节点之间的想插入额外的一行时更加困难。间隙光标可以解决这一问题。

为默认编辑器的顶级块节点(pos.depth = 1)增加间隙光标的功能。当 NodeType 属性 `allowGapCursor` 为 true 时,将会在目标节点上启用间隙光标的功能。间隙光标将可能出现在目标节点的左上方与右下方。

<img width="909" alt="image" src="https://github.com/halo-dev/halo/assets/31335418/fbbdc8fe-59c9-4ae3-a7c8-97a90607c785">

已知问题:
1. 对于 inlineContent 的节点,点击生成间隙光标时,光标会先出现在对应的内容上,会出现闪动的问题。
2. 在间隙光标上使用组合输入(例如中文输入)时,首个字母会被新增至新的一行。
3. CodeBlock 无法使用间隙光标(CodeBlock 自身问题,待适配)
~~4. 首行空文本无法被删除(与 Gap Cursor 问题无关,待适配  Paragraph)~~
~~5. 删除文本上方有可以添加间隙光标的块级节点时,无法触发间隙光标的 Backspace 事件(同 4,属于 Paragraph 适配问题)~~

目前已经启用此功能的节点:

- 表格
- 分栏卡片
- CodeBlock (无法生效)

#### How to test it?

测试间隙光标是否能够在表格与分栏卡片上出现。
测试间隙光标出现后,输入文本、使用快捷键等操作是否符合逻辑。
测试使用方向键调整间隙光标位置。

#### Does this PR introduce a user-facing change?
```release-note
为默认编辑器的块级节点增加间隙光标的功能。
```
2024-06-26 11:18:50 +00:00
Ryan Wang a93479dc34
chore: organize and fix imports (#6152)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.17.x

#### What this PR does / why we need it:

重新组织和固定 UI 部分代码的 imports 导入,防止后续因为 imports 的顺序造成不必要的 diff。

基于:https://github.com/halo-dev/halo/pull/6151

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-06-26 10:42:50 +00:00
Takagi 5aacd8a252
pref: editor iframe risk with src tag (#6150)
#### What type of PR is this?

/kind improvement
/area editor
/milestone 2.17.x

#### What this PR does / why we need it:

在用户设置 iframe 相关的 src 时,检测设置的链接是否符合白名单。如果不符合则不允许设置。

see https://github.com/ueberdosis/tiptap/pull/5160

#### How to test it?

测试在 iframe 中的 src 输入 `javascript: alert("1")` 时是否会触发 javascript

#### Does this PR introduce a user-facing change?
```release-note
处理默认编辑器中 iframe 标签的 src 属性可能存在的风险
```
2024-06-26 10:24:50 +00:00
Takagi ba2987b585
feat: range selection feature to default editor (#6117)
#### What type of PR is this?

/kind feature
/area editor
/milestone 2.17.x

#### What this PR does / why we need it:

为默认编辑器添加 `RangeSelection` 选择器。

<img width="989" alt="image" src="https://github.com/halo-dev/halo/assets/31335418/c976cf99-0d6e-4346-9b05-8b9b0dc95183">


它的功能基本与 TextSelection 相反,例如:

1. TextSelection 支持光标展示,RangeSelection 不允许空内容,即它并不支持光标。
2. TextSelection 会抛弃被选择的 Node 节点部分偏移量,而 RangeSelection 会扩展偏移量至 Node 节点结束。
3. TextSelection 支持 Text 而 RangeSelection 支持 Node 节点。

`RangeSelection` 可以用于范围选中块节点并进行操作,可用于全选内容并进行删除操作。

#### How to test it?

测试使用点击,拖拽,释放鼠标的操作,能否选中某些节点。
测试删除选中的节点。

#### Which issue(s) this PR fixes:

Fixes #5194

#### Does this PR introduce a user-facing change?
```release-note
为默认编辑器添加 RangeSelection 选择器
```
2024-06-26 06:14:50 +00:00
Takagi c1ba566e08
fix: autosave content feature not working (#6147)
#### What type of PR is this?

/kind bug
/area ui
/milestone 2.17.x

#### What this PR does / why we need it:

解决自动保存失效的问题

#### How to test it?

测试文章、页面输入内容后,点击其他页面是否能够自动保存。

#### Which issue(s) this PR fixes:

Fixes #6129 

#### Does this PR introduce a user-facing change?
```release-note
解决文章自动保存失效的问题
```
2024-06-26 06:10:49 +00:00
Takagi c956533160
pref: default code block indentation from Tab to 2 Spaces in editor (#6090)
#### What type of PR is this?

/kind improvement
/area editor
/milestone 2.17.x

#### What this PR does / why we need it:

将默认编辑器中代码块的缩进由一个制表符(\t),更改为两个空格` {2}`。

#### How to test it?

测试使用 `Tab` 即 `Shift + Tab` 缩进时,是否每次缩进两个空格而不是一个制表符。

#### Does this PR introduce a user-facing change?
```release-note
优化默认编辑器代码块缩进为两个空格。
```
2024-06-18 06:02:53 +00:00
Takagi 1e37768b35
pref: improve code block styling in editor (#6089)
#### What type of PR is this?

/kind improvement
/area editor

#### What this PR does / why we need it:

优化编辑器代码块样式。

before:

<img width="907" alt="image" src="https://github.com/halo-dev/halo/assets/31335418/11ad91a9-75ce-42ec-a947-effca7b42f30">

after:

<img width="932" alt="image" src="https://github.com/halo-dev/halo/assets/31335418/d0b3275b-a269-4104-aea8-0d8726ce32e7">

#### How to test it?

测试复制功能是否正常。

#### Does this PR introduce a user-facing change?
```release-note
优化默认编辑器代码块样式
```
2024-06-18 06:00:52 +00:00
Takagi 10f3157258
fix: ensure pasted content auto-generates title id (#6059)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.17.x

#### What this PR does / why we need it:

当前在编辑器中粘贴内容后,如果不修改任意标题或新增标题,则无法为当前标题自动生成标题 ID,进而导致锚点失效。

本 PR 将在编辑器触发内容更改后,如果是粘贴的内容,则直接触发生成标题 ID。

#### How to test it?

新建一篇文章并粘贴一段带标题的内容后直接发布。

查看发布后的文章是否可以在主题端使用锚点跳转。

#### Which issue(s) this PR fixes:

Fixes #6056 

#### Does this PR introduce a user-facing change?
```release-note
解决在默认编辑器中粘贴的内容无法生成标题 ID 的问题
```
2024-06-17 13:48:50 +00:00
John Niang 1821829f99
Prepare for developing 2.17.0 (#6032)
#### What type of PR is this?

/kind cleanup
/area core

#### What this PR does / why we need it:

This is a regular update after a release.

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-06-03 09:53:44 +00:00
Ryan Wang ce5757ae10
chore: bump up vue-related version (#5965)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.16.x

#### What this PR does / why we need it:

升级 Vue 生态的相关依赖,以及修复编译 packages 时的异常日志问题。

#### Does this PR introduce a user-facing change?

```release-note
升级 Vue 生态的相关依赖至最新版本。
```
2024-05-22 12:42:47 +00:00
Takagi d29da319e7
fix: deleting selected text in a list with the backspace key causes the list to revert (#5938)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.16.x

#### What this PR does / why we need it:

移除使用 `Backspace` 进行缩进的功能。此功能会导致选中无序列表文本至起始位置时,按 `Backspace` 快捷键会导致无序列表解除当前层级。

#### How to test it?

测试从后往前选中无序列表文本至文本起始位置,然后按下 `Backspace` 快捷键。此时应当只删除文本而不会调整无序列表层级。

#### Which issue(s) this PR fixes:

Fixes #5925 

#### Does this PR introduce a user-facing change?
```release-note
修复默认编辑器中列表使用 Backspace 快捷键删除选中文本的错误行为
```
2024-05-22 02:12:45 +00:00
Takagi b762a9dac7
pref: optimize code block backspace shortcut key logic (#5936)
#### What type of PR is this?

/kind improvement
/area editor
/milestone 2.16.x

#### What this PR does / why we need it:

优化默认编辑器代码块 `Backspace` 快捷键逻辑。如下所示:

1. 选中内容时进行删除,保证光标仍处于代码块内。
2. 光标处于代码块首位或者代码块没有内容时,不再删除代码块。

#### How to test it?

测试默认编辑器代码块功能。查看是否符合上述逻辑

#### Which issue(s) this PR fixes:

Fixes #5927 

#### Does this PR introduce a user-facing change?
```release-note
优化默认编辑器代码块 Backspace 快捷键逻辑
```
2024-05-21 09:46:45 +00:00
Takagi c5d63b1a8f
fix: toolbar menu being obscured after overflowing (#5930)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.16.x

#### What this PR does / why we need it:

当工具栏菜单出现溢出时,由于 `justify-content` 会始终保持居中状态,因此会导致溢出的内容被遮挡。

考虑到 [justify-content:safe](https://developer.mozilla.org/zh-CN/docs/Web/CSS/justify-content#safe) 在 safari 上具有兼容性问题,因此修改 HTML 结构,使用 `text-align` 来使菜单居中。

#### How to test it?

测试在菜单栏溢出时,溢出的内容是否被遮挡。

#### Which issue(s) this PR fixes:

Fixes #5926 

#### Does this PR introduce a user-facing change?
```release-note
解决默认编辑器中顶部工具栏菜单溢出后被遮挡的问题
```
2024-05-20 08:54:42 +00:00
Ryan Wang fc10ffaeb2
chore: bump tiptap version to 2.4.0 (#5951)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.16.x

#### What this PR does / why we need it:

升级 Tiptap 依赖至 2.4.0,https://github.com/ueberdosis/tiptap/releases/tag/v2.4.0

#### Does this PR introduce a user-facing change?

```release-note
升级 Tiptap 依赖至 [2.4.0](https://github.com/ueberdosis/tiptap/releases/tag/v2.4.0)
```
2024-05-20 04:54:41 +00:00
Takagi 607898b172
fix: incorrect column width calculation after merging cells in the table (#5803)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.16.x

#### What this PR does / why we need it:

默认编辑器中的表格**首行被合并单元格**之后,将会出现当前表在刷新之后宽度被重置为默认。此 PR 改正了计算宽度,使其首次刷新时,也能返回正确的数组。

#### How to test it?

1. 将表格首行使用合并单元格之后,改变表格宽度。
2. 刷新表格,查看表格宽度是否不再变为默认宽度。

#### Which issue(s) this PR fixes:

Fixes #5767 

#### Does this PR introduce a user-facing change?
```release-note
解决默认编辑器中的表格首行合并单元格后会出现宽度重置的问题
```
2024-05-16 07:06:37 +00:00
Takagi 33e6c9e38d
fix: cursor misalignment when scrolling through the table (#5928)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.16.x

#### What this PR does / why we need it:

目前表格在监听到滚动时,会重新设置 `TextSelection` 用于阴影的显示。
本 PR 将设置 `TextSelection` 更改为重新执行一次 `Transaction` 。这样可以解决在滚动时光标错位的问题。

#### How to test it?

编写表格时,测试当编写内容出现滚动条时,是否会导致文本错位。
测试滚动表格时,光标位置是否会发生改变。

#### Which issue(s) this PR fixes:

Fixes #5924 

#### Does this PR introduce a user-facing change?
```release-note
解决默认编辑器中滚动表格时会导致光标变换的问题
```
2024-05-16 07:02:35 +00:00
Ryan Wang b47015a36d
chore: bump vite to 5.x (#5920)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.16.x

#### What this PR does / why we need it:

升级 Vite 至 5.x。

#### Does this PR introduce a user-facing change?

```release-note
升级 UI 部分的 Vite 版本至 5.x。
```
2024-05-16 06:18:36 +00:00
John Niang 7ea414dd6d
Prepare for developing 2.16.0 (#5856)
#### What type of PR is this?

/kind cleanup
/area core

#### What this PR does / why we need it:

This is a regular action after releasing a minor version.

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-05-05 01:37:33 +00:00
Ryan Wang d1d4705705
refactor: improve editor ui (#5828)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.15.x

#### What this PR does / why we need it:

优化编辑器的部分 UI。

1. 优化顶部工具栏的样式。
2. 统一格式刷和清除格式的图标。

before:

<img width="1001" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/4d3f2e9a-a79d-429e-aaa4-70313f61da6c">

after:

<img width="1021" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/676ce83b-da87-4c5b-bc63-1405106827f8">

#### Does this PR introduce a user-facing change?

```release-note
优化编辑器的部分 UI。
```
2024-04-29 07:59:34 +00:00
Takagi cb6836aa8c
feat: add tab shortcut function to the default editor table (#5784)
#### What type of PR is this?

/kind feature
/area editor

#### What this PR does / why we need it:

为默认编辑器表格增加 `Tab` 与 `Shift-Tab` 切换至上一个单元格或下一个单元格。具体功能如下:

1. 使用 Tab 快捷键从左向右切换至下一个单元格,当光标在最后一个单元格时,使用 Tab 键新建一行并跳转至新一行的第一个单元格。
2. 使用 Shift + Tab 快捷键从右向左来切换至上一个单元格。

#### How to test it?

测试在默认编辑器中 `Tab` 快捷键切换单元格是否生效。
测试在合并单元格等各种表格操作下,切换单元格是否生效。

#### Which issue(s) this PR fixes:

Fixes #5771 

#### Does this PR introduce a user-facing change?
```release-note
为默认编辑器表格增加 Tab 快捷键切换单元格的功能
```
2024-04-26 10:00:10 +00:00
Ryan Wang b05ed5814c
chore: bump tiptap version to 2.3.0 (#5655)
#### What type of PR is this?

/area ui
/kind improvement

#### What this PR does / why we need it:

升级 Tiptap 的版本为 2.3.0。

- https://github.com/ueberdosis/tiptap/releases/tag/v2.3.0
- https://github.com/ueberdosis/tiptap/releases/tag/v2.2.6
- https://github.com/ueberdosis/tiptap/releases/tag/v2.2.5
- https://github.com/ueberdosis/tiptap/releases/tag/v2.2.4

#### Does this PR introduce a user-facing change?

```release-note
升级 Tiptap 的版本为 2.3.0。
```
2024-04-18 09:40:07 +00:00
Takagi ac6896d0f3
pref: optimize the toolbar space and fold the same type of function (#5683)
#### What type of PR is this?

/kind improvement
/area editor
/milestone 2.15.x

#### What this PR does / why we need it:

本 PR 对富文本编辑器中工具栏和冒泡菜单进行精简。

- 对默认富文本冒泡菜单及顶部工具栏相同类型的功能进行了折叠。
- 删除在 text 的冒泡菜单中,不属于当前选中文本的功能,例如转换为代码块等,这些实际上是段落的功能,并非是文本的功能。而 textAlign 目前也仅仅用在标题和行上,因此也移除。

#### How to test it?

查看默认富文本编辑器工具栏中,折叠的功能是否正常。选中文本,查看文本中是否不包含段落相关的功能。

#### Which issue(s) this PR fixes:

Fixes #5669 

#### Does this PR introduce a user-facing change?
```release-note
对默认富文本编辑器中的工具栏进行折叠及精简优化。
```
2024-04-18 09:30:06 +00:00
Takagi fdc2453cc8
fix: code block content insertion location error (#5737)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.15.x

#### What this PR does / why we need it:

在编写多行文本后,粘贴代码块时,会出现粘贴的内容插入错误,其与代码块分割开。

[例如 #5736 中的示例所示](https://github.com/halo-dev/halo/assets/44745967/4b1ef8dc-60bf-47fd-b64d-23b0d6537d9e)

在本 PR 中,在创建 CodeBlock 时,将 Text 转为 `TextNode` 后,一同传入作为 `CodeBlock` 的 content。
另外为了保证插入代码块之后,光标处于代码块中,将会从插入位置的 from 开始往文档顶部搜索。

#### How to test it?

测试示例中的场景下,代码块插入是否正常。

测试在代码块前后放入其他代码块或者其他块,插入代码块后光标是否在代码块中。

#### Which issue(s) this PR fixes:

Fixes #5736 

#### Does this PR introduce a user-facing change?
```release-note
修复默认编辑器中粘贴代码块会出现错行的问题
```
2024-04-18 04:42:06 +00:00
Takagi 410a7557f9
feat: add the format brush extension to the default rich text editor (#5603)
#### What type of PR is this?

/kind feature
/area editor
/area ui

#### What this PR does / why we need it:

为默认富文本编辑器添加格式刷扩展。用以给 text node 复制格式。

使用方式:

1. 选中一串具有格式的文本
2. 点击格式刷或者使用 `Shift + Mod + c` 快捷键复制格式。
3. 选中需要进行格式处理的文本
4. 松开鼠标,格式刷生效。

#### How to test it?

测试格式刷功能是否正常可用。需要测试 text node 以及 block node 内部的 text 格式功能。

#### Which issue(s) this PR fixes:

Fixes #5591 

#### Does this PR introduce a user-facing change?
```release-note
为默认富文本编辑器添加格式刷扩展。
```
2024-04-18 04:26:07 +00:00
Takagi 0ba50b806e
pref: optimize the pop-up mode of toolbar submenu (#5682)
#### What type of PR is this?

/kind improvement
/area editor

#### What this PR does / why we need it:

优化默认富文本编辑器中,顶部工具栏子菜单的弹出方式,将原有的鼠标移入弹出改为点击左键弹出。并且为了显示效果,将会在具有子菜单的工具栏后方显示额外的下拉图标。

#### How to test it?

查看顶部工具栏子菜单弹出方式是否已改变。(插入组件未进行更改,仍旧保持原有鼠标移入弹出方式)

#### Which issue(s) this PR fixes:

Fixes #5668 

#### Does this PR introduce a user-facing change?
```release-note
优化默认富文本编辑器中顶部工具栏的子菜单弹出方式
```
2024-04-18 04:24:06 +00:00
Takagi 505f38a145
pref: optimize the rich text editor link paste logic (#5680)
#### What type of PR is this?

/kind improvement
/area editor
/area ui
/milestone 2.15.x

#### What this PR does / why we need it:

优化默认富文本编辑器中自动创建链接的逻辑。

- 移除了粘贴文本时,如果文本为链接则会自动转为链接的问题。
- 移除输入链接文本之后回车,会自动转化为链接的问题。
- 新增当选中的文本内容为链接时,点击链接按钮,将会自动转化选中的文本为链接。

#### How to test it?

在富文本编辑器中,测试如下场景:

1. 在浏览器地址栏复制一个链接,粘贴后不会再转为链接,而是一个普通文本。
2. 输入一段链接文本,按回车后是否不会再被转为链接。
3. 选中一段可以被解析为链接的地址,选中此地址,点击链接按钮,此地址是否会被默认转为链接。

#### Which issue(s) this PR fixes:

Fixes #5653 

#### Does this PR introduce a user-facing change?
```release-note
优化默认富文本编辑器中文本自动转为链接的相关逻辑
```
2024-04-13 00:50:08 +00:00