opensumi / ide-electron

OpenSumi Electron Version
https://opensumi.com
MIT License
171 stars 56 forks source link

react-beautiful-dnd 拖拽库的使用问题 #85

Closed zt6991 closed 4 months ago

zt6991 commented 1 year ago

目前需要在opensumi里增加拖拽功能,使用到了react-beautiful-dnd库。因为拖拽的范围包括整个页面,所以需要使用react-beautiful-dnd 的组件包裹需要拖拽的组件。我要修改哪个文件才能将整个页面在呢。

下面是react-beautiful-dnd的组件关系 53607406-c8f3a780-3c12-11e9-979c-7f3b5bd1bfbd react-beautiful-dnd的github地址 https://github.com/atlassian/react-beautiful-dnd

bytemain commented 1 year ago

可以结合自定义视图的能力来做:https://opensumi.com/zh/docs/integrate/universal-integrate-case/custom-view/

参考代码:https://github.com/opensumi/opensumi-module-samples/blob/main/modules/custom-toolbar/browser/custom-layout.tsx#L7

代码这一行返回的整个的页面布局,你可以将需要全局包裹的放这里。

image
zt6991 commented 1 year ago

好咧,谢谢回复。我试试

zt6991 commented 1 year ago

目前已经在custom-layout加上了,自定义视图的运行正常。就是编辑器里的拖拽模型显示有问题。就是一片空白。 界面效果图 1687331484080

Uncaught Error: Could not find "store" in the context of "Connect(Droppable)". Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to Connect(Droppable) in connect options. Error: Could not find "store" in the context of "Connect(Droppable)". Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to Connect(Droppable) in connect options. at ConnectFunction (bundle.js:591738:15) at renderWithHooks (bundle.js:578326:18) at mountIndeterminateComponent (bundle.js:581005:13) at beginWork (bundle.js:582119:16) at HTMLUnknownElement.callCallback (bundle.js:563711:14) at Object.invokeGuardedCallbackDev (bundle.js:563760:16) at invokeGuardedCallback (bundle.js:563815:31) at beginWork$1 (bundle.js:586726:7) at performUnitOfWork (bundle.js:585680:12) at workLoopSync (bundle.js:585653:22) at bundle.js:212961:27

bytemain commented 1 year ago

这个报错看起来是 Redux 报错了,OpenSumi 内部没有使用 Redux,你可以检查下你的代码?

zt6991 commented 1 year ago

嗯嗯,好的。主要是代码写的都差不多。其他视图都正常,就是编辑器里有问题。