Skip to content

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.

fix: storybook failed because can not override name property (#2339)

Ran Luo58539999a91f
diff --git a/packages/core/src/docs/data-model/json-x/json-x.ts b/packages/core/src/docs/data-model/json-x/json-x.ts
index c49fbbf685..520b196b9e 100644
--- a/packages/core/src/docs/data-model/json-x/json-x.ts
+++ b/packages/core/src/docs/data-model/json-x/json-x.ts
@@ -40,7 +40,7 @@ export interface ISubType {
export { JSONOp as JSONXActions, Path as JSONXPath, json1 as JSON1 };
export class JSONX {
- static name = 'json-x';
+ // static name = 'json-x';
static uri = 'https://github.com/dream-num/univer#json-x';
diff --git a/packages/core/src/docs/data-model/text-x/__tests__/text-x.spec.ts b/packages/core/src/docs/data-model/text-x/__tests__/text-x.spec.ts
index 49df1e926a..febfda0ea5 100644
--- a/packages/core/src/docs/data-model/text-x/__tests__/text-x.spec.ts
+++ b/packages/core/src/docs/data-model/text-x/__tests__/text-x.spec.ts
@@ -251,5 +251,9 @@ describe('test TextX methods and branches', () => {
expect(TextX.isNoop(textX.serialize())).toBe(false);
});
+
+ it('textX name should to be text-x', () => {
+ expect(TextX.name).toBe('text-x');
+ });
});
});
diff --git a/packages/core/src/docs/data-model/text-x/text-x.ts b/packages/core/src/docs/data-model/text-x/text-x.ts
index 2f7519de0d..ab7ca44e96 100644
--- a/packages/core/src/docs/data-model/text-x/text-x.ts
+++ b/packages/core/src/docs/data-model/text-x/text-x.ts
@@ -29,7 +29,7 @@ function onlyHasDataStream(body: IDocumentBody) {
export type TPriority = 'left' | 'right';
export class TextX {
- static name = 'text-x';
+ // static name = 'text-x';
static id = 'text-x';
@@ -310,3 +310,8 @@ export class TextX {
return this;
}
}
+
+// FIXME: @Jocs, Use to avoid storybook error. and move the static name property to here.
+Object.defineProperty(TextX, 'name', {
+ value: 'text-x',
+});