@wendongfly/myhi 1.3.139 → 1.3.140
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/chat.html +17 -6
- package/package.json +1 -1
package/dist/chat.html
CHANGED
|
@@ -746,14 +746,14 @@
|
|
|
746
746
|
</div>
|
|
747
747
|
<!-- 就地新增:不必先在消息框打字再"提取",直接在这儿写 -->
|
|
748
748
|
<div style="border-top:1px solid var(--surface2);padding:0.5rem 0.2rem">
|
|
749
|
-
<textarea id="inbox-new-text" rows="3" spellcheck="false" placeholder="
|
|
749
|
+
<textarea id="inbox-new-text" rows="3" spellcheck="false" placeholder="写下临时想法… 截图可直接 Ctrl+V 粘进来 (能连着记多条)"
|
|
750
750
|
style="width:100%;box-sizing:border-box;background:var(--surface2);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:0.5rem;font-size:0.82rem;resize:vertical"></textarea>
|
|
751
751
|
<div id="inbox-new-img" style="display:none;align-items:center;gap:0.4rem;margin-top:0.35rem;font-size:0.7rem;color:var(--text2)">
|
|
752
752
|
<span>📷</span><span id="inbox-new-img-name" style="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"></span>
|
|
753
753
|
<button class="dr-btn" onclick="clearInboxNewImage()">移除</button>
|
|
754
754
|
</div>
|
|
755
755
|
<div style="display:flex;align-items:center;gap:0.5rem;margin-top:0.45rem;flex-wrap:wrap">
|
|
756
|
-
<button class="dr-btn" onclick="document.getElementById('inbox-new-file').click()">📷
|
|
756
|
+
<button class="dr-btn" onclick="document.getElementById('inbox-new-file').click()" title="也可以直接 Ctrl+V 粘贴截图">📷 选图片</button>
|
|
757
757
|
<input type="file" id="inbox-new-file" accept="image/*" style="display:none"
|
|
758
758
|
onchange="uploadInboxImage(this.files[0]); this.value='';">
|
|
759
759
|
<label style="display:flex;align-items:center;gap:0.3rem;font-size:0.7rem;color:var(--muted);cursor:pointer">
|
|
@@ -3581,18 +3581,20 @@
|
|
|
3581
3581
|
if (box) box.style.display = 'none';
|
|
3582
3582
|
};
|
|
3583
3583
|
|
|
3584
|
-
|
|
3584
|
+
// file 可能来自文件选择器,也可能是 Ctrl+V 粘贴来的 blob(后者 name 常为空)
|
|
3585
|
+
window.uploadInboxImage = async function(file, fallbackName) {
|
|
3585
3586
|
if (!file) return;
|
|
3587
|
+
const name = file.name || fallbackName || 'paste.png';
|
|
3586
3588
|
const box = document.getElementById('inbox-new-img');
|
|
3587
3589
|
const nameEl = document.getElementById('inbox-new-img-name');
|
|
3588
3590
|
box.style.display = 'flex';
|
|
3589
|
-
nameEl.textContent = '上传中… ' +
|
|
3591
|
+
nameEl.textContent = '上传中… ' + name;
|
|
3590
3592
|
try {
|
|
3591
3593
|
const form = new FormData();
|
|
3592
|
-
form.append('image', file,
|
|
3594
|
+
form.append('image', file, name);
|
|
3593
3595
|
const r = await fetch(`/upload?sessionId=${SESSION_ID}`, { method: 'POST', body: form });
|
|
3594
3596
|
const d = await r.json();
|
|
3595
|
-
if (d.path) { _inboxNewImage = { path: d.path, name
|
|
3597
|
+
if (d.path) { _inboxNewImage = { path: d.path, name }; nameEl.textContent = name; }
|
|
3596
3598
|
else { _inboxNewImage = null; nameEl.textContent = '上传失败:' + (d.error || '未知'); }
|
|
3597
3599
|
} catch (e) {
|
|
3598
3600
|
_inboxNewImage = null;
|
|
@@ -4654,6 +4656,15 @@
|
|
|
4654
4656
|
const blob = item.getAsFile();
|
|
4655
4657
|
if (!blob) continue;
|
|
4656
4658
|
e.preventDefault(); // 阻止浏览器把图片当文本塞进 textarea
|
|
4659
|
+
// 草稿箱抽屉开着 → 截图归草稿,而不是塞进下面的消息框
|
|
4660
|
+
// (记草稿时配图的常见姿势就是"截个图 Ctrl+V",不是去文件选择器里翻)
|
|
4661
|
+
if (document.getElementById('inbox-sheet')?.classList.contains('open')) {
|
|
4662
|
+
try {
|
|
4663
|
+
await window.uploadInboxImage(blob, 'paste.png');
|
|
4664
|
+
document.getElementById('inbox-new-text')?.focus();
|
|
4665
|
+
} catch (err) { addStatusMessage('上传失败: ' + err.message); }
|
|
4666
|
+
return;
|
|
4667
|
+
}
|
|
4657
4668
|
addStatusMessage('粘贴图片上传中...');
|
|
4658
4669
|
try {
|
|
4659
4670
|
await uploadImageBlob(blob, 'paste.png');
|
package/package.json
CHANGED