eddev 0.3.29 → 0.3.32
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.
|
@@ -62,17 +62,20 @@ function useBlockAppender() {
|
|
|
62
62
|
}
|
|
63
63
|
exports.useBlockAppender = useBlockAppender;
|
|
64
64
|
function useInnerBlocks() {
|
|
65
|
+
var _a;
|
|
65
66
|
var ctx = (0, react_1.useContext)(InlineEditingContext);
|
|
66
|
-
return (ctx === null || ctx === void 0 ? void 0 : ctx.innerBlocks)
|
|
67
|
+
return (_a = ctx === null || ctx === void 0 ? void 0 : ctx.innerBlocks) !== null && _a !== void 0 ? _a : [];
|
|
67
68
|
}
|
|
68
69
|
exports.useInnerBlocks = useInnerBlocks;
|
|
69
70
|
function useBlockParents() {
|
|
71
|
+
var _a;
|
|
70
72
|
var ctx = (0, react_1.useContext)(InlineEditingContext);
|
|
71
|
-
return (ctx === null || ctx === void 0 ? void 0 : ctx.parents)
|
|
73
|
+
return (_a = ctx === null || ctx === void 0 ? void 0 : ctx.parents) !== null && _a !== void 0 ? _a : [];
|
|
72
74
|
}
|
|
73
75
|
exports.useBlockParents = useBlockParents;
|
|
74
76
|
function useBlockIndex() {
|
|
77
|
+
var _a;
|
|
75
78
|
var ctx = (0, react_1.useContext)(InlineEditingContext);
|
|
76
|
-
return (ctx === null || ctx === void 0 ? void 0 : ctx.index)
|
|
79
|
+
return (_a = ctx === null || ctx === void 0 ? void 0 : ctx.index) !== null && _a !== void 0 ? _a : -1;
|
|
77
80
|
}
|
|
78
81
|
exports.useBlockIndex = useBlockIndex;
|
package/blocks/inlineEditing.js
CHANGED
|
@@ -34,11 +34,12 @@ var react_2 = require("@stitches/react");
|
|
|
34
34
|
var remoteProps_1 = require("../routing/remoteProps");
|
|
35
35
|
var routing_1 = require("../routing");
|
|
36
36
|
function EditableText(_a) {
|
|
37
|
+
var _b;
|
|
37
38
|
var id = _a.id, as = _a.as, appendOnEnter = _a.appendOnEnter, props = __rest(_a, ["id", "as", "appendOnEnter"]);
|
|
38
39
|
if (process.admin) {
|
|
39
|
-
var
|
|
40
|
+
var _c = (0, blockAttributes_1.useInlineEditableValue)(id), value = _c[0], setValue = _c[1];
|
|
40
41
|
var appendBlocks_1 = (0, blockAttributes_1.useBlockAppender)();
|
|
41
|
-
return ((0, jsx_runtime_1.jsx)(block_editor_1.RichText, __assign({}, props, { tagName: as, value: value || "", onChange: setValue, disableLineBreaks: props.disableLineBreaks, onKeyDownCapture: function (e) {
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(block_editor_1.RichText, __assign({}, props, { placeholder: (_b = props.placeholder) !== null && _b !== void 0 ? _b : props.defaultValue, tagName: as, value: value || "", onChange: setValue, disableLineBreaks: props.disableLineBreaks, onKeyDownCapture: function (e) {
|
|
42
43
|
if (e.key === "Enter" && appendOnEnter && appendBlocks_1) {
|
|
43
44
|
appendBlocks_1([(0, blocks_1.createBlock)("core/paragraph")]);
|
|
44
45
|
e.preventDefault();
|