@aeriz/wysiwyg 1.0.0 → 1.0.1
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/README.md +96 -0
- package/dist/aeriz-wysiwyg.css +10 -1
- package/dist/aeriz-wysiwyg.esm.js +308 -39
- package/dist/aeriz-wysiwyg.esm.min.js +908 -692
- package/dist/aeriz-wysiwyg.js +308 -39
- package/dist/aeriz-wysiwyg.min.css +1 -1
- package/dist/aeriz-wysiwyg.min.js +17 -17
- package/dist-types/core/AerizEditor.d.ts.map +1 -1
- package/dist-types/core/blocks.d.ts +10 -0
- package/dist-types/core/blocks.d.ts.map +1 -1
- package/dist-types/core/import-html.d.ts +13 -2
- package/dist-types/core/import-html.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var w = (n, e, t) =>
|
|
4
|
-
const
|
|
1
|
+
var We = Object.defineProperty;
|
|
2
|
+
var Ke = (n, e, t) => e in n ? We(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var w = (n, e, t) => Ke(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
const Ve = {
|
|
5
5
|
items: [
|
|
6
6
|
// undo / redo 는 브라우저 네이티브 (Ctrl+Z / Ctrl+Y) 가 처리하므로 기본
|
|
7
7
|
// 툴바에서 제외. ToolbarItemName 멤버는 유지 — 커스텀 toolbar 에서
|
|
@@ -96,7 +96,7 @@ const Ke = {
|
|
|
96
96
|
hr: { name: "hr", label: "구분선", icon: "hr" },
|
|
97
97
|
clearFormat: { name: "clearFormat", label: "서식 지우기", icon: "clearFormat", shortcut: "Ctrl+\\" }
|
|
98
98
|
};
|
|
99
|
-
class
|
|
99
|
+
class Ge {
|
|
100
100
|
constructor(e, t) {
|
|
101
101
|
w(this, "element");
|
|
102
102
|
w(this, "buttons", /* @__PURE__ */ new Map());
|
|
@@ -170,17 +170,17 @@ function P(n, e) {
|
|
|
170
170
|
r.type = "button", r.className = "aw-dialog-close", r.setAttribute("aria-label", "닫기"), r.innerHTML = E.close, l.appendChild(i), l.appendChild(r);
|
|
171
171
|
const s = document.createElement("div");
|
|
172
172
|
s.className = "aw-dialog-body";
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
const
|
|
176
|
-
return r.addEventListener("click",
|
|
177
|
-
d.target === t &&
|
|
173
|
+
const a = document.createElement("div");
|
|
174
|
+
a.className = "aw-dialog-footer", o.appendChild(l), o.appendChild(s), o.appendChild(a), t.appendChild(o);
|
|
175
|
+
const c = () => t.remove();
|
|
176
|
+
return r.addEventListener("click", c), t.addEventListener("click", (d) => {
|
|
177
|
+
d.target === t && c();
|
|
178
178
|
}), document.addEventListener(
|
|
179
179
|
"keydown",
|
|
180
180
|
function d(u) {
|
|
181
|
-
u.key === "Escape" && (
|
|
181
|
+
u.key === "Escape" && (c(), document.removeEventListener("keydown", d));
|
|
182
182
|
}
|
|
183
|
-
), { overlay: t, body: s, footer:
|
|
183
|
+
), { overlay: t, body: s, footer: a, close: c };
|
|
184
184
|
}
|
|
185
185
|
function R(n, e) {
|
|
186
186
|
const t = document.createElement("div");
|
|
@@ -188,88 +188,88 @@ function R(n, e) {
|
|
|
188
188
|
const o = document.createElement("label");
|
|
189
189
|
return o.className = "aw-field-label", o.textContent = n, t.appendChild(o), t.appendChild(e), t;
|
|
190
190
|
}
|
|
191
|
-
function
|
|
191
|
+
function Ze(n = {}, e) {
|
|
192
192
|
return new Promise((t) => {
|
|
193
193
|
const { overlay: o, body: l, footer: i, close: r } = P("링크 삽입", e), s = document.createElement("input");
|
|
194
194
|
s.type = "text", s.className = "aw-input", s.placeholder = "링크에 표시할 텍스트", s.value = n.text ?? "";
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
|
|
195
|
+
const a = document.createElement("input");
|
|
196
|
+
a.type = "url", a.className = "aw-input", a.placeholder = "https://example.com", a.value = n.href ?? "";
|
|
197
|
+
const c = document.createElement("label");
|
|
198
|
+
c.className = "aw-checkbox";
|
|
199
199
|
const d = document.createElement("input");
|
|
200
200
|
d.type = "checkbox", d.checked = n.newWindow ?? !1;
|
|
201
201
|
const u = document.createElement("span");
|
|
202
|
-
u.textContent = "새 창에서 열기",
|
|
202
|
+
u.textContent = "새 창에서 열기", c.appendChild(d), c.appendChild(u), l.appendChild(R("표시할 텍스트", s)), l.appendChild(R("URL", a)), l.appendChild(c);
|
|
203
203
|
const m = document.createElement("button");
|
|
204
204
|
m.type = "button", m.className = "aw-btn aw-btn-ghost", m.textContent = "취소";
|
|
205
|
-
const
|
|
206
|
-
|
|
205
|
+
const h = document.createElement("button");
|
|
206
|
+
h.type = "button", h.className = "aw-btn aw-btn-primary", h.textContent = "확인", i.appendChild(m), i.appendChild(h), m.addEventListener("click", () => {
|
|
207
207
|
r(), t({ confirmed: !1 });
|
|
208
|
-
}),
|
|
208
|
+
}), h.addEventListener("click", () => {
|
|
209
209
|
r(), t({
|
|
210
210
|
confirmed: !0,
|
|
211
211
|
text: s.value,
|
|
212
|
-
href:
|
|
212
|
+
href: a.value,
|
|
213
213
|
newWindow: d.checked
|
|
214
214
|
});
|
|
215
|
-
}), document.body.appendChild(o), setTimeout(() =>
|
|
215
|
+
}), document.body.appendChild(o), setTimeout(() => a.focus(), 0);
|
|
216
216
|
});
|
|
217
217
|
}
|
|
218
|
-
function
|
|
218
|
+
function Xe(n = {}, e) {
|
|
219
219
|
return new Promise((t) => {
|
|
220
220
|
const { overlay: o, body: l, footer: i, close: r } = P("이미지", e), s = document.createElement("div");
|
|
221
221
|
s.className = "aw-tabs";
|
|
222
|
-
const c = document.createElement("button");
|
|
223
|
-
c.type = "button", c.className = "aw-tab", c.textContent = "임베드", c.title = "base64 데이터로 본문에 직접 삽입";
|
|
224
222
|
const a = document.createElement("button");
|
|
225
|
-
a.type = "button", a.className = "aw-tab", a.textContent = "
|
|
223
|
+
a.type = "button", a.className = "aw-tab", a.textContent = "임베드", a.title = "base64 데이터로 본문에 직접 삽입";
|
|
224
|
+
const c = document.createElement("button");
|
|
225
|
+
c.type = "button", c.className = "aw-tab", c.textContent = "URL", c.title = "이미지 URL 입력";
|
|
226
226
|
const d = document.createElement("button");
|
|
227
227
|
d.type = "button", d.className = "aw-tab", d.textContent = "업로드";
|
|
228
228
|
const u = !!n.onUpload;
|
|
229
|
-
u ? d.title = "서버 API 로 업로드 후 결과 URL 사용" : (d.disabled = !0, d.classList.add("aw-tab-disabled"), d.title = "개체 생성시 등록된 API 주소가 없습니다."), s.appendChild(
|
|
229
|
+
u ? d.title = "서버 API 로 업로드 후 결과 URL 사용" : (d.disabled = !0, d.classList.add("aw-tab-disabled"), d.title = "개체 생성시 등록된 API 주소가 없습니다."), s.appendChild(a), s.appendChild(c), s.appendChild(d), l.appendChild(s);
|
|
230
230
|
const m = document.createElement("div");
|
|
231
231
|
m.className = "aw-pane";
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
|
|
238
|
-
const
|
|
239
|
-
if (
|
|
240
|
-
const
|
|
241
|
-
x.className = "aw-preview", x.style.display = "none",
|
|
242
|
-
var
|
|
243
|
-
const
|
|
244
|
-
if (!(
|
|
232
|
+
const h = me("이미지 파일 선택 (base64 임베드)"), f = document.createElement("div");
|
|
233
|
+
f.className = "aw-preview", f.style.display = "none", m.appendChild(h.dropzone), m.appendChild(f);
|
|
234
|
+
const p = document.createElement("div");
|
|
235
|
+
p.className = "aw-pane";
|
|
236
|
+
const g = document.createElement("input");
|
|
237
|
+
g.type = "url", g.className = "aw-input", g.placeholder = "https://example.com/image.jpg", p.appendChild(R("이미지 URL", g));
|
|
238
|
+
const b = document.createElement("div");
|
|
239
|
+
if (b.className = "aw-pane", u) {
|
|
240
|
+
const y = me("서버 업로드용 이미지 선택"), x = document.createElement("div");
|
|
241
|
+
x.className = "aw-preview", x.style.display = "none", b.appendChild(y.dropzone), b.appendChild(x), y.input.addEventListener("change", async () => {
|
|
242
|
+
var z;
|
|
243
|
+
const $ = (z = y.input.files) == null ? void 0 : z[0];
|
|
244
|
+
if (!(!$ || !n.onUpload))
|
|
245
245
|
try {
|
|
246
|
-
|
|
247
|
-
const K = await n.onUpload(
|
|
248
|
-
|
|
246
|
+
y.dropzone.classList.add("aw-dropzone-loading");
|
|
247
|
+
const K = await n.onUpload($);
|
|
248
|
+
C = K, x.style.backgroundImage = `url(${JSON.stringify(K)})`, x.style.display = "block";
|
|
249
249
|
} catch (K) {
|
|
250
250
|
console.error(K);
|
|
251
251
|
} finally {
|
|
252
|
-
|
|
252
|
+
y.dropzone.classList.remove("aw-dropzone-loading"), y.input.value = "";
|
|
253
253
|
}
|
|
254
254
|
});
|
|
255
255
|
} else {
|
|
256
|
-
const
|
|
257
|
-
|
|
256
|
+
const y = document.createElement("div");
|
|
257
|
+
y.className = "aw-pane-notice", y.textContent = "개체 생성시 등록된 API 주소가 없습니다.", b.appendChild(y);
|
|
258
258
|
}
|
|
259
|
-
l.appendChild(m), l.appendChild(
|
|
260
|
-
let
|
|
261
|
-
const L = (
|
|
262
|
-
|
|
259
|
+
l.appendChild(m), l.appendChild(p), l.appendChild(b);
|
|
260
|
+
let v = "embed", T, C;
|
|
261
|
+
const L = (y) => {
|
|
262
|
+
y === "upload" && !u || (v = y, a.classList.toggle("aw-tab-active", y === "embed"), c.classList.toggle("aw-tab-active", y === "url"), d.classList.toggle("aw-tab-active", y === "upload"), m.style.display = y === "embed" ? "block" : "none", p.style.display = y === "url" ? "block" : "none", b.style.display = y === "upload" ? "block" : "none");
|
|
263
263
|
};
|
|
264
|
-
L(
|
|
265
|
-
var
|
|
266
|
-
const
|
|
267
|
-
if (!
|
|
264
|
+
L(v), a.addEventListener("click", () => L("embed")), c.addEventListener("click", () => L("url")), d.addEventListener("click", () => L("upload")), h.input.addEventListener("change", () => {
|
|
265
|
+
var $;
|
|
266
|
+
const y = ($ = h.input.files) == null ? void 0 : $[0];
|
|
267
|
+
if (!y) return;
|
|
268
268
|
const x = new FileReader();
|
|
269
269
|
x.onload = () => {
|
|
270
|
-
const
|
|
271
|
-
T =
|
|
272
|
-
}, x.readAsDataURL(
|
|
270
|
+
const z = String(x.result ?? "");
|
|
271
|
+
T = z, f.style.backgroundImage = `url(${JSON.stringify(z)})`, f.style.display = "block", h.input.value = "";
|
|
272
|
+
}, x.readAsDataURL(y);
|
|
273
273
|
});
|
|
274
274
|
const A = document.createElement("button");
|
|
275
275
|
A.type = "button", A.className = "aw-btn aw-btn-ghost", A.textContent = "취소";
|
|
@@ -277,10 +277,10 @@ function Ze(n = {}, e) {
|
|
|
277
277
|
M.type = "button", M.className = "aw-btn aw-btn-primary", M.textContent = "확인", i.appendChild(A), i.appendChild(M), A.addEventListener("click", () => {
|
|
278
278
|
r(), t({ confirmed: !1 });
|
|
279
279
|
}), M.addEventListener("click", () => {
|
|
280
|
-
let
|
|
281
|
-
|
|
280
|
+
let y;
|
|
281
|
+
v === "embed" ? y = T : v === "url" ? y = g.value || void 0 : v === "upload" && (y = C), r();
|
|
282
282
|
const x = { confirmed: !0 };
|
|
283
|
-
|
|
283
|
+
y && (x.src = y), t(x);
|
|
284
284
|
}), document.body.appendChild(o);
|
|
285
285
|
});
|
|
286
286
|
}
|
|
@@ -293,7 +293,7 @@ function me(n) {
|
|
|
293
293
|
const t = document.createElement("input");
|
|
294
294
|
return t.type = "file", t.accept = "image/*", t.style.display = "none", e.appendChild(t), { dropzone: e, input: t };
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function Qe(n) {
|
|
297
297
|
return new Promise((e) => {
|
|
298
298
|
const { overlay: t, body: o, footer: l, close: i } = P("HTML", n), r = document.createElement("input");
|
|
299
299
|
r.type = "file", r.accept = ".html,.htm,text/html", r.style.display = "none";
|
|
@@ -302,49 +302,49 @@ function Xe(n) {
|
|
|
302
302
|
${E.importHtml}
|
|
303
303
|
<div class="aw-dropzone-text">HTML 파일 선택<br/>드래그 앤 드롭 또는 클릭</div>
|
|
304
304
|
`, s.appendChild(r);
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
const
|
|
308
|
-
|
|
305
|
+
const a = document.createElement("div");
|
|
306
|
+
a.className = "aw-dialog-hint", a.textContent = "선택된 파일 없음";
|
|
307
|
+
const c = document.createElement("textarea");
|
|
308
|
+
c.className = "aw-input aw-textarea", c.placeholder = "또는 HTML 을 직접 붙여넣기…", c.rows = 8, o.appendChild(s), o.appendChild(a), o.appendChild(R("직접 붙여넣기", c));
|
|
309
309
|
const d = document.createElement("div");
|
|
310
310
|
d.className = "aw-dialog-hint", d.textContent = "iframe 으로 로드한 후 모든 스타일을 인라인으로 합쳐 가져옵니다.", o.appendChild(d);
|
|
311
311
|
let u;
|
|
312
312
|
r.addEventListener("change", () => {
|
|
313
|
-
var
|
|
314
|
-
const
|
|
315
|
-
if (!
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
u = String(
|
|
319
|
-
},
|
|
320
|
-
}), s.addEventListener("dragover", (
|
|
321
|
-
|
|
313
|
+
var g;
|
|
314
|
+
const f = (g = r.files) == null ? void 0 : g[0];
|
|
315
|
+
if (!f) return;
|
|
316
|
+
const p = new FileReader();
|
|
317
|
+
p.onload = () => {
|
|
318
|
+
u = String(p.result ?? ""), c.value = u, a.textContent = `${f.name} (${f.size.toLocaleString()} bytes)`, r.value = "";
|
|
319
|
+
}, p.readAsText(f);
|
|
320
|
+
}), s.addEventListener("dragover", (f) => {
|
|
321
|
+
f.preventDefault(), s.classList.add("aw-dropzone-loading");
|
|
322
322
|
}), s.addEventListener("dragleave", () => {
|
|
323
323
|
s.classList.remove("aw-dropzone-loading");
|
|
324
|
-
}), s.addEventListener("drop", (
|
|
325
|
-
var
|
|
326
|
-
|
|
327
|
-
const
|
|
328
|
-
if (!
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
u = String(
|
|
332
|
-
},
|
|
324
|
+
}), s.addEventListener("drop", (f) => {
|
|
325
|
+
var b, v;
|
|
326
|
+
f.preventDefault(), s.classList.remove("aw-dropzone-loading");
|
|
327
|
+
const p = (v = (b = f.dataTransfer) == null ? void 0 : b.files) == null ? void 0 : v[0];
|
|
328
|
+
if (!p) return;
|
|
329
|
+
const g = new FileReader();
|
|
330
|
+
g.onload = () => {
|
|
331
|
+
u = String(g.result ?? ""), c.value = u, a.textContent = `${p.name} (${p.size.toLocaleString()} bytes)`;
|
|
332
|
+
}, g.readAsText(p);
|
|
333
333
|
});
|
|
334
334
|
const m = document.createElement("button");
|
|
335
335
|
m.type = "button", m.className = "aw-btn aw-btn-ghost", m.textContent = "취소";
|
|
336
|
-
const
|
|
337
|
-
|
|
336
|
+
const h = document.createElement("button");
|
|
337
|
+
h.type = "button", h.className = "aw-btn aw-btn-primary", h.textContent = "가져오기", l.appendChild(m), l.appendChild(h), m.addEventListener("click", () => {
|
|
338
338
|
i(), e({ confirmed: !1 });
|
|
339
|
-
}),
|
|
340
|
-
const
|
|
339
|
+
}), h.addEventListener("click", () => {
|
|
340
|
+
const f = c.value.trim();
|
|
341
341
|
i();
|
|
342
|
-
const
|
|
343
|
-
|
|
342
|
+
const p = { confirmed: !0 };
|
|
343
|
+
f.length > 0 && (p.html = f), e(p);
|
|
344
344
|
}), document.body.appendChild(t);
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function Je(n) {
|
|
348
348
|
return new Promise((e) => {
|
|
349
349
|
const { overlay: t, body: o, footer: l, close: i } = P("Markdown", n), r = document.createElement("input");
|
|
350
350
|
r.type = "file", r.accept = ".md,.markdown,text/markdown,text/plain", r.style.display = "none";
|
|
@@ -353,34 +353,34 @@ function Qe(n) {
|
|
|
353
353
|
${E.importMarkdown}
|
|
354
354
|
<div class="aw-dropzone-text">Markdown 파일 선택<br/>드래그 앤 드롭 또는 클릭</div>
|
|
355
355
|
`, s.appendChild(r);
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
|
|
356
|
+
const a = document.createElement("div");
|
|
357
|
+
a.className = "aw-dialog-hint", a.textContent = "선택된 파일 없음";
|
|
358
|
+
const c = document.createElement("textarea");
|
|
359
|
+
c.className = "aw-input aw-textarea", c.placeholder = "또는 Markdown 을 직접 붙여넣기…", c.rows = 8, o.appendChild(s), o.appendChild(a), o.appendChild(R("직접 붙여넣기", c));
|
|
360
360
|
const d = document.createElement("div");
|
|
361
361
|
d.className = "aw-dialog-hint", d.textContent = "CommonMark 기본 문법(제목/목록/링크/코드/표/인용 등) 지원", o.appendChild(d), r.addEventListener("change", () => {
|
|
362
|
-
var
|
|
363
|
-
const
|
|
362
|
+
var p;
|
|
363
|
+
const h = (p = r.files) == null ? void 0 : p[0];
|
|
364
|
+
if (!h) return;
|
|
365
|
+
const f = new FileReader();
|
|
366
|
+
f.onload = () => {
|
|
367
|
+
const g = String(f.result ?? "");
|
|
368
|
+
c.value = g, a.textContent = `${h.name} (${h.size.toLocaleString()} bytes)`, r.value = "";
|
|
369
|
+
}, f.readAsText(h);
|
|
370
|
+
}), s.addEventListener("dragover", (h) => {
|
|
371
|
+
h.preventDefault(), s.classList.add("aw-dropzone-loading");
|
|
372
|
+
}), s.addEventListener("dragleave", () => {
|
|
373
|
+
s.classList.remove("aw-dropzone-loading");
|
|
374
|
+
}), s.addEventListener("drop", (h) => {
|
|
375
|
+
var g, b;
|
|
376
|
+
h.preventDefault(), s.classList.remove("aw-dropzone-loading");
|
|
377
|
+
const f = (b = (g = h.dataTransfer) == null ? void 0 : g.files) == null ? void 0 : b[0];
|
|
364
378
|
if (!f) return;
|
|
365
379
|
const p = new FileReader();
|
|
366
380
|
p.onload = () => {
|
|
367
|
-
const
|
|
368
|
-
|
|
381
|
+
const v = String(p.result ?? "");
|
|
382
|
+
c.value = v, a.textContent = `${f.name} (${f.size.toLocaleString()} bytes)`;
|
|
369
383
|
}, p.readAsText(f);
|
|
370
|
-
}), s.addEventListener("dragover", (f) => {
|
|
371
|
-
f.preventDefault(), s.classList.add("aw-dropzone-loading");
|
|
372
|
-
}), s.addEventListener("dragleave", () => {
|
|
373
|
-
s.classList.remove("aw-dropzone-loading");
|
|
374
|
-
}), s.addEventListener("drop", (f) => {
|
|
375
|
-
var b, v;
|
|
376
|
-
f.preventDefault(), s.classList.remove("aw-dropzone-loading");
|
|
377
|
-
const p = (v = (b = f.dataTransfer) == null ? void 0 : b.files) == null ? void 0 : v[0];
|
|
378
|
-
if (!p) return;
|
|
379
|
-
const h = new FileReader();
|
|
380
|
-
h.onload = () => {
|
|
381
|
-
const k = String(h.result ?? "");
|
|
382
|
-
a.value = k, c.textContent = `${p.name} (${p.size.toLocaleString()} bytes)`;
|
|
383
|
-
}, h.readAsText(p);
|
|
384
384
|
});
|
|
385
385
|
const u = document.createElement("button");
|
|
386
386
|
u.type = "button", u.className = "aw-btn aw-btn-ghost", u.textContent = "취소";
|
|
@@ -388,115 +388,115 @@ function Qe(n) {
|
|
|
388
388
|
m.type = "button", m.className = "aw-btn aw-btn-primary", m.textContent = "가져오기", l.appendChild(u), l.appendChild(m), u.addEventListener("click", () => {
|
|
389
389
|
i(), e({ confirmed: !1 });
|
|
390
390
|
}), m.addEventListener("click", () => {
|
|
391
|
-
const
|
|
391
|
+
const h = c.value.trim();
|
|
392
392
|
i();
|
|
393
|
-
const
|
|
394
|
-
|
|
393
|
+
const f = { confirmed: !0 };
|
|
394
|
+
h.length > 0 && (f.markdown = h), e(f);
|
|
395
395
|
}), document.body.appendChild(t);
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function et(n = {}, e) {
|
|
399
399
|
return new Promise((t) => {
|
|
400
400
|
const { overlay: o, body: l, footer: i, close: r } = P("파일 첨부", e), s = document.createElement("div");
|
|
401
401
|
s.className = "aw-tabs";
|
|
402
|
-
const c = document.createElement("button");
|
|
403
|
-
c.type = "button", c.className = "aw-tab", c.textContent = "URL", c.title = "이미 호스팅된 파일의 URL 직접 입력";
|
|
404
402
|
const a = document.createElement("button");
|
|
405
|
-
a.type = "button", a.className = "aw-tab", a.textContent = "
|
|
403
|
+
a.type = "button", a.className = "aw-tab", a.textContent = "URL", a.title = "이미 호스팅된 파일의 URL 직접 입력";
|
|
404
|
+
const c = document.createElement("button");
|
|
405
|
+
c.type = "button", c.className = "aw-tab", c.textContent = "업로드";
|
|
406
406
|
const d = !!n.onUpload;
|
|
407
|
-
d ?
|
|
407
|
+
d ? c.title = "서버 API 로 업로드 후 응답 URL 사용" : (c.disabled = !0, c.classList.add("aw-tab-disabled"), c.title = "개체 생성시 등록된 파일 업로드 API 가 없습니다."), s.appendChild(a), s.appendChild(c), l.appendChild(s);
|
|
408
408
|
const u = document.createElement("div");
|
|
409
409
|
u.className = "aw-pane";
|
|
410
410
|
const m = document.createElement("input");
|
|
411
411
|
m.type = "url", m.className = "aw-input", m.placeholder = "https://example.com/files/report.pdf", u.appendChild(R("파일 URL", m));
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
const
|
|
415
|
-
|
|
416
|
-
let
|
|
412
|
+
const h = document.createElement("input");
|
|
413
|
+
h.type = "text", h.className = "aw-input", h.placeholder = "표시할 파일명 (예: report.pdf)", u.appendChild(R("파일명", h));
|
|
414
|
+
const f = document.createElement("div");
|
|
415
|
+
f.className = "aw-pane";
|
|
416
|
+
let p;
|
|
417
417
|
if (d) {
|
|
418
|
-
const
|
|
419
|
-
|
|
418
|
+
const C = document.createElement("label");
|
|
419
|
+
C.className = "aw-dropzone", C.innerHTML = `
|
|
420
420
|
${E.upload}
|
|
421
421
|
<div class="aw-dropzone-text">서버 업로드용 파일 선택<br/>드래그 앤 드롭 또는 클릭</div>
|
|
422
422
|
`;
|
|
423
423
|
const L = document.createElement("input");
|
|
424
|
-
L.type = "file", L.style.display = "none",
|
|
424
|
+
L.type = "file", L.style.display = "none", C.appendChild(L);
|
|
425
425
|
const A = document.createElement("div");
|
|
426
|
-
A.className = "aw-dialog-hint", A.textContent = "선택된 파일 없음",
|
|
427
|
-
const M = async (
|
|
426
|
+
A.className = "aw-dialog-hint", A.textContent = "선택된 파일 없음", f.appendChild(C), f.appendChild(A);
|
|
427
|
+
const M = async (y) => {
|
|
428
428
|
if (n.onUpload)
|
|
429
429
|
try {
|
|
430
|
-
|
|
431
|
-
src: await n.onUpload(
|
|
432
|
-
name:
|
|
433
|
-
size:
|
|
434
|
-
type:
|
|
435
|
-
}, A.textContent = `${
|
|
430
|
+
C.classList.add("aw-dropzone-loading"), p = {
|
|
431
|
+
src: await n.onUpload(y),
|
|
432
|
+
name: y.name,
|
|
433
|
+
size: y.size,
|
|
434
|
+
type: y.type || ""
|
|
435
|
+
}, A.textContent = `${y.name} (${y.size.toLocaleString()} bytes) — 업로드 완료`;
|
|
436
436
|
} catch (x) {
|
|
437
437
|
console.error(x), A.textContent = `업로드 실패: ${x instanceof Error ? x.message : String(x)}`;
|
|
438
438
|
} finally {
|
|
439
|
-
|
|
439
|
+
C.classList.remove("aw-dropzone-loading"), L.value = "";
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
442
|
L.addEventListener("change", () => {
|
|
443
443
|
var x;
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
}),
|
|
447
|
-
|
|
448
|
-
}),
|
|
449
|
-
|
|
450
|
-
}),
|
|
451
|
-
var
|
|
452
|
-
|
|
453
|
-
const x = (
|
|
444
|
+
const y = (x = L.files) == null ? void 0 : x[0];
|
|
445
|
+
y && M(y);
|
|
446
|
+
}), C.addEventListener("dragover", (y) => {
|
|
447
|
+
y.preventDefault(), C.classList.add("aw-dropzone-loading");
|
|
448
|
+
}), C.addEventListener("dragleave", () => {
|
|
449
|
+
C.classList.remove("aw-dropzone-loading");
|
|
450
|
+
}), C.addEventListener("drop", (y) => {
|
|
451
|
+
var $, z;
|
|
452
|
+
y.preventDefault();
|
|
453
|
+
const x = (z = ($ = y.dataTransfer) == null ? void 0 : $.files) == null ? void 0 : z[0];
|
|
454
454
|
x && M(x);
|
|
455
455
|
});
|
|
456
456
|
} else {
|
|
457
|
-
const
|
|
458
|
-
|
|
457
|
+
const C = document.createElement("div");
|
|
458
|
+
C.className = "aw-pane-notice", C.textContent = "개체 생성시 등록된 파일 업로드 API 가 없습니다.", f.appendChild(C);
|
|
459
459
|
}
|
|
460
|
-
l.appendChild(u), l.appendChild(
|
|
461
|
-
let
|
|
462
|
-
const
|
|
463
|
-
|
|
460
|
+
l.appendChild(u), l.appendChild(f);
|
|
461
|
+
let g = "url";
|
|
462
|
+
const b = (C) => {
|
|
463
|
+
C === "upload" && !d || (g = C, a.classList.toggle("aw-tab-active", C === "url"), c.classList.toggle("aw-tab-active", C === "upload"), u.style.display = C === "url" ? "block" : "none", f.style.display = C === "upload" ? "block" : "none");
|
|
464
464
|
};
|
|
465
|
-
|
|
466
|
-
const
|
|
467
|
-
|
|
465
|
+
b(g), a.addEventListener("click", () => b("url")), c.addEventListener("click", () => b("upload"));
|
|
466
|
+
const v = document.createElement("button");
|
|
467
|
+
v.type = "button", v.className = "aw-btn aw-btn-ghost", v.textContent = "취소";
|
|
468
468
|
const T = document.createElement("button");
|
|
469
|
-
T.type = "button", T.className = "aw-btn aw-btn-primary", T.textContent = "확인", i.appendChild(
|
|
469
|
+
T.type = "button", T.className = "aw-btn aw-btn-primary", T.textContent = "확인", i.appendChild(v), i.appendChild(T), v.addEventListener("click", () => {
|
|
470
470
|
r(), t({ confirmed: !1 });
|
|
471
471
|
}), T.addEventListener("click", () => {
|
|
472
|
-
const
|
|
473
|
-
if (
|
|
474
|
-
const L = m.value.trim(), A =
|
|
475
|
-
L.length > 0 && (
|
|
476
|
-
} else
|
|
477
|
-
r(), t(
|
|
472
|
+
const C = { confirmed: !0 };
|
|
473
|
+
if (g === "url") {
|
|
474
|
+
const L = m.value.trim(), A = h.value.trim();
|
|
475
|
+
L.length > 0 && (C.src = L), A.length > 0 && (C.name = A);
|
|
476
|
+
} else p && (C.src = p.src, C.name = p.name, C.size = p.size, p.type && (C.type = p.type));
|
|
477
|
+
r(), t(C);
|
|
478
478
|
}), document.body.appendChild(o);
|
|
479
479
|
});
|
|
480
480
|
}
|
|
481
|
-
function
|
|
481
|
+
function tt(n) {
|
|
482
482
|
return new Promise((e) => {
|
|
483
483
|
const { overlay: t, body: o, footer: l, close: i } = P("유튜브 임베드", n), r = document.createElement("input");
|
|
484
484
|
r.type = "url", r.className = "aw-input", r.placeholder = "https://www.youtube.com/watch?v=…", o.appendChild(R("YouTube URL", r));
|
|
485
485
|
const s = document.createElement("div");
|
|
486
486
|
s.className = "aw-dialog-hint", s.textContent = "youtu.be / youtube.com/watch / /embed / /shorts 형식 모두 지원", o.appendChild(s);
|
|
487
|
-
const c = document.createElement("button");
|
|
488
|
-
c.type = "button", c.className = "aw-btn aw-btn-ghost", c.textContent = "취소";
|
|
489
487
|
const a = document.createElement("button");
|
|
490
|
-
a.type = "button", a.className = "aw-btn aw-btn-
|
|
488
|
+
a.type = "button", a.className = "aw-btn aw-btn-ghost", a.textContent = "취소";
|
|
489
|
+
const c = document.createElement("button");
|
|
490
|
+
c.type = "button", c.className = "aw-btn aw-btn-primary", c.textContent = "확인", l.appendChild(a), l.appendChild(c), a.addEventListener("click", () => {
|
|
491
491
|
i(), e({ confirmed: !1 });
|
|
492
|
-
}),
|
|
492
|
+
}), c.addEventListener("click", () => {
|
|
493
493
|
i(), e({ confirmed: !0, url: r.value });
|
|
494
494
|
}), document.body.appendChild(t), setTimeout(() => r.focus(), 0);
|
|
495
495
|
});
|
|
496
496
|
}
|
|
497
|
-
const
|
|
497
|
+
const nt = "system", W = [
|
|
498
498
|
{
|
|
499
|
-
id:
|
|
499
|
+
id: nt,
|
|
500
500
|
label: "시스템 기본",
|
|
501
501
|
stack: '-apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", "Malgun Gothic", sans-serif'
|
|
502
502
|
},
|
|
@@ -554,7 +554,7 @@ const tt = "system", W = [
|
|
|
554
554
|
for (const e of W) n[e.id] = e;
|
|
555
555
|
return n;
|
|
556
556
|
})();
|
|
557
|
-
const
|
|
557
|
+
const ot = [
|
|
558
558
|
12,
|
|
559
559
|
13,
|
|
560
560
|
14,
|
|
@@ -568,7 +568,7 @@ const nt = [
|
|
|
568
568
|
40,
|
|
569
569
|
48
|
|
570
570
|
];
|
|
571
|
-
function
|
|
571
|
+
function lt(n) {
|
|
572
572
|
if (!n) return null;
|
|
573
573
|
const e = n.trim(), t = /^(\d+(?:\.\d+)?)px$/i.exec(e);
|
|
574
574
|
if (t && t[1]) return Math.round(Number(t[1]));
|
|
@@ -576,7 +576,7 @@ function ot(n) {
|
|
|
576
576
|
return o && o[1] ? Math.round(Number(o[1]) * 16) : null;
|
|
577
577
|
}
|
|
578
578
|
let fe = !1;
|
|
579
|
-
function
|
|
579
|
+
function it() {
|
|
580
580
|
if (fe || (fe = !0, typeof document > "u")) return;
|
|
581
581
|
const n = W.map((e) => e.googleFonts).filter((e) => typeof e == "string" && e.length > 0);
|
|
582
582
|
if (n.length > 0) {
|
|
@@ -593,7 +593,7 @@ function ge(n) {
|
|
|
593
593
|
const t = document.createElement("link");
|
|
594
594
|
t.rel = "stylesheet", t.href = n, document.head.appendChild(t);
|
|
595
595
|
}
|
|
596
|
-
function
|
|
596
|
+
function rt(n) {
|
|
597
597
|
var o;
|
|
598
598
|
if (!n) return null;
|
|
599
599
|
const e = be(n);
|
|
@@ -610,11 +610,11 @@ function be(n) {
|
|
|
610
610
|
const e = (t = n.split(",")[0]) == null ? void 0 : t.trim();
|
|
611
611
|
return e ? e.replace(/^["']|["']$/g, "") : null;
|
|
612
612
|
}
|
|
613
|
-
const
|
|
613
|
+
const B = {
|
|
614
614
|
lineComment: "//",
|
|
615
615
|
blockComment: { start: "/*", end: "*/" },
|
|
616
616
|
stringDelims: ['"', "'"]
|
|
617
|
-
},
|
|
617
|
+
}, Ne = /* @__PURE__ */ new Set([
|
|
618
618
|
"abstract",
|
|
619
619
|
"arguments",
|
|
620
620
|
"async",
|
|
@@ -669,8 +669,8 @@ const N = {
|
|
|
669
669
|
"while",
|
|
670
670
|
"with",
|
|
671
671
|
"yield"
|
|
672
|
-
]),
|
|
673
|
-
...
|
|
672
|
+
]), st = /* @__PURE__ */ new Set([
|
|
673
|
+
...Ne,
|
|
674
674
|
"any",
|
|
675
675
|
"as",
|
|
676
676
|
"asserts",
|
|
@@ -693,7 +693,7 @@ const N = {
|
|
|
693
693
|
"type",
|
|
694
694
|
"unique",
|
|
695
695
|
"unknown"
|
|
696
|
-
]),
|
|
696
|
+
]), at = /* @__PURE__ */ new Set([
|
|
697
697
|
"False",
|
|
698
698
|
"None",
|
|
699
699
|
"True",
|
|
@@ -729,7 +729,7 @@ const N = {
|
|
|
729
729
|
"while",
|
|
730
730
|
"with",
|
|
731
731
|
"yield"
|
|
732
|
-
]),
|
|
732
|
+
]), ct = /* @__PURE__ */ new Set([
|
|
733
733
|
"abs",
|
|
734
734
|
"all",
|
|
735
735
|
"any",
|
|
@@ -757,7 +757,7 @@ const N = {
|
|
|
757
757
|
"zip",
|
|
758
758
|
"self",
|
|
759
759
|
"cls"
|
|
760
|
-
]),
|
|
760
|
+
]), Me = /* @__PURE__ */ new Set([
|
|
761
761
|
"auto",
|
|
762
762
|
"break",
|
|
763
763
|
"case",
|
|
@@ -794,8 +794,8 @@ const N = {
|
|
|
794
794
|
"restrict",
|
|
795
795
|
"_Bool",
|
|
796
796
|
"NULL"
|
|
797
|
-
]),
|
|
798
|
-
...
|
|
797
|
+
]), dt = /* @__PURE__ */ new Set([
|
|
798
|
+
...Me,
|
|
799
799
|
"class",
|
|
800
800
|
"new",
|
|
801
801
|
"delete",
|
|
@@ -829,7 +829,7 @@ const N = {
|
|
|
829
829
|
"noexcept",
|
|
830
830
|
"final",
|
|
831
831
|
"auto"
|
|
832
|
-
]),
|
|
832
|
+
]), ut = /* @__PURE__ */ new Set([
|
|
833
833
|
"abstract",
|
|
834
834
|
"async",
|
|
835
835
|
"await",
|
|
@@ -914,7 +914,7 @@ const N = {
|
|
|
914
914
|
"init",
|
|
915
915
|
"nameof",
|
|
916
916
|
"when"
|
|
917
|
-
]),
|
|
917
|
+
]), pt = /* @__PURE__ */ new Set([
|
|
918
918
|
"abstract",
|
|
919
919
|
"assert",
|
|
920
920
|
"boolean",
|
|
@@ -974,7 +974,7 @@ const N = {
|
|
|
974
974
|
"sealed",
|
|
975
975
|
"permits",
|
|
976
976
|
"non-sealed"
|
|
977
|
-
]),
|
|
977
|
+
]), ht = /* @__PURE__ */ new Set([
|
|
978
978
|
"abstract",
|
|
979
979
|
"actual",
|
|
980
980
|
"annotation",
|
|
@@ -1041,7 +1041,7 @@ const N = {
|
|
|
1041
1041
|
"when",
|
|
1042
1042
|
"where",
|
|
1043
1043
|
"while"
|
|
1044
|
-
]),
|
|
1044
|
+
]), mt = /* @__PURE__ */ new Set([
|
|
1045
1045
|
"break",
|
|
1046
1046
|
"case",
|
|
1047
1047
|
"chan",
|
|
@@ -1071,7 +1071,7 @@ const N = {
|
|
|
1071
1071
|
"false",
|
|
1072
1072
|
"nil",
|
|
1073
1073
|
"iota"
|
|
1074
|
-
]),
|
|
1074
|
+
]), ft = /* @__PURE__ */ new Set([
|
|
1075
1075
|
"as",
|
|
1076
1076
|
"async",
|
|
1077
1077
|
"await",
|
|
@@ -1120,7 +1120,7 @@ const N = {
|
|
|
1120
1120
|
"unsized",
|
|
1121
1121
|
"virtual",
|
|
1122
1122
|
"yield"
|
|
1123
|
-
]),
|
|
1123
|
+
]), gt = /* @__PURE__ */ new Set([
|
|
1124
1124
|
"if",
|
|
1125
1125
|
"then",
|
|
1126
1126
|
"else",
|
|
@@ -1151,7 +1151,7 @@ const N = {
|
|
|
1151
1151
|
"source",
|
|
1152
1152
|
"true",
|
|
1153
1153
|
"false"
|
|
1154
|
-
]),
|
|
1154
|
+
]), bt = /* @__PURE__ */ new Set([
|
|
1155
1155
|
"select",
|
|
1156
1156
|
"from",
|
|
1157
1157
|
"where",
|
|
@@ -1220,7 +1220,7 @@ const N = {
|
|
|
1220
1220
|
"max",
|
|
1221
1221
|
"asc",
|
|
1222
1222
|
"desc"
|
|
1223
|
-
]),
|
|
1223
|
+
]), yt = /* @__PURE__ */ new Set(["true", "false", "null"]), Be = [
|
|
1224
1224
|
{
|
|
1225
1225
|
id: "plaintext",
|
|
1226
1226
|
label: "Plain Text",
|
|
@@ -1229,54 +1229,54 @@ const N = {
|
|
|
1229
1229
|
{
|
|
1230
1230
|
id: "javascript",
|
|
1231
1231
|
label: "JavaScript",
|
|
1232
|
-
keywords:
|
|
1233
|
-
...
|
|
1232
|
+
keywords: Ne,
|
|
1233
|
+
...B,
|
|
1234
1234
|
stringDelims: ['"', "'", "`"]
|
|
1235
1235
|
},
|
|
1236
1236
|
{
|
|
1237
1237
|
id: "typescript",
|
|
1238
1238
|
label: "TypeScript",
|
|
1239
|
-
keywords:
|
|
1240
|
-
...
|
|
1239
|
+
keywords: st,
|
|
1240
|
+
...B,
|
|
1241
1241
|
stringDelims: ['"', "'", "`"]
|
|
1242
1242
|
},
|
|
1243
1243
|
{
|
|
1244
1244
|
id: "python",
|
|
1245
1245
|
label: "Python",
|
|
1246
|
-
keywords:
|
|
1247
|
-
builtins:
|
|
1246
|
+
keywords: at,
|
|
1247
|
+
builtins: ct,
|
|
1248
1248
|
lineComment: "#",
|
|
1249
1249
|
stringDelims: ['"', "'"]
|
|
1250
1250
|
},
|
|
1251
1251
|
{
|
|
1252
1252
|
id: "json",
|
|
1253
1253
|
label: "JSON",
|
|
1254
|
-
keywords:
|
|
1254
|
+
keywords: yt,
|
|
1255
1255
|
stringDelims: ['"']
|
|
1256
1256
|
},
|
|
1257
1257
|
{
|
|
1258
1258
|
id: "html",
|
|
1259
1259
|
label: "HTML",
|
|
1260
1260
|
keywords: /* @__PURE__ */ new Set(),
|
|
1261
|
-
custom: (n) =>
|
|
1261
|
+
custom: (n) => xt(n)
|
|
1262
1262
|
},
|
|
1263
1263
|
{
|
|
1264
1264
|
id: "css",
|
|
1265
1265
|
label: "CSS",
|
|
1266
1266
|
keywords: /* @__PURE__ */ new Set(),
|
|
1267
|
-
custom: (n) =>
|
|
1267
|
+
custom: (n) => Lt(n)
|
|
1268
1268
|
},
|
|
1269
1269
|
{
|
|
1270
1270
|
id: "bash",
|
|
1271
1271
|
label: "Bash",
|
|
1272
|
-
keywords:
|
|
1272
|
+
keywords: gt,
|
|
1273
1273
|
lineComment: "#",
|
|
1274
1274
|
stringDelims: ['"', "'"]
|
|
1275
1275
|
},
|
|
1276
1276
|
{
|
|
1277
1277
|
id: "sql",
|
|
1278
1278
|
label: "SQL",
|
|
1279
|
-
keywords:
|
|
1279
|
+
keywords: bt,
|
|
1280
1280
|
caseInsensitiveKeywords: !0,
|
|
1281
1281
|
lineComment: "--",
|
|
1282
1282
|
blockComment: { start: "/*", end: "*/" },
|
|
@@ -1286,26 +1286,26 @@ const N = {
|
|
|
1286
1286
|
id: "markdown",
|
|
1287
1287
|
label: "Markdown",
|
|
1288
1288
|
keywords: /* @__PURE__ */ new Set(),
|
|
1289
|
-
custom: (n) =>
|
|
1289
|
+
custom: (n) => At(n)
|
|
1290
1290
|
},
|
|
1291
|
-
{ id: "c", label: "C", keywords:
|
|
1292
|
-
{ id: "cpp", label: "C++", keywords:
|
|
1293
|
-
{ id: "csharp", label: "C#", keywords:
|
|
1294
|
-
{ id: "java", label: "Java", keywords:
|
|
1295
|
-
{ id: "kotlin", label: "Kotlin", keywords:
|
|
1296
|
-
{ id: "go", label: "Go", keywords:
|
|
1297
|
-
{ id: "rust", label: "Rust", keywords:
|
|
1298
|
-
],
|
|
1291
|
+
{ id: "c", label: "C", keywords: Me, ...B },
|
|
1292
|
+
{ id: "cpp", label: "C++", keywords: dt, ...B },
|
|
1293
|
+
{ id: "csharp", label: "C#", keywords: ut, ...B },
|
|
1294
|
+
{ id: "java", label: "Java", keywords: pt, ...B },
|
|
1295
|
+
{ id: "kotlin", label: "Kotlin", keywords: ht, ...B },
|
|
1296
|
+
{ id: "go", label: "Go", keywords: mt, ...B },
|
|
1297
|
+
{ id: "rust", label: "Rust", keywords: ft, ...B }
|
|
1298
|
+
], wt = (() => {
|
|
1299
1299
|
const n = /* @__PURE__ */ new Map();
|
|
1300
|
-
for (const e of
|
|
1300
|
+
for (const e of Be) n.set(e.id, e);
|
|
1301
1301
|
return n;
|
|
1302
1302
|
})();
|
|
1303
|
-
function wt(n, e) {
|
|
1304
|
-
if (!e) return C(n);
|
|
1305
|
-
const t = yt.get(e);
|
|
1306
|
-
return t ? t.custom ? t.custom(n) : kt(n, t) : C(n);
|
|
1307
|
-
}
|
|
1308
1303
|
function kt(n, e) {
|
|
1304
|
+
if (!e) return k(n);
|
|
1305
|
+
const t = wt.get(e);
|
|
1306
|
+
return t ? t.custom ? t.custom(n) : vt(n, t) : k(n);
|
|
1307
|
+
}
|
|
1308
|
+
function vt(n, e) {
|
|
1309
1309
|
var r, s;
|
|
1310
1310
|
const t = !!e.caseInsensitiveKeywords;
|
|
1311
1311
|
let o = "", l = 0;
|
|
@@ -1314,128 +1314,128 @@ function kt(n, e) {
|
|
|
1314
1314
|
if (e.lineComment && n.startsWith(e.lineComment, l)) {
|
|
1315
1315
|
const d = n.indexOf(`
|
|
1316
1316
|
`, l), u = d === -1 ? i : d;
|
|
1317
|
-
o += `<span class="hl-comment">${
|
|
1317
|
+
o += `<span class="hl-comment">${k(n.slice(l, u))}</span>`, l = u;
|
|
1318
1318
|
continue;
|
|
1319
1319
|
}
|
|
1320
1320
|
if (e.blockComment && n.startsWith(e.blockComment.start, l)) {
|
|
1321
1321
|
const d = n.indexOf(e.blockComment.end, l + e.blockComment.start.length), u = d === -1 ? i : d + e.blockComment.end.length;
|
|
1322
|
-
o += `<span class="hl-comment">${
|
|
1322
|
+
o += `<span class="hl-comment">${k(n.slice(l, u))}</span>`, l = u;
|
|
1323
1323
|
continue;
|
|
1324
1324
|
}
|
|
1325
|
-
const
|
|
1326
|
-
if (
|
|
1327
|
-
let d = l +
|
|
1325
|
+
const a = (r = e.stringDelims) == null ? void 0 : r.find((d) => n.startsWith(d, l));
|
|
1326
|
+
if (a) {
|
|
1327
|
+
let d = l + a.length;
|
|
1328
1328
|
for (; d < i; ) {
|
|
1329
1329
|
const u = n[d] ?? "";
|
|
1330
1330
|
if (u === "\\") {
|
|
1331
1331
|
d += 2;
|
|
1332
1332
|
continue;
|
|
1333
1333
|
}
|
|
1334
|
-
if (n.startsWith(
|
|
1335
|
-
d +=
|
|
1334
|
+
if (n.startsWith(a, d)) {
|
|
1335
|
+
d += a.length;
|
|
1336
1336
|
break;
|
|
1337
1337
|
}
|
|
1338
1338
|
if (u === `
|
|
1339
|
-
` &&
|
|
1339
|
+
` && a !== "`") break;
|
|
1340
1340
|
d++;
|
|
1341
1341
|
}
|
|
1342
|
-
o += `<span class="hl-string">${
|
|
1342
|
+
o += `<span class="hl-string">${k(n.slice(l, d))}</span>`, l = d;
|
|
1343
1343
|
continue;
|
|
1344
1344
|
}
|
|
1345
|
-
const
|
|
1346
|
-
if (/[0-9]/.test(
|
|
1347
|
-
const d =
|
|
1345
|
+
const c = n[l] ?? "";
|
|
1346
|
+
if (/[0-9]/.test(c)) {
|
|
1347
|
+
const d = Ct.exec(n.slice(l));
|
|
1348
1348
|
if (d) {
|
|
1349
|
-
o += `<span class="hl-number">${
|
|
1349
|
+
o += `<span class="hl-number">${k(d[0])}</span>`, l += d[0].length;
|
|
1350
1350
|
continue;
|
|
1351
1351
|
}
|
|
1352
1352
|
}
|
|
1353
|
-
if (/[a-zA-Z_$]/.test(
|
|
1353
|
+
if (/[a-zA-Z_$]/.test(c)) {
|
|
1354
1354
|
let d = l + 1;
|
|
1355
1355
|
for (; d < i && /[a-zA-Z0-9_$]/.test(n[d] ?? ""); ) d++;
|
|
1356
1356
|
const u = n.slice(l, d), m = t ? u.toLowerCase() : u;
|
|
1357
1357
|
if (e.keywords.has(m))
|
|
1358
|
-
o += `<span class="hl-keyword">${
|
|
1358
|
+
o += `<span class="hl-keyword">${k(u)}</span>`;
|
|
1359
1359
|
else if ((s = e.builtins) != null && s.has(m))
|
|
1360
|
-
o += `<span class="hl-builtin">${
|
|
1360
|
+
o += `<span class="hl-builtin">${k(u)}</span>`;
|
|
1361
1361
|
else {
|
|
1362
|
-
let
|
|
1363
|
-
for (;
|
|
1364
|
-
n[
|
|
1362
|
+
let h = d;
|
|
1363
|
+
for (; h < i && (n[h] === " " || n[h] === " "); ) h++;
|
|
1364
|
+
n[h] === "(" ? o += `<span class="hl-fn">${k(u)}</span>` : o += k(u);
|
|
1365
1365
|
}
|
|
1366
1366
|
l = d;
|
|
1367
1367
|
continue;
|
|
1368
1368
|
}
|
|
1369
|
-
o +=
|
|
1369
|
+
o += k(c), l++;
|
|
1370
1370
|
}
|
|
1371
1371
|
return o;
|
|
1372
1372
|
}
|
|
1373
|
-
const
|
|
1374
|
-
function
|
|
1373
|
+
const Ct = /^(0[xX][0-9a-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|[0-9][0-9_]*(?:\.[0-9_]+)?(?:[eE][-+]?[0-9_]+)?)[a-zA-Z]*/;
|
|
1374
|
+
function xt(n) {
|
|
1375
1375
|
let e = "", t = 0;
|
|
1376
1376
|
const o = n.length;
|
|
1377
1377
|
for (; t < o; ) {
|
|
1378
1378
|
if (n.startsWith("<!--", t)) {
|
|
1379
1379
|
const l = n.indexOf("-->", t + 4), i = l === -1 ? o : l + 3;
|
|
1380
|
-
e += `<span class="hl-comment">${
|
|
1380
|
+
e += `<span class="hl-comment">${k(n.slice(t, i))}</span>`, t = i;
|
|
1381
1381
|
continue;
|
|
1382
1382
|
}
|
|
1383
1383
|
if (n[t] === "<") {
|
|
1384
1384
|
const l = n.indexOf(">", t);
|
|
1385
1385
|
if (l === -1) {
|
|
1386
|
-
e +=
|
|
1386
|
+
e += k(n.slice(t));
|
|
1387
1387
|
break;
|
|
1388
1388
|
}
|
|
1389
1389
|
const i = n.slice(t, l + 1);
|
|
1390
|
-
e +=
|
|
1390
|
+
e += Et(i), t = l + 1;
|
|
1391
1391
|
continue;
|
|
1392
1392
|
}
|
|
1393
|
-
e +=
|
|
1393
|
+
e += k(n[t] ?? ""), t++;
|
|
1394
1394
|
}
|
|
1395
1395
|
return e;
|
|
1396
1396
|
}
|
|
1397
|
-
function
|
|
1397
|
+
function Et(n) {
|
|
1398
1398
|
const e = n.slice(1, -1);
|
|
1399
1399
|
let t = '<span class="hl-punct"><</span>';
|
|
1400
1400
|
const o = /^\/?[a-zA-Z][a-zA-Z0-9-]*/.exec(e);
|
|
1401
1401
|
if (o) {
|
|
1402
|
-
t += `<span class="hl-tag">${
|
|
1402
|
+
t += `<span class="hl-tag">${k(o[0])}</span>`;
|
|
1403
1403
|
let l = e.slice(o[0].length);
|
|
1404
1404
|
const i = /\s+([a-zA-Z_:][a-zA-Z0-9_:.-]*)(\s*=\s*("([^"]*)"|'([^']*)'|([^\s>]+)))?/g;
|
|
1405
1405
|
let r = 0, s;
|
|
1406
1406
|
for (; s = i.exec(l); ) {
|
|
1407
|
-
t +=
|
|
1408
|
-
const
|
|
1409
|
-
if (
|
|
1410
|
-
const
|
|
1411
|
-
t +=
|
|
1412
|
-
const d =
|
|
1413
|
-
t += `<span class="hl-string">${
|
|
1407
|
+
t += k(l.slice(r, s.index)), t += k(l.slice(s.index, s.index + s[0].indexOf(s[1] ?? ""))), t += `<span class="hl-attr">${k(s[1] ?? "")}</span>`;
|
|
1408
|
+
const a = l.slice(s.index + (s[0].indexOf(s[1] ?? "") + (s[1] ?? "").length), s.index + s[0].length);
|
|
1409
|
+
if (a.includes("=")) {
|
|
1410
|
+
const c = a.indexOf("=");
|
|
1411
|
+
t += k(a.slice(0, c + 1));
|
|
1412
|
+
const d = a.slice(c + 1);
|
|
1413
|
+
t += `<span class="hl-string">${k(d)}</span>`;
|
|
1414
1414
|
}
|
|
1415
1415
|
r = s.index + s[0].length;
|
|
1416
1416
|
}
|
|
1417
|
-
t +=
|
|
1417
|
+
t += k(l.slice(r));
|
|
1418
1418
|
} else
|
|
1419
|
-
t +=
|
|
1419
|
+
t += k(e);
|
|
1420
1420
|
return t += '<span class="hl-punct">></span>', t;
|
|
1421
1421
|
}
|
|
1422
|
-
function
|
|
1422
|
+
function Lt(n) {
|
|
1423
1423
|
let e = "", t = 0;
|
|
1424
1424
|
const o = n.length;
|
|
1425
1425
|
let l = !1;
|
|
1426
1426
|
for (; t < o; ) {
|
|
1427
1427
|
if (n.startsWith("/*", t)) {
|
|
1428
1428
|
const r = n.indexOf("*/", t + 2), s = r === -1 ? o : r + 2;
|
|
1429
|
-
e += `<span class="hl-comment">${
|
|
1429
|
+
e += `<span class="hl-comment">${k(n.slice(t, s))}</span>`, t = s;
|
|
1430
1430
|
continue;
|
|
1431
1431
|
}
|
|
1432
1432
|
const i = n[t] ?? "";
|
|
1433
1433
|
if (i === "{") {
|
|
1434
|
-
l = !0, e +=
|
|
1434
|
+
l = !0, e += k(i), t++;
|
|
1435
1435
|
continue;
|
|
1436
1436
|
}
|
|
1437
1437
|
if (i === "}") {
|
|
1438
|
-
l = !1, e +=
|
|
1438
|
+
l = !1, e += k(i), t++;
|
|
1439
1439
|
continue;
|
|
1440
1440
|
}
|
|
1441
1441
|
if (i === '"' || i === "'") {
|
|
@@ -1443,7 +1443,7 @@ function Et(n) {
|
|
|
1443
1443
|
let s = t + 1;
|
|
1444
1444
|
for (; s < o && n[s] !== r; )
|
|
1445
1445
|
n[s] === "\\" ? s += 2 : s++;
|
|
1446
|
-
s = Math.min(s + 1, o), e += `<span class="hl-string">${
|
|
1446
|
+
s = Math.min(s + 1, o), e += `<span class="hl-string">${k(n.slice(t, s))}</span>`, t = s;
|
|
1447
1447
|
continue;
|
|
1448
1448
|
}
|
|
1449
1449
|
if (/[a-zA-Z_-]/.test(i) || i === "@" || i === "#" || i === "." || i === ":") {
|
|
@@ -1451,51 +1451,51 @@ function Et(n) {
|
|
|
1451
1451
|
for (; r < o && /[a-zA-Z0-9_-]/.test(n[r] ?? ""); ) r++;
|
|
1452
1452
|
const s = n.slice(t, r);
|
|
1453
1453
|
if (i === "@")
|
|
1454
|
-
e += `<span class="hl-keyword">${
|
|
1454
|
+
e += `<span class="hl-keyword">${k(s)}</span>`;
|
|
1455
1455
|
else if (l && /^[a-zA-Z-]+$/.test(s)) {
|
|
1456
|
-
let
|
|
1457
|
-
for (;
|
|
1458
|
-
n[
|
|
1456
|
+
let a = r;
|
|
1457
|
+
for (; a < o && (n[a] === " " || n[a] === " "); ) a++;
|
|
1458
|
+
n[a] === ":" ? e += `<span class="hl-prop">${k(s)}</span>` : e += k(s);
|
|
1459
1459
|
} else
|
|
1460
|
-
e += `<span class="hl-tag">${
|
|
1460
|
+
e += `<span class="hl-tag">${k(s)}</span>`;
|
|
1461
1461
|
t = r;
|
|
1462
1462
|
continue;
|
|
1463
1463
|
}
|
|
1464
1464
|
if (/[0-9]/.test(i)) {
|
|
1465
1465
|
const r = /^[0-9.]+(px|em|rem|%|vh|vw|s|ms|deg|fr)?/.exec(n.slice(t));
|
|
1466
1466
|
if (r) {
|
|
1467
|
-
e += `<span class="hl-number">${
|
|
1467
|
+
e += `<span class="hl-number">${k(r[0])}</span>`, t += r[0].length;
|
|
1468
1468
|
continue;
|
|
1469
1469
|
}
|
|
1470
1470
|
}
|
|
1471
|
-
e +=
|
|
1471
|
+
e += k(i), t++;
|
|
1472
1472
|
}
|
|
1473
1473
|
return e;
|
|
1474
1474
|
}
|
|
1475
|
-
function
|
|
1475
|
+
function At(n) {
|
|
1476
1476
|
return n.split(`
|
|
1477
|
-
`).map(
|
|
1477
|
+
`).map(St).join(`
|
|
1478
1478
|
`);
|
|
1479
1479
|
}
|
|
1480
|
-
function
|
|
1480
|
+
function St(n) {
|
|
1481
1481
|
const e = /^(#{1,6})\s+(.*)$/.exec(n);
|
|
1482
1482
|
if (e)
|
|
1483
|
-
return `<span class="hl-keyword">${
|
|
1483
|
+
return `<span class="hl-keyword">${k(e[1] ?? "")}</span> <span class="hl-tag">${ee(e[2] ?? "")}</span>`;
|
|
1484
1484
|
if (n.startsWith(">"))
|
|
1485
|
-
return `<span class="hl-comment">${
|
|
1485
|
+
return `<span class="hl-comment">${k(n)}</span>`;
|
|
1486
1486
|
if (n.startsWith("```"))
|
|
1487
|
-
return `<span class="hl-keyword">${
|
|
1487
|
+
return `<span class="hl-keyword">${k(n)}</span>`;
|
|
1488
1488
|
const t = /^(\s*)([-*+]|\d+\.)\s+(.*)$/.exec(n);
|
|
1489
|
-
return t ? `${t[1] ?? ""}<span class="hl-keyword">${
|
|
1489
|
+
return t ? `${t[1] ?? ""}<span class="hl-keyword">${k(t[2] ?? "")}</span> ${ee(t[3] ?? "")}` : ee(n);
|
|
1490
1490
|
}
|
|
1491
1491
|
function ee(n) {
|
|
1492
|
-
let e =
|
|
1492
|
+
let e = k(n);
|
|
1493
1493
|
return e = e.replace(/\*\*([^*]+)\*\*/g, '<span class="hl-keyword">**$1**</span>'), e = e.replace(new RegExp("(?<!\\*)\\*([^*]+)\\*(?!\\*)", "g"), '<span class="hl-string">*$1*</span>'), e = e.replace(/`([^`]+)`/g, '<span class="hl-builtin">`$1`</span>'), e = e.replace(
|
|
1494
1494
|
/\[([^\]]+)\]\(([^)]+)\)/g,
|
|
1495
1495
|
'<span class="hl-tag">[$1]</span><span class="hl-string">($2)</span>'
|
|
1496
1496
|
), e;
|
|
1497
1497
|
}
|
|
1498
|
-
function
|
|
1498
|
+
function k(n) {
|
|
1499
1499
|
return n.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
1500
1500
|
}
|
|
1501
1501
|
function S(n) {
|
|
@@ -1520,7 +1520,7 @@ const ae = [
|
|
|
1520
1520
|
"#1098ad"
|
|
1521
1521
|
];
|
|
1522
1522
|
function te(n, e, t = []) {
|
|
1523
|
-
|
|
1523
|
+
D();
|
|
1524
1524
|
const o = document.createElement("div");
|
|
1525
1525
|
o.className = "aw-popover aw-color-popover", o.dataset.popover = "true", S(o);
|
|
1526
1526
|
const l = (d) => {
|
|
@@ -1539,14 +1539,14 @@ function te(n, e, t = []) {
|
|
|
1539
1539
|
s.type = "button", s.className = "aw-popover-action", s.textContent = "기본색", S(s), s.addEventListener("click", (d) => {
|
|
1540
1540
|
d.stopPropagation(), l(null);
|
|
1541
1541
|
});
|
|
1542
|
-
const
|
|
1543
|
-
|
|
1544
|
-
const
|
|
1545
|
-
if (
|
|
1546
|
-
l(
|
|
1547
|
-
}),
|
|
1548
|
-
d.stopPropagation(),
|
|
1549
|
-
}), o.appendChild(s), o.appendChild(
|
|
1542
|
+
const a = document.createElement("button");
|
|
1543
|
+
a.type = "button", a.className = "aw-popover-action", a.textContent = "사용자 지정", S(a);
|
|
1544
|
+
const c = document.createElement("input");
|
|
1545
|
+
if (c.type = "color", c.tabIndex = -1, c.setAttribute("aria-hidden", "true"), c.style.position = "absolute", c.style.left = "-9999px", c.style.width = "0", c.style.height = "0", c.style.opacity = "0", c.style.pointerEvents = "none", c.addEventListener("change", () => {
|
|
1546
|
+
l(c.value);
|
|
1547
|
+
}), a.addEventListener("click", (d) => {
|
|
1548
|
+
d.stopPropagation(), c.click();
|
|
1549
|
+
}), o.appendChild(s), o.appendChild(a), o.appendChild(c), t.length > 0) {
|
|
1550
1550
|
const d = document.createElement("div");
|
|
1551
1551
|
d.className = "aw-color-section", d.textContent = "최근 사용", o.appendChild(d);
|
|
1552
1552
|
const u = document.createElement("div");
|
|
@@ -1557,7 +1557,7 @@ function te(n, e, t = []) {
|
|
|
1557
1557
|
}
|
|
1558
1558
|
I(o, n);
|
|
1559
1559
|
}
|
|
1560
|
-
const
|
|
1560
|
+
const Tt = [
|
|
1561
1561
|
{ label: "본문", kind: "paragraph", attrs: {}, glyph: "¶" },
|
|
1562
1562
|
{ label: "제목 1", kind: "heading", attrs: { level: 1 }, glyph: "H1", weight: "700" },
|
|
1563
1563
|
{ label: "제목 2", kind: "heading", attrs: { level: 2 }, glyph: "H2", weight: "700" },
|
|
@@ -1654,11 +1654,11 @@ const St = [
|
|
|
1654
1654
|
glyphIsSvg: !0
|
|
1655
1655
|
}
|
|
1656
1656
|
];
|
|
1657
|
-
function
|
|
1658
|
-
|
|
1657
|
+
function Nt(n, e) {
|
|
1658
|
+
D();
|
|
1659
1659
|
const t = document.createElement("div");
|
|
1660
1660
|
t.className = "aw-popover aw-block-type-popover", t.dataset.popover = "true", S(t);
|
|
1661
|
-
for (const o of
|
|
1661
|
+
for (const o of Tt) {
|
|
1662
1662
|
if (o.divider) {
|
|
1663
1663
|
const s = document.createElement("div");
|
|
1664
1664
|
s.className = "aw-popover-divider", t.appendChild(s);
|
|
@@ -1674,8 +1674,8 @@ function Tt(n, e) {
|
|
|
1674
1674
|
}
|
|
1675
1675
|
I(t, n);
|
|
1676
1676
|
}
|
|
1677
|
-
function
|
|
1678
|
-
|
|
1677
|
+
function Mt(n, e) {
|
|
1678
|
+
D();
|
|
1679
1679
|
const t = document.createElement("div");
|
|
1680
1680
|
t.className = "aw-popover aw-align-popover", t.dataset.popover = "true", S(t);
|
|
1681
1681
|
const o = [
|
|
@@ -1692,8 +1692,8 @@ function Nt(n, e) {
|
|
|
1692
1692
|
}
|
|
1693
1693
|
I(t, n);
|
|
1694
1694
|
}
|
|
1695
|
-
function
|
|
1696
|
-
|
|
1695
|
+
function Bt(n, e, t) {
|
|
1696
|
+
it(), D();
|
|
1697
1697
|
const o = document.createElement("div");
|
|
1698
1698
|
o.className = "aw-popover aw-font-family-popover", o.dataset.popover = "true", S(o);
|
|
1699
1699
|
for (const l of W) {
|
|
@@ -1702,17 +1702,17 @@ function Mt(n, e, t) {
|
|
|
1702
1702
|
const r = document.createElement("span");
|
|
1703
1703
|
r.className = "aw-font-family-name", r.textContent = l.label;
|
|
1704
1704
|
const s = document.createElement("span");
|
|
1705
|
-
s.className = "aw-font-family-preview", s.textContent = "가A", s.style.fontFamily = l.stack, i.appendChild(r), i.appendChild(s), S(i), i.addEventListener("click", (
|
|
1706
|
-
|
|
1705
|
+
s.className = "aw-font-family-preview", s.textContent = "가A", s.style.fontFamily = l.stack, i.appendChild(r), i.appendChild(s), S(i), i.addEventListener("click", (a) => {
|
|
1706
|
+
a.stopPropagation(), o.remove(), e({ id: l.id, label: l.label, stack: l.stack });
|
|
1707
1707
|
}), o.appendChild(i);
|
|
1708
1708
|
}
|
|
1709
1709
|
I(o, n);
|
|
1710
1710
|
}
|
|
1711
|
-
function
|
|
1712
|
-
|
|
1711
|
+
function $t(n, e, t) {
|
|
1712
|
+
D();
|
|
1713
1713
|
const o = document.createElement("div");
|
|
1714
1714
|
o.className = "aw-popover aw-code-lang-popover", o.dataset.popover = "true", S(o);
|
|
1715
|
-
for (const l of
|
|
1715
|
+
for (const l of Be) {
|
|
1716
1716
|
const i = document.createElement("button");
|
|
1717
1717
|
i.type = "button", i.className = "aw-popover-item aw-code-lang-item", t === l.id && i.classList.add("aw-popover-item-active"), i.title = l.label;
|
|
1718
1718
|
const r = document.createElement("span");
|
|
@@ -1722,7 +1722,7 @@ function Bt(n, e, t) {
|
|
|
1722
1722
|
}
|
|
1723
1723
|
I(o, n);
|
|
1724
1724
|
}
|
|
1725
|
-
const
|
|
1725
|
+
const zt = [
|
|
1726
1726
|
{ action: "rowAbove", label: "위에 행 추가" },
|
|
1727
1727
|
{ action: "rowBelow", label: "아래에 행 추가" },
|
|
1728
1728
|
{ action: "colLeft", label: "왼쪽에 열 추가", divider: !0 },
|
|
@@ -1731,10 +1731,10 @@ const $t = [
|
|
|
1731
1731
|
{ action: "deleteCol", label: "열 삭제" }
|
|
1732
1732
|
];
|
|
1733
1733
|
function Rt(n, e) {
|
|
1734
|
-
|
|
1734
|
+
D();
|
|
1735
1735
|
const t = document.createElement("div");
|
|
1736
1736
|
t.className = "aw-popover aw-table-menu-popover", t.dataset.popover = "true", S(t);
|
|
1737
|
-
for (const o of
|
|
1737
|
+
for (const o of zt) {
|
|
1738
1738
|
if (o.divider) {
|
|
1739
1739
|
const i = document.createElement("div");
|
|
1740
1740
|
i.className = "aw-popover-divider", t.appendChild(i);
|
|
@@ -1747,10 +1747,10 @@ function Rt(n, e) {
|
|
|
1747
1747
|
I(t, n);
|
|
1748
1748
|
}
|
|
1749
1749
|
function It(n, e, t) {
|
|
1750
|
-
|
|
1750
|
+
D();
|
|
1751
1751
|
const o = document.createElement("div");
|
|
1752
1752
|
o.className = "aw-popover aw-font-size-popover", o.dataset.popover = "true", S(o);
|
|
1753
|
-
for (const l of
|
|
1753
|
+
for (const l of ot) {
|
|
1754
1754
|
const i = document.createElement("button");
|
|
1755
1755
|
i.type = "button", i.className = "aw-popover-item aw-font-size-item", t === l && i.classList.add("aw-popover-item-active"), i.title = `${l}px`;
|
|
1756
1756
|
const r = document.createElement("span");
|
|
@@ -1760,174 +1760,332 @@ function It(n, e, t) {
|
|
|
1760
1760
|
}
|
|
1761
1761
|
I(o, n);
|
|
1762
1762
|
}
|
|
1763
|
-
function
|
|
1764
|
-
|
|
1763
|
+
function Dt(n, e) {
|
|
1764
|
+
D();
|
|
1765
1765
|
const t = 2, o = 12, l = document.createElement("div");
|
|
1766
1766
|
l.className = "aw-popover aw-table-popover", l.dataset.popover = "true";
|
|
1767
1767
|
const i = document.createElement("div");
|
|
1768
1768
|
i.className = "aw-table-picker-grid";
|
|
1769
1769
|
const r = document.createElement("div");
|
|
1770
1770
|
r.className = "aw-table-status";
|
|
1771
|
-
let s = t,
|
|
1771
|
+
let s = t, a = t, c = 0, d = 0;
|
|
1772
1772
|
const u = [];
|
|
1773
1773
|
function m() {
|
|
1774
|
-
for (let
|
|
1775
|
-
const
|
|
1776
|
-
if (
|
|
1777
|
-
for (let
|
|
1778
|
-
const
|
|
1779
|
-
|
|
1774
|
+
for (let p = 0; p < u.length; p++) {
|
|
1775
|
+
const g = u[p];
|
|
1776
|
+
if (g)
|
|
1777
|
+
for (let b = 0; b < g.length; b++) {
|
|
1778
|
+
const v = g[b];
|
|
1779
|
+
v && v.classList.toggle("aw-table-cell-active", p < c && b < d);
|
|
1780
1780
|
}
|
|
1781
1781
|
}
|
|
1782
|
-
r.textContent =
|
|
1783
|
-
}
|
|
1784
|
-
function
|
|
1785
|
-
i.innerHTML = "", i.style.gridTemplateColumns = `repeat(${
|
|
1786
|
-
for (let
|
|
1787
|
-
const
|
|
1788
|
-
for (let
|
|
1789
|
-
const
|
|
1790
|
-
|
|
1782
|
+
r.textContent = c > 0 && d > 0 ? `${c} × ${d} 표` : "크기를 선택하세요";
|
|
1783
|
+
}
|
|
1784
|
+
function h() {
|
|
1785
|
+
i.innerHTML = "", i.style.gridTemplateColumns = `repeat(${a}, 18px)`, i.style.gridTemplateRows = `repeat(${s}, 18px)`, u.length = 0;
|
|
1786
|
+
for (let p = 0; p < s; p++) {
|
|
1787
|
+
const g = [];
|
|
1788
|
+
for (let b = 0; b < a; b++) {
|
|
1789
|
+
const v = document.createElement("div");
|
|
1790
|
+
v.className = "aw-table-cell", v.dataset.row = String(p + 1), v.dataset.col = String(b + 1), i.appendChild(v), g.push(v);
|
|
1791
1791
|
}
|
|
1792
|
-
u.push(
|
|
1792
|
+
u.push(g);
|
|
1793
1793
|
}
|
|
1794
1794
|
m();
|
|
1795
1795
|
}
|
|
1796
|
-
|
|
1797
|
-
const
|
|
1798
|
-
if (!
|
|
1799
|
-
const
|
|
1800
|
-
|
|
1796
|
+
h(), i.addEventListener("mousemove", (p) => {
|
|
1797
|
+
const g = p.target;
|
|
1798
|
+
if (!g.classList.contains("aw-table-cell")) return;
|
|
1799
|
+
const b = parseInt(g.dataset.row ?? "0", 10), v = parseInt(g.dataset.col ?? "0", 10);
|
|
1800
|
+
c = b, d = v;
|
|
1801
1801
|
let T = !1;
|
|
1802
|
-
|
|
1803
|
-
}), i.addEventListener("click", (
|
|
1804
|
-
const
|
|
1805
|
-
if (!
|
|
1806
|
-
const
|
|
1807
|
-
|
|
1802
|
+
b >= s && s < o && (s = Math.min(o, b + 1), T = !0), v >= a && a < o && (a = Math.min(o, v + 1), T = !0), T ? h() : m();
|
|
1803
|
+
}), i.addEventListener("click", (p) => {
|
|
1804
|
+
const g = p.target;
|
|
1805
|
+
if (!g.classList.contains("aw-table-cell")) return;
|
|
1806
|
+
const b = parseInt(g.dataset.row ?? "0", 10), v = parseInt(g.dataset.col ?? "0", 10);
|
|
1807
|
+
b > 0 && v > 0 && (e({ rows: b, cols: v }), l.remove());
|
|
1808
1808
|
});
|
|
1809
|
-
function p
|
|
1810
|
-
|
|
1809
|
+
function f(p) {
|
|
1810
|
+
p.key === "Escape" && (l.remove(), document.removeEventListener("keydown", f));
|
|
1811
1811
|
}
|
|
1812
|
-
document.addEventListener("keydown",
|
|
1812
|
+
document.addEventListener("keydown", f), l.appendChild(i), l.appendChild(r), I(l, n);
|
|
1813
1813
|
}
|
|
1814
1814
|
function I(n, e) {
|
|
1815
1815
|
const t = e.closest(".aeriz-wysiwyg"), o = t == null ? void 0 : t.dataset.theme;
|
|
1816
1816
|
o && (n.dataset.theme = o), n.style.position = "fixed";
|
|
1817
1817
|
const l = () => {
|
|
1818
|
-
const
|
|
1819
|
-
n.style.top = `${
|
|
1818
|
+
const c = e.getBoundingClientRect();
|
|
1819
|
+
n.style.top = `${c.bottom + 4}px`, n.style.left = `${c.left}px`;
|
|
1820
1820
|
};
|
|
1821
1821
|
l(), document.body.appendChild(n);
|
|
1822
1822
|
const i = () => l(), r = () => l();
|
|
1823
1823
|
window.addEventListener("scroll", i, !0), window.addEventListener("resize", r);
|
|
1824
|
-
function s(
|
|
1825
|
-
!n.contains(
|
|
1824
|
+
function s(c) {
|
|
1825
|
+
!n.contains(c.target) && !e.contains(c.target) && n.remove();
|
|
1826
1826
|
}
|
|
1827
1827
|
setTimeout(() => {
|
|
1828
1828
|
document.addEventListener("click", s);
|
|
1829
1829
|
}, 0);
|
|
1830
|
-
const
|
|
1830
|
+
const a = n.remove.bind(n);
|
|
1831
1831
|
n.remove = function() {
|
|
1832
|
-
window.removeEventListener("scroll", i, !0), window.removeEventListener("resize", r), document.removeEventListener("click", s),
|
|
1832
|
+
window.removeEventListener("scroll", i, !0), window.removeEventListener("resize", r), document.removeEventListener("click", s), a();
|
|
1833
1833
|
};
|
|
1834
1834
|
}
|
|
1835
|
-
function
|
|
1835
|
+
function D() {
|
|
1836
1836
|
document.querySelectorAll('[data-popover="true"]').forEach((n) => n.remove());
|
|
1837
1837
|
}
|
|
1838
|
-
const Ht = ["script", "noscript", "meta", "link", "style", "base"]
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1838
|
+
const Ht = ["script", "noscript", "meta", "link", "style", "base"], Ft = /* @__PURE__ */ new Set([
|
|
1839
|
+
// CSS 2.1
|
|
1840
|
+
"border-collapse",
|
|
1841
|
+
"border-spacing",
|
|
1842
|
+
"caption-side",
|
|
1843
|
+
"color",
|
|
1844
|
+
"cursor",
|
|
1845
|
+
"direction",
|
|
1846
|
+
"empty-cells",
|
|
1847
|
+
"font-family",
|
|
1848
|
+
"font-size",
|
|
1849
|
+
"font-style",
|
|
1850
|
+
"font-variant",
|
|
1851
|
+
"font-weight",
|
|
1852
|
+
"letter-spacing",
|
|
1853
|
+
"line-height",
|
|
1854
|
+
"list-style",
|
|
1855
|
+
"list-style-image",
|
|
1856
|
+
"list-style-position",
|
|
1857
|
+
"list-style-type",
|
|
1858
|
+
"orphans",
|
|
1859
|
+
"quotes",
|
|
1860
|
+
"text-align",
|
|
1861
|
+
"text-indent",
|
|
1862
|
+
"text-transform",
|
|
1863
|
+
"visibility",
|
|
1864
|
+
"white-space",
|
|
1865
|
+
"widows",
|
|
1866
|
+
"word-spacing",
|
|
1867
|
+
// CSS 3+
|
|
1868
|
+
"caret-color",
|
|
1869
|
+
"font",
|
|
1870
|
+
"font-feature-settings",
|
|
1871
|
+
"font-kerning",
|
|
1872
|
+
"font-language-override",
|
|
1873
|
+
"font-optical-sizing",
|
|
1874
|
+
"font-palette",
|
|
1875
|
+
"font-size-adjust",
|
|
1876
|
+
"font-stretch",
|
|
1877
|
+
"font-synthesis",
|
|
1878
|
+
"font-synthesis-weight",
|
|
1879
|
+
"font-synthesis-style",
|
|
1880
|
+
"font-synthesis-small-caps",
|
|
1881
|
+
"font-variant-alternates",
|
|
1882
|
+
"font-variant-caps",
|
|
1883
|
+
"font-variant-east-asian",
|
|
1884
|
+
"font-variant-emoji",
|
|
1885
|
+
"font-variant-ligatures",
|
|
1886
|
+
"font-variant-numeric",
|
|
1887
|
+
"font-variant-position",
|
|
1888
|
+
"font-variation-settings",
|
|
1889
|
+
"hanging-punctuation",
|
|
1890
|
+
"hyphens",
|
|
1891
|
+
"image-rendering",
|
|
1892
|
+
"line-break",
|
|
1893
|
+
"overflow-wrap",
|
|
1894
|
+
"pointer-events",
|
|
1895
|
+
"ruby-align",
|
|
1896
|
+
"ruby-position",
|
|
1897
|
+
"tab-size",
|
|
1898
|
+
"text-align-last",
|
|
1899
|
+
"text-combine-upright",
|
|
1900
|
+
"text-decoration-color",
|
|
1901
|
+
"text-emphasis",
|
|
1902
|
+
"text-emphasis-color",
|
|
1903
|
+
"text-emphasis-position",
|
|
1904
|
+
"text-emphasis-style",
|
|
1905
|
+
"text-justify",
|
|
1906
|
+
"text-orientation",
|
|
1907
|
+
"text-rendering",
|
|
1908
|
+
"text-shadow",
|
|
1909
|
+
"text-size-adjust",
|
|
1910
|
+
"text-underline-offset",
|
|
1911
|
+
"text-underline-position",
|
|
1912
|
+
"white-space-collapse",
|
|
1913
|
+
"word-break",
|
|
1914
|
+
"word-wrap",
|
|
1915
|
+
"writing-mode",
|
|
1916
|
+
"color-scheme",
|
|
1917
|
+
"print-color-adjust",
|
|
1918
|
+
// Vendor
|
|
1919
|
+
"-webkit-font-smoothing",
|
|
1920
|
+
"-moz-osx-font-smoothing",
|
|
1921
|
+
"-webkit-locale",
|
|
1922
|
+
"-webkit-text-fill-color",
|
|
1923
|
+
"-webkit-text-stroke",
|
|
1924
|
+
"-webkit-text-stroke-color",
|
|
1925
|
+
"-webkit-text-stroke-width",
|
|
1926
|
+
"-webkit-print-color-adjust",
|
|
1927
|
+
// SVG
|
|
1928
|
+
"clip-rule",
|
|
1929
|
+
"color-interpolation",
|
|
1930
|
+
"color-interpolation-filters",
|
|
1931
|
+
"color-rendering",
|
|
1932
|
+
"fill",
|
|
1933
|
+
"fill-opacity",
|
|
1934
|
+
"fill-rule",
|
|
1935
|
+
"marker",
|
|
1936
|
+
"marker-end",
|
|
1937
|
+
"marker-mid",
|
|
1938
|
+
"marker-start",
|
|
1939
|
+
"paint-order",
|
|
1940
|
+
"shape-rendering",
|
|
1941
|
+
"stroke",
|
|
1942
|
+
"stroke-dasharray",
|
|
1943
|
+
"stroke-dashoffset",
|
|
1944
|
+
"stroke-linecap",
|
|
1945
|
+
"stroke-linejoin",
|
|
1946
|
+
"stroke-miterlimit",
|
|
1947
|
+
"stroke-opacity",
|
|
1948
|
+
"stroke-width",
|
|
1949
|
+
"text-anchor"
|
|
1950
|
+
]);
|
|
1951
|
+
async function Pt(n, e = {}) {
|
|
1952
|
+
const t = e.settleMs ?? 1e3, o = e.timeoutMs ?? 3e4, l = e.width ?? 1024, i = e.mountTarget ?? null;
|
|
1953
|
+
return new Promise((r, s) => {
|
|
1954
|
+
const a = document.createElement("iframe");
|
|
1955
|
+
a.setAttribute("aria-hidden", "true"), a.setAttribute("tabindex", "-1"), a.style.position = "fixed", a.style.left = "-99999px", a.style.top = "0", a.style.width = `${l}px`, a.style.height = "768px", a.style.border = "0", a.style.opacity = "0", a.style.pointerEvents = "none";
|
|
1844
1956
|
let c = !1;
|
|
1845
|
-
const
|
|
1846
|
-
|
|
1847
|
-
}, d = (p) => {
|
|
1848
|
-
c || (c = !0, a(), r(p));
|
|
1957
|
+
const d = () => {
|
|
1958
|
+
a.parentNode && a.parentNode.removeChild(a);
|
|
1849
1959
|
}, u = (p) => {
|
|
1850
|
-
c || (c = !0,
|
|
1851
|
-
}, m =
|
|
1852
|
-
|
|
1960
|
+
c || (c = !0, d(), s(p));
|
|
1961
|
+
}, m = (p) => {
|
|
1962
|
+
c || (c = !0, d(), r(p));
|
|
1963
|
+
}, h = window.setTimeout(() => {
|
|
1964
|
+
u(new Error("HTML 로드 시간 초과"));
|
|
1853
1965
|
}, o), f = () => {
|
|
1854
|
-
var
|
|
1855
|
-
const p =
|
|
1966
|
+
var T;
|
|
1967
|
+
const p = a.contentDocument;
|
|
1856
1968
|
if (!p || !p.body || p.body.children.length === 0 && (p.body.textContent ?? "").trim() === "")
|
|
1857
1969
|
return;
|
|
1858
|
-
const
|
|
1859
|
-
(p.fonts && typeof ((
|
|
1860
|
-
const
|
|
1970
|
+
const g = a.contentWindow, b = (g == null ? void 0 : g.requestAnimationFrame) ?? window.requestAnimationFrame;
|
|
1971
|
+
(p.fonts && typeof ((T = p.fonts.ready) == null ? void 0 : T.then) == "function" ? p.fonts.ready : Promise.resolve()).then(() => {
|
|
1972
|
+
const C = () => {
|
|
1861
1973
|
window.setTimeout(() => {
|
|
1862
1974
|
if (!c)
|
|
1863
1975
|
try {
|
|
1864
|
-
const
|
|
1865
|
-
if (!
|
|
1866
|
-
window.clearTimeout(
|
|
1976
|
+
const L = a.contentWindow, A = a.contentDocument;
|
|
1977
|
+
if (!L || !A || !A.body) {
|
|
1978
|
+
window.clearTimeout(h), u(new Error("iframe document 접근 실패"));
|
|
1867
1979
|
return;
|
|
1868
1980
|
}
|
|
1869
|
-
const
|
|
1870
|
-
window.clearTimeout(
|
|
1871
|
-
} catch (
|
|
1872
|
-
window.clearTimeout(
|
|
1981
|
+
const M = qt(A.body, L, i);
|
|
1982
|
+
window.clearTimeout(h), m(M);
|
|
1983
|
+
} catch (L) {
|
|
1984
|
+
window.clearTimeout(h), u(L instanceof Error ? L : new Error(String(L)));
|
|
1873
1985
|
}
|
|
1874
1986
|
}, t);
|
|
1875
1987
|
};
|
|
1876
|
-
b(() => b(
|
|
1988
|
+
b(() => b(C));
|
|
1877
1989
|
});
|
|
1878
1990
|
};
|
|
1879
|
-
|
|
1991
|
+
a.addEventListener("load", f), a.srcdoc = n, document.body.appendChild(a);
|
|
1880
1992
|
});
|
|
1881
1993
|
}
|
|
1882
|
-
function
|
|
1883
|
-
var
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
const
|
|
1893
|
-
|
|
1994
|
+
function qt(n, e, t) {
|
|
1995
|
+
var r;
|
|
1996
|
+
const o = n.ownerDocument;
|
|
1997
|
+
if (!o) throw new Error("body has no ownerDocument");
|
|
1998
|
+
const l = document.createElement("div"), i = Ot(o, e, t);
|
|
1999
|
+
try {
|
|
2000
|
+
for (let a = 0; a < n.attributes.length; a++) {
|
|
2001
|
+
const c = n.attributes.item(a);
|
|
2002
|
+
c && c.name !== "style" && l.setAttribute(c.name, c.value);
|
|
2003
|
+
}
|
|
2004
|
+
const s = $e(n, null, "div", i.get, e);
|
|
2005
|
+
s.length > 0 && l.setAttribute("style", s);
|
|
2006
|
+
for (const a of Array.from(n.children)) {
|
|
2007
|
+
const c = document.importNode(a, !0);
|
|
2008
|
+
ze(a, c, n, i.get, e), l.appendChild(c);
|
|
2009
|
+
}
|
|
2010
|
+
} finally {
|
|
2011
|
+
i.cleanup();
|
|
1894
2012
|
}
|
|
1895
|
-
for (const
|
|
1896
|
-
for (const
|
|
1897
|
-
(
|
|
1898
|
-
return
|
|
2013
|
+
for (const s of Ht)
|
|
2014
|
+
for (const a of Array.from(l.querySelectorAll(s)))
|
|
2015
|
+
(r = a.parentNode) == null || r.removeChild(a);
|
|
2016
|
+
return l.style.width = "auto", l.style.maxWidth = "none", l.style.height = "auto", l.style.maxHeight = "none", l.setAttribute("data-imported-html", "true"), [l];
|
|
2017
|
+
}
|
|
2018
|
+
function Ot(n, e, t) {
|
|
2019
|
+
var d;
|
|
2020
|
+
let o, l, i;
|
|
2021
|
+
const r = ((d = t == null ? void 0 : t.ownerDocument) == null ? void 0 : d.defaultView) ?? null;
|
|
2022
|
+
if (t && r) {
|
|
2023
|
+
o = t.ownerDocument, l = r;
|
|
2024
|
+
const u = o.createElement("div");
|
|
2025
|
+
u.setAttribute("data-imported-html", "true"), u.setAttribute("aria-hidden", "true"), u.style.cssText = "position:absolute;left:-99999px;top:0;visibility:hidden;pointer-events:none;", t.appendChild(u), i = u;
|
|
2026
|
+
} else {
|
|
2027
|
+
o = n, l = e;
|
|
2028
|
+
const u = o.createElement("div");
|
|
2029
|
+
u.setAttribute("aria-hidden", "true"), u.style.cssText = "position:absolute;left:-99999px;top:0;width:0;height:0;overflow:hidden;visibility:hidden;", o.body.appendChild(u), i = u;
|
|
2030
|
+
}
|
|
2031
|
+
const s = /* @__PURE__ */ new Map();
|
|
2032
|
+
return { get: (u) => {
|
|
2033
|
+
const m = s.get(u);
|
|
2034
|
+
if (m) return m;
|
|
2035
|
+
const h = o.createElement(u);
|
|
2036
|
+
i.appendChild(h);
|
|
2037
|
+
const f = l.getComputedStyle(h), p = /* @__PURE__ */ new Map();
|
|
2038
|
+
for (let g = 0; g < f.length; g++) {
|
|
2039
|
+
const b = f.item(g);
|
|
2040
|
+
b && p.set(b, f.getPropertyValue(b));
|
|
2041
|
+
}
|
|
2042
|
+
return i.removeChild(h), s.set(u, p), p;
|
|
2043
|
+
}, cleanup: () => {
|
|
2044
|
+
i.parentNode && i.parentNode.removeChild(i);
|
|
2045
|
+
} };
|
|
1899
2046
|
}
|
|
1900
|
-
function
|
|
1901
|
-
const
|
|
1902
|
-
let
|
|
1903
|
-
for (let
|
|
1904
|
-
const
|
|
1905
|
-
if (!
|
|
1906
|
-
const
|
|
1907
|
-
|
|
2047
|
+
function $e(n, e, t, o, l) {
|
|
2048
|
+
const i = l.getComputedStyle(n), r = e ? l.getComputedStyle(e) : null, s = o(t);
|
|
2049
|
+
let a = "";
|
|
2050
|
+
for (let c = 0; c < i.length; c++) {
|
|
2051
|
+
const d = i.item(c);
|
|
2052
|
+
if (!d) continue;
|
|
2053
|
+
const u = i.getPropertyValue(d);
|
|
2054
|
+
if (u) {
|
|
2055
|
+
if (Ft.has(d)) {
|
|
2056
|
+
if (r && r.getPropertyValue(d) === u) continue;
|
|
2057
|
+
} else if (s.get(d) === u) continue;
|
|
2058
|
+
a += `${d}:${u};`;
|
|
2059
|
+
}
|
|
1908
2060
|
}
|
|
1909
|
-
return
|
|
2061
|
+
return a;
|
|
1910
2062
|
}
|
|
1911
|
-
function
|
|
2063
|
+
function ze(n, e, t, o, l) {
|
|
1912
2064
|
if (n.nodeType === 1 && e.nodeType === 1) {
|
|
1913
|
-
const
|
|
1914
|
-
|
|
2065
|
+
const a = $e(
|
|
2066
|
+
n,
|
|
2067
|
+
t,
|
|
2068
|
+
n.tagName.toLowerCase(),
|
|
2069
|
+
o,
|
|
2070
|
+
l
|
|
2071
|
+
);
|
|
2072
|
+
a.length > 0 ? e.setAttribute("style", a) : e.hasAttribute("style") && e.removeAttribute("style");
|
|
1915
2073
|
}
|
|
1916
|
-
const
|
|
1917
|
-
for (let
|
|
1918
|
-
const
|
|
1919
|
-
|
|
2074
|
+
const i = n.children, r = e.children, s = Math.min(i.length, r.length);
|
|
2075
|
+
for (let a = 0; a < s; a++) {
|
|
2076
|
+
const c = i[a], d = r[a];
|
|
2077
|
+
c && d && ze(c, d, n, o, l);
|
|
1920
2078
|
}
|
|
1921
2079
|
}
|
|
1922
|
-
function
|
|
1923
|
-
const e =
|
|
2080
|
+
function _t(n) {
|
|
2081
|
+
const e = jt(n), t = document.createElement("div");
|
|
1924
2082
|
t.innerHTML = e;
|
|
1925
2083
|
const o = [];
|
|
1926
2084
|
for (const l of Array.from(t.children))
|
|
1927
2085
|
l instanceof HTMLElement && o.push(l);
|
|
1928
2086
|
return o;
|
|
1929
2087
|
}
|
|
1930
|
-
function
|
|
2088
|
+
function jt(n) {
|
|
1931
2089
|
const t = n.replace(/\r\n?/g, `
|
|
1932
2090
|
`).replace(/\s+$/, "").split(`
|
|
1933
2091
|
`), o = [];
|
|
@@ -1940,11 +2098,11 @@ function qt(n) {
|
|
|
1940
2098
|
}
|
|
1941
2099
|
const r = /^```\s*([\w-]*)\s*$/.exec(i);
|
|
1942
2100
|
if (r) {
|
|
1943
|
-
const
|
|
2101
|
+
const c = r[1] ?? "", d = [];
|
|
1944
2102
|
for (l++; l < t.length && !/^```\s*$/.test(t[l] ?? ""); )
|
|
1945
2103
|
d.push(t[l] ?? ""), l++;
|
|
1946
2104
|
l < t.length && l++;
|
|
1947
|
-
const u =
|
|
2105
|
+
const u = c ? ` data-language="${j(c)}"` : "";
|
|
1948
2106
|
o.push(
|
|
1949
2107
|
`<pre><code${u}>${X(d.join(`
|
|
1950
2108
|
`))}</code></pre>`
|
|
@@ -1953,8 +2111,8 @@ function qt(n) {
|
|
|
1953
2111
|
}
|
|
1954
2112
|
const s = /^(#{1,6})\s+(.+?)\s*#*\s*$/.exec(i);
|
|
1955
2113
|
if (s) {
|
|
1956
|
-
const
|
|
1957
|
-
o.push(`<h${
|
|
2114
|
+
const c = (s[1] ?? "#").length;
|
|
2115
|
+
o.push(`<h${c}>${H(s[2] ?? "")}</h${c}>`), l++;
|
|
1958
2116
|
continue;
|
|
1959
2117
|
}
|
|
1960
2118
|
if (/^[\s]*([-*_])(\s*\1){2,}[\s]*$/.test(i)) {
|
|
@@ -1962,55 +2120,55 @@ function qt(n) {
|
|
|
1962
2120
|
continue;
|
|
1963
2121
|
}
|
|
1964
2122
|
if (Re(i, t[l + 1] ?? "")) {
|
|
1965
|
-
const
|
|
1966
|
-
for (l++,
|
|
1967
|
-
|
|
1968
|
-
o.push(
|
|
2123
|
+
const c = [i];
|
|
2124
|
+
for (l++, c.push(t[l] ?? ""), l++; l < t.length && (t[l] ?? "").includes("|") && (t[l] ?? "").trim() !== ""; )
|
|
2125
|
+
c.push(t[l] ?? ""), l++;
|
|
2126
|
+
o.push(Wt(c));
|
|
1969
2127
|
continue;
|
|
1970
2128
|
}
|
|
1971
2129
|
if (i.startsWith(">")) {
|
|
1972
|
-
const
|
|
2130
|
+
const c = [];
|
|
1973
2131
|
for (; l < t.length && (t[l] ?? "").startsWith(">"); )
|
|
1974
|
-
|
|
1975
|
-
const d =
|
|
2132
|
+
c.push((t[l] ?? "").replace(/^>\s?/, "")), l++;
|
|
2133
|
+
const d = H(c.join(" ").trim());
|
|
1976
2134
|
o.push(`<blockquote><p>${d}</p></blockquote>`);
|
|
1977
2135
|
continue;
|
|
1978
2136
|
}
|
|
1979
2137
|
if (/^[\s]*[-*+]\s+/.test(i)) {
|
|
1980
|
-
const
|
|
1981
|
-
l =
|
|
2138
|
+
const c = ye(t, l, /^[\s]*[-*+]\s+(.*)$/);
|
|
2139
|
+
l = c.next, o.push(`<ul>${c.html}</ul>`);
|
|
1982
2140
|
continue;
|
|
1983
2141
|
}
|
|
1984
2142
|
if (/^[\s]*\d+\.\s+/.test(i)) {
|
|
1985
|
-
const
|
|
1986
|
-
l =
|
|
2143
|
+
const c = ye(t, l, /^[\s]*\d+\.\s+(.*)$/);
|
|
2144
|
+
l = c.next, o.push(`<ol>${c.html}</ol>`);
|
|
1987
2145
|
continue;
|
|
1988
2146
|
}
|
|
1989
|
-
const
|
|
1990
|
-
for (; l < t.length && (t[l] ?? "").trim() !== "" && !
|
|
1991
|
-
|
|
1992
|
-
|
|
2147
|
+
const a = [];
|
|
2148
|
+
for (; l < t.length && (t[l] ?? "").trim() !== "" && !Ut(t[l] ?? "", t[l + 1] ?? ""); )
|
|
2149
|
+
a.push(t[l] ?? ""), l++;
|
|
2150
|
+
a.length > 0 && o.push(`<p>${H(Kt(a))}</p>`);
|
|
1993
2151
|
}
|
|
1994
2152
|
return o.join(`
|
|
1995
2153
|
`);
|
|
1996
2154
|
}
|
|
1997
|
-
function
|
|
2155
|
+
function Ut(n, e) {
|
|
1998
2156
|
return /^#{1,6}\s/.test(n) || /^[\s]*[-*+]\s+/.test(n) || /^[\s]*\d+\.\s+/.test(n) || n.startsWith(">") || /^```/.test(n) || /^[\s]*([-*_])(\s*\1){2,}[\s]*$/.test(n) || Re(n, e);
|
|
1999
2157
|
}
|
|
2000
2158
|
function Re(n, e) {
|
|
2001
2159
|
return n.includes("|") ? /^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)+\|?\s*$/.test(e) : !1;
|
|
2002
2160
|
}
|
|
2003
|
-
function
|
|
2161
|
+
function Wt(n) {
|
|
2004
2162
|
if (n.length < 2) return "";
|
|
2005
2163
|
const e = ne(n[0] ?? ""), o = ne(n[1] ?? "").map((s) => {
|
|
2006
|
-
const
|
|
2007
|
-
return
|
|
2008
|
-
}), l = n.slice(2).map(ne), i = e.map((s,
|
|
2009
|
-
const
|
|
2010
|
-
return `<th${
|
|
2011
|
-
}).join(""), r = l.map((s) => `<tr>${s.map((
|
|
2164
|
+
const a = s.trim(), c = a.startsWith(":"), d = a.endsWith(":");
|
|
2165
|
+
return c && d ? "center" : d ? "right" : c ? "left" : null;
|
|
2166
|
+
}), l = n.slice(2).map(ne), i = e.map((s, a) => {
|
|
2167
|
+
const c = o[a];
|
|
2168
|
+
return `<th${c ? ` style="text-align:${c}"` : ""}>${H(s.trim())}</th>`;
|
|
2169
|
+
}).join(""), r = l.map((s) => `<tr>${s.map((c, d) => {
|
|
2012
2170
|
const u = o[d];
|
|
2013
|
-
return `<td${u ? ` style="text-align:${u}"` : ""}>${
|
|
2171
|
+
return `<td${u ? ` style="text-align:${u}"` : ""}>${H(c.trim())}</td>`;
|
|
2014
2172
|
}).join("")}</tr>`).join("");
|
|
2015
2173
|
return `<table><thead><tr>${i}</tr></thead><tbody>${r}</tbody></table>`;
|
|
2016
2174
|
}
|
|
@@ -2032,11 +2190,11 @@ function ye(n, e, t) {
|
|
|
2032
2190
|
}
|
|
2033
2191
|
const r = t.exec(i);
|
|
2034
2192
|
if (!r) break;
|
|
2035
|
-
o.push(`<li>${
|
|
2193
|
+
o.push(`<li>${H(r[1] ?? "")}</li>`), l++;
|
|
2036
2194
|
}
|
|
2037
2195
|
return { html: o.join(""), next: l };
|
|
2038
2196
|
}
|
|
2039
|
-
function
|
|
2197
|
+
function Kt(n) {
|
|
2040
2198
|
const e = [];
|
|
2041
2199
|
for (let t = 0; t < n.length; t++) {
|
|
2042
2200
|
const o = n[t] ?? "", l = t === n.length - 1;
|
|
@@ -2046,7 +2204,7 @@ function jt(n) {
|
|
|
2046
2204
|
}
|
|
2047
2205
|
return e.join("");
|
|
2048
2206
|
}
|
|
2049
|
-
function
|
|
2207
|
+
function H(n) {
|
|
2050
2208
|
const e = [];
|
|
2051
2209
|
let t = n.replace(/(`+)([\s\S]+?)\1/g, (o, l, i) => `\0CODE${e.push(`<code>${X(i)}</code>`) - 1}\0`);
|
|
2052
2210
|
return t = X(t), t = t.replace(
|
|
@@ -2074,64 +2232,81 @@ const Q = [
|
|
|
2074
2232
|
"italic",
|
|
2075
2233
|
"underline",
|
|
2076
2234
|
"strike"
|
|
2077
|
-
],
|
|
2235
|
+
], Vt = {
|
|
2078
2236
|
kind: "paragraph",
|
|
2079
2237
|
label: "단락",
|
|
2080
2238
|
allowsInlineFormat: !0,
|
|
2081
2239
|
allowedMarks: Q,
|
|
2240
|
+
allowsColor: !0,
|
|
2241
|
+
allowsFontSize: !0,
|
|
2082
2242
|
matches: (n) => n.tagName === "P" ? { kind: "paragraph", attrs: {} } : null,
|
|
2083
2243
|
create: () => J(document.createElement("p")),
|
|
2084
2244
|
isEmpty: (n) => q(n)
|
|
2085
|
-
},
|
|
2245
|
+
}, Yt = {
|
|
2086
2246
|
kind: "heading",
|
|
2087
2247
|
label: "제목",
|
|
2088
2248
|
allowsInlineFormat: !0,
|
|
2089
2249
|
// 사용자 지정 — 제목은 italic 만 허용. (bold 는 heading 자체가 굵으므로
|
|
2090
2250
|
// 중복, underline / strike 는 가독성/시맨틱 면에서 부적합.)
|
|
2091
2251
|
allowedMarks: ["italic"],
|
|
2252
|
+
// 글자색/배경색은 시맨틱 헤딩 톤 보존을 위해 X.
|
|
2253
|
+
allowsColor: !1,
|
|
2254
|
+
// 글자 크기는 heading level (h1~h6) 로 결정되므로 X.
|
|
2255
|
+
allowsFontSize: !1,
|
|
2092
2256
|
matches: (n) => {
|
|
2093
2257
|
const e = /^H([1-6])$/.exec(n.tagName);
|
|
2094
2258
|
return e ? { kind: "heading", attrs: { level: Number(e[1]) } } : null;
|
|
2095
2259
|
},
|
|
2096
2260
|
create: (n) => {
|
|
2097
|
-
const e =
|
|
2261
|
+
const e = xn(n == null ? void 0 : n.level);
|
|
2098
2262
|
return J(document.createElement(`h${e}`));
|
|
2099
2263
|
},
|
|
2100
2264
|
isEmpty: (n) => q(n)
|
|
2101
|
-
},
|
|
2265
|
+
}, Gt = {
|
|
2102
2266
|
kind: "bulletList",
|
|
2103
2267
|
label: "글머리 목록",
|
|
2104
2268
|
allowsInlineFormat: !0,
|
|
2105
2269
|
allowedMarks: Q,
|
|
2270
|
+
allowsColor: !0,
|
|
2271
|
+
allowsFontSize: !0,
|
|
2106
2272
|
matches: (n) => n.tagName === "UL" ? { kind: "bulletList", attrs: {} } : null,
|
|
2107
|
-
create: () =>
|
|
2108
|
-
isEmpty: (n) =>
|
|
2109
|
-
},
|
|
2273
|
+
create: () => je("ul"),
|
|
2274
|
+
isEmpty: (n) => Ue(n)
|
|
2275
|
+
}, Zt = {
|
|
2110
2276
|
kind: "orderedList",
|
|
2111
2277
|
label: "번호 매기기 목록",
|
|
2112
2278
|
allowsInlineFormat: !0,
|
|
2113
2279
|
allowedMarks: Q,
|
|
2280
|
+
allowsColor: !0,
|
|
2281
|
+
allowsFontSize: !0,
|
|
2114
2282
|
matches: (n) => n.tagName === "OL" ? { kind: "orderedList", attrs: {} } : null,
|
|
2115
|
-
create: () =>
|
|
2116
|
-
isEmpty: (n) =>
|
|
2117
|
-
},
|
|
2283
|
+
create: () => je("ol"),
|
|
2284
|
+
isEmpty: (n) => Ue(n)
|
|
2285
|
+
}, Xt = {
|
|
2118
2286
|
kind: "blockquote",
|
|
2119
2287
|
label: "인용구",
|
|
2120
2288
|
allowsInlineFormat: !0,
|
|
2121
2289
|
// 사용자 지정 — 인용구는 italic 제외(인용 자체가 이미 italic 으로 렌더되어
|
|
2122
2290
|
// 중복). bold / underline / strike 만 허용.
|
|
2123
2291
|
allowedMarks: ["bold", "underline", "strike"],
|
|
2292
|
+
// 인용구 자체의 톤(이탤릭/주변 색조) 을 보존.
|
|
2293
|
+
allowsColor: !1,
|
|
2294
|
+
allowsFontSize: !0,
|
|
2124
2295
|
matches: (n) => n.tagName === "BLOCKQUOTE" ? { kind: "blockquote", attrs: {} } : null,
|
|
2125
2296
|
create: () => {
|
|
2126
2297
|
const n = document.createElement("blockquote");
|
|
2127
2298
|
return n.appendChild(J(document.createElement("p"))), n;
|
|
2128
2299
|
},
|
|
2129
2300
|
isEmpty: (n) => q(n)
|
|
2130
|
-
},
|
|
2301
|
+
}, Qt = {
|
|
2131
2302
|
kind: "codeBlock",
|
|
2132
2303
|
label: "코드 블록",
|
|
2133
2304
|
allowsInlineFormat: !1,
|
|
2134
2305
|
allowedMarks: [],
|
|
2306
|
+
// 코드 블록은 인라인 서식은 막혀 있지만 글자 크기 조정은 (가독성) 의미가
|
|
2307
|
+
// 있어 예외적으로 허용. 색은 syntax highlight 와 충돌하므로 X.
|
|
2308
|
+
allowsColor: !1,
|
|
2309
|
+
allowsFontSize: !0,
|
|
2135
2310
|
matches: (n) => {
|
|
2136
2311
|
if (n.tagName !== "PRE") return null;
|
|
2137
2312
|
const e = n.querySelector(":scope > code"), t = e == null ? void 0 : e.getAttribute("data-language");
|
|
@@ -2142,17 +2317,19 @@ const Q = [
|
|
|
2142
2317
|
return n != null && n.language && t.setAttribute("data-language", n.language), e.appendChild(t), e;
|
|
2143
2318
|
},
|
|
2144
2319
|
isEmpty: (n) => q(n)
|
|
2145
|
-
},
|
|
2320
|
+
}, Jt = {
|
|
2146
2321
|
kind: "image",
|
|
2147
2322
|
label: "이미지",
|
|
2148
2323
|
allowsInlineFormat: !1,
|
|
2149
2324
|
allowedMarks: [],
|
|
2325
|
+
allowsColor: !1,
|
|
2326
|
+
allowsFontSize: !1,
|
|
2150
2327
|
matches: (n) => {
|
|
2151
2328
|
if (n.tagName === "FIGURE") {
|
|
2152
|
-
const e = n.querySelector(":scope > img"), t =
|
|
2329
|
+
const e = n.querySelector(":scope > img"), t = xe(e), o = n.getAttribute("style");
|
|
2153
2330
|
return o && (t.wrapperStyle = o), { kind: "image", attrs: t };
|
|
2154
2331
|
}
|
|
2155
|
-
return n.tagName === "IMG" ? { kind: "image", attrs:
|
|
2332
|
+
return n.tagName === "IMG" ? { kind: "image", attrs: xe(n) } : null;
|
|
2156
2333
|
},
|
|
2157
2334
|
create: (n) => {
|
|
2158
2335
|
const e = document.createElement("figure");
|
|
@@ -2174,19 +2351,21 @@ function he() {
|
|
|
2174
2351
|
n.className = "aw-block-align-controls", n.setAttribute("contenteditable", "false"), n.setAttribute("aria-hidden", "true");
|
|
2175
2352
|
for (const e of ["left", "center", "right"]) {
|
|
2176
2353
|
const t = document.createElement("button");
|
|
2177
|
-
t.type = "button", t.className = "aw-block-align-btn", t.dataset.align = e, t.title = e === "left" ? "왼쪽 정렬" : e === "center" ? "가운데 정렬" : "오른쪽 정렬", t.setAttribute("aria-label", t.title), t.innerHTML =
|
|
2354
|
+
t.type = "button", t.className = "aw-block-align-btn", t.dataset.align = e, t.title = e === "left" ? "왼쪽 정렬" : e === "center" ? "가운데 정렬" : "오른쪽 정렬", t.setAttribute("aria-label", t.title), t.innerHTML = en[e], n.appendChild(t);
|
|
2178
2355
|
}
|
|
2179
2356
|
return n;
|
|
2180
2357
|
}
|
|
2181
|
-
const
|
|
2358
|
+
const en = {
|
|
2182
2359
|
left: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="17" y1="10" x2="3" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="17" y1="18" x2="3" y2="18"/></svg>',
|
|
2183
2360
|
center: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="10" x2="6" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="18" y1="18" x2="6" y2="18"/></svg>',
|
|
2184
2361
|
right: '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="21" y1="10" x2="7" y2="10"/><line x1="21" y1="6" x2="3" y2="6"/><line x1="21" y1="14" x2="3" y2="14"/><line x1="21" y1="18" x2="7" y2="18"/></svg>'
|
|
2185
|
-
},
|
|
2362
|
+
}, tn = {
|
|
2186
2363
|
kind: "table",
|
|
2187
2364
|
label: "표",
|
|
2188
2365
|
allowsInlineFormat: !0,
|
|
2189
2366
|
allowedMarks: Q,
|
|
2367
|
+
allowsColor: !0,
|
|
2368
|
+
allowsFontSize: !0,
|
|
2190
2369
|
matches: (n) => {
|
|
2191
2370
|
var l;
|
|
2192
2371
|
if (n.tagName !== "TABLE") return null;
|
|
@@ -2198,30 +2377,34 @@ const Xt = {
|
|
|
2198
2377
|
for (let i = 0; i < e; i++) {
|
|
2199
2378
|
const r = document.createElement("tr");
|
|
2200
2379
|
for (let s = 0; s < t; s++) {
|
|
2201
|
-
const
|
|
2202
|
-
|
|
2380
|
+
const a = document.createElement("td");
|
|
2381
|
+
a.appendChild(document.createElement("br")), r.appendChild(a);
|
|
2203
2382
|
}
|
|
2204
2383
|
l.appendChild(r);
|
|
2205
2384
|
}
|
|
2206
2385
|
return o.appendChild(l), o;
|
|
2207
2386
|
},
|
|
2208
2387
|
isEmpty: (n) => n.querySelectorAll(":scope tr").length === 0
|
|
2209
|
-
},
|
|
2388
|
+
}, nn = {
|
|
2210
2389
|
kind: "hr",
|
|
2211
2390
|
label: "구분선",
|
|
2212
2391
|
allowsInlineFormat: !1,
|
|
2213
2392
|
allowedMarks: [],
|
|
2393
|
+
allowsColor: !1,
|
|
2394
|
+
allowsFontSize: !1,
|
|
2214
2395
|
matches: (n) => n.tagName === "HR" ? { kind: "hr", attrs: {} } : null,
|
|
2215
2396
|
create: () => {
|
|
2216
2397
|
const n = document.createElement("hr");
|
|
2217
2398
|
return n.setAttribute("contenteditable", "false"), n;
|
|
2218
2399
|
},
|
|
2219
2400
|
isEmpty: () => !1
|
|
2220
|
-
},
|
|
2401
|
+
}, on = {
|
|
2221
2402
|
kind: "youtube",
|
|
2222
2403
|
label: "유튜브",
|
|
2223
2404
|
allowsInlineFormat: !1,
|
|
2224
2405
|
allowedMarks: [],
|
|
2406
|
+
allowsColor: !1,
|
|
2407
|
+
allowsFontSize: !1,
|
|
2225
2408
|
matches: (n) => {
|
|
2226
2409
|
if (n.tagName !== "DIV" || !n.classList.contains("aw-youtube-embed")) return null;
|
|
2227
2410
|
const e = n.getAttribute("data-youtube-id") ?? void 0, t = {};
|
|
@@ -2239,37 +2422,39 @@ const Xt = {
|
|
|
2239
2422
|
), o.setAttribute("allowfullscreen", ""), o.setAttribute("frameborder", "0"), o.setAttribute("referrerpolicy", "strict-origin-when-cross-origin"), t.appendChild(o), t.appendChild(he()), t.appendChild(pe()), t;
|
|
2240
2423
|
},
|
|
2241
2424
|
isEmpty: (n) => !n.getAttribute("data-youtube-id")
|
|
2242
|
-
},
|
|
2425
|
+
}, ln = {
|
|
2243
2426
|
kind: "linkCard",
|
|
2244
2427
|
label: "링크",
|
|
2245
2428
|
allowsInlineFormat: !1,
|
|
2246
2429
|
allowedMarks: [],
|
|
2430
|
+
allowsColor: !1,
|
|
2431
|
+
allowsFontSize: !1,
|
|
2247
2432
|
matches: (n) => {
|
|
2248
|
-
var s,
|
|
2433
|
+
var s, a, c, d, u;
|
|
2249
2434
|
if (n.tagName !== "A" || !n.classList.contains("aw-link-card")) return null;
|
|
2250
|
-
const e = n.getAttribute("href") ?? void 0, t = ((s = n.querySelector(":scope > .aw-link-card-body > .aw-link-card-title")) == null ? void 0 : s.textContent) ?? ((
|
|
2435
|
+
const e = n.getAttribute("href") ?? void 0, t = ((s = n.querySelector(":scope > .aw-link-card-body > .aw-link-card-title")) == null ? void 0 : s.textContent) ?? ((a = n.querySelector(":scope > .aw-link-card-text")) == null ? void 0 : a.textContent) ?? void 0, o = ((c = n.querySelector(":scope > .aw-link-card-body > .aw-link-card-desc")) == null ? void 0 : c.textContent) ?? void 0, l = ((d = n.querySelector(":scope > .aw-link-card-image")) == null ? void 0 : d.getAttribute("src")) ?? void 0, i = ((u = n.querySelector(":scope .aw-link-card-favicon")) == null ? void 0 : u.getAttribute("src")) ?? void 0, r = {};
|
|
2251
2436
|
return e && (r.href = e), t && (r.text = t), o && (r.description = o), l && (r.image = l), i && (r.favicon = i), { kind: "linkCard", attrs: r };
|
|
2252
2437
|
},
|
|
2253
2438
|
create: (n) => {
|
|
2254
|
-
const e = (n == null ? void 0 : n.href) ?? "#", t = n != null && n.text && n.text.length > 0 ? n.text : Ie(e) || e, o = (n == null ? void 0 : n.description) ?? "", l = (n == null ? void 0 : n.image) ?? "", i = (n == null ? void 0 : n.favicon) ??
|
|
2439
|
+
const e = (n == null ? void 0 : n.href) ?? "#", t = n != null && n.text && n.text.length > 0 ? n.text : Ie(e) || e, o = (n == null ? void 0 : n.description) ?? "", l = (n == null ? void 0 : n.image) ?? "", i = (n == null ? void 0 : n.favicon) ?? rn(e), r = document.createElement("a");
|
|
2255
2440
|
if (r.className = "aw-link-card", l && r.classList.add("aw-link-card-with-image"), r.href = e, r.target = "_blank", r.rel = "noopener", r.setAttribute("contenteditable", "false"), l) {
|
|
2256
2441
|
const u = document.createElement("img");
|
|
2257
2442
|
u.className = "aw-link-card-image", u.src = l, u.alt = "", u.loading = "lazy", r.appendChild(u);
|
|
2258
2443
|
}
|
|
2259
2444
|
const s = document.createElement("span");
|
|
2260
2445
|
s.className = "aw-link-card-body";
|
|
2261
|
-
const
|
|
2262
|
-
if (
|
|
2446
|
+
const a = document.createElement("span");
|
|
2447
|
+
if (a.className = "aw-link-card-title", a.textContent = t, s.appendChild(a), o) {
|
|
2263
2448
|
const u = document.createElement("span");
|
|
2264
2449
|
u.className = "aw-link-card-desc", u.textContent = o, s.appendChild(u);
|
|
2265
2450
|
}
|
|
2266
|
-
const
|
|
2267
|
-
if (
|
|
2451
|
+
const c = document.createElement("span");
|
|
2452
|
+
if (c.className = "aw-link-card-url", i) {
|
|
2268
2453
|
const u = document.createElement("img");
|
|
2269
|
-
u.className = "aw-link-card-favicon", u.src = i, u.alt = "", u.loading = "lazy",
|
|
2454
|
+
u.className = "aw-link-card-favicon", u.src = i, u.alt = "", u.loading = "lazy", c.appendChild(u);
|
|
2270
2455
|
}
|
|
2271
2456
|
const d = document.createElement("span");
|
|
2272
|
-
return d.className = "aw-link-card-url-text", d.textContent = e,
|
|
2457
|
+
return d.className = "aw-link-card-url-text", d.textContent = e, c.appendChild(d), s.appendChild(c), r.appendChild(s), r;
|
|
2273
2458
|
},
|
|
2274
2459
|
isEmpty: (n) => !n.getAttribute("href")
|
|
2275
2460
|
};
|
|
@@ -2280,15 +2465,17 @@ function Ie(n) {
|
|
|
2280
2465
|
return "";
|
|
2281
2466
|
}
|
|
2282
2467
|
}
|
|
2283
|
-
function
|
|
2468
|
+
function rn(n) {
|
|
2284
2469
|
const e = Ie(n);
|
|
2285
2470
|
return e ? `https://www.google.com/s2/favicons?domain=${encodeURIComponent(e)}&sz=64` : "";
|
|
2286
2471
|
}
|
|
2287
|
-
const
|
|
2472
|
+
const sn = {
|
|
2288
2473
|
kind: "file",
|
|
2289
2474
|
label: "파일",
|
|
2290
2475
|
allowsInlineFormat: !1,
|
|
2291
2476
|
allowedMarks: [],
|
|
2477
|
+
allowsColor: !1,
|
|
2478
|
+
allowsFontSize: !1,
|
|
2292
2479
|
matches: (n) => {
|
|
2293
2480
|
if (n.tagName !== "A" || !n.classList.contains("aw-file-attachment")) return null;
|
|
2294
2481
|
const e = n.getAttribute("href") ?? void 0, t = n.getAttribute("data-file-name") ?? void 0, o = n.getAttribute("data-file-size"), l = o ? Number(o) : void 0, i = n.getAttribute("data-file-type") ?? void 0, r = {};
|
|
@@ -2303,20 +2490,20 @@ const on = {
|
|
|
2303
2490
|
o.className = "aw-file-meta";
|
|
2304
2491
|
const l = document.createElement("span");
|
|
2305
2492
|
l.className = "aw-file-name", l.textContent = (n == null ? void 0 : n.fileName) ?? "파일", o.appendChild(l);
|
|
2306
|
-
const i = [], r =
|
|
2307
|
-
if (r && i.push(r), (n == null ? void 0 : n.fileSize) !== void 0 && i.push(
|
|
2308
|
-
const
|
|
2309
|
-
|
|
2493
|
+
const i = [], r = cn(n == null ? void 0 : n.fileName, n == null ? void 0 : n.fileType);
|
|
2494
|
+
if (r && i.push(r), (n == null ? void 0 : n.fileSize) !== void 0 && i.push(an(n.fileSize)), i.length > 0) {
|
|
2495
|
+
const a = document.createElement("span");
|
|
2496
|
+
a.className = "aw-file-info", a.textContent = i.join(" · "), o.appendChild(a);
|
|
2310
2497
|
}
|
|
2311
2498
|
const s = document.createElement("span");
|
|
2312
2499
|
return s.className = "aw-file-action", s.setAttribute("aria-hidden", "true"), s.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>', e.appendChild(t), e.appendChild(o), e.appendChild(s), e;
|
|
2313
2500
|
},
|
|
2314
2501
|
isEmpty: (n) => !n.getAttribute("href")
|
|
2315
2502
|
};
|
|
2316
|
-
function
|
|
2503
|
+
function an(n) {
|
|
2317
2504
|
return n < 1024 ? `${n} B` : n < 1024 * 1024 ? `${(n / 1024).toFixed(1)} KB` : n < 1024 * 1024 * 1024 ? `${(n / 1024 / 1024).toFixed(1)} MB` : `${(n / 1024 / 1024 / 1024).toFixed(1)} GB`;
|
|
2318
2505
|
}
|
|
2319
|
-
function
|
|
2506
|
+
function cn(n, e) {
|
|
2320
2507
|
if (n) {
|
|
2321
2508
|
const t = n.lastIndexOf(".");
|
|
2322
2509
|
if (t > 0 && t < n.length - 1)
|
|
@@ -2324,11 +2511,13 @@ function rn(n, e) {
|
|
|
2324
2511
|
}
|
|
2325
2512
|
return e ? (e.split("/").pop() ?? "").toUpperCase() : "";
|
|
2326
2513
|
}
|
|
2327
|
-
const
|
|
2514
|
+
const dn = {
|
|
2328
2515
|
kind: "importedHtml",
|
|
2329
2516
|
label: "HTML",
|
|
2330
2517
|
allowsInlineFormat: !1,
|
|
2331
2518
|
allowedMarks: [],
|
|
2519
|
+
allowsColor: !1,
|
|
2520
|
+
allowsFontSize: !1,
|
|
2332
2521
|
matches: (n) => {
|
|
2333
2522
|
if (n.tagName !== "DIV" || n.getAttribute("data-imported-html") !== "true") return null;
|
|
2334
2523
|
const e = {}, t = n.getAttribute("style");
|
|
@@ -2341,30 +2530,32 @@ const sn = {
|
|
|
2341
2530
|
return e.setAttribute("data-imported-html", "true"), n != null && n.importedStyle && e.setAttribute("style", n.importedStyle), n != null && n.importedClass && e.setAttribute("class", n.importedClass), e;
|
|
2342
2531
|
},
|
|
2343
2532
|
isEmpty: () => !1
|
|
2344
|
-
},
|
|
2533
|
+
}, De = {
|
|
2345
2534
|
kind: "unknown",
|
|
2346
2535
|
label: "알 수 없음",
|
|
2347
2536
|
allowsInlineFormat: !1,
|
|
2348
2537
|
allowedMarks: [],
|
|
2538
|
+
allowsColor: !1,
|
|
2539
|
+
allowsFontSize: !1,
|
|
2349
2540
|
matches: () => null,
|
|
2350
2541
|
create: () => J(document.createElement("p")),
|
|
2351
2542
|
isEmpty: (n) => q(n)
|
|
2352
2543
|
}, He = [
|
|
2353
|
-
Ut,
|
|
2354
|
-
Wt,
|
|
2355
|
-
Kt,
|
|
2356
|
-
Yt,
|
|
2357
2544
|
Vt,
|
|
2545
|
+
Yt,
|
|
2358
2546
|
Gt,
|
|
2359
2547
|
Zt,
|
|
2548
|
+
Xt,
|
|
2360
2549
|
Qt,
|
|
2361
2550
|
Jt,
|
|
2362
2551
|
tn,
|
|
2363
|
-
|
|
2552
|
+
nn,
|
|
2553
|
+
ln,
|
|
2364
2554
|
on,
|
|
2365
|
-
sn
|
|
2366
|
-
|
|
2367
|
-
|
|
2555
|
+
sn,
|
|
2556
|
+
dn
|
|
2557
|
+
], N = (() => {
|
|
2558
|
+
const n = { unknown: De };
|
|
2368
2559
|
for (const e of He) n[e.kind] = e;
|
|
2369
2560
|
return n;
|
|
2370
2561
|
})();
|
|
@@ -2373,10 +2564,10 @@ function U(n) {
|
|
|
2373
2564
|
const t = e.matches(n);
|
|
2374
2565
|
if (t) return { type: e, match: t };
|
|
2375
2566
|
}
|
|
2376
|
-
return { type:
|
|
2567
|
+
return { type: De, match: { kind: "unknown", attrs: {} } };
|
|
2377
2568
|
}
|
|
2378
2569
|
const F = "data-block-id";
|
|
2379
|
-
class
|
|
2570
|
+
class Fe {
|
|
2380
2571
|
constructor() {
|
|
2381
2572
|
w(this, "counter", 0);
|
|
2382
2573
|
w(this, "seen", /* @__PURE__ */ new Set());
|
|
@@ -2445,7 +2636,7 @@ function we(n) {
|
|
|
2445
2636
|
for (const e of Array.from(n.querySelectorAll("figure, div.aw-youtube-embed")))
|
|
2446
2637
|
e instanceof HTMLElement && (e.querySelector(":scope > .aw-block-align-controls") || e.appendChild(he()), e.querySelector(":scope > .aw-resize-handle") || e.appendChild(pe()));
|
|
2447
2638
|
}
|
|
2448
|
-
function
|
|
2639
|
+
function un(n) {
|
|
2449
2640
|
switch (n.kind) {
|
|
2450
2641
|
case "paragraph":
|
|
2451
2642
|
return "단락";
|
|
@@ -2477,7 +2668,7 @@ function an(n) {
|
|
|
2477
2668
|
return "?";
|
|
2478
2669
|
}
|
|
2479
2670
|
}
|
|
2480
|
-
function
|
|
2671
|
+
function pn(n) {
|
|
2481
2672
|
return {
|
|
2482
2673
|
id: n.id,
|
|
2483
2674
|
kind: n.kind,
|
|
@@ -2485,17 +2676,17 @@ function cn(n) {
|
|
|
2485
2676
|
html: n.element.innerHTML
|
|
2486
2677
|
};
|
|
2487
2678
|
}
|
|
2488
|
-
function
|
|
2489
|
-
return n.map(
|
|
2679
|
+
function Pe(n) {
|
|
2680
|
+
return n.map(pn);
|
|
2490
2681
|
}
|
|
2491
|
-
function
|
|
2492
|
-
const t = (
|
|
2682
|
+
function hn(n) {
|
|
2683
|
+
const t = (N[n.kind] ?? N.unknown).create(n.attrs);
|
|
2493
2684
|
return t.setAttribute(F, n.id), n.html.length > 0 && (t.innerHTML = n.html), t;
|
|
2494
2685
|
}
|
|
2495
|
-
function
|
|
2686
|
+
function mn(n, e) {
|
|
2496
2687
|
for (; n.firstChild; ) n.removeChild(n.firstChild);
|
|
2497
2688
|
for (const t of e)
|
|
2498
|
-
n.appendChild(
|
|
2689
|
+
n.appendChild(hn(t));
|
|
2499
2690
|
}
|
|
2500
2691
|
function de(n, e) {
|
|
2501
2692
|
const t = [];
|
|
@@ -2527,7 +2718,7 @@ function ue(n, e, t) {
|
|
|
2527
2718
|
}
|
|
2528
2719
|
return null;
|
|
2529
2720
|
}
|
|
2530
|
-
function
|
|
2721
|
+
function fn(n) {
|
|
2531
2722
|
const e = n.element;
|
|
2532
2723
|
switch (n.kind) {
|
|
2533
2724
|
case "paragraph":
|
|
@@ -2557,7 +2748,7 @@ function ke(n) {
|
|
|
2557
2748
|
for (const l of Array.from(t.childNodes)) e.push(l);
|
|
2558
2749
|
}), e;
|
|
2559
2750
|
}
|
|
2560
|
-
function
|
|
2751
|
+
function gn(n, e, t) {
|
|
2561
2752
|
if (t.length === 0) return;
|
|
2562
2753
|
let o = null;
|
|
2563
2754
|
switch (e) {
|
|
@@ -2578,13 +2769,50 @@ function hn(n, e, t) {
|
|
|
2578
2769
|
default:
|
|
2579
2770
|
return;
|
|
2580
2771
|
}
|
|
2581
|
-
if (o)
|
|
2582
|
-
|
|
2583
|
-
|
|
2772
|
+
if (!o) return;
|
|
2773
|
+
for (; o.firstChild; ) o.removeChild(o.firstChild);
|
|
2774
|
+
for (const i of t) o.appendChild(i);
|
|
2775
|
+
const l = N[e];
|
|
2776
|
+
l && bn(o, l);
|
|
2777
|
+
}
|
|
2778
|
+
function bn(n, e) {
|
|
2779
|
+
const t = new Set(e.allowedMarks);
|
|
2780
|
+
for (const o of Array.from(n.querySelectorAll("*"))) {
|
|
2781
|
+
if (!(o instanceof HTMLElement) || !o.parentNode) continue;
|
|
2782
|
+
const l = o.tagName.toLowerCase();
|
|
2783
|
+
if ((l === "b" || l === "strong") && !t.has("bold") || (l === "i" || l === "em") && !t.has("italic") || l === "u" && !t.has("underline") || (l === "s" || l === "strike" || l === "del") && !t.has("strike")) {
|
|
2784
|
+
ve(o);
|
|
2785
|
+
continue;
|
|
2786
|
+
}
|
|
2787
|
+
if (l === "span" || l === "font") {
|
|
2788
|
+
const i = o.style;
|
|
2789
|
+
if (!t.has("bold")) {
|
|
2790
|
+
const c = i.fontWeight;
|
|
2791
|
+
(c === "bold" || c === "bolder" || /^[7-9]\d{2}$|^1000$/.test(c)) && i.removeProperty("font-weight");
|
|
2792
|
+
}
|
|
2793
|
+
!t.has("italic") && i.fontStyle === "italic" && i.removeProperty("font-style");
|
|
2794
|
+
const r = i.textDecorationLine || i.textDecoration || "";
|
|
2795
|
+
if (r) {
|
|
2796
|
+
const c = r.split(/\s+/), d = c.filter((u) => !(u === "underline" && !t.has("underline") || u === "line-through" && !t.has("strike")));
|
|
2797
|
+
d.length !== c.length && (i.removeProperty("text-decoration"), i.removeProperty("text-decoration-line"), d.length > 0 && (i.textDecoration = d.join(" ")));
|
|
2798
|
+
}
|
|
2799
|
+
e.allowsColor || (i.removeProperty("color"), i.removeProperty("background-color"), l === "font" && o.removeAttribute("color")), e.allowsFontSize || (i.removeProperty("font-size"), l === "font" && o.removeAttribute("size")), e.allowsInlineFormat || (i.removeProperty("font-family"), l === "font" && o.removeAttribute("face"));
|
|
2800
|
+
const s = i.cssText.trim().length > 0, a = Array.from(o.attributes).some(
|
|
2801
|
+
(c) => c.name !== "style"
|
|
2802
|
+
);
|
|
2803
|
+
!s && !a && ve(o);
|
|
2804
|
+
}
|
|
2584
2805
|
}
|
|
2585
2806
|
}
|
|
2586
|
-
function
|
|
2587
|
-
const e = n.
|
|
2807
|
+
function ve(n) {
|
|
2808
|
+
const e = n.parentNode;
|
|
2809
|
+
if (e) {
|
|
2810
|
+
for (; n.firstChild; ) e.insertBefore(n.firstChild, n);
|
|
2811
|
+
e.removeChild(n);
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
function yn(n = {}) {
|
|
2815
|
+
const e = n.fg || "currentColor", t = n.bg || "transparent", o = n.mode === "dark" ? !0 : n.mode === "light" ? !1 : wn(e, t);
|
|
2588
2816
|
return {
|
|
2589
2817
|
primary: n.primary || "#64c8ff",
|
|
2590
2818
|
fg: e,
|
|
@@ -2594,13 +2822,13 @@ function mn(n = {}) {
|
|
|
2594
2822
|
isDark: o
|
|
2595
2823
|
};
|
|
2596
2824
|
}
|
|
2597
|
-
function
|
|
2598
|
-
const t =
|
|
2825
|
+
function wn(n, e) {
|
|
2826
|
+
const t = Ce(n);
|
|
2599
2827
|
if (t !== null) return t > 0.5;
|
|
2600
|
-
const o =
|
|
2828
|
+
const o = Ce(e);
|
|
2601
2829
|
return o !== null ? o < 0.5 : !0;
|
|
2602
2830
|
}
|
|
2603
|
-
function
|
|
2831
|
+
function Ce(n) {
|
|
2604
2832
|
if (!n) return null;
|
|
2605
2833
|
const e = n.trim();
|
|
2606
2834
|
let t = -1, o = -1, l = -1;
|
|
@@ -2614,14 +2842,14 @@ function ve(n) {
|
|
|
2614
2842
|
}
|
|
2615
2843
|
return t < 0 ? null : (0.299 * t + 0.587 * o + 0.114 * l) / 255;
|
|
2616
2844
|
}
|
|
2617
|
-
function
|
|
2618
|
-
const e = getComputedStyle(n), t = (
|
|
2619
|
-
const d = e.getPropertyValue(
|
|
2845
|
+
function qe(n) {
|
|
2846
|
+
const e = getComputedStyle(n), t = (c) => {
|
|
2847
|
+
const d = e.getPropertyValue(c).trim();
|
|
2620
2848
|
return d.length > 0 ? d : void 0;
|
|
2621
|
-
}, o = {}, l = t("--aw-primary"), i = t("--aw-fg"), r = t("--aw-bg"), s = t("--aw-border"),
|
|
2622
|
-
return l && (o.primary = l), i && (o.fg = i), r && (o.bg = r), s && (o.border = s),
|
|
2849
|
+
}, o = {}, l = t("--aw-primary"), i = t("--aw-fg"), r = t("--aw-bg"), s = t("--aw-border"), a = t("--aw-fg-muted");
|
|
2850
|
+
return l && (o.primary = l), i && (o.fg = i), r && (o.bg = r), s && (o.border = s), a && (o.fgMuted = a), o;
|
|
2623
2851
|
}
|
|
2624
|
-
function
|
|
2852
|
+
function kn(n) {
|
|
2625
2853
|
const e = `color-mix(in srgb, ${n.primary} 8%, transparent)`, t = `color-mix(in srgb, ${n.fg} 6%, ${n.bg})`;
|
|
2626
2854
|
return `${n.fg}${n.bg}`, {
|
|
2627
2855
|
H1: `font-size:1.875rem;font-weight:700;line-height:1.3;margin:.6em 0 .4em;padding-bottom:.25em;border-bottom:1px solid ${n.border};color:${n.fg};`,
|
|
@@ -2641,7 +2869,7 @@ function gn(n) {
|
|
|
2641
2869
|
A: `display:block;text-decoration:none;margin:1em 0;padding:12px 16px;border:1px solid ${n.border};border-radius:8px;background-color:${e};color:${n.fg};`
|
|
2642
2870
|
};
|
|
2643
2871
|
}
|
|
2644
|
-
function
|
|
2872
|
+
function vn(n) {
|
|
2645
2873
|
const e = `color-mix(in srgb, ${n.fg} 5%, ${n.bg})`, t = `color-mix(in srgb, ${n.primary} 12%, transparent)`;
|
|
2646
2874
|
return {
|
|
2647
2875
|
"pre > code": "background:transparent;padding:0;font:inherit;color:inherit;display:block;",
|
|
@@ -2675,8 +2903,8 @@ function bn(n) {
|
|
|
2675
2903
|
"pre > code .hl-punct": `color:${n.fgMuted};`
|
|
2676
2904
|
};
|
|
2677
2905
|
}
|
|
2678
|
-
function
|
|
2679
|
-
const t =
|
|
2906
|
+
function Oe(n, e = {}) {
|
|
2907
|
+
const t = yn(e), o = kn(t), l = vn(t);
|
|
2680
2908
|
for (const i of Array.from(n.children)) {
|
|
2681
2909
|
if (!(i instanceof HTMLElement) || i.getAttribute("data-imported-html") === "true") continue;
|
|
2682
2910
|
if (i.tagName === "A" && i.classList.contains("aw-file-attachment")) {
|
|
@@ -2702,7 +2930,7 @@ function oe(n, e) {
|
|
|
2702
2930
|
const o = e.replace(/;\s*$/, ""), l = t.replace(/;\s*$/, "");
|
|
2703
2931
|
n.setAttribute("style", `${o};${l}`);
|
|
2704
2932
|
}
|
|
2705
|
-
function
|
|
2933
|
+
function _e(n) {
|
|
2706
2934
|
for (const e of Array.from(n.querySelectorAll("[data-block-kind]")))
|
|
2707
2935
|
e.removeAttribute("data-block-kind");
|
|
2708
2936
|
for (const e of Array.from(n.querySelectorAll("[data-block-label]")))
|
|
@@ -2719,12 +2947,12 @@ function O(n) {
|
|
|
2719
2947
|
if (n.tagName === "HR")
|
|
2720
2948
|
t.setStartAfter(n);
|
|
2721
2949
|
else {
|
|
2722
|
-
const o =
|
|
2950
|
+
const o = Cn(n);
|
|
2723
2951
|
t.selectNodeContents(o), t.collapse(!0);
|
|
2724
2952
|
}
|
|
2725
2953
|
e.removeAllRanges(), e.addRange(t);
|
|
2726
2954
|
}
|
|
2727
|
-
function
|
|
2955
|
+
function Cn(n) {
|
|
2728
2956
|
switch (n.tagName) {
|
|
2729
2957
|
case "UL":
|
|
2730
2958
|
case "OL": {
|
|
@@ -2750,32 +2978,32 @@ function yn(n) {
|
|
|
2750
2978
|
function J(n) {
|
|
2751
2979
|
return n.appendChild(document.createElement("br")), n;
|
|
2752
2980
|
}
|
|
2753
|
-
function
|
|
2981
|
+
function je(n) {
|
|
2754
2982
|
const e = document.createElement(n), t = document.createElement("li");
|
|
2755
2983
|
return t.appendChild(document.createElement("br")), e.appendChild(t), e;
|
|
2756
2984
|
}
|
|
2757
|
-
function
|
|
2985
|
+
function Ue(n) {
|
|
2758
2986
|
const e = n.querySelectorAll(":scope > li");
|
|
2759
2987
|
return e.length === 0 ? !0 : e.length === 1 ? q(e[0]) : !1;
|
|
2760
2988
|
}
|
|
2761
2989
|
function q(n) {
|
|
2762
2990
|
return (n.textContent ?? "").replace(//g, "").trim().length === 0;
|
|
2763
2991
|
}
|
|
2764
|
-
function
|
|
2992
|
+
function xn(n) {
|
|
2765
2993
|
return n === void 0 || n < 1 ? 1 : n > 6 ? 6 : n;
|
|
2766
2994
|
}
|
|
2767
|
-
function
|
|
2995
|
+
function xe(n) {
|
|
2768
2996
|
if (!n) return {};
|
|
2769
2997
|
const e = {}, t = n.getAttribute("src"), o = n.getAttribute("alt");
|
|
2770
2998
|
return t && (e.src = t), o && (e.alt = o), e;
|
|
2771
2999
|
}
|
|
2772
|
-
const
|
|
3000
|
+
const Ee = {
|
|
2773
3001
|
bulletList: "bulletList",
|
|
2774
3002
|
orderedList: "orderedList",
|
|
2775
3003
|
blockquote: "blockquote",
|
|
2776
3004
|
codeBlock: "codeBlock"
|
|
2777
3005
|
}, le = "application/x-aeriz-block";
|
|
2778
|
-
class
|
|
3006
|
+
class Rn {
|
|
2779
3007
|
constructor(e) {
|
|
2780
3008
|
w(this, "root");
|
|
2781
3009
|
w(this, "content");
|
|
@@ -2792,12 +3020,12 @@ class $n {
|
|
|
2792
3020
|
w(this, "statusSourceEl");
|
|
2793
3021
|
w(this, "options");
|
|
2794
3022
|
w(this, "observer");
|
|
2795
|
-
w(this, "blockIds", new
|
|
3023
|
+
w(this, "blockIds", new Fe());
|
|
2796
3024
|
w(this, "idFor", (e) => this.blockIds.ensure(e));
|
|
2797
3025
|
w(this, "listeners", /* @__PURE__ */ new Set());
|
|
2798
3026
|
w(this, "handleSelectionChange", () => this.queueSync());
|
|
2799
3027
|
w(this, "handleResize", () => this.repositionHandles());
|
|
2800
|
-
w(this, "state",
|
|
3028
|
+
w(this, "state", Mn());
|
|
2801
3029
|
w(this, "destroyed", !1);
|
|
2802
3030
|
w(this, "syncQueued", !1);
|
|
2803
3031
|
w(this, "lastSerialized", "");
|
|
@@ -2815,9 +3043,9 @@ class $n {
|
|
|
2815
3043
|
if (!(e.element instanceof HTMLElement))
|
|
2816
3044
|
throw new TypeError("AerizEditor: options.element must be an HTMLElement");
|
|
2817
3045
|
if (this.options = e, e.locale && (e.locale, void 0), this.root = document.createElement("div"), this.root.className = "aeriz-wysiwyg", e.theme && (this.root.dataset.theme = e.theme), e.toolbar !== !1) {
|
|
2818
|
-
const r = e.toolbar ??
|
|
2819
|
-
this.toolbar = new
|
|
2820
|
-
onAction: (s,
|
|
3046
|
+
const r = e.toolbar ?? Ve;
|
|
3047
|
+
this.toolbar = new Ge(r, {
|
|
3048
|
+
onAction: (s, a) => this.handleToolbarAction(s, a)
|
|
2821
3049
|
}), this.root.appendChild(this.toolbar.element);
|
|
2822
3050
|
}
|
|
2823
3051
|
this.contentWrap = document.createElement("div"), this.contentWrap.className = "aw-content-wrap", this.content = document.createElement("div"), this.content.className = "aw-content", this.content.contentEditable = "true", this.content.setAttribute("role", "textbox"), this.content.setAttribute("aria-multiline", "true"), e.placeholder && (this.content.dataset.placeholder = e.placeholder), this.content.innerHTML = e.initialHTML ?? "<p><br></p>", we(this.content), ce(this.content, this.blockIds), this.lastSerialized = this.content.innerHTML, this.contentWrap.appendChild(this.content), this.handlesLayer = document.createElement("div"), this.handlesLayer.className = "aw-block-handles", this.contentWrap.appendChild(this.handlesLayer), this.dropIndicator = document.createElement("div"), this.dropIndicator.className = "aw-block-drop-indicator", this.dropIndicator.style.display = "none", this.contentWrap.appendChild(this.dropIndicator), this.blockLabelPill = document.createElement("button"), this.blockLabelPill.type = "button", this.blockLabelPill.className = "aw-block-label-pill", this.blockLabelPill.style.display = "none", this.blockLabelPill.title = "블록 유형 변경", this.blockLabelPill.addEventListener("mousedown", (r) => r.preventDefault()), this.blockLabelPill.addEventListener("click", (r) => {
|
|
@@ -2827,9 +3055,9 @@ class $n {
|
|
|
2827
3055
|
}), this.contentWrap.appendChild(this.blockLabelPill), this.root.appendChild(this.contentWrap), this.statusBar = document.createElement("div"), this.statusBar.className = "aw-status-bar";
|
|
2828
3056
|
const t = document.createElement("div");
|
|
2829
3057
|
t.className = "aw-status-left";
|
|
2830
|
-
const o =
|
|
3058
|
+
const o = Te("되돌리기 (Ctrl+Z)", E.undo, () => {
|
|
2831
3059
|
this.content.focus(), document.execCommand("undo");
|
|
2832
|
-
}), l =
|
|
3060
|
+
}), l = Te("다시 실행 (Ctrl+Y)", E.redo, () => {
|
|
2833
3061
|
this.content.focus(), document.execCommand("redo");
|
|
2834
3062
|
});
|
|
2835
3063
|
this.statusBlockEl = document.createElement("span"), this.statusBlockEl.className = "aw-status-item", t.appendChild(o), t.appendChild(l), t.appendChild(this.statusBlockEl);
|
|
@@ -2855,8 +3083,8 @@ class $n {
|
|
|
2855
3083
|
* data-block-id 는 보존.
|
|
2856
3084
|
*/
|
|
2857
3085
|
getHTML() {
|
|
2858
|
-
const e = this.content.cloneNode(!0), t =
|
|
2859
|
-
return o && (t.mode = o),
|
|
3086
|
+
const e = this.content.cloneNode(!0), t = qe(this.root), o = this.currentTheme();
|
|
3087
|
+
return o && (t.mode = o), Oe(e, t), _e(e), e.innerHTML;
|
|
2860
3088
|
}
|
|
2861
3089
|
/** 가공 없는 원본 innerHTML. 직렬화 검증/디버그 용도. */
|
|
2862
3090
|
getRawHTML() {
|
|
@@ -2882,7 +3110,7 @@ class $n {
|
|
|
2882
3110
|
* AerizViewer.setBlocks(snapshots) 가 받아 동일한 트리를 렌더할 수 있다.
|
|
2883
3111
|
*/
|
|
2884
3112
|
serialize() {
|
|
2885
|
-
return
|
|
3113
|
+
return Pe(this.getBlocks());
|
|
2886
3114
|
}
|
|
2887
3115
|
/**
|
|
2888
3116
|
* data-block-id 로 본문에서 블록을 찾아 반환. 없으면 null.
|
|
@@ -2904,14 +3132,14 @@ class $n {
|
|
|
2904
3132
|
* - 미지정 시 현재 active block 사용. 둘 다 없으면 본문 끝에 새 블록 추가.
|
|
2905
3133
|
*/
|
|
2906
3134
|
setBlockType(e, t, o) {
|
|
2907
|
-
const l =
|
|
3135
|
+
const l = N[e];
|
|
2908
3136
|
if (!l) return;
|
|
2909
3137
|
const i = o ? this.findBlockById(o) : this.getActiveBlock(), r = i ? this.replaceBlock(i, l, t) : this.appendBlock(l, t);
|
|
2910
3138
|
this.flush(), this.content.focus(), O(r);
|
|
2911
3139
|
}
|
|
2912
3140
|
replaceBlock(e, t, o) {
|
|
2913
|
-
const l =
|
|
2914
|
-
return
|
|
3141
|
+
const l = fn(e), i = t.create(o);
|
|
3142
|
+
return gn(i, t.kind, l), i.setAttribute("data-block-explicit", "true"), e.element.replaceWith(i), i;
|
|
2915
3143
|
}
|
|
2916
3144
|
appendBlock(e, t) {
|
|
2917
3145
|
const o = e.create(t);
|
|
@@ -2944,9 +3172,9 @@ class $n {
|
|
|
2944
3172
|
break;
|
|
2945
3173
|
}
|
|
2946
3174
|
case "fontFamily": {
|
|
2947
|
-
if (!
|
|
3175
|
+
if (!Le(this.getActiveBlock())) return;
|
|
2948
3176
|
const o = this.detectActiveFontId();
|
|
2949
|
-
|
|
3177
|
+
Bt(
|
|
2950
3178
|
t,
|
|
2951
3179
|
(l) => this.applyFontFamily(l.stack),
|
|
2952
3180
|
o ?? void 0
|
|
@@ -2954,7 +3182,7 @@ class $n {
|
|
|
2954
3182
|
break;
|
|
2955
3183
|
}
|
|
2956
3184
|
case "fontSize": {
|
|
2957
|
-
if (!
|
|
3185
|
+
if (!Ae(this.getActiveBlock())) return;
|
|
2958
3186
|
const o = this.detectActiveFontSize();
|
|
2959
3187
|
It(
|
|
2960
3188
|
t,
|
|
@@ -2964,7 +3192,7 @@ class $n {
|
|
|
2964
3192
|
break;
|
|
2965
3193
|
}
|
|
2966
3194
|
case "color": {
|
|
2967
|
-
if (!
|
|
3195
|
+
if (!V(this.getActiveBlock())) return;
|
|
2968
3196
|
te(
|
|
2969
3197
|
t,
|
|
2970
3198
|
(o) => this.handleColorPick(o, "foreColor"),
|
|
@@ -2973,7 +3201,7 @@ class $n {
|
|
|
2973
3201
|
break;
|
|
2974
3202
|
}
|
|
2975
3203
|
case "backgroundColor": {
|
|
2976
|
-
if (!
|
|
3204
|
+
if (!V(this.getActiveBlock())) return;
|
|
2977
3205
|
te(
|
|
2978
3206
|
t,
|
|
2979
3207
|
(o) => this.handleColorPick(o, "hiliteColor"),
|
|
@@ -2983,11 +3211,11 @@ class $n {
|
|
|
2983
3211
|
}
|
|
2984
3212
|
case "align": {
|
|
2985
3213
|
if (!ie(this.getActiveBlock())) return;
|
|
2986
|
-
|
|
3214
|
+
Mt(t, (o) => this.applyAlign(o));
|
|
2987
3215
|
break;
|
|
2988
3216
|
}
|
|
2989
3217
|
case "cellBg": {
|
|
2990
|
-
if (!
|
|
3218
|
+
if (!Y(this.getActiveBlock())) return;
|
|
2991
3219
|
const o = this.getSelectedTableCells();
|
|
2992
3220
|
if (o.length === 0) return;
|
|
2993
3221
|
te(
|
|
@@ -2998,7 +3226,7 @@ class $n {
|
|
|
2998
3226
|
break;
|
|
2999
3227
|
}
|
|
3000
3228
|
case "tableMenu": {
|
|
3001
|
-
if (!
|
|
3229
|
+
if (!Y(this.getActiveBlock())) return;
|
|
3002
3230
|
Rt(t, (o) => this.runTableMenu(o));
|
|
3003
3231
|
break;
|
|
3004
3232
|
}
|
|
@@ -3006,7 +3234,7 @@ class $n {
|
|
|
3006
3234
|
const o = this.getActiveBlock();
|
|
3007
3235
|
if (!o || o.kind !== "codeBlock") return;
|
|
3008
3236
|
const l = o.element.querySelector(":scope > code"), i = (l == null ? void 0 : l.getAttribute("data-language")) ?? void 0;
|
|
3009
|
-
|
|
3237
|
+
$t(
|
|
3010
3238
|
t,
|
|
3011
3239
|
(r) => this.applyCodeLanguage(o.element, r.id),
|
|
3012
3240
|
i
|
|
@@ -3223,8 +3451,8 @@ class $n {
|
|
|
3223
3451
|
for (const r of Array.from(i.querySelectorAll("tr"))) {
|
|
3224
3452
|
const s = r.children[l];
|
|
3225
3453
|
if (!s) continue;
|
|
3226
|
-
const
|
|
3227
|
-
|
|
3454
|
+
const a = s.tagName.toLowerCase(), c = document.createElement(a);
|
|
3455
|
+
c.appendChild(document.createElement("br")), e === "left" ? r.insertBefore(c, s) : r.insertBefore(c, s.nextSibling);
|
|
3228
3456
|
}
|
|
3229
3457
|
this.flush();
|
|
3230
3458
|
}
|
|
@@ -3262,8 +3490,8 @@ class $n {
|
|
|
3262
3490
|
* code 안에 있다면 textContent offset 으로 caret 위치 보존.
|
|
3263
3491
|
*/
|
|
3264
3492
|
rehighlightCode(e, t) {
|
|
3265
|
-
const o = e.textContent ?? "", l =
|
|
3266
|
-
e.innerHTML =
|
|
3493
|
+
const o = e.textContent ?? "", l = Ln(e);
|
|
3494
|
+
e.innerHTML = kt(o, t), l && An(e, l);
|
|
3267
3495
|
}
|
|
3268
3496
|
/**
|
|
3269
3497
|
* 본문에서 모든 codeBlock 을 순회하며 highlight 적용. setHTML / 초기 로드
|
|
@@ -3306,7 +3534,7 @@ class $n {
|
|
|
3306
3534
|
this.content.style.cursor = "";
|
|
3307
3535
|
return;
|
|
3308
3536
|
}
|
|
3309
|
-
const o =
|
|
3537
|
+
const o = Se(t, e.clientX, e.clientY);
|
|
3310
3538
|
this.content.style.cursor = o === "right" ? "col-resize" : o === "bottom" ? "row-resize" : "";
|
|
3311
3539
|
}
|
|
3312
3540
|
/**
|
|
@@ -3315,27 +3543,27 @@ class $n {
|
|
|
3315
3543
|
* - 이미지·유튜브: 우하단 `.aw-resize-handle` element (corner resize)
|
|
3316
3544
|
*/
|
|
3317
3545
|
handleTableResizeStart(e) {
|
|
3318
|
-
var
|
|
3546
|
+
var a;
|
|
3319
3547
|
if (e.button !== 0) return;
|
|
3320
3548
|
const t = e.target, o = t == null ? void 0 : t.closest(".aw-resize-handle");
|
|
3321
3549
|
if (o instanceof HTMLElement) {
|
|
3322
|
-
const
|
|
3323
|
-
if (
|
|
3324
|
-
e.preventDefault(), e.stopPropagation(), this.startBlockResize(
|
|
3550
|
+
const c = o.parentElement;
|
|
3551
|
+
if (c instanceof HTMLElement && (c.tagName === "FIGURE" || c.tagName === "DIV" && c.classList.contains("aw-youtube-embed"))) {
|
|
3552
|
+
e.preventDefault(), e.stopPropagation(), this.startBlockResize(c, e.clientX);
|
|
3325
3553
|
return;
|
|
3326
3554
|
}
|
|
3327
3555
|
}
|
|
3328
|
-
const l = (
|
|
3556
|
+
const l = (a = t == null ? void 0 : t.closest) == null ? void 0 : a.call(t, "td, th");
|
|
3329
3557
|
if (!(l instanceof HTMLTableCellElement)) return;
|
|
3330
|
-
const i =
|
|
3558
|
+
const i = Se(l, e.clientX, e.clientY);
|
|
3331
3559
|
if (!i) return;
|
|
3332
3560
|
if (e.preventDefault(), e.stopPropagation(), i === "right") {
|
|
3333
|
-
const
|
|
3561
|
+
const c = l.closest("tr"), d = c ? Array.from(c.children).indexOf(l) : -1, u = l.closest("table");
|
|
3334
3562
|
if (!u || d < 0) return;
|
|
3335
3563
|
const m = [];
|
|
3336
|
-
for (const
|
|
3337
|
-
const
|
|
3338
|
-
|
|
3564
|
+
for (const h of Array.from(u.querySelectorAll("tr"))) {
|
|
3565
|
+
const f = h.children[d];
|
|
3566
|
+
f instanceof HTMLTableCellElement && m.push(f);
|
|
3339
3567
|
}
|
|
3340
3568
|
this.tableResize = {
|
|
3341
3569
|
kind: "col",
|
|
@@ -3346,18 +3574,18 @@ class $n {
|
|
|
3346
3574
|
targetRow: null
|
|
3347
3575
|
}, document.body.style.cursor = "col-resize";
|
|
3348
3576
|
} else {
|
|
3349
|
-
const
|
|
3350
|
-
if (!(
|
|
3577
|
+
const c = l.closest("tr");
|
|
3578
|
+
if (!(c instanceof HTMLTableRowElement)) return;
|
|
3351
3579
|
this.tableResize = {
|
|
3352
3580
|
kind: "row",
|
|
3353
3581
|
startX: e.clientX,
|
|
3354
3582
|
startY: e.clientY,
|
|
3355
|
-
initialSize:
|
|
3583
|
+
initialSize: c.getBoundingClientRect().height,
|
|
3356
3584
|
targetCells: [],
|
|
3357
|
-
targetRow:
|
|
3585
|
+
targetRow: c
|
|
3358
3586
|
}, document.body.style.cursor = "row-resize";
|
|
3359
3587
|
}
|
|
3360
|
-
const r = (
|
|
3588
|
+
const r = (c) => this.handleTableResizeMove(c), s = () => {
|
|
3361
3589
|
document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", s), document.body.style.cursor = "", this.tableResize = null, this.flush();
|
|
3362
3590
|
};
|
|
3363
3591
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", s);
|
|
@@ -3396,8 +3624,8 @@ class $n {
|
|
|
3396
3624
|
const o = e.getBoundingClientRect().width;
|
|
3397
3625
|
document.body.style.cursor = "nwse-resize", e.classList.add("aw-resizing");
|
|
3398
3626
|
const l = (r) => {
|
|
3399
|
-
const s = r.clientX - t,
|
|
3400
|
-
e.style.width = `${Math.round(
|
|
3627
|
+
const s = r.clientX - t, a = Math.max(80, o + s);
|
|
3628
|
+
e.style.width = `${Math.round(a)}px`;
|
|
3401
3629
|
}, i = () => {
|
|
3402
3630
|
document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", i), document.body.style.cursor = "", e.classList.remove("aw-resizing"), this.flush();
|
|
3403
3631
|
};
|
|
@@ -3426,7 +3654,7 @@ class $n {
|
|
|
3426
3654
|
let t = e.getRangeAt(0).startContainer;
|
|
3427
3655
|
if (!t || !this.content.contains(t) || (t.nodeType !== Node.ELEMENT_NODE && (t = t.parentElement), !(t instanceof Element))) return null;
|
|
3428
3656
|
const o = getComputedStyle(t).fontFamily;
|
|
3429
|
-
return
|
|
3657
|
+
return rt(o);
|
|
3430
3658
|
}
|
|
3431
3659
|
/**
|
|
3432
3660
|
* 선택 영역에 글자 크기를 적용한다. execCommand('fontSize') 는 1~7 만 받기
|
|
@@ -3449,11 +3677,11 @@ class $n {
|
|
|
3449
3677
|
}
|
|
3450
3678
|
const o = document.getSelection();
|
|
3451
3679
|
if (o && o.rangeCount > 0 && !o.getRangeAt(0).collapsed) {
|
|
3452
|
-
const s = o.getRangeAt(0),
|
|
3453
|
-
if (
|
|
3454
|
-
const d =
|
|
3680
|
+
const s = o.getRangeAt(0), a = G(s.startContainer), c = G(s.endContainer);
|
|
3681
|
+
if (a && c && a !== c && this.content.contains(a) && this.content.contains(c)) {
|
|
3682
|
+
const d = a.closest("table");
|
|
3455
3683
|
if (d instanceof HTMLTableElement) {
|
|
3456
|
-
this.applyFontSizeToCells(re(d,
|
|
3684
|
+
this.applyFontSizeToCells(re(d, a, c), e);
|
|
3457
3685
|
return;
|
|
3458
3686
|
}
|
|
3459
3687
|
}
|
|
@@ -3472,8 +3700,8 @@ class $n {
|
|
|
3472
3700
|
try {
|
|
3473
3701
|
i.surroundContents(r);
|
|
3474
3702
|
} catch {
|
|
3475
|
-
const
|
|
3476
|
-
r.appendChild(
|
|
3703
|
+
const a = i.extractContents();
|
|
3704
|
+
r.appendChild(a), i.insertNode(r);
|
|
3477
3705
|
}
|
|
3478
3706
|
l.removeAllRanges();
|
|
3479
3707
|
const s = document.createRange();
|
|
@@ -3492,7 +3720,7 @@ class $n {
|
|
|
3492
3720
|
let t = e.getRangeAt(0).startContainer;
|
|
3493
3721
|
if (!t || !this.content.contains(t) || (t.nodeType !== Node.ELEMENT_NODE && (t = t.parentElement), !(t instanceof Element))) return null;
|
|
3494
3722
|
const o = getComputedStyle(t).fontSize;
|
|
3495
|
-
return
|
|
3723
|
+
return lt(o);
|
|
3496
3724
|
}
|
|
3497
3725
|
/**
|
|
3498
3726
|
* 블록 유형 드롭다운을 열어 사용자 선택 결과를 처리한다.
|
|
@@ -3500,7 +3728,7 @@ class $n {
|
|
|
3500
3728
|
* 로직(리치 블록 다이얼로그 분기 + targetId 보존) 을 공유한다.
|
|
3501
3729
|
*/
|
|
3502
3730
|
openBlockTypeMenu(e, t) {
|
|
3503
|
-
|
|
3731
|
+
Nt(e, (o) => {
|
|
3504
3732
|
if (o.kind === "linkCard") {
|
|
3505
3733
|
this.openLinkDialogAndApply(t);
|
|
3506
3734
|
return;
|
|
@@ -3514,7 +3742,7 @@ class $n {
|
|
|
3514
3742
|
return;
|
|
3515
3743
|
}
|
|
3516
3744
|
if (o.kind === "table") {
|
|
3517
|
-
|
|
3745
|
+
Dt(e, (l) => {
|
|
3518
3746
|
this.setBlockType(
|
|
3519
3747
|
"table",
|
|
3520
3748
|
{ rows: l.rows, cols: l.cols },
|
|
@@ -3544,7 +3772,7 @@ class $n {
|
|
|
3544
3772
|
* 그 id 의 블록을 정확히 변환 대상으로 삼는다.
|
|
3545
3773
|
*/
|
|
3546
3774
|
openLinkDialogAndApply(e) {
|
|
3547
|
-
|
|
3775
|
+
Ze({}, this.currentTheme()).then((t) => {
|
|
3548
3776
|
var r;
|
|
3549
3777
|
if (!t.confirmed || !t.href) return;
|
|
3550
3778
|
const o = t.href, l = ((r = t.text) == null ? void 0 : r.trim()) ?? "", i = l.length > 0 ? l : o;
|
|
@@ -3557,7 +3785,7 @@ class $n {
|
|
|
3557
3785
|
*/
|
|
3558
3786
|
openImageDialogAndApply(e) {
|
|
3559
3787
|
const t = this.resolveImageUploadFn();
|
|
3560
|
-
|
|
3788
|
+
Xe(
|
|
3561
3789
|
{ ...t ? { onUpload: t } : {} },
|
|
3562
3790
|
this.currentTheme()
|
|
3563
3791
|
).then((o) => {
|
|
@@ -3569,9 +3797,9 @@ class $n {
|
|
|
3569
3797
|
* 변환/추가. 잘못된 URL 이면 무시.
|
|
3570
3798
|
*/
|
|
3571
3799
|
openYouTubeDialogAndApply(e) {
|
|
3572
|
-
|
|
3800
|
+
tt(this.currentTheme()).then((t) => {
|
|
3573
3801
|
if (!t.confirmed || !t.url) return;
|
|
3574
|
-
const o =
|
|
3802
|
+
const o = Sn(t.url);
|
|
3575
3803
|
o && this.setBlockType("youtube", { videoId: o }, e);
|
|
3576
3804
|
});
|
|
3577
3805
|
}
|
|
@@ -3583,7 +3811,7 @@ class $n {
|
|
|
3583
3811
|
* - 삽입된 element 는 MutationObserver flush 가 새 data-block-id 를 발급.
|
|
3584
3812
|
*/
|
|
3585
3813
|
openImportHtmlDialogAndApply(e) {
|
|
3586
|
-
|
|
3814
|
+
Qe(this.currentTheme()).then(async (t) => {
|
|
3587
3815
|
if (!t.confirmed) return;
|
|
3588
3816
|
if (!t.html || t.html.length === 0) {
|
|
3589
3817
|
window.alert("가져올 HTML 이 비어 있습니다.");
|
|
@@ -3591,11 +3819,13 @@ class $n {
|
|
|
3591
3819
|
}
|
|
3592
3820
|
let o;
|
|
3593
3821
|
try {
|
|
3594
|
-
o = await
|
|
3822
|
+
o = await Pt(t.html, {
|
|
3823
|
+
mountTarget: this.content
|
|
3824
|
+
});
|
|
3595
3825
|
} catch (s) {
|
|
3596
3826
|
console.error("HTML 가져오기 실패:", s);
|
|
3597
|
-
const
|
|
3598
|
-
window.alert(`HTML 가져오기 실패: ${
|
|
3827
|
+
const a = s instanceof Error ? s.message : String(s);
|
|
3828
|
+
window.alert(`HTML 가져오기 실패: ${a}`);
|
|
3599
3829
|
return;
|
|
3600
3830
|
}
|
|
3601
3831
|
if (o.length === 0) {
|
|
@@ -3604,25 +3834,25 @@ class $n {
|
|
|
3604
3834
|
}
|
|
3605
3835
|
const l = e ? this.content.querySelector(`[data-block-id="${e}"]`) : null, i = [];
|
|
3606
3836
|
for (const s of o) {
|
|
3607
|
-
const
|
|
3608
|
-
const
|
|
3609
|
-
return
|
|
3837
|
+
const a = $n(s.tagName) ? s : (() => {
|
|
3838
|
+
const c = document.createElement("p");
|
|
3839
|
+
return c.appendChild(s), c;
|
|
3610
3840
|
})();
|
|
3611
|
-
|
|
3841
|
+
a.setAttribute("data-block-explicit", "true"), i.push(a);
|
|
3612
3842
|
}
|
|
3613
3843
|
if (l)
|
|
3614
3844
|
if (l.tagName === "P" && (l.textContent ?? "").trim().length === 0 && i.length > 0) {
|
|
3615
|
-
const
|
|
3616
|
-
l.replaceWith(
|
|
3617
|
-
let
|
|
3845
|
+
const a = i[0];
|
|
3846
|
+
l.replaceWith(a);
|
|
3847
|
+
let c = a;
|
|
3618
3848
|
for (let d = 1; d < i.length; d++) {
|
|
3619
3849
|
const u = i[d];
|
|
3620
|
-
|
|
3850
|
+
c.after(u), c = u;
|
|
3621
3851
|
}
|
|
3622
3852
|
} else {
|
|
3623
|
-
let
|
|
3624
|
-
for (const
|
|
3625
|
-
|
|
3853
|
+
let a = l;
|
|
3854
|
+
for (const c of i)
|
|
3855
|
+
a.after(c), a = c;
|
|
3626
3856
|
}
|
|
3627
3857
|
else
|
|
3628
3858
|
for (const s of i) this.content.appendChild(s);
|
|
@@ -3636,7 +3866,7 @@ class $n {
|
|
|
3636
3866
|
* 본문에 element 들을 삽입한다. importHtml 과 동일한 삽입 정책을 따른다.
|
|
3637
3867
|
*/
|
|
3638
3868
|
openMarkdownImportDialogAndApply(e) {
|
|
3639
|
-
|
|
3869
|
+
Je(this.currentTheme()).then((t) => {
|
|
3640
3870
|
if (!t.confirmed) return;
|
|
3641
3871
|
if (!t.markdown || t.markdown.length === 0) {
|
|
3642
3872
|
window.alert("가져올 Markdown 이 비어 있습니다.");
|
|
@@ -3644,7 +3874,7 @@ class $n {
|
|
|
3644
3874
|
}
|
|
3645
3875
|
let o;
|
|
3646
3876
|
try {
|
|
3647
|
-
o =
|
|
3877
|
+
o = _t(t.markdown);
|
|
3648
3878
|
} catch (r) {
|
|
3649
3879
|
console.error("Markdown 파싱 실패:", r);
|
|
3650
3880
|
const s = r instanceof Error ? r.message : String(r);
|
|
@@ -3661,15 +3891,15 @@ class $n {
|
|
|
3661
3891
|
if (l.tagName === "P" && (l.textContent ?? "").trim().length === 0 && o.length > 0) {
|
|
3662
3892
|
const s = o[0];
|
|
3663
3893
|
l.replaceWith(s);
|
|
3664
|
-
let
|
|
3665
|
-
for (let
|
|
3666
|
-
const d = o[
|
|
3667
|
-
|
|
3894
|
+
let a = s;
|
|
3895
|
+
for (let c = 1; c < o.length; c++) {
|
|
3896
|
+
const d = o[c];
|
|
3897
|
+
a.after(d), a = d;
|
|
3668
3898
|
}
|
|
3669
3899
|
} else {
|
|
3670
3900
|
let s = l;
|
|
3671
|
-
for (const
|
|
3672
|
-
s.after(
|
|
3901
|
+
for (const a of o)
|
|
3902
|
+
s.after(a), s = a;
|
|
3673
3903
|
}
|
|
3674
3904
|
else
|
|
3675
3905
|
for (const r of o) this.content.appendChild(r);
|
|
@@ -3685,7 +3915,7 @@ class $n {
|
|
|
3685
3915
|
*/
|
|
3686
3916
|
openFileAttachmentDialogAndApply(e) {
|
|
3687
3917
|
const t = this.resolveFileUploadFn();
|
|
3688
|
-
|
|
3918
|
+
et(
|
|
3689
3919
|
{ ...t ? { onUpload: t } : {} },
|
|
3690
3920
|
this.currentTheme()
|
|
3691
3921
|
).then((o) => {
|
|
@@ -3694,7 +3924,7 @@ class $n {
|
|
|
3694
3924
|
window.alert("파일 URL 이 비어 있습니다.");
|
|
3695
3925
|
return;
|
|
3696
3926
|
}
|
|
3697
|
-
const l = { fileSrc: o.src }, i = o.name && o.name.length > 0 ? o.name :
|
|
3927
|
+
const l = { fileSrc: o.src }, i = o.name && o.name.length > 0 ? o.name : Tn(o.src);
|
|
3698
3928
|
i && (l.fileName = i), o.size !== void 0 && (l.fileSize = o.size), o.type && (l.fileType = o.type), this.setBlockType("file", l, e);
|
|
3699
3929
|
});
|
|
3700
3930
|
}
|
|
@@ -3921,8 +4151,8 @@ class $n {
|
|
|
3921
4151
|
const i = e.element.getBoundingClientRect(), r = this.contentWrap.getBoundingClientRect(), s = Math.max(
|
|
3922
4152
|
0,
|
|
3923
4153
|
i.top - r.top + this.contentWrap.scrollTop - 12
|
|
3924
|
-
),
|
|
3925
|
-
this.blockLabelPill.style.top = `${s}px`, this.blockLabelPill.style.left = `${
|
|
4154
|
+
), a = i.left - r.left + 4;
|
|
4155
|
+
this.blockLabelPill.style.top = `${s}px`, this.blockLabelPill.style.left = `${a}px`;
|
|
3926
4156
|
}
|
|
3927
4157
|
/**
|
|
3928
4158
|
* 하단 Status Bar 갱신.
|
|
@@ -3932,19 +4162,19 @@ class $n {
|
|
|
3932
4162
|
syncStatusBar(e, t) {
|
|
3933
4163
|
if (e) {
|
|
3934
4164
|
const { type: r, match: s } = U(e.element);
|
|
3935
|
-
let
|
|
4165
|
+
let a = se(e.element, r, s);
|
|
3936
4166
|
if (e.kind === "codeBlock") {
|
|
3937
|
-
const
|
|
3938
|
-
d && (
|
|
4167
|
+
const c = e.element.querySelector(":scope > code"), d = c == null ? void 0 : c.getAttribute("data-language");
|
|
4168
|
+
d && (a += ` · ${d}`);
|
|
3939
4169
|
}
|
|
3940
|
-
this.statusBlockEl.textContent =
|
|
4170
|
+
this.statusBlockEl.textContent = a;
|
|
3941
4171
|
} else
|
|
3942
4172
|
this.statusBlockEl.textContent = "— 선택된 블록 없음";
|
|
3943
4173
|
this.statusBlocksEl.textContent = `${t.length} 블록`;
|
|
3944
4174
|
const o = (this.content.textContent ?? "").replace(/\s+/g, ""), l = Array.from(o).length;
|
|
3945
4175
|
this.statusCharsEl.textContent = `텍스트 ${l} 자`;
|
|
3946
4176
|
const i = this.content.innerHTML.length;
|
|
3947
|
-
this.statusSourceEl.textContent = `소스 ${
|
|
4177
|
+
this.statusSourceEl.textContent = `소스 ${Nn(i)}`;
|
|
3948
4178
|
}
|
|
3949
4179
|
syncBlockMarkers(e) {
|
|
3950
4180
|
for (const t of Array.from(this.content.children)) {
|
|
@@ -3959,53 +4189,39 @@ class $n {
|
|
|
3959
4189
|
applyToolbarState(e, t) {
|
|
3960
4190
|
if (this.toolbar) {
|
|
3961
4191
|
this.toolbar.setActive("bold", e.inline.bold), this.toolbar.setActive("italic", e.inline.italic), this.toolbar.setActive("underline", e.inline.underline), this.toolbar.setActive("strike", e.inline.strike);
|
|
3962
|
-
for (const o of Object.keys(
|
|
3963
|
-
const l =
|
|
4192
|
+
for (const o of Object.keys(Ee)) {
|
|
4193
|
+
const l = Ee[o];
|
|
3964
4194
|
this.toolbar.setActive(o, (t == null ? void 0 : t.kind) === l);
|
|
3965
4195
|
}
|
|
3966
|
-
this.toolbar.setVisible("bold", _(t, "bold")), this.toolbar.setVisible("italic", _(t, "italic")), this.toolbar.setVisible("underline", _(t, "underline")), this.toolbar.setVisible("strike", _(t, "strike")), this.toolbar.setVisible("fontFamily",
|
|
4196
|
+
this.toolbar.setVisible("bold", _(t, "bold")), this.toolbar.setVisible("italic", _(t, "italic")), this.toolbar.setVisible("underline", _(t, "underline")), this.toolbar.setVisible("strike", _(t, "strike")), this.toolbar.setVisible("fontFamily", Le(t)), this.toolbar.setVisible("fontSize", Ae(t)), this.toolbar.setVisible("color", V(t)), this.toolbar.setVisible("backgroundColor", V(t)), this.toolbar.setVisible("align", ie(t)), this.toolbar.setVisible("cellBg", Y(t)), this.toolbar.setVisible("tableMenu", Y(t)), this.toolbar.setVisible("codeLang", (t == null ? void 0 : t.kind) === "codeBlock"), this.toolbar.syncGroupVisibility();
|
|
3967
4197
|
}
|
|
3968
4198
|
}
|
|
3969
4199
|
}
|
|
3970
4200
|
function _(n, e) {
|
|
3971
|
-
return n ? (
|
|
3972
|
-
}
|
|
3973
|
-
function Ee(n) {
|
|
3974
|
-
return n ? (H[n.kind] ?? H.unknown).allowsInlineFormat : !1;
|
|
4201
|
+
return n ? (N[n.kind] ?? N.unknown).allowedMarks.includes(e) : !1;
|
|
3975
4202
|
}
|
|
3976
|
-
const kn = /* @__PURE__ */ new Set([
|
|
3977
|
-
"paragraph",
|
|
3978
|
-
"bulletList",
|
|
3979
|
-
"orderedList",
|
|
3980
|
-
"blockquote",
|
|
3981
|
-
"codeBlock",
|
|
3982
|
-
"table"
|
|
3983
|
-
]);
|
|
3984
4203
|
function Le(n) {
|
|
3985
|
-
return n ?
|
|
4204
|
+
return n ? (N[n.kind] ?? N.unknown).allowsInlineFormat : !1;
|
|
3986
4205
|
}
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
"bulletList",
|
|
3990
|
-
"orderedList",
|
|
3991
|
-
"table"
|
|
3992
|
-
]);
|
|
3993
|
-
function Y(n) {
|
|
3994
|
-
return n ? vn.has(n.kind) : !1;
|
|
4206
|
+
function Ae(n) {
|
|
4207
|
+
return n ? (N[n.kind] ?? N.unknown).allowsFontSize : !1;
|
|
3995
4208
|
}
|
|
3996
|
-
|
|
4209
|
+
function V(n) {
|
|
4210
|
+
return n ? (N[n.kind] ?? N.unknown).allowsColor : !1;
|
|
4211
|
+
}
|
|
4212
|
+
const En = /* @__PURE__ */ new Set([
|
|
3997
4213
|
"paragraph",
|
|
3998
4214
|
"heading",
|
|
3999
4215
|
"blockquote",
|
|
4000
4216
|
"table"
|
|
4001
4217
|
]);
|
|
4002
4218
|
function ie(n) {
|
|
4003
|
-
return n ?
|
|
4219
|
+
return n ? En.has(n.kind) : !1;
|
|
4004
4220
|
}
|
|
4005
|
-
function
|
|
4221
|
+
function Y(n) {
|
|
4006
4222
|
return (n == null ? void 0 : n.kind) === "table";
|
|
4007
4223
|
}
|
|
4008
|
-
function
|
|
4224
|
+
function Ln(n) {
|
|
4009
4225
|
const e = document.getSelection();
|
|
4010
4226
|
if (!e || e.rangeCount === 0) return null;
|
|
4011
4227
|
const t = e.getRangeAt(0);
|
|
@@ -4017,23 +4233,23 @@ function xn(n) {
|
|
|
4017
4233
|
const i = o.toString().length;
|
|
4018
4234
|
return { start: l, end: i };
|
|
4019
4235
|
}
|
|
4020
|
-
function
|
|
4236
|
+
function An(n, e) {
|
|
4021
4237
|
var u;
|
|
4022
4238
|
const t = document.createTreeWalker(n, NodeFilter.SHOW_TEXT);
|
|
4023
|
-
let o = 0, l = null, i = 0, r = null, s = 0,
|
|
4024
|
-
for (;
|
|
4025
|
-
const m = ((u =
|
|
4026
|
-
if (!l && o + m >= e.start && (l =
|
|
4027
|
-
r =
|
|
4239
|
+
let o = 0, l = null, i = 0, r = null, s = 0, a = t.nextNode();
|
|
4240
|
+
for (; a; ) {
|
|
4241
|
+
const m = ((u = a.textContent) == null ? void 0 : u.length) ?? 0;
|
|
4242
|
+
if (!l && o + m >= e.start && (l = a, i = e.start - o), !r && o + m >= e.end) {
|
|
4243
|
+
r = a, s = e.end - o;
|
|
4028
4244
|
break;
|
|
4029
4245
|
}
|
|
4030
|
-
o += m,
|
|
4246
|
+
o += m, a = t.nextNode();
|
|
4031
4247
|
}
|
|
4032
4248
|
if (!l || !r) return;
|
|
4033
|
-
const
|
|
4034
|
-
|
|
4249
|
+
const c = document.createRange();
|
|
4250
|
+
c.setStart(l, i), c.setEnd(r, s);
|
|
4035
4251
|
const d = document.getSelection();
|
|
4036
|
-
d == null || d.removeAllRanges(), d == null || d.addRange(
|
|
4252
|
+
d == null || d.removeAllRanges(), d == null || d.addRange(c);
|
|
4037
4253
|
}
|
|
4038
4254
|
function G(n) {
|
|
4039
4255
|
let e = n;
|
|
@@ -4047,27 +4263,27 @@ function re(n, e, t) {
|
|
|
4047
4263
|
return [e];
|
|
4048
4264
|
const i = Array.from(n.querySelectorAll("tr")), r = i.indexOf(o), s = i.indexOf(l);
|
|
4049
4265
|
if (r < 0 || s < 0) return [e];
|
|
4050
|
-
const
|
|
4266
|
+
const a = Math.min(r, s), c = Math.max(r, s), d = Array.from(o.children).indexOf(e), u = Array.from(l.children).indexOf(t);
|
|
4051
4267
|
if (d < 0 || u < 0) return [e];
|
|
4052
|
-
const m = Math.min(d, u),
|
|
4053
|
-
for (let
|
|
4054
|
-
const
|
|
4055
|
-
if (
|
|
4056
|
-
for (let
|
|
4057
|
-
const
|
|
4058
|
-
|
|
4268
|
+
const m = Math.min(d, u), h = Math.max(d, u), f = [];
|
|
4269
|
+
for (let p = a; p <= c; p++) {
|
|
4270
|
+
const g = i[p];
|
|
4271
|
+
if (g)
|
|
4272
|
+
for (let b = m; b <= h; b++) {
|
|
4273
|
+
const v = g.children[b];
|
|
4274
|
+
v instanceof HTMLTableCellElement && f.push(v);
|
|
4059
4275
|
}
|
|
4060
4276
|
}
|
|
4061
|
-
return
|
|
4277
|
+
return f;
|
|
4062
4278
|
}
|
|
4063
|
-
function
|
|
4279
|
+
function Se(n, e, t) {
|
|
4064
4280
|
const o = n.getBoundingClientRect(), l = 6;
|
|
4065
4281
|
return e < o.left - l || e > o.right + l || t < o.top - l || t > o.bottom + l ? null : e >= o.right - l ? "right" : t >= o.bottom - l ? "bottom" : null;
|
|
4066
4282
|
}
|
|
4067
4283
|
function se(n, e, t) {
|
|
4068
|
-
return n.getAttribute("data-block-explicit") === "true" || !e.isEmpty(n) ? t.kind === "unknown" ? n.tagName.toLowerCase() :
|
|
4284
|
+
return n.getAttribute("data-block-explicit") === "true" || !e.isEmpty(n) ? t.kind === "unknown" ? n.tagName.toLowerCase() : un(t) : "?";
|
|
4069
4285
|
}
|
|
4070
|
-
function
|
|
4286
|
+
function Sn(n) {
|
|
4071
4287
|
const e = n.trim();
|
|
4072
4288
|
if (!e) return null;
|
|
4073
4289
|
let t;
|
|
@@ -4085,7 +4301,7 @@ function Ln(n) {
|
|
|
4085
4301
|
}
|
|
4086
4302
|
return null;
|
|
4087
4303
|
}
|
|
4088
|
-
function
|
|
4304
|
+
function Tn(n) {
|
|
4089
4305
|
var e;
|
|
4090
4306
|
try {
|
|
4091
4307
|
const l = new URL(n, "http://localhost").pathname.split("/").filter(Boolean).pop();
|
|
@@ -4094,14 +4310,14 @@ function An(n) {
|
|
|
4094
4310
|
return (((e = n.split("?")[0]) == null ? void 0 : e.split("#")[0]) ?? "").split("/").filter(Boolean).pop() ?? "";
|
|
4095
4311
|
}
|
|
4096
4312
|
}
|
|
4097
|
-
function
|
|
4313
|
+
function Nn(n) {
|
|
4098
4314
|
return n >= 1e6 ? `${(n / 1e6).toFixed(1)}M` : n >= 1e3 ? `${(n / 1e3).toFixed(1)}K` : `${n}`;
|
|
4099
4315
|
}
|
|
4100
|
-
function
|
|
4316
|
+
function Te(n, e, t) {
|
|
4101
4317
|
const o = document.createElement("button");
|
|
4102
4318
|
return o.type = "button", o.className = "aw-status-action", o.title = n, o.setAttribute("aria-label", n), o.innerHTML = e, o.addEventListener("mousedown", (l) => l.preventDefault()), o.addEventListener("click", t), o;
|
|
4103
4319
|
}
|
|
4104
|
-
function
|
|
4320
|
+
function Mn() {
|
|
4105
4321
|
return {
|
|
4106
4322
|
blocks: [],
|
|
4107
4323
|
activeBlockId: null,
|
|
@@ -4115,7 +4331,7 @@ function Z(n) {
|
|
|
4115
4331
|
return !1;
|
|
4116
4332
|
}
|
|
4117
4333
|
}
|
|
4118
|
-
const
|
|
4334
|
+
const Bn = /* @__PURE__ */ new Set([
|
|
4119
4335
|
"P",
|
|
4120
4336
|
"DIV",
|
|
4121
4337
|
"SECTION",
|
|
@@ -4147,14 +4363,14 @@ const Nn = /* @__PURE__ */ new Set([
|
|
|
4147
4363
|
"FIELDSET",
|
|
4148
4364
|
"ADDRESS"
|
|
4149
4365
|
]);
|
|
4150
|
-
function
|
|
4151
|
-
return
|
|
4366
|
+
function $n(n) {
|
|
4367
|
+
return Bn.has(n.toUpperCase());
|
|
4152
4368
|
}
|
|
4153
|
-
class
|
|
4369
|
+
class In {
|
|
4154
4370
|
constructor(e) {
|
|
4155
4371
|
w(this, "root");
|
|
4156
4372
|
w(this, "content");
|
|
4157
|
-
w(this, "blockIds", new
|
|
4373
|
+
w(this, "blockIds", new Fe());
|
|
4158
4374
|
w(this, "idFor", (e) => this.blockIds.ensure(e));
|
|
4159
4375
|
w(this, "destroyed", !1);
|
|
4160
4376
|
if (!(e.element instanceof HTMLElement))
|
|
@@ -4169,11 +4385,11 @@ class Rn {
|
|
|
4169
4385
|
* 경로를 거치지 않는다.
|
|
4170
4386
|
*/
|
|
4171
4387
|
setBlocks(e) {
|
|
4172
|
-
|
|
4388
|
+
mn(this.content, e), ce(this.content, this.blockIds);
|
|
4173
4389
|
}
|
|
4174
4390
|
/** 현재 본문의 BlockSnapshot 배열을 반환한다. */
|
|
4175
4391
|
getBlocks() {
|
|
4176
|
-
return
|
|
4392
|
+
return Pe(this.listBlocksInternal());
|
|
4177
4393
|
}
|
|
4178
4394
|
/** 임의의 노드를 받아 그 노드가 속한 블록을 반환한다. 본문 밖이면 null. */
|
|
4179
4395
|
getBlockOf(e) {
|
|
@@ -4184,8 +4400,8 @@ class Rn {
|
|
|
4184
4400
|
* 보이도록 portable 인라인 스타일을 입힌 자급자족적 HTML 을 반환한다.
|
|
4185
4401
|
*/
|
|
4186
4402
|
getHTML() {
|
|
4187
|
-
const e = this.content.cloneNode(!0), t =
|
|
4188
|
-
return (o === "light" || o === "dark") && (t.mode = o),
|
|
4403
|
+
const e = this.content.cloneNode(!0), t = qe(this.root), o = this.root.dataset.theme;
|
|
4404
|
+
return (o === "light" || o === "dark") && (t.mode = o), Oe(e, t), _e(e), e.innerHTML;
|
|
4189
4405
|
}
|
|
4190
4406
|
setTheme(e) {
|
|
4191
4407
|
this.root.dataset.theme = e;
|
|
@@ -4200,28 +4416,28 @@ class Rn {
|
|
|
4200
4416
|
typeof globalThis.AerizWysiwyg == "object" && (globalThis.AerizEditor = globalThis.AerizWysiwyg.AerizEditor, globalThis.AerizViewer = globalThis.AerizWysiwyg.AerizViewer);
|
|
4201
4417
|
export {
|
|
4202
4418
|
Q as ALL_INLINE_MARKS,
|
|
4203
|
-
|
|
4204
|
-
|
|
4419
|
+
Rn as AerizEditor,
|
|
4420
|
+
In as AerizViewer,
|
|
4205
4421
|
F as BLOCK_ID_ATTR,
|
|
4206
4422
|
He as BLOCK_TYPES,
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
|
|
4423
|
+
N as BLOCK_TYPE_BY_KIND,
|
|
4424
|
+
Fe as BlockIdRegistry,
|
|
4425
|
+
Ve as DEFAULT_TOOLBAR,
|
|
4426
|
+
Oe as applyBlockInlineStyles,
|
|
4211
4427
|
ce as assignMissingIds,
|
|
4212
4428
|
U as classifyBlockElement,
|
|
4213
|
-
|
|
4214
|
-
|
|
4429
|
+
fn as extractInlineContent,
|
|
4430
|
+
gn as fillInlineContent,
|
|
4215
4431
|
ue as findBlockFrom,
|
|
4216
|
-
|
|
4432
|
+
un as getBlockLabel,
|
|
4217
4433
|
q as isElementBlank,
|
|
4218
4434
|
de as listBlocks,
|
|
4219
4435
|
we as normalizeContent,
|
|
4220
4436
|
O as placeCaretAtStart,
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4437
|
+
qe as readBlockStyleTheme,
|
|
4438
|
+
hn as renderBlock,
|
|
4439
|
+
mn as renderBlocks,
|
|
4440
|
+
pn as serializeBlock,
|
|
4441
|
+
Pe as serializeBlocks,
|
|
4442
|
+
_e as stripEditorOnlyAttrs
|
|
4227
4443
|
};
|