@yurikilian/lex4 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,7 +59,10 @@ const A4_HEIGHT_MM = 297;
59
59
  const PX_PER_MM = 96 / 25.4;
60
60
  const A4_WIDTH_PX = Math.round(A4_WIDTH_MM * PX_PER_MM);
61
61
  const A4_HEIGHT_PX = Math.round(A4_HEIGHT_MM * PX_PER_MM);
62
- const PAGE_MARGIN_PX = 40;
62
+ const PAGE_MARGIN_TOP_PX = Math.round(30 * PX_PER_MM);
63
+ const PAGE_MARGIN_BOTTOM_PX = Math.round(30 * PX_PER_MM);
64
+ const PAGE_MARGIN_LEFT_PX = Math.round(30 * PX_PER_MM);
65
+ const PAGE_MARGIN_RIGHT_PX = Math.round(30 * PX_PER_MM);
63
66
  const MAX_HEADER_RATIO = 0.2;
64
67
  const MAX_FOOTER_RATIO = 0.2;
65
68
  const MAX_HEADER_HEIGHT_PX = Math.round(A4_HEIGHT_PX * MAX_HEADER_RATIO);
@@ -2532,7 +2535,7 @@ const ToolbarIconButton = ({
2532
2535
  );
2533
2536
  const Divider = () => /* @__PURE__ */ jsx("div", { className: "lex4-toolbar-separator" });
2534
2537
  function computeBodyHeight(headerHeight, footerHeight) {
2535
- const verticalMargins = PAGE_MARGIN_PX * 2;
2538
+ const verticalMargins = PAGE_MARGIN_TOP_PX + PAGE_MARGIN_BOTTOM_PX;
2536
2539
  return A4_HEIGHT_PX - headerHeight - footerHeight - verticalMargins;
2537
2540
  }
2538
2541
  function getTopLevelNodes(state) {
@@ -4064,7 +4067,10 @@ const PageView = React.memo(({
4064
4067
  style: {
4065
4068
  width: A4_WIDTH_PX,
4066
4069
  height: A4_HEIGHT_PX,
4067
- padding: PAGE_MARGIN_PX
4070
+ paddingTop: PAGE_MARGIN_TOP_PX,
4071
+ paddingBottom: PAGE_MARGIN_BOTTOM_PX,
4072
+ paddingLeft: PAGE_MARGIN_LEFT_PX,
4073
+ paddingRight: PAGE_MARGIN_RIGHT_PX
4068
4074
  },
4069
4075
  "data-testid": `page-${pageIndex}`,
4070
4076
  "data-page-id": pageId,
@@ -4544,7 +4550,10 @@ function mapEditorStateToBlocks(state) {
4544
4550
  }
4545
4551
  return mapBlockNodes(state.root.children);
4546
4552
  }
4547
- const MARGIN_MM = Math.round(PAGE_MARGIN_PX / PX_PER_MM * 10) / 10;
4553
+ const MARGIN_TOP_MM = Math.round(PAGE_MARGIN_TOP_PX / PX_PER_MM * 10) / 10;
4554
+ const MARGIN_BOTTOM_MM = Math.round(PAGE_MARGIN_BOTTOM_PX / PX_PER_MM * 10) / 10;
4555
+ const MARGIN_LEFT_MM = Math.round(PAGE_MARGIN_LEFT_PX / PX_PER_MM * 10) / 10;
4556
+ const MARGIN_RIGHT_MM = Math.round(PAGE_MARGIN_RIGHT_PX / PX_PER_MM * 10) / 10;
4548
4557
  function serializeDocument(document2, variableDefinitions = []) {
4549
4558
  const pages = document2.pages.map(
4550
4559
  (page, index) => serializePage(page, index)
@@ -4557,10 +4566,10 @@ function serializeDocument(document2, variableDefinitions = []) {
4557
4566
  widthMm: 210,
4558
4567
  heightMm: 297,
4559
4568
  margins: {
4560
- topMm: MARGIN_MM,
4561
- rightMm: MARGIN_MM,
4562
- bottomMm: MARGIN_MM,
4563
- leftMm: MARGIN_MM
4569
+ topMm: MARGIN_TOP_MM,
4570
+ rightMm: MARGIN_RIGHT_MM,
4571
+ bottomMm: MARGIN_BOTTOM_MM,
4572
+ leftMm: MARGIN_LEFT_MM
4564
4573
  }
4565
4574
  },
4566
4575
  headerFooter: {