@agentsky/desktop-ui 0.4.236 → 0.4.237

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.
@@ -1568,6 +1568,18 @@ ${mXe}`:mXe,e.head.append(n),t.push(n.outerHTML),t}function mv(e){let t=e.body;f
1568
1568
  event.preventDefault();
1569
1569
  document.execCommand('insertText', false, event.clipboardData.getData('text/plain'));
1570
1570
  }, true);
1571
+ const caretAtPointer = (event, host) => {
1572
+ const selection = document.getSelection();
1573
+ if (!selection || event.detail > 1) return;
1574
+ let point = null;
1575
+ if (document.caretPositionFromPoint) {
1576
+ const position = document.caretPositionFromPoint(event.clientX, event.clientY);
1577
+ if (position) { point = document.createRange(); point.setStart(position.offsetNode, position.offset); point.collapse(true); }
1578
+ } else if (document.caretRangeFromPoint) point = document.caretRangeFromPoint(event.clientX, event.clientY);
1579
+ if (!point || !host.contains(point.startContainer)) return;
1580
+ selection.removeAllRanges();
1581
+ selection.addRange(point);
1582
+ };
1571
1583
  document.addEventListener('click', (event) => {
1572
1584
  if (commenting || event.target.closest('[data-artifact-chrome]')) return;
1573
1585
  const box = event.target.closest('input[type=checkbox][data-todo-id]');
@@ -1582,15 +1594,21 @@ ${mXe}`:mXe,e.head.append(n),t.push(n.outerHTML),t}function mv(e){let t=e.body;f
1582
1594
  if (element.closest('a,button,label,summary,details,input,select,textarea,option,video,audio')) event.preventDefault();
1583
1595
  const root = element.hasAttribute('data-artifact-text-node') ? null : richRoot(element);
1584
1596
  if (enabled && root) {
1597
+ const opening = document.activeElement !== root;
1585
1598
  activate(root);
1586
- if (document.activeElement !== root) root.focus();
1599
+ if (opening) { root.focus(); caretAtPointer(event, root); }
1587
1600
  select(root, root);
1588
1601
  return;
1589
1602
  }
1590
1603
  if (enabled && editable(element)) {
1604
+ // The press landed before the text was editable, so the browser placed
1605
+ // no caret; focus() alone would put it at the start. Put it where the
1606
+ // person clicked, as a second click would.
1607
+ const opening = document.activeElement !== element;
1591
1608
  element.setAttribute('data-artifact-inline', '');
1592
1609
  element.contentEditable = 'plaintext-only';
1593
1610
  element.focus();
1611
+ if (opening) caretAtPointer(event, element);
1594
1612
  } else event.preventDefault();
1595
1613
  const target = element.hasAttribute('data-artifact-text-node') ? element.parentElement : element;
1596
1614
  select(element, target);
@@ -2644,6 +2644,7 @@
2644
2644
  "Loading files…": "正在加载文件…",
2645
2645
  "Loading file…": "正在加载文件…",
2646
2646
  "Loading from GitHub…": "正在从 GitHub 加载…",
2647
+ "Loading page…": "正在加载页面…",
2647
2648
  "Loading goal…": "正在加载目标…",
2648
2649
  "Loading image…": "正在加载图片…",
2649
2650
  "Loading members…": "正在加载成员…",
@@ -6896,5 +6897,8 @@
6896
6897
  "“{name}” is waiting on you": "“{name}”在等你",
6897
6898
  "… [{count} chars elided] …": "… [已省略 {count} 个字符] …",
6898
6899
  "● Notes": "● 笔记",
6899
- "● Using this Mac": "● 正在使用本机"
6900
+ "● Using this Mac": "● 正在使用本机",
6901
+ "Confirm in the chat": "在聊天中确认",
6902
+ "Go back to the chat and send {command} as {who} within 10 minutes. Nothing runs on this account until you do.": "请在 10 分钟内回到聊天,以 {who} 的身份发送 {command}。在此之前,不会有任何任务以这个账户运行。",
6903
+ "This link was posted in a group, so {person} must also confirm it in the chat.": "这个链接是在群聊中发出的,因此 {person} 还需要在聊天中确认。"
6900
6904
  }