@builder.io/sdk-react-native 0.5.6 → 0.5.8
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/components/content/components/enable-editor.js +2 -1
- package/dist/constants/sdk-version.js +1 -1
- package/dist/functions/register-component.js +1 -1
- package/dist/functions/transform-block-properties.js +6 -2
- package/package.json +1 -1
- package/src/components/content/components/enable-editor.jsx +2 -1
- package/src/constants/sdk-version.js +1 -1
- package/src/functions/register-component.js +1 -1
- package/src/functions/transform-block-properties.js +6 -2
|
@@ -44,6 +44,7 @@ const logger_js_1 = require("../../../helpers/logger.js");
|
|
|
44
44
|
const index_js_3 = require("../../../functions/get-content/index.js");
|
|
45
45
|
const is_previewing_js_1 = require("../../../functions/is-previewing.js");
|
|
46
46
|
const set_js_1 = require("../../../helpers/preview-lru-cache/set.js");
|
|
47
|
+
const fast_clone_js_1 = require("../../../functions/fast-clone.js");
|
|
47
48
|
function EnableEditor(props) {
|
|
48
49
|
var _a, _b, _c, _d, _e;
|
|
49
50
|
const elementRef = (0, react_1.useRef)(null);
|
|
@@ -184,7 +185,7 @@ function EnableEditor(props) {
|
|
|
184
185
|
if ((0, is_editing_js_1.isEditing)()) {
|
|
185
186
|
window.dispatchEvent(new CustomEvent("builder:component:stateChange", {
|
|
186
187
|
detail: {
|
|
187
|
-
state: props.builderContextSignal.rootState,
|
|
188
|
+
state: (0, fast_clone_js_1.fastClone)(props.builderContextSignal.rootState),
|
|
188
189
|
ref: {
|
|
189
190
|
name: props.model,
|
|
190
191
|
},
|
|
@@ -50,7 +50,7 @@ function registerComponent(component, info) {
|
|
|
50
50
|
exports.registerComponent = registerComponent;
|
|
51
51
|
const createRegisterComponentMessage = info => ({
|
|
52
52
|
type: "builder.registerComponent",
|
|
53
|
-
data: info
|
|
53
|
+
data: serializeComponentInfo(info)
|
|
54
54
|
});
|
|
55
55
|
exports.createRegisterComponentMessage = createRegisterComponentMessage;
|
|
56
56
|
const serializeFn = fnValue => {
|
|
@@ -6,12 +6,16 @@ const react_dom_1 = require("react-dom");
|
|
|
6
6
|
function transformBlockProperties(block) {
|
|
7
7
|
block.className = block.class;
|
|
8
8
|
delete block.class;
|
|
9
|
+
const id = block["builder-id"];
|
|
10
|
+
if (!id && (0, is_editing_js_1.isEditing)()) {
|
|
11
|
+
console.warn("No builder-id found on block", block);
|
|
12
|
+
}
|
|
9
13
|
block.ref = (ref) => {
|
|
10
14
|
if ((0, is_editing_js_1.isEditing)()) {
|
|
11
15
|
const el = (0, react_dom_1.findDOMNode)(ref);
|
|
12
16
|
if (el) {
|
|
13
|
-
el.setAttribute("builder-id",
|
|
14
|
-
el.classList.add(
|
|
17
|
+
el.setAttribute("builder-id", id);
|
|
18
|
+
el.classList.add(id);
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
21
|
};
|
package/package.json
CHANGED
|
@@ -26,6 +26,7 @@ import { logger } from "../../../helpers/logger.js";
|
|
|
26
26
|
import { fetchOneEntry } from "../../../functions/get-content/index.js";
|
|
27
27
|
import { isPreviewing } from "../../../functions/is-previewing.js";
|
|
28
28
|
import { postPreviewContent } from "../../../helpers/preview-lru-cache/set.js";
|
|
29
|
+
import { fastClone } from "../../../functions/fast-clone.js";
|
|
29
30
|
|
|
30
31
|
function EnableEditor(props) {
|
|
31
32
|
const elementRef = useRef(null);
|
|
@@ -186,7 +187,7 @@ function EnableEditor(props) {
|
|
|
186
187
|
window.dispatchEvent(
|
|
187
188
|
new CustomEvent("builder:component:stateChange", {
|
|
188
189
|
detail: {
|
|
189
|
-
state: props.builderContextSignal.rootState,
|
|
190
|
+
state: fastClone(props.builderContextSignal.rootState),
|
|
190
191
|
ref: {
|
|
191
192
|
name: props.model,
|
|
192
193
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.5.
|
|
1
|
+
export const SDK_VERSION = "0.5.8"
|
|
@@ -37,7 +37,7 @@ function registerComponent(component, info) {
|
|
|
37
37
|
}
|
|
38
38
|
const createRegisterComponentMessage = info => ({
|
|
39
39
|
type: "builder.registerComponent",
|
|
40
|
-
data: info
|
|
40
|
+
data: serializeComponentInfo(info)
|
|
41
41
|
});
|
|
42
42
|
const serializeFn = fnValue => {
|
|
43
43
|
const fnStr = fnValue.toString().trim();
|
|
@@ -3,12 +3,16 @@ import { findDOMNode } from "react-dom";
|
|
|
3
3
|
function transformBlockProperties(block) {
|
|
4
4
|
block.className = block.class;
|
|
5
5
|
delete block.class;
|
|
6
|
+
const id = block["builder-id"];
|
|
7
|
+
if (!id && isEditing()) {
|
|
8
|
+
console.warn("No builder-id found on block", block);
|
|
9
|
+
}
|
|
6
10
|
block.ref = (ref) => {
|
|
7
11
|
if (isEditing()) {
|
|
8
12
|
const el = findDOMNode(ref);
|
|
9
13
|
if (el) {
|
|
10
|
-
el.setAttribute("builder-id",
|
|
11
|
-
el.classList.add(
|
|
14
|
+
el.setAttribute("builder-id", id);
|
|
15
|
+
el.classList.add(id);
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
18
|
};
|