Files
docx-js/src/file/drawing/text-wrap/wrap-square.ts
dependabot[bot] 2381ba8a05 build(deps-dev): bump eslint from 8.57.1 to 9.13.0 (#2792)
* build(deps-dev): bump eslint from 8.57.1 to 9.13.0

Bumps [eslint](https://github.com/eslint/eslint) from 8.57.1 to 9.13.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.57.1...v9.13.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Upgrade EsLint

* Fix all new lint errors

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dolan Miu <dolan_miu@hotmail.com>
2024-10-21 03:57:15 +01:00

45 lines
1.2 KiB
TypeScript

// http://officeopenxml.com/drwPicFloating-textWrap.php
import { XmlAttributeComponent, XmlComponent } from "@file/xml-components";
import { IDistance } from "../drawing";
import { IMargins } from "../floating";
import { ITextWrapping, TextWrappingSide } from "./text-wrapping";
type IWrapSquareAttributes = {
readonly wrapText?: (typeof TextWrappingSide)[keyof typeof TextWrappingSide];
} & IDistance;
class WrapSquareAttributes extends XmlAttributeComponent<IWrapSquareAttributes> {
protected readonly xmlKeys = {
distT: "distT",
distB: "distB",
distL: "distL",
distR: "distR",
wrapText: "wrapText",
};
}
export class WrapSquare extends XmlComponent {
public constructor(
textWrapping: ITextWrapping,
margins: IMargins = {
top: 0,
bottom: 0,
left: 0,
right: 0,
},
) {
super("wp:wrapSquare");
this.root.push(
new WrapSquareAttributes({
wrapText: textWrapping.side || TextWrappingSide.BOTH_SIDES,
distT: margins.top,
distB: margins.bottom,
distL: margins.left,
distR: margins.right,
}),
);
}
}