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