Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
docs: update contributing
Wenzhao Hu49d590c2e21c
diff --git a/.github/workflows/update-snapshots-on-comment.yml b/.github/workflows/update-snapshots-on-comment.ymldeleted file mode 100644index ff828d7d6a..0000000000--- a/.github/workflows/update-snapshots-on-comment.yml+++ /dev/null@@ -1,40 +0,0 @@-name: 📸 Update Snapshots on Comment--on:- issue_comment:- types: [created]--jobs:- udpate-snapshots:- if: contains(github.event.comment.body, '/update-snapshots')- runs-on: ubuntu-latest- env:- GH_TOKEN: ${{ github.token }}-- steps:- - name: Checkout- uses: actions/checkout@v4- with:- ref: ${{ github.event.issue.pull_request.head.ref }}- fetch-depth: 0-- - name: Get Branch Name- id: get_branch- run: echo "##[set-output name=branch;]${{ github.event.issue.pull_request.head.ref }}"-- - name: Setup Node.js- uses: ./.github/actions/setup-node-- - name: Update Snapshots- uses: ./.github/actions/update-snapshots-- - name: Commit Updated Snapshots- shell: bash- run: |- git config --global user.email "[email protected]"- git config --global user.name "GitHub Actions"-- git checkout ${{ steps.get_branch.outputs.branch }}- git add -A- git commit -m "chore(snapshots): update snapshots" || exit 0- git pushdiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 708822c2da..a19e69b7b0 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -199,7 +199,7 @@ pnpm test:e2e### Update Snapshots-Univer uses Playwright to perform visual comparison tests. If you have made changes to the UI, the CI may fail due to visual differences. You can update the snapshots ~~by commenting the PR with `/update-snapshots` like [this](https://github.com/dream-num/univer/pull/3655#issuecomment-2398951289), or you can~~ run this GitHub Action [📸 Manually Update Snapshots · Workflow runs · dream-num/univer (github.com)](https://github.com/dream-num/univer/actions/workflows/update-snapshots-manually.yml) manually.+Univer uses Playwright to perform visual comparison tests. If you have made changes to the UI, the CI may fail due to visual differences. You can update the snapshots by running this GitHub Action [📸 Manually Update Snapshots · Workflow runs · dream-num/univer (github.com)](https://github.com/dream-num/univer/actions/workflows/update-snapshots-manually.yml) on your branch.### Clean codediff --git a/examples/src/sheets/lazy.ts b/examples/src/sheets/lazy.tsindex 4188c3ff26..47523fce1f 100644--- a/examples/src/sheets/lazy.ts+++ b/examples/src/sheets/lazy.ts@@ -14,12 +14,16 @@* limitations under the License.*/+import type { Plugin, PluginCtor } from '@univerjs/core';import { UniverActionRecorderPlugin } from '@univerjs/action-recorder';+import { UniverDebuggerPlugin } from '@univerjs/debugger';+import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';import { UniverSheetsCrosshairHighlightPlugin } from '@univerjs/sheets-crosshair-highlight';+import { UniverSheetsDrawingUIPlugin } from '@univerjs/sheets-drawing-ui';import { UniverSheetsFilterUIPlugin } from '@univerjs/sheets-filter-ui';import { UniverSheetsFindReplacePlugin } from '@univerjs/sheets-find-replace';+import { UniverSheetsHyperLinkUIPlugin } from '@univerjs/sheets-hyper-link-ui';import { UniverUniscriptPlugin } from '@univerjs/uniscript';-import type { Plugin, PluginCtor } from '@univerjs/core';export default function getLazyPlugins(): Array<[PluginCtor<Plugin>] | [PluginCtor<Plugin>, unknown]> {return [@@ -40,9 +44,13 @@ export default function getLazyPlugins(): Array<[PluginCtor<Plugin>] | [PluginCtreturn '/vs/editor/editor.worker.js';},}],+ [UniverSheetsConditionalFormattingUIPlugin],[UniverActionRecorderPlugin],+ [UniverSheetsHyperLinkUIPlugin],[UniverSheetsCrosshairHighlightPlugin],[UniverSheetsFilterUIPlugin, { useRemoteFilterValuesGenerator: false }],+ [UniverSheetsDrawingUIPlugin],[UniverSheetsFindReplacePlugin],+ [UniverDebuggerPlugin],];}diff --git a/examples/src/sheets/main.ts b/examples/src/sheets/main.tsindex c325b208c6..2bc2766f95 100644--- a/examples/src/sheets/main.ts+++ b/examples/src/sheets/main.ts@@ -18,11 +18,9 @@ import type { Nullable } from '@univerjs/core';import type { IUniverRPCMainThreadConfig } from '@univerjs/rpc';import type { IThreadCommentMentionDataSource } from '@univerjs/thread-comment-ui';import { LocaleType, LogLevel, Univer, UniverInstanceType, UserManagerService } from '@univerjs/core';-import { UniverDebuggerPlugin } from '@univerjs/debugger';import { defaultTheme } from '@univerjs/design';import { UniverDocsPlugin } from '@univerjs/docs';import { UniverDocsUIPlugin } from '@univerjs/docs-ui';-import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';import { UniverRenderEnginePlugin } from '@univerjs/engine-render';import { FUniver } from '@univerjs/facade';@@ -30,20 +28,17 @@ import { DEFAULT_WORKBOOK_DATA_DEMO } from '@univerjs/mockdata';import { UniverRPCMainThreadPlugin } from '@univerjs/rpc';import { UniverSheetsPlugin } from '@univerjs/sheets';import { UniverSheetsConditionalFormattingPlugin } from '@univerjs/sheets-conditional-formatting';-import { UniverSheetsConditionalFormattingUIPlugin } from '@univerjs/sheets-conditional-formatting-ui';import { UniverSheetsDataValidationPlugin } from '@univerjs/sheets-data-validation';import { UniverSheetsDataValidationUIPlugin } from '@univerjs/sheets-data-validation-ui';-import { UniverSheetsDrawingUIPlugin } from '@univerjs/sheets-drawing-ui';import { UniverSheetsFilterPlugin } from '@univerjs/sheets-filter';import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula';import { UniverSheetsFormulaUIPlugin } from '@univerjs/sheets-formula-ui';-import { UniverSheetsHyperLinkUIPlugin } from '@univerjs/sheets-hyper-link-ui';+import { UniverSheetsHyperLinkPlugin } from '@univerjs/sheets-hyper-link';import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt';import { UniverSheetsSortUIPlugin } from '@univerjs/sheets-sort-ui';-import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';+import { IThreadCommentMentionDataService, UniverSheetsThreadCommentPlugin, UniverThreadCommentUIPlugin } from '@univerjs/sheets-thread-comment';import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';-import { IThreadCommentMentionDataService, UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';import { UniverUIPlugin } from '@univerjs/ui';import { enUS, faIR, ruRU, viVN, zhCN, zhTW } from '../locales';@@ -52,6 +47,36 @@ const IS_E2E: boolean = !!process.env.IS_E2E;const LOAD_LAZY_PLUGINS_TIMEOUT = 1_000;+export const mockUser = {+ userID: 'Owner_qxVnhPbQ',+ name: 'Owner',+ avatar: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAInSURBVHgBtZU9TxtBEIbfWRzFSIdkikhBSqRQkJqkCKTCFkqVInSUSaT0wC8w/gXxD4gU2nRJkXQWhAZowDUUWKIwEgWWbEEB3mVmx3dn4DA2nB/ppNuPeWd29mMIPXDr+RxwtgRHeW6+guNPRxogqnL7Dwz9psJ27S4NShaeZTH3kwXy6I81dlRKcmRui88swdq9AcSFL7Buz1Vmlns64MiLsCjzwnIYHLH57tbfFbs7KRaXyEU8FVZofqccOfA5l7Q8LPIkGrwnb2RPNEXWFVMUF3L+kDCk0btDDAMzOm5YfAHDwp4tG74wnzAsiOYMnJ3GoDybA7IT98/jm5+JNnfiIzAS6LlqHQBN/i6b2t/cV1Hh6BfwYlHnHP4AXi5q/8kmMMpOs8+BixZw/Fd6xUEHEbnkgclvQP2fGp7uShRKnQ3G32rkjV1th8JhIGG7tR/JyjGteSOZELwGMmNqIIigRCLRh2OZIE6BjItdd7pCW6Uhm1zzkUtungSxwEUzNpQ+GQumtH1ej1MqgmNT6vwmhCq5yuwq56EYTbgeQUz3yvrpV1b4ok3nYJ+eYhgYmjRUqErx2EDq0Fr8FhG++iqVGqxlUJI/70Ar0UgJaWHj6hYVHJrfKssAHot1JfqwE9WVWzXZVd5z2Ws/4PnmtEjkXeKJDvxUecLbWOXH/DP6QQ4J72NS0adedp1aseBfXP8odlZFfPvBF7SN/8hky1TYuPOAXAEipMx15u5ToAAAAABJRU5ErkJggg==',+ anonymous: false,+ canBindAnonymous: false,+};++class CustomMentionDataService implements IThreadCommentMentionDataService {+ dataSource: Nullable<IThreadCommentMentionDataSource>;+ trigger: string = '@';++ async getMentions() {+ return [+ {+ id: mockUser.userID,+ label: mockUser.name,+ type: 'user',+ icon: mockUser.avatar,+ },+ {+ id: '2',+ label: 'User2',+ type: 'user',+ icon: mockUser.avatar,+ },+ ];+ }+}+// univerconst univer = new Univer({theme: defaultTheme,@@ -75,10 +100,9 @@ univer.registerPlugin(UniverDocsPlugin);univer.registerPlugin(UniverRenderEnginePlugin);univer.registerPlugin(UniverUIPlugin, { container: 'app' });univer.registerPlugin(UniverDocsUIPlugin);+univer.registerPlugin(UniverSheetsPlugin, { notExecuteFormula: true });univer.registerPlugin(UniverSheetsUIPlugin);--// sheet feature pluginsuniver.registerPlugin(UniverSheetsNumfmtPlugin);univer.registerPlugin(UniverSheetsZenEditorPlugin);univer.registerPlugin(UniverFormulaEnginePlugin, { notExecuteFormula: true });@@ -86,62 +110,15 @@ univer.registerPlugin(UniverSheetsFormulaPlugin, { notExecuteFormula: true });univer.registerPlugin(UniverSheetsFormulaUIPlugin);univer.registerPlugin(UniverSheetsDataValidationPlugin);univer.registerPlugin(UniverSheetsDataValidationUIPlugin);--// filter plugin+univer.registerPlugin(UniverSheetsConditionalFormattingPlugin);univer.registerPlugin(UniverSheetsFilterPlugin);--// mock lazy load-setTimeout(() => {- // hyperlink- univer.registerPlugin(UniverSheetsHyperLinkUIPlugin);-}, 500);--// sort+univer.registerPlugin(UniverSheetsHyperLinkPlugin);univer.registerPlugin(UniverSheetsSortUIPlugin);-// condition formatting-univer.registerPlugin(UniverSheetsConditionalFormattingPlugin);-univer.registerPlugin(UniverSheetsConditionalFormattingUIPlugin);--// drawing-univer.registerPlugin(UniverSheetsDrawingUIPlugin);--const mockUser = {- userID: 'Owner_qxVnhPbQ',- name: 'Owner',- avatar: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAInSURBVHgBtZU9TxtBEIbfWRzFSIdkikhBSqRQkJqkCKTCFkqVInSUSaT0wC8w/gXxD4gU2nRJkXQWhAZowDUUWKIwEgWWbEEB3mVmx3dn4DA2nB/ppNuPeWd29mMIPXDr+RxwtgRHeW6+guNPRxogqnL7Dwz9psJ27S4NShaeZTH3kwXy6I81dlRKcmRui88swdq9AcSFL7Buz1Vmlns64MiLsCjzwnIYHLH57tbfFbs7KRaXyEU8FVZofqccOfA5l7Q8LPIkGrwnb2RPNEXWFVMUF3L+kDCk0btDDAMzOm5YfAHDwp4tG74wnzAsiOYMnJ3GoDybA7IT98/jm5+JNnfiIzAS6LlqHQBN/i6b2t/cV1Hh6BfwYlHnHP4AXi5q/8kmMMpOs8+BixZw/Fd6xUEHEbnkgclvQP2fGp7uShRKnQ3G32rkjV1th8JhIGG7tR/JyjGteSOZELwGMmNqIIigRCLRh2OZIE6BjItdd7pCW6Uhm1zzkUtungSxwEUzNpQ+GQumtH1ej1MqgmNT6vwmhCq5yuwq56EYTbgeQUz3yvrpV1b4ok3nYJ+eYhgYmjRUqErx2EDq0Fr8FhG++iqVGqxlUJI/70Ar0UgJaWHj6hYVHJrfKssAHot1JfqwE9WVWzXZVd5z2Ws/4PnmtEjkXeKJDvxUecLbWOXH/DP6QQ4J72NS0adedp1aseBfXP8odlZFfPvBF7SN/8hky1TYuPOAXAEipMx15u5ToAAAAABJRU5ErkJggg==',- anonymous: false,- canBindAnonymous: false,-};--class CustomMentionDataService implements IThreadCommentMentionDataService {- dataSource: Nullable<IThreadCommentMentionDataSource>;- trigger: string = '@';-- async getMentions() {- return [- {- id: mockUser.userID,- label: mockUser.name,- type: 'user',- icon: mockUser.avatar,- },- {- id: '2',- label: 'User2',- type: 'user',- icon: mockUser.avatar,- },- ];- }-}--// comment-univer.registerPlugin(UniverThreadCommentUIPlugin, { overrides: [[IThreadCommentMentionDataService, { useClass: CustomMentionDataService }]] });+univer.registerPlugin(UniverThreadCommentUIPlugin, {+ overrides: [[IThreadCommentMentionDataService, { useClass: CustomMentionDataService }]],+});univer.registerPlugin(UniverSheetsThreadCommentPlugin);-// debugger plugin-univer.registerPlugin(UniverDebuggerPlugin);-const injector = univer.__getInjector();const userManagerService = injector.get(UserManagerService);userManagerService.setCurrentUser(mockUser);