coxpit 5.26.2 → 5.26.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cockpit.ts +12 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coxpit",
3
- "version": "5.26.2",
3
+ "version": "5.26.3",
4
4
  "description": "Self-hosted cockpit for running a fleet of AI coding agents across your own machines — parallel worktree runs, live board, compare & merge, web terminal, design capture.",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
package/src/cockpit.ts CHANGED
@@ -776,9 +776,19 @@ export const COCKPIT_HTML = /* html */ `<!doctype html>
776
776
  }catch(e){}
777
777
  // 복사 배선: xterm 은 user-select:none 이라 네이티브 선택이 없다 → term.getSelection() 을 직접 클립보드로.
778
778
  // ① 드래그 놓으면 자동 복사(select-to-copy) ② Cmd/Ctrl+C 로도 복사(선택 없으면 통과 → SIGINT).
779
+ // 복사: clipboard API 우선(HTTPS·PWA), 실패하면 execCommand 폴백(iOS 포함). 항상 토스트로 확인.
780
+ var copyFallback=function(s){ var ok=false;
781
+ try{ var ta=document.createElement('textarea'); ta.value=s; ta.setAttribute('readonly',''); ta.contentEditable='true';
782
+ ta.style.position='fixed'; ta.style.top='-9999px'; ta.style.opacity='0'; document.body.appendChild(ta);
783
+ var r=document.createRange(); r.selectNodeContents(ta); var sel=window.getSelection(); sel.removeAllRanges(); sel.addRange(r);
784
+ try{ ta.setSelectionRange(0, s.length); }catch(e){}
785
+ ok=document.execCommand('copy'); document.body.removeChild(ta);
786
+ }catch(e){ ok=false; }
787
+ toast(ok?('복사됨 · '+s.length+'자'):'복사 실패 — 브라우저가 클립보드를 막았어요'); };
779
788
  var copySel=function(){ var s=''; try{ s=term.getSelection(); }catch(e){} if(!s) return false;
780
- try{ if(navigator.clipboard&&navigator.clipboard.writeText) navigator.clipboard.writeText(s); }catch(e){}
781
- try{ var ta=document.createElement('textarea'); ta.value=s; ta.style.position='fixed'; ta.style.opacity='0'; document.body.appendChild(ta); ta.select(); document.execCommand('copy'); document.body.removeChild(ta); }catch(e){}
789
+ if(navigator.clipboard && navigator.clipboard.writeText){
790
+ navigator.clipboard.writeText(s).then(function(){ toast('복사됨 · '+s.length+''); }).catch(function(){ copyFallback(s); });
791
+ } else { copyFallback(s); }
782
792
  return true; };
783
793
  host.addEventListener('mouseup', function(){ copySel(); });
784
794
  host.addEventListener('touchend', function(){ copySel(); });