@puckeditor/core 0.21.2 → 0.21.3-canary.26cf9e0b
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/README.md +1 -1
- package/dist/{chunk-PK2F2YZX.mjs → chunk-IY2D5KJQ.mjs} +8 -3
- package/dist/index.js +8 -3
- package/dist/index.mjs +1 -1
- package/dist/no-external.js +8 -3
- package/dist/no-external.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</picture>
|
|
10
10
|
</a>
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
_The visual editor for React_
|
|
13
13
|
|
|
14
14
|
[Documentation](https://puckeditor.com/docs?utm_source=readme&utm_medium=code&utm_campaign=repo&utm_contents=docs_link) • [Demo](https://demo.puckeditor.com/edit?utm_source=readme&utm_medium=code&utm_campaign=repo&utm_contents=demo_link) • [Discord](https://discord.gg/V9mDAhuxyZ) • [Contributing](https://github.com/puckeditor/puck/blob/main/CONTRIBUTING.md)
|
|
15
15
|
|
|
@@ -2707,6 +2707,10 @@ var DraggableComponent = ({
|
|
|
2707
2707
|
);
|
|
2708
2708
|
const onClick = useCallback7(
|
|
2709
2709
|
(e) => {
|
|
2710
|
+
const userIsDragging = !!zoneStore.getState().draggedItem;
|
|
2711
|
+
if (userIsDragging) {
|
|
2712
|
+
return;
|
|
2713
|
+
}
|
|
2710
2714
|
const el = e.target;
|
|
2711
2715
|
if (!el.closest("[data-puck-overlay-portal]")) {
|
|
2712
2716
|
e.stopPropagation();
|
|
@@ -3661,7 +3665,7 @@ var DragDropContextClient = ({
|
|
|
3661
3665
|
const { previewIndex = {} } = zoneStore.getState() || {};
|
|
3662
3666
|
const thisPreview = ((_b = previewIndex[zone]) == null ? void 0 : _b.props.id) === source.id ? previewIndex[zone] : null;
|
|
3663
3667
|
const onAnimationEnd = () => {
|
|
3664
|
-
var _a2, _b2;
|
|
3668
|
+
var _a2, _b2, _c, _d;
|
|
3665
3669
|
zoneStore.setState({ draggedItem: null });
|
|
3666
3670
|
if (event.canceled || (target == null ? void 0 : target.type) === "void") {
|
|
3667
3671
|
zoneStore.setState({ previewIndex: {} });
|
|
@@ -3695,15 +3699,16 @@ var DragDropContextClient = ({
|
|
|
3695
3699
|
);
|
|
3696
3700
|
}
|
|
3697
3701
|
}
|
|
3702
|
+
const movedToNewPosition = ((_b2 = initialSelector.current) == null ? void 0 : _b2.zone) !== (thisPreview == null ? void 0 : thisPreview.zone) || ((_c = initialSelector.current) == null ? void 0 : _c.index) !== (thisPreview == null ? void 0 : thisPreview.index);
|
|
3698
3703
|
dispatch({
|
|
3699
3704
|
type: "setUi",
|
|
3700
3705
|
ui: {
|
|
3701
3706
|
itemSelector: { index, zone },
|
|
3702
3707
|
isDragging: false
|
|
3703
3708
|
},
|
|
3704
|
-
recordHistory:
|
|
3709
|
+
recordHistory: movedToNewPosition
|
|
3705
3710
|
});
|
|
3706
|
-
(
|
|
3711
|
+
(_d = dragListeners.dragend) == null ? void 0 : _d.forEach((fn) => {
|
|
3707
3712
|
fn(event, manager);
|
|
3708
3713
|
});
|
|
3709
3714
|
};
|
package/dist/index.js
CHANGED
|
@@ -8287,6 +8287,10 @@ var DraggableComponent = ({
|
|
|
8287
8287
|
);
|
|
8288
8288
|
const onClick = (0, import_react51.useCallback)(
|
|
8289
8289
|
(e) => {
|
|
8290
|
+
const userIsDragging = !!zoneStore.getState().draggedItem;
|
|
8291
|
+
if (userIsDragging) {
|
|
8292
|
+
return;
|
|
8293
|
+
}
|
|
8290
8294
|
const el = e.target;
|
|
8291
8295
|
if (!el.closest("[data-puck-overlay-portal]")) {
|
|
8292
8296
|
e.stopPropagation();
|
|
@@ -10808,7 +10812,7 @@ var DragDropContextClient = ({
|
|
|
10808
10812
|
const { previewIndex = {} } = zoneStore.getState() || {};
|
|
10809
10813
|
const thisPreview = ((_b = previewIndex[zone]) == null ? void 0 : _b.props.id) === source.id ? previewIndex[zone] : null;
|
|
10810
10814
|
const onAnimationEnd = () => {
|
|
10811
|
-
var _a2, _b2;
|
|
10815
|
+
var _a2, _b2, _c, _d;
|
|
10812
10816
|
zoneStore.setState({ draggedItem: null });
|
|
10813
10817
|
if (event.canceled || (target == null ? void 0 : target.type) === "void") {
|
|
10814
10818
|
zoneStore.setState({ previewIndex: {} });
|
|
@@ -10842,15 +10846,16 @@ var DragDropContextClient = ({
|
|
|
10842
10846
|
);
|
|
10843
10847
|
}
|
|
10844
10848
|
}
|
|
10849
|
+
const movedToNewPosition = ((_b2 = initialSelector.current) == null ? void 0 : _b2.zone) !== (thisPreview == null ? void 0 : thisPreview.zone) || ((_c = initialSelector.current) == null ? void 0 : _c.index) !== (thisPreview == null ? void 0 : thisPreview.index);
|
|
10845
10850
|
dispatch({
|
|
10846
10851
|
type: "setUi",
|
|
10847
10852
|
ui: {
|
|
10848
10853
|
itemSelector: { index, zone },
|
|
10849
10854
|
isDragging: false
|
|
10850
10855
|
},
|
|
10851
|
-
recordHistory:
|
|
10856
|
+
recordHistory: movedToNewPosition
|
|
10852
10857
|
});
|
|
10853
|
-
(
|
|
10858
|
+
(_d = dragListeners.dragend) == null ? void 0 : _d.forEach((fn) => {
|
|
10854
10859
|
fn(event, manager);
|
|
10855
10860
|
});
|
|
10856
10861
|
};
|
package/dist/index.mjs
CHANGED
package/dist/no-external.js
CHANGED
|
@@ -8287,6 +8287,10 @@ var DraggableComponent = ({
|
|
|
8287
8287
|
);
|
|
8288
8288
|
const onClick = (0, import_react51.useCallback)(
|
|
8289
8289
|
(e) => {
|
|
8290
|
+
const userIsDragging = !!zoneStore.getState().draggedItem;
|
|
8291
|
+
if (userIsDragging) {
|
|
8292
|
+
return;
|
|
8293
|
+
}
|
|
8290
8294
|
const el = e.target;
|
|
8291
8295
|
if (!el.closest("[data-puck-overlay-portal]")) {
|
|
8292
8296
|
e.stopPropagation();
|
|
@@ -10808,7 +10812,7 @@ var DragDropContextClient = ({
|
|
|
10808
10812
|
const { previewIndex = {} } = zoneStore.getState() || {};
|
|
10809
10813
|
const thisPreview = ((_b = previewIndex[zone]) == null ? void 0 : _b.props.id) === source.id ? previewIndex[zone] : null;
|
|
10810
10814
|
const onAnimationEnd = () => {
|
|
10811
|
-
var _a2, _b2;
|
|
10815
|
+
var _a2, _b2, _c, _d;
|
|
10812
10816
|
zoneStore.setState({ draggedItem: null });
|
|
10813
10817
|
if (event.canceled || (target == null ? void 0 : target.type) === "void") {
|
|
10814
10818
|
zoneStore.setState({ previewIndex: {} });
|
|
@@ -10842,15 +10846,16 @@ var DragDropContextClient = ({
|
|
|
10842
10846
|
);
|
|
10843
10847
|
}
|
|
10844
10848
|
}
|
|
10849
|
+
const movedToNewPosition = ((_b2 = initialSelector.current) == null ? void 0 : _b2.zone) !== (thisPreview == null ? void 0 : thisPreview.zone) || ((_c = initialSelector.current) == null ? void 0 : _c.index) !== (thisPreview == null ? void 0 : thisPreview.index);
|
|
10845
10850
|
dispatch({
|
|
10846
10851
|
type: "setUi",
|
|
10847
10852
|
ui: {
|
|
10848
10853
|
itemSelector: { index, zone },
|
|
10849
10854
|
isDragging: false
|
|
10850
10855
|
},
|
|
10851
|
-
recordHistory:
|
|
10856
|
+
recordHistory: movedToNewPosition
|
|
10852
10857
|
});
|
|
10853
|
-
(
|
|
10858
|
+
(_d = dragListeners.dragend) == null ? void 0 : _d.forEach((fn) => {
|
|
10854
10859
|
fn(event, manager);
|
|
10855
10860
|
});
|
|
10856
10861
|
};
|
package/dist/no-external.mjs
CHANGED