onSelect(null)}
+ style={{
+ position: 'relative',
+ width: '100%',
+ aspectRatio: landscape ? String(A4_RATIO) : String(1 / A4_RATIO),
+ background: '#ffffff',
+ border: '1px solid var(--mantine-color-gray-4)',
+ overflow: 'hidden',
+ // Blocks are positioned against this box, so it must not be static.
+ touchAction: 'none',
+ }}
+ >
+ {backgroundUrl && (
+
+ )}
+
+ {logoUrl && (
+
+ )}
+
+ {placements.map((block) => {
+ const isSelected = block.id === selectedId;
+ return (
+ startDrag(event, block, 'move')}
+ onKeyDown={(event) => handleKeyDown(event, block)}
+ style={{
+ position: 'absolute',
+ left: `${block.xPct}%`,
+ top: `${block.yPct}%`,
+ width: `${block.widthPct}%`,
+ fontSize: block.fontSize ?? 14,
+ fontWeight: block.fontWeight ?? 'normal',
+ textAlign: block.align ?? 'left',
+ color: block.color ?? '#111111',
+ cursor: disabled ? 'default' : 'move',
+ outline: isSelected
+ ? '2px solid var(--mantine-color-blue-6)'
+ : '1px dashed var(--mantine-color-gray-5)',
+ background: isSelected ? 'rgba(34,139,230,0.06)' : 'transparent',
+ boxSizing: 'border-box',
+ padding: 2,
+ lineHeight: 1.3,
+ wordWrap: 'break-word',
+ userSelect: 'none',
+ }}
+ >
+ {block.variable ? `{{${block.variable}}}` : block.text || ' '}
+
+ {isSelected && !disabled && (
+ startDrag(event, block, 'resize')}
+ style={{
+ position: 'absolute',
+ right: -4,
+ top: '50%',
+ transform: 'translateY(-50%)',
+ width: 8,
+ height: 18,
+ borderRadius: 2,
+ background: 'var(--mantine-color-blue-6)',
+ cursor: 'ew-resize',
+ }}
+ />
+ )}
+
+ );
+ })}
+
+