@blocklet/pages-kit-block-studio 0.5.26 → 0.5.28
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.
|
@@ -164,6 +164,11 @@ function Layout({ loadState, loadedData }) {
|
|
|
164
164
|
const location = (0, react_router_dom_1.useLocation)();
|
|
165
165
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
166
166
|
const staticData = (0, client_1.useStaticData)();
|
|
167
|
+
// 获取当前URL参数判断是否是在iframe内
|
|
168
|
+
const isInsideIframe = (0, react_1.useMemo)(() => {
|
|
169
|
+
const url = new URL(window.location.href);
|
|
170
|
+
return url.searchParams.get('simulator') === '1';
|
|
171
|
+
}, [window.location.href]);
|
|
167
172
|
(0, ahooks_2.useUpdateEffect)(() => {
|
|
168
173
|
const iframe = document.querySelector('#preview-iframe');
|
|
169
174
|
if (iframe && iframe.contentWindow) {
|
|
@@ -261,8 +266,9 @@ function Layout({ loadState, loadedData }) {
|
|
|
261
266
|
}
|
|
262
267
|
}, { wait: 500 });
|
|
263
268
|
(0, react_1.useEffect)(() => {
|
|
264
|
-
|
|
265
|
-
|
|
269
|
+
if (!isInsideIframe)
|
|
270
|
+
debouncedUpdateMetadata.run(state.metadata);
|
|
271
|
+
}, [state.metadata, debouncedUpdateMetadata, isInsideIframe]);
|
|
266
272
|
const mergedAllBlocks = (0, react_1.useMemo)(() => {
|
|
267
273
|
// Add all staticData code and importPath mappings
|
|
268
274
|
if (import.meta.env.DEV) {
|
|
@@ -355,11 +361,6 @@ function Layout({ loadState, loadedData }) {
|
|
|
355
361
|
url.searchParams.set('locale', locale || defaultLocale || 'en');
|
|
356
362
|
return url.toString();
|
|
357
363
|
}, [window.location.href, state.metadata.id, locale, defaultLocale]);
|
|
358
|
-
// 获取当前URL参数判断是否是在iframe内
|
|
359
|
-
const isInsideIframe = (0, react_1.useMemo)(() => {
|
|
360
|
-
const url = new URL(window.location.href);
|
|
361
|
-
return url.searchParams.get('simulator') === '1';
|
|
362
|
-
}, [window.location.href]);
|
|
363
364
|
// 添加消息事件监听
|
|
364
365
|
(0, react_1.useEffect)(() => {
|
|
365
366
|
const handleMessage = (event) => {
|