mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-08 22:54:09 +08:00
feat: 移除插件内收藏栏
This commit is contained in:
parent
a1e627ae5b
commit
cce8116bb1
@ -6,13 +6,11 @@
|
||||
(id !== 'collect' &&
|
||||
id !== 'view' &&
|
||||
id !== 'open-folder' &&
|
||||
id !== 'un-collect' &&
|
||||
id !== 'word-break' &&
|
||||
id !== 'save-file') ||
|
||||
(id === 'collect' && item.collect !== true) ||
|
||||
(id === 'view' && !isFullData) ||
|
||||
(id === 'open-folder' && item.type === 'file') ||
|
||||
(id === 'un-collect' && item.collect === true) ||
|
||||
(id === 'save-file' && isFullData && item.type !== 'file') ||
|
||||
(id === 'word-break' &&
|
||||
isFullData &&
|
||||
@ -47,12 +45,16 @@ const operation = [
|
||||
{ id: 'view', title: '查看全部', icon: '💬' },
|
||||
{ id: 'open-folder', title: '打开文件夹', icon: '📁' },
|
||||
{ id: 'collect', title: '收藏', icon: '⭐' },
|
||||
{ id: 'un-collect', title: '取消收藏', icon: '📤' },
|
||||
{ id: 'word-break', title: '分词', icon: '💣' },
|
||||
{ id: 'save-file', title: '保存', icon: '💾' },
|
||||
{ id: 'remove', title: '删除', icon: '❌' }
|
||||
]
|
||||
const handleOperateClick = ({ id, item }) => {
|
||||
const typeMap = {
|
||||
text: 'text',
|
||||
file: 'files',
|
||||
image: 'img'
|
||||
}
|
||||
switch (id) {
|
||||
case 'copy':
|
||||
window.copy(item, false)
|
||||
@ -63,30 +65,23 @@ const handleOperateClick = ({ id, item }) => {
|
||||
case 'open-folder':
|
||||
const { data } = item
|
||||
const fl = JSON.parse(data)
|
||||
window.openFileFolder(fl[0].path) // 取第一个文件的路径打开
|
||||
utools.shellShowItemInFolder(fl[0].path) // 取第一个文件的路径打开
|
||||
break
|
||||
case 'collect':
|
||||
item.collect = true
|
||||
window.db.updateDataBaseLocal(db)
|
||||
utools.redirect('添加到「备忘快贴」', {
|
||||
type: typeMap[item.type],
|
||||
data: item.data
|
||||
})
|
||||
break
|
||||
case 'word-break':
|
||||
utools.redirect('超级分词', item.data)
|
||||
break
|
||||
case 'save-file':
|
||||
const typeMap = {
|
||||
text: 'text',
|
||||
file: 'files',
|
||||
image: 'img'
|
||||
}
|
||||
utools.redirect('收集文件', {
|
||||
type: typeMap[item.type],
|
||||
data: item.data
|
||||
})
|
||||
break
|
||||
case 'un-collect':
|
||||
item.collect = undefined
|
||||
window.db.updateDataBaseLocal(db)
|
||||
break
|
||||
case 'remove':
|
||||
window.remove(item)
|
||||
emit('onDataRemove')
|
||||
|
@ -21,8 +21,7 @@ const tabs = ref([
|
||||
{ name: '📚 全部', type: 'all' },
|
||||
{ name: '📋 文字', type: 'text' },
|
||||
{ name: '⛺ 图片', type: 'image' },
|
||||
{ name: '📂 文件', type: 'file' },
|
||||
{ name: '⭐ 收藏', type: 'collect' }
|
||||
{ name: '📂 文件', type: 'file' }
|
||||
])
|
||||
const activeTab = ref('all')
|
||||
const emit = defineEmits(['onNavClick'])
|
||||
|
@ -156,9 +156,7 @@ const textFilterCallBack = (item) => {
|
||||
const updateShowList = (type) => {
|
||||
// 更新显示列表
|
||||
showList.value = list.value
|
||||
.filter((item) =>
|
||||
type === 'collect' ? item.collect === true : type === 'all' ? item : item.type === type
|
||||
) // 是 collect则返回所有收藏 否则按照 type返回
|
||||
.filter((item) => (type === 'all' ? item : item.type === type)) // 是 all则返回所有 否则按照 type返回
|
||||
.filter((item) => (filterText.value ? item.type !== 'image' : item)) // 有过滤词 排除掉图片 DataURL
|
||||
.filter((item) => textFilterCallBack(item))
|
||||
.slice(0, GAP) // 重新切分懒加载列表
|
||||
|
Loading…
x
Reference in New Issue
Block a user