@dotcms/react 0.0.1-alpha.22 → 0.0.1-alpha.24

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/index.esm.js CHANGED
@@ -1616,22 +1616,28 @@ for (var COLLECTION_NAME in DOMIterables) {
1616
1616
 
1617
1617
  handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
1618
1618
 
1619
- const useDotcmsEditor = config => {
1620
- const [isInsideEditorPage, setIsInsideEditorPage] = useState(false);
1619
+ const useDotcmsEditor = ({
1620
+ pathname
1621
+ }) => {
1622
+ const [isInsideEditor$1, setIsInsideEditor] = useState(false);
1621
1623
  useEffect(() => {
1622
1624
  const insideEditor = isInsideEditor();
1623
1625
  if (insideEditor) {
1624
- initEditor(config);
1625
- updateNavigation((config == null ? void 0 : config.pathname) || '/');
1626
+ initEditor({
1627
+ pathname
1628
+ });
1629
+ updateNavigation(pathname || '/');
1630
+ setIsInsideEditor(insideEditor);
1626
1631
  }
1627
- setIsInsideEditorPage(insideEditor);
1628
1632
  return () => {
1629
1633
  if (insideEditor) {
1630
1634
  destroyEditor();
1631
1635
  }
1632
1636
  };
1633
- }, [config]);
1634
- return isInsideEditorPage;
1637
+ }, [pathname]);
1638
+ return {
1639
+ isInsideEditor: isInsideEditor$1
1640
+ };
1635
1641
  };
1636
1642
 
1637
1643
  const PageContext = /*#__PURE__*/createContext(null);
@@ -1901,12 +1907,15 @@ function DotcmsLayout({
1901
1907
  pageContext,
1902
1908
  config
1903
1909
  }) {
1904
- const isInsideEditor = useDotcmsEditor(config);
1910
+ var _pageContext$pageAsse;
1911
+ const {
1912
+ isInsideEditor
1913
+ } = useDotcmsEditor(config);
1905
1914
  return jsx(PageProvider, {
1906
1915
  pageContext: Object.assign({}, pageContext, {
1907
1916
  isInsideEditor
1908
1917
  }),
1909
- children: pageContext.pageAsset.layout.body.rows.map((row, index) => jsx(Row, {
1918
+ children: (_pageContext$pageAsse = pageContext.pageAsset.layout) == null ? void 0 : _pageContext$pageAsse.body.rows.map((row, index) => jsx(Row, {
1910
1919
  row: row
1911
1920
  }, index))
1912
1921
  });
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dotcms/react",
3
- "version": "0.0.1-alpha.22",
3
+ "version": "0.0.1-alpha.24",
4
4
  "peerDependencies": {
5
5
  "react": ">=18",
6
6
  "react-dom": ">=18",
7
- "@dotcms/client": "0.0.1-alpha.22"
7
+ "@dotcms/client": "0.0.1-alpha.24"
8
8
  },
9
9
  "description": "Official React Components library to render a dotCMS page.",
10
10
  "repository": {
@@ -21,7 +21,7 @@ export type DotcmsPageProps = {
21
21
  * @readonly
22
22
  */
23
23
  readonly pageContext: DotCMSPageContext;
24
- readonly config?: DotCMSPageEditorConfig;
24
+ readonly config: DotCMSPageEditorConfig;
25
25
  };
26
26
  /**
27
27
  * `DotcmsLayout` is a functional component that renders a layout for a DotCMS page.
@@ -1,2 +1,4 @@
1
1
  import { DotCMSPageEditorConfig } from '@dotcms/client';
2
- export declare const useDotcmsEditor: (config?: DotCMSPageEditorConfig) => boolean;
2
+ export declare const useDotcmsEditor: ({ pathname }: DotCMSPageEditorConfig) => {
3
+ isInsideEditor: boolean;
4
+ };