@social-mail/social-mail-client 1.8.315 → 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 +16 -10
- package/dist/site-editor/editor/ui/SelectionUI.js.map +1 -1
- package/dist/site-editor-app/SiteEditorApp.pack.js +30 -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 +18 -12
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;
|
|
@@ -7,8 +7,6 @@ import { BindEditor } from "../../properties/controls/PropertyEditor";
|
|
|
7
7
|
import "./SelectionUI.global.css";
|
|
8
8
|
import HtmlPageEditor from "../HtmlPageEditor";
|
|
9
9
|
import { mobileScreenWidth, tabletScreenWidth } from "../sizes";
|
|
10
|
-
import { AtomBinder } from "@web-atoms/core/dist/core/AtomBinder";
|
|
11
|
-
|
|
12
10
|
declare global {
|
|
13
11
|
namespace JSX {
|
|
14
12
|
interface IntrinsicElements {
|
|
@@ -26,6 +24,7 @@ interface IRect {
|
|
|
26
24
|
dy;
|
|
27
25
|
sx;
|
|
28
26
|
sy;
|
|
27
|
+
move?: boolean;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
const setCapture = (editor: HtmlPageEditor, element: HTMLElement, e: PointerEvent, fx: (r: IRect, ) => IRect) => {
|
|
@@ -35,7 +34,7 @@ const setCapture = (editor: HtmlPageEditor, element: HTMLElement, e: PointerEven
|
|
|
35
34
|
? "styler-tablet"
|
|
36
35
|
: (editor.maxWidth === mobileScreenWidth
|
|
37
36
|
? "styler-mobile"
|
|
38
|
-
: "styler");
|
|
37
|
+
: "styler-desktop");
|
|
39
38
|
|
|
40
39
|
const sx = e.clientX;
|
|
41
40
|
const sy = e.clientY;
|
|
@@ -51,6 +50,8 @@ const setCapture = (editor: HtmlPageEditor, element: HTMLElement, e: PointerEven
|
|
|
51
50
|
|
|
52
51
|
const ps = (v, max) => (v* 100 / (max || 1)).toFixed(2);
|
|
53
52
|
|
|
53
|
+
const d = editor.undoRedo.beginPause();
|
|
54
|
+
|
|
54
55
|
const captureMove = (evt: PointerEvent) => {
|
|
55
56
|
const dx = evt.clientX - sx;
|
|
56
57
|
const dy = evt.clientY - sy;
|
|
@@ -69,16 +70,18 @@ const setCapture = (editor: HtmlPageEditor, element: HTMLElement, e: PointerEven
|
|
|
69
70
|
selectedElement.setAttribute(`${prefix}-inset`, av);
|
|
70
71
|
// if (/^img$/i.test(selectedElement.tagName)) {
|
|
71
72
|
// image needs width/height as well...
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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) + "%");
|
|
79
84
|
}
|
|
80
|
-
selectedElement.setAttribute(`${prefix}-width`, ps(width + widthDiff, width) + "%");
|
|
81
|
-
selectedElement.setAttribute(`${prefix}-height`, ps(height + heightDiff, height) + "%");
|
|
82
85
|
// }
|
|
83
86
|
|
|
84
87
|
setTimeout(() => {
|
|
@@ -93,6 +96,8 @@ const setCapture = (editor: HtmlPageEditor, element: HTMLElement, e: PointerEven
|
|
|
93
96
|
element.releasePointerCapture(e.pointerId);
|
|
94
97
|
element.removeEventListener("pointermove", captureMove);
|
|
95
98
|
element.removeEventListener("pointerup", release);
|
|
99
|
+
d.resume();
|
|
100
|
+
editor.commit();
|
|
96
101
|
};
|
|
97
102
|
element.addEventListener("pointerup", release);
|
|
98
103
|
};
|
|
@@ -151,6 +156,7 @@ const eventPointerDown = (editor: HtmlPageEditor, e: PointerEvent) => {
|
|
|
151
156
|
r.left += r.dx;
|
|
152
157
|
r.bottom -= r.dy;
|
|
153
158
|
r.right -= r.dx;
|
|
159
|
+
r.move = true;
|
|
154
160
|
return r;
|
|
155
161
|
});
|
|
156
162
|
|