From 79e1455e4ba4f4a7d04a483dda1a354e53921a69 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 04 十一月 2020 19:04:14 +0800 Subject: [PATCH] 2020-11-04 --- src/menu/components/card/cardcellcomponent/dragaction/index.jsx | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/src/menu/components/card/cardcellcomponent/dragaction/index.jsx b/src/menu/components/card/cardcellcomponent/dragaction/index.jsx index 845cedf..49267a8 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/index.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/index.jsx @@ -4,6 +4,7 @@ import update from 'immutability-helper' import Card from './card' +import Utils from '@/utils/utils.js' import Action from './action' import './index.scss' @@ -30,6 +31,38 @@ const editCard = id => { const { card } = findCard(id) handleMenu(card) + } + + const copyCard = id => { + const { card, index: overIndex } = findCard(id) + let copycard = fromJS(card).toJS() + + copycard.uuid = Utils.getuuid() + copycard.copyType = 'customCardElement' + copycard.focus = true + + let _val = '' + + try { + _val = window.btoa(window.encodeURIComponent(JSON.stringify(copycard))) + } catch { + console.warn('Stringify Failure') + _val = '' + } + + if (_val) { + let oInput = document.createElement('input') + oInput.value = _val + document.body.appendChild(oInput) + oInput.select() + document.execCommand('Copy') + document.body.removeChild(oInput) + } + + const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] }) + + handleList(_cards) + handleMenu(copycard) } const changeStyle = id => { @@ -88,6 +121,7 @@ cardIds={cardIds} card={card} moveCard={moveCard} + copyCard={copyCard} editCard={editCard} changeStyle={changeStyle} delCard={delCard} -- Gitblit v1.8.0