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(docs-drawing): expose TextWrappingStyle through Facade (#7385)

Univerf23c9ee81e5c
diff --git a/packages/docs-drawing/src/facade/__tests__/f-document-image.spec.ts b/packages/docs-drawing/src/facade/__tests__/f-document-image.spec.ts
index 6136112e97..d8af48363b 100644
--- a/packages/docs-drawing/src/facade/__tests__/f-document-image.spec.ts
+++ b/packages/docs-drawing/src/facade/__tests__/f-document-image.spec.ts
@@ -25,6 +25,7 @@ import {
ObjectRelativeFromV,
PositionedObjectLayoutType,
} from '@univerjs/core';
+import { FEnum } from '@univerjs/core/facade';
import { DocSelectionManagerService } from '@univerjs/docs';
import { IDocDrawingService, TextWrappingStyle, UpdateDocDrawingWrappingStyleCommand } from '@univerjs/docs-drawing';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
@@ -62,6 +63,11 @@ describe('FDocument image facade', () => {
vi.restoreAllMocks();
});
+ it('exposes TextWrappingStyle under its Facade signature name', () => {
+ expect(FEnum.get().TextWrappingStyle).toBe(TextWrappingStyle);
+ expect(FEnum.get()).not.toHaveProperty('DocsImageWrappingStyle');
+ });
+
it('inserts an image with optional transform and text range options', async () => {
const positionH: IObjectPositionH = {
relativeFrom: ObjectRelativeFromH.MARGIN,
diff --git a/packages/docs-drawing/src/facade/f-document-image.ts b/packages/docs-drawing/src/facade/f-document-image.ts
index df90e4c61e..731a3ab93c 100644
--- a/packages/docs-drawing/src/facade/f-document-image.ts
+++ b/packages/docs-drawing/src/facade/f-document-image.ts
@@ -301,7 +301,7 @@ export class FDocumentImage {
*
* if (image) {
* // Float the image beside body text without covering it.
- * const success = image.setWrappingStyle(univerAPI.Enum.DocsImageWrappingStyle.WRAP_SQUARE);
+ * const success = image.setWrappingStyle(univerAPI.Enum.TextWrappingStyle.WRAP_SQUARE);
* console.log(success);
* }
* ```
diff --git a/packages/docs-drawing/src/facade/f-document.ts b/packages/docs-drawing/src/facade/f-document.ts
index f48c1b2eb0..7c931428a2 100644
--- a/packages/docs-drawing/src/facade/f-document.ts
+++ b/packages/docs-drawing/src/facade/f-document.ts
@@ -90,7 +90,7 @@ export interface IFDocumentImageMixin {
* imageSourceType: univerAPI.Enum.ImageSourceType.URL,
* width: 320,
* // Keep the image in the text flow so it cannot cover surrounding text.
- * wrappingStyle: univerAPI.Enum.DocsImageWrappingStyle.INLINE,
+ * wrappingStyle: univerAPI.Enum.TextWrappingStyle.INLINE,
* textRange: {
* startOffset: 30,
* },
@@ -106,7 +106,7 @@ export interface IFDocumentImageMixin {
* imageSourceType: univerAPI.Enum.ImageSourceType.URL,
* width: 320,
* // Float the image and let body text flow beside its rectangular bounds.
- * wrappingStyle: univerAPI.Enum.DocsImageWrappingStyle.WRAP_SQUARE,
+ * wrappingStyle: univerAPI.Enum.TextWrappingStyle.WRAP_SQUARE,
* textRange: {
* startOffset: 30,
* },
diff --git a/packages/docs-drawing/src/facade/f-enum.ts b/packages/docs-drawing/src/facade/f-enum.ts
index 67e67a3a78..a8c3dbb067 100644
--- a/packages/docs-drawing/src/facade/f-enum.ts
+++ b/packages/docs-drawing/src/facade/f-enum.ts
@@ -23,10 +23,11 @@ import { TextWrappingStyle } from '@univerjs/docs-drawing';
*/
export interface IFDocumentImageEnumMixin {
/**
- * Represents the wrapping styles used by docs image operations.
+ * Represents the text wrapping styles used by document drawings, including images and Shapes.
*
* Prefer `INLINE`, `WRAP_SQUARE`, or `WRAP_TOP_AND_BOTTOM` for ordinary document content.
* `BEHIND_TEXT` and `IN_FRONT_OF_TEXT` are overlay styles that do not cause text to reflow.
+ * Use this property whenever a Facade signature references `TextWrappingStyle`.
* @example
* ```ts
* const fDocument = univerAPI.getActiveDocument();
@@ -35,7 +36,7 @@ export interface IFDocumentImageEnumMixin {
* imageSourceType: univerAPI.Enum.ImageSourceType.URL,
* width: 320,
* // Float the image and wrap body text around its rectangular bounds.
- * wrappingStyle: univerAPI.Enum.DocsImageWrappingStyle.WRAP_SQUARE,
+ * wrappingStyle: univerAPI.Enum.TextWrappingStyle.WRAP_SQUARE,
* textRange: {
* startOffset: 30,
* },
@@ -43,7 +44,7 @@ export interface IFDocumentImageEnumMixin {
* console.log(image);
* ```
*/
- DocsImageWrappingStyle: typeof TextWrappingStyle;
+ TextWrappingStyle: typeof TextWrappingStyle;
/**
* Represents the horizontal position types used by docs image operations.
@@ -83,7 +84,7 @@ export interface IFDocumentImageEnumMixin {
}
export class FDocumentImageEnumMixin extends FEnum implements IFDocumentImageEnumMixin {
- override get DocsImageWrappingStyle(): typeof TextWrappingStyle {
+ override get TextWrappingStyle(): typeof TextWrappingStyle {
return TextWrappingStyle;
}