sykpcomposer 0.0.225 → 0.0.228
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/{ImageComponent-d7557a1f.js → ImageComponent-5fc589b6.js} +273 -268
- package/dist/ImageComponent-5fc589b6.js.map +1 -0
- package/dist/{InlineImageComponent-185b293c.js → InlineImageComponent-4ce78b6a.js} +3 -3
- package/dist/{InlineImageComponent-185b293c.js.map → InlineImageComponent-4ce78b6a.js.map} +1 -1
- package/dist/{Placeholder-dd3f559e.js → Placeholder-874b4a67.js} +2 -2
- package/dist/{Placeholder-dd3f559e.js.map → Placeholder-874b4a67.js.map} +1 -1
- package/dist/{index-858ce1f1.js → index-63da0e16.js} +8074 -8127
- package/dist/index-63da0e16.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +3 -3
- package/dist/index.umd.js +99 -99
- package/dist/index.umd.js.map +1 -1
- package/dist/src/components/EditorVariant2.d.ts +11 -0
- package/dist/src/components/nodes/ImageNode.d.ts +1 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/ImageComponent-d7557a1f.js.map +0 -1
- package/dist/index-858ce1f1.js.map +0 -1
- package/dist/src/components/Editor2.d.ts +0 -17
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { j as v, u as
|
|
2
|
-
import { d as De, L as be, P as Re } from "./Placeholder-
|
|
3
|
-
import f, { useRef as Y, PureComponent as Ee, createRef as
|
|
1
|
+
import { j as v, u as ce, a as ae, d as F, w as V, x as q, $ as J, b as ne, c as de, e as le, f as ge, C as I, g as ue, k as pe, h as we, I as me, r as xe, i as fe, l as ye, m as Ce, t as ve } from "./index-63da0e16.js";
|
|
2
|
+
import { d as De, L as be, P as Re } from "./Placeholder-874b4a67.js";
|
|
3
|
+
import f, { useRef as Y, PureComponent as Ee, createRef as ie, useState as W, useCallback as T, useEffect as te, Suspense as Me } from "react";
|
|
4
4
|
import "react-dom";
|
|
5
|
-
function
|
|
6
|
-
return Math.min(Math.max(
|
|
5
|
+
function ee(l, t, e) {
|
|
6
|
+
return Math.min(Math.max(l, t), e);
|
|
7
7
|
}
|
|
8
8
|
const y = {
|
|
9
9
|
east: 1,
|
|
@@ -12,7 +12,7 @@ const y = {
|
|
|
12
12
|
west: 4
|
|
13
13
|
};
|
|
14
14
|
function Pe({
|
|
15
|
-
onResizeStart:
|
|
15
|
+
onResizeStart: l,
|
|
16
16
|
onResizeEnd: t,
|
|
17
17
|
buttonRef: e,
|
|
18
18
|
imageRef: o,
|
|
@@ -22,10 +22,10 @@ function Pe({
|
|
|
22
22
|
setShowCaption: p,
|
|
23
23
|
captionsEnabled: s
|
|
24
24
|
}) {
|
|
25
|
-
const r = Y(null),
|
|
25
|
+
const r = Y(null), d = Y({
|
|
26
26
|
priority: "",
|
|
27
27
|
value: "default"
|
|
28
|
-
}),
|
|
28
|
+
}), a = Y({
|
|
29
29
|
currentHeight: 0,
|
|
30
30
|
currentWidth: 0,
|
|
31
31
|
direction: 0,
|
|
@@ -35,78 +35,78 @@ function Pe({
|
|
|
35
35
|
startWidth: 0,
|
|
36
36
|
startX: 0,
|
|
37
37
|
startY: 0
|
|
38
|
-
}),
|
|
39
|
-
const
|
|
40
|
-
|
|
38
|
+
}), g = i.getRootElement(), c = g !== null ? g.getBoundingClientRect().width - 20 : 100, C = g !== null ? g.getBoundingClientRect().height - 20 : 100, P = 100, x = 100, $ = (w) => {
|
|
39
|
+
const u = w === y.east || w === y.west, m = w === y.north || w === y.south, H = w & y.north && w & y.west || w & y.south && w & y.east, E = u ? "ew" : m ? "ns" : H ? "nwse" : "nesw";
|
|
40
|
+
g !== null && g.style.setProperty(
|
|
41
41
|
"cursor",
|
|
42
|
-
`${
|
|
42
|
+
`${E}-resize`,
|
|
43
43
|
"important"
|
|
44
44
|
), document.body !== null && (document.body.style.setProperty(
|
|
45
45
|
"cursor",
|
|
46
|
-
`${
|
|
46
|
+
`${E}-resize`,
|
|
47
47
|
"important"
|
|
48
|
-
),
|
|
48
|
+
), d.current.value = document.body.style.getPropertyValue(
|
|
49
49
|
"-webkit-user-select"
|
|
50
|
-
),
|
|
50
|
+
), d.current.priority = document.body.style.getPropertyPriority(
|
|
51
51
|
"-webkit-user-select"
|
|
52
52
|
), document.body.style.setProperty(
|
|
53
53
|
"-webkit-user-select",
|
|
54
54
|
"none",
|
|
55
55
|
"important"
|
|
56
56
|
));
|
|
57
|
-
},
|
|
58
|
-
|
|
57
|
+
}, K = () => {
|
|
58
|
+
g !== null && g.style.setProperty("cursor", "text"), document.body !== null && (document.body.style.setProperty("cursor", "default"), document.body.style.setProperty(
|
|
59
59
|
"-webkit-user-select",
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
d.current.value,
|
|
61
|
+
d.current.priority
|
|
62
62
|
));
|
|
63
|
-
},
|
|
63
|
+
}, z = (w, u) => {
|
|
64
64
|
if (!i.isEditable())
|
|
65
65
|
return;
|
|
66
|
-
const m = o.current,
|
|
67
|
-
if (m !== null &&
|
|
68
|
-
|
|
69
|
-
const { width:
|
|
70
|
-
|
|
66
|
+
const m = o.current, H = r.current;
|
|
67
|
+
if (m !== null && H !== null) {
|
|
68
|
+
w.preventDefault();
|
|
69
|
+
const { width: E, height: b } = m.getBoundingClientRect(), D = a.current;
|
|
70
|
+
D.startWidth = E, D.startHeight = b, D.ratio = E / b, D.currentWidth = E, D.currentHeight = b, D.startX = w.clientX, D.startY = w.clientY, D.isResizing = !0, D.direction = u, $(u), l(), H.classList.add("image-control-wrapper--resizing"), m.style.height = `${b}px`, m.style.width = `${E}px`, document.addEventListener("pointermove", j), document.addEventListener("pointerup", k);
|
|
71
71
|
}
|
|
72
|
-
},
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
if (
|
|
76
|
-
let
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
m.startWidth +
|
|
80
|
-
|
|
72
|
+
}, j = (w) => {
|
|
73
|
+
const u = o.current, m = a.current, H = m.direction & (y.east | y.west), E = m.direction & (y.south | y.north);
|
|
74
|
+
if (u !== null && m.isResizing) {
|
|
75
|
+
if (H && E) {
|
|
76
|
+
let b = Math.floor(m.startX - w.clientX);
|
|
77
|
+
b = m.direction & y.east ? -b : b;
|
|
78
|
+
const D = ee(
|
|
79
|
+
m.startWidth + b,
|
|
80
|
+
P,
|
|
81
81
|
c
|
|
82
|
-
),
|
|
83
|
-
|
|
84
|
-
} else if (
|
|
85
|
-
let
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
m.startHeight +
|
|
82
|
+
), L = D / m.ratio;
|
|
83
|
+
u.style.width = `${D}px`, u.style.height = `${L}px`, m.currentHeight = L, m.currentWidth = D;
|
|
84
|
+
} else if (E) {
|
|
85
|
+
let b = Math.floor(m.startY - w.clientY);
|
|
86
|
+
b = m.direction & y.south ? -b : b;
|
|
87
|
+
const D = ee(
|
|
88
|
+
m.startHeight + b,
|
|
89
89
|
x,
|
|
90
90
|
C
|
|
91
91
|
);
|
|
92
|
-
|
|
92
|
+
u.style.height = `${D}px`, u.style.maxHeight = `${D}px`, m.currentHeight = D;
|
|
93
93
|
} else {
|
|
94
|
-
let
|
|
95
|
-
|
|
96
|
-
const
|
|
97
|
-
m.startWidth +
|
|
98
|
-
|
|
94
|
+
let b = Math.floor(m.startX - w.clientX);
|
|
95
|
+
b = m.direction & y.east ? -b : b;
|
|
96
|
+
const D = ee(
|
|
97
|
+
m.startWidth + b,
|
|
98
|
+
P,
|
|
99
99
|
c
|
|
100
100
|
);
|
|
101
|
-
|
|
101
|
+
u.style.width = `${D}px`, u.style.maxWidth = `${D}px`, m.currentWidth = D;
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
u && (u.setAttribute("width", `${m.currentWidth}`), u.setAttribute("height", `${m.currentHeight}`));
|
|
104
104
|
}
|
|
105
|
-
},
|
|
106
|
-
const
|
|
107
|
-
if (
|
|
108
|
-
const
|
|
109
|
-
|
|
105
|
+
}, k = () => {
|
|
106
|
+
const w = o.current, u = a.current, m = r.current;
|
|
107
|
+
if (w !== null && m !== null && u.isResizing) {
|
|
108
|
+
const H = u.currentWidth, E = u.currentHeight;
|
|
109
|
+
u.startWidth = 0, u.startHeight = 0, u.ratio = 0, u.startX = 0, u.startY = 0, u.currentWidth = 0, u.currentHeight = 0, u.isResizing = !1, m.classList.remove("image-control-wrapper--resizing"), K(), t(H, E), document.removeEventListener("pointermove", j), document.removeEventListener("pointerup", k);
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
112
|
return /* @__PURE__ */ v.jsxs("div", { ref: r, children: [
|
|
@@ -114,8 +114,8 @@ function Pe({
|
|
|
114
114
|
"div",
|
|
115
115
|
{
|
|
116
116
|
className: "image-resizer image-resizer-n",
|
|
117
|
-
onPointerDown: (
|
|
118
|
-
|
|
117
|
+
onPointerDown: (w) => {
|
|
118
|
+
z(w, y.north);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
),
|
|
@@ -123,8 +123,8 @@ function Pe({
|
|
|
123
123
|
"div",
|
|
124
124
|
{
|
|
125
125
|
className: "image-resizer image-resizer-ne",
|
|
126
|
-
onPointerDown: (
|
|
127
|
-
|
|
126
|
+
onPointerDown: (w) => {
|
|
127
|
+
z(w, y.north | y.east);
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
),
|
|
@@ -132,8 +132,8 @@ function Pe({
|
|
|
132
132
|
"div",
|
|
133
133
|
{
|
|
134
134
|
className: "image-resizer image-resizer-e",
|
|
135
|
-
onPointerDown: (
|
|
136
|
-
|
|
135
|
+
onPointerDown: (w) => {
|
|
136
|
+
z(w, y.east);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
),
|
|
@@ -141,8 +141,8 @@ function Pe({
|
|
|
141
141
|
"div",
|
|
142
142
|
{
|
|
143
143
|
className: "image-resizer image-resizer-se",
|
|
144
|
-
onPointerDown: (
|
|
145
|
-
|
|
144
|
+
onPointerDown: (w) => {
|
|
145
|
+
z(w, y.south | y.east);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
),
|
|
@@ -150,8 +150,8 @@ function Pe({
|
|
|
150
150
|
"div",
|
|
151
151
|
{
|
|
152
152
|
className: "image-resizer image-resizer-s",
|
|
153
|
-
onPointerDown: (
|
|
154
|
-
|
|
153
|
+
onPointerDown: (w) => {
|
|
154
|
+
z(w, y.south);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
),
|
|
@@ -159,8 +159,8 @@ function Pe({
|
|
|
159
159
|
"div",
|
|
160
160
|
{
|
|
161
161
|
className: "image-resizer image-resizer-sw",
|
|
162
|
-
onPointerDown: (
|
|
163
|
-
|
|
162
|
+
onPointerDown: (w) => {
|
|
163
|
+
z(w, y.south | y.west);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
),
|
|
@@ -168,8 +168,8 @@ function Pe({
|
|
|
168
168
|
"div",
|
|
169
169
|
{
|
|
170
170
|
className: "image-resizer image-resizer-w",
|
|
171
|
-
onPointerDown: (
|
|
172
|
-
|
|
171
|
+
onPointerDown: (w) => {
|
|
172
|
+
z(w, y.west);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
),
|
|
@@ -177,62 +177,62 @@ function Pe({
|
|
|
177
177
|
"div",
|
|
178
178
|
{
|
|
179
179
|
className: "image-resizer image-resizer-nw",
|
|
180
|
-
onPointerDown: (
|
|
181
|
-
|
|
180
|
+
onPointerDown: (w) => {
|
|
181
|
+
z(w, y.north | y.west);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
)
|
|
185
185
|
] });
|
|
186
186
|
}
|
|
187
|
-
const
|
|
187
|
+
const Q = {
|
|
188
188
|
x: 0,
|
|
189
189
|
y: 0,
|
|
190
190
|
width: 0,
|
|
191
191
|
height: 0,
|
|
192
192
|
unit: "px"
|
|
193
|
-
},
|
|
194
|
-
function
|
|
195
|
-
return
|
|
193
|
+
}, A = (l, t, e) => Math.min(Math.max(l, t), e), He = (...l) => l.filter((t) => t && typeof t == "string").join(" "), re = (l, t) => l === t || l.width === t.width && l.height === t.height && l.x === t.x && l.y === t.y && l.unit === t.unit;
|
|
194
|
+
function B(l, t, e) {
|
|
195
|
+
return l.unit === "%" ? { ...Q, ...l, unit: "%" } : {
|
|
196
196
|
unit: "%",
|
|
197
|
-
x:
|
|
198
|
-
y:
|
|
199
|
-
width:
|
|
200
|
-
height:
|
|
197
|
+
x: l.x ? l.x / t * 100 : 0,
|
|
198
|
+
y: l.y ? l.y / e * 100 : 0,
|
|
199
|
+
width: l.width ? l.width / t * 100 : 0,
|
|
200
|
+
height: l.height ? l.height / e * 100 : 0
|
|
201
201
|
};
|
|
202
202
|
}
|
|
203
|
-
function _(
|
|
204
|
-
return
|
|
203
|
+
function _(l, t, e) {
|
|
204
|
+
return l.unit ? l.unit === "px" ? { ...Q, ...l, unit: "px" } : {
|
|
205
205
|
unit: "px",
|
|
206
|
-
x:
|
|
207
|
-
y:
|
|
208
|
-
width:
|
|
209
|
-
height:
|
|
210
|
-
} : { ...
|
|
206
|
+
x: l.x ? l.x * t / 100 : 0,
|
|
207
|
+
y: l.y ? l.y * e / 100 : 0,
|
|
208
|
+
width: l.width ? l.width * t / 100 : 0,
|
|
209
|
+
height: l.height ? l.height * e / 100 : 0
|
|
210
|
+
} : { ...Q, ...l, unit: "px" };
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
const r = { ...
|
|
214
|
-
let
|
|
215
|
-
t && (t > 1 ? (
|
|
212
|
+
function oe(l, t, e, o, n, i = 0, h = 0, p = o, s = n) {
|
|
213
|
+
const r = { ...l };
|
|
214
|
+
let d = Math.min(i, o), a = Math.min(h, n), g = Math.min(p, o), c = Math.min(s, n);
|
|
215
|
+
t && (t > 1 ? (d = h ? h * t : d, a = d / t, g = p * t) : (a = i ? i / t : a, d = a * t, c = s / t)), r.y < 0 && (r.height = Math.max(r.height + r.y, a), r.y = 0), r.x < 0 && (r.width = Math.max(r.width + r.x, d), r.x = 0);
|
|
216
216
|
const C = o - (r.x + r.width);
|
|
217
|
-
C < 0 && (r.x = Math.min(r.x, o -
|
|
218
|
-
const
|
|
219
|
-
if (
|
|
217
|
+
C < 0 && (r.x = Math.min(r.x, o - d), r.width += C);
|
|
218
|
+
const P = n - (r.y + r.height);
|
|
219
|
+
if (P < 0 && (r.y = Math.min(r.y, n - a), r.height += P), r.width < d && ((e === "sw" || e == "nw") && (r.x -= d - r.width), r.width = d), r.height < a && ((e === "nw" || e == "ne") && (r.y -= a - r.height), r.height = a), r.width > g && ((e === "sw" || e == "nw") && (r.x -= g - r.width), r.width = g), r.height > c && ((e === "nw" || e == "ne") && (r.y -= c - r.height), r.height = c), t) {
|
|
220
220
|
const x = r.width / r.height;
|
|
221
221
|
if (x < t) {
|
|
222
|
-
const
|
|
223
|
-
(e === "nw" || e == "ne") && (r.y -=
|
|
222
|
+
const $ = Math.max(r.width / t, a);
|
|
223
|
+
(e === "nw" || e == "ne") && (r.y -= $ - r.height), r.height = $;
|
|
224
224
|
} else if (x > t) {
|
|
225
|
-
const
|
|
226
|
-
(e === "sw" || e == "nw") && (r.x -=
|
|
225
|
+
const $ = Math.max(r.height * t, d);
|
|
226
|
+
(e === "sw" || e == "nw") && (r.x -= $ - r.width), r.width = $;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
return r;
|
|
230
230
|
}
|
|
231
|
-
function $e(
|
|
232
|
-
const n = { ...
|
|
231
|
+
function $e(l, t, e, o) {
|
|
232
|
+
const n = { ...l };
|
|
233
233
|
return t === "ArrowLeft" ? o === "nw" ? (n.x -= e, n.y -= e, n.width += e, n.height += e) : o === "w" ? (n.x -= e, n.width += e) : o === "sw" ? (n.x -= e, n.width += e, n.height += e) : o === "ne" ? (n.y += e, n.width -= e, n.height -= e) : o === "e" ? n.width -= e : o === "se" && (n.width -= e, n.height -= e) : t === "ArrowRight" && (o === "nw" ? (n.x += e, n.y += e, n.width -= e, n.height -= e) : o === "w" ? (n.x += e, n.width -= e) : o === "sw" ? (n.x += e, n.width -= e, n.height -= e) : o === "ne" ? (n.y -= e, n.width += e, n.height += e) : o === "e" ? n.width += e : o === "se" && (n.width += e, n.height += e)), t === "ArrowUp" ? o === "nw" ? (n.x -= e, n.y -= e, n.width += e, n.height += e) : o === "n" ? (n.y -= e, n.height += e) : o === "ne" ? (n.y -= e, n.width += e, n.height += e) : o === "sw" ? (n.x += e, n.width -= e, n.height -= e) : o === "s" ? n.height -= e : o === "se" && (n.width -= e, n.height -= e) : t === "ArrowDown" && (o === "nw" ? (n.x += e, n.y += e, n.width -= e, n.height -= e) : o === "n" ? (n.y += e, n.height -= e) : o === "ne" ? (n.y += e, n.width -= e, n.height -= e) : o === "sw" ? (n.x -= e, n.width += e, n.height += e) : o === "s" ? n.height += e : o === "se" && (n.width += e, n.height += e)), n;
|
|
234
234
|
}
|
|
235
|
-
const
|
|
235
|
+
const O = { capture: !0, passive: !1 };
|
|
236
236
|
let ze = 0;
|
|
237
237
|
const X = class S extends Ee {
|
|
238
238
|
constructor() {
|
|
@@ -244,7 +244,7 @@ const X = class S extends Ee {
|
|
|
244
244
|
clientX: 0,
|
|
245
245
|
clientY: 0,
|
|
246
246
|
isResize: !0
|
|
247
|
-
}, this.componentRef =
|
|
247
|
+
}, this.componentRef = ie(), this.mediaRef = ie(), this.initChangeCalled = !1, this.instanceId = `rc-${ze++}`, this.state = {
|
|
248
248
|
cropIsActive: !1,
|
|
249
249
|
newCropIsBeingDrawn: !1
|
|
250
250
|
}, this.onCropPointerDown = (t) => {
|
|
@@ -256,17 +256,17 @@ const X = class S extends Ee {
|
|
|
256
256
|
return;
|
|
257
257
|
t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({ preventScroll: !0 });
|
|
258
258
|
const h = t.target.dataset.ord, p = !!h;
|
|
259
|
-
let s = t.clientX, r = t.clientY,
|
|
259
|
+
let s = t.clientX, r = t.clientY, d = i.x, a = i.y;
|
|
260
260
|
if (h) {
|
|
261
|
-
const
|
|
262
|
-
let C = 0,
|
|
263
|
-
h === "ne" || h == "e" ? (C =
|
|
261
|
+
const g = t.clientX - n.x, c = t.clientY - n.y;
|
|
262
|
+
let C = 0, P = 0;
|
|
263
|
+
h === "ne" || h == "e" ? (C = g - (i.x + i.width), P = c - i.y, d = i.x, a = i.y + i.height) : h === "se" || h === "s" ? (C = g - (i.x + i.width), P = c - (i.y + i.height), d = i.x, a = i.y) : h === "sw" || h == "w" ? (C = g - i.x, P = c - (i.y + i.height), d = i.x + i.width, a = i.y) : (h === "nw" || h == "n") && (C = g - i.x, P = c - i.y, d = i.x + i.width, a = i.y + i.height), s = d + n.x + C, r = a + n.y + P;
|
|
264
264
|
}
|
|
265
265
|
this.evData = {
|
|
266
266
|
startClientX: s,
|
|
267
267
|
startClientY: r,
|
|
268
|
-
startCropX:
|
|
269
|
-
startCropY:
|
|
268
|
+
startCropX: d,
|
|
269
|
+
startCropY: a,
|
|
270
270
|
clientX: t.clientX,
|
|
271
271
|
clientY: t.clientY,
|
|
272
272
|
isResize: p,
|
|
@@ -277,7 +277,7 @@ const X = class S extends Ee {
|
|
|
277
277
|
if (o || n || i && e)
|
|
278
278
|
return;
|
|
279
279
|
t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({ preventScroll: !0 });
|
|
280
|
-
const s = t.clientX - p.x, r = t.clientY - p.y,
|
|
280
|
+
const s = t.clientX - p.x, r = t.clientY - p.y, d = {
|
|
281
281
|
unit: "px",
|
|
282
282
|
x: s,
|
|
283
283
|
y: r,
|
|
@@ -292,7 +292,7 @@ const X = class S extends Ee {
|
|
|
292
292
|
clientX: t.clientX,
|
|
293
293
|
clientY: t.clientY,
|
|
294
294
|
isResize: !0
|
|
295
|
-
}, this.mouseDownOnCrop = !0, h(_(
|
|
295
|
+
}, this.mouseDownOnCrop = !0, h(_(d, p.width, p.height), B(d, p.width, p.height)), this.setState({ cropIsActive: !0, newCropIsBeingDrawn: !0 });
|
|
296
296
|
}, this.onDocPointerMove = (t) => {
|
|
297
297
|
const { crop: e, disabled: o, onChange: n, onDragStart: i } = this.props, h = this.getBox();
|
|
298
298
|
if (o || !e || !this.mouseDownOnCrop)
|
|
@@ -301,9 +301,9 @@ const X = class S extends Ee {
|
|
|
301
301
|
const { evData: p } = this;
|
|
302
302
|
p.clientX = t.clientX, p.clientY = t.clientY;
|
|
303
303
|
let s;
|
|
304
|
-
p.isResize ? s = this.resizeCrop() : s = this.dragCrop(),
|
|
304
|
+
p.isResize ? s = this.resizeCrop() : s = this.dragCrop(), re(e, s) || n(
|
|
305
305
|
_(s, h.width, h.height),
|
|
306
|
-
|
|
306
|
+
B(s, h.width, h.height)
|
|
307
307
|
);
|
|
308
308
|
}, this.onComponentKeyDown = (t) => {
|
|
309
309
|
const { crop: e, disabled: o, onChange: n, onComplete: i } = this.props;
|
|
@@ -313,11 +313,11 @@ const X = class S extends Ee {
|
|
|
313
313
|
let p = !1;
|
|
314
314
|
if (!e)
|
|
315
315
|
return;
|
|
316
|
-
const s = this.getBox(), r = this.makePixelCrop(s),
|
|
317
|
-
if (h === "ArrowLeft" ? (r.x -=
|
|
318
|
-
t.cancelable && t.preventDefault(), r.x =
|
|
319
|
-
const
|
|
320
|
-
n(
|
|
316
|
+
const s = this.getBox(), r = this.makePixelCrop(s), d = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? S.nudgeStepLarge : t.shiftKey ? S.nudgeStepMedium : S.nudgeStep;
|
|
317
|
+
if (h === "ArrowLeft" ? (r.x -= d, p = !0) : h === "ArrowRight" ? (r.x += d, p = !0) : h === "ArrowUp" ? (r.y -= d, p = !0) : h === "ArrowDown" && (r.y += d, p = !0), p) {
|
|
318
|
+
t.cancelable && t.preventDefault(), r.x = A(r.x, 0, s.width - r.width), r.y = A(r.y, 0, s.height - r.height);
|
|
319
|
+
const a = _(r, s.width, s.height), g = B(r, s.width, s.height);
|
|
320
|
+
n(a, g), i && i(a, g);
|
|
321
321
|
}
|
|
322
322
|
}, this.onHandlerKeyDown = (t, e) => {
|
|
323
323
|
const {
|
|
@@ -328,33 +328,33 @@ const X = class S extends Ee {
|
|
|
328
328
|
minHeight: p = 0,
|
|
329
329
|
maxWidth: s,
|
|
330
330
|
maxHeight: r,
|
|
331
|
-
onChange:
|
|
332
|
-
onComplete:
|
|
333
|
-
} = this.props,
|
|
331
|
+
onChange: d,
|
|
332
|
+
onComplete: a
|
|
333
|
+
} = this.props, g = this.getBox();
|
|
334
334
|
if (i || !n)
|
|
335
335
|
return;
|
|
336
336
|
if (t.key === "ArrowUp" || t.key === "ArrowDown" || t.key === "ArrowLeft" || t.key === "ArrowRight")
|
|
337
337
|
t.stopPropagation(), t.preventDefault();
|
|
338
338
|
else
|
|
339
339
|
return;
|
|
340
|
-
const c = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? S.nudgeStepLarge : t.shiftKey ? S.nudgeStepMedium : S.nudgeStep, C = _(n,
|
|
341
|
-
|
|
340
|
+
const c = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? S.nudgeStepLarge : t.shiftKey ? S.nudgeStepMedium : S.nudgeStep, C = _(n, g.width, g.height), P = $e(C, t.key, c, e), x = oe(
|
|
341
|
+
P,
|
|
342
342
|
o,
|
|
343
343
|
e,
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
g.width,
|
|
345
|
+
g.height,
|
|
346
346
|
h,
|
|
347
347
|
p,
|
|
348
348
|
s,
|
|
349
349
|
r
|
|
350
350
|
);
|
|
351
|
-
if (!
|
|
352
|
-
const
|
|
353
|
-
|
|
351
|
+
if (!re(n, x)) {
|
|
352
|
+
const $ = B(x, g.width, g.height);
|
|
353
|
+
d(x, $), a && a(x, $);
|
|
354
354
|
}
|
|
355
355
|
}, this.onDocPointerDone = (t) => {
|
|
356
356
|
const { crop: e, disabled: o, onComplete: n, onDragEnd: i } = this.props, h = this.getBox();
|
|
357
|
-
this.unbindDocMove(), !(o || !e) && this.mouseDownOnCrop && (this.mouseDownOnCrop = !1, this.dragStarted = !1, i && i(t), n && n(_(e, h.width, h.height),
|
|
357
|
+
this.unbindDocMove(), !(o || !e) && this.mouseDownOnCrop && (this.mouseDownOnCrop = !1, this.dragStarted = !1, i && i(t), n && n(_(e, h.width, h.height), B(e, h.width, h.height)), this.setState({ cropIsActive: !1, newCropIsBeingDrawn: !1 }));
|
|
358
358
|
}, this.onDragFocus = () => {
|
|
359
359
|
var t;
|
|
360
360
|
(t = this.componentRef.current) == null || t.scrollTo(0, 0);
|
|
@@ -376,17 +376,17 @@ const X = class S extends Ee {
|
|
|
376
376
|
const { crop: e, onComplete: o } = this.props;
|
|
377
377
|
if (o && !t.crop && e) {
|
|
378
378
|
const { width: n, height: i } = this.getBox();
|
|
379
|
-
n && i && o(_(e, n, i),
|
|
379
|
+
n && i && o(_(e, n, i), B(e, n, i));
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
382
|
componentWillUnmount() {
|
|
383
383
|
this.resizeObserver && this.resizeObserver.disconnect(), this.unbindDocMove();
|
|
384
384
|
}
|
|
385
385
|
bindDocMove() {
|
|
386
|
-
this.docMoveBound || (this.document.addEventListener("pointermove", this.onDocPointerMove,
|
|
386
|
+
this.docMoveBound || (this.document.addEventListener("pointermove", this.onDocPointerMove, O), this.document.addEventListener("pointerup", this.onDocPointerDone, O), this.document.addEventListener("pointercancel", this.onDocPointerDone, O), this.docMoveBound = !0);
|
|
387
387
|
}
|
|
388
388
|
unbindDocMove() {
|
|
389
|
-
this.docMoveBound && (this.document.removeEventListener("pointermove", this.onDocPointerMove,
|
|
389
|
+
this.docMoveBound && (this.document.removeEventListener("pointermove", this.onDocPointerMove, O), this.document.removeEventListener("pointerup", this.onDocPointerDone, O), this.document.removeEventListener("pointercancel", this.onDocPointerDone, O), this.docMoveBound = !1);
|
|
390
390
|
}
|
|
391
391
|
getCropStyle() {
|
|
392
392
|
const { crop: t } = this.props;
|
|
@@ -400,7 +400,7 @@ const X = class S extends Ee {
|
|
|
400
400
|
}
|
|
401
401
|
dragCrop() {
|
|
402
402
|
const { evData: t } = this, e = this.getBox(), o = this.makePixelCrop(e), n = t.clientX - t.startClientX, i = t.clientY - t.startClientY;
|
|
403
|
-
return o.x =
|
|
403
|
+
return o.x = A(t.startCropX + n, 0, e.width - o.width), o.y = A(t.startCropY + i, 0, e.height - o.height), o;
|
|
404
404
|
}
|
|
405
405
|
getPointRegion(t, e, o, n) {
|
|
406
406
|
const { evData: i } = this, h = i.clientX - t.x, p = i.clientY - t.y;
|
|
@@ -416,9 +416,9 @@ const X = class S extends Ee {
|
|
|
416
416
|
resizeCrop() {
|
|
417
417
|
const { evData: t } = this, { aspect: e = 0, maxWidth: o, maxHeight: n } = this.props, i = this.getBox(), [h, p] = this.resolveMinDimensions(i, e, this.props.minWidth, this.props.minHeight);
|
|
418
418
|
let s = this.makePixelCrop(i);
|
|
419
|
-
const r = this.getPointRegion(i, t.ord, h, p),
|
|
420
|
-
let
|
|
421
|
-
(h &&
|
|
419
|
+
const r = this.getPointRegion(i, t.ord, h, p), d = t.ord || r;
|
|
420
|
+
let a = t.clientX - t.startClientX, g = t.clientY - t.startClientY;
|
|
421
|
+
(h && d === "nw" || d === "w" || d === "sw") && (a = Math.min(a, -h)), (p && d === "nw" || d === "n" || d === "ne") && (g = Math.min(g, -p));
|
|
422
422
|
const c = {
|
|
423
423
|
unit: "px",
|
|
424
424
|
x: 0,
|
|
@@ -426,8 +426,8 @@ const X = class S extends Ee {
|
|
|
426
426
|
width: 0,
|
|
427
427
|
height: 0
|
|
428
428
|
};
|
|
429
|
-
r === "ne" ? (c.x = t.startCropX, c.width =
|
|
430
|
-
const C =
|
|
429
|
+
r === "ne" ? (c.x = t.startCropX, c.width = a, e ? (c.height = c.width / e, c.y = t.startCropY - c.height) : (c.height = Math.abs(g), c.y = t.startCropY - c.height)) : r === "se" ? (c.x = t.startCropX, c.y = t.startCropY, c.width = a, e ? c.height = c.width / e : c.height = g) : r === "sw" ? (c.x = t.startCropX + a, c.y = t.startCropY, c.width = Math.abs(a), e ? c.height = c.width / e : c.height = g) : r === "nw" && (c.x = t.startCropX + a, c.width = Math.abs(a), e ? (c.height = c.width / e, c.y = t.startCropY - c.height) : (c.height = Math.abs(g), c.y = t.startCropY + g));
|
|
430
|
+
const C = oe(
|
|
431
431
|
c,
|
|
432
432
|
e,
|
|
433
433
|
r,
|
|
@@ -438,7 +438,7 @@ const X = class S extends Ee {
|
|
|
438
438
|
o,
|
|
439
439
|
n
|
|
440
440
|
);
|
|
441
|
-
return e || S.xyOrds.indexOf(
|
|
441
|
+
return e || S.xyOrds.indexOf(d) > -1 ? s = C : S.xOrds.indexOf(d) > -1 ? (s.x = C.x, s.width = C.width) : S.yOrds.indexOf(d) > -1 && (s.y = C.y, s.height = C.height), s.x = A(s.x, 0, i.width - s.width), s.y = A(s.y, 0, i.height - s.height), s;
|
|
442
442
|
}
|
|
443
443
|
renderCropSelection() {
|
|
444
444
|
const {
|
|
@@ -547,17 +547,17 @@ const X = class S extends Ee {
|
|
|
547
547
|
);
|
|
548
548
|
}
|
|
549
549
|
makePixelCrop(t) {
|
|
550
|
-
const e = { ...
|
|
550
|
+
const e = { ...Q, ...this.props.crop || {} };
|
|
551
551
|
return _(e, t.width, t.height);
|
|
552
552
|
}
|
|
553
553
|
render() {
|
|
554
|
-
const { aspect: t, children: e, circularCrop: o, className: n, crop: i, disabled: h, locked: p, style: s, ruleOfThirds: r } = this.props, { cropIsActive:
|
|
554
|
+
const { aspect: t, children: e, circularCrop: o, className: n, crop: i, disabled: h, locked: p, style: s, ruleOfThirds: r } = this.props, { cropIsActive: d, newCropIsBeingDrawn: a } = this.state, g = i ? this.renderCropSelection() : null, c = He(
|
|
555
555
|
"ReactCrop",
|
|
556
556
|
n,
|
|
557
|
-
|
|
557
|
+
d && "ReactCrop--active",
|
|
558
558
|
h && "ReactCrop--disabled",
|
|
559
559
|
p && "ReactCrop--locked",
|
|
560
|
-
|
|
560
|
+
a && "ReactCrop--new-crop",
|
|
561
561
|
i && t && "ReactCrop--fixed-aspect",
|
|
562
562
|
i && o && "ReactCrop--circular-crop",
|
|
563
563
|
i && r && "ReactCrop--rule-of-thirds",
|
|
@@ -582,7 +582,7 @@ const X = class S extends Ee {
|
|
|
582
582
|
height: `${i.height}${i.unit}`,
|
|
583
583
|
fill: "black"
|
|
584
584
|
}
|
|
585
|
-
))), /* @__PURE__ */ f.createElement("rect", { fill: "black", fillOpacity: 0.5, width: "100%", height: "100%", mask: `url(#hole-${this.instanceId})` })) : void 0,
|
|
585
|
+
))), /* @__PURE__ */ f.createElement("rect", { fill: "black", fillOpacity: 0.5, width: "100%", height: "100%", mask: `url(#hole-${this.instanceId})` })) : void 0, g);
|
|
586
586
|
}
|
|
587
587
|
};
|
|
588
588
|
X.xOrds = ["e", "w"], X.yOrds = ["n", "s"], X.xyOrds = ["nw", "ne", "se", "sw"], X.nudgeStep = 1, X.nudgeStepMedium = 10, X.nudgeStepLarge = 100, X.defaultProps = {
|
|
@@ -599,9 +599,9 @@ X.xOrds = ["e", "w"], X.yOrds = ["n", "s"], X.xyOrds = ["nw", "ne", "se", "sw"],
|
|
|
599
599
|
}
|
|
600
600
|
};
|
|
601
601
|
let Ne = X;
|
|
602
|
-
const
|
|
603
|
-
function
|
|
604
|
-
altText:
|
|
602
|
+
const se = ve();
|
|
603
|
+
function Se({
|
|
604
|
+
altText: l,
|
|
605
605
|
className: t,
|
|
606
606
|
src: e,
|
|
607
607
|
width: o,
|
|
@@ -610,9 +610,10 @@ function ke({
|
|
|
610
610
|
imageRef: h,
|
|
611
611
|
startCrop: p,
|
|
612
612
|
setStartCrop: s,
|
|
613
|
-
isFocused: r
|
|
613
|
+
isFocused: r,
|
|
614
|
+
nodeKey: d
|
|
614
615
|
}) {
|
|
615
|
-
const [a,
|
|
616
|
+
const [a, g] = W(null), [c, C] = W(null), [P, x] = W({
|
|
616
617
|
//@ts-ignore
|
|
617
618
|
unit: "px",
|
|
618
619
|
// Can be 'px' or '%'
|
|
@@ -620,57 +621,60 @@ function ke({
|
|
|
620
621
|
y: 25,
|
|
621
622
|
width: 50,
|
|
622
623
|
height: 50
|
|
623
|
-
}),
|
|
624
|
+
}), [$] = ae(), K = () => {
|
|
624
625
|
if (a) {
|
|
625
|
-
const
|
|
626
|
-
if (!
|
|
626
|
+
const u = h.current;
|
|
627
|
+
if (!u || !a)
|
|
627
628
|
return;
|
|
628
|
-
const
|
|
629
|
-
a.width *
|
|
630
|
-
a.height *
|
|
631
|
-
),
|
|
632
|
-
if (!
|
|
629
|
+
const m = u.naturalWidth / u.width, H = u.naturalHeight / u.height, E = new OffscreenCanvas(
|
|
630
|
+
a.width * m,
|
|
631
|
+
a.height * H
|
|
632
|
+
), b = E.getContext("2d");
|
|
633
|
+
if (!b)
|
|
633
634
|
throw new Error("No 2D context available");
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
a.x *
|
|
637
|
-
a.y *
|
|
638
|
-
a.width *
|
|
639
|
-
a.height *
|
|
635
|
+
b.drawImage(
|
|
636
|
+
u,
|
|
637
|
+
a.x * m,
|
|
638
|
+
a.y * H,
|
|
639
|
+
a.width * m,
|
|
640
|
+
a.height * H,
|
|
640
641
|
0,
|
|
641
642
|
0,
|
|
642
|
-
a.width *
|
|
643
|
-
a.height *
|
|
644
|
-
),
|
|
645
|
-
const
|
|
646
|
-
|
|
643
|
+
a.width * m,
|
|
644
|
+
a.height * H
|
|
645
|
+
), E.convertToBlob({ type: "image/png" }).then((D) => {
|
|
646
|
+
const L = URL.createObjectURL(D);
|
|
647
|
+
C(L), s(!1), $.update(() => {
|
|
648
|
+
const G = q(d);
|
|
649
|
+
J(G) && G.setSrc(L);
|
|
650
|
+
});
|
|
647
651
|
});
|
|
648
652
|
}
|
|
649
653
|
}, z = () => {
|
|
650
|
-
p || s((
|
|
651
|
-
if (
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
+
p || s((u) => {
|
|
655
|
+
if (u === !1) {
|
|
656
|
+
const m = h.current;
|
|
657
|
+
x({
|
|
654
658
|
unit: "px",
|
|
655
659
|
// Can be 'px' or '%'
|
|
656
660
|
x: 0,
|
|
657
661
|
y: 0,
|
|
658
|
-
width:
|
|
659
|
-
height:
|
|
662
|
+
width: m.width,
|
|
663
|
+
height: m.height
|
|
660
664
|
});
|
|
661
665
|
}
|
|
662
|
-
return !
|
|
666
|
+
return !u;
|
|
663
667
|
});
|
|
664
|
-
},
|
|
665
|
-
|
|
666
|
-
a && (
|
|
668
|
+
}, j = Y(null), k = Y(null);
|
|
669
|
+
te(() => {
|
|
670
|
+
a && (j.current = a);
|
|
667
671
|
}, [a]);
|
|
668
|
-
const
|
|
669
|
-
|
|
672
|
+
const w = (u) => {
|
|
673
|
+
k.current && !k.current.contains(u.target) && s(!1);
|
|
670
674
|
};
|
|
671
|
-
return
|
|
672
|
-
document.removeEventListener("mousedown",
|
|
673
|
-
}), []), /* @__PURE__ */ v.jsxs("div", { ref:
|
|
675
|
+
return te(() => (document.addEventListener("mousedown", w), () => {
|
|
676
|
+
document.removeEventListener("mousedown", w);
|
|
677
|
+
}), []), /* @__PURE__ */ v.jsxs("div", { ref: k, children: [
|
|
674
678
|
r && /* @__PURE__ */ v.jsx(
|
|
675
679
|
"button",
|
|
676
680
|
{
|
|
@@ -685,22 +689,22 @@ function ke({
|
|
|
685
689
|
{
|
|
686
690
|
style: { zIndex: 999 },
|
|
687
691
|
className: "image-caption-button",
|
|
688
|
-
onClick: () =>
|
|
692
|
+
onClick: () => K(),
|
|
689
693
|
children: "Apply Crop"
|
|
690
694
|
}
|
|
691
695
|
),
|
|
692
696
|
p ? /* @__PURE__ */ v.jsx(
|
|
693
697
|
Ne,
|
|
694
698
|
{
|
|
695
|
-
crop:
|
|
696
|
-
onChange: (
|
|
697
|
-
onComplete: (
|
|
699
|
+
crop: P,
|
|
700
|
+
onChange: (u) => x(u),
|
|
701
|
+
onComplete: (u) => g(u),
|
|
698
702
|
children: /* @__PURE__ */ v.jsx(
|
|
699
703
|
"img",
|
|
700
704
|
{
|
|
701
705
|
className: t || void 0,
|
|
702
|
-
src:
|
|
703
|
-
alt:
|
|
706
|
+
src: c || e,
|
|
707
|
+
alt: l,
|
|
704
708
|
ref: h,
|
|
705
709
|
style: {
|
|
706
710
|
height: n,
|
|
@@ -717,8 +721,8 @@ function ke({
|
|
|
717
721
|
"img",
|
|
718
722
|
{
|
|
719
723
|
className: t || void 0,
|
|
720
|
-
src:
|
|
721
|
-
alt:
|
|
724
|
+
src: c || e,
|
|
725
|
+
alt: l,
|
|
722
726
|
ref: h,
|
|
723
727
|
style: {
|
|
724
728
|
height: n,
|
|
@@ -732,7 +736,7 @@ function ke({
|
|
|
732
736
|
] });
|
|
733
737
|
}
|
|
734
738
|
function Ye({
|
|
735
|
-
src:
|
|
739
|
+
src: l,
|
|
736
740
|
altText: t,
|
|
737
741
|
nodeKey: e,
|
|
738
742
|
width: o,
|
|
@@ -742,138 +746,139 @@ function Ye({
|
|
|
742
746
|
showCaption: p,
|
|
743
747
|
caption: s
|
|
744
748
|
}) {
|
|
745
|
-
const r = Y(null),
|
|
746
|
-
(
|
|
747
|
-
if (
|
|
748
|
-
|
|
749
|
-
const
|
|
750
|
-
if (
|
|
751
|
-
return
|
|
749
|
+
const r = Y(null), d = Y(null), [a, g, c] = ce(e), [C, P] = W(!1), [x] = ae(), [$, K] = W(null), [z, j] = W(!1), k = Y(null), w = T(
|
|
750
|
+
(M) => {
|
|
751
|
+
if (a && F(V())) {
|
|
752
|
+
M.preventDefault();
|
|
753
|
+
const N = q(e);
|
|
754
|
+
if (J(N))
|
|
755
|
+
return N.remove(), !0;
|
|
752
756
|
}
|
|
753
757
|
return !1;
|
|
754
758
|
},
|
|
755
|
-
[
|
|
756
|
-
),
|
|
757
|
-
(
|
|
758
|
-
const
|
|
759
|
-
if (
|
|
759
|
+
[a, e]
|
|
760
|
+
), u = T(
|
|
761
|
+
(M) => {
|
|
762
|
+
const R = V(), N = d.current;
|
|
763
|
+
if (a && F(R) && R.getNodes().length === 1) {
|
|
760
764
|
if (p)
|
|
761
|
-
return
|
|
762
|
-
if (
|
|
763
|
-
return
|
|
765
|
+
return ne(null), M.preventDefault(), s.focus(), !0;
|
|
766
|
+
if (N !== null && N !== document.activeElement)
|
|
767
|
+
return M.preventDefault(), N.focus(), !0;
|
|
764
768
|
}
|
|
765
769
|
return !1;
|
|
766
770
|
},
|
|
767
|
-
[s,
|
|
768
|
-
), m =
|
|
769
|
-
(
|
|
770
|
-
|
|
771
|
-
const
|
|
772
|
-
|
|
771
|
+
[s, a, p]
|
|
772
|
+
), m = T(
|
|
773
|
+
(M) => k.current === s || d.current === M.target ? (ne(null), x.update(() => {
|
|
774
|
+
g(!0);
|
|
775
|
+
const R = x.getRootElement();
|
|
776
|
+
R !== null && R.focus();
|
|
773
777
|
}), !0) : !1,
|
|
774
|
-
[s, x,
|
|
775
|
-
),
|
|
776
|
-
(
|
|
777
|
-
const
|
|
778
|
-
return C ? !0 :
|
|
778
|
+
[s, x, g]
|
|
779
|
+
), H = T(
|
|
780
|
+
(M) => {
|
|
781
|
+
const R = M;
|
|
782
|
+
return C ? !0 : R.target === r.current ? (R.shiftKey ? g(!a) : (c(), g(!0)), !0) : !1;
|
|
779
783
|
},
|
|
780
|
-
[C,
|
|
781
|
-
),
|
|
782
|
-
(
|
|
784
|
+
[C, a, g, c]
|
|
785
|
+
), E = T(
|
|
786
|
+
(M) => {
|
|
783
787
|
x.getEditorState().read(() => {
|
|
784
|
-
const
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
+
const R = V();
|
|
789
|
+
M.target.tagName === "IMG" && de(R) && R.getNodes().length === 1 && x.dispatchCommand(
|
|
790
|
+
se,
|
|
791
|
+
M
|
|
788
792
|
);
|
|
789
793
|
});
|
|
790
794
|
},
|
|
791
795
|
[x]
|
|
792
796
|
);
|
|
793
|
-
|
|
794
|
-
let
|
|
795
|
-
const
|
|
796
|
-
x.registerUpdateListener(({ editorState:
|
|
797
|
-
|
|
797
|
+
te(() => {
|
|
798
|
+
let M = !0;
|
|
799
|
+
const R = x.getRootElement(), N = le(
|
|
800
|
+
x.registerUpdateListener(({ editorState: U }) => {
|
|
801
|
+
M && K(U.read(() => V()));
|
|
798
802
|
}),
|
|
799
803
|
x.registerCommand(
|
|
800
804
|
fe,
|
|
801
|
-
(
|
|
805
|
+
(U, he) => (k.current = he, !1),
|
|
802
806
|
I
|
|
803
807
|
),
|
|
804
808
|
x.registerCommand(
|
|
805
809
|
xe,
|
|
806
|
-
|
|
810
|
+
H,
|
|
807
811
|
I
|
|
808
812
|
),
|
|
809
813
|
x.registerCommand(
|
|
810
|
-
|
|
811
|
-
|
|
814
|
+
se,
|
|
815
|
+
H,
|
|
812
816
|
I
|
|
813
817
|
),
|
|
814
818
|
x.registerCommand(
|
|
815
819
|
me,
|
|
816
|
-
(
|
|
820
|
+
(U) => U.target === r.current ? (U.preventDefault(), !0) : !1,
|
|
817
821
|
I
|
|
818
822
|
),
|
|
819
823
|
x.registerCommand(
|
|
820
824
|
we,
|
|
821
|
-
|
|
825
|
+
w,
|
|
822
826
|
I
|
|
823
827
|
),
|
|
824
828
|
x.registerCommand(
|
|
825
829
|
pe,
|
|
826
|
-
|
|
830
|
+
w,
|
|
827
831
|
I
|
|
828
832
|
),
|
|
829
|
-
x.registerCommand(ue,
|
|
833
|
+
x.registerCommand(ue, u, I),
|
|
830
834
|
x.registerCommand(ge, m, I)
|
|
831
835
|
);
|
|
832
|
-
return
|
|
833
|
-
|
|
836
|
+
return R == null || R.addEventListener("contextmenu", E), () => {
|
|
837
|
+
M = !1, N(), R == null || R.removeEventListener("contextmenu", E);
|
|
834
838
|
};
|
|
835
839
|
}, [
|
|
836
840
|
c,
|
|
837
841
|
x,
|
|
838
842
|
C,
|
|
839
|
-
|
|
843
|
+
a,
|
|
840
844
|
e,
|
|
841
|
-
u,
|
|
842
845
|
w,
|
|
846
|
+
u,
|
|
843
847
|
m,
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
848
|
+
H,
|
|
849
|
+
E,
|
|
850
|
+
g
|
|
847
851
|
]);
|
|
848
|
-
const
|
|
852
|
+
const b = () => {
|
|
849
853
|
x.update(() => {
|
|
850
|
-
const
|
|
851
|
-
|
|
854
|
+
const M = q(e);
|
|
855
|
+
J(M) && M.setShowCaption(!0);
|
|
852
856
|
});
|
|
853
|
-
},
|
|
857
|
+
}, D = (M, R) => {
|
|
854
858
|
setTimeout(() => {
|
|
855
|
-
|
|
859
|
+
P(!1);
|
|
856
860
|
}, 200), x.update(() => {
|
|
857
|
-
const
|
|
858
|
-
|
|
861
|
+
const N = q(e);
|
|
862
|
+
console.log(N, "node"), J(N) && N.setWidthAndHeight(M, R);
|
|
859
863
|
});
|
|
860
|
-
},
|
|
861
|
-
|
|
862
|
-
},
|
|
864
|
+
}, L = () => {
|
|
865
|
+
z || P(!0);
|
|
866
|
+
}, G = a && F($) && !C, Z = a || C;
|
|
863
867
|
return /* @__PURE__ */ v.jsx(Me, { fallback: null, children: /* @__PURE__ */ v.jsxs(v.Fragment, { children: [
|
|
864
|
-
/* @__PURE__ */ v.jsx("div", { draggable:
|
|
865
|
-
|
|
868
|
+
/* @__PURE__ */ v.jsx("div", { draggable: G, children: /* @__PURE__ */ v.jsx(
|
|
869
|
+
Se,
|
|
866
870
|
{
|
|
867
|
-
className:
|
|
868
|
-
src:
|
|
871
|
+
className: Z ? `focused ${F($) ? "draggable" : ""}` : null,
|
|
872
|
+
src: l,
|
|
869
873
|
altText: t,
|
|
870
874
|
width: o,
|
|
871
875
|
height: n,
|
|
872
876
|
maxWidth: i,
|
|
873
877
|
imageRef: r,
|
|
874
|
-
startCrop:
|
|
875
|
-
setStartCrop:
|
|
876
|
-
isFocused:
|
|
878
|
+
startCrop: z,
|
|
879
|
+
setStartCrop: j,
|
|
880
|
+
isFocused: Z,
|
|
881
|
+
nodeKey: e
|
|
877
882
|
}
|
|
878
883
|
) }),
|
|
879
884
|
p && /* @__PURE__ */ v.jsx("div", { className: "image-caption-container", children: /* @__PURE__ */ v.jsx(De, { initialEditor: s, children: /* @__PURE__ */ v.jsx(
|
|
@@ -884,18 +889,18 @@ function Ye({
|
|
|
884
889
|
ErrorBoundary: Ce
|
|
885
890
|
}
|
|
886
891
|
) }) }),
|
|
887
|
-
!
|
|
892
|
+
!z && h && F($) && Z && /* @__PURE__ */ v.jsx(
|
|
888
893
|
Pe,
|
|
889
894
|
{
|
|
890
895
|
showCaption: p,
|
|
891
|
-
setShowCaption:
|
|
896
|
+
setShowCaption: b,
|
|
892
897
|
editor: x,
|
|
893
|
-
buttonRef:
|
|
898
|
+
buttonRef: d,
|
|
894
899
|
maxWidth: i,
|
|
895
|
-
onResizeStart:
|
|
896
|
-
} :
|
|
897
|
-
onResizeEnd:
|
|
898
|
-
} :
|
|
900
|
+
onResizeStart: z ? () => {
|
|
901
|
+
} : L,
|
|
902
|
+
onResizeEnd: z ? () => {
|
|
903
|
+
} : D,
|
|
899
904
|
captionsEnabled: !1,
|
|
900
905
|
imageRef: r
|
|
901
906
|
}
|
|
@@ -903,7 +908,7 @@ function Ye({
|
|
|
903
908
|
] }) });
|
|
904
909
|
}
|
|
905
910
|
export {
|
|
906
|
-
|
|
911
|
+
se as RIGHT_CLICK_IMAGE_COMMAND,
|
|
907
912
|
Ye as default
|
|
908
913
|
};
|
|
909
|
-
//# sourceMappingURL=ImageComponent-
|
|
914
|
+
//# sourceMappingURL=ImageComponent-5fc589b6.js.map
|