labellife-design-tool 2.2.8 → 2.3.0
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/cjs/canvas/workspace.js +74 -20
- package/dist/cjs/canvas/workspace.js.map +1 -1
- package/dist/cjs/index.js +582 -111
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/side-panel/index.js +191 -35
- package/dist/cjs/side-panel/index.js.map +1 -1
- package/dist/cjs/toolbar/toolbar.js +317 -56
- package/dist/cjs/toolbar/toolbar.js.map +1 -1
- package/dist/esm/canvas/workspace.js +74 -20
- package/dist/esm/canvas/workspace.js.map +1 -1
- package/dist/esm/index.js +582 -111
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/side-panel/index.js +191 -35
- package/dist/esm/side-panel/index.js.map +1 -1
- package/dist/esm/toolbar/toolbar.js +318 -57
- package/dist/esm/toolbar/toolbar.js.map +1 -1
- package/package.json +1 -1
|
@@ -971,8 +971,10 @@ var TextElementComponent = observer(function (_ref) {
|
|
|
971
971
|
var scaleY = absScale.y;
|
|
972
972
|
var cssFontStyle = element.fontStyle === 'italic' ? 'italic' : 'normal';
|
|
973
973
|
var cssFontWeight = String(element.fontWeight || 'normal');
|
|
974
|
+
var originalText = element.text;
|
|
974
975
|
var textarea = document.createElement('textarea');
|
|
975
|
-
textarea.value =
|
|
976
|
+
textarea.value = '';
|
|
977
|
+
textarea.placeholder = originalText;
|
|
976
978
|
textarea.style.position = 'absolute';
|
|
977
979
|
textarea.style.top = "".concat(textPosition.y, "px");
|
|
978
980
|
textarea.style.left = "".concat(textPosition.x, "px");
|
|
@@ -1005,15 +1007,21 @@ var TextElementComponent = observer(function (_ref) {
|
|
|
1005
1007
|
textarea.style.wordBreak = 'break-word';
|
|
1006
1008
|
textarea.style.minHeight = '0';
|
|
1007
1009
|
textarea.style.minWidth = '0';
|
|
1010
|
+
|
|
1011
|
+
// Placeholder inherits the element's text color at 40% opacity
|
|
1012
|
+
var placeholderStyle = document.createElement('style');
|
|
1013
|
+
placeholderStyle.textContent = "\n textarea:placeholder-shown { opacity: 1; }\n textarea::placeholder { color: ".concat(element.fill, "; opacity: 0.4; }\n ");
|
|
1014
|
+
stageContainer.appendChild(placeholderStyle);
|
|
1008
1015
|
stageContainer.appendChild(textarea);
|
|
1009
1016
|
textarea.focus();
|
|
1010
|
-
textarea.select();
|
|
1011
1017
|
var removed = false;
|
|
1012
1018
|
var removeTextarea = function removeTextarea() {
|
|
1019
|
+
var cancel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
1013
1020
|
if (removed) return;
|
|
1014
1021
|
removed = true;
|
|
1022
|
+
var newText = !cancel && textarea.value.length > 0 ? textarea.value : originalText;
|
|
1015
1023
|
element.set({
|
|
1016
|
-
text:
|
|
1024
|
+
text: newText
|
|
1017
1025
|
});
|
|
1018
1026
|
element.toggleEditMode(false);
|
|
1019
1027
|
if (grp) grp.show();
|
|
@@ -1021,12 +1029,15 @@ var TextElementComponent = observer(function (_ref) {
|
|
|
1021
1029
|
if (textarea.parentNode) {
|
|
1022
1030
|
textarea.parentNode.removeChild(textarea);
|
|
1023
1031
|
}
|
|
1032
|
+
if (placeholderStyle.parentNode) {
|
|
1033
|
+
placeholderStyle.parentNode.removeChild(placeholderStyle);
|
|
1034
|
+
}
|
|
1024
1035
|
};
|
|
1025
|
-
textarea.addEventListener('blur',
|
|
1036
|
+
textarea.addEventListener('blur', function () {
|
|
1037
|
+
return removeTextarea(false);
|
|
1038
|
+
});
|
|
1026
1039
|
textarea.addEventListener('keydown', function (e) {
|
|
1027
|
-
if (e.key === 'Escape')
|
|
1028
|
-
removeTextarea();
|
|
1029
|
-
}
|
|
1040
|
+
if (e.key === 'Escape') removeTextarea(true);
|
|
1030
1041
|
});
|
|
1031
1042
|
};
|
|
1032
1043
|
|
|
@@ -2186,6 +2197,7 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2186
2197
|
setDisplayIndex = _useState8[1];
|
|
2187
2198
|
var initialTotalRef = useRef(0);
|
|
2188
2199
|
var completedHistoryRef = useRef([]);
|
|
2200
|
+
var removedDueToSkipRef = useRef([]);
|
|
2189
2201
|
var isGoingBackRef = useRef(false);
|
|
2190
2202
|
var prevBackTriggerRef = useRef(backTrigger);
|
|
2191
2203
|
var config = getInputFieldsConfig();
|
|
@@ -2228,14 +2240,24 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2228
2240
|
var last = completedHistoryRef.current.pop();
|
|
2229
2241
|
if (!last) return;
|
|
2230
2242
|
var el = last.el,
|
|
2231
|
-
previousValue = last.previousValue
|
|
2243
|
+
previousValue = last.previousValue,
|
|
2244
|
+
removed = last.removed;
|
|
2232
2245
|
if (el) {
|
|
2233
2246
|
var isImage = el.custom && el.custom.inputType === 'image';
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2247
|
+
if (removed) {
|
|
2248
|
+
el.set({
|
|
2249
|
+
visible: true
|
|
2250
|
+
});
|
|
2251
|
+
removedDueToSkipRef.current = removedDueToSkipRef.current.filter(function (e) {
|
|
2252
|
+
return e.id !== el.id;
|
|
2253
|
+
});
|
|
2254
|
+
} else {
|
|
2255
|
+
el.set(isImage ? {
|
|
2256
|
+
src: previousValue || ''
|
|
2257
|
+
} : {
|
|
2258
|
+
text: previousValue || ''
|
|
2259
|
+
});
|
|
2260
|
+
}
|
|
2239
2261
|
isGoingBackRef.current = true;
|
|
2240
2262
|
store._unresolveInputField(el);
|
|
2241
2263
|
}
|
|
@@ -2253,6 +2275,15 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2253
2275
|
var currentField = fields[0];
|
|
2254
2276
|
if (!currentField) return null;
|
|
2255
2277
|
|
|
2278
|
+
// ── Helper: clear the removed-elements tracking ref ──────────────────
|
|
2279
|
+
// Elements are kept in the canvas with visible:false — they don't render
|
|
2280
|
+
// on screen or in exports, and can be restored via back navigation at any
|
|
2281
|
+
// point (including back-from-summary via backTrigger) without touching
|
|
2282
|
+
// deleted MST nodes.
|
|
2283
|
+
var _flushRemovedElements = function _flushRemovedElements() {
|
|
2284
|
+
removedDueToSkipRef.current = [];
|
|
2285
|
+
};
|
|
2286
|
+
|
|
2256
2287
|
// ── Shared submit / skip / back helpers ─────────────────────────────
|
|
2257
2288
|
var handleSubmit = function handleSubmit(elementId, value) {
|
|
2258
2289
|
var el = store.getElementById(elementId);
|
|
@@ -2276,6 +2307,7 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2276
2307
|
}
|
|
2277
2308
|
store._resolveInputField(elementId);
|
|
2278
2309
|
if (fields.length <= 1) {
|
|
2310
|
+
_flushRemovedElements();
|
|
2279
2311
|
store.history.addUndoState();
|
|
2280
2312
|
if (_onComplete) _onComplete();
|
|
2281
2313
|
} else {
|
|
@@ -2288,13 +2320,24 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2288
2320
|
var el = store.getElementById(elementId);
|
|
2289
2321
|
var isImage = el && el.custom && el.custom.inputType === 'image';
|
|
2290
2322
|
var previousValue = el ? isImage ? el.src : el.text : '';
|
|
2323
|
+
var shouldRemove = !!(el && el.custom && el.custom.removeIfSkipped);
|
|
2324
|
+
if (shouldRemove) {
|
|
2325
|
+
el.set({
|
|
2326
|
+
visible: false
|
|
2327
|
+
});
|
|
2328
|
+
removedDueToSkipRef.current.push(el);
|
|
2329
|
+
}
|
|
2291
2330
|
completedHistoryRef.current.push({
|
|
2292
2331
|
el: el,
|
|
2293
2332
|
previousValue: previousValue,
|
|
2294
|
-
skipped: true
|
|
2333
|
+
skipped: true,
|
|
2334
|
+
removed: shouldRemove
|
|
2295
2335
|
});
|
|
2296
2336
|
store._resolveInputField(elementId);
|
|
2297
2337
|
if (fields.length <= 1) {
|
|
2338
|
+
var hadRemovals = removedDueToSkipRef.current.length > 0;
|
|
2339
|
+
_flushRemovedElements();
|
|
2340
|
+
if (hadRemovals) store.history.addUndoState();
|
|
2298
2341
|
if (_onComplete) _onComplete();
|
|
2299
2342
|
} else {
|
|
2300
2343
|
setDisplayIndex(function (prev) {
|
|
@@ -2306,14 +2349,24 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2306
2349
|
var last = completedHistoryRef.current.pop();
|
|
2307
2350
|
if (!last) return;
|
|
2308
2351
|
var el = last.el,
|
|
2309
|
-
previousValue = last.previousValue
|
|
2352
|
+
previousValue = last.previousValue,
|
|
2353
|
+
removed = last.removed;
|
|
2310
2354
|
if (el) {
|
|
2311
2355
|
var isImage = el.custom && el.custom.inputType === 'image';
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2356
|
+
if (removed) {
|
|
2357
|
+
el.set({
|
|
2358
|
+
visible: true
|
|
2359
|
+
});
|
|
2360
|
+
removedDueToSkipRef.current = removedDueToSkipRef.current.filter(function (e) {
|
|
2361
|
+
return e.id !== el.id;
|
|
2362
|
+
});
|
|
2363
|
+
} else {
|
|
2364
|
+
el.set(isImage ? {
|
|
2365
|
+
src: previousValue || ''
|
|
2366
|
+
} : {
|
|
2367
|
+
text: previousValue || ''
|
|
2368
|
+
});
|
|
2369
|
+
}
|
|
2317
2370
|
store._unresolveInputField(el);
|
|
2318
2371
|
}
|
|
2319
2372
|
setDisplayIndex(function (prev) {
|
|
@@ -2347,6 +2400,7 @@ var InputFieldsDialog = observer(function (_ref2) {
|
|
|
2347
2400
|
onBack: handleBack,
|
|
2348
2401
|
canGoBack: canGoBack,
|
|
2349
2402
|
onComplete: function onComplete() {
|
|
2403
|
+
_flushRemovedElements();
|
|
2350
2404
|
store.history.addUndoState();
|
|
2351
2405
|
if (_onComplete) _onComplete();
|
|
2352
2406
|
}
|