mirror of
https://github.com/45Drives/cockpit-navigator.git
synced 2025-07-31 01:24:37 +02:00
make clipboard a Ref<Array> instead of reactive
This commit is contained in:
parent
33dce5c1bf
commit
b3050e5578
@ -92,7 +92,7 @@ If not, see <https://www.gnu.org/licenses/>.
|
||||
<template v-if="selection.length === 0">
|
||||
<!-- Current directory actions -->
|
||||
<div
|
||||
v-if="clipboard.content.length"
|
||||
v-if="clipboard.length"
|
||||
class="flex flex-col items-stretch"
|
||||
>
|
||||
<button
|
||||
@ -101,8 +101,8 @@ If not, see <https://www.gnu.org/licenses/>.
|
||||
>
|
||||
<ClipboardIcon class="size-icon icon-default" />
|
||||
<span>
|
||||
Paste {{ clipboard.content.length }}
|
||||
item{{ clipboard.content.length > 1 ? 's' : '' }}
|
||||
Paste {{ clipboard.length }}
|
||||
item{{ clipboard.length > 1 ? 's' : '' }}
|
||||
here
|
||||
</span>
|
||||
</button>
|
||||
@ -189,14 +189,14 @@ If not, see <https://www.gnu.org/licenses/>.
|
||||
<span>Copy directory</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="clipboard.content.length"
|
||||
v-if="clipboard.length"
|
||||
class="context-menu-button"
|
||||
@click="$emit('directoryViewAction', 'paste', selection[0])"
|
||||
>
|
||||
<ClipboardIcon class="size-icon icon-default" />
|
||||
<span>
|
||||
Paste {{ clipboard.content.length }}
|
||||
item{{ clipboard.content.length > 1 ? 's' : '' }} into directory
|
||||
Paste {{ clipboard.length }}
|
||||
item{{ clipboard.length > 1 ? 's' : '' }} into directory
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -151,7 +151,7 @@ export default {
|
||||
return; // changed directory before could finish
|
||||
}
|
||||
const selectedIds = gatherEntries([], false).filter(entry => entry.selected).map(entry => entry.uniqueId);
|
||||
const clipboardIds = clipboard.content.map(item => item.uniqueId);
|
||||
const clipboardIds = clipboard.value.map(item => item.uniqueId);
|
||||
tmpEntries.map(entry => {
|
||||
entry.selected = selectedIds.includes(entry.uniqueId);
|
||||
entry.cut = clipboardIds.includes(entry.uniqueId);
|
||||
|
@ -372,11 +372,11 @@ export default {
|
||||
};
|
||||
});
|
||||
if (append)
|
||||
clipboard.content = [...newContent, ...clipboard.content].filter((a, index, arr) => arr.findIndex(b => b.uniqueId === a.uniqueId) === index);
|
||||
clipboard.value = [...newContent, ...clipboard.value].filter((a, index, arr) => arr.findIndex(b => b.uniqueId === a.uniqueId) === index);
|
||||
else
|
||||
clipboard.content = newContent;
|
||||
clipboard.value = newContent;
|
||||
const message = append
|
||||
? `Added ${newContent.length} items to clipboard.\n(${clipboard.content.length} items total)`
|
||||
? `Added ${newContent.length} items to clipboard.\n(${clipboard.value.length} items total)`
|
||||
: `${cut ? 'Cut' : 'Copied'} ${newContent.length} items to clipboard.`;
|
||||
notifications.value.constructNotification('Clipboard', message, 'info', 2000);
|
||||
}
|
||||
@ -395,8 +395,8 @@ export default {
|
||||
notifications.value.constructNotification("Paste Failed", 'Cannot paste to multiple directories.', 'error');
|
||||
return;
|
||||
}
|
||||
console.log("paste", clipboard.content, destination);
|
||||
const fullSources = [...clipboard.content];
|
||||
console.log("paste", clipboard.value, destination);
|
||||
const fullSources = [...clipboard.value];
|
||||
const { common } = commonPath(fullSources.map(item => item.path));
|
||||
const groupedByHost = fullSources.reduce((res, item) => {
|
||||
if (!res[item.host])
|
||||
@ -421,9 +421,9 @@ export default {
|
||||
break;
|
||||
case 'escape':
|
||||
if (getSelected().length === 0) {
|
||||
if (clipboard.content.length) {
|
||||
if (clipboard.value.length) {
|
||||
unCutEntries();
|
||||
clipboard.content = [];
|
||||
clipboard.value = [];
|
||||
notifications.value.constructNotification('Clipboard', 'Cleared clipboard.', 'info', 2000);
|
||||
}
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user