@@ -19,6 +19,7 @@ import { ThemeContext } from "comps/utils/themeContext";
19
19
import { ModuleLayoutCompName } from "constants/compConstants" ;
20
20
import { defaultTheme as localDefaultTheme } from "comps/controls/styleControlConstants" ;
21
21
import { ModuleLoading } from "components/ModuleLoading" ;
22
+ import EditorSkeletonView from "pages/editor/editorSkeletonView" ;
22
23
import { getGlobalSettings } from "comps/utils/globalSettings" ;
23
24
import { getCurrentTheme } from "comps/utils/themeUtil" ;
24
25
import { DataChangeResponderListComp } from "./dataChangeResponderComp" ;
@@ -29,10 +30,7 @@ import {
29
30
PropertySectionState ,
30
31
} from "lowcoder-design" ;
31
32
import RefTreeComp from "./refTreeComp" ;
32
-
33
- const EditorSkeletonView = lazy (
34
- ( ) => import ( "pages/editor/editorSkeletonView" )
35
- ) ;
33
+ import { ExternalEditorContext } from "util/context/ExternalEditorContext" ;
36
34
37
35
const EditorView = lazy (
38
36
( ) => import ( "pages/editor/editorView" ) ,
@@ -61,6 +59,7 @@ function RootView(props: RootViewProps) {
61
59
const { comp, isModuleRoot, ...divProps } = props ;
62
60
const [ editorState , setEditorState ] = useState < EditorState > ( ) ;
63
61
const [ propertySectionState , setPropertySectionState ] = useState < PropertySectionState > ( { } ) ;
62
+ const { readOnly } = useContext ( ExternalEditorContext ) ;
64
63
const appThemeId = comp . children . settings . getView ( ) . themeId ;
65
64
const { orgCommonSettings } = getGlobalSettings ( ) ;
66
65
const themeList = orgCommonSettings ?. themeList || [ ] ;
@@ -110,13 +109,15 @@ function RootView(props: RootViewProps) {
110
109
} ;
111
110
} , [ editorState , propertySectionState ] ) ;
112
111
113
- // if (!editorState) {
114
- // if (isModuleRoot) {
115
- // return <ModuleLoading />;
116
- // }
117
- // return <EditorSkeletonView />;
118
- // }
119
- if ( ! editorState ) return < ModuleLoading /> ;
112
+ if ( ! editorState && readOnly ) {
113
+ return < ModuleLoading /> ;
114
+ }
115
+
116
+ const SuspenseFallback = isModuleRoot ? < ModuleLoading /> : < EditorSkeletonView /> ;
117
+
118
+ if ( ! editorState ) {
119
+ return SuspenseFallback ;
120
+ }
120
121
121
122
return (
122
123
< div { ...divProps } >
@@ -126,7 +127,7 @@ function RootView(props: RootViewProps) {
126
127
{ Object . keys ( comp . children . queries . children ) . map ( ( key ) => (
127
128
< div key = { key } > { comp . children . queries . children [ key ] . getView ( ) } </ div >
128
129
) ) }
129
- < Suspense fallback = { null } >
130
+ < Suspense fallback = { ! readOnly && SuspenseFallback } >
130
131
< EditorView uiComp = { comp . children . ui } preloadComp = { comp . children . preload } />
131
132
</ Suspense >
132
133
</ EditorContext . Provider >
0 commit comments