Commit Graph

235 Commits

Author SHA1 Message Date
Ryan Wang
760ba2347b Optimize editor styles (#7982)
* Refactor list toolbar items and unify icon sizing

* Replace MDI icons with Mingcute icons in editor extensions

* Replace MDI icons with Mingcute and other icon sets

* Unify button styles and icon sizing in editor UI

* Refactor editor icons and remove BlockCard component

* Refactor CommandsView menu styles and structure

* Add transition-colors to interactive UI components

* Refactor toolbar and toolbox item props typing

* Refactor BubbleItem props to use shared type

* Fix optional chaining for isActive prop in LinkBubbleButton

* Replace MDI icons with Mingcute icons in editor UI

* Refactor editor layout and styles for improved flexibility

* Refactor editor layout and update styles

* Replace icon set in CodeBlockViewRenderer

* Extend props types for toolbar, bubble, and toolbox items

* Refactor bubble components into subfolder

* Add BubbleButton component and update usage

* Refactor dropdown and toolbar item components

* Add image position dropdown to image bubble menu

* Refactor editor extension isActive checks to use class names

* Refactor gallery bubble items to use new UI components

* Refactor iframe align actions into dedicated component

* Refactor video position bubble to dropdown component

* Refactor input components and unify input UI

* Increase input container width from w-60 to w-64

* Refactor video size UI and update link popper widths

* Add audio position alignment to editor extension

* Refactor iframe and video size controls, update icons

* Add ResourceReplaceButton and refactor media replace UI

* Add configurable gap for gallery items

* Increase group size options to 10 in gallery

Expanded the selectable group size options in BubbleItemGroupSize.vue from 6 to 10, allowing users to choose larger group sizes for gallery items.

* Add danger type to cover delete dropdown item

* Add auto-focus to Input components in editor bubbles

* Add top margin to GalleryView node wrapper
2025-12-10 14:37:45 +08:00
Ryan Wang
ac449924e2 Add custom color input component to FormKit (#8003)
* Add custom color input component to FormKit

* Update ui/src/formkit/inputs/color/ColorInput.vue

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add aria-label to color input button for improved accessibility

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-10 14:37:03 +08:00
Takagi
9cee89c2fc fix: resolve the issue of not being able to drag after adding a figure caption (#7984)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.22.x

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

解决由于调整图片时多个位置同时修改 figure 而导致的报错问题。

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

Fixes #7980 

#### Does this PR introduce a user-facing change?
```release-note
解决在 figure 中添加 caption 后拖动图片报错的问题
```
2025-12-05 03:58:24 +00:00
Ryan Wang
15a1c6ee91 Bump vite to 8.0 (#7983)
Signed-off-by: Ryan Wang <i@ryanc.cc>
2025-12-04 18:58:29 +08:00
Takagi
a14d7b7b12 chore: export Fragment from pm package (#7985)
#### What type of PR is this?

/kind improvement
/area editor
/milestone 2.22.x

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

将 Fragment 包从 PM 包中导出,而不是 core 包,用于解决 https://github.com/halo-sigs/plugin-hybrid-edit-block/issues/24 的错误

#### How to test it?

测试使用插件 `plugin-hybrid-edit-block` 是否会报错的问题。

#### Does this PR introduce a user-facing change?
```release-note
None
```
2025-12-04 10:56:23 +00:00
Takagi
61637a21cd fix: resolve the issue of the video node-view-wrapper error (#7986)
#### What type of PR is this?

/kind bug
/area editor
/milestone 2.22.x

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

解决 video 缺少 node-view-wrapper 导入的问题。

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

Fixes #7981

#### Does this PR introduce a user-facing change?
```release-note
解决无法在编辑器中插入视频的问题
```
2025-12-04 10:54:22 +00:00
Ryan Wang
fca4c32519 Refactor dropdown component (#7978)
* Refactor dropdown components to use floating-vue directly

* Replace floating-vue with @halo-dev/components in editor

* Remove Dropdown.vue and update story usage

* Remove unused popper class and related styles

* Refactor gallery dropdowns to use VDropdownItem
2025-12-01 11:32:23 +08:00
Ryan Wang
488f9cc7c4 Make content fields required in post and content models (#7972)
#### What type of PR is this?

/area core
/kind improvement
/milestone 2.22.x

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

See #7967 

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

Fixes #7967 

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

```release-note
None
```
2025-12-01 02:39:37 +00:00
Ryan Wang
0883082699 Remove yjs dependency from editor package (#7971) 2025-11-28 15:52:40 +08:00
Ryan Wang
d39c371ad4 Fix incorrect type generation for the Dropdown component (#7974) 2025-11-28 14:32:40 +08:00
Ryan Wang
a204fbc86a Refactor editor package (#7968)
* Move extensions

Signed-off-by: Ryan Wang <i@ryanc.cc>

* Refactor editor extensions to use explicit naming

* Refactor attachment selector integration in editor

* Remove vue-demi from Vite external dependencies

* Add README for richtext-editor package

* Refactor attachment composable and update upload permissions

* Refactor editor i18n keys and move upload strings

* Refactor AllExtensions to ExtensionsKit and update usage

* Move heading id attribute to extension implementation

* Refactor i18n usage to use i18n.global.t

* Update README to reflect changes in editor extensions, replacing AllExtensions with ExtensionsKit

---------

Signed-off-by: Ryan Wang <i@ryanc.cc>
2025-11-28 13:02:34 +08:00
Ryan Wang
c25aadeb3e Update api-client package.json to use ES module format (#7966)
* Update api-client package.json to use ES module format

* Enhance api-client configuration by adding sideEffects flag and refactoring tsdown config for better output formats
2025-11-28 10:20:39 +08:00
Ryan Wang
08747dc59d Upgrade tiptap dependencies to v3.11.0 (#7969) 2025-11-27 14:08:07 +08:00
Takagi
558400f4a2 feat: add figure and caption support to editor (#7875)
#### What type of PR is this?

/kind feature
/area editor

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

添加 figure 功能至 editor 中。

当前会将 `figure` 应用至 `image`、`video`、`audio` 等。

由于 figure 的引入,image 等结构会有一定的变化,将由原先的行内元素转变为块级元素。

> 更新后,将兼容旧版本 image,打开编辑器后会自动将其转换为带有 `figure` 父节点的内容。

#### How to test it?

测试原有的 `image`、`video`、`audio`  等功能是否正常可用。
测试 `figure-caption` 是否正常可用。
测试历史数据是否正常渲染。

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

Fixes #5388

#### Does this PR introduce a user-facing change?
```release-note
为默认编辑器添加 Figure 功能并应用至图片、视频、音频
```
2025-11-26 07:27:21 +00:00
Ryan Wang
6f711fc0cb Upgrade dev dependencies versions (#7960)
#### What type of PR is this?

/area ui
/kind cleanup

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

Upgrade dev dependencies versions

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

```release-note
None
```
2025-11-23 06:03:11 +00:00
Ryan Wang
caf5ecd4cb Bump vue and related-deps version (#7949)
* Bump vue and related-deps version

Signed-off-by: Ryan Wang <i@ryanc.cc>

* Update @intlify/unplugin-vue-i18n to v11.0.1

---------

Signed-off-by: Ryan Wang <i@ryanc.cc>
2025-11-20 14:42:18 +08:00
Ryan Wang
8eb436b274 Add wrapper class to Dropdown component (#7947)
Introduces a 'dropdown-wrapper' class to the Dropdown component and sets its display to inline-block for improved layout control.
2025-11-19 15:55:58 +08:00
Ryan Wang
6e6ee580ec Bump storybook to 10 (#7946)
Signed-off-by: Ryan Wang <i@ryanc.cc>
2025-11-19 15:55:47 +08:00
Takagi
1d58ead011 feat: add gallery extension in editor (#7897)
#### What type of PR is this?

/kind feature
/area ui
/area editor

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

为编辑器增加画廊的扩展。

<img width="1908" height="960" alt="image" src="https://github.com/user-attachments/assets/7971cf83-9bf4-4330-ac2a-612ce0e3c9bf" />

#### How to test it?

在编辑器中测试画廊是否正常可用

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

Fixes #6307

#### Does this PR introduce a user-facing change?
```release-note
为编辑器新增画廊(图片集)功能
```
2025-11-18 10:20:57 +00:00
Ryan Wang
e446512565 Add route-based quick action support to dashboard (#7939)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.22.x

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

Introduces DashboardWidgetQuickActionRouteItem type to allow quick actions that navigate to routes instead of executing callbacks.

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

```release-note
None
```
2025-11-17 02:02:54 +00:00
Ryan Wang
dc030c8f16 Rename output files from rich-text-editor to index (#7940)
#### What type of PR is this?

/area ui
/kind cleanup
/milestone 2.22.x

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

Rename output files from rich-text-editor to index

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

```release-note
None
```
2025-11-17 02:00:55 +00:00
Ryan Wang
ac88ee70cb Rename @halo-dev/console-shared to @halo-dev/ui-shared (#7926)
#### What type of PR is this?

/area ui
/kind api-change
/milestone 2.22.x

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

See #7925 

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

Fixes #7925 

#### Special notes for your reviewer:

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

```release-note
将 `@halo-dev/console-shared` 重命名为 `@halo-dev/ui-shared`
```
2025-11-10 16:20:41 +00:00
Ryan Wang
fbc12cd8b2 Refactor component library prop types (#7911) 2025-11-06 15:57:13 +08:00
Ryan Wang
2d50736719 Expose dayjs in utils.date to allow users to call dayjs methods directly (#7906) 2025-11-06 12:24:20 +08:00
Ryan Wang
75f2a50da1 Bump rolldown-vite to 7.2.0 (#7905)
Signed-off-by: Ryan Wang <i@ryanc.cc>
2025-11-06 12:02:31 +08:00
Ryan Wang
ad3b5c0680 Refactor UUID generation to shared utils.id.uuid (#7898) 2025-11-05 11:13:35 +08:00
Ryan Wang
150db051f8 Replace lodash-es with es-toolkit across codebase (#7896) 2025-11-05 11:08:57 +08:00
Ryan Wang
fc475f6bf9 Add shared event bus for plugin config updates (#7895) 2025-11-04 22:08:45 +08:00
Takagi
3e4accf20f chore: upgrade Tiptap dependencies to v3.9.1 (#7888)
#### What this PR does / why we need it:

升级 Tiptap 版本至 3.9.1

#### Does this PR introduce a user-facing change?
```release-note
None
```
2025-10-30 08:38:18 +00:00
Takagi
0f8ef82d6f feat: refactor the drag function and add support for the drag menu (#7861)
#### What type of PR is this?

/kind feature
/area ui
/area editor

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

重构拖拽功能, 使用 Tiptap [extension-drag-handle-vue-3](https://github.com/ueberdosis/tiptap/tree/develop/packages/extension-drag-handle-vue-3)  代替原有的自定义方式。

并且,在此基础上,增加了添加至下一行及拖拽菜单的功能,且支持插件动态扩展拖拽菜单。

<img width="368" height="237" alt="image" src="https://github.com/user-attachments/assets/7f7be771-e549-446f-9f75-c289817965f6" />

对于插件开发者,尤其是编辑器开发者来说,此 PR 有如下变更:
1. 移除了原有的 `getDraggable` 方法,不再使用它,直接移除即可。
2. 新增了 `getDraggableMenuItems` 方法,用于扩展拖拽菜单。

扩展方式如下:
```ts
getDraggableMenuItems() {
  return {
    parentKey: CONVERT_TO_KEY,
    children: {
      items: [
        {
          priority: 10,
          icon: markRaw(MdiFormatParagraph),
          title: i18n.global.t("editor.common.heading.paragraph"),
          action: ({ editor }: { editor: Editor }) =>
            editor.chain().focus().setParagraph().run(),
        }
	]
  }
 }
}
```

#### Does this PR introduce a user-facing change?
```release-note
重构编辑器拖拽功能,并为其增加功能操作菜单。
```
2025-10-30 07:38:18 +00:00
Ryan Wang
382fbfcf37 Generate api client (#7885)
#### What type of PR is this?

/area ui
/milestone 2.22.x

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

1. Upgrade `openapi-generator` to `7.17.0`.
2. Regenerate the API client based on the latest changes from the `main` branch.

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

```release-note
None
```
2025-10-30 03:16:17 +00:00
Ryan Wang
6d577f7c4c Improve structure and JSDoc of shared package (#7881)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.22.x

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

Improve structure and JSDoc of `@halo-dev/console-shared` package

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

```release-note
None
```
2025-10-29 04:00:17 +00:00
Ryan Wang
8075cec7ef Remove deprecated FunctionalPage interface and hooks (#7879)
* Remove deprecated FunctionalPage interface and hooks

* Remove pages state export from shared index

The export for './states/pages' was removed from the shared package index, likely because it is no longer needed or has been deprecated.
2025-10-28 21:48:54 +08:00
Ryan Wang
714cdddf61 Refactor attachment handling to use AttachmentSimple (#7865)
#### What type of PR is this?

/area ui
/kind api-change
/kind cleanup
/milestone 2.22.x

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

Unified attachment data structures by introducing AttachmentSimple and updating AttachmentLike to support it. Refactored utility functions and editor components to use new conversion and extraction methods, simplifying attachment processing and improving type safety. Removed legacy AttachmentAttr and related code, ensuring consistent handling of attachments across image, audio, video, and link features.

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

```release-note
None
```
2025-10-27 13:12:17 +00:00
Ryan Wang
e53bfd4edb Refactor user and global info stores to shared package (#7858)
#### What type of PR is this?

/area ui
/kind feature
/milestone 2.22.x

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

This PR moves the `currentUser` and `globalInfo` stores to the `@halo-dev/console-shared` package, making them easily accessible for plugins.

In addition, it’s now possible for plugins to define their own global stores using Pinia.

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

```release-note
- 在 `@halo-dev/console-shared` 包中提供 `stores` 对象,包含 currentUser 和 globalInfo。
- 支持在插件的 UI 中使用 Pinia 定义全局 Store
```
2025-10-23 10:32:14 +00:00
Ryan Wang
cc4ba4a361 Refactor permission checks to use shared utils (#7853)
#### What type of PR is this?

/area ui
/kind feature
/milestone 2.22.x

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

This PR introduces a developer-friendly utility for checking UI permissions, which is also exposed for use by plugins.

Usage:

```ts
import { utils } from "@halo-dev/console-shared"

utils.permission.has(['any:permission'])
```

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

```release-note
在 `@halo-dev/console-shared` 包中提供 UI 权限检查工具
```
2025-10-23 09:44:13 +00:00
Ryan Wang
0c2ccc7e00 Add JSDoc comments to attachment and date utils (#7850)
Added detailed JSDoc comments and usage examples to methods in AttachmentUtils and DateUtils. This improves code readability and provides better context and guidance for developers using these utility functions.
2025-10-23 11:26:22 +08:00
Ryan Wang
c598ff6781 Update axios to version 1.12.2 (#7849)
#### What type of PR is this?

/area ui
/milestone 2.22.x

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

Bump axios version to 1.12

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

```release-note
None
```
2025-10-22 10:08:15 +00:00
Ryan Wang
75ae6215a0 Refactor date and attachment utils to shared package (#7847)
#### What type of PR is this?

/area ui
/kind feature
/milestone 2.22.x

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

This PR introduces date and attachment utilities into the `@halo-dev/console-shared` package. This makes it convenient for plugins to share and reuse these common functions.

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

```release-note
在 `@halo-dev/console-shared` 包中提供统一的 date 和 attachment 工具
```
2025-10-22 10:02:14 +00:00
Ryan Wang
1d81a73430 Upgrade Node.js to v22 (#7846)
#### What type of PR is this?

/area ui
/kind cleanup

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

Upgrade Node.js to 22

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

```release-note
None
```
2025-10-22 08:38:13 +00:00
Ryan Wang
1cb0629364 Add eslint-plugin-unicorn and use node: protocol imports (#7845)
#### What type of PR is this?

/area ui
/kind cleanup

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

Integrated [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) into the ESLint config and added related rules. Updated all imports of core Node.js modules to use the 'node:' protocol for improved compatibility and linting.

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

```release-note
None
```
2025-10-22 08:36:14 +00:00
Takagi
da84c6c35d chore: upgrade tiptap to version 3.7.2 (#7811)
#### What type of PR is this?

/kind improvement
/area editor
/area ui

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

升级 Tiptap 版本至 3.7.2。

⚠️  由于 Tiptap 在 3.x 做了一些破坏性更新,并且 Halo 也遵循其更新,对 BubbleMenu 进行了更新,因此当前插件如果扩展了编辑器,并使用了 BubbleMenu,则需要根据以下方式进行更新升级。

1. 使用 `options` 代替 `tippyOptions`。
```diff
- tippyOptions: {
-  fixed: false,
- },
+ options: {
+  strategy:"absolute",
+ },
```

2. 使用 `getReferencedVirtualElement` 代替 `getRenderContainer`。
```diff
- getRenderContainer: (node: HTMLElement) => {
-   let container = node;
-   if (container.nodeName === "#text") {
-     container = node.parentElement as HTMLElement;
-   }
-   while (
-     container &&
-     container.classList &&
-    !container.classList.contains("column")
-   ) {
-     container = container.parentElement as HTMLElement;
-   }
-   return container;
- },
+ getReferencedVirtualElement() {
+  const editor = this.editor;
+   if (!editor) {
+     return null;
+   }
+  const parentNode = findParentNode(
+     (node) => node.type.name === Column.name
+   )(editor.state.selection);
+   if (parentNode) {
+     const domRect = posToDOMRect(
+       editor.view,
+       parentNode.pos,
+       parentNode.pos + parentNode.node.nodeSize
+     );
+     return {
+       getBoundingClientRect: () => domRect,
+       getClientRects: () => [domRect],
+     };
+   }
+   return null;
+ },
```

3. 移除 `defaultAnimation`。
```diff
- defaultAnimation: false,
```

此外,更新后,原有插件中扩展已有 Node 的 `BubbleMenu` 方式将会失效,例如 [编辑器超链接卡片](https://www.halo.run/store/apps/app-UpUJA) 扩展了 Text Node 的 `BubbleMenu`,因为此前并未支持扩展已实现的 `BubbleMenu`。
在当前 PR 中,为了解决升级版本后失效的问题,引入了 `extendsKey` 字段,用于扩展已有的 `BubbleMenu`。(需要已有的 `BubbleMenu` 设置了 PluginKey。
用法如下:

```ts
Extension.create({
    name: "expandTextBubbleMenu",
    addOptions() {
      return {
        getBubbleMenu() {
          return {
            // 目标 BubbleMenu 的 PluginKey。当前版本会导出 Halo UI Editor 中的所有 PluginKey。
            extendsKey: TEXT_BUBBLE_MENU_KEY,
            items: [
              {
                priority: 10,
                // 具有同一个 key 的 items 将会被覆盖
                key: "textItem1",
                props: { title: "ExpandText" },
              },
            ],
          };
        },
      };
    },
  }),
```

这样当 text 中具有 `textItem1` 的 item 时,将会被覆盖,没有时将会追加合并。
#### How to test it?

#### Does this PR introduce a user-facing change?
```release-note
升级 Tiptap 至 3.x
```
2025-10-22 07:00:14 +00:00
Ryan Wang
a3ec1b2f74 Consolidate some config files to project root (#7831)
#### What type of PR is this?

/kind cleanup

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

This PR moves the .gitignore, .editorconfig, and .vscode files from the ui/ directory to the project root. This change is to avoid the need to maintain multiple, separate configuration files.

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

```release-note
None
```
2025-10-21 15:04:14 +00:00
Takagi
7fd3cce29a feat: support using Chinese symbols to invoke the suggestion menu (#7840)
#### What type of PR is this?

/kind feature
/area editor

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

支持使用中文符号`、`唤起建议菜单

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

Fixes #7770

#### Does this PR introduce a user-facing change?
```release-note
支持使用中文符号、唤起建议菜单
```
2025-10-21 09:48:14 +00:00
Takagi
5c2598a551 fix: code block focus positioning error when switching languages (#7839)
#### What type of PR is this?

/kind bug
/area editor

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

当切换代码块语言时,可能会导致页面不正常跳动。

当前 PR 移除了切换代码块语言之后的设置焦点事件用于解决此问题

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

Fixes #7795

#### Does this PR introduce a user-facing change?
```release-note
解决切换代码块语言时编辑器页面不正常跳动的问题
```
2025-10-21 04:20:12 +00:00
Ryan Wang
5b3bfe8dfd Update toolbox priorities and add image command menu (#7803)
Adjusted the priority values for toolbox items in audio, code-block, columns, iframe, and table extensions to refine their ordering. Added a getCommandMenuItems method to the image extension, enabling image insertion via the command menu.
2025-10-15 12:47:58 +08:00
Ryan Wang
5e6de80570 Remove thumbnails management feature and adapt new implementation 2025-10-02 10:31:17 +08:00
John Niang
6cc0489763 Bump OpenAPI document version to 2.22.0-SNAPSHOT 2025-09-24 19:13:09 +08:00
Ryan Wang
b822de2d78 Add ui packages publish workflow (#7743) 2025-09-09 18:13:33 +08:00
Ryan Wang
3487132154 Add support for hidden comments (#7679)
* Add 'hidden' field to comment and reply requests

Signed-off-by: Ryan Wang <i@ryanc.cc>

* Add support for filtering comments with hidden

* Specify hidden=false and approved=true for anonymous users

* Set default hidden flag only if null in comments

* Add 'private reply' option to comment modals

* Add private tag for hidden comments and replies

* Allow hiding comments only

* Enhance comment visibility logic to allow owners to view hidden comments

* Remove hidden input for reply form

Signed-off-by: Ryan Wang <i@ryanc.cc>

* Refine i18n

Signed-off-by: Ryan Wang <i@ryanc.cc>

---------

Signed-off-by: Ryan Wang <i@ryanc.cc>
Co-authored-by: John Niang <johnniang@foxmail.com>
2025-08-19 14:47:37 +08:00