11/// Define the paragraph related structs and enums
22use serde:: { Deserialize , Serialize } ;
3+
4+ #[ cfg( feature = "jsbindings" ) ]
35use tsify:: Tsify ;
6+ #[ cfg( feature = "jsbindings" ) ]
47use wasm_bindgen:: prelude:: wasm_bindgen;
58
69use crate :: tokens:: ControlWord ;
710
811#[ derive( Debug , Default , Clone , Copy , PartialEq , Hash , Deserialize , Serialize ) ]
9- #[ wasm_bindgen]
12+ #[ cfg_attr ( feature = "jsbindings" , wasm_bindgen) ]
1013pub struct Paragraph {
1114 pub alignment : Alignment ,
1215 pub spacing : Spacing ,
@@ -15,8 +18,8 @@ pub struct Paragraph {
1518}
1619
1720/// Alignement of a paragraph (left, right, center, justify)
18- #[ derive( Debug , Default , Clone , Copy , PartialEq , Hash , Deserialize , Serialize , Tsify ) ]
19- #[ tsify( into_wasm_abi, from_wasm_abi) ]
21+ #[ derive( Debug , Default , Clone , Copy , PartialEq , Hash , Deserialize , Serialize ) ]
22+ #[ cfg_attr ( feature = "jsbindings" , derive ( Tsify ) , tsify( into_wasm_abi, from_wasm_abi) ) ]
2023pub enum Alignment {
2124 #[ default]
2225 LeftAligned , // \ql
@@ -39,16 +42,16 @@ impl From<&ControlWord<'_>> for Alignment {
3942
4043/// The vertical margin before / after a block of text
4144#[ derive( Debug , Default , Clone , Copy , PartialEq , Hash , Deserialize , Serialize ) ]
42- #[ wasm_bindgen]
45+ #[ cfg_attr ( feature = "jsbindings" , wasm_bindgen) ]
4346pub struct Spacing {
4447 pub before : i32 ,
4548 pub after : i32 ,
4649 pub between_line : SpaceBetweenLine ,
4750 pub line_multiplier : i32 ,
4851}
4952
50- #[ derive( Default , Debug , Clone , Copy , PartialEq , Hash , Deserialize , Serialize , Tsify ) ]
51- #[ tsify( into_wasm_abi, from_wasm_abi) ]
53+ #[ derive( Default , Debug , Clone , Copy , PartialEq , Hash , Deserialize , Serialize ) ]
54+ #[ cfg_attr ( feature = "jsbindings" , derive ( Tsify ) , tsify( into_wasm_abi, from_wasm_abi) ) ]
5255pub enum SpaceBetweenLine {
5356 Value ( i32 ) ,
5457 #[ default]
@@ -72,7 +75,7 @@ impl From<i32> for SpaceBetweenLine {
7275
7376// This struct can not be an enum because left-indent and right-ident can both be defined at the same time
7477#[ derive( Default , Debug , Clone , Copy , PartialEq , Hash , Deserialize , Serialize ) ]
75- #[ wasm_bindgen]
78+ #[ cfg_attr ( feature = "jsbindings" , wasm_bindgen) ]
7679pub struct Indentation {
7780 pub left : i32 ,
7881 pub right : i32 ,
0 commit comments