Skip to content

Commit cf7ed4c

Browse files
authored
docs: add weekly-7 (#26)
1 parent 9fa9d98 commit cf7ed4c

File tree

7 files changed

+367
-5
lines changed

7 files changed

+367
-5
lines changed

app/[lang]/(home)/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default async function Page({ params }: IProps) {
8484
hover:bg-neutral-100
8585
dark:bg-neutral-800 dark:hover:bg-neutral-900
8686
`}
87-
href="/blog/weekly-6"
87+
href="/blog/weekly-7"
8888
>
8989
<span
9090
className={`

content/blog/weekly-7.mdx

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
---
2+
title: "Univer 周报 #7"
3+
author: 白熱
4+
date: 2025-07-29
5+
---
6+
7+
import { RainbowButton } from '@/components/magicui/rainbow-button'
8+
9+
如果 Univer 对你有所帮助,请考虑在 GitHub 上给我们点个星。你的支持将帮助我们继续改进和维护 Univer。
10+
11+
<a href="https://github.com/dream-num/univer" target="_blank" rel="noopener noreferrer">
12+
<RainbowButton variant="outline">⭐️ 在 GitHub 上点个星</RainbowButton>
13+
</a>
14+
15+
---
16+
17+
## Univer v0.10.0
18+
19+
### `mergeLocales`:简化多语言包合并
20+
21+
在 Univer v0.10.0 版本中,我们提供了新的 [`mergeLocales`](/guides/getting-started/i18n#mergeLocales) 方法。用于合并多个语言包对象。相比以往手动调用 `merge` 进行合并,`mergeLocales` 让你无需再关心底层的合并细节,只需专注于传入需要合并的语言包即可,大幅提升了国际化开发的便捷性和代码可读性。
22+
23+
对于之前使用 `merge` 方法的项目,建议按如下方式修改代码:
24+
25+
<Tabs items={['预设模式', '插件模式']}>
26+
<Tab>
27+
```diff
28+
- import { merge } from '@univerjs/presets';
29+
+ import { mergeLocales } from '@univerjs/presets';
30+
31+
const univer = new Univer({
32+
locale: LocaleType.ZH_CN,
33+
locales: {
34+
- [LocaleType.ZH_CN]: merge(
35+
- {},
36+
+ [LocaleType.ZH_CN]: mergeLocales(
37+
DesignZhCN,
38+
UIZhCN,
39+
DocsUIZhCN,
40+
SheetsZhCN,
41+
SheetsUIZhCN,
42+
SheetsFormulaUIZhCN,
43+
SheetsNumfmtUIZhCN,
44+
),
45+
},
46+
})
47+
```
48+
</Tab>
49+
<Tab>
50+
```diff
51+
- import { merge } from '@univerjs/core';
52+
+ import { mergeLocales } from '@univerjs/core';
53+
54+
const univer = new Univer({
55+
locale: LocaleType.ZH_CN,
56+
locales: {
57+
- [LocaleType.ZH_CN]: merge(
58+
- {},
59+
+ [LocaleType.ZH_CN]: mergeLocales(
60+
DesignZhCN,
61+
UIZhCN,
62+
DocsUIZhCN,
63+
SheetsZhCN,
64+
SheetsUIZhCN,
65+
SheetsFormulaUIZhCN,
66+
SheetsNumfmtUIZhCN,
67+
),
68+
},
69+
})
70+
```
71+
</Tab>
72+
</Tabs>
73+
74+
通过上述调整,你可以用更清晰的方式合并多个语言包,无需再手动传入空对象作为初始参数。
75+
76+
### `univer.registerPlugin`:支持批量注册插件
77+
78+
本次更新对 [`univer.registerPlugin`](/guides/getting-started/installation#registerPlugin) 方法进行了增强,现在支持一次性注册多个插件,无需多次循环调用,极大提升了插件注册的灵活性与效率。例如:
79+
80+
```typescript
81+
univer.registerPlugin([
82+
UniverRenderEnginePlugin,
83+
UniverFormulaEnginePlugin,
84+
[UniverUIPlugin, {
85+
container: 'app',
86+
}],
87+
UniverDocsPlugin,
88+
UniverDocsUIPlugin,
89+
UniverSheetsPlugin,
90+
UniverSheetsUIPlugin,
91+
UniverSheetsFormulaPlugin,
92+
UniverSheetsFormulaUIPlugin,
93+
UniverSheetsNumfmtPlugin,
94+
UniverSheetsNumfmtUIPlugin,
95+
])
96+
```
97+
98+
通过数组传递插件列表,可以更直观地管理和维护插件依赖关系。
99+
100+
### 💔 破坏性更新:自定义权限背景与用户组件配置方式调整
101+
102+
以往,开发者需要通过 `UniverSheetsUIPlugin``customComponents` 属性实现自定义权限背景和用户组件,这一方式配置繁琐、理解门槛高。v0.10.0 版本对此进行了破坏性调整,移除了 `customComponents`,并用更直观的 `protectedRangeUserSelector``protectedRangeShadow` 替代。
103+
104+
如果你过去使用了 `customComponents` 属性来实现自定义权限背景和用户组件,请参考以下示例进行迁移:
105+
106+
**隐藏权限背景阴影**
107+
108+
<Tabs items={['预设模式', '插件模式']}>
109+
<Tab>
110+
```diff
111+
createUniver({
112+
presets: [
113+
UniverSheetsCorePreset({
114+
- customComponents: new Set([UNIVER_SHEET_PERMISSION_BACKGROUND]),
115+
+ protectedRangeShadow: false,
116+
}),
117+
],
118+
})
119+
```
120+
</Tab>
121+
<Tab>
122+
```diff
123+
univer.registerPlugin(UniverSheetsUIPlugin, {
124+
- customComponents: new Set([UNIVER_SHEET_PERMISSION_BACKGROUND]),
125+
+ protectedRangeShadow: false,
126+
})
127+
```
128+
</Tab>
129+
</Tabs>
130+
131+
**自定义用户组件**
132+
133+
<Tabs items={['预设模式', '插件模式']}>
134+
<Tab>
135+
```diff
136+
- const injector = univer.__getInjector()
137+
- const uiPartsService = injector.get(IUIPartsService)
138+
- uiPartsService.registerComponent(UNIVER_SHEET_PERMISSION_USER_PART, () => connectInjector(CustomPermissionDetailUserPart, injector))
139+
140+
createUniver({
141+
presets: [
142+
UniverSheetsCorePreset({
143+
- customComponents: new Set([UNIVER_SHEET_PERMISSION_USER_PART]),
144+
+ protectedRangeUserSelector: {
145+
+ component: CustomPermissionDetailUserPart,
146+
+ framework: 'react',
147+
+ },
148+
}),
149+
],
150+
})
151+
```
152+
</Tab>
153+
<Tab>
154+
```diff
155+
- const injector = univer.__getInjector()
156+
- const uiPartsService = injector.get(IUIPartsService)
157+
- uiPartsService.registerComponent(UNIVER_SHEET_PERMISSION_USER_PART, () => connectInjector(CustomPermissionDetailUserPart, injector))
158+
159+
univer.registerPlugin(UniverSheetsUIPlugin, {
160+
- customComponents: new Set([UNIVER_SHEET_PERMISSION_USER_PART]),
161+
+ protectedRangeUserSelector: {
162+
+ component: CustomPermissionDetailUserPart,
163+
+ framework: 'react',
164+
+ },
165+
})
166+
```
167+
</Tab>
168+
</Tabs>
169+
170+
### 其他功能优化与问题修复
171+
172+
- Univer Slides 现已支持插入圆形。感谢社区贡献者 [@kenny-not-dead](https://github.com/kenny-not-dead) 对此功能的贡献([#5602](https://github.com/dream-num/univer/pull/5602))。
173+
- 优化了自定义排序弹窗的默认弹出位置,提升用户体验。
174+
- 查找替换功能升级,现支持在输入框中直接通过回车键跳转到下一个匹配项。
175+
- 修复了部分表格过滤器相关的问题。
176+
177+
更多详细的更新内容和历史版本信息,请访问我们的 [GitHub Releases](https://github.com/dream-num/univer/releases/tag/v0.10.0) 页面。
178+
179+
---
180+
181+
感谢每一位社区开发者和用户的关注与支持!我们将持续优化产品体验,也欢迎大家通过文档评价、Issue 或 Pull Request 提出宝贵建议或直接参与贡献。让我们一起让 Univer 变得更好!

content/blog/weekly-7.zh-CN.mdx

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
---
2+
title: "Univer Weekly #7"
3+
author: 白熱
4+
date: 2025-07-29
5+
---
6+
7+
import { RainbowButton } from '@/components/magicui/rainbow-button'
8+
9+
If you find Univer useful, please consider supporting us by starring our project on GitHub. Your support helps us continue to improve and maintain Univer.
10+
11+
<a href="https://github.com/dream-num/univer" target="_blank" rel="noopener noreferrer">
12+
<RainbowButton variant="outline">⭐️ Star on GitHub</RainbowButton>
13+
</a>
14+
15+
---
16+
17+
## Univer v0.10.0
18+
19+
### `mergeLocales`: Simplifying Locale Merging
20+
21+
In Univer v0.10.0, we introduced the new [`mergeLocales`](/guides/getting-started/i18n#mergeLocales) method for merging multiple locale objects. This method simplifies the merging process, allowing you to focus on the locales you want to combine without worrying about the underlying details, significantly enhancing the convenience and readability of internationalization development.
22+
23+
For projects that previously used the `merge` method, we recommend updating your code as follows:
24+
25+
<Tabs items={['Preset Mode', 'Plugin Mode']}>
26+
<Tab>
27+
```diff
28+
- import { merge } from '@univerjs/presets';
29+
+ import { mergeLocales } from '@univerjs/presets';
30+
31+
const univer = new Univer({
32+
locale: LocaleType.EN_US,
33+
locales: {
34+
- [LocaleType.EN_US]: merge(
35+
- {},
36+
+ [LocaleType.EN_US]: mergeLocales(
37+
DesignEnUS,
38+
UIEnUS,
39+
DocsUIEnUS,
40+
SheetsEnUS,
41+
SheetsUIEnUS,
42+
SheetsFormulaUIEnUS,
43+
SheetsNumfmtUIEnUS,
44+
),
45+
},
46+
})
47+
```
48+
</Tab>
49+
<Tab>
50+
```diff
51+
- import { merge } from '@univerjs/core';
52+
+ import { mergeLocales } from '@univerjs/core';
53+
54+
const univer = new Univer({
55+
locale: LocaleType.EN_US,
56+
locales: {
57+
- [LocaleType.EN_US]: merge(
58+
- {},
59+
+ [LocaleType.EN_US]: mergeLocales(
60+
DesignEnUS,
61+
UIEnUS,
62+
DocsUIEnUS,
63+
SheetsEnUS,
64+
SheetsUIEnUS,
65+
SheetsFormulaUIEnUS,
66+
SheetsNumfmtUIEnUS,
67+
),
68+
},
69+
})
70+
```
71+
</Tab>
72+
</Tabs>
73+
74+
This adjustment allows you to merge multiple locale objects more clearly, without needing to manually pass an empty object as the initial parameter.
75+
76+
### `univer.registerPlugin`: Support for Batch Plugin Registration
77+
78+
We have enhanced the [`univer.registerPlugin`](/guides/getting-started/installation#registerPlugin) method to support batch registration of plugins, allowing you to register multiple plugins at once without the need for multiple calls, greatly improving flexibility and efficiency. For example:
79+
80+
```typescript
81+
univer.registerPlugin([
82+
UniverRenderEnginePlugin,
83+
UniverFormulaEnginePlugin,
84+
[UniverUIPlugin, {
85+
container: 'app',
86+
}],
87+
UniverDocsPlugin,
88+
UniverDocsUIPlugin,
89+
UniverSheetsPlugin,
90+
UniverSheetsUIPlugin,
91+
UniverSheetsFormulaPlugin,
92+
UniverSheetsFormulaUIPlugin,
93+
UniverSheetsNumfmtPlugin,
94+
UniverSheetsNumfmtUIPlugin,
95+
])
96+
```
97+
98+
This allows you to manage and maintain plugin dependencies more intuitively by passing an array of plugins.
99+
100+
### 💔 Breaking Change: Custom Permission Background and User Component Configuration Changes
101+
102+
In the past, developers used the `customComponents` property of `UniverSheetsUIPlugin` to implement custom permission backgrounds and user components. This approach was cumbersome and had a high learning curve. In version 0.10.0, we made a breaking change by removing `customComponents` and replacing it with more intuitive `protectedRangeUserSelector` and `protectedRangeShadow`.
103+
104+
If you previously used the `customComponents` property for custom permission backgrounds and user components, please refer to the following examples for migration:
105+
106+
**Hide Permission Background Shadow**
107+
108+
<Tabs items={['Preset Mode', 'Plugin Mode']}>
109+
<Tab>
110+
```diff
111+
createUniver({
112+
presets: [
113+
UniverSheetsCorePreset({
114+
- customComponents: new Set([UNIVER_SHEET_PERMISSION_BACKGROUND]),
115+
+ protectedRangeShadow: false,
116+
}),
117+
],
118+
})
119+
```
120+
</Tab>
121+
<Tab>
122+
```diff
123+
univer.registerPlugin(UniverSheetsUIPlugin, {
124+
- customComponents: new Set([UNIVER_SHEET_PERMISSION_BACKGROUND]),
125+
+ protectedRangeShadow: false,
126+
})
127+
```
128+
</Tab>
129+
</Tabs>
130+
131+
**Custom User Component**
132+
133+
<Tabs items={['Preset Mode', 'Plugin Mode']}>
134+
<Tab>
135+
```diff
136+
- const injector = univer.__getInjector()
137+
- const uiPartsService = injector.get(IUIPartsService)
138+
- uiPartsService.registerComponent(UNIVER_SHEET_PERMISSION_USER_PART, () => connectInjector(CustomPermissionDetailUserPart, injector))
139+
140+
createUniver({
141+
presets: [
142+
UniverSheetsCorePreset({
143+
- customComponents: new Set([UNIVER_SHEET_PERMISSION_USER_PART]),
144+
+ protectedRangeUserSelector: {
145+
+ component: CustomPermissionDetailUserPart,
146+
+ framework: 'react',
147+
+ },
148+
}),
149+
],
150+
})
151+
```
152+
</Tab>
153+
<Tab>
154+
```diff
155+
- const injector = univer.__getInjector()
156+
- const uiPartsService = injector.get(IUIPartsService)
157+
- uiPartsService.registerComponent(UNIVER_SHEET_PERMISSION_USER_PART, () => connectInjector(CustomPermissionDetailUserPart, injector))
158+
159+
univer.registerPlugin(UniverSheetsUIPlugin, {
160+
- customComponents: new Set([UNIVER_SHEET_PERMISSION_USER_PART]),
161+
+ protectedRangeUserSelector: {
162+
+ component: CustomPermissionDetailUserPart,
163+
+ framework: 'react',
164+
+ },
165+
})
166+
```
167+
</Tab>
168+
</Tabs>
169+
170+
### Other Feature Enhancements and Bug Fixes
171+
172+
- Univer Slides now supports inserting circles. Thanks to community contributor [@kenny-not-dead](https://github.com/kenny-not-dead) for this feature contribution (#[5602](https://github.com/dream-num/univer/pull/5602)).
173+
- Optimized the default popup position of the custom sorting dialog to enhance user experience.
174+
- The find and replace feature has been upgraded to allow jumping to the next match directly by pressing the Enter key in the input box.
175+
- Fixed some issues related to table filters.
176+
177+
For a full list of updates and historical release information, please visit our [GitHub Releases page](https://github.com/dream-num/univer/releases/tag/v0.10.0).
178+
179+
---
180+
181+
Thank you to every community developer and user for your attention and support! We will continue to optimize the product experience, and we welcome your valuable suggestions and contributions. Let's work together to make Univer even better!

content/guides/shared/getting-started/i18n.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ icon: Earth
77
Not all plugins include language packs. We will specify this in the documentation for each feature.
88
</Callout>
99

10-
## `mergeLocales` Method
10+
## `mergeLocales` Method [#mergeLocales]
1111

1212
`mergeLocales` Method is used to merge multiple plugin or preset language packs into a complete language pack object. You can use it as follows:
1313

content/guides/shared/getting-started/i18n.zh-CN.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ icon: Earth
77
并非所有插件都包含了语言包,我们会在每个功能的文档对此进行说明。
88
</Callout>
99

10-
## `mergeLocales` 方法
10+
## `mergeLocales` 方法 [#mergeLocales]
1111

1212
`mergeLocales` 方法用于将多个插件或预设的语言包合并为一个完整的语言包对象,你可以通过以下方式使用它:
1313

content/guides/sheets/getting-started/installation/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ We use React to develop the view (this does not affect your use of Univer in Vue
233233

234234
<PlaygroundFrame lang="en-US" slug="sheets/slim-via-plugin" clickToShow />
235235

236-
#### `univer.registerPlugin` Method
236+
#### `univer.registerPlugin` Method [#registerPlugin]
237237

238238
``univer.registerPlugin` method is used to register a plugin to the Univer instance. You can call this method after creating the Univer instance to register plugins.
239239

0 commit comments

Comments
 (0)