erl-mathtextx-editor 0.1.5 → 0.1.6
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/{CellPropertiesDialogImpl-ra6ImDOd.js → CellPropertiesDialogImpl-CHemDwqM.js} +1 -1
- package/dist/{ContentViewer-COGXSiwX.js → ContentViewer-CsFSAN_B.js} +13 -12
- package/dist/ImageInsertDialog-CJPVdXtW.js +238 -0
- package/dist/{InsertTableDialogImpl-BmFE8rOe.js → InsertTableDialogImpl-65qn7ajF.js} +1 -1
- package/dist/{LinkDialogImpl-BZuaNMx0.js → LinkDialogImpl-BXNEtesu.js} +60 -45
- package/dist/{TableTemplatesDialogImpl-D7cUqz0B.js → TableTemplatesDialogImpl-Djt0R6Hh.js} +1 -1
- package/dist/assets/viewer.css +1 -1
- package/dist/erl-mathtextx-editor.js +2 -2
- package/dist/erl-mathtextx-editor.umd.cjs +95 -95
- package/dist/{index-K6msjM1s.js → index-wMMXFiRr.js} +442 -411
- package/dist/math/MathFieldView.d.ts +5 -0
- package/dist/utils/logger.d.ts +46 -0
- package/dist/viewer.js +1 -1
- package/package.json +1 -1
- package/dist/ImageInsertDialog-CjD1IOEK.js +0 -217
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
2
2
|
import z, { useId as H, useRef as A, useCallback as b, useState as d, useEffect as V } from "react";
|
|
3
|
-
import { u as B } from "./index-
|
|
3
|
+
import { u as B } from "./index-wMMXFiRr.js";
|
|
4
4
|
const M = z.memo(({
|
|
5
5
|
isOpen: s,
|
|
6
6
|
initialData: i = {},
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as r, useMemo as i, useEffect as m } from "react";
|
|
3
3
|
import { p as s, k as l } from "./viewer-deps-CjbAqdti.js";
|
|
4
4
|
function c(t) {
|
|
5
5
|
const e = t.getAttribute("data-latex") || t.getAttribute("latex");
|
|
6
6
|
if (!e) return;
|
|
7
|
-
const
|
|
7
|
+
const n = t.classList.contains("mtx-math-block");
|
|
8
8
|
try {
|
|
9
9
|
l.render(e, t, {
|
|
10
10
|
throwOnError: !1,
|
|
11
|
-
displayMode:
|
|
11
|
+
displayMode: n,
|
|
12
12
|
output: "htmlAndMathml"
|
|
13
13
|
});
|
|
14
14
|
} catch {
|
|
15
|
-
t.textContent =
|
|
15
|
+
t.textContent = n ? `$$${e}$$` : `$${e}$`;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
function p({ content: t, className: e }) {
|
|
19
|
-
const
|
|
19
|
+
const n = r(null), a = i(
|
|
20
20
|
() => s.sanitize(t, {
|
|
21
21
|
ADD_TAGS: ["math-field", "span", "div"],
|
|
22
22
|
ADD_ATTR: ["data-latex", "latex", "data-type", "data-mathml"],
|
|
23
|
-
FORBID_TAGS: ["script", "style", "iframe", "object", "embed"]
|
|
23
|
+
FORBID_TAGS: ["script", "style", "iframe", "object", "embed"],
|
|
24
|
+
FORBID_ATTR: ["onerror", "onload", "onclick", "onmouseover", "onmouseout", "onfocus", "onblur"]
|
|
24
25
|
}),
|
|
25
26
|
[t]
|
|
26
27
|
);
|
|
27
28
|
return m(() => {
|
|
28
|
-
if (!
|
|
29
|
-
|
|
29
|
+
if (!n.current) return;
|
|
30
|
+
n.current.querySelectorAll(
|
|
30
31
|
'.mtx-math-inline, .mtx-math-block, [data-type="math-inline"], [data-type="math-block"]'
|
|
31
32
|
).forEach(c);
|
|
32
|
-
}, [
|
|
33
|
+
}, [a]), /* @__PURE__ */ o(
|
|
33
34
|
"div",
|
|
34
35
|
{
|
|
35
|
-
ref:
|
|
36
|
+
ref: n,
|
|
36
37
|
className: `mtx-content-viewer${e ? ` ${e}` : ""}`,
|
|
37
|
-
dangerouslySetInnerHTML: { __html:
|
|
38
|
+
dangerouslySetInnerHTML: { __html: a }
|
|
38
39
|
}
|
|
39
40
|
);
|
|
40
41
|
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { jsxs as i, Fragment as J, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useId as V, useRef as y, useState as d, useCallback as s } from "react";
|
|
3
|
+
import { u as q } from "./index-wMMXFiRr.js";
|
|
4
|
+
function Z({
|
|
5
|
+
isOpen: U,
|
|
6
|
+
onClose: N,
|
|
7
|
+
onInsert: u,
|
|
8
|
+
onImageUpload: v
|
|
9
|
+
}) {
|
|
10
|
+
const w = V(), R = y(null), [p, L] = d(v ? "upload" : "url"), [r, D] = d(""), [g, C] = d(""), [B, h] = d(!1), [T, k] = d(!1), [f, o] = d(null), [P, l] = d(""), F = y(null), m = y(null), j = s(() => {
|
|
11
|
+
m.current && (URL.revokeObjectURL(m.current), m.current = null), D(""), C(""), o(null), l(""), k(!1), h(!1);
|
|
12
|
+
}, []), t = s(() => {
|
|
13
|
+
j(), N();
|
|
14
|
+
}, [N, j]);
|
|
15
|
+
q({ isOpen: U, dialogRef: R, onClose: t });
|
|
16
|
+
const A = async (a) => {
|
|
17
|
+
if (!["image/png", "image/jpeg", "image/jpg", "image/gif", "image/webp"].includes(a.type))
|
|
18
|
+
return { valid: !1, error: "File harus berupa gambar (JPG, PNG, GIF, WebP)" };
|
|
19
|
+
if (a.size > 10 * 1024 * 1024)
|
|
20
|
+
return { valid: !1, error: "Ukuran file maksimal 10MB" };
|
|
21
|
+
const _ = {
|
|
22
|
+
"image/png": [[137, 80, 78, 71]],
|
|
23
|
+
"image/jpeg": [[255, 216, 255]],
|
|
24
|
+
"image/jpg": [[255, 216, 255]],
|
|
25
|
+
"image/gif": [[71, 73, 70, 56]],
|
|
26
|
+
"image/webp": [[82, 73, 70, 70]]
|
|
27
|
+
};
|
|
28
|
+
try {
|
|
29
|
+
const c = await a.slice(0, 8).arrayBuffer(), x = new Uint8Array(c), S = _[a.type];
|
|
30
|
+
if (!S)
|
|
31
|
+
return { valid: !1, error: "Format gambar tidak dikenali" };
|
|
32
|
+
if (!S.some(
|
|
33
|
+
(W) => W.every(($, z) => x[z] === $)
|
|
34
|
+
))
|
|
35
|
+
return { valid: !1, error: "File signature tidak valid. Kemungkinan file rusak atau mencurigakan." };
|
|
36
|
+
} catch {
|
|
37
|
+
return { valid: !1, error: "Gagal memvalidasi file" };
|
|
38
|
+
}
|
|
39
|
+
return { valid: !0 };
|
|
40
|
+
}, b = s(
|
|
41
|
+
async (a) => {
|
|
42
|
+
const n = await A(a);
|
|
43
|
+
if (!n.valid) {
|
|
44
|
+
l(n.error);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
l(""), m.current && URL.revokeObjectURL(m.current);
|
|
48
|
+
const _ = URL.createObjectURL(a);
|
|
49
|
+
if (m.current = _, o(_), v) {
|
|
50
|
+
k(!0);
|
|
51
|
+
try {
|
|
52
|
+
const c = await v(a);
|
|
53
|
+
u(c, g || a.name), t();
|
|
54
|
+
} catch {
|
|
55
|
+
l("Upload gagal. Silakan coba lagi."), o(null);
|
|
56
|
+
} finally {
|
|
57
|
+
k(!1);
|
|
58
|
+
}
|
|
59
|
+
} else {
|
|
60
|
+
const c = new FileReader();
|
|
61
|
+
c.onload = () => {
|
|
62
|
+
const x = c.result;
|
|
63
|
+
u(x, g || a.name), t();
|
|
64
|
+
}, c.readAsDataURL(a);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
[v, u, g, t]
|
|
68
|
+
), M = s(
|
|
69
|
+
(a) => {
|
|
70
|
+
const n = a.target.files?.[0];
|
|
71
|
+
n && b(n);
|
|
72
|
+
},
|
|
73
|
+
[b]
|
|
74
|
+
), I = s((a) => {
|
|
75
|
+
a.preventDefault(), a.stopPropagation(), h(!0);
|
|
76
|
+
}, []), O = s((a) => {
|
|
77
|
+
a.preventDefault(), a.stopPropagation(), h(!1);
|
|
78
|
+
}, []), E = s(
|
|
79
|
+
(a) => {
|
|
80
|
+
a.preventDefault(), a.stopPropagation(), h(!1);
|
|
81
|
+
const n = a.dataTransfer.files?.[0];
|
|
82
|
+
n && b(n);
|
|
83
|
+
},
|
|
84
|
+
[b]
|
|
85
|
+
), G = s(() => {
|
|
86
|
+
if (!r.trim()) {
|
|
87
|
+
l("Masukkan URL gambar");
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
new URL(r);
|
|
92
|
+
} catch {
|
|
93
|
+
l("URL tidak valid");
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
u(r.trim(), g || void 0), t();
|
|
97
|
+
}, [r, g, u, t]), K = s(() => {
|
|
98
|
+
if (r.trim())
|
|
99
|
+
try {
|
|
100
|
+
new URL(r), o(r.trim()), l("");
|
|
101
|
+
} catch {
|
|
102
|
+
l("URL tidak valid");
|
|
103
|
+
}
|
|
104
|
+
}, [r]);
|
|
105
|
+
return U ? /* @__PURE__ */ i(J, { children: [
|
|
106
|
+
/* @__PURE__ */ e("div", { className: "mtx-dialog-overlay", onClick: t }),
|
|
107
|
+
/* @__PURE__ */ i("div", { className: "mtx-image-dialog", ref: R, role: "dialog", "aria-modal": "true", "aria-labelledby": w, tabIndex: -1, children: [
|
|
108
|
+
/* @__PURE__ */ i("div", { className: "mtx-image-dialog__header", children: [
|
|
109
|
+
/* @__PURE__ */ e("h3", { id: w, children: "Sisipkan Gambar" }),
|
|
110
|
+
/* @__PURE__ */ e(
|
|
111
|
+
"button",
|
|
112
|
+
{
|
|
113
|
+
className: "mtx-image-dialog__close",
|
|
114
|
+
onClick: t,
|
|
115
|
+
"aria-label": "Tutup",
|
|
116
|
+
children: "✕"
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] }),
|
|
120
|
+
/* @__PURE__ */ i("div", { className: "mtx-image-dialog__tabs", children: [
|
|
121
|
+
/* @__PURE__ */ e(
|
|
122
|
+
"button",
|
|
123
|
+
{
|
|
124
|
+
className: `mtx-image-dialog__tab ${p === "upload" ? "is-active" : ""}`,
|
|
125
|
+
onClick: () => {
|
|
126
|
+
L("upload"), l(""), o(null);
|
|
127
|
+
},
|
|
128
|
+
children: "📁 Upload File"
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ e(
|
|
132
|
+
"button",
|
|
133
|
+
{
|
|
134
|
+
className: `mtx-image-dialog__tab ${p === "url" ? "is-active" : ""}`,
|
|
135
|
+
onClick: () => {
|
|
136
|
+
L("url"), l(""), o(null);
|
|
137
|
+
},
|
|
138
|
+
children: "🔗 URL"
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
] }),
|
|
142
|
+
/* @__PURE__ */ i("div", { className: "mtx-image-dialog__body", children: [
|
|
143
|
+
p === "upload" && /* @__PURE__ */ i(
|
|
144
|
+
"div",
|
|
145
|
+
{
|
|
146
|
+
className: `mtx-image-dialog__dropzone ${B ? "is-dragging" : ""}`,
|
|
147
|
+
onDragOver: I,
|
|
148
|
+
onDragLeave: O,
|
|
149
|
+
onDrop: E,
|
|
150
|
+
onClick: () => F.current?.click(),
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ e(
|
|
153
|
+
"input",
|
|
154
|
+
{
|
|
155
|
+
ref: F,
|
|
156
|
+
type: "file",
|
|
157
|
+
accept: "image/*",
|
|
158
|
+
onChange: M,
|
|
159
|
+
style: { display: "none" }
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
T ? /* @__PURE__ */ i("div", { className: "mtx-image-dialog__uploading", children: [
|
|
163
|
+
/* @__PURE__ */ e("div", { className: "mtx-spinner" }),
|
|
164
|
+
/* @__PURE__ */ e("p", { children: "Mengupload gambar..." })
|
|
165
|
+
] }) : f ? /* @__PURE__ */ e("div", { className: "mtx-image-dialog__preview", children: /* @__PURE__ */ e("img", { src: f, alt: "Preview" }) }) : /* @__PURE__ */ i("div", { className: "mtx-image-dialog__placeholder", children: [
|
|
166
|
+
/* @__PURE__ */ i("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [
|
|
167
|
+
/* @__PURE__ */ e("rect", { x: "4", y: "8", width: "40", height: "32", rx: "4" }),
|
|
168
|
+
/* @__PURE__ */ e("circle", { cx: "16", cy: "20", r: "4" }),
|
|
169
|
+
/* @__PURE__ */ e("path", { d: "M4 36l10-10 6 6 8-10 16 14" })
|
|
170
|
+
] }),
|
|
171
|
+
/* @__PURE__ */ i("p", { children: [
|
|
172
|
+
/* @__PURE__ */ e("strong", { children: "Klik untuk pilih file" }),
|
|
173
|
+
" atau drag & drop ke sini"
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ e("span", { children: "JPG, PNG, GIF, WebP — Maks 10MB" })
|
|
176
|
+
] })
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
),
|
|
180
|
+
p === "url" && /* @__PURE__ */ i("div", { className: "mtx-image-dialog__url-form", children: [
|
|
181
|
+
/* @__PURE__ */ e("label", { children: "URL Gambar" }),
|
|
182
|
+
/* @__PURE__ */ e("div", { className: "mtx-image-dialog__url-row", children: /* @__PURE__ */ e(
|
|
183
|
+
"input",
|
|
184
|
+
{
|
|
185
|
+
type: "url",
|
|
186
|
+
value: r,
|
|
187
|
+
onChange: (a) => D(a.target.value),
|
|
188
|
+
placeholder: "https://example.com/gambar.jpg",
|
|
189
|
+
onKeyDown: (a) => {
|
|
190
|
+
a.key === "Enter" && G();
|
|
191
|
+
},
|
|
192
|
+
onBlur: K,
|
|
193
|
+
autoFocus: !0
|
|
194
|
+
}
|
|
195
|
+
) }),
|
|
196
|
+
f && /* @__PURE__ */ e("div", { className: "mtx-image-dialog__url-preview", children: /* @__PURE__ */ e(
|
|
197
|
+
"img",
|
|
198
|
+
{
|
|
199
|
+
src: f,
|
|
200
|
+
alt: "Preview",
|
|
201
|
+
onError: () => {
|
|
202
|
+
o(null), l("Gambar tidak dapat dimuat dari URL ini");
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
) })
|
|
206
|
+
] }),
|
|
207
|
+
/* @__PURE__ */ i("div", { className: "mtx-image-dialog__alt", children: [
|
|
208
|
+
/* @__PURE__ */ e("label", { children: "Teks Alternatif (opsional)" }),
|
|
209
|
+
/* @__PURE__ */ e(
|
|
210
|
+
"input",
|
|
211
|
+
{
|
|
212
|
+
type: "text",
|
|
213
|
+
value: g,
|
|
214
|
+
onChange: (a) => C(a.target.value),
|
|
215
|
+
placeholder: "Deskripsi gambar untuk aksesibilitas"
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
] }),
|
|
219
|
+
P && /* @__PURE__ */ e("div", { className: "mtx-image-dialog__error", children: P })
|
|
220
|
+
] }),
|
|
221
|
+
/* @__PURE__ */ i("div", { className: "mtx-image-dialog__footer", children: [
|
|
222
|
+
/* @__PURE__ */ e("button", { className: "mtx-image-dialog__btn mtx-image-dialog__btn--cancel", onClick: t, children: "Batal" }),
|
|
223
|
+
p === "url" && /* @__PURE__ */ e(
|
|
224
|
+
"button",
|
|
225
|
+
{
|
|
226
|
+
className: "mtx-image-dialog__btn mtx-image-dialog__btn--insert",
|
|
227
|
+
onClick: G,
|
|
228
|
+
disabled: !r.trim(),
|
|
229
|
+
children: "Sisipkan"
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
] })
|
|
233
|
+
] })
|
|
234
|
+
] }) : null;
|
|
235
|
+
}
|
|
236
|
+
export {
|
|
237
|
+
Z as ImageInsertDialog
|
|
238
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import N, { useId as v, useRef as f, useState as c, useEffect as g, useCallback as w } from "react";
|
|
3
|
-
import { u as y } from "./index-
|
|
3
|
+
import { u as y } from "./index-wMMXFiRr.js";
|
|
4
4
|
const k = N.memo(({ isOpen: i, onInsert: d, onClose: m }) => {
|
|
5
5
|
const b = v(), u = f(null), [l, n] = c(3), [a, s] = c(3), [o, h] = c(!0);
|
|
6
6
|
g(() => {
|
|
@@ -1,87 +1,102 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { u as E } from "./index-
|
|
4
|
-
const
|
|
5
|
-
isOpen:
|
|
6
|
-
currentUrl:
|
|
7
|
-
currentText:
|
|
1
|
+
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
|
+
import D, { useId as _, useRef as j, useState as n, useEffect as F, useCallback as d } from "react";
|
|
3
|
+
import { u as E } from "./index-wMMXFiRr.js";
|
|
4
|
+
const S = D.memo(({
|
|
5
|
+
isOpen: s,
|
|
6
|
+
currentUrl: o = "",
|
|
7
|
+
currentText: m = "",
|
|
8
8
|
currentTitle: h = "",
|
|
9
9
|
currentTarget: u = "_blank",
|
|
10
10
|
onInsert: g,
|
|
11
11
|
onRemove: p,
|
|
12
|
-
onClose:
|
|
12
|
+
onClose: r
|
|
13
13
|
}) => {
|
|
14
|
-
const N =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, [
|
|
18
|
-
const
|
|
19
|
-
|
|
14
|
+
const N = _(), v = j(null), [x, y] = n(o), [k, C] = n(m), [f, L] = n(h), [b, R] = n(u), [c, i] = n("");
|
|
15
|
+
F(() => {
|
|
16
|
+
s && (y(o), C(m), L(h), R(u || "_blank"), i(""));
|
|
17
|
+
}, [s, o, m, h, u]), E({ isOpen: s, dialogRef: v, onClose: r });
|
|
18
|
+
const U = d((t) => {
|
|
19
|
+
if (!t.trim())
|
|
20
|
+
return i("URL tidak boleh kosong"), !1;
|
|
21
|
+
if (t.startsWith("#"))
|
|
22
|
+
return i(""), !0;
|
|
23
|
+
try {
|
|
24
|
+
const l = new URL(t);
|
|
25
|
+
if (l.protocol !== "http:" && l.protocol !== "https:")
|
|
26
|
+
return i("URL harus dimulai dengan http:// atau https://"), !1;
|
|
27
|
+
if (t.includes("javascript:") || t.includes("data:") || t.includes("vbscript:"))
|
|
28
|
+
return i("URL tidak valid"), !1;
|
|
29
|
+
} catch {
|
|
30
|
+
return i("URL tidak valid. Pastikan format benar (contoh: https://example.com)"), !1;
|
|
31
|
+
}
|
|
32
|
+
return i(""), !0;
|
|
33
|
+
}, []), I = d((t) => {
|
|
34
|
+
const l = t.trim();
|
|
20
35
|
return l.startsWith("http://") || l.startsWith("https://") || l.startsWith("mailto:") || l.startsWith("#") ? l : `https://${l}`;
|
|
21
|
-
}, []), W = d((
|
|
22
|
-
|
|
23
|
-
const l =
|
|
24
|
-
|
|
36
|
+
}, []), W = d((t) => {
|
|
37
|
+
t.preventDefault();
|
|
38
|
+
const l = I(x);
|
|
39
|
+
U(l) && g({
|
|
25
40
|
url: l,
|
|
26
41
|
text: k.trim() || void 0,
|
|
27
42
|
title: f.trim() || void 0,
|
|
28
43
|
target: b || void 0
|
|
29
44
|
});
|
|
30
|
-
}, [x, k, f, b,
|
|
31
|
-
p?.(),
|
|
32
|
-
}, [p,
|
|
33
|
-
return
|
|
45
|
+
}, [x, k, f, b, U, I, g]), w = d(() => {
|
|
46
|
+
p?.(), r();
|
|
47
|
+
}, [p, r]);
|
|
48
|
+
return s ? /* @__PURE__ */ e("div", { className: "mtx-modal-overlay", onClick: r, children: /* @__PURE__ */ a(
|
|
34
49
|
"div",
|
|
35
50
|
{
|
|
36
51
|
ref: v,
|
|
37
52
|
className: "mtx-modal-dialog mtx-link-dialog",
|
|
38
|
-
onClick: (
|
|
53
|
+
onClick: (t) => t.stopPropagation(),
|
|
39
54
|
role: "dialog",
|
|
40
55
|
"aria-modal": "true",
|
|
41
56
|
"aria-labelledby": N,
|
|
42
57
|
tabIndex: -1,
|
|
43
58
|
children: [
|
|
44
59
|
/* @__PURE__ */ a("div", { className: "mtx-modal-header", children: [
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
60
|
+
/* @__PURE__ */ e("h3", { className: "mtx-modal-title", id: N, children: o ? "Edit Link" : "Insert Link" }),
|
|
61
|
+
/* @__PURE__ */ e("button", { className: "mtx-modal-close", onClick: r, title: "Close", "aria-label": "Close dialog", children: /* @__PURE__ */ e("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M4 4l8 8m0-8l-8 8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) }) })
|
|
47
62
|
] }),
|
|
48
63
|
/* @__PURE__ */ a("form", { onSubmit: W, children: [
|
|
49
64
|
/* @__PURE__ */ a("div", { className: "mtx-modal-body", children: [
|
|
50
65
|
/* @__PURE__ */ a("div", { className: "mtx-form-group", children: [
|
|
51
66
|
/* @__PURE__ */ a("label", { className: "mtx-form-label", htmlFor: "link-url", children: [
|
|
52
67
|
"URL ",
|
|
53
|
-
/* @__PURE__ */
|
|
68
|
+
/* @__PURE__ */ e("span", { className: "mtx-required", children: "*" })
|
|
54
69
|
] }),
|
|
55
|
-
/* @__PURE__ */
|
|
70
|
+
/* @__PURE__ */ e(
|
|
56
71
|
"input",
|
|
57
72
|
{
|
|
58
73
|
id: "link-url",
|
|
59
74
|
type: "text",
|
|
60
75
|
className: `mtx-form-input ${c ? "mtx-input-error" : ""}`,
|
|
61
76
|
value: x,
|
|
62
|
-
onChange: (
|
|
63
|
-
y(
|
|
77
|
+
onChange: (t) => {
|
|
78
|
+
y(t.target.value), c && i("");
|
|
64
79
|
},
|
|
65
80
|
placeholder: "https://example.com",
|
|
66
81
|
autoFocus: !0,
|
|
67
82
|
autoComplete: "url"
|
|
68
83
|
}
|
|
69
84
|
),
|
|
70
|
-
c && /* @__PURE__ */
|
|
85
|
+
c && /* @__PURE__ */ e("div", { className: "mtx-form-error", children: c })
|
|
71
86
|
] }),
|
|
72
87
|
/* @__PURE__ */ a("div", { className: "mtx-form-group", children: [
|
|
73
88
|
/* @__PURE__ */ a("label", { className: "mtx-form-label", htmlFor: "link-text", children: [
|
|
74
89
|
"Display Text",
|
|
75
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ e("span", { className: "mtx-form-hint", children: m ? "(kosongkan untuk tetap menggunakan text saat ini)" : "(opsional, akan menggunakan URL jika kosong)" })
|
|
76
91
|
] }),
|
|
77
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ e(
|
|
78
93
|
"input",
|
|
79
94
|
{
|
|
80
95
|
id: "link-text",
|
|
81
96
|
type: "text",
|
|
82
97
|
className: "mtx-form-input",
|
|
83
98
|
value: k,
|
|
84
|
-
onChange: (
|
|
99
|
+
onChange: (t) => C(t.target.value),
|
|
85
100
|
placeholder: "Click here",
|
|
86
101
|
autoComplete: "off"
|
|
87
102
|
}
|
|
@@ -90,38 +105,38 @@ const P = w.memo(({
|
|
|
90
105
|
/* @__PURE__ */ a("div", { className: "mtx-form-group", children: [
|
|
91
106
|
/* @__PURE__ */ a("label", { className: "mtx-form-label", htmlFor: "link-title", children: [
|
|
92
107
|
"Title (Tooltip)",
|
|
93
|
-
/* @__PURE__ */
|
|
108
|
+
/* @__PURE__ */ e("span", { className: "mtx-form-hint", children: "Teks yang muncul saat hover" })
|
|
94
109
|
] }),
|
|
95
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ e(
|
|
96
111
|
"input",
|
|
97
112
|
{
|
|
98
113
|
id: "link-title",
|
|
99
114
|
type: "text",
|
|
100
115
|
className: "mtx-form-input",
|
|
101
116
|
value: f,
|
|
102
|
-
onChange: (
|
|
117
|
+
onChange: (t) => L(t.target.value),
|
|
103
118
|
placeholder: "Visit our website",
|
|
104
119
|
autoComplete: "off"
|
|
105
120
|
}
|
|
106
121
|
)
|
|
107
122
|
] }),
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ e("div", { className: "mtx-form-group mtx-form-checkbox", children: /* @__PURE__ */ a("label", { className: "mtx-checkbox-label", children: [
|
|
124
|
+
/* @__PURE__ */ e(
|
|
110
125
|
"input",
|
|
111
126
|
{
|
|
112
127
|
type: "checkbox",
|
|
113
128
|
checked: b === "_blank",
|
|
114
|
-
onChange: (
|
|
129
|
+
onChange: (t) => R(t.target.checked ? "_blank" : "_self")
|
|
115
130
|
}
|
|
116
131
|
),
|
|
117
|
-
/* @__PURE__ */
|
|
132
|
+
/* @__PURE__ */ e("span", { children: "Open in new tab" })
|
|
118
133
|
] }) })
|
|
119
134
|
] }),
|
|
120
135
|
/* @__PURE__ */ a("div", { className: "mtx-modal-footer", children: [
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
|
|
136
|
+
/* @__PURE__ */ e("button", { type: "button", className: "mtx-btn mtx-btn-secondary", onClick: r, children: "Cancel" }),
|
|
137
|
+
o && p && /* @__PURE__ */ e("button", { type: "button", className: "mtx-btn mtx-btn-danger", onClick: w, children: "Remove Link" }),
|
|
123
138
|
/* @__PURE__ */ a("button", { type: "submit", className: "mtx-btn mtx-btn-primary", children: [
|
|
124
|
-
|
|
139
|
+
o ? "Update" : "Insert",
|
|
125
140
|
" Link"
|
|
126
141
|
] })
|
|
127
142
|
] })
|
|
@@ -130,7 +145,7 @@ const P = w.memo(({
|
|
|
130
145
|
}
|
|
131
146
|
) }) : null;
|
|
132
147
|
});
|
|
133
|
-
|
|
148
|
+
S.displayName = "LinkDialogImpl";
|
|
134
149
|
export {
|
|
135
|
-
|
|
150
|
+
S as LinkDialogImpl
|
|
136
151
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
2
|
import o, { useId as c, useRef as n, useCallback as p } from "react";
|
|
3
|
-
import { u as h } from "./index-
|
|
3
|
+
import { u as h } from "./index-wMMXFiRr.js";
|
|
4
4
|
const x = [
|
|
5
5
|
{ id: "plain", name: "Plain", description: "Simple table without styling", headerStyle: "none", borderStyle: "all", stripeRows: !1 },
|
|
6
6
|
{ id: "light", name: "Light", description: "Light gray header", headerStyle: "light", borderStyle: "all", stripeRows: !1 },
|