fix: Add end and distribute (#83)
parent
6ed69bdf5d
commit
ada3d55418
|
@ -7,10 +7,12 @@ use super::errors;
|
|||
#[wasm_bindgen]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub enum AlignmentType {
|
||||
Both,
|
||||
Center,
|
||||
Distribute,
|
||||
End,
|
||||
Left,
|
||||
Right,
|
||||
Both,
|
||||
Justified,
|
||||
Unsupported,
|
||||
}
|
||||
|
@ -20,7 +22,9 @@ impl fmt::Display for AlignmentType {
|
|||
match *self {
|
||||
AlignmentType::Center => write!(f, "center"),
|
||||
AlignmentType::Left => write!(f, "left"),
|
||||
AlignmentType::Distribute => write!(f, "distribute"),
|
||||
AlignmentType::Right => write!(f, "right"),
|
||||
AlignmentType::End => write!(f, "end"),
|
||||
AlignmentType::Both => write!(f, "both"),
|
||||
AlignmentType::Justified => write!(f, "justified"),
|
||||
_ => write!(f, "unsupported"),
|
||||
|
@ -34,8 +38,10 @@ impl FromStr for AlignmentType {
|
|||
match s {
|
||||
"left" => Ok(AlignmentType::Left),
|
||||
"right" => Ok(AlignmentType::Right),
|
||||
"distribute" => Ok(AlignmentType::Distribute),
|
||||
"center" => Ok(AlignmentType::Center),
|
||||
"both" => Ok(AlignmentType::Both),
|
||||
"end" => Ok(AlignmentType::End),
|
||||
"justified" => Ok(AlignmentType::Justified),
|
||||
_ => Ok(AlignmentType::Unsupported),
|
||||
}
|
||||
|
|
|
@ -223,6 +223,14 @@ export class Docx {
|
|||
paragraph = paragraph.align(wasm.AlignmentType.Left);
|
||||
break;
|
||||
}
|
||||
case "distribute": {
|
||||
paragraph = paragraph.align(wasm.AlignmentType.Distribute);
|
||||
break;
|
||||
}
|
||||
case "end": {
|
||||
paragraph = paragraph.align(wasm.AlignmentType.End);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof p.property.indent !== "undefined") {
|
||||
|
|
|
@ -15,7 +15,13 @@ export type ParagraphChild =
|
|||
| Comment
|
||||
| CommentEnd;
|
||||
|
||||
export type AlignmentType = "center" | "left" | "right" | "justified";
|
||||
export type AlignmentType =
|
||||
| "center"
|
||||
| "left"
|
||||
| "right"
|
||||
| "justified"
|
||||
| "distribute"
|
||||
| "end";
|
||||
|
||||
export type SpecialIndentKind = "firstLine" | "hanging";
|
||||
|
||||
|
|
Loading…
Reference in New Issue