@websline/cms-view-utils 1.2.4 → 1.2.5
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
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
class: className,
|
|
7
7
|
color = "#dadad8",
|
|
8
8
|
countBlockItems = 0,
|
|
9
|
+
disabled = false,
|
|
9
10
|
hoverBorderColor = "#D1CECA",
|
|
10
11
|
hoverColor = "#E7E5E1",
|
|
11
12
|
iconBackgroundColor = "#FFFFFF",
|
|
@@ -45,6 +46,8 @@
|
|
|
45
46
|
);
|
|
46
47
|
|
|
47
48
|
const handleClick = () => {
|
|
49
|
+
if (disabled) return;
|
|
50
|
+
|
|
48
51
|
notifyCMS(EVENTS.BLOCK_ADD, {
|
|
49
52
|
position: countBlockItems,
|
|
50
53
|
});
|
|
@@ -53,8 +56,10 @@
|
|
|
53
56
|
|
|
54
57
|
<div>
|
|
55
58
|
<button
|
|
59
|
+
{disabled}
|
|
56
60
|
class={tw(
|
|
57
|
-
"group relative flex min-h-32 w-full
|
|
61
|
+
"group relative flex min-h-32 w-full items-center justify-center rounded-lg transition-all duration-300",
|
|
62
|
+
disabled ? "cursor-not-allowed opacity-40" : "cursor-pointer",
|
|
58
63
|
className,
|
|
59
64
|
)}
|
|
60
65
|
style={`--block-color: ${color}; --block-hover-color: ${hoverColor}; --block-hover-border-color: ${hoverBorderColor}; --block-text: ${textColor}; --block-icon-background: ${iconBackgroundColor}; --block-icon-color: ${iconColor}; --sublabel-color: ${sublabelColor};`}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import ImageText from "./skeleton/ImageText.svelte";
|
|
8
8
|
|
|
9
9
|
let {
|
|
10
|
+
autoTranslate,
|
|
10
11
|
barPosition,
|
|
11
12
|
block,
|
|
12
13
|
children,
|
|
@@ -45,9 +46,11 @@
|
|
|
45
46
|
|
|
46
47
|
switch (action) {
|
|
47
48
|
case CMS_ACTIONS.add:
|
|
49
|
+
if (autoTranslate) return;
|
|
48
50
|
notifyCMS(EVENTS.BLOCK_ADD, { position });
|
|
49
51
|
break;
|
|
50
52
|
case CMS_ACTIONS.delete:
|
|
53
|
+
if (isSynced) return;
|
|
51
54
|
notifyCMS(EVENTS.BLOCK_DELETE, {
|
|
52
55
|
draftBlockUuid: block.uuid,
|
|
53
56
|
});
|
|
@@ -64,6 +67,7 @@
|
|
|
64
67
|
});
|
|
65
68
|
break;
|
|
66
69
|
case CMS_ACTIONS.position:
|
|
70
|
+
if (autoTranslate) return;
|
|
67
71
|
notifyCMS(EVENTS.BLOCK_POSITION, {
|
|
68
72
|
draftBlockUuid: block.uuid,
|
|
69
73
|
});
|
|
@@ -79,6 +83,7 @@
|
|
|
79
83
|
};
|
|
80
84
|
|
|
81
85
|
let blockVisible = $derived(block?.meta?.visibility?.enabled);
|
|
86
|
+
let isSynced = $derived(autoTranslate && block?.meta?.sync?.isSynced);
|
|
82
87
|
|
|
83
88
|
let isHovered = $state(false);
|
|
84
89
|
let isActive = $state(false);
|
|
@@ -211,7 +216,10 @@
|
|
|
211
216
|
class:opacity-0={!toolbarVisible}>
|
|
212
217
|
<button
|
|
213
218
|
aria-label={t.addAria}
|
|
214
|
-
class=
|
|
219
|
+
class={[
|
|
220
|
+
"cursor-pointer",
|
|
221
|
+
(autoTranslate || isSynced) && "pointer-events-none opacity-40",
|
|
222
|
+
]}
|
|
215
223
|
onmouseenter={() => showTooltip("add")}
|
|
216
224
|
onmouseleave={hideTooltip}
|
|
217
225
|
onclick={(event) => handleClick(event, CMS_ACTIONS.add)}>
|
|
@@ -294,7 +302,7 @@
|
|
|
294
302
|
|
|
295
303
|
<!-- <button
|
|
296
304
|
aria-label="copy block"
|
|
297
|
-
class="cursor-pointer"
|
|
305
|
+
class={["cursor-pointer", isSynced && "pointer-events-none opacity-40"]}
|
|
298
306
|
onclick={(event) => handleClick(event, CMS_ACTIONS.copy)}>
|
|
299
307
|
<svg
|
|
300
308
|
width="24"
|
|
@@ -313,7 +321,10 @@
|
|
|
313
321
|
|
|
314
322
|
<button
|
|
315
323
|
aria-label={t.positionAria}
|
|
316
|
-
class=
|
|
324
|
+
class={[
|
|
325
|
+
"cursor-pointer",
|
|
326
|
+
(autoTranslate || isSynced) && "pointer-events-none opacity-40",
|
|
327
|
+
]}
|
|
317
328
|
onmouseenter={() => showTooltip("position")}
|
|
318
329
|
onmouseleave={hideTooltip}
|
|
319
330
|
onclick={(event) => handleClick(event, CMS_ACTIONS.position)}>
|
|
@@ -341,7 +352,7 @@
|
|
|
341
352
|
|
|
342
353
|
<button
|
|
343
354
|
aria-label={t.deleteAria}
|
|
344
|
-
class="
|
|
355
|
+
class={["cursor-pointer", isSynced && "pointer-events-none opacity-40"]}
|
|
345
356
|
onmouseenter={() => showTooltip("delete")}
|
|
346
357
|
onmouseleave={hideTooltip}
|
|
347
358
|
onclick={(event) => handleClick(event, CMS_ACTIONS.delete)}>
|