sykpcomposer 0.0.191 → 0.0.192
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-ea1adbce.js → ImageComponent-d49dd9f8.js} +93 -79
- package/dist/ImageComponent-d49dd9f8.js.map +1 -0
- package/dist/{InlineImageComponent-9bddefc5.js → InlineImageComponent-972c8b61.js} +3 -3
- package/dist/{InlineImageComponent-9bddefc5.js.map → InlineImageComponent-972c8b61.js.map} +1 -1
- package/dist/{Placeholder-433b48ba.js → Placeholder-ed3bc9f3.js} +2 -2
- package/dist/{Placeholder-433b48ba.js.map → Placeholder-ed3bc9f3.js.map} +1 -1
- package/dist/{index-b2431ded.js → index-60b4a632.js} +1597 -1603
- package/dist/index-60b4a632.js.map +1 -0
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +25 -25
- package/dist/index.umd.js.map +1 -1
- package/dist/src/components/Editor.d.ts +1 -1
- package/package.json +1 -1
- package/dist/ImageComponent-ea1adbce.js.map +0 -1
- package/dist/index-b2431ded.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { j as v, u as he, d as U, w as G, x as J, $ as Q, a as te, b as ce, c as de, e as le, C as I, f as ge, k as ue, g as pe, I as we, r as me, h as xe, i as fe, l as ye, t as Ce } from "./index-
|
|
2
|
-
import { u as ve, d as De, L as be, P as Re } from "./Placeholder-
|
|
1
|
+
import { j as v, u as he, d as U, w as G, x as J, $ as Q, a as te, b as ce, c as de, e as le, C as I, f as ge, k as ue, g as pe, I as we, r as me, h as xe, i as fe, l as ye, t as Ce } from "./index-60b4a632.js";
|
|
2
|
+
import { u as ve, d as De, L as be, P as Re } from "./Placeholder-ed3bc9f3.js";
|
|
3
3
|
import f, { useRef as Y, PureComponent as Ee, createRef as ne, useState as O, useCallback as F, useEffect as ee, Suspense as Me } from "react";
|
|
4
4
|
import "react-dom";
|
|
5
5
|
function Z(g, t, e) {
|
|
@@ -19,7 +19,7 @@ function Pe({
|
|
|
19
19
|
maxWidth: n,
|
|
20
20
|
editor: i,
|
|
21
21
|
showCaption: h,
|
|
22
|
-
setShowCaption:
|
|
22
|
+
setShowCaption: p,
|
|
23
23
|
captionsEnabled: s
|
|
24
24
|
}) {
|
|
25
25
|
const r = Y(null), a = Y({
|
|
@@ -35,8 +35,8 @@ function Pe({
|
|
|
35
35
|
startWidth: 0,
|
|
36
36
|
startX: 0,
|
|
37
37
|
startY: 0
|
|
38
|
-
}), l = i.getRootElement(), c = l !== null ? l.getBoundingClientRect().width - 20 : 100, C = l !== null ? l.getBoundingClientRect().height - 20 : 100, M = 100, x = 100, z = (
|
|
39
|
-
const w =
|
|
38
|
+
}), l = i.getRootElement(), c = l !== null ? l.getBoundingClientRect().width - 20 : 100, C = l !== null ? l.getBoundingClientRect().height - 20 : 100, M = 100, x = 100, z = (u) => {
|
|
39
|
+
const w = u === y.east || u === y.west, m = u === y.north || u === y.south, N = u & y.north && u & y.west || u & y.south && u & y.east, $ = w ? "ew" : m ? "ns" : N ? "nwse" : "nesw";
|
|
40
40
|
l !== null && l.style.setProperty(
|
|
41
41
|
"cursor",
|
|
42
42
|
`${$}-resize`,
|
|
@@ -60,20 +60,20 @@ function Pe({
|
|
|
60
60
|
a.current.value,
|
|
61
61
|
a.current.priority
|
|
62
62
|
));
|
|
63
|
-
}, H = (
|
|
63
|
+
}, H = (u, w) => {
|
|
64
64
|
if (!i.isEditable())
|
|
65
65
|
return;
|
|
66
66
|
const m = o.current, N = r.current;
|
|
67
67
|
if (m !== null && N !== null) {
|
|
68
|
-
|
|
68
|
+
u.preventDefault();
|
|
69
69
|
const { width: $, height: D } = m.getBoundingClientRect(), b = d.current;
|
|
70
|
-
b.startWidth = $, b.startHeight = D, b.ratio = $ / D, b.currentWidth = $, b.currentHeight = D, b.startX =
|
|
70
|
+
b.startWidth = $, b.startHeight = D, b.ratio = $ / D, b.currentWidth = $, b.currentHeight = D, b.startX = u.clientX, b.startY = u.clientY, b.isResizing = !0, b.direction = w, z(w), g(), N.classList.add("image-control-wrapper--resizing"), m.style.height = `${D}px`, m.style.width = `${$}px`, document.addEventListener("pointermove", L), document.addEventListener("pointerup", R);
|
|
71
71
|
}
|
|
72
|
-
}, L = (
|
|
72
|
+
}, L = (u) => {
|
|
73
73
|
const w = o.current, m = d.current, N = m.direction & (y.east | y.west), $ = m.direction & (y.south | y.north);
|
|
74
74
|
if (w !== null && m.isResizing) {
|
|
75
75
|
if (N && $) {
|
|
76
|
-
let D = Math.floor(m.startX -
|
|
76
|
+
let D = Math.floor(m.startX - u.clientX);
|
|
77
77
|
D = m.direction & y.east ? -D : D;
|
|
78
78
|
const b = Z(
|
|
79
79
|
m.startWidth + D,
|
|
@@ -82,7 +82,7 @@ function Pe({
|
|
|
82
82
|
), T = b / m.ratio;
|
|
83
83
|
w.style.width = `${b}px`, w.style.height = `${T}px`, m.currentHeight = T, m.currentWidth = b;
|
|
84
84
|
} else if ($) {
|
|
85
|
-
let D = Math.floor(m.startY -
|
|
85
|
+
let D = Math.floor(m.startY - u.clientY);
|
|
86
86
|
D = m.direction & y.south ? -D : D;
|
|
87
87
|
const b = Z(
|
|
88
88
|
m.startHeight + D,
|
|
@@ -91,7 +91,7 @@ function Pe({
|
|
|
91
91
|
);
|
|
92
92
|
w.style.height = `${b}px`, w.style.maxHeight = `${b}px`, m.currentHeight = b;
|
|
93
93
|
} else {
|
|
94
|
-
let D = Math.floor(m.startX -
|
|
94
|
+
let D = Math.floor(m.startX - u.clientX);
|
|
95
95
|
D = m.direction & y.east ? -D : D;
|
|
96
96
|
const b = Z(
|
|
97
97
|
m.startWidth + D,
|
|
@@ -103,8 +103,8 @@ function Pe({
|
|
|
103
103
|
w && (w.setAttribute("width", `${m.currentWidth}`), w.setAttribute("height", `${m.currentHeight}`));
|
|
104
104
|
}
|
|
105
105
|
}, R = () => {
|
|
106
|
-
const
|
|
107
|
-
if (
|
|
106
|
+
const u = o.current, w = d.current, m = r.current;
|
|
107
|
+
if (u !== null && m !== null && w.isResizing) {
|
|
108
108
|
const N = w.currentWidth, $ = w.currentHeight;
|
|
109
109
|
w.startWidth = 0, w.startHeight = 0, w.ratio = 0, w.startX = 0, w.startY = 0, w.currentWidth = 0, w.currentHeight = 0, w.isResizing = !1, m.classList.remove("image-control-wrapper--resizing"), W(), t(N, $), document.removeEventListener("pointermove", L), document.removeEventListener("pointerup", R);
|
|
110
110
|
}
|
|
@@ -114,8 +114,8 @@ function Pe({
|
|
|
114
114
|
"div",
|
|
115
115
|
{
|
|
116
116
|
className: "image-resizer image-resizer-n",
|
|
117
|
-
onPointerDown: (
|
|
118
|
-
H(
|
|
117
|
+
onPointerDown: (u) => {
|
|
118
|
+
H(u, 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
|
-
H(
|
|
126
|
+
onPointerDown: (u) => {
|
|
127
|
+
H(u, 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
|
-
H(
|
|
135
|
+
onPointerDown: (u) => {
|
|
136
|
+
H(u, 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
|
-
H(
|
|
144
|
+
onPointerDown: (u) => {
|
|
145
|
+
H(u, 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
|
-
H(
|
|
153
|
+
onPointerDown: (u) => {
|
|
154
|
+
H(u, 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
|
-
H(
|
|
162
|
+
onPointerDown: (u) => {
|
|
163
|
+
H(u, 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
|
-
H(
|
|
171
|
+
onPointerDown: (u) => {
|
|
172
|
+
H(u, y.west);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
),
|
|
@@ -177,8 +177,8 @@ function Pe({
|
|
|
177
177
|
"div",
|
|
178
178
|
{
|
|
179
179
|
className: "image-resizer image-resizer-nw",
|
|
180
|
-
onPointerDown: (
|
|
181
|
-
H(
|
|
180
|
+
onPointerDown: (u) => {
|
|
181
|
+
H(u, y.north | y.west);
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
)
|
|
@@ -209,10 +209,10 @@ function _(g, t, e) {
|
|
|
209
209
|
height: g.height ? g.height * e / 100 : 0
|
|
210
210
|
} : { ...V, ...g, unit: "px" };
|
|
211
211
|
}
|
|
212
|
-
function re(g, t, e, o, n, i = 0, h = 0,
|
|
212
|
+
function re(g, t, e, o, n, i = 0, h = 0, p = o, s = n) {
|
|
213
213
|
const r = { ...g };
|
|
214
|
-
let a = Math.min(i, o), d = Math.min(h, n), l = Math.min(
|
|
215
|
-
t && (t > 1 ? (a = h ? h * t : a, d = a / t, l =
|
|
214
|
+
let a = Math.min(i, o), d = Math.min(h, n), l = Math.min(p, o), c = Math.min(s, n);
|
|
215
|
+
t && (t > 1 ? (a = h ? h * t : a, d = a / t, l = p * t) : (d = i ? i / t : d, a = d * t, c = s / t)), r.y < 0 && (r.height = Math.max(r.height + r.y, d), r.y = 0), r.x < 0 && (r.width = Math.max(r.width + r.x, a), r.x = 0);
|
|
216
216
|
const C = o - (r.x + r.width);
|
|
217
217
|
C < 0 && (r.x = Math.min(r.x, o - a), r.width += C);
|
|
218
218
|
const M = n - (r.y + r.height);
|
|
@@ -255,7 +255,7 @@ const X = class S extends Ee {
|
|
|
255
255
|
if (o)
|
|
256
256
|
return;
|
|
257
257
|
t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({ preventScroll: !0 });
|
|
258
|
-
const h = t.target.dataset.ord,
|
|
258
|
+
const h = t.target.dataset.ord, p = !!h;
|
|
259
259
|
let s = t.clientX, r = t.clientY, a = i.x, d = i.y;
|
|
260
260
|
if (h) {
|
|
261
261
|
const l = t.clientX - n.x, c = t.clientY - n.y;
|
|
@@ -269,15 +269,15 @@ const X = class S extends Ee {
|
|
|
269
269
|
startCropY: d,
|
|
270
270
|
clientX: t.clientX,
|
|
271
271
|
clientY: t.clientY,
|
|
272
|
-
isResize:
|
|
272
|
+
isResize: p,
|
|
273
273
|
ord: h
|
|
274
274
|
}, this.mouseDownOnCrop = !0, this.setState({ cropIsActive: !0 });
|
|
275
275
|
}, this.onComponentPointerDown = (t) => {
|
|
276
|
-
const { crop: e, disabled: o, locked: n, keepSelection: i, onChange: h } = this.props,
|
|
276
|
+
const { crop: e, disabled: o, locked: n, keepSelection: i, onChange: h } = this.props, p = this.getBox();
|
|
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 -
|
|
280
|
+
const s = t.clientX - p.x, r = t.clientY - p.y, a = {
|
|
281
281
|
unit: "px",
|
|
282
282
|
x: s,
|
|
283
283
|
y: r,
|
|
@@ -292,16 +292,16 @@ 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(_(a,
|
|
295
|
+
}, this.mouseDownOnCrop = !0, h(_(a, p.width, p.height), A(a, 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)
|
|
299
299
|
return;
|
|
300
300
|
t.cancelable && t.preventDefault(), this.dragStarted || (this.dragStarted = !0, i && i(t));
|
|
301
|
-
const { evData:
|
|
302
|
-
|
|
301
|
+
const { evData: p } = this;
|
|
302
|
+
p.clientX = t.clientX, p.clientY = t.clientY;
|
|
303
303
|
let s;
|
|
304
|
-
|
|
304
|
+
p.isResize ? s = this.resizeCrop() : s = this.dragCrop(), ie(e, s) || n(
|
|
305
305
|
_(s, h.width, h.height),
|
|
306
306
|
A(s, h.width, h.height)
|
|
307
307
|
);
|
|
@@ -310,11 +310,11 @@ const X = class S extends Ee {
|
|
|
310
310
|
if (o)
|
|
311
311
|
return;
|
|
312
312
|
const h = t.key;
|
|
313
|
-
let
|
|
313
|
+
let p = !1;
|
|
314
314
|
if (!e)
|
|
315
315
|
return;
|
|
316
316
|
const s = this.getBox(), r = this.makePixelCrop(s), a = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? S.nudgeStepLarge : t.shiftKey ? S.nudgeStepMedium : S.nudgeStep;
|
|
317
|
-
if (h === "ArrowLeft" ? (r.x -= a,
|
|
317
|
+
if (h === "ArrowLeft" ? (r.x -= a, p = !0) : h === "ArrowRight" ? (r.x += a, p = !0) : h === "ArrowUp" ? (r.y -= a, p = !0) : h === "ArrowDown" && (r.y += a, p = !0), p) {
|
|
318
318
|
t.cancelable && t.preventDefault(), r.x = j(r.x, 0, s.width - r.width), r.y = j(r.y, 0, s.height - r.height);
|
|
319
319
|
const d = _(r, s.width, s.height), l = A(r, s.width, s.height);
|
|
320
320
|
n(d, l), i && i(d, l);
|
|
@@ -325,7 +325,7 @@ const X = class S extends Ee {
|
|
|
325
325
|
crop: n,
|
|
326
326
|
disabled: i,
|
|
327
327
|
minWidth: h = 0,
|
|
328
|
-
minHeight:
|
|
328
|
+
minHeight: p = 0,
|
|
329
329
|
maxWidth: s,
|
|
330
330
|
maxHeight: r,
|
|
331
331
|
onChange: a,
|
|
@@ -344,7 +344,7 @@ const X = class S extends Ee {
|
|
|
344
344
|
l.width,
|
|
345
345
|
l.height,
|
|
346
346
|
h,
|
|
347
|
-
|
|
347
|
+
p,
|
|
348
348
|
s,
|
|
349
349
|
r
|
|
350
350
|
);
|
|
@@ -403,9 +403,9 @@ const X = class S extends Ee {
|
|
|
403
403
|
return o.x = j(t.startCropX + n, 0, e.width - o.width), o.y = j(t.startCropY + i, 0, e.height - o.height), o;
|
|
404
404
|
}
|
|
405
405
|
getPointRegion(t, e, o, n) {
|
|
406
|
-
const { evData: i } = this, h = i.clientX - t.x,
|
|
406
|
+
const { evData: i } = this, h = i.clientX - t.x, p = i.clientY - t.y;
|
|
407
407
|
let s;
|
|
408
|
-
n && e ? s = e === "nw" || e === "n" || e === "ne" : s =
|
|
408
|
+
n && e ? s = e === "nw" || e === "n" || e === "ne" : s = p < i.startCropY;
|
|
409
409
|
let r;
|
|
410
410
|
return o && e ? r = e === "nw" || e === "w" || e === "sw" : r = h < i.startCropX, r ? s ? "nw" : "sw" : s ? "ne" : "se";
|
|
411
411
|
}
|
|
@@ -414,11 +414,11 @@ const X = class S extends Ee {
|
|
|
414
414
|
return !e || !i && !h ? [i, h] : e > 1 ? i ? [i, i / e] : [h * e, h] : h ? [h * e, h] : [i, i / e];
|
|
415
415
|
}
|
|
416
416
|
resizeCrop() {
|
|
417
|
-
const { evData: t } = this, { aspect: e = 0, maxWidth: o, maxHeight: n } = this.props, i = this.getBox(), [h,
|
|
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,
|
|
419
|
+
const r = this.getPointRegion(i, t.ord, h, p), a = t.ord || r;
|
|
420
420
|
let d = t.clientX - t.startClientX, l = t.clientY - t.startClientY;
|
|
421
|
-
(h && a === "nw" || a === "w" || a === "sw") && (d = Math.min(d, -h)), (
|
|
421
|
+
(h && a === "nw" || a === "w" || a === "sw") && (d = Math.min(d, -h)), (p && a === "nw" || a === "n" || a === "ne") && (l = Math.min(l, -p));
|
|
422
422
|
const c = {
|
|
423
423
|
unit: "px",
|
|
424
424
|
x: 0,
|
|
@@ -434,7 +434,7 @@ const X = class S extends Ee {
|
|
|
434
434
|
i.width,
|
|
435
435
|
i.height,
|
|
436
436
|
h,
|
|
437
|
-
|
|
437
|
+
p,
|
|
438
438
|
o,
|
|
439
439
|
n
|
|
440
440
|
);
|
|
@@ -448,12 +448,12 @@ const X = class S extends Ee {
|
|
|
448
448
|
renderSelectionAddon: n,
|
|
449
449
|
ruleOfThirds: i,
|
|
450
450
|
crop: h
|
|
451
|
-
} = this.props,
|
|
451
|
+
} = this.props, p = this.getCropStyle();
|
|
452
452
|
if (h)
|
|
453
453
|
return /* @__PURE__ */ f.createElement(
|
|
454
454
|
"div",
|
|
455
455
|
{
|
|
456
|
-
style:
|
|
456
|
+
style: p,
|
|
457
457
|
className: "ReactCrop__crop-selection",
|
|
458
458
|
onPointerDown: this.onCropPointerDown,
|
|
459
459
|
"aria-label": t.cropArea,
|
|
@@ -551,12 +551,12 @@ const X = class S extends Ee {
|
|
|
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:
|
|
554
|
+
const { aspect: t, children: e, circularCrop: o, className: n, crop: i, disabled: h, locked: p, style: s, ruleOfThirds: r } = this.props, { cropIsActive: a, newCropIsBeingDrawn: d } = this.state, l = i ? this.renderCropSelection() : null, c = He(
|
|
555
555
|
"ReactCrop",
|
|
556
556
|
n,
|
|
557
557
|
a && "ReactCrop--active",
|
|
558
558
|
h && "ReactCrop--disabled",
|
|
559
|
-
|
|
559
|
+
p && "ReactCrop--locked",
|
|
560
560
|
d && "ReactCrop--new-crop",
|
|
561
561
|
i && t && "ReactCrop--fixed-aspect",
|
|
562
562
|
i && o && "ReactCrop--circular-crop",
|
|
@@ -608,37 +608,38 @@ function ke({
|
|
|
608
608
|
height: n,
|
|
609
609
|
maxWidth: i,
|
|
610
610
|
imageRef: h,
|
|
611
|
-
startCrop:
|
|
611
|
+
startCrop: p,
|
|
612
612
|
setStartCrop: s,
|
|
613
613
|
isFocused: r
|
|
614
614
|
}) {
|
|
615
615
|
const [a, d] = O(null), [l, c] = O(null), [C, M] = O({
|
|
616
616
|
//@ts-ignore
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
617
|
+
unit: "px",
|
|
618
|
+
// Can be 'px' or '%'
|
|
619
|
+
x: 25,
|
|
620
|
+
y: 25,
|
|
621
|
+
width: 50,
|
|
622
|
+
height: 50
|
|
622
623
|
}), x = () => {
|
|
623
624
|
if (a) {
|
|
624
625
|
const R = h.current;
|
|
625
626
|
if (!R || !a)
|
|
626
627
|
return;
|
|
627
|
-
const
|
|
628
|
-
a.width *
|
|
628
|
+
const u = R.naturalWidth / R.width, w = R.naturalHeight / R.height, m = new OffscreenCanvas(
|
|
629
|
+
a.width * u,
|
|
629
630
|
a.height * w
|
|
630
631
|
), N = m.getContext("2d");
|
|
631
632
|
if (!N)
|
|
632
633
|
throw new Error("No 2D context available");
|
|
633
634
|
N.drawImage(
|
|
634
635
|
R,
|
|
635
|
-
a.x *
|
|
636
|
+
a.x * u,
|
|
636
637
|
a.y * w,
|
|
637
|
-
a.width *
|
|
638
|
+
a.width * u,
|
|
638
639
|
a.height * w,
|
|
639
640
|
0,
|
|
640
641
|
0,
|
|
641
|
-
a.width *
|
|
642
|
+
a.width * u,
|
|
642
643
|
a.height * w
|
|
643
644
|
), m.convertToBlob({ type: "image/png" }).then(($) => {
|
|
644
645
|
const D = URL.createObjectURL($);
|
|
@@ -646,7 +647,20 @@ function ke({
|
|
|
646
647
|
});
|
|
647
648
|
}
|
|
648
649
|
}, z = () => {
|
|
649
|
-
|
|
650
|
+
p || s((R) => {
|
|
651
|
+
if (R === !1) {
|
|
652
|
+
const u = h.current;
|
|
653
|
+
M({
|
|
654
|
+
unit: "px",
|
|
655
|
+
// Can be 'px' or '%'
|
|
656
|
+
x: 0,
|
|
657
|
+
y: 0,
|
|
658
|
+
width: u.width,
|
|
659
|
+
height: u.height
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
return !R;
|
|
663
|
+
});
|
|
650
664
|
}, W = Y(null), H = Y(null);
|
|
651
665
|
ee(() => {
|
|
652
666
|
a && (W.current = a);
|
|
@@ -666,7 +680,7 @@ function ke({
|
|
|
666
680
|
children: "Crop"
|
|
667
681
|
}
|
|
668
682
|
),
|
|
669
|
-
|
|
683
|
+
p && /* @__PURE__ */ v.jsx(
|
|
670
684
|
"button",
|
|
671
685
|
{
|
|
672
686
|
style: { zIndex: 999 },
|
|
@@ -675,7 +689,7 @@ function ke({
|
|
|
675
689
|
children: "Apply Crop"
|
|
676
690
|
}
|
|
677
691
|
),
|
|
678
|
-
|
|
692
|
+
p ? /* @__PURE__ */ v.jsx(
|
|
679
693
|
Ne,
|
|
680
694
|
{
|
|
681
695
|
crop: C,
|
|
@@ -725,10 +739,10 @@ function Ye({
|
|
|
725
739
|
height: n,
|
|
726
740
|
maxWidth: i,
|
|
727
741
|
resizable: h,
|
|
728
|
-
showCaption:
|
|
742
|
+
showCaption: p,
|
|
729
743
|
caption: s
|
|
730
744
|
}) {
|
|
731
|
-
const r = Y(null), a = Y(null), [d, l, c] = ve(e), [C, M] = O(!1), [x] = he(), [z, W] = O(null), [H, L] = O(!1), R = Y(null),
|
|
745
|
+
const r = Y(null), a = Y(null), [d, l, c] = ve(e), [C, M] = O(!1), [x] = he(), [z, W] = O(null), [H, L] = O(!1), R = Y(null), u = F(
|
|
732
746
|
(P) => {
|
|
733
747
|
if (d && U(G())) {
|
|
734
748
|
P.preventDefault();
|
|
@@ -743,14 +757,14 @@ function Ye({
|
|
|
743
757
|
(P) => {
|
|
744
758
|
const E = G(), k = a.current;
|
|
745
759
|
if (d && U(E) && E.getNodes().length === 1) {
|
|
746
|
-
if (
|
|
760
|
+
if (p)
|
|
747
761
|
return te(null), P.preventDefault(), s.focus(), !0;
|
|
748
762
|
if (k !== null && k !== document.activeElement)
|
|
749
763
|
return P.preventDefault(), k.focus(), !0;
|
|
750
764
|
}
|
|
751
765
|
return !1;
|
|
752
766
|
},
|
|
753
|
-
[s, d,
|
|
767
|
+
[s, d, p]
|
|
754
768
|
), m = F(
|
|
755
769
|
(P) => R.current === s || a.current === P.target ? (te(null), x.update(() => {
|
|
756
770
|
l(!0);
|
|
@@ -804,12 +818,12 @@ function Ye({
|
|
|
804
818
|
),
|
|
805
819
|
x.registerCommand(
|
|
806
820
|
pe,
|
|
807
|
-
|
|
821
|
+
u,
|
|
808
822
|
I
|
|
809
823
|
),
|
|
810
824
|
x.registerCommand(
|
|
811
825
|
ue,
|
|
812
|
-
|
|
826
|
+
u,
|
|
813
827
|
I
|
|
814
828
|
),
|
|
815
829
|
x.registerCommand(ge, w, I),
|
|
@@ -824,7 +838,7 @@ function Ye({
|
|
|
824
838
|
C,
|
|
825
839
|
d,
|
|
826
840
|
e,
|
|
827
|
-
|
|
841
|
+
u,
|
|
828
842
|
w,
|
|
829
843
|
m,
|
|
830
844
|
N,
|
|
@@ -862,7 +876,7 @@ function Ye({
|
|
|
862
876
|
isFocused: q
|
|
863
877
|
}
|
|
864
878
|
) }),
|
|
865
|
-
|
|
879
|
+
p && /* @__PURE__ */ v.jsx("div", { className: "image-caption-container", children: /* @__PURE__ */ v.jsx(De, { initialEditor: s, children: /* @__PURE__ */ v.jsx(
|
|
866
880
|
fe,
|
|
867
881
|
{
|
|
868
882
|
contentEditable: /* @__PURE__ */ v.jsx(be, { className: "ImageNode__contentEditable" }),
|
|
@@ -873,7 +887,7 @@ function Ye({
|
|
|
873
887
|
!H && h && U(z) && q && /* @__PURE__ */ v.jsx(
|
|
874
888
|
Pe,
|
|
875
889
|
{
|
|
876
|
-
showCaption:
|
|
890
|
+
showCaption: p,
|
|
877
891
|
setShowCaption: D,
|
|
878
892
|
editor: x,
|
|
879
893
|
buttonRef: a,
|
|
@@ -892,4 +906,4 @@ export {
|
|
|
892
906
|
oe as RIGHT_CLICK_IMAGE_COMMAND,
|
|
893
907
|
Ye as default
|
|
894
908
|
};
|
|
895
|
-
//# sourceMappingURL=ImageComponent-
|
|
909
|
+
//# sourceMappingURL=ImageComponent-d49dd9f8.js.map
|