eddev 0.3.27 → 0.3.28
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/blocks/ContentBlocks.js +1 -1
- package/blocks/blockAttributes.d.ts +2 -0
- package/blocks/blockAttributes.js +7 -1
- package/blocks/index.d.ts +1 -1
- package/blocks/index.js +4 -1
- package/blocks/installGutenbergHooks.js +1 -1
- package/package-lock.json +13535 -0
- package/package.json +1 -1
package/blocks/ContentBlocks.js
CHANGED
|
@@ -80,7 +80,7 @@ function ContentBlocks(props) {
|
|
|
80
80
|
var Component = blockTypes[block.blockName];
|
|
81
81
|
if (!Component)
|
|
82
82
|
return (0, jsx_runtime_1.jsx)(react_1.Fragment, {}, void 0);
|
|
83
|
-
blockNode = ((0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ block: [block.blockName, block.props], values: block.inline, innerBlocks: block.innerBlocks }, { children: (0, jsx_runtime_1.jsx)(Component, __assign({}, block.props, { innerHTML: block.innerHTML,
|
|
83
|
+
blockNode = ((0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ block: [block.blockName, block.props], values: block.inline, innerBlocks: block.innerBlocks, index: index }, { children: (0, jsx_runtime_1.jsx)(Component, __assign({}, block.props, { innerHTML: block.innerHTML,
|
|
84
84
|
// innerBlocks={block.innerBlocks}
|
|
85
85
|
children: Array.isArray(block.innerBlocks) && block.innerBlocks.length ? ((0, jsx_runtime_1.jsx)(ContentBlocks, { blocks: block.innerBlocks }, void 0)) : null }), void 0) }), void 0));
|
|
86
86
|
}
|
|
@@ -9,10 +9,12 @@ declare type ProviderProps = PropsWithChildren<{
|
|
|
9
9
|
block: [string, Attributes];
|
|
10
10
|
onChange?: (attrs: Attributes) => void;
|
|
11
11
|
insertBlocksAfter?: (block: any) => void;
|
|
12
|
+
index: number;
|
|
12
13
|
}>;
|
|
13
14
|
export declare function InlineEditingContextProvider(props: ProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export declare function useInlineEditableValue<T>(key: string, defaultValue?: T): [T, (value: T) => void];
|
|
15
16
|
export declare function useBlockAppender(): ((block: any) => void) | undefined;
|
|
16
17
|
export declare function useInnerBlocks(): ContentBlock[];
|
|
17
18
|
export declare function useBlockParents(): [string, Attributes][];
|
|
19
|
+
export declare function useBlockIndex(): number;
|
|
18
20
|
export {};
|
|
@@ -20,7 +20,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
20
20
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.useBlockParents = exports.useInnerBlocks = exports.useBlockAppender = exports.useInlineEditableValue = exports.InlineEditingContextProvider = void 0;
|
|
23
|
+
exports.useBlockIndex = exports.useBlockParents = exports.useInnerBlocks = exports.useBlockAppender = exports.useInlineEditableValue = exports.InlineEditingContextProvider = void 0;
|
|
24
24
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
25
25
|
var react_1 = require("react");
|
|
26
26
|
var InlineEditingContext = (0, react_1.createContext)(undefined);
|
|
@@ -41,6 +41,7 @@ function InlineEditingContextProvider(props) {
|
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
insertBlocksAfter: props.insertBlocksAfter,
|
|
44
|
+
index: props.index,
|
|
44
45
|
} }, { children: props.children }), void 0));
|
|
45
46
|
}
|
|
46
47
|
exports.InlineEditingContextProvider = InlineEditingContextProvider;
|
|
@@ -70,3 +71,8 @@ function useBlockParents() {
|
|
|
70
71
|
return (ctx === null || ctx === void 0 ? void 0 : ctx.parents) || [];
|
|
71
72
|
}
|
|
72
73
|
exports.useBlockParents = useBlockParents;
|
|
74
|
+
function useBlockIndex() {
|
|
75
|
+
var ctx = (0, react_1.useContext)(InlineEditingContext);
|
|
76
|
+
return (ctx === null || ctx === void 0 ? void 0 : ctx.index) || -1;
|
|
77
|
+
}
|
|
78
|
+
exports.useBlockIndex = useBlockIndex;
|
package/blocks/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export * from "./defineBlock";
|
|
|
2
2
|
export * from "./inlineEditing";
|
|
3
3
|
export * from "./ContentBlocks";
|
|
4
4
|
export * from "./InspectorControls";
|
|
5
|
-
export { useInlineEditableValue, useInnerBlocks } from "./blockAttributes";
|
|
5
|
+
export { useInlineEditableValue, useInnerBlocks, useBlockParents, useBlockAppender, useBlockIndex, } from "./blockAttributes";
|
package/blocks/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.useInnerBlocks = exports.useInlineEditableValue = void 0;
|
|
13
|
+
exports.useBlockIndex = exports.useBlockAppender = exports.useBlockParents = exports.useInnerBlocks = exports.useInlineEditableValue = void 0;
|
|
14
14
|
__exportStar(require("./defineBlock"), exports);
|
|
15
15
|
__exportStar(require("./inlineEditing"), exports);
|
|
16
16
|
__exportStar(require("./ContentBlocks"), exports);
|
|
@@ -18,3 +18,6 @@ __exportStar(require("./InspectorControls"), exports);
|
|
|
18
18
|
var blockAttributes_1 = require("./blockAttributes");
|
|
19
19
|
Object.defineProperty(exports, "useInlineEditableValue", { enumerable: true, get: function () { return blockAttributes_1.useInlineEditableValue; } });
|
|
20
20
|
Object.defineProperty(exports, "useInnerBlocks", { enumerable: true, get: function () { return blockAttributes_1.useInnerBlocks; } });
|
|
21
|
+
Object.defineProperty(exports, "useBlockParents", { enumerable: true, get: function () { return blockAttributes_1.useBlockParents; } });
|
|
22
|
+
Object.defineProperty(exports, "useBlockAppender", { enumerable: true, get: function () { return blockAttributes_1.useBlockAppender; } });
|
|
23
|
+
Object.defineProperty(exports, "useBlockIndex", { enumerable: true, get: function () { return blockAttributes_1.useBlockIndex; } });
|
|
@@ -116,7 +116,7 @@ function installEDGutenbergHooks() {
|
|
|
116
116
|
}, []);
|
|
117
117
|
return ((0, jsx_runtime_1.jsx)(BlockContext.Provider, __assign({ value: { name: name, props: props } }, { children: (0, jsx_runtime_1.jsx)(blockAttributes_1.InlineEditingContextProvider, __assign({ values: props.attributes.inline || {}, innerBlocks: children, block: [name, props], onChange: function (attrs) {
|
|
118
118
|
props.setAttributes(__assign(__assign({}, props.attributes), { inline: attrs }));
|
|
119
|
-
}, insertBlocksAfter: props.insertBlocksAfter }, { children: edit_1.call(self, props) }), void 0) }), void 0));
|
|
119
|
+
}, insertBlocksAfter: props.insertBlocksAfter, index: -1 }, { children: edit_1.call(self, props) }), void 0) }), void 0));
|
|
120
120
|
};
|
|
121
121
|
}
|
|
122
122
|
// Remember the block type name
|