Skip to content

Commit 1b98505

Browse files
Merge pull request #1919 from iamfaran/feat/1903-editmode-util
[Feat] #1903 editmode util JS
2 parents d086fb7 + 09164f7 commit 1b98505

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

client/packages/lowcoder/src/comps/hooks/utilsComp.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { logoutAction } from "redux/reduxActions/userActions";
1010
import StoreRegistry from "@lowcoder-ee/redux/store/storeRegistry";
1111
import UserApi from "@lowcoder-ee/api/userApi";
1212
import { messageInstance } from "components/GlobalInstances";
13+
import { isEditMode } from "../utils/globalSettings";
1314

1415
const UtilsCompBase = simpleMultiComp({});
1516
export let UtilsComp = withExposingConfigs(UtilsCompBase, []);
@@ -30,6 +31,16 @@ interface DownloadFileOptions {
3031
}
3132

3233
UtilsComp = withMethodExposing(UtilsComp, [
34+
{
35+
method: {
36+
name: "isEditMode",
37+
description: trans("utilsComp.isEditMode"),
38+
params: [],
39+
},
40+
execute: (comp, params) => {
41+
return isEditMode();
42+
},
43+
},
3344
{
3445
method: {
3546
name: "openUrl",

client/packages/lowcoder/src/comps/utils/globalSettings.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ export function setGlobalSettings(patch: GlobalSettings) {
1919
export function getGlobalSettings() {
2020
return globalSettings;
2121
}
22+
23+
24+
export function isEditMode(): boolean {
25+
// Edit mode is when we're not in view mode
26+
return globalSettings.isViewMode !== true;
27+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy