@webiny/app-website-builder-workflows 6.4.12-beta.2 → 6.4.12-beta.3
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.
- package/Components/PageEditor/PageEditorConfig.js +3 -3
- package/Components/PageEditor/PageEditorConfig.js.map +1 -1
- package/Components/PageEditor/ToggleEditorMode.js +5 -4
- package/Components/PageEditor/ToggleEditorMode.js.map +1 -1
- package/package.json +9 -9
- package/Components/PageEditor/PageEditorLayout.d.ts +0 -2
- package/Components/PageEditor/PageEditorLayout.js +0 -43
- package/Components/PageEditor/PageEditorLayout.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import react from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Plugins } from "@webiny/app";
|
|
3
3
|
import { PageFormWorkflowStateTooltip } from "./PageFormWorkflowStateTooltip.js";
|
|
4
4
|
import { PageFormWorkflowStatePublishButton } from "./PageFormWorkflowStatePublishButton.js";
|
|
5
5
|
import { PageEditorTopBar } from "./PageEditorTopBar.js";
|
|
6
|
-
const
|
|
7
|
-
export {
|
|
6
|
+
const PageEditorConfig = ()=>/*#__PURE__*/ react.createElement(Plugins, null, /*#__PURE__*/ react.createElement(PageEditorTopBar, null), /*#__PURE__*/ react.createElement(PageFormWorkflowStateTooltip, null), /*#__PURE__*/ react.createElement(PageFormWorkflowStatePublishButton, null));
|
|
7
|
+
export { PageEditorConfig };
|
|
8
8
|
|
|
9
9
|
//# sourceMappingURL=PageEditorConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Components/PageEditor/PageEditorConfig.js","sources":["../../../src/Components/PageEditor/PageEditorConfig.tsx"],"sourcesContent":["import React from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"Components/PageEditor/PageEditorConfig.js","sources":["../../../src/Components/PageEditor/PageEditorConfig.tsx"],"sourcesContent":["import React from \"react\";\nimport { Plugins } from \"@webiny/app\";\nimport { PageFormWorkflowStateTooltip } from \"./PageFormWorkflowStateTooltip.js\";\nimport { PageFormWorkflowStatePublishButton } from \"./PageFormWorkflowStatePublishButton.js\";\nimport { PageEditorTopBar } from \"./PageEditorTopBar.js\";\n\nexport const PageEditorConfig = () => {\n return (\n <Plugins>\n {/* Toggle editor \"readonly\" mode, and add workflow alerts */}\n <PageEditorTopBar />\n {/* Should add a button with list of steps and their states + comment button in each row */}\n <PageFormWorkflowStateTooltip />\n {/* should remove publish button from the form */}\n <PageFormWorkflowStatePublishButton />\n </Plugins>\n );\n};\n"],"names":["PageEditorConfig","Plugins","PageEditorTopBar","PageFormWorkflowStateTooltip","PageFormWorkflowStatePublishButton"],"mappings":";;;;;AAMO,MAAMA,mBAAmB,IACrB,WAAP,GACI,oBAACC,SAAOA,MAAAA,WAAAA,GAEJ,oBAACC,kBAAgBA,OAAAA,WAAAA,GAEjB,oBAACC,8BAA4BA,OAAAA,WAAAA,GAE7B,oBAACC,oCAAkCA"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
2
|
import { observer } from "mobx-react-lite";
|
|
3
|
-
import { useWorkflowState } from "@webiny/app-workflows";
|
|
3
|
+
import { WorkflowStateValue, useWorkflowState } from "@webiny/app-workflows";
|
|
4
4
|
import { useDocumentEditor } from "@webiny/app-website-builder/DocumentEditor/index.js";
|
|
5
5
|
const ToggleEditorMode = observer(()=>{
|
|
6
6
|
const { presenter } = useWorkflowState();
|
|
7
7
|
const editor = useDocumentEditor();
|
|
8
|
-
const
|
|
8
|
+
const state = presenter.vm.state?.state;
|
|
9
|
+
const isUnderReview = !!state && state !== WorkflowStateValue.approved;
|
|
9
10
|
useEffect(()=>{
|
|
10
11
|
const options = editor.getEditorOptions();
|
|
11
12
|
editor.updateEditor((state)=>{
|
|
12
|
-
state.isReadOnly = options.isReadOnly ||
|
|
13
|
+
state.isReadOnly = options.isReadOnly || isUnderReview;
|
|
13
14
|
});
|
|
14
15
|
}, [
|
|
15
|
-
|
|
16
|
+
isUnderReview
|
|
16
17
|
]);
|
|
17
18
|
return null;
|
|
18
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Components/PageEditor/ToggleEditorMode.js","sources":["../../../src/Components/PageEditor/ToggleEditorMode.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { useWorkflowState } from \"@webiny/app-workflows\";\nimport { useDocumentEditor } from \"@webiny/app-website-builder/DocumentEditor/index.js\";\n\nexport const ToggleEditorMode = observer(() => {\n const { presenter } = useWorkflowState();\n const editor = useDocumentEditor();\n\n const
|
|
1
|
+
{"version":3,"file":"Components/PageEditor/ToggleEditorMode.js","sources":["../../../src/Components/PageEditor/ToggleEditorMode.tsx"],"sourcesContent":["import { useEffect } from \"react\";\nimport { observer } from \"mobx-react-lite\";\nimport { useWorkflowState, WorkflowStateValue } from \"@webiny/app-workflows\";\nimport { useDocumentEditor } from \"@webiny/app-website-builder/DocumentEditor/index.js\";\n\nexport const ToggleEditorMode = observer(() => {\n const { presenter } = useWorkflowState();\n const editor = useDocumentEditor();\n\n const state = presenter.vm.state?.state;\n\n /**\n * A page is locked for the duration of the review. Once the review is approved the page can\n * be published, so the editor has to become writable again - otherwise the top bar keeps\n * offering \"New Revision\" instead of \"Publish\".\n */\n const isUnderReview = !!state && state !== WorkflowStateValue.approved;\n\n useEffect(() => {\n const options = editor.getEditorOptions();\n editor.updateEditor(state => {\n state.isReadOnly = options.isReadOnly || isUnderReview;\n });\n }, [isUnderReview]);\n\n return null;\n});\n"],"names":["ToggleEditorMode","observer","presenter","useWorkflowState","editor","useDocumentEditor","state","isUnderReview","WorkflowStateValue","useEffect","options"],"mappings":";;;;AAKO,MAAMA,mBAAmBC,SAAS;IACrC,MAAM,EAAEC,SAAS,EAAE,GAAGC;IACtB,MAAMC,SAASC;IAEf,MAAMC,QAAQJ,UAAU,EAAE,CAAC,KAAK,EAAE;IAOlC,MAAMK,gBAAgB,CAAC,CAACD,SAASA,UAAUE,mBAAmB,QAAQ;IAEtEC,UAAU;QACN,MAAMC,UAAUN,OAAO,gBAAgB;QACvCA,OAAO,YAAY,CAACE,CAAAA;YAChBA,MAAM,UAAU,GAAGI,QAAQ,UAAU,IAAIH;QAC7C;IACJ,GAAG;QAACA;KAAc;IAElB,OAAO;AACX"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-website-builder-workflows",
|
|
3
|
-
"version": "6.4.12-beta.
|
|
3
|
+
"version": "6.4.12-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@apollo/react-hooks": "3.1.5",
|
|
17
|
-
"@webiny/admin-ui": "6.4.12-beta.
|
|
18
|
-
"@webiny/app": "6.4.12-beta.
|
|
19
|
-
"@webiny/app-admin": "6.4.12-beta.
|
|
20
|
-
"@webiny/app-website-builder": "6.4.12-beta.
|
|
21
|
-
"@webiny/app-workflows": "6.4.12-beta.
|
|
22
|
-
"@webiny/feature": "6.4.12-beta.
|
|
23
|
-
"@webiny/icons": "6.4.12-beta.
|
|
17
|
+
"@webiny/admin-ui": "6.4.12-beta.3",
|
|
18
|
+
"@webiny/app": "6.4.12-beta.3",
|
|
19
|
+
"@webiny/app-admin": "6.4.12-beta.3",
|
|
20
|
+
"@webiny/app-website-builder": "6.4.12-beta.3",
|
|
21
|
+
"@webiny/app-workflows": "6.4.12-beta.3",
|
|
22
|
+
"@webiny/feature": "6.4.12-beta.3",
|
|
23
|
+
"@webiny/icons": "6.4.12-beta.3",
|
|
24
24
|
"mobx": "7.0.3",
|
|
25
25
|
"mobx-react-lite": "5.0.3",
|
|
26
26
|
"react": "18.3.1",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/react": "18.3.31",
|
|
32
|
-
"@webiny/build-tools": "6.4.12-beta.
|
|
32
|
+
"@webiny/build-tools": "6.4.12-beta.3",
|
|
33
33
|
"rimraf": "6.1.3",
|
|
34
34
|
"typescript": "6.0.3"
|
|
35
35
|
},
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import react, { useEffect } from "react";
|
|
2
|
-
import { useSelectFromDocument } from "@webiny/app-website-builder/BaseEditor/hooks/useSelectFromDocument.js";
|
|
3
|
-
import { useApolloClient } from "@apollo/react-hooks";
|
|
4
|
-
import { useAuthentication } from "@webiny/app-admin";
|
|
5
|
-
import { Components, useWorkflowState } from "@webiny/app-workflows";
|
|
6
|
-
import { WB_PAGE_APP } from "../../constants.js";
|
|
7
|
-
import { PageEditorConfig } from "@webiny/app-website-builder";
|
|
8
|
-
import { observer } from "mobx-react-lite";
|
|
9
|
-
import { useDocumentEditor } from "@webiny/app-website-builder/DocumentEditor/index.js";
|
|
10
|
-
const { Ui: Ui } = PageEditorConfig;
|
|
11
|
-
const { ContentReview: { WorkflowStateProvider: WorkflowStateProvider } } = Components;
|
|
12
|
-
const ToggleReadonly = observer(()=>{
|
|
13
|
-
const { presenter } = useWorkflowState();
|
|
14
|
-
const editor = useDocumentEditor();
|
|
15
|
-
const hasState = !!presenter.vm.state?.state;
|
|
16
|
-
useEffect(()=>{
|
|
17
|
-
const options = editor.getEditorOptions();
|
|
18
|
-
editor.updateEditor((state)=>{
|
|
19
|
-
state.isReadOnly = options.isReadOnly || hasState;
|
|
20
|
-
});
|
|
21
|
-
}, [
|
|
22
|
-
hasState
|
|
23
|
-
]);
|
|
24
|
-
return null;
|
|
25
|
-
});
|
|
26
|
-
const PageEditorLayout = Ui.Layout.createDecorator((Original)=>function() {
|
|
27
|
-
const page = useSelectFromDocument((doc)=>({
|
|
28
|
-
id: doc.id,
|
|
29
|
-
title: doc.properties.title || "unknown page"
|
|
30
|
-
}));
|
|
31
|
-
const client = useApolloClient();
|
|
32
|
-
const { identity } = useAuthentication();
|
|
33
|
-
return /*#__PURE__*/ react.createElement(WorkflowStateProvider, {
|
|
34
|
-
app: WB_PAGE_APP,
|
|
35
|
-
id: page.id,
|
|
36
|
-
identity: identity,
|
|
37
|
-
client: client,
|
|
38
|
-
title: `Website Builder: ${page.title}`
|
|
39
|
-
}, /*#__PURE__*/ react.createElement(Original, null), /*#__PURE__*/ react.createElement(ToggleReadonly, null));
|
|
40
|
-
});
|
|
41
|
-
export { PageEditorLayout };
|
|
42
|
-
|
|
43
|
-
//# sourceMappingURL=PageEditorLayout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Components/PageEditor/PageEditorLayout.js","sources":["../../../src/Components/PageEditor/PageEditorLayout.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { useSelectFromDocument } from \"@webiny/app-website-builder/BaseEditor/hooks/useSelectFromDocument.js\";\nimport { useApolloClient } from \"@apollo/react-hooks\";\nimport { useAuthentication } from \"@webiny/app-admin\";\nimport { Components, useWorkflowState } from \"@webiny/app-workflows\";\nimport { WB_PAGE_APP } from \"~/constants.js\";\nimport { PageEditorConfig } from \"@webiny/app-website-builder\";\nimport { observer } from \"mobx-react-lite\";\nimport { useDocumentEditor } from \"@webiny/app-website-builder/DocumentEditor/index.js\";\n\nconst { Ui } = PageEditorConfig;\n\nconst {\n ContentReview: { WorkflowStateProvider }\n} = Components;\n\nconst ToggleReadonly = observer(() => {\n const { presenter } = useWorkflowState();\n const editor = useDocumentEditor();\n\n const hasState = !!presenter.vm.state?.state;\n\n useEffect(() => {\n const options = editor.getEditorOptions();\n editor.updateEditor(state => {\n state.isReadOnly = options.isReadOnly || hasState;\n });\n }, [hasState]);\n\n return null;\n});\n\nexport const PageEditorLayout = Ui.Layout.createDecorator(Original => {\n return function PageEditorTopBarWorkflowsState() {\n const page = useSelectFromDocument(doc => {\n return {\n id: doc.id,\n title: doc.properties.title || \"unknown page\"\n };\n });\n\n const client = useApolloClient();\n const { identity } = useAuthentication();\n\n return (\n <WorkflowStateProvider\n app={WB_PAGE_APP}\n id={page.id}\n identity={identity}\n client={client}\n title={`Website Builder: ${page.title}`}\n >\n <Original />\n <ToggleReadonly />\n </WorkflowStateProvider>\n );\n };\n});\n"],"names":["Ui","PageEditorConfig","WorkflowStateProvider","Components","ToggleReadonly","observer","presenter","useWorkflowState","editor","useDocumentEditor","hasState","useEffect","options","state","PageEditorLayout","Original","page","useSelectFromDocument","doc","client","useApolloClient","identity","useAuthentication","WB_PAGE_APP"],"mappings":";;;;;;;;;AAUA,MAAM,EAAEA,IAAAA,EAAE,EAAE,GAAGC;AAEf,MAAM,EACF,eAAe,EAAEC,uBAAAA,qBAAqB,EAAE,EAC3C,GAAGC;AAEJ,MAAMC,iBAAiBC,SAAS;IAC5B,MAAM,EAAEC,SAAS,EAAE,GAAGC;IACtB,MAAMC,SAASC;IAEf,MAAMC,WAAW,CAAC,CAACJ,UAAU,EAAE,CAAC,KAAK,EAAE;IAEvCK,UAAU;QACN,MAAMC,UAAUJ,OAAO,gBAAgB;QACvCA,OAAO,YAAY,CAACK,CAAAA;YAChBA,MAAM,UAAU,GAAGD,QAAQ,UAAU,IAAIF;QAC7C;IACJ,GAAG;QAACA;KAAS;IAEb,OAAO;AACX;AAEO,MAAMI,mBAAmBd,GAAG,MAAM,CAAC,eAAe,CAACe,CAAAA,WAC/C;QACH,MAAMC,OAAOC,sBAAsBC,CAAAA,MACxB;gBACH,IAAIA,IAAI,EAAE;gBACV,OAAOA,IAAI,UAAU,CAAC,KAAK,IAAI;YACnC;QAGJ,MAAMC,SAASC;QACf,MAAM,EAAEC,QAAQ,EAAE,GAAGC;QAErB,OAAO,WAAP,GACI,oBAACpB,uBAAqBA;YAClB,KAAKqB;YACL,IAAIP,KAAK,EAAE;YACX,UAAUK;YACV,QAAQF;YACR,OAAO,CAAC,iBAAiB,EAAEH,KAAK,KAAK,EAAE;yBAEvC,oBAACD,UAAAA,OAAAA,WAAAA,GACD,oBAACX,gBAAcA;IAG3B"}
|