fix(ags): close clipboard when copying old item
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-07-14 16:26:07 -04:00
parent c4095afd16
commit cc2329ec67
2 changed files with 14 additions and 8 deletions

View file

@ -105,6 +105,7 @@ export default tseslint.config(
selector: [ selector: [
'import', 'import',
'objectLiteralProperty', 'objectLiteralProperty',
'objectLiteralMethod',
'typeProperty', 'typeProperty',
], ],
format: null, format: null,
@ -124,7 +125,6 @@ export default tseslint.config(
'classProperty', 'classProperty',
'typeProperty', 'typeProperty',
'classMethod', 'classMethod',
'objectLiteralMethod',
'typeMethod', 'typeMethod',
'accessor', 'accessor',
'enumMember', 'enumMember',

View file

@ -23,7 +23,10 @@ export default () => {
class_name: 'item', class_name: 'item',
name: key.toString(), name: key.toString(),
on_primary_click_release: () => Clipboard.copyOldItem(key), on_primary_click_release: () => {
Clipboard.copyOldItem(key);
App.closeWindow('win-clipboard');
},
child: Box({ child: Box({
children: [ children: [
@ -52,19 +55,22 @@ export default () => {
class_name: 'clipboard', class_name: 'clipboard',
transition: 'slide top', transition: 'slide top',
on_select: (r) => Clipboard.copyOldItem(getKey(r)), on_select: (r) => {
Clipboard.copyOldItem(getKey(r));
App.closeWindow('win-clipboard');
},
init_rows: (list) => { init_rows: (list) => {
Clipboard.getHistory(); Clipboard.getHistory();
const connectId = Clipboard.connect('history-searched', () => { const CONNECT_ID = Clipboard.connect('history-searched', () => {
list.get_children().forEach((row) => { list.get_children().forEach((row) => {
row.destroy(); row.destroy();
}); });
Clipboard.clips.forEach((clip, key) => { Clipboard.clips.forEach((clip, key) => {
makeItem(list, key, clip.clip, clip.isImage); makeItem(list, key, clip.clip, clip.isImage);
}); });
Clipboard.disconnect(connectId); Clipboard.disconnect(CONNECT_ID);
}); });
}, },
@ -81,10 +87,10 @@ export default () => {
fzfResults = fzf.find(text); fzfResults = fzf.find(text);
list.set_sort_func((a, b) => { list.set_sort_func((a, b) => {
const row1 = fzfResults.find((f) => f.item[0] === getKey(a))?.score ?? 0; const ROW_1 = fzfResults.find((f) => f.item[0] === getKey(a))?.score ?? 0;
const row2 = fzfResults.find((f) => f.item[0] === getKey(b))?.score ?? 0; const ROW_2 = fzfResults.find((f) => f.item[0] === getKey(b))?.score ?? 0;
return row2 - row1; return ROW_2 - ROW_1;
}); });
} }
}, },