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.
package/dist/esm/index.js CHANGED
@@ -11489,8 +11489,10 @@ var TextElementComponent = observer(function (_ref) {
11489
11489
  var cssFontWeight = String(element.fontWeight || 'normal');
11490
11490
  var originalText = element.text;
11491
11491
  var textarea = document.createElement('textarea');
11492
- textarea.value = '';
11493
- textarea.placeholder = originalText;
11492
+ textarea.value = originalText;
11493
+ // Only show the dimmed placeholder hint when there's no real text yet
11494
+ // (e.g. a freshly-added text element) — not when editing existing text.
11495
+ textarea.placeholder = originalText ? '' : element.placeholder;
11494
11496
  textarea.style.position = 'absolute';
11495
11497
  textarea.style.top = "".concat(textPosition.y, "px");
11496
11498
  textarea.style.left = "".concat(textPosition.x, "px");
@@ -11530,12 +11532,14 @@ var TextElementComponent = observer(function (_ref) {
11530
11532
  stageContainer.appendChild(placeholderStyle);
11531
11533
  stageContainer.appendChild(textarea);
11532
11534
  textarea.focus();
11535
+ var caretPos = textarea.value.length;
11536
+ textarea.setSelectionRange(caretPos, caretPos);
11533
11537
  var removed = false;
11534
11538
  var removeTextarea = function removeTextarea() {
11535
11539
  var cancel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
11536
11540
  if (removed) return;
11537
11541
  removed = true;
11538
- var newText = !cancel && textarea.value.length > 0 ? textarea.value : originalText;
11542
+ var newText = cancel ? originalText : textarea.value;
11539
11543
  element.set({
11540
11544
  text: newText
11541
11545
  });