@8btc/whiteboard 0.0.20-alpha.30 → 0.0.20-alpha.31
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/index.js +75 -66
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var p = (n, i, t) => kn(n, typeof i != "symbol" ? i + "" : i, t), Fe = (n, i, t)
|
|
|
7
7
|
var r = (n, i, t) => (Fe(n, i, "read from private field"), t ? t.call(n) : i.get(n)), g = (n, i, t) => i.has(n) ? ai("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(n) : i.set(n, t), x = (n, i, t, e) => (Fe(n, i, "write to private field"), e ? e.call(n, t) : i.set(n, t), t), E = (n, i, t) => (Fe(n, i, "access private method"), t);
|
|
8
8
|
import { jsxs as k, jsx as c, Fragment as Ie } from "react/jsx-runtime";
|
|
9
9
|
import { useState as R, useEffect as Z, useRef as Ue, useMemo as St, forwardRef as $, createContext as Rn, isValidElement as li, version as $n, cloneElement as An, useContext as Fn, Fragment as Hn, useCallback as J, memo as ct } from "react";
|
|
10
|
-
import
|
|
10
|
+
import M from "konva";
|
|
11
11
|
import { N as b, R as N, I as Q } from "./const-BJHbPsA9.js";
|
|
12
12
|
import Ln from "mitt";
|
|
13
13
|
import { Editor as Dn } from "@tiptap/core";
|
|
@@ -172,7 +172,7 @@ class ms {
|
|
|
172
172
|
targetIds: Array.isArray(s) ? s.map((o) => o.id()) : s ? [s.id()] : []
|
|
173
173
|
});
|
|
174
174
|
});
|
|
175
|
-
x(this, T, i), x(this, S, new
|
|
175
|
+
x(this, T, i), x(this, S, new M.Stage({
|
|
176
176
|
id: "canvas-stage",
|
|
177
177
|
container: t.container,
|
|
178
178
|
width: t.width,
|
|
@@ -241,12 +241,12 @@ T = new WeakMap(), S = new WeakMap(), tt = new WeakMap(), ne = new WeakMap(), se
|
|
|
241
241
|
_i = function() {
|
|
242
242
|
r(this, S).on("wheel", r(this, ne)), r(this, S).on("pointerdown", r(this, se)), r(this, S).on("pointermove", r(this, oe)), r(this, S).on("pointerup", r(this, re)), r(this, S).on("dragstart", r(this, ae)), r(this, S).on("dragmove", r(this, le)), r(this, S).on("dragend", r(this, he)), r(this, S).on("contextmenu", r(this, ce));
|
|
243
243
|
};
|
|
244
|
-
var Lt,
|
|
244
|
+
var Lt, _, ge, ue, me, fe, pe, ye, ve, Mi;
|
|
245
245
|
class fs {
|
|
246
246
|
constructor(i, t) {
|
|
247
247
|
g(this, ve);
|
|
248
248
|
g(this, Lt);
|
|
249
|
-
g(this,
|
|
249
|
+
g(this, _);
|
|
250
250
|
/**
|
|
251
251
|
* 处理 transformstart 事件
|
|
252
252
|
*/
|
|
@@ -283,7 +283,7 @@ class fs {
|
|
|
283
283
|
g(this, ye, () => {
|
|
284
284
|
this.emitPositionChange();
|
|
285
285
|
});
|
|
286
|
-
x(this, Lt, i), x(this,
|
|
286
|
+
x(this, Lt, i), x(this, _, new M.Transformer({
|
|
287
287
|
rotateEnabled: t?.rotateEnabled ?? !0,
|
|
288
288
|
ignoreStroke: t?.ignoreStroke ?? !0,
|
|
289
289
|
anchorSize: t?.anchorSize ?? 8,
|
|
@@ -297,21 +297,21 @@ class fs {
|
|
|
297
297
|
* 获取原生 Konva.Transformer 实例
|
|
298
298
|
*/
|
|
299
299
|
getTransformer() {
|
|
300
|
-
return r(this,
|
|
300
|
+
return r(this, _);
|
|
301
301
|
}
|
|
302
302
|
/**
|
|
303
303
|
* 获取 Transformer 的位置信息
|
|
304
304
|
*/
|
|
305
305
|
getPosition() {
|
|
306
|
-
if (r(this,
|
|
306
|
+
if (r(this, _).nodes().length === 0)
|
|
307
307
|
return null;
|
|
308
|
-
const t = r(this,
|
|
308
|
+
const t = r(this, _).getClientRect();
|
|
309
309
|
return {
|
|
310
310
|
x: t.x,
|
|
311
311
|
y: t.y,
|
|
312
312
|
width: t.width,
|
|
313
313
|
height: t.height,
|
|
314
|
-
rotation: r(this,
|
|
314
|
+
rotation: r(this, _).rotation()
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
/**
|
|
@@ -322,30 +322,39 @@ class fs {
|
|
|
322
322
|
this.clearNodes();
|
|
323
323
|
return;
|
|
324
324
|
}
|
|
325
|
-
r(this,
|
|
325
|
+
r(this, _).nodes(i), r(this, _).moveToTop(), r(this, _).rotateEnabled(
|
|
326
326
|
!i.some(
|
|
327
327
|
(t) => ["rich-text", "html"].includes(t.getAttr("$_type"))
|
|
328
328
|
)
|
|
329
|
-
), i.length === 1 && i[0].getAttr("$_type") === "rich-text"
|
|
329
|
+
), i.length === 1 && i[0].getAttr("$_type") === "rich-text" ? r(this, _).enabledAnchors([
|
|
330
330
|
"top-left",
|
|
331
331
|
"top-right",
|
|
332
332
|
"bottom-left",
|
|
333
333
|
"bottom-right",
|
|
334
334
|
"middle-left",
|
|
335
335
|
"middle-right"
|
|
336
|
-
])
|
|
336
|
+
]) : i.length === 1 && i[0].getAttr("$_type") === "arrow" ? (r(this, _).enabledAnchors([]), r(this, _).rotateEnabled(!1), r(this, _).borderStroke("transparent")) : (r(this, _).visible(!0), r(this, _).rotateEnabled(!0), r(this, _).enabledAnchors([
|
|
337
|
+
"top-left",
|
|
338
|
+
"top-center",
|
|
339
|
+
"top-right",
|
|
340
|
+
"middle-right",
|
|
341
|
+
"middle-left",
|
|
342
|
+
"bottom-left",
|
|
343
|
+
"bottom-center",
|
|
344
|
+
"bottom-right"
|
|
345
|
+
]), r(this, _).borderStroke("rgb(0, 161, 255)")), this.emitPositionChange();
|
|
337
346
|
}
|
|
338
347
|
/**
|
|
339
348
|
* 获取当前变换的节点
|
|
340
349
|
*/
|
|
341
350
|
getNodes() {
|
|
342
|
-
return r(this,
|
|
351
|
+
return r(this, _).nodes();
|
|
343
352
|
}
|
|
344
353
|
/**
|
|
345
354
|
* 清除所有节点
|
|
346
355
|
*/
|
|
347
356
|
clearNodes() {
|
|
348
|
-
r(this,
|
|
357
|
+
r(this, _).nodes([]), this.emitPositionChange();
|
|
349
358
|
}
|
|
350
359
|
/**
|
|
351
360
|
* emit Transformer 位置
|
|
@@ -358,15 +367,15 @@ class fs {
|
|
|
358
367
|
* 销毁 Transformer
|
|
359
368
|
*/
|
|
360
369
|
destroy() {
|
|
361
|
-
r(this,
|
|
370
|
+
r(this, _).destroy();
|
|
362
371
|
}
|
|
363
372
|
}
|
|
364
|
-
Lt = new WeakMap(),
|
|
373
|
+
Lt = new WeakMap(), _ = new WeakMap(), ge = new WeakMap(), ue = new WeakMap(), me = new WeakMap(), fe = new WeakMap(), pe = new WeakMap(), ye = new WeakMap(), ve = new WeakSet(), /**
|
|
365
374
|
* 设置事件监听器
|
|
366
375
|
*/
|
|
367
376
|
Mi = function() {
|
|
368
|
-
r(this,
|
|
369
|
-
const t = r(this,
|
|
377
|
+
r(this, _).on("transformstart", r(this, ge)), r(this, _).on("transform", r(this, ue)), r(this, _).on("transformend", r(this, me)), r(this, _).on("dragstart", r(this, fe)), r(this, _).on("dragmove", r(this, pe)), r(this, _).on("dragend", r(this, ye)), r(this, _).on("pointerdblclick", (i) => {
|
|
378
|
+
const t = r(this, _).nodes();
|
|
370
379
|
if (t.length === 1) {
|
|
371
380
|
const e = t[0];
|
|
372
381
|
e.fire("pointerdblclick", {
|
|
@@ -790,7 +799,7 @@ class ws extends st {
|
|
|
790
799
|
this.config = e;
|
|
791
800
|
}
|
|
792
801
|
createElement() {
|
|
793
|
-
return new
|
|
802
|
+
return new M.Rect(this.config);
|
|
794
803
|
}
|
|
795
804
|
/**
|
|
796
805
|
* 获取 Konva.Rect 实例
|
|
@@ -870,7 +879,7 @@ class bs extends st {
|
|
|
870
879
|
this.config = e;
|
|
871
880
|
}
|
|
872
881
|
createElement() {
|
|
873
|
-
return new
|
|
882
|
+
return new M.Image(this.config);
|
|
874
883
|
}
|
|
875
884
|
/**
|
|
876
885
|
* 获取 Konva.Image 实例
|
|
@@ -947,7 +956,7 @@ Le = function() {
|
|
|
947
956
|
l.forEach((f) => {
|
|
948
957
|
const m = d.find((u) => u.id === f.id());
|
|
949
958
|
if (m?.$_type === "image-marker" && m.$_relativeBox) {
|
|
950
|
-
const { start: u, end: y } = m.$_relativeBox, w = s + u.ratioX * a, v = o + u.ratioY * h,
|
|
959
|
+
const { start: u, end: y } = m.$_relativeBox, w = s + u.ratioX * a, v = o + u.ratioY * h, I = s + y.ratioX * a, C = o + y.ratioY * h, B = Math.min(w, I), dt = Math.min(v, C), K = Math.abs(I - w), q = Math.abs(C - v);
|
|
951
960
|
f.setAttrs({
|
|
952
961
|
x: B,
|
|
953
962
|
y: dt,
|
|
@@ -990,14 +999,14 @@ class Es extends st {
|
|
|
990
999
|
return this.config;
|
|
991
1000
|
}
|
|
992
1001
|
createElement() {
|
|
993
|
-
const t = Math.max(this.config.width ?? N.MIN_SIZE, N.MIN_SIZE), e = Math.max(this.config.height ?? N.MIN_SIZE, N.MIN_SIZE), s = new
|
|
1002
|
+
const t = Math.max(this.config.width ?? N.MIN_SIZE, N.MIN_SIZE), e = Math.max(this.config.height ?? N.MIN_SIZE, N.MIN_SIZE), s = new M.Group({
|
|
994
1003
|
id: this.config.id,
|
|
995
1004
|
name: `${b.nodeRoot} ${b.imageMarker} ${this.config.$_parentId}`,
|
|
996
1005
|
x: this.config.x,
|
|
997
1006
|
y: this.config.y,
|
|
998
1007
|
width: t,
|
|
999
1008
|
height: e
|
|
1000
|
-
}), o = this.core.getStageScale(), a = 2 / o, h = [5 / o, 5 / o], l = N.CORNER_RADIUS / o, d = new
|
|
1009
|
+
}), o = this.core.getStageScale(), a = 2 / o, h = [5 / o, 5 / o], l = N.CORNER_RADIUS / o, d = new M.Rect({
|
|
1001
1010
|
name: "rect",
|
|
1002
1011
|
x: 0,
|
|
1003
1012
|
y: 0,
|
|
@@ -1008,17 +1017,17 @@ class Es extends st {
|
|
|
1008
1017
|
dash: h,
|
|
1009
1018
|
cornerRadius: l,
|
|
1010
1019
|
listening: !1
|
|
1011
|
-
}), f = new
|
|
1020
|
+
}), f = new M.Group({
|
|
1012
1021
|
name: "marker-group",
|
|
1013
1022
|
x: t,
|
|
1014
1023
|
y: e,
|
|
1015
1024
|
visible: !this.isDraft
|
|
1016
|
-
}), m = 14 / o, u = 3 / o, y = 16 / o, w = new
|
|
1025
|
+
}), m = 14 / o, u = 3 / o, y = 16 / o, w = new M.Circle({
|
|
1017
1026
|
radius: m,
|
|
1018
1027
|
fill: this.config.markerColor,
|
|
1019
1028
|
stroke: "white",
|
|
1020
1029
|
strokeWidth: u
|
|
1021
|
-
}), v = new
|
|
1030
|
+
}), v = new M.Text({
|
|
1022
1031
|
x: -m,
|
|
1023
1032
|
y: -m,
|
|
1024
1033
|
width: m * 2,
|
|
@@ -1129,7 +1138,7 @@ class Ss extends st {
|
|
|
1129
1138
|
this.config = e;
|
|
1130
1139
|
}
|
|
1131
1140
|
createElement() {
|
|
1132
|
-
return new
|
|
1141
|
+
return new M.Rect(this.config);
|
|
1133
1142
|
}
|
|
1134
1143
|
/**
|
|
1135
1144
|
* 获取 Konva.Rect 实例
|
|
@@ -1219,7 +1228,7 @@ class Ns extends st {
|
|
|
1219
1228
|
this.core.on("viewport:change", f), window.addEventListener("click", d), window.addEventListener("touchstart", d);
|
|
1220
1229
|
});
|
|
1221
1230
|
});
|
|
1222
|
-
this.core = t, this.config = mi(e, this.core.getTheme()), this.element = this.createElement(), this.rect = new
|
|
1231
|
+
this.core = t, this.config = mi(e, this.core.getTheme()), this.element = this.createElement(), this.rect = new M.Rect(this.config), rt(this.element, this), this.isDraft = s, E(this, be, Di).call(this), setTimeout(() => {
|
|
1223
1232
|
r(this, we).call(this);
|
|
1224
1233
|
});
|
|
1225
1234
|
}
|
|
@@ -1234,7 +1243,7 @@ class Ns extends st {
|
|
|
1234
1243
|
this.config = e;
|
|
1235
1244
|
}
|
|
1236
1245
|
createElement() {
|
|
1237
|
-
return new
|
|
1246
|
+
return new M.Text(this.config);
|
|
1238
1247
|
}
|
|
1239
1248
|
/**
|
|
1240
1249
|
* 获取 Konva.Text 实例
|
|
@@ -1384,7 +1393,7 @@ class Ts extends st {
|
|
|
1384
1393
|
delete e.image, this.config = e;
|
|
1385
1394
|
}
|
|
1386
1395
|
createElement() {
|
|
1387
|
-
return new
|
|
1396
|
+
return new M.Image({ ...this.config });
|
|
1388
1397
|
}
|
|
1389
1398
|
/**
|
|
1390
1399
|
* 获取 Konva.Rect 实例
|
|
@@ -1470,11 +1479,11 @@ class _s extends st {
|
|
|
1470
1479
|
this.config = e;
|
|
1471
1480
|
}
|
|
1472
1481
|
createElement() {
|
|
1473
|
-
const t = new
|
|
1482
|
+
const t = new M.Group({
|
|
1474
1483
|
...this.config,
|
|
1475
1484
|
width: void 0,
|
|
1476
1485
|
height: void 0
|
|
1477
|
-
}), e = new
|
|
1486
|
+
}), e = new M.Image({
|
|
1478
1487
|
...this.config,
|
|
1479
1488
|
name: "",
|
|
1480
1489
|
id: `${this.config.id}-image`,
|
|
@@ -1483,7 +1492,7 @@ class _s extends st {
|
|
|
1483
1492
|
listening: !1
|
|
1484
1493
|
});
|
|
1485
1494
|
t.add(e);
|
|
1486
|
-
const s = new
|
|
1495
|
+
const s = new M.Rect({
|
|
1487
1496
|
name: "",
|
|
1488
1497
|
x: 0,
|
|
1489
1498
|
y: 0,
|
|
@@ -1493,7 +1502,7 @@ class _s extends st {
|
|
|
1493
1502
|
listening: !1
|
|
1494
1503
|
});
|
|
1495
1504
|
t.add(s);
|
|
1496
|
-
const o = new
|
|
1505
|
+
const o = new M.RegularPolygon({
|
|
1497
1506
|
x: this.config.width / 2,
|
|
1498
1507
|
// 微调使其视觉居中
|
|
1499
1508
|
y: this.config.height / 2,
|
|
@@ -1603,7 +1612,7 @@ class Ms extends st {
|
|
|
1603
1612
|
this.config = e;
|
|
1604
1613
|
}
|
|
1605
1614
|
createElement() {
|
|
1606
|
-
return new
|
|
1615
|
+
return new M.Star(this.config);
|
|
1607
1616
|
}
|
|
1608
1617
|
/**
|
|
1609
1618
|
* 获取 Konva.Star 实例
|
|
@@ -1677,7 +1686,7 @@ class ks extends st {
|
|
|
1677
1686
|
this.config = e;
|
|
1678
1687
|
}
|
|
1679
1688
|
createElement() {
|
|
1680
|
-
return new
|
|
1689
|
+
return new M.Ellipse(this.config);
|
|
1681
1690
|
}
|
|
1682
1691
|
/**
|
|
1683
1692
|
* 获取 Konva.Ellipse 实例
|
|
@@ -1750,7 +1759,7 @@ class $s extends st {
|
|
|
1750
1759
|
this.config = e;
|
|
1751
1760
|
}
|
|
1752
1761
|
createElement() {
|
|
1753
|
-
return new
|
|
1762
|
+
return new M.Line(this.config);
|
|
1754
1763
|
}
|
|
1755
1764
|
/**
|
|
1756
1765
|
* 获取 Konva.Line 实例
|
|
@@ -1826,7 +1835,7 @@ class As extends st {
|
|
|
1826
1835
|
this.config = e;
|
|
1827
1836
|
}
|
|
1828
1837
|
createElement() {
|
|
1829
|
-
return new
|
|
1838
|
+
return new M.Arrow(this.config);
|
|
1830
1839
|
}
|
|
1831
1840
|
/**
|
|
1832
1841
|
* 获取 Konva.Arrow 实例
|
|
@@ -1860,7 +1869,7 @@ Ui = function() {
|
|
|
1860
1869
|
const t = this.core.getMainLayer();
|
|
1861
1870
|
if (!t) return;
|
|
1862
1871
|
const e = this.core.getStageScale(), s = 6 / e, o = 2 / e;
|
|
1863
|
-
x(this, A, new
|
|
1872
|
+
x(this, A, new M.Circle({
|
|
1864
1873
|
radius: s,
|
|
1865
1874
|
fill: "white",
|
|
1866
1875
|
stroke: "#1976d2",
|
|
@@ -1868,7 +1877,7 @@ Ui = function() {
|
|
|
1868
1877
|
draggable: !0,
|
|
1869
1878
|
visible: !1,
|
|
1870
1879
|
name: "arrow-anchor"
|
|
1871
|
-
})), x(this, F, new
|
|
1880
|
+
})), x(this, F, new M.Circle({
|
|
1872
1881
|
radius: s,
|
|
1873
1882
|
fill: "white",
|
|
1874
1883
|
stroke: "#1976d2",
|
|
@@ -2101,7 +2110,7 @@ class Ls extends ps {
|
|
|
2101
2110
|
height: t.clientHeight,
|
|
2102
2111
|
draggable: !1,
|
|
2103
2112
|
className: "touch-none"
|
|
2104
|
-
})), x(this, j, new
|
|
2113
|
+
})), x(this, j, new M.Layer()), x(this, it, new fs(this)), r(this, D).getStage().add(r(this, j)), r(this, j).add(r(this, it).getTransformer()), this._renderCanvas(o), E(this, U, Yi).call(this), E(this, U, Gi).call(this);
|
|
2105
2114
|
}
|
|
2106
2115
|
/**
|
|
2107
2116
|
* 获取当前主题
|
|
@@ -2246,7 +2255,7 @@ class Ls extends ps {
|
|
|
2246
2255
|
a.forEach((C) => {
|
|
2247
2256
|
C.$_type === "image-marker" && typeof C.$_markerNumber == "number" && (h = Math.max(h, C.$_markerNumber));
|
|
2248
2257
|
});
|
|
2249
|
-
const l = (e.x - o.x) / o.width, d = (e.y - o.y) / o.height, f = (s.x - o.x) / o.width, m = (s.y - o.y) / o.height, u = Math.min(e.x, s.x), y = Math.min(e.y, s.y), w = Math.abs(s.x - e.x), v = Math.abs(s.y - e.y),
|
|
2258
|
+
const l = (e.x - o.x) / o.width, d = (e.y - o.y) / o.height, f = (s.x - o.x) / o.width, m = (s.y - o.y) / o.height, u = Math.min(e.x, s.x), y = Math.min(e.y, s.y), w = Math.abs(s.x - e.x), v = Math.abs(s.y - e.y), I = {
|
|
2250
2259
|
id: Tt(),
|
|
2251
2260
|
$_type: "image-marker",
|
|
2252
2261
|
x: u,
|
|
@@ -2268,7 +2277,7 @@ class Ls extends ps {
|
|
|
2268
2277
|
}
|
|
2269
2278
|
}
|
|
2270
2279
|
};
|
|
2271
|
-
this.createNodes([
|
|
2280
|
+
this.createNodes([I], !0);
|
|
2272
2281
|
}
|
|
2273
2282
|
/**
|
|
2274
2283
|
* 在指定位置查找图片节点
|
|
@@ -2388,7 +2397,7 @@ class Ls extends ps {
|
|
|
2388
2397
|
* @internal 仅供内部使用
|
|
2389
2398
|
*/
|
|
2390
2399
|
_createSelectRect() {
|
|
2391
|
-
this.isEditingText || (r(this, Y) && r(this, Y).destroy(), x(this, Y, new
|
|
2400
|
+
this.isEditingText || (r(this, Y) && r(this, Y).destroy(), x(this, Y, new M.Rect({
|
|
2392
2401
|
x: r(this, G)[0].x,
|
|
2393
2402
|
y: r(this, G)[0].y,
|
|
2394
2403
|
width: 0,
|
|
@@ -2412,7 +2421,7 @@ class Ls extends ps {
|
|
|
2412
2421
|
});
|
|
2413
2422
|
const s = r(this, Y).getClientRect(), a = r(this, j).find(`.${b.selectable}`).filter((h) => {
|
|
2414
2423
|
const l = h.getClientRect();
|
|
2415
|
-
return
|
|
2424
|
+
return M.Util.haveIntersection(s, l);
|
|
2416
2425
|
});
|
|
2417
2426
|
this._selectNodes(
|
|
2418
2427
|
a.length > 0 ? a.filter((h) => h.listening()).map((h) => h.id()) : void 0,
|
|
@@ -2665,7 +2674,7 @@ class Ds extends Ls {
|
|
|
2665
2674
|
const t = this.getState().selectedNodeIds || [];
|
|
2666
2675
|
if (t.length === 0)
|
|
2667
2676
|
return console.warn("No selection to export"), null;
|
|
2668
|
-
const e = i?.padding ?? 0, s = new
|
|
2677
|
+
const e = i?.padding ?? 0, s = new M.Group();
|
|
2669
2678
|
t.forEach((h) => {
|
|
2670
2679
|
const l = this.getStage().findOne(`#${h}`);
|
|
2671
2680
|
if (l) {
|
|
@@ -2698,7 +2707,7 @@ class Ds extends Ls {
|
|
|
2698
2707
|
);
|
|
2699
2708
|
if (o.length === 0)
|
|
2700
2709
|
return console.warn("No image-marker nodes found for the given image ID"), null;
|
|
2701
|
-
const a = new
|
|
2710
|
+
const a = new M.Group(), h = e.clone();
|
|
2702
2711
|
a.add(h);
|
|
2703
2712
|
const l = t?.markerScale ?? 1;
|
|
2704
2713
|
o.forEach((m) => {
|
|
@@ -2706,8 +2715,8 @@ class Ds extends Ls {
|
|
|
2706
2715
|
if (u) {
|
|
2707
2716
|
const y = u.clone(), w = y.findOne(".rect"), v = y.findOne(".marker-group");
|
|
2708
2717
|
if (w && (w.strokeWidth(3 * l), w.dash([5 * l, 5 * l]), w.cornerRadius(6 * l)), v) {
|
|
2709
|
-
const
|
|
2710
|
-
if (
|
|
2718
|
+
const I = v.findOne("Circle"), C = v.findOne("Text");
|
|
2719
|
+
if (I && (I.radius(14 * l), I.strokeWidth(3 * l)), C) {
|
|
2711
2720
|
const B = 14 * l;
|
|
2712
2721
|
C.x(-B), C.y(-B), C.width(B * 2), C.height(B * 2), C.fontSize(16 * l);
|
|
2713
2722
|
}
|
|
@@ -2838,10 +2847,10 @@ class Ds extends Ls {
|
|
|
2838
2847
|
a = Math.min(a, ni), h = Math.min(h, si), l = Math.max(l, ni + En), d = Math.max(d, si + Sn);
|
|
2839
2848
|
}
|
|
2840
2849
|
}), a === 1 / 0 || h === 1 / 0) return;
|
|
2841
|
-
const v = l - a,
|
|
2850
|
+
const v = l - a, I = d - h, C = a + v / 2, B = h + I / 2;
|
|
2842
2851
|
let K = this.getState().viewport.scale;
|
|
2843
2852
|
if (s) {
|
|
2844
|
-
const z = (this.getStage().width() - e * 2) / v, xt = (this.getStage().height() - e * 2) /
|
|
2853
|
+
const z = (this.getStage().width() - e * 2) / v, xt = (this.getStage().height() - e * 2) / I;
|
|
2845
2854
|
K = Math.min(z, xt, 1);
|
|
2846
2855
|
}
|
|
2847
2856
|
const q = this.getStage().width() / 2 - C * K, Ct = this.getStage().height() / 2 - B * K;
|
|
@@ -2942,7 +2951,7 @@ function Bs({
|
|
|
2942
2951
|
"aria-hidden": "true",
|
|
2943
2952
|
children: [
|
|
2944
2953
|
/* @__PURE__ */ c("defs", { children: Ei.map(({ min: l, mid: d, step: f }, m) => {
|
|
2945
|
-
const u = f * e * h, y = 0.5 + o * h, w = 0.5 + a * h, v = y > 0 ? y % u : u + y % u,
|
|
2954
|
+
const u = f * e * h, y = 0.5 + o * h, w = 0.5 + a * h, v = y > 0 ? y % u : u + y % u, I = w > 0 ? w % u : u + w % u, C = h < d ? Ps(h, [l, d], [0, 1]) : 1;
|
|
2946
2955
|
return /* @__PURE__ */ c(
|
|
2947
2956
|
"pattern",
|
|
2948
2957
|
{
|
|
@@ -2955,7 +2964,7 @@ function Bs({
|
|
|
2955
2964
|
{
|
|
2956
2965
|
className: "grid-dot",
|
|
2957
2966
|
cx: v,
|
|
2958
|
-
cy:
|
|
2967
|
+
cy: I,
|
|
2959
2968
|
r: 1,
|
|
2960
2969
|
opacity: C
|
|
2961
2970
|
}
|
|
@@ -3336,15 +3345,15 @@ function Ys({
|
|
|
3336
3345
|
}
|
|
3337
3346
|
}), y = cs(m, {
|
|
3338
3347
|
enabled: t == null
|
|
3339
|
-
}), w = ds(m), v = gs(m, { role: "tooltip" }),
|
|
3348
|
+
}), w = ds(m), v = gs(m, { role: "tooltip" }), I = us([u, y, w, v]);
|
|
3340
3349
|
return St(
|
|
3341
3350
|
() => ({
|
|
3342
3351
|
open: l,
|
|
3343
3352
|
setOpen: d,
|
|
3344
|
-
...
|
|
3353
|
+
...I,
|
|
3345
3354
|
...f
|
|
3346
3355
|
}),
|
|
3347
|
-
[l, d,
|
|
3356
|
+
[l, d, I, f]
|
|
3348
3357
|
);
|
|
3349
3358
|
}
|
|
3350
3359
|
const Ve = Rn(null);
|
|
@@ -3531,7 +3540,7 @@ const At = $(
|
|
|
3531
3540
|
label: y,
|
|
3532
3541
|
canToggle: w,
|
|
3533
3542
|
isActive: v,
|
|
3534
|
-
Icon:
|
|
3543
|
+
Icon: I,
|
|
3535
3544
|
shortcutKeys: C
|
|
3536
3545
|
} = eo({
|
|
3537
3546
|
editor: f,
|
|
@@ -3561,7 +3570,7 @@ const At = $(
|
|
|
3561
3570
|
...l,
|
|
3562
3571
|
ref: d,
|
|
3563
3572
|
children: h ?? /* @__PURE__ */ k(Ie, { children: [
|
|
3564
|
-
/* @__PURE__ */ c(
|
|
3573
|
+
/* @__PURE__ */ c(I, { className: "tiptap-button-icon" }),
|
|
3565
3574
|
t && /* @__PURE__ */ c("span", { className: "tiptap-button-text", children: t }),
|
|
3566
3575
|
o && /* @__PURE__ */ c(Ks, { type: i, shortcutKeys: C })
|
|
3567
3576
|
] })
|
|
@@ -4079,7 +4088,7 @@ const mn = $(
|
|
|
4079
4088
|
const { editor: y } = yt(n), {
|
|
4080
4089
|
isVisible: w,
|
|
4081
4090
|
canColorHighlight: v,
|
|
4082
|
-
isActive:
|
|
4091
|
+
isActive: I,
|
|
4083
4092
|
handleColorHighlight: C,
|
|
4084
4093
|
label: B,
|
|
4085
4094
|
shortcutKeys: dt
|
|
@@ -4108,13 +4117,13 @@ const mn = $(
|
|
|
4108
4117
|
{
|
|
4109
4118
|
type: "button",
|
|
4110
4119
|
variant: "ghost",
|
|
4111
|
-
"data-active-state":
|
|
4120
|
+
"data-active-state": I ? "on" : "off",
|
|
4112
4121
|
role: "button",
|
|
4113
4122
|
tabIndex: -1,
|
|
4114
4123
|
disabled: !v,
|
|
4115
4124
|
"data-disabled": !v,
|
|
4116
4125
|
"aria-label": B,
|
|
4117
|
-
"aria-pressed":
|
|
4126
|
+
"aria-pressed": I,
|
|
4118
4127
|
tooltip: B,
|
|
4119
4128
|
onClick: K,
|
|
4120
4129
|
style: q,
|
|
@@ -4287,7 +4296,7 @@ function Qe(n) {
|
|
|
4287
4296
|
const C = l.chain().focus().toggleNodeBackgroundColor(y).run();
|
|
4288
4297
|
return C && h?.({ color: y, label: t, mode: o }), C;
|
|
4289
4298
|
}
|
|
4290
|
-
}, [u, y, l, t, h, o]),
|
|
4299
|
+
}, [u, y, l, t, h, o]), I = J(() => {
|
|
4291
4300
|
const C = lo(l, o);
|
|
4292
4301
|
return C && h?.({ color: "", label: "Remove highlight", mode: o }), C;
|
|
4293
4302
|
}, [l, h, o]);
|
|
@@ -4305,7 +4314,7 @@ function Qe(n) {
|
|
|
4305
4314
|
isVisible: f,
|
|
4306
4315
|
isActive: w,
|
|
4307
4316
|
handleColorHighlight: v,
|
|
4308
|
-
handleRemoveHighlight:
|
|
4317
|
+
handleRemoveHighlight: I,
|
|
4309
4318
|
canColorHighlight: u,
|
|
4310
4319
|
label: t || "Highlight",
|
|
4311
4320
|
shortcutKeys: Oe,
|
|
@@ -4470,7 +4479,7 @@ const vn = $(
|
|
|
4470
4479
|
isVisible: y,
|
|
4471
4480
|
canTextColor: w,
|
|
4472
4481
|
isActive: v,
|
|
4473
|
-
handleTextColor:
|
|
4482
|
+
handleTextColor: I,
|
|
4474
4483
|
label: C,
|
|
4475
4484
|
shortcutKeys: B
|
|
4476
4485
|
} = ii({
|
|
@@ -4482,9 +4491,9 @@ const vn = $(
|
|
|
4482
4491
|
onApplied: s
|
|
4483
4492
|
}), dt = J(
|
|
4484
4493
|
(q) => {
|
|
4485
|
-
a?.(q), !q.defaultPrevented && (
|
|
4494
|
+
a?.(q), !q.defaultPrevented && (I(), q.preventDefault(), q.stopPropagation());
|
|
4486
4495
|
},
|
|
4487
|
-
[
|
|
4496
|
+
[I, a]
|
|
4488
4497
|
), K = St(
|
|
4489
4498
|
() => ({
|
|
4490
4499
|
...l,
|