-
Notifications
You must be signed in to change notification settings - Fork 187
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
优化代码编辑体验,仅在切换模式时同步文件 AST 信息 #188
Conversation
if (view === 'dual') { | ||
this.setActiveSidebarPanel(''); | ||
this.toggleRightPanel(false); | ||
this.toggleIsPreview(true); | ||
workspace2editor(); | ||
} else if (view === 'design') { | ||
this.toggleIsPreview(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
切回设计视图的时候,默认不激活 RightPanel,在用户点击画布节点的时候(use-dnd onClick)中可以自动激活下 RightPanel ?
packages/core/src/factory.ts
Outdated
designer: new Designer({ | ||
workspace, | ||
editor: editorState, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
目前相当于存在 工作区文件和 IDE 文件两种文件,在切换的时候做一次 clear 文件再同步
考虑 API 兼容的话,从关系上是不是 editor 注入在 workspace 中合适一些
workspace >> editor >> designer,API 也可以默认走 workspace,原有的 setActiveFile/CRUD File 相关 API 可以内部判断设计器状态来抹平
例如单边使用的场景:纯使用可视化面板/纯使用 IDE,在最终提交代码的时候消费哪个 API ?
onCancel: () => {}, | ||
}); | ||
} | ||
editorState.updateFile({ filename: path, code: value }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此处直接更新,在 editor2workspace 的时候,如果是错误的代码,在 workspace 重新 addFile的时候会不会有问题(导致设计视图白屏)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
此处可以在切换模式的时候增加 ErrorBoundary-- 提示用户是否代码错误
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feature
code -> design
:EditorState --snyc--> Workspace
design -> code
:Workspace --sync--> EditorState