Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用@antv/x6-plugin-clipboard插件且useLocalStorage开启时,希望支持设置LocalStorage的key #4218

Open
favorite58 opened this issue Feb 28, 2024 · 1 comment

Comments

@favorite58
Copy link

功能描述

在一个项目中存在多个不同类型的画布,且都使用了复制粘贴功能(useLocalStorage开启)时,可能会存在因为插件中默认的LocalStorage的key相同导致拿到非本画布的剪切板数据,从而导致报错;

期望解决方案

在new Clipboard时提供配置项设置useLocalStorage存储的key

@whinc
Copy link

whinc commented Mar 13, 2024

附议,我也遇到类似问题,A和B 两个画布的节点 shape 不同,开启 useLocalStorage 后从 A 画布复制节点到 B 画布时,会报错。这里有几个提议供参考:

  1. useLocalStorage 目前存储时,storage key 是固定的,value 是被复制节点的数据,期望支持设置 storage 的 key 类似 [key: string]: nodes,或者 value 中再划分一层,支持按用户自定义的 key 存储,类似 'x6.clipboard.cells': { [key: string]: nodes}
  2. 暴露 storage 的序列化和反序列化的钩子函数,以便应用层在复制和粘贴时,有机会对数据进行校验和加工处理,例如校验数据是否处于有效期、是否格式正确等等,不通过时则可以忽略加载数据或删除数据
  3. 暴露 Storage 的读写 API,并支持异步读写,以便应用侧自定义后端存储,例如使用 SessionStorage、IndexDB、或者 web server 实现云端复制粘贴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants