labellife-design-tool 2.4.2 → 2.4.3

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.
@@ -1381,8 +1381,10 @@ var TextElementComponent = observer(function (_ref) {
1381
1381
  var cssFontWeight = String(element.fontWeight || 'normal');
1382
1382
  var originalText = element.text;
1383
1383
  var textarea = document.createElement('textarea');
1384
- textarea.value = '';
1385
- textarea.placeholder = originalText;
1384
+ textarea.value = originalText;
1385
+ // Only show the dimmed placeholder hint when there's no real text yet
1386
+ // (e.g. a freshly-added text element) — not when editing existing text.
1387
+ textarea.placeholder = originalText ? '' : element.placeholder;
1386
1388
  textarea.style.position = 'absolute';
1387
1389
  textarea.style.top = "".concat(textPosition.y, "px");
1388
1390
  textarea.style.left = "".concat(textPosition.x, "px");
@@ -1422,12 +1424,14 @@ var TextElementComponent = observer(function (_ref) {
1422
1424
  stageContainer.appendChild(placeholderStyle);
1423
1425
  stageContainer.appendChild(textarea);
1424
1426
  textarea.focus();
1427
+ var caretPos = textarea.value.length;
1428
+ textarea.setSelectionRange(caretPos, caretPos);
1425
1429
  var removed = false;
1426
1430
  var removeTextarea = function removeTextarea() {
1427
1431
  var cancel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1428
1432
  if (removed) return;
1429
1433
  removed = true;
1430
- var newText = !cancel && textarea.value.length > 0 ? textarea.value : originalText;
1434
+ var newText = cancel ? originalText : textarea.value;
1431
1435
  element.set({
1432
1436
  text: newText
1433
1437
  });