@social-mail/social-mail-client 1.8.316 → 1.8.317
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/site-editor/drag-drop/DragDropHelper.d.ts.map +1 -1
- package/dist/site-editor/drag-drop/DragDropHelper.js +6 -1
- package/dist/site-editor/drag-drop/DragDropHelper.js.map +1 -1
- package/dist/site-editor/editor/UndoRedo.d.ts +3 -0
- package/dist/site-editor/editor/UndoRedo.d.ts.map +1 -1
- package/dist/site-editor/editor/UndoRedo.js +8 -0
- package/dist/site-editor/editor/UndoRedo.js.map +1 -1
- package/dist/site-editor/editor/ui/SelectionUI.d.ts.map +1 -1
- package/dist/site-editor/editor/ui/SelectionUI.js +15 -9
- package/dist/site-editor/editor/ui/SelectionUI.js.map +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.js +29 -10
- package/dist/site-editor-app/SiteEditorApp.pack.js.map +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.min.js +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.min.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/site-editor/drag-drop/DragDropHelper.ts +6 -1
- package/src/site-editor/editor/UndoRedo.tsx +9 -0
- package/src/site-editor/editor/ui/SelectionUI.tsx +17 -9
package/package.json
CHANGED
|
@@ -24,8 +24,13 @@ export function InstallDragDropHelper(editor: HtmlPageEditor) {
|
|
|
24
24
|
const dropTarget = (editor as any).dropTarget as SelectedElement;
|
|
25
25
|
|
|
26
26
|
document.addEventListener("dragstart", (e) => {
|
|
27
|
+
const target = e.target as HTMLElement;
|
|
28
|
+
const s = document.defaultView.getComputedStyle(target);
|
|
29
|
+
if(/absolute|relative/i.test(s.position)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
27
32
|
setTimeout(() => document.body.contentEditable = "false", 0);
|
|
28
|
-
dragged =
|
|
33
|
+
dragged = target;
|
|
29
34
|
e.dataTransfer.dropEffect = "move";
|
|
30
35
|
e.dataTransfer.setDragImage(dragged, 0, 0);
|
|
31
36
|
});
|
|
@@ -41,6 +41,15 @@ export default class UndoRedo {
|
|
|
41
41
|
setTimeout(() => this.silent = false, 100);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
beginPause() {
|
|
45
|
+
this.silent = true;
|
|
46
|
+
return {
|
|
47
|
+
resume: () => {
|
|
48
|
+
this.silent = false;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
44
53
|
observe(records: MutationRecord[]) {
|
|
45
54
|
if (this.silent) {
|
|
46
55
|
return;
|
|
@@ -24,6 +24,7 @@ interface IRect {
|
|
|
24
24
|
dy;
|
|
25
25
|
sx;
|
|
26
26
|
sy;
|
|
27
|
+
move?: boolean;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
const setCapture = (editor: HtmlPageEditor, element: HTMLElement, e: PointerEvent, fx: (r: IRect, ) => IRect) => {
|
|
@@ -49,6 +50,8 @@ const setCapture = (editor: HtmlPageEditor, element: HTMLElement, e: PointerEven
|
|
|
49
50
|
|
|
50
51
|
const ps = (v, max) => (v* 100 / (max || 1)).toFixed(2);
|
|
51
52
|
|
|
53
|
+
const d = editor.undoRedo.beginPause();
|
|
54
|
+
|
|
52
55
|
const captureMove = (evt: PointerEvent) => {
|
|
53
56
|
const dx = evt.clientX - sx;
|
|
54
57
|
const dy = evt.clientY - sy;
|
|
@@ -67,16 +70,18 @@ const setCapture = (editor: HtmlPageEditor, element: HTMLElement, e: PointerEven
|
|
|
67
70
|
selectedElement.setAttribute(`${prefix}-inset`, av);
|
|
68
71
|
// if (/^img$/i.test(selectedElement.tagName)) {
|
|
69
72
|
// image needs width/height as well...
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
if (!r.move) {
|
|
74
|
+
let widthDiff = -r.left;
|
|
75
|
+
let heightDiff = -r.top;
|
|
76
|
+
if (ri.bottom === r.bottom) {
|
|
77
|
+
heightDiff -= r.bottom;
|
|
78
|
+
}
|
|
79
|
+
if (ri.right === r.right) {
|
|
80
|
+
widthDiff -= r.right;
|
|
81
|
+
}
|
|
82
|
+
selectedElement.setAttribute(`${prefix}-width`, ps(width + widthDiff, width) + "%");
|
|
83
|
+
selectedElement.setAttribute(`${prefix}-height`, ps(height + heightDiff, height) + "%");
|
|
77
84
|
}
|
|
78
|
-
selectedElement.setAttribute(`${prefix}-width`, ps(width + widthDiff, width) + "%");
|
|
79
|
-
selectedElement.setAttribute(`${prefix}-height`, ps(height + heightDiff, height) + "%");
|
|
80
85
|
// }
|
|
81
86
|
|
|
82
87
|
setTimeout(() => {
|
|
@@ -91,6 +96,8 @@ const setCapture = (editor: HtmlPageEditor, element: HTMLElement, e: PointerEven
|
|
|
91
96
|
element.releasePointerCapture(e.pointerId);
|
|
92
97
|
element.removeEventListener("pointermove", captureMove);
|
|
93
98
|
element.removeEventListener("pointerup", release);
|
|
99
|
+
d.resume();
|
|
100
|
+
editor.commit();
|
|
94
101
|
};
|
|
95
102
|
element.addEventListener("pointerup", release);
|
|
96
103
|
};
|
|
@@ -149,6 +156,7 @@ const eventPointerDown = (editor: HtmlPageEditor, e: PointerEvent) => {
|
|
|
149
156
|
r.left += r.dx;
|
|
150
157
|
r.bottom -= r.dy;
|
|
151
158
|
r.right -= r.dx;
|
|
159
|
+
r.move = true;
|
|
152
160
|
return r;
|
|
153
161
|
});
|
|
154
162
|
|