Skip to content

Commit b5ca00c

Browse files
committed
fix: added GEOContext
1 parent d69969d commit b5ca00c

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

src/GEOComp.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { useResizeDetector } from "react-resize-detector";
2424
// @ts-ignore
2525
import Notification from 'ol-ext/control/Notification'
2626
import { featureControl } from './FeaturesControl';
27+
import { geoContext } from './GeoContext';
2728

2829
export const CompStyles = [
2930
{
@@ -517,8 +518,10 @@ GEOComp = withMethodExposing(GEOComp, [
517518
// @ts-ignore
518519
data = JSON.parse(data)
519520
}
520-
521-
521+
for (const [key, value] of Object.entries(data)) {
522+
console.log(key, comp.children[key])
523+
//comp.children[key].value(value)
524+
}
522525
} catch (e) {
523526
console.error("Failed to parse config data", e)
524527
}
@@ -536,10 +539,14 @@ GEOComp = withMethodExposing(GEOComp, [
536539
]
537540
},
538541
execute: (comp: any, params: any) => {
539-
const data = comp.toJsonValue();
540-
console.debug(JSON.stringify(data, null))
542+
var data = comp.toJsonValue();
543+
delete data.onEvent
544+
data = params[0] !== true ? data : JSON.stringify(data, null)
545+
// @ts-ignore
546+
if (geoContext.previewMode)
547+
console.debug(data)
541548
//Event config needs to be added
542-
return params[0] === true ? JSON.stringify(data, null) : data
549+
return data
543550
}
544551
},
545552
]);

src/GEOContext.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const geoContext = {
2+
previewMode: document.lowcoderdev
3+
}

src/vendors/helpers/useScreenSize.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// useScreenSize.js
2+
import { geoContext } from '../../GeoContext';
23
import { useState, useLayoutEffect } from 'react';
34

45
export function useScreenSize() {
@@ -8,7 +9,7 @@ export function useScreenSize() {
89
});
910

1011
//Should not be added in dev
11-
if (!document.lowcoderdev)
12+
if (!geoContext.previewMode)
1213
useLayoutEffect(() => {
1314
const handleResize = function () {
1415
const rec = {

0 commit comments

Comments
 (0)