feat: fetch for the assistant with Поиск on - a page's main text for the model, the server's own network out of reach; shorter words in Настройки and the chat; the + menu's roots a step left. Also files from panes into the chat, docview and drag fixes (by the user)
This commit is contained in:
1 parent
84b42c5369
commit
ae8fffe7d8
17 files changed
+712
-102
No files matched your search
@@ -19,6 +19,9 @@
|
||||
// start: a pointerdown on a row of pane; the drag begins past 6px.
|
||||
function start(ev, pane, tr) {
|
||||
if (ev.button !== 0 || ev.target.closest('input, button, a, .act')) return;
|
||||
// Keep the file pane's pointer drag as the only drag source. Otherwise
|
||||
// the browser can start a native text-selection drag beside our ghost.
|
||||
ev.preventDefault();
|
||||
const name = tr.dataset.name;
|
||||
const names = pane.selected.has(name) ? [...pane.selected] : [name];
|
||||
d = {pane, names, x0: ev.clientX, y0: ev.clientY, id: ev.pointerId, on: false,
|
||||
@@ -56,6 +59,7 @@
|
||||
d.target = null;
|
||||
box.hidden = true;
|
||||
d.ghost.dataset.hint = '';
|
||||
if (window.AIChat) window.AIChat.setDragging(false);
|
||||
// Over a tab's title: it opens after half a second.
|
||||
const tab = Workspace.tabAt(ev.clientX, ev.clientY);
|
||||
if (tab !== d.overTab) {
|
||||
@@ -64,6 +68,11 @@
|
||||
if (tab) d.tabTimer = setTimeout(() => { if (d && d.overTab === tab) Workspace.activate(tab); }, 500);
|
||||
}
|
||||
if (tab) { d.ghost.dataset.hint = 'открыть вкладку'; return; }
|
||||
if (window.AIChat && window.AIChat.isDropTargetAt(ev.clientX, ev.clientY)) {
|
||||
window.AIChat.setDragging(true);
|
||||
d.target = {kind: 'ai'};
|
||||
return;
|
||||
}
|
||||
const pane = Workspace.paneAt(ev.clientX, ev.clientY);
|
||||
if (!pane || !pane.dropTarget) return;
|
||||
const t = pane.dropTarget(ev.clientX, ev.clientY);
|
||||
@@ -87,14 +96,23 @@
|
||||
x.ghost.remove();
|
||||
box.hidden = true;
|
||||
document.body.classList.remove('dnd');
|
||||
if (window.AIChat) window.AIChat.setDragging(false);
|
||||
justDropped = true;
|
||||
setTimeout(() => { justDropped = false; }, 0);
|
||||
if (cancel || !x.target) return;
|
||||
if (x.target.kind === 'ai') { window.AIChat.dropFiles(x.pane, x.names); return; }
|
||||
const {pane, t, a} = x.target;
|
||||
Workspace.setActivePane(pane);
|
||||
if (a.kind === 'paste') pane.drop(x.item);
|
||||
else if (a.kind === 'transfer') ask(x.item, x.pane, t, ev.clientX, ev.clientY);
|
||||
}
|
||||
// While FileDnD owns the pointer, never let the browser start a second,
|
||||
// native drag (for example from the SVG icon or the filename under it).
|
||||
document.addEventListener('dragstart', ev => {
|
||||
if (!d) return;
|
||||
ev.preventDefault();
|
||||
ev.stopImmediatePropagation();
|
||||
}, true);
|
||||
window.addEventListener('pointermove', move);
|
||||
window.addEventListener('pointerup', ev => end(ev));
|
||||
window.addEventListener('pointercancel', ev => end(ev, true));
|
||||
|
||||
Reference in new issue
Block a user