@hiai-gg/docsmint 0.7.0 → 0.7.3
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 +97 -103
- package/dist/backend/index.js +2 -2
- package/dist/frontend/CategoryDialog-bQKMpVFD.js +631 -0
- package/dist/frontend/ConfirmDialog-DF7kgkyq.js +139 -0
- package/dist/frontend/CreateSnapshotDialog-CojnWChs.js +222 -0
- package/dist/frontend/{DatePicker-DsoepNdb.js → DatePicker-7FAbIOGg.js} +4 -4
- package/dist/frontend/DeleteDialog-BIlqRb1u.js +179 -0
- package/dist/frontend/{FolderNode-CNwi0ySr.js → FolderNode-Cf443LBa.js} +2 -2
- package/dist/frontend/{HiAiEditor-B1EDGsnA.js → HiAiEditor-CMZ-eL8s.js} +961 -955
- package/dist/frontend/SettingsDialog-DatuxOVX.js +980 -0
- package/dist/frontend/{ShareDialog-wGTXuXFE.js → ShareDialog-Bwz2y3Le.js} +2 -2
- package/dist/frontend/Sidebar-C_t5RrOJ.js +2101 -0
- package/dist/frontend/TagCreateDialog-Ch21yuWV.js +266 -0
- package/dist/frontend/app-shell.d.ts +3 -1
- package/dist/frontend/app-shell.js +155 -152
- package/dist/frontend/components/category-dialog.js +1 -1
- package/dist/frontend/components/create-snapshot-dialog.js +1 -1
- package/dist/frontend/components/delete-dialog.js +1 -1
- package/dist/frontend/components/editor/compact-editor.js +1 -1
- package/dist/frontend/components/editor/document-editor.js +1 -1
- package/dist/frontend/components/editor/document-title.js +1 -1
- package/dist/frontend/components/editor/extensions.js +1 -1
- package/dist/frontend/components/editor/markdown-toggle.js +2 -2
- package/dist/frontend/components/editor/markdown.js +1 -1
- package/dist/frontend/components/folder-node.js +1 -1
- package/dist/frontend/components/save-as-dialog.js +232 -227
- package/dist/frontend/components/settings.js +1 -1
- package/dist/frontend/components/share-dialog.js +1 -1
- package/dist/frontend/components/sidebar.js +1 -1
- package/dist/frontend/components/tag-create-dialog.js +1 -1
- package/dist/frontend/components/version-history.js +3 -3
- package/dist/frontend/confirm-dialog-8T6vsWL7.js +265 -0
- package/dist/frontend/dashboard.js +600 -592
- package/dist/frontend/dialog-CiSwD-_v.js +253 -0
- package/dist/frontend/{dropdown-menu-BXIl2E26.js → dropdown-menu-Bi5Iipwf.js} +6 -6
- package/dist/frontend/editor-content-sanitizer-CC_A8aaI.js +112 -0
- package/dist/frontend/{editorExtensions-BmINh76i.js → editorExtensions--HusV819.js} +3356 -3423
- package/dist/frontend/frontend.css +1 -1
- package/dist/frontend/i18n.js +1 -1
- package/dist/frontend/{input-eHFb2qiL.js → input-N9dNSOWF.js} +2 -2
- package/dist/frontend/{label-_I1iiaNU.js → label-CK72_fw8.js} +2 -2
- package/dist/frontend/{markdown-A5xji16P.js → markdown-H6QB53zu.js} +1 -1
- package/dist/frontend/messages-DTRe4U2V.js +1093 -0
- package/dist/frontend/search.js +3 -3
- package/dist/frontend/{select-value-CtMyrvDJ.js → select-value-BD1DToYs.js} +6 -6
- package/dist/frontend/shared-document.js +95 -92
- package/dist/frontend/{textarea-2eslfANY.js → textarea-pl_fDBre.js} +2 -2
- package/dist/frontend/theme.js +1 -1
- package/dist/frontend/theme.svelte-DG3RS7wv.js +101 -0
- package/dist/frontend/{utils-CDBqTgoV.js → utils-CMQRlxbx.js} +1 -1
- package/dist/frontend-ssr/app-shell.js +9 -5
- package/dist/frontend-ssr/assets/CategoryDialog-DsXe54EF.js +608 -0
- package/dist/frontend-ssr/assets/ConfirmDialog-DrH653ua.js +136 -0
- package/dist/frontend-ssr/assets/{CreateSnapshotDialog-BZ45odvJ.js → CreateSnapshotDialog-D3-PjXVr.js} +93 -88
- package/dist/frontend-ssr/assets/{DatePicker-CPtl6W5E.js → DatePicker-C9suIA1S.js} +4 -4
- package/dist/frontend-ssr/assets/DeleteDialog-DxtMrS1O.js +159 -0
- package/dist/frontend-ssr/assets/{FolderNode-D9kgJG9d.js → FolderNode-ChD10Elp.js} +2 -2
- package/dist/frontend-ssr/assets/{HiAiEditor-DOd2MXjD.js → HiAiEditor-2X3Uyg1B.js} +60 -54
- package/dist/frontend-ssr/assets/{SettingsDialog-CIVbMKmf.js → SettingsDialog-DDy0hN8x.js} +373 -361
- package/dist/frontend-ssr/assets/{ShareDialog-D2UNUbF7.js → ShareDialog-BwW_wF4G.js} +2 -2
- package/dist/frontend-ssr/assets/{Sidebar-Bb-k2R-Z.js → Sidebar-Dy-5gXOf.js} +170 -129
- package/dist/frontend-ssr/assets/{TagCreateDialog-6Gk7L3D-.js → TagCreateDialog-BPzgOaX8.js} +94 -89
- package/dist/frontend-ssr/assets/{confirm-dialog-B9MVS_bF.js → confirm-dialog-wYC07DPx.js} +109 -89
- package/dist/frontend-ssr/assets/{dialog-1SB5neow.js → dialog-ClcuF7nD.js} +47 -12
- package/dist/frontend-ssr/assets/{dropdown-menu-DqoOkdqB.js → dropdown-menu-BKMGVNLL.js} +6 -6
- package/dist/frontend-ssr/assets/editor-content-sanitizer-Gjm93iR-.js +145 -0
- package/dist/frontend-ssr/assets/{editorExtensions-BwGeSPuX.js → editorExtensions-qNlZVP98.js} +2 -88
- package/dist/frontend-ssr/assets/{input-Df-QP3Km.js → input-DcDR8L8M.js} +2 -2
- package/dist/frontend-ssr/assets/{label-CbUOUz6L.js → label-Cz0_svJx.js} +2 -2
- package/dist/frontend-ssr/assets/{markdown-CB8DZ-LT.js → markdown-MhPwNWrC.js} +1 -1
- package/dist/frontend-ssr/assets/{messages-BAQzILs4.js → messages-B1TjVIH8.js} +2 -2
- package/dist/frontend-ssr/assets/{select-value-CXEDWrZg.js → select-value-CaDktvDW.js} +6 -6
- package/dist/frontend-ssr/assets/{textarea-CHh8NuSS.js → textarea-BGrjPOgU.js} +2 -2
- package/dist/frontend-ssr/assets/theme.svelte-CN3BUhJG.js +136 -0
- package/dist/frontend-ssr/assets/{utils-DtX0ta7y.js → utils-Cg_R05dR.js} +1 -1
- package/dist/frontend-ssr/components/category-dialog.js +1 -1
- package/dist/frontend-ssr/components/create-snapshot-dialog.js +1 -1
- package/dist/frontend-ssr/components/delete-dialog.js +1 -1
- package/dist/frontend-ssr/components/editor/compact-editor.js +1 -1
- package/dist/frontend-ssr/components/editor/document-editor.js +1 -1
- package/dist/frontend-ssr/components/editor/document-title.js +1 -1
- package/dist/frontend-ssr/components/editor/extensions.js +1 -1
- package/dist/frontend-ssr/components/editor/markdown-toggle.js +2 -2
- package/dist/frontend-ssr/components/editor/markdown.js +1 -1
- package/dist/frontend-ssr/components/folder-node.js +1 -1
- package/dist/frontend-ssr/components/save-as-dialog.js +177 -172
- package/dist/frontend-ssr/components/settings.js +1 -1
- package/dist/frontend-ssr/components/share-dialog.js +1 -1
- package/dist/frontend-ssr/components/sidebar.js +1 -1
- package/dist/frontend-ssr/components/tag-create-dialog.js +1 -1
- package/dist/frontend-ssr/components/version-history.js +3 -3
- package/dist/frontend-ssr/dashboard.js +102 -95
- package/dist/frontend-ssr/i18n.js +1 -1
- package/dist/frontend-ssr/search.js +3 -3
- package/dist/frontend-ssr/shared-document.js +3 -0
- package/dist/frontend-ssr/theme.js +1 -1
- package/dist/mcp-cli.js +1 -1
- package/dist/mcp-server.js +1 -1
- package/package.json +1 -1
- package/packages/cli/src/index.ts +4 -3
- package/server.json +43 -6
- package/dist/frontend/CategoryDialog-C67_TXf0.js +0 -626
- package/dist/frontend/ConfirmDialog-_LlrA--f.js +0 -134
- package/dist/frontend/CreateSnapshotDialog-BmCRpOMv.js +0 -217
- package/dist/frontend/DeleteDialog-L1A3FhMM.js +0 -174
- package/dist/frontend/SettingsDialog-AP42xOGg.js +0 -969
- package/dist/frontend/Sidebar-lKQT3dEf.js +0 -2060
- package/dist/frontend/TagCreateDialog-su8BhLzS.js +0 -261
- package/dist/frontend/confirm-dialog-BG8y2Pum.js +0 -250
- package/dist/frontend/dialog-C2iKObEu.js +0 -213
- package/dist/frontend/messages-DIovIZrK.js +0 -1093
- package/dist/frontend/theme.svelte-DKfCy12k.js +0 -49
- package/dist/frontend-ssr/assets/CategoryDialog-BGuHTb3K.js +0 -603
- package/dist/frontend-ssr/assets/ConfirmDialog-D1BDXXll.js +0 -131
- package/dist/frontend-ssr/assets/DeleteDialog-oHT_p_vG.js +0 -154
- package/dist/frontend-ssr/assets/theme.svelte-Co0-ssaD.js +0 -67
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { O as doc_new_folder_name, _n as action_cancel, _r as folders_rename, bn as error_generic, br as folders_new, mn as action_create, vn as action_save } from "./messages-
|
|
1
|
+
import { O as doc_new_folder_name, _n as action_cancel, _r as folders_rename, bn as error_generic, br as folders_new, mn as action_create, vn as action_save } from "./messages-B1TjVIH8.js";
|
|
2
2
|
import { t as Icon } from "./Icon-QwirKi9Y.js";
|
|
3
3
|
import { t as Circle_check } from "./circle-check-CPS9dKEo.js";
|
|
4
4
|
import { t as Loader_circle } from "./loader-circle-CIEWGyfP.js";
|
|
5
|
-
import { a as
|
|
6
|
-
import { t as Input } from "./input-
|
|
7
|
-
import { t as Label } from "./label-
|
|
8
|
-
import "./ConfirmDialog-
|
|
5
|
+
import { a as Dialog_content, i as Dialog_description, n as Dialog_header, o as Dialog, r as Dialog_footer, s as Button, t as Dialog_title } from "./dialog-ClcuF7nD.js";
|
|
6
|
+
import { t as Input } from "./input-DcDR8L8M.js";
|
|
7
|
+
import { t as Label } from "./label-Cz0_svJx.js";
|
|
8
|
+
import "./ConfirmDialog-DrH653ua.js";
|
|
9
9
|
import * as $ from "svelte/internal/server";
|
|
10
|
+
import { getContext, setContext } from "svelte";
|
|
10
11
|
//#region ../node_modules/.bun/lucide-svelte@0.577.0+ff5f301bb2db9a0d/node_modules/lucide-svelte/dist/icons/check.svelte
|
|
11
12
|
function Check($$renderer, $$props) {
|
|
12
13
|
const $$sanitized_props = $.sanitize_props($$props);
|
|
@@ -291,107 +292,113 @@ function FolderDialog($$renderer, $$props) {
|
|
|
291
292
|
$$settled = false;
|
|
292
293
|
},
|
|
293
294
|
children: ($$renderer) => {
|
|
294
|
-
|
|
295
|
+
Dialog_content($$renderer, {
|
|
295
296
|
children: ($$renderer) => {
|
|
296
|
-
|
|
297
|
+
Dialog_header($$renderer, {
|
|
297
298
|
children: ($$renderer) => {
|
|
298
|
-
$$renderer
|
|
299
|
+
Dialog_title($$renderer, {
|
|
300
|
+
children: ($$renderer) => {
|
|
301
|
+
$$renderer.push(`<!---->${$.escape(title())}`);
|
|
302
|
+
},
|
|
303
|
+
$$slots: { default: true }
|
|
304
|
+
});
|
|
305
|
+
$$renderer.push(`<!----> `);
|
|
306
|
+
Dialog_description($$renderer, {
|
|
307
|
+
children: ($$renderer) => {
|
|
308
|
+
$$renderer.push(`<!---->${$.escape(mode === "edit" ? folders_rename() : doc_new_folder_name())}`);
|
|
309
|
+
},
|
|
310
|
+
$$slots: { default: true }
|
|
311
|
+
});
|
|
312
|
+
$$renderer.push(`<!---->`);
|
|
299
313
|
},
|
|
300
314
|
$$slots: { default: true }
|
|
301
315
|
});
|
|
302
316
|
$$renderer.push(`<!----> `);
|
|
303
|
-
Dialog_description($$renderer, {
|
|
304
|
-
children: ($$renderer) => {
|
|
305
|
-
$$renderer.push(`<!---->${$.escape(mode === "edit" ? folders_rename() : doc_new_folder_name())}`);
|
|
306
|
-
},
|
|
307
|
-
$$slots: { default: true }
|
|
308
|
-
});
|
|
309
|
-
$$renderer.push(`<!---->`);
|
|
310
|
-
},
|
|
311
|
-
$$slots: { default: true }
|
|
312
|
-
});
|
|
313
|
-
$$renderer.push(`<!----> `);
|
|
314
|
-
if (createdFolderName) {
|
|
315
|
-
$$renderer.push("<!--[0-->");
|
|
316
|
-
$$renderer.push(`<div class="space-y-3 rounded-lg border border-primary/30 bg-primary/10 p-4" role="status" aria-live="polite"><div class="flex items-start gap-3">`);
|
|
317
|
-
Circle_check($$renderer, { class: "mt-0.5 size-5 shrink-0 text-primary" });
|
|
318
|
-
$$renderer.push(`<!----> <div><p class="text-sm font-medium text-foreground">Folder created</p> <p class="text-sm text-muted-foreground">${$.escape(createdFolderName)} is ready to use.</p></div></div></div>`);
|
|
319
|
-
} else {
|
|
320
|
-
$$renderer.push("<!--[-1-->");
|
|
321
|
-
$$renderer.push(`<form class="space-y-4"><div class="space-y-2">`);
|
|
322
|
-
Label($$renderer, {
|
|
323
|
-
for: "folder-dialog-name",
|
|
324
|
-
children: ($$renderer) => {
|
|
325
|
-
$$renderer.push(`<!---->${$.escape(doc_new_folder_name())}`);
|
|
326
|
-
},
|
|
327
|
-
$$slots: { default: true }
|
|
328
|
-
});
|
|
329
|
-
$$renderer.push(`<!----> `);
|
|
330
|
-
Input($$renderer, {
|
|
331
|
-
id: "folder-dialog-name",
|
|
332
|
-
name: "name",
|
|
333
|
-
type: "text",
|
|
334
|
-
placeholder: doc_new_folder_name(),
|
|
335
|
-
maxlength: 255,
|
|
336
|
-
required: true,
|
|
337
|
-
disabled: busy,
|
|
338
|
-
"aria-invalid": error ? "true" : void 0,
|
|
339
|
-
"aria-describedby": error ? "folder-dialog-name-error" : void 0,
|
|
340
|
-
autocomplete: "off",
|
|
341
|
-
get value() {
|
|
342
|
-
return name;
|
|
343
|
-
},
|
|
344
|
-
set value($$value) {
|
|
345
|
-
name = $$value;
|
|
346
|
-
$$settled = false;
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
$$renderer.push(`<!----> `);
|
|
350
|
-
if (error) {
|
|
351
|
-
$$renderer.push("<!--[0-->");
|
|
352
|
-
$$renderer.push(`<p id="folder-dialog-name-error" class="text-xs text-destructive" role="alert">${$.escape(error)}</p>`);
|
|
353
|
-
} else $$renderer.push("<!--[-1-->");
|
|
354
|
-
$$renderer.push(`<!--]--></div></form>`);
|
|
355
|
-
}
|
|
356
|
-
$$renderer.push(`<!--]--> `);
|
|
357
|
-
Dialog_footer($$renderer, {
|
|
358
|
-
class: "gap-2 max-sm:flex-col max-sm:items-stretch",
|
|
359
|
-
children: ($$renderer) => {
|
|
360
317
|
if (createdFolderName) {
|
|
361
318
|
$$renderer.push("<!--[0-->");
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
319
|
+
$$renderer.push(`<div class="space-y-3 rounded-lg border border-primary/30 bg-primary/10 p-4" role="status" aria-live="polite"><div class="flex items-start gap-3">`);
|
|
320
|
+
Circle_check($$renderer, { class: "mt-0.5 size-5 shrink-0 text-primary" });
|
|
321
|
+
$$renderer.push(`<!----> <div><p class="text-sm font-medium text-foreground">Folder created</p> <p class="text-sm text-muted-foreground">${$.escape(createdFolderName)} is ready to use.</p></div></div></div>`);
|
|
322
|
+
} else {
|
|
323
|
+
$$renderer.push("<!--[-1-->");
|
|
324
|
+
$$renderer.push(`<form class="space-y-4"><div class="space-y-2">`);
|
|
325
|
+
Label($$renderer, {
|
|
326
|
+
for: "folder-dialog-name",
|
|
366
327
|
children: ($$renderer) => {
|
|
367
|
-
$$renderer.push(
|
|
328
|
+
$$renderer.push(`<!---->${$.escape(doc_new_folder_name())}`);
|
|
368
329
|
},
|
|
369
330
|
$$slots: { default: true }
|
|
370
331
|
});
|
|
371
|
-
|
|
372
|
-
$$renderer
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
type: "
|
|
376
|
-
|
|
332
|
+
$$renderer.push(`<!----> `);
|
|
333
|
+
Input($$renderer, {
|
|
334
|
+
id: "folder-dialog-name",
|
|
335
|
+
name: "name",
|
|
336
|
+
type: "text",
|
|
337
|
+
placeholder: doc_new_folder_name(),
|
|
338
|
+
maxlength: 255,
|
|
339
|
+
required: true,
|
|
377
340
|
disabled: busy,
|
|
378
|
-
|
|
379
|
-
|
|
341
|
+
"aria-invalid": error ? "true" : void 0,
|
|
342
|
+
"aria-describedby": error ? "folder-dialog-name-error" : void 0,
|
|
343
|
+
autocomplete: "off",
|
|
344
|
+
get value() {
|
|
345
|
+
return name;
|
|
380
346
|
},
|
|
381
|
-
$$
|
|
347
|
+
set value($$value) {
|
|
348
|
+
name = $$value;
|
|
349
|
+
$$settled = false;
|
|
350
|
+
}
|
|
382
351
|
});
|
|
352
|
+
$$renderer.push(`<!----> `);
|
|
353
|
+
if (error) {
|
|
354
|
+
$$renderer.push("<!--[0-->");
|
|
355
|
+
$$renderer.push(`<p id="folder-dialog-name-error" class="text-xs text-destructive" role="alert">${$.escape(error)}</p>`);
|
|
356
|
+
} else $$renderer.push("<!--[-1-->");
|
|
357
|
+
$$renderer.push(`<!--]--></div></form>`);
|
|
383
358
|
}
|
|
384
359
|
$$renderer.push(`<!--]--> `);
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
onclick: createdFolderName ? () => close() : handleSubmit,
|
|
388
|
-
disabled: busy || !createdFolderName && trimmedName().length === 0,
|
|
360
|
+
Dialog_footer($$renderer, {
|
|
361
|
+
class: "gap-2 max-sm:flex-col max-sm:items-stretch",
|
|
389
362
|
children: ($$renderer) => {
|
|
390
|
-
if (
|
|
363
|
+
if (createdFolderName) {
|
|
391
364
|
$$renderer.push("<!--[0-->");
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
365
|
+
Button($$renderer, {
|
|
366
|
+
variant: "outline",
|
|
367
|
+
type: "button",
|
|
368
|
+
onclick: createAnother,
|
|
369
|
+
children: ($$renderer) => {
|
|
370
|
+
$$renderer.push(`<!---->Create another`);
|
|
371
|
+
},
|
|
372
|
+
$$slots: { default: true }
|
|
373
|
+
});
|
|
374
|
+
} else {
|
|
375
|
+
$$renderer.push("<!--[-1-->");
|
|
376
|
+
Button($$renderer, {
|
|
377
|
+
variant: "outline",
|
|
378
|
+
type: "button",
|
|
379
|
+
onclick: () => close(),
|
|
380
|
+
disabled: busy,
|
|
381
|
+
children: ($$renderer) => {
|
|
382
|
+
$$renderer.push(`<!---->${$.escape(action_cancel())}`);
|
|
383
|
+
},
|
|
384
|
+
$$slots: { default: true }
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
$$renderer.push(`<!--]--> `);
|
|
388
|
+
Button($$renderer, {
|
|
389
|
+
type: "submit",
|
|
390
|
+
onclick: createdFolderName ? () => close() : handleSubmit,
|
|
391
|
+
disabled: busy || !createdFolderName && trimmedName().length === 0,
|
|
392
|
+
children: ($$renderer) => {
|
|
393
|
+
if (busy) {
|
|
394
|
+
$$renderer.push("<!--[0-->");
|
|
395
|
+
Loader_circle($$renderer, { class: "mr-1 size-4 animate-spin" });
|
|
396
|
+
} else $$renderer.push("<!--[-1-->");
|
|
397
|
+
$$renderer.push(`<!--]--> ${$.escape(createdFolderName ? "Done" : submitLabel())}`);
|
|
398
|
+
},
|
|
399
|
+
$$slots: { default: true }
|
|
400
|
+
});
|
|
401
|
+
$$renderer.push(`<!---->`);
|
|
395
402
|
},
|
|
396
403
|
$$slots: { default: true }
|
|
397
404
|
});
|
|
@@ -399,7 +406,6 @@ function FolderDialog($$renderer, $$props) {
|
|
|
399
406
|
},
|
|
400
407
|
$$slots: { default: true }
|
|
401
408
|
});
|
|
402
|
-
$$renderer.push(`<!---->`);
|
|
403
409
|
},
|
|
404
410
|
$$slots: { default: true }
|
|
405
411
|
});
|
|
@@ -414,4 +420,18 @@ function FolderDialog($$renderer, $$props) {
|
|
|
414
420
|
});
|
|
415
421
|
}
|
|
416
422
|
//#endregion
|
|
417
|
-
|
|
423
|
+
//#region src/lib/hosts/share-context.ts
|
|
424
|
+
var SHARE_ADAPTER = Symbol("docsmint-share-adapter");
|
|
425
|
+
var standaloneShare = { displayMode: "standalone" };
|
|
426
|
+
function provideDocsmintShareAdapter(adapter) {
|
|
427
|
+
setContext(SHARE_ADAPTER, adapter);
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Reads the host share contour. Standalone OSS (no AppShellHost share prop)
|
|
431
|
+
* always gets a public-link dialog.
|
|
432
|
+
*/
|
|
433
|
+
function getDocsmintShareAdapter() {
|
|
434
|
+
return getContext(SHARE_ADAPTER) ?? standaloneShare;
|
|
435
|
+
}
|
|
436
|
+
//#endregion
|
|
437
|
+
export { File_text as a, Plus as i, provideDocsmintShareAdapter as n, Check as o, FolderDialog as r, getDocsmintShareAdapter as t };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { t as cn } from "./utils-
|
|
1
|
+
import { t as cn } from "./utils-Cg_R05dR.js";
|
|
2
2
|
import * as $ from "svelte/internal/server";
|
|
3
|
+
import { getContext, setContext } from "svelte";
|
|
3
4
|
import { tv } from "tailwind-variants";
|
|
4
|
-
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.
|
|
5
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/button/button.svelte
|
|
5
6
|
function Button($$renderer, $$props) {
|
|
6
7
|
$$renderer.component(($$renderer) => {
|
|
7
8
|
let { class: className, variant = "default", size = "default", ref = null, href = void 0, children, $$slots, $$events, ...restProps } = $$props;
|
|
@@ -42,7 +43,7 @@ function Button($$renderer, $$props) {
|
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
//#endregion
|
|
45
|
-
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.
|
|
46
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/button/index.js
|
|
46
47
|
var buttonVariants = tv({
|
|
47
48
|
base: "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
48
49
|
variants: {
|
|
@@ -67,13 +68,48 @@ var buttonVariants = tv({
|
|
|
67
68
|
}
|
|
68
69
|
});
|
|
69
70
|
//#endregion
|
|
70
|
-
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.
|
|
71
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/dialog/dialog.svelte
|
|
71
72
|
function Dialog($$renderer, $$props) {
|
|
72
73
|
$$renderer.component(($$renderer) => {
|
|
73
74
|
let { open = false, onOpenChange, children } = $$props;
|
|
74
|
-
|
|
75
|
+
function close() {
|
|
76
|
+
open = false;
|
|
77
|
+
onOpenChange?.(false);
|
|
78
|
+
}
|
|
79
|
+
setContext("DIALOG_CONTEXT", {
|
|
80
|
+
get open() {
|
|
81
|
+
return open;
|
|
82
|
+
},
|
|
83
|
+
set open(v) {
|
|
84
|
+
open = v;
|
|
85
|
+
onOpenChange?.(v);
|
|
86
|
+
},
|
|
87
|
+
close
|
|
88
|
+
});
|
|
89
|
+
if (children) {
|
|
75
90
|
$$renderer.push("<!--[0-->");
|
|
76
|
-
$$renderer
|
|
91
|
+
children($$renderer);
|
|
92
|
+
$$renderer.push(`<!---->`);
|
|
93
|
+
} else $$renderer.push("<!--[-1-->");
|
|
94
|
+
$$renderer.push(`<!--]-->`);
|
|
95
|
+
$.bind_props($$props, { open });
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/dialog/dialog-content.svelte
|
|
100
|
+
function Dialog_content($$renderer, $$props) {
|
|
101
|
+
$$renderer.component(($$renderer) => {
|
|
102
|
+
let { class: className, children, $$slots, $$events, ...restProps } = $$props;
|
|
103
|
+
const ctx = getContext("DIALOG_CONTEXT");
|
|
104
|
+
if (!ctx) throw new Error("DialogContent must be used within a Dialog component");
|
|
105
|
+
if (ctx.open) {
|
|
106
|
+
$$renderer.push("<!--[0-->");
|
|
107
|
+
$$renderer.push(`<div class="fixed inset-0 z-50 flex items-center justify-center"><div class="fixed inset-0 bg-black/80" aria-hidden="true"></div> <div${$.attributes({
|
|
108
|
+
class: $.clsx(cn("relative z-50 grid w-full max-w-lg gap-4 border bg-background p-6 shadow-lg sm:rounded-lg", className)),
|
|
109
|
+
role: "dialog",
|
|
110
|
+
"aria-modal": "true",
|
|
111
|
+
...restProps
|
|
112
|
+
})}>`);
|
|
77
113
|
if (children) {
|
|
78
114
|
$$renderer.push("<!--[0-->");
|
|
79
115
|
children($$renderer);
|
|
@@ -82,11 +118,10 @@ function Dialog($$renderer, $$props) {
|
|
|
82
118
|
$$renderer.push(`<!--]--></div></div>`);
|
|
83
119
|
} else $$renderer.push("<!--[-1-->");
|
|
84
120
|
$$renderer.push(`<!--]-->`);
|
|
85
|
-
$.bind_props($$props, { open });
|
|
86
121
|
});
|
|
87
122
|
}
|
|
88
123
|
//#endregion
|
|
89
|
-
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.
|
|
124
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/dialog/dialog-description.svelte
|
|
90
125
|
function Dialog_description($$renderer, $$props) {
|
|
91
126
|
$$renderer.component(($$renderer) => {
|
|
92
127
|
const { class: className, children, $$slots, $$events, ...restProps } = $$props;
|
|
@@ -103,7 +138,7 @@ function Dialog_description($$renderer, $$props) {
|
|
|
103
138
|
});
|
|
104
139
|
}
|
|
105
140
|
//#endregion
|
|
106
|
-
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.
|
|
141
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/dialog/dialog-footer.svelte
|
|
107
142
|
function Dialog_footer($$renderer, $$props) {
|
|
108
143
|
$$renderer.component(($$renderer) => {
|
|
109
144
|
const { class: className, children, $$slots, $$events, ...restProps } = $$props;
|
|
@@ -120,7 +155,7 @@ function Dialog_footer($$renderer, $$props) {
|
|
|
120
155
|
});
|
|
121
156
|
}
|
|
122
157
|
//#endregion
|
|
123
|
-
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.
|
|
158
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/dialog/dialog-header.svelte
|
|
124
159
|
function Dialog_header($$renderer, $$props) {
|
|
125
160
|
$$renderer.component(($$renderer) => {
|
|
126
161
|
const { class: className, children, $$slots, $$events, ...restProps } = $$props;
|
|
@@ -137,7 +172,7 @@ function Dialog_header($$renderer, $$props) {
|
|
|
137
172
|
});
|
|
138
173
|
}
|
|
139
174
|
//#endregion
|
|
140
|
-
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.
|
|
175
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/dialog/dialog-title.svelte
|
|
141
176
|
function Dialog_title($$renderer, $$props) {
|
|
142
177
|
$$renderer.component(($$renderer) => {
|
|
143
178
|
const { class: className, children, $$slots, $$events, ...restProps } = $$props;
|
|
@@ -154,4 +189,4 @@ function Dialog_title($$renderer, $$props) {
|
|
|
154
189
|
});
|
|
155
190
|
}
|
|
156
191
|
//#endregion
|
|
157
|
-
export {
|
|
192
|
+
export { Dialog_content as a, Dialog_description as i, Dialog_header as n, Dialog as o, Dialog_footer as r, Button as s, Dialog_title as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as Icon } from "./Icon-QwirKi9Y.js";
|
|
2
|
-
import { t as cn } from "./utils-
|
|
2
|
+
import { t as cn } from "./utils-Cg_R05dR.js";
|
|
3
3
|
import { Q as mergeProps, a as Floating_layer, c as MenuContentState, d as MenuMenuState, et as boxWith, f as MenuRootState, i as createId, n as Popper_layer_force_mount, o as getFloatingContentCSSVars, p as MenuSeparatorState, r as Popper_layer, s as DropdownMenuTriggerState, t as Floating_layer_anchor, u as MenuItemState, v as noop } from "./floating-layer-anchor-BoiiIEiK.js";
|
|
4
4
|
import * as $ from "svelte/internal/server";
|
|
5
5
|
//#region ../node_modules/.bun/lucide-svelte@0.577.0+ff5f301bb2db9a0d/node_modules/lucide-svelte/dist/icons/ellipsis-vertical.svelte
|
|
@@ -320,7 +320,7 @@ function Menu_separator($$renderer, $$props) {
|
|
|
320
320
|
});
|
|
321
321
|
}
|
|
322
322
|
//#endregion
|
|
323
|
-
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.
|
|
323
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/dropdown-menu/dropdown-menu.svelte
|
|
324
324
|
function Dropdown_menu($$renderer, $$props) {
|
|
325
325
|
const { children, $$slots, $$events, ...restProps } = $$props;
|
|
326
326
|
if (Menu) {
|
|
@@ -343,7 +343,7 @@ function Dropdown_menu($$renderer, $$props) {
|
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
//#endregion
|
|
346
|
-
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.
|
|
346
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/dropdown-menu/dropdown-menu-content.svelte
|
|
347
347
|
function Dropdown_menu_content($$renderer, $$props) {
|
|
348
348
|
$$renderer.component(($$renderer) => {
|
|
349
349
|
let { ref = null, class: className, sideOffset = 4, children, $$slots, $$events, ...restProps } = $$props;
|
|
@@ -393,7 +393,7 @@ function Dropdown_menu_content($$renderer, $$props) {
|
|
|
393
393
|
});
|
|
394
394
|
}
|
|
395
395
|
//#endregion
|
|
396
|
-
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.
|
|
396
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte
|
|
397
397
|
function Dropdown_menu_item($$renderer, $$props) {
|
|
398
398
|
$$renderer.component(($$renderer) => {
|
|
399
399
|
let { ref = null, class: className, inset, children, $$slots, $$events, ...restProps } = $$props;
|
|
@@ -440,7 +440,7 @@ function Dropdown_menu_item($$renderer, $$props) {
|
|
|
440
440
|
});
|
|
441
441
|
}
|
|
442
442
|
//#endregion
|
|
443
|
-
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.
|
|
443
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/dropdown-menu/dropdown-menu-separator.svelte
|
|
444
444
|
function Dropdown_menu_separator($$renderer, $$props) {
|
|
445
445
|
$$renderer.component(($$renderer) => {
|
|
446
446
|
let { ref = null, class: className, $$slots, $$events, ...restProps } = $$props;
|
|
@@ -478,7 +478,7 @@ function Dropdown_menu_separator($$renderer, $$props) {
|
|
|
478
478
|
});
|
|
479
479
|
}
|
|
480
480
|
//#endregion
|
|
481
|
-
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.
|
|
481
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/dropdown-menu/dropdown-menu-trigger.svelte
|
|
482
482
|
function Dropdown_menu_trigger($$renderer, $$props) {
|
|
483
483
|
$$renderer.component(($$renderer) => {
|
|
484
484
|
let { ref = null, child, children, $$slots, $$events, ...restProps } = $$props;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
//#region src/lib/components/editor/editor-content-sanitizer.ts
|
|
2
|
+
var ATTACHMENT_RAW_URL = /^\/api\/attachments\/[0-9a-f-]+\/raw$/i;
|
|
3
|
+
var EMOJI_IMAGE_HOST = /(?:abs\.twimg\.com\/emoji\/|twemoji\.maxcdn\.com\/|(?:cdnjs\.cloudflare\.com|cdn\.jsdelivr\.net)\/(?:ajax\/libs\/)?twemoji)/i;
|
|
4
|
+
var EMOJI_SVG_CODEPOINTS = /\/(?:emoji\/v2\/svg|twemoji\/[\d.]+\/(?:svg|72x72))\/([0-9a-f][0-9a-f-]*)\.svg(?:[?#].*)?$/i;
|
|
5
|
+
/** Matches the editor image-resize floor; larger explicit sizes stay photos. */
|
|
6
|
+
var EMOJI_IMAGE_MAX_PX = 96;
|
|
7
|
+
function isEmojiGrapheme(segment) {
|
|
8
|
+
return /^[\d#*]\uFE0F?\u20E3$/u.test(segment) || /^\p{Extended_Pictographic}/u.test(segment);
|
|
9
|
+
}
|
|
10
|
+
function isEmojiOnlyText(value) {
|
|
11
|
+
if (!value) return false;
|
|
12
|
+
try {
|
|
13
|
+
const segmenter = new Intl.Segmenter("en", { granularity: "grapheme" });
|
|
14
|
+
let count = 0;
|
|
15
|
+
for (const { segment } of segmenter.segment(value)) {
|
|
16
|
+
if (!isEmojiGrapheme(segment)) return false;
|
|
17
|
+
count += 1;
|
|
18
|
+
}
|
|
19
|
+
return count > 0;
|
|
20
|
+
} catch {
|
|
21
|
+
return /^(?:\p{Extended_Pictographic}|\d\uFE0F?\u20E3)+$/u.test(value);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function glyphFromEmojiSrc(src) {
|
|
25
|
+
const match = src.match(EMOJI_SVG_CODEPOINTS);
|
|
26
|
+
if (!match?.[1] || !/(?:\/emoji\/|\/twemoji\/)/i.test(src)) return null;
|
|
27
|
+
try {
|
|
28
|
+
return match[1].split("-").map((hex) => String.fromCodePoint(Number.parseInt(hex, 16))).join("");
|
|
29
|
+
} catch {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Twitter / Twemoji paste the glyph as an SVG image. Share CSS then stretches
|
|
35
|
+
* those viewBox-only SVGs to the full column. Return the Unicode glyph instead
|
|
36
|
+
* unless the operator explicitly resized the node into a photo.
|
|
37
|
+
*/
|
|
38
|
+
function emojiGlyphFromImageAttrs(attrs) {
|
|
39
|
+
if (!attrs) return null;
|
|
40
|
+
const src = typeof attrs.src === "string" ? attrs.src.trim() : "";
|
|
41
|
+
const alt = typeof attrs.alt === "string" ? attrs.alt.trim() : "";
|
|
42
|
+
const width = Number(attrs.width);
|
|
43
|
+
const height = Number(attrs.height);
|
|
44
|
+
if (Number.isFinite(width) && width >= EMOJI_IMAGE_MAX_PX && Number.isFinite(height) && height >= EMOJI_IMAGE_MAX_PX) return null;
|
|
45
|
+
const fromSrc = glyphFromEmojiSrc(src);
|
|
46
|
+
if (!EMOJI_IMAGE_HOST.test(src) && fromSrc === null) return null;
|
|
47
|
+
return (isEmojiOnlyText(alt) ? alt : null) ?? fromSrc;
|
|
48
|
+
}
|
|
49
|
+
function isAttachmentImage(node) {
|
|
50
|
+
return node.type === "image" && typeof node.attrs?.src === "string" && ATTACHMENT_RAW_URL.test(node.attrs.src);
|
|
51
|
+
}
|
|
52
|
+
function isSafeEditorImageSource(value) {
|
|
53
|
+
if (typeof value !== "string") return false;
|
|
54
|
+
const src = value.trim();
|
|
55
|
+
return ATTACHMENT_RAW_URL.test(src) || /^https?:\/\//i.test(src) || /^blob:/i.test(src) || /^data:image\//i.test(src);
|
|
56
|
+
}
|
|
57
|
+
function isLoadableImage(node) {
|
|
58
|
+
if (node.type !== "image") return true;
|
|
59
|
+
return isSafeEditorImageSource(node.attrs?.src);
|
|
60
|
+
}
|
|
61
|
+
function emojiParagraph(glyph) {
|
|
62
|
+
return {
|
|
63
|
+
type: "paragraph",
|
|
64
|
+
content: [{
|
|
65
|
+
type: "text",
|
|
66
|
+
text: glyph
|
|
67
|
+
}]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function sanitizeNode(node) {
|
|
71
|
+
const emojiGlyph = emojiGlyphFromImageAttrs(node.attrs);
|
|
72
|
+
if (node.type === "image" && emojiGlyph) return [emojiParagraph(emojiGlyph)];
|
|
73
|
+
if (!isLoadableImage(node)) return [];
|
|
74
|
+
if (!node.content) return [node];
|
|
75
|
+
const children = node.content.flatMap((child) => sanitizeNode(child));
|
|
76
|
+
if (node.type === "paragraph") {
|
|
77
|
+
const normalized = [];
|
|
78
|
+
let inline = [];
|
|
79
|
+
const flushInline = () => {
|
|
80
|
+
if (inline.length === 0) return;
|
|
81
|
+
normalized.push({
|
|
82
|
+
...node,
|
|
83
|
+
content: inline
|
|
84
|
+
});
|
|
85
|
+
inline = [];
|
|
86
|
+
};
|
|
87
|
+
for (const child of children) if (child.type === "image" || child.type === "paragraph") {
|
|
88
|
+
flushInline();
|
|
89
|
+
normalized.push(child);
|
|
90
|
+
} else inline.push(child);
|
|
91
|
+
flushInline();
|
|
92
|
+
return normalized.length > 0 ? normalized : [{
|
|
93
|
+
...node,
|
|
94
|
+
content: []
|
|
95
|
+
}];
|
|
96
|
+
}
|
|
97
|
+
return [{
|
|
98
|
+
...node,
|
|
99
|
+
content: children
|
|
100
|
+
}];
|
|
101
|
+
}
|
|
102
|
+
function sanitizeEditorContent(value) {
|
|
103
|
+
return sanitizeNode(value)[0] ?? {
|
|
104
|
+
type: "doc",
|
|
105
|
+
content: [{ type: "paragraph" }]
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
async function removeUnavailableAttachmentImages(value, fetchImpl = fetch) {
|
|
109
|
+
const root = sanitizeEditorContent(value);
|
|
110
|
+
const urls = /* @__PURE__ */ new Set();
|
|
111
|
+
const collect = (node) => {
|
|
112
|
+
if (isAttachmentImage(node)) urls.add(node.attrs?.src);
|
|
113
|
+
for (const child of node.content ?? []) collect(child);
|
|
114
|
+
};
|
|
115
|
+
collect(root);
|
|
116
|
+
const unavailable = /* @__PURE__ */ new Set();
|
|
117
|
+
await Promise.all(Array.from(urls, async (url) => {
|
|
118
|
+
try {
|
|
119
|
+
if (!(await fetchImpl(url, { credentials: "include" })).ok) unavailable.add(url);
|
|
120
|
+
} catch {
|
|
121
|
+
unavailable.add(url);
|
|
122
|
+
}
|
|
123
|
+
}));
|
|
124
|
+
let removed = 0;
|
|
125
|
+
const remove = (node) => {
|
|
126
|
+
if (isAttachmentImage(node) && unavailable.has(node.attrs?.src)) {
|
|
127
|
+
removed += 1;
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
if (!node.content) return node;
|
|
131
|
+
return {
|
|
132
|
+
...node,
|
|
133
|
+
content: node.content.map(remove).filter((child) => child !== null)
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
return {
|
|
137
|
+
content: remove(root) ?? {
|
|
138
|
+
type: "doc",
|
|
139
|
+
content: []
|
|
140
|
+
},
|
|
141
|
+
removed
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
export { sanitizeEditorContent as i, isSafeEditorImageSource as n, removeUnavailableAttachmentImages as r, emojiGlyphFromImageAttrs as t };
|
package/dist/frontend-ssr/assets/{editorExtensions-BwGeSPuX.js → editorExtensions-qNlZVP98.js}
RENAMED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as isSafeEditorImageSource } from "./editor-content-sanitizer-Gjm93iR-.js";
|
|
1
2
|
import { Node, mergeAttributes, textblockTypeInputRule } from "@tiptap/core";
|
|
2
3
|
import CodeBlockLowlight from "@tiptap/extension-code-block-lowlight";
|
|
3
4
|
import Highlight from "@tiptap/extension-highlight";
|
|
@@ -9,93 +10,6 @@ import TextAlign from "@tiptap/extension-text-align";
|
|
|
9
10
|
import { Markdown } from "@tiptap/markdown";
|
|
10
11
|
import StarterKit from "@tiptap/starter-kit";
|
|
11
12
|
import { common, createLowlight } from "lowlight";
|
|
12
|
-
//#region src/lib/components/editor/editor-content-sanitizer.ts
|
|
13
|
-
var ATTACHMENT_RAW_URL = /^\/api\/attachments\/[0-9a-f-]+\/raw$/i;
|
|
14
|
-
function isAttachmentImage(node) {
|
|
15
|
-
return node.type === "image" && typeof node.attrs?.src === "string" && ATTACHMENT_RAW_URL.test(node.attrs.src);
|
|
16
|
-
}
|
|
17
|
-
function isSafeEditorImageSource(value) {
|
|
18
|
-
if (typeof value !== "string") return false;
|
|
19
|
-
const src = value.trim();
|
|
20
|
-
return ATTACHMENT_RAW_URL.test(src) || /^https?:\/\//i.test(src) || /^blob:/i.test(src) || /^data:image\//i.test(src);
|
|
21
|
-
}
|
|
22
|
-
function isLoadableImage(node) {
|
|
23
|
-
if (node.type !== "image") return true;
|
|
24
|
-
return isSafeEditorImageSource(node.attrs?.src);
|
|
25
|
-
}
|
|
26
|
-
function sanitizeNode(node) {
|
|
27
|
-
if (!isLoadableImage(node)) return [];
|
|
28
|
-
if (!node.content) return [node];
|
|
29
|
-
const children = node.content.flatMap((child) => sanitizeNode(child));
|
|
30
|
-
if (node.type === "paragraph") {
|
|
31
|
-
const normalized = [];
|
|
32
|
-
let inline = [];
|
|
33
|
-
const flushInline = () => {
|
|
34
|
-
if (inline.length === 0) return;
|
|
35
|
-
normalized.push({
|
|
36
|
-
...node,
|
|
37
|
-
content: inline
|
|
38
|
-
});
|
|
39
|
-
inline = [];
|
|
40
|
-
};
|
|
41
|
-
for (const child of children) if (child.type === "image") {
|
|
42
|
-
flushInline();
|
|
43
|
-
normalized.push(child);
|
|
44
|
-
} else inline.push(child);
|
|
45
|
-
flushInline();
|
|
46
|
-
return normalized.length > 0 ? normalized : [{
|
|
47
|
-
...node,
|
|
48
|
-
content: []
|
|
49
|
-
}];
|
|
50
|
-
}
|
|
51
|
-
return [{
|
|
52
|
-
...node,
|
|
53
|
-
content: children
|
|
54
|
-
}];
|
|
55
|
-
}
|
|
56
|
-
function sanitizeEditorContent(value) {
|
|
57
|
-
return sanitizeNode(value)[0] ?? {
|
|
58
|
-
type: "doc",
|
|
59
|
-
content: [{ type: "paragraph" }]
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
async function removeUnavailableAttachmentImages(value, fetchImpl = fetch) {
|
|
63
|
-
const root = sanitizeEditorContent(value);
|
|
64
|
-
const urls = /* @__PURE__ */ new Set();
|
|
65
|
-
const collect = (node) => {
|
|
66
|
-
if (isAttachmentImage(node)) urls.add(node.attrs?.src);
|
|
67
|
-
for (const child of node.content ?? []) collect(child);
|
|
68
|
-
};
|
|
69
|
-
collect(root);
|
|
70
|
-
const unavailable = /* @__PURE__ */ new Set();
|
|
71
|
-
await Promise.all(Array.from(urls, async (url) => {
|
|
72
|
-
try {
|
|
73
|
-
if (!(await fetchImpl(url, { credentials: "include" })).ok) unavailable.add(url);
|
|
74
|
-
} catch {
|
|
75
|
-
unavailable.add(url);
|
|
76
|
-
}
|
|
77
|
-
}));
|
|
78
|
-
let removed = 0;
|
|
79
|
-
const remove = (node) => {
|
|
80
|
-
if (isAttachmentImage(node) && unavailable.has(node.attrs?.src)) {
|
|
81
|
-
removed += 1;
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
if (!node.content) return node;
|
|
85
|
-
return {
|
|
86
|
-
...node,
|
|
87
|
-
content: node.content.map(remove).filter((child) => child !== null)
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
return {
|
|
91
|
-
content: remove(root) ?? {
|
|
92
|
-
type: "doc",
|
|
93
|
-
content: []
|
|
94
|
-
},
|
|
95
|
-
removed
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
//#endregion
|
|
99
13
|
//#region src/lib/components/editor/editorExtensions.ts
|
|
100
14
|
var lowlight = createLowlight(common);
|
|
101
15
|
var SafeImage = Image.extend({ addAttributes() {
|
|
@@ -282,4 +196,4 @@ var editorExtensions = [
|
|
|
282
196
|
TaskItem.configure({ nested: true })
|
|
283
197
|
];
|
|
284
198
|
//#endregion
|
|
285
|
-
export {
|
|
199
|
+
export { TextAlignParagraph as n, editorExtensions as r, TextAlignHeading as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as cn } from "./utils-
|
|
1
|
+
import { t as cn } from "./utils-Cg_R05dR.js";
|
|
2
2
|
import * as $ from "svelte/internal/server";
|
|
3
|
-
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.
|
|
3
|
+
//#region ../node_modules/.bun/@hiai-gg+hiai-ui@0.1.3+8f2b9fada26e5f3b/node_modules/@hiai-gg/hiai-ui/dist/components/ui/input/input.svelte
|
|
4
4
|
function Input($$renderer, $$props) {
|
|
5
5
|
$$renderer.component(($$renderer) => {
|
|
6
6
|
let { ref = null, class: className, value = "", $$slots, $$events, ...restProps } = $$props;
|