@pdfme/ui 1.0.16 → 1.0.18

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/ui",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "author": "hand-dot",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -44,6 +44,9 @@ const DeleteButton = ({ activeElements: aes }: { activeElements: HTMLElement[] }
44
44
  fontWeight: 'bold',
45
45
  borderRadius: 2,
46
46
  background: 'rgb(68, 170, 255)',
47
+ display: 'flex',
48
+ alignItems: 'center',
49
+ justifyContent: 'center',
47
50
  }}
48
51
  >
49
52
  <svg
@@ -51,10 +54,10 @@ const DeleteButton = ({ activeElements: aes }: { activeElements: HTMLElement[] }
51
54
  xmlns="http://www.w3.org/2000/svg"
52
55
  fill="none"
53
56
  viewBox="0 0 24 24"
54
- stroke-width="1.5"
57
+ strokeWidth="1.5"
55
58
  stroke="currentColor"
56
59
  >
57
- <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
60
+ <path strokeLinecap="round" strokeLinejoin="round" d="M6 18L18 6M6 6l12 12" />
58
61
  </svg>
59
62
  </button>
60
63
  );
@@ -118,7 +118,7 @@ const TemplateEditor = ({
118
118
 
119
119
  return schemasList[pageCursor].filter((s) => ids.includes(s.id));
120
120
  };
121
- const timeTavel = (mode: 'undo' | 'redo') => {
121
+ const timeTravel = (mode: 'undo' | 'redo') => {
122
122
  const isUndo = mode === 'undo';
123
123
  const stack = isUndo ? past : future;
124
124
  if (stack.current.length <= 0) return;
@@ -160,8 +160,8 @@ const TemplateEditor = ({
160
160
  onEdit(pasteSchemas.map((s) => document.getElementById(s.id)!));
161
161
  copiedSchemas.current = pasteSchemas;
162
162
  },
163
- redo: () => timeTavel('redo'),
164
- undo: () => timeTavel('undo'),
163
+ redo: () => timeTravel('redo'),
164
+ undo: () => timeTravel('undo'),
165
165
  save: () => onSaveTemplate && onSaveTemplate(modifiedTemplate),
166
166
  remove: () => removeSchemas(getActiveSchemas().map((s) => s.id)),
167
167
  esc: onEditEnd,
@@ -20,7 +20,7 @@ const TextSchemaUI = (
20
20
  padding: 0,
21
21
  resize: 'none',
22
22
  position: 'absolute',
23
- fontFamily: schema.fontName ?? 'inherit',
23
+ fontFamily: schema.fontName ? `'${schema.fontName}'` : 'inherit',
24
24
  height: schema.height * ZOOM,
25
25
  // Increase the width by 1 point. (0.75 pixels)
26
26
  width: (schema.width + (schema.characterSpacing ?? DEFAULT_CHARACTER_SPACING) * 0.75) * ZOOM,
package/src/hooks.ts CHANGED
@@ -12,7 +12,8 @@ export const usePrevious = <T>(value: T) => {
12
12
  return ref.current;
13
13
  };
14
14
 
15
- const getScale = (n: number, paper: number) => (n / paper > 1 ? 1 : n / paper);
15
+ const getScale = (n: number, paper: number) =>
16
+ Math.floor((n / paper > 1 ? 1 : n / paper) * 100) / 100;
16
17
 
17
18
  type UIPreProcessorProps = { template: Template; size: Size; zoomLevel: number };
18
19