feat: support folder, note, and model drag-and-drop from sidebar as context references (#25771)
* feat(ui): add drag-to-reorder for pinned notes in sidebar * feat(chat): support folder, note, and model drag-and-drop from sidebar as context references --------- Co-authored-by: Tim Baek <tim@openwebui.com>
This commit is contained in:
1 parent
b617d56c60
commit
f53ec857c0
3 files changed
+65
-1
No files matched your search
@@ -18,6 +18,15 @@
|
||||
if (pinnedModelsList && !$mobile) {
|
||||
new Sortable(pinnedModelsList, {
|
||||
animation: 150,
|
||||
setData: function (dataTransfer, dragEl) {
|
||||
dataTransfer.setData(
|
||||
'text/plain',
|
||||
JSON.stringify({
|
||||
type: 'model',
|
||||
id: dragEl.dataset.id
|
||||
})
|
||||
);
|
||||
},
|
||||
onUpdate: async (event) => {
|
||||
const modelId = event.item.dataset.id;
|
||||
const newIndex = event.newIndex;
|
||||
|
||||
@@ -54,6 +54,16 @@
|
||||
<div
|
||||
class="flex items-center text-gray-800 dark:text-gray-200 cursor-grab relative group rounded-xl px-2.5 py-1.5 hover:bg-gray-100 dark:hover:bg-gray-900 transition"
|
||||
data-id={note.id}
|
||||
draggable="true"
|
||||
on:dragstart={(e) => {
|
||||
e.dataTransfer.setData(
|
||||
'text/plain',
|
||||
JSON.stringify({
|
||||
type: 'note',
|
||||
id: note.id
|
||||
})
|
||||
);
|
||||
}}
|
||||
>
|
||||
<a
|
||||
class="grow flex items-center gap-2.5 text-sm"
|
||||
|
||||
Reference in new issue
Block a user