eddev 2.0.0-beta.55 → 2.0.0-beta.57
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.
|
@@ -74,15 +74,18 @@ export function installEDGutenbergHooks() {
|
|
|
74
74
|
;
|
|
75
75
|
wp.data.dispatch("core/block-editor").setTemplateValidity(true);
|
|
76
76
|
}, []);
|
|
77
|
-
const children = wp.data.useSelect((select) => {
|
|
78
|
-
const { getBlock, getBlockOrder } = select("core/block-editor");
|
|
77
|
+
const { children, index } = wp.data.useSelect((select) => {
|
|
78
|
+
const { getBlock, getBlockOrder, getBlockIndex } = select("core/block-editor");
|
|
79
79
|
const innerBlockIDs = getBlockOrder(props.clientId);
|
|
80
80
|
const children = innerBlockIDs.map((id) => {
|
|
81
81
|
return getBlock(id);
|
|
82
82
|
});
|
|
83
|
-
return
|
|
83
|
+
return {
|
|
84
|
+
children,
|
|
85
|
+
index: getBlockIndex(props.clientId),
|
|
86
|
+
};
|
|
84
87
|
}, []);
|
|
85
|
-
return (_jsx(BlockContext.Provider, { value: { name, props }, children: _jsx(InlineEditingContextProvider, { values: props.attributes.inline || {}, innerBlocks: children, block: [name, props], index: -1, onChange: (attrs) => {
|
|
88
|
+
return (_jsx(BlockContext.Provider, { value: { name, props }, children: _jsx(InlineEditingContextProvider, { values: props.attributes.inline || {}, innerBlocks: children, block: [name, props], index: index ?? -1, onChange: (attrs) => {
|
|
86
89
|
props.setAttributes({ ...props.attributes, inline: attrs });
|
|
87
90
|
}, insertBlocksAfter: props.insertBlocksAfter, children: edit.call(self, props) }) }));
|
|
88
91
|
};
|
|
@@ -7,10 +7,17 @@ type OptionalMaybes<T> = T extends any[] ? T : T extends {
|
|
|
7
7
|
type MaybeVars = {
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
} | undefined;
|
|
10
|
-
|
|
10
|
+
declare class QueryError extends Error {
|
|
11
|
+
name: string;
|
|
11
12
|
messages: string[];
|
|
12
13
|
statusCode: number;
|
|
13
|
-
|
|
14
|
+
constructor(args: {
|
|
15
|
+
messages: string[];
|
|
16
|
+
statusCode: number;
|
|
17
|
+
type: "query" | "mutation";
|
|
18
|
+
queryName: string;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
14
21
|
/** Regular queries */
|
|
15
22
|
type CreateUseQueryOptions = {
|
|
16
23
|
name: string;
|
|
@@ -3,11 +3,16 @@ import { useEffect, useState } from "react";
|
|
|
3
3
|
import { joinURL } from "ufo";
|
|
4
4
|
import { getQueryClient } from "../../utils/query-client.js";
|
|
5
5
|
import { apiConfig } from "../runtime/apiConfig.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
class QueryError extends Error {
|
|
7
|
+
name = "QueryError";
|
|
8
|
+
messages;
|
|
9
|
+
statusCode;
|
|
10
|
+
constructor(args) {
|
|
11
|
+
const msg = args.messages.join(", ");
|
|
12
|
+
super(msg);
|
|
13
|
+
this.statusCode = args.statusCode;
|
|
14
|
+
this.messages = args.messages;
|
|
15
|
+
}
|
|
11
16
|
}
|
|
12
17
|
const fetchGETQuery = async (name, params, opts) => {
|
|
13
18
|
let url;
|
|
@@ -34,7 +39,12 @@ const fetchGETQuery = async (name, params, opts) => {
|
|
|
34
39
|
apiConfig.onResponse(response, "query", name, params, url, options);
|
|
35
40
|
const payload = await response.json();
|
|
36
41
|
if (payload.errors?.length > 0) {
|
|
37
|
-
throw
|
|
42
|
+
throw new QueryError({
|
|
43
|
+
messages: payload.errors.map((e) => e.message),
|
|
44
|
+
statusCode: response.status,
|
|
45
|
+
queryName: name,
|
|
46
|
+
type: "query",
|
|
47
|
+
});
|
|
38
48
|
}
|
|
39
49
|
return payload.data;
|
|
40
50
|
};
|
|
@@ -159,7 +169,12 @@ const fetchMutation = async (name, params, opts) => {
|
|
|
159
169
|
apiConfig.onResponse(response, "mutation", name, params, url, options);
|
|
160
170
|
const payload = await response.json();
|
|
161
171
|
if (payload.errors?.length > 0) {
|
|
162
|
-
throw
|
|
172
|
+
throw new QueryError({
|
|
173
|
+
messages: payload.errors.map((e) => e.message),
|
|
174
|
+
statusCode: response.status,
|
|
175
|
+
queryName: name,
|
|
176
|
+
type: "mutation",
|
|
177
|
+
});
|
|
163
178
|
}
|
|
164
179
|
return payload.data;
|
|
165
180
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.0-beta.
|
|
1
|
+
export declare const VERSION = "2.0.0-beta.57";
|
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.57";
|