eddev 2.0.0-beta.30 → 2.0.0-beta.31
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/dist/app/lib/blocks/block-utils.d.ts +1 -1
- package/dist/app/lib/blocks/block-utils.js +1 -1
- package/dist/app/lib/blocks/inline-editing.js +4 -2
- package/dist/app/lib/routing/components/BackButton.d.ts +10 -0
- package/dist/app/lib/routing/components/BackButton.js +3 -1
- package/dist/node/cli/version.d.ts +1 -1
- package/dist/node/cli/version.js +1 -1
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ export declare function getPublicBlockInfo(): {
|
|
|
12
12
|
*
|
|
13
13
|
* Note that this function mutates the existing block, adding new properties.
|
|
14
14
|
*/
|
|
15
|
-
export declare function addBlockMetadata(blocks: ContentBlock[]): ContentBlock[];
|
|
15
|
+
export declare function addBlockMetadata(blocks: ContentBlock[] | null | undefined): ContentBlock[];
|
|
16
16
|
export declare function getBlockMetadata(blockName: string): {
|
|
17
17
|
slug: string;
|
|
18
18
|
tags?: undefined;
|
|
@@ -13,7 +13,7 @@ export function getPublicBlockInfo() {
|
|
|
13
13
|
* Note that this function mutates the existing block, adding new properties.
|
|
14
14
|
*/
|
|
15
15
|
export function addBlockMetadata(blocks) {
|
|
16
|
-
const out = blocks;
|
|
16
|
+
const out = (blocks ?? []);
|
|
17
17
|
const infos = getPublicBlockInfo();
|
|
18
18
|
for (let block of out) {
|
|
19
19
|
const info = infos[block.blockName];
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext } from "react";
|
|
2
|
+
import { createContext, useContext, useMemo } from "react";
|
|
3
3
|
import { usePostEditor } from "./editor/usePostEditor.js";
|
|
4
4
|
import { useRoute } from "../routing/index.js";
|
|
5
5
|
import { addBlockMetadata } from "./block-utils.js";
|
|
6
6
|
const InlineEditingContext = createContext(undefined);
|
|
7
7
|
export function InlineEditingContextProvider(props) {
|
|
8
8
|
const parentContext = useContext(InlineEditingContext);
|
|
9
|
-
|
|
9
|
+
useMemo(() => {
|
|
10
|
+
addBlockMetadata(props.innerBlocks ?? []);
|
|
11
|
+
}, [props.innerBlocks]);
|
|
10
12
|
return (_jsx(InlineEditingContext.Provider, { value: {
|
|
11
13
|
values: props.values,
|
|
12
14
|
innerBlocks: props.innerBlocks,
|
|
@@ -11,6 +11,16 @@ type BackButtonProps = {
|
|
|
11
11
|
* @param route The last route in the history stack.
|
|
12
12
|
*/
|
|
13
13
|
filter?: (route: RouteState) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether to use the top-most "global" route, or the "context" route.
|
|
16
|
+
*
|
|
17
|
+
* The "global" route is the top-most route, reflected in the URL bar.
|
|
18
|
+
*
|
|
19
|
+
* The "context" route will be the route that is currently being rendered, which may be different to the global route when using modals/overlays/route stacks/transitions.
|
|
20
|
+
*
|
|
21
|
+
* @default "context"
|
|
22
|
+
*/
|
|
23
|
+
mode?: "global" | "context";
|
|
14
24
|
/**
|
|
15
25
|
* An optional href, which will be used if no back route is found.
|
|
16
26
|
*
|
|
@@ -10,8 +10,10 @@ import { useRoute } from "../hooks/useRoute";
|
|
|
10
10
|
*/
|
|
11
11
|
export function BackButton(props) {
|
|
12
12
|
const router = useRouter();
|
|
13
|
-
const route = useRoute();
|
|
14
13
|
const prevRoute = useRouterState((state) => state.history[state.history.length - 2]);
|
|
14
|
+
const contextRoute = useRoute();
|
|
15
|
+
const activeRoute = useRouterState((state) => state.activeRoute);
|
|
16
|
+
const route = props.mode === "global" ? activeRoute : contextRoute;
|
|
15
17
|
const backAction = useMemo(() => {
|
|
16
18
|
if (prevRoute && (!props.filter || props.filter(prevRoute))) {
|
|
17
19
|
return (e) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.0-beta.
|
|
1
|
+
export declare const VERSION = "2.0.0-beta.31";
|
package/dist/node/cli/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.0.0-beta.
|
|
1
|
+
export const VERSION = "2.0.0-beta.31";
|