@saltcorn/builder 1.1.4-beta.1 → 1.1.4-beta.10
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/builder",
|
|
3
|
-
"version": "1.1.4-beta.
|
|
3
|
+
"version": "1.1.4-beta.10",
|
|
4
4
|
"description": "Drag and drop view builder for Saltcorn, open-source no-code platform",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"homepage": "https://saltcorn.com",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"@babel/preset-react": "7.24.7",
|
|
21
21
|
"@craftjs/core": "0.1.0-beta.20",
|
|
22
22
|
"@craftjs/utils": "0.1.0-beta.20",
|
|
23
|
-
"@saltcorn/common-code": "1.1.4-beta.
|
|
23
|
+
"@saltcorn/common-code": "1.1.4-beta.10",
|
|
24
24
|
"saltcorn-craft-layers-noeye": "0.1.0-beta.22",
|
|
25
25
|
"@fonticonpicker/react-fonticonpicker": "1.2.0",
|
|
26
26
|
"@fortawesome/fontawesome-svg-core": "1.2.34",
|
|
@@ -27,8 +27,8 @@ const BoxModelEditor = ({ setProp, node, sizeWithStyle }) => {
|
|
|
27
27
|
const selectedProperty = !selectedCategory
|
|
28
28
|
? false
|
|
29
29
|
: selectedDirection
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
? `${selectedCategory}-${selectedDirection}`
|
|
31
|
+
: selectedCategory;
|
|
32
32
|
const setCatAndDir = (c, d) => {
|
|
33
33
|
setSelectedCategory(c);
|
|
34
34
|
setSelectedDirection(d);
|
|
@@ -149,8 +149,8 @@ const BoxModelEditor = ({ setProp, node, sizeWithStyle }) => {
|
|
|
149
149
|
sizeWithStyle
|
|
150
150
|
? style["width"]
|
|
151
151
|
: node.width
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
? `${node.width}${node.widthUnit || "px"}`
|
|
153
|
+
: ""
|
|
154
154
|
}
|
|
155
155
|
/>
|
|
156
156
|
x
|
|
@@ -164,8 +164,8 @@ const BoxModelEditor = ({ setProp, node, sizeWithStyle }) => {
|
|
|
164
164
|
sizeWithStyle
|
|
165
165
|
? style["height"]
|
|
166
166
|
: node.height
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
? `${node.height}${node.heightUnit || "px"}`
|
|
168
|
+
: ""
|
|
169
169
|
}
|
|
170
170
|
/>
|
|
171
171
|
</div>
|
|
@@ -45,6 +45,17 @@ const fields = (mode) => {
|
|
|
45
45
|
name: "text",
|
|
46
46
|
type: "textarea",
|
|
47
47
|
segment_name: "contents",
|
|
48
|
+
onSave: (segment, node_props) => {
|
|
49
|
+
const div = document.createElement("div");
|
|
50
|
+
div.innerHTML = (node_props.text || "").trim();
|
|
51
|
+
const children = []; // Type: Node[]
|
|
52
|
+
const walker = document.createTreeWalker(div, NodeFilter.SHOW_TEXT);
|
|
53
|
+
while (walker.nextNode()) {
|
|
54
|
+
const s = walker.currentNode.data?.trim?.();
|
|
55
|
+
if (s && !(s.startsWith("{{") && s.endsWith("}}"))) children.push(s);
|
|
56
|
+
}
|
|
57
|
+
segment.text_strings = [...new Set(children.sort())];
|
|
58
|
+
},
|
|
48
59
|
sublabel:
|
|
49
60
|
mode === "show" || mode === "list"
|
|
50
61
|
? "Access fields with <code>{{ var_name }}</code>"
|
|
@@ -483,6 +483,7 @@ const craftToSaltcorn = (nodes, startFrom = "ROOT", options) => {
|
|
|
483
483
|
nodes[node.linkedNodes[f.nodeID]]
|
|
484
484
|
);
|
|
485
485
|
} else s[f.segment_name || f.name || f] = node.props[f.name || f];
|
|
486
|
+
if(f.onSave) f.onSave(s, node.props)
|
|
486
487
|
});
|
|
487
488
|
if (related.fields.some((f) => f.canBeFormula))
|
|
488
489
|
s.isFormula = node.props.isFormula;
|