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/),
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)
- [Breaking] make docGrid optional

View File

@ -56,6 +56,7 @@ export type ParagraphProperty = {
left: number;
specialIndentKind?: SpecialIndentKind;
specialIndentSize?: number;
right?: number;
};
numbering?: {
id: number;
@ -221,7 +222,12 @@ export const setParagraphProperty = <T extends wasm.Paragraph | wasm.Style>(
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") {

View File

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

View File

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

View File

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