Feat:新增禁止读取和写入用户剪贴板的实例化选项
This commit is contained in:
parent
35c8e129f0
commit
e8c4aad690
@ -221,6 +221,8 @@ export const defaultOpt = {
|
|||||||
createNodePrefixContent: null,
|
createNodePrefixContent: null,
|
||||||
// 添加附加的节点后置内容,后置内容指和文本同一行的区域中的后置内容,不包括节点图片部分
|
// 添加附加的节点后置内容,后置内容指和文本同一行的区域中的后置内容,不包括节点图片部分
|
||||||
createNodePostfixContent: null,
|
createNodePostfixContent: null,
|
||||||
|
// 禁止粘贴用户剪贴板中的数据,禁止将复制的数据写入用户的剪贴板中
|
||||||
|
disabledClipboard: false,
|
||||||
|
|
||||||
// 【Select插件】
|
// 【Select插件】
|
||||||
// 多选节点时鼠标移动到边缘时的画布移动偏移量
|
// 多选节点时鼠标移动到边缘时的画布移动偏移量
|
||||||
|
|||||||
@ -1013,14 +1013,18 @@ class Render {
|
|||||||
copy() {
|
copy() {
|
||||||
this.beingCopyData = this.copyNode()
|
this.beingCopyData = this.copyNode()
|
||||||
if (!this.beingCopyData) return
|
if (!this.beingCopyData) return
|
||||||
setDataToClipboard(createSmmFormatData(this.beingCopyData))
|
if (!this.mindMap.opt.disabledClipboard) {
|
||||||
|
setDataToClipboard(createSmmFormatData(this.beingCopyData))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 剪切节点
|
// 剪切节点
|
||||||
cut() {
|
cut() {
|
||||||
this.mindMap.execCommand('CUT_NODE', copyData => {
|
this.mindMap.execCommand('CUT_NODE', copyData => {
|
||||||
this.beingCopyData = copyData
|
this.beingCopyData = copyData
|
||||||
setDataToClipboard(createSmmFormatData(copyData))
|
if (!this.mindMap.opt.disabledClipboard) {
|
||||||
|
setDataToClipboard(createSmmFormatData(copyData))
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1029,17 +1033,20 @@ class Render {
|
|||||||
const {
|
const {
|
||||||
errorHandler,
|
errorHandler,
|
||||||
handleIsSplitByWrapOnPasteCreateNewNode,
|
handleIsSplitByWrapOnPasteCreateNewNode,
|
||||||
handleNodePasteImg
|
handleNodePasteImg,
|
||||||
|
disabledClipboard
|
||||||
} = this.mindMap.opt
|
} = this.mindMap.opt
|
||||||
// 读取剪贴板的文字和图片
|
// 读取剪贴板的文字和图片
|
||||||
let text = null
|
let text = ''
|
||||||
let img = null
|
let img = null
|
||||||
try {
|
if (!disabledClipboard) {
|
||||||
const res = await getDataFromClipboard()
|
try {
|
||||||
text = res.text
|
const res = await getDataFromClipboard()
|
||||||
img = res.img
|
text = res.text || ''
|
||||||
} catch (error) {
|
img = res.img || null
|
||||||
errorHandler(ERROR_TYPES.READ_CLIPBOARD_ERROR, error)
|
} catch (error) {
|
||||||
|
errorHandler(ERROR_TYPES.READ_CLIPBOARD_ERROR, error)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 检查剪切板数据是否有变化
|
// 检查剪切板数据是否有变化
|
||||||
// 通过图片大小来判断图片是否发生变化,可能是不准确的,但是目前没有其他好方法
|
// 通过图片大小来判断图片是否发生变化,可能是不准确的,但是目前没有其他好方法
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user