eddev 2.0.0-beta.191 → 2.0.0-beta.192
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.
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useMemo } from "react";
|
|
3
3
|
import { ContentBlocks } from "./ContentBlocks.js";
|
|
4
|
-
import {
|
|
4
|
+
import { transformBlockTemplate } from "./editor/block-templates.js";
|
|
5
5
|
import { blocksByTag } from "./editor/blocks-by-tag.js";
|
|
6
6
|
import { useBlockContext, useInnerBlocks } from "./inline-editing.js";
|
|
7
|
-
import { hash } from "object-code";
|
|
8
7
|
const Appender = ({ config, ...props }) => {
|
|
9
8
|
const clientId = useBlockContext()?.block[1].clientId;
|
|
10
9
|
if (config?.type === "button") {
|
|
@@ -85,16 +84,16 @@ export function InnerBlocks(props) {
|
|
|
85
84
|
* Adds support for headerTemplate/defaultBlocks/footerTemplate, which was first introduced in `_editor.tsx` for generate templates.
|
|
86
85
|
*/
|
|
87
86
|
const blockId = inlineContext?.block[1].clientId;
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}, [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
])
|
|
87
|
+
// useEffect(() => {
|
|
88
|
+
// if (props.defaultBlocks || props.headerTemplate || props.footerTemplate) {
|
|
89
|
+
// const newBlocks = applyTemplateBlocks(inlineContext?.innerBlocks ?? [], props)
|
|
90
|
+
// wp.data.dispatch(wp.blockEditor.store).replaceInnerBlocks(blockId, newBlocks)
|
|
91
|
+
// }
|
|
92
|
+
// }, [
|
|
93
|
+
// hash(inlineContext?.innerBlocks.map((b: any) => [b.blockName, b.clientId])),
|
|
94
|
+
// hash([props.template, props.defaultBlocks, props.headerTemplate, props.footerTemplate]),
|
|
95
|
+
// blockId,
|
|
96
|
+
// ])
|
|
98
97
|
return (_jsx("div", { ...innerBlocksProps, className: [innerBlocksProps.className, props.adminClassName].filter(Boolean).join(" ") }));
|
|
99
98
|
}
|
|
100
99
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installGutenbergHooks.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/blocks/editor/installGutenbergHooks.tsx"],"names":[],"mappings":"AA4BA,eAAO,MAAM,oBAAoB;;CAAgC,CAAA;AAEjE,wBAAgB,iBAAiB,kBAsBhC;AAED,wBAAgB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"installGutenbergHooks.d.ts","sourceRoot":"","sources":["../../../../../src/app/lib/blocks/editor/installGutenbergHooks.tsx"],"names":[],"mappings":"AA4BA,eAAO,MAAM,oBAAoB;;CAAgC,CAAA;AAEjE,wBAAgB,iBAAiB,kBAsBhC;AAED,wBAAgB,uBAAuB,SA4OtC"}
|
|
@@ -142,16 +142,24 @@ export function installEDGutenbergHooks() {
|
|
|
142
142
|
;
|
|
143
143
|
wp.data.dispatch("core/block-editor").setTemplateValidity(true);
|
|
144
144
|
}, []);
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
function getIndex() {
|
|
146
|
+
const { getBlockIndex } = wp.data.select("core/block-editor");
|
|
147
|
+
return getBlockIndex(props.clientId);
|
|
148
|
+
}
|
|
149
|
+
function getChildren() {
|
|
150
|
+
const { getBlock, getBlockOrder } = wp.data.select("core/block-editor");
|
|
151
|
+
const innerBlockIDs = getBlockOrder(props.clientId);
|
|
152
|
+
const children = innerBlockIDs.map((id) => {
|
|
153
|
+
return getBlock(id);
|
|
154
|
+
});
|
|
155
|
+
return children;
|
|
156
|
+
}
|
|
157
|
+
const [index, setIndex] = useState(getIndex);
|
|
158
|
+
const [children, setChildren] = useState(getChildren);
|
|
147
159
|
useEffect(() => {
|
|
148
160
|
return wp.data.subscribe(() => {
|
|
149
|
-
|
|
150
|
-
const
|
|
151
|
-
const children = innerBlockIDs.map((id) => {
|
|
152
|
-
return getBlock(id);
|
|
153
|
-
});
|
|
154
|
-
setIndex(getBlockIndex(props.clientId));
|
|
161
|
+
setIndex(getIndex());
|
|
162
|
+
const children = getChildren();
|
|
155
163
|
setChildren((current) => current.length === children.length
|
|
156
164
|
? current.every((item, i) => item === children[i])
|
|
157
165
|
? current
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.0-beta.
|
|
1
|
+
export declare const VERSION = "2.0.0-beta.192";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
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.192";
|