@social-mail/social-mail-client 1.8.316 → 1.8.318
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 +17 -10
- package/dist/site-editor/editor/ui/SelectionUI.js.map +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.js +31 -11
- 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 +19 -10
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(() => {
|
|
@@ -87,10 +92,13 @@ const setCapture = (editor: HtmlPageEditor, element: HTMLElement, e: PointerEven
|
|
|
87
92
|
|
|
88
93
|
element.addEventListener("pointermove", captureMove);
|
|
89
94
|
element.setPointerCapture(e.pointerId);
|
|
90
|
-
const release = () => {
|
|
95
|
+
const release = (e1) => {
|
|
91
96
|
element.releasePointerCapture(e.pointerId);
|
|
92
97
|
element.removeEventListener("pointermove", captureMove);
|
|
93
98
|
element.removeEventListener("pointerup", release);
|
|
99
|
+
captureMove(e1);
|
|
100
|
+
d.resume();
|
|
101
|
+
editor.commit();
|
|
94
102
|
};
|
|
95
103
|
element.addEventListener("pointerup", release);
|
|
96
104
|
};
|
|
@@ -149,6 +157,7 @@ const eventPointerDown = (editor: HtmlPageEditor, e: PointerEvent) => {
|
|
|
149
157
|
r.left += r.dx;
|
|
150
158
|
r.bottom -= r.dy;
|
|
151
159
|
r.right -= r.dx;
|
|
160
|
+
r.move = true;
|
|
152
161
|
return r;
|
|
153
162
|
});
|
|
154
163
|
|