Support indent right (#632)

* fix: support indent right for js

* fix
main
bokuweb 2023-06-16 13:43:26 +09:00 committed by GitHub
parent a2e135d50e
commit 45b58dc3b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 5 deletions

View File

@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## docx-wasm@0.0.278-rc7 (19. Jun, 2023)
- Support indent right for js
## docx-wasm@0.0.278-rc6 (19. Jun, 2023) ## docx-wasm@0.0.278-rc6 (19. Jun, 2023)
- [Breaking] make docGrid optional - [Breaking] make docGrid optional

View File

@ -56,6 +56,7 @@ export type ParagraphProperty = {
left: number; left: number;
specialIndentKind?: SpecialIndentKind; specialIndentKind?: SpecialIndentKind;
specialIndentSize?: number; specialIndentSize?: number;
right?: number;
}; };
numbering?: { numbering?: {
id: number; id: number;
@ -221,7 +222,12 @@ export const setParagraphProperty = <T extends wasm.Paragraph | wasm.Style>(
break; break;
} }
} }
target = target.indent(indent.left, kind, indent.specialIndentSize) as T; target = target.indent(
indent.left,
kind,
indent.specialIndentSize,
indent.right
) as T;
} }
if (typeof property.numbering !== "undefined") { if (typeof property.numbering !== "undefined") {

View File

@ -83,9 +83,15 @@ export class Paragraph {
indent( indent(
left: number, left: number,
specialIndentKind?: SpecialIndentKind, specialIndentKind?: SpecialIndentKind,
specialIndentSize?: number specialIndentSize?: number,
right?: number
) { ) {
this.property.indent = { left, specialIndentKind, specialIndentSize }; this.property.indent = {
left,
specialIndentKind,
specialIndentSize,
right,
};
return this; return this;
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "docx-wasm", "name": "docx-wasm",
"version": "0.0.278-rc6", "version": "0.0.278-rc7",
"main": "dist/node/index.js", "main": "dist/node/index.js",
"browser": "dist/web/index.js", "browser": "dist/web/index.js",
"author": "bokuweb <bokuweb12@gmail.com>", "author": "bokuweb <bokuweb12@gmail.com>",

View File

@ -146,12 +146,13 @@ impl Paragraph {
left: i32, left: i32,
special_indent_kind: Option<docx_rs::SpecialIndentKind>, special_indent_kind: Option<docx_rs::SpecialIndentKind>,
special_indent_size: Option<i32>, special_indent_size: Option<i32>,
right: Option<i32>,
) -> Paragraph { ) -> Paragraph {
let special_indent = create_special_indent(special_indent_kind, special_indent_size); let special_indent = create_special_indent(special_indent_kind, special_indent_size);
self.0.property = self self.0.property = self
.0 .0
.property .property
.indent(Some(left), special_indent, None, None); .indent(Some(left), special_indent, right, None);
self self
} }