@blocklet/pages-kit-block-studio 0.5.11 → 0.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -46,6 +46,7 @@ const Session_1 = require("@arcblock/did-connect/lib/Session");
|
|
|
46
46
|
const Config_1 = require("@arcblock/ux/lib/Config");
|
|
47
47
|
const Empty_1 = __importDefault(require("@arcblock/ux/lib/Empty"));
|
|
48
48
|
const context_1 = require("@arcblock/ux/lib/Locale/context");
|
|
49
|
+
const Theme_1 = require("@arcblock/ux/lib/Theme");
|
|
49
50
|
const Toast_1 = __importStar(require("@arcblock/ux/lib/Toast"));
|
|
50
51
|
const js_sdk_1 = require("@blocklet/js-sdk");
|
|
51
52
|
const theme_1 = require("@blocklet/pages-kit-inner-components/theme");
|
|
@@ -152,7 +153,7 @@ function Layout({ loadState, loadedData }) {
|
|
|
152
153
|
simulatorType: 'pc',
|
|
153
154
|
iframeLoaded: false,
|
|
154
155
|
});
|
|
155
|
-
const { theme, mode,
|
|
156
|
+
const { theme, mode, changeMode } = (0, Config_1.useConfig)();
|
|
156
157
|
// 添加renderComponentTrigger状态,用于触发组件重新渲染
|
|
157
158
|
const [renderComponentTrigger, setRenderComponentTrigger] = (0, react_1.useState)(0);
|
|
158
159
|
const [hSizes, setHSizes] = (0, ahooks_1.useLocalStorageState)('BlockStudioHorizontalSizes', {
|
|
@@ -377,13 +378,13 @@ function Layout({ loadState, loadedData }) {
|
|
|
377
378
|
}
|
|
378
379
|
if (event.data && event.data.type === 'TOGGLE_MODE') {
|
|
379
380
|
if (mode !== event.data.data.mode) {
|
|
380
|
-
|
|
381
|
+
changeMode(event.data.data.mode);
|
|
381
382
|
}
|
|
382
383
|
}
|
|
383
384
|
};
|
|
384
385
|
window.addEventListener('message', handleMessage);
|
|
385
386
|
return () => window.removeEventListener('message', handleMessage);
|
|
386
|
-
}, []);
|
|
387
|
+
}, [changeMode, mode]);
|
|
387
388
|
const leftPanelContent = (0, react_1.useMemo)(() => {
|
|
388
389
|
if (state.draggingSplitPane) {
|
|
389
390
|
return DraggingSplitPlaceholder;
|
|
@@ -445,7 +446,7 @@ function Layout({ loadState, loadedData }) {
|
|
|
445
446
|
const url = new URL(window.location.href);
|
|
446
447
|
const initialComponentId = url.searchParams.get('componentId') || state.metadata.id;
|
|
447
448
|
const initialLocale = url.searchParams.get('locale') || locale || 'en';
|
|
448
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Box, { className: "custom-component-root", sx: { height: '100%', width: '100%', overflow: 'auto' }, children: (0, jsx_runtime_1.jsx)(
|
|
449
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, { className: "custom-component-root", sx: { height: '100%', width: '100%', overflow: 'auto' }, children: (0, jsx_runtime_1.jsx)(Theme_1.ThemeProvider, { theme: theme, children: (0, jsx_runtime_1.jsx)(react_1.Suspense, { fallback: (0, jsx_runtime_1.jsx)(material_1.CircularProgress, {}), children: (0, jsx_runtime_1.jsx)(components_2.CustomComponentRenderer, { locale: initialLocale, componentId: initialComponentId || state.metadata.id, dev: {
|
|
449
450
|
mode: 'draft',
|
|
450
451
|
components: mergedAllBlocks,
|
|
451
452
|
defaultLocale,
|
|
@@ -612,6 +613,10 @@ function Layout({ loadState, loadedData }) {
|
|
|
612
613
|
state.iframeLoaded,
|
|
613
614
|
locale,
|
|
614
615
|
mode,
|
|
616
|
+
theme,
|
|
617
|
+
JSON.stringify(state.metadata || {}),
|
|
618
|
+
JSON.stringify(mergedAllBlocks || []),
|
|
619
|
+
JSON.stringify(mergedPropertiesValues || {}),
|
|
615
620
|
]);
|
|
616
621
|
const rightPanelContent = (0, react_1.useMemo)(() => {
|
|
617
622
|
if (state.draggingSplitPane) {
|