feat: 清空剪贴板

This commit is contained in:
MTrun 2022-02-04 13:22:00 +08:00
parent c3096ed486
commit 5e2f0ab6df
2 changed files with 32 additions and 13 deletions

View File

@ -56,7 +56,8 @@ import {
DicomOverlay as DicomOverlayIcon, DicomOverlay as DicomOverlayIcon,
UpToTop as UpToTopIcon, UpToTop as UpToTopIcon,
DownToBottom as DownToBottomIcon, DownToBottom as DownToBottomIcon,
StackedMove as StackedMoveIcon StackedMove as StackedMoveIcon,
PaintBrush as PaintBrushIcon
} from '@vicons/carbon' } from '@vicons/carbon'
const ionicons5 = { const ionicons5 = {
@ -171,7 +172,9 @@ const carbon = {
// 置底 // 置底
DownToBottomIcon, DownToBottomIcon,
// 移动 // 移动
StackedMoveIcon StackedMoveIcon,
// 清空剪切板(刷子)
PaintBrushIcon
} }
// https://www.xicons.org/#/ 还有很多 // https://www.xicons.org/#/ 还有很多

View File

@ -4,8 +4,15 @@ import { CreateComponentType } from '@/packages/index.d'
import { renderIcon, loadingError } from '@/utils' import { renderIcon, loadingError } from '@/utils'
import { icon } from '@/plugins' import { icon } from '@/plugins'
const { CopyIcon, CutIcon, ClipboardOutlineIcon, TrashIcon, ChevronDownIcon, ChevronUpIcon } = icon.ionicons5 const {
const { UpToTopIcon, DownToBottomIcon } = icon.carbon CopyIcon,
CutIcon,
ClipboardOutlineIcon,
TrashIcon,
ChevronDownIcon,
ChevronUpIcon
} = icon.ionicons5
const { UpToTopIcon, DownToBottomIcon, PaintBrushIcon } = icon.carbon
const chartEditStore = useChartEditStoreStore() const chartEditStore = useChartEditStoreStore()
@ -17,7 +24,8 @@ export enum MenuEnum {
TOP = 'top', TOP = 'top',
BOTTOM = 'bottom', BOTTOM = 'bottom',
UP = 'up', UP = 'up',
DOWN = 'down' DOWN = 'down',
CLEAR = 'clear'
} }
export interface MenuOptionsItemType { export interface MenuOptionsItemType {
@ -26,6 +34,8 @@ export interface MenuOptionsItemType {
key: MenuEnum | string key: MenuEnum | string
icon?: Function icon?: Function
fnHandle?: Function fnHandle?: Function
disabled?: boolean
hidden?: boolean
} }
// * 默认选项 // * 默认选项
@ -34,19 +44,19 @@ const defaultOptions: MenuOptionsItemType[] = [
label: '复制', label: '复制',
key: MenuEnum.COPY, key: MenuEnum.COPY,
icon: renderIcon(CopyIcon), icon: renderIcon(CopyIcon),
fnHandle: chartEditStore.setCopy fnHandle: chartEditStore.setCopy,
}, },
{ {
label: '剪切', label: '剪切',
key: MenuEnum.CUT, key: MenuEnum.CUT,
icon: renderIcon(CutIcon), icon: renderIcon(CutIcon),
fnHandle: chartEditStore.setCut fnHandle: chartEditStore.setCut,
}, },
{ {
label: '粘贴', label: '粘贴',
key: MenuEnum.PARSE, key: MenuEnum.PARSE,
icon: renderIcon(ClipboardOutlineIcon), icon: renderIcon(ClipboardOutlineIcon),
fnHandle: chartEditStore.setParse fnHandle: chartEditStore.setParse,
}, },
{ {
type: 'divider', type: 'divider',
@ -56,35 +66,41 @@ const defaultOptions: MenuOptionsItemType[] = [
label: '置顶', label: '置顶',
key: MenuEnum.TOP, key: MenuEnum.TOP,
icon: renderIcon(UpToTopIcon), icon: renderIcon(UpToTopIcon),
fnHandle: chartEditStore.setTop fnHandle: chartEditStore.setTop,
}, },
{ {
label: '置底', label: '置底',
key: MenuEnum.BOTTOM, key: MenuEnum.BOTTOM,
icon: renderIcon(DownToBottomIcon), icon: renderIcon(DownToBottomIcon),
fnHandle: chartEditStore.setBottom fnHandle: chartEditStore.setBottom,
}, },
{ {
label: '上移一层', label: '上移一层',
key: MenuEnum.UP, key: MenuEnum.UP,
icon: renderIcon(ChevronUpIcon), icon: renderIcon(ChevronUpIcon),
fnHandle: chartEditStore.setUp fnHandle: chartEditStore.setUp,
}, },
{ {
label: '下移一层', label: '下移一层',
key: MenuEnum.DOWN, key: MenuEnum.DOWN,
icon: renderIcon(ChevronDownIcon), icon: renderIcon(ChevronDownIcon),
fnHandle: chartEditStore.setDown fnHandle: chartEditStore.setDown,
}, },
{ {
type: 'divider', type: 'divider',
key: 'd2' key: 'd2'
}, },
{
label: '清空剪贴板',
key: MenuEnum.CLEAR,
icon: renderIcon(PaintBrushIcon),
fnHandle: chartEditStore.setRecordChart,
},
{ {
label: '删除', label: '删除',
key: MenuEnum.DELETE, key: MenuEnum.DELETE,
icon: renderIcon(TrashIcon), icon: renderIcon(TrashIcon),
fnHandle: chartEditStore.removeComponentList fnHandle: chartEditStore.removeComponentList,
} }
] ]