@threadlabs/looma 0.53.14 → 0.53.15
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/components/ui-button/ui-button.html +11 -0
- package/components/ui-editor/ui-editor.html +10 -1
- package/dist/index.js +1 -1
- package/docs/catalog.json +36 -1
- package/editor/chunks/expressmark.js +86 -14
- package/editor/chunks/extensions.js +1 -1
- package/editor/components.css +9 -0
- package/editor/document-session.d.ts +12 -0
- package/editor/extensions/file-attachment.d.ts +3 -1
- package/editor/extensions/index.d.ts +1 -1
- package/editor/extensions/index.js +2 -2
- package/editor/file-deletions.d.ts +11 -0
- package/editor/index.d.ts +1 -1
- package/editor/index.js +276 -130
- package/editor/node-views/file-attachment.d.ts +3 -2
- package/editor/reference-display.d.ts +6 -2
- package/package.json +1 -1
- package/styles/ui-button.css +9 -0
- package/vanilla/UiButton.d.ts +1 -0
- package/vanilla/UiButton.js +54 -54
- package/vanilla/UiEditor.d.ts +3 -0
- package/vanilla/UiEditor.js +1 -1
package/editor/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as LOOMA_CALLOUT_TONES, _ as referenceDisplay, b as fileAttachmentAttrs, c as imageSourceUrls, g as observeReferenceDisplay, h as getReferenceDisplay, k as __exportAll, l as mapImageSourceUrls, m as LoomaReferencePresentation, p as LoomaReference, u as normalizeImageSources, v as setReferenceDisplay, x as fileAttachmentSize, y as LoomaFileAttachment } from "./chunks/expressmark.js";
|
|
2
2
|
import { i as TABLE_CELL_BACKGROUND_PRESETS, n as resolveTableCellAt, r as TABLE_CELL_BACKGROUND_OPTIONS, t as measureTableOverlayGeometry } from "./chunks/table-overlay.js";
|
|
3
3
|
import "./ui.js";
|
|
4
4
|
import { $ as LoomaFootnote, A as createLoomaMentionExtension, B as createImageMedia, C as getActiveTableCellBackground, D as createSiteRelativeLinks, E as LoomaSmartPaste, F as LoomaImage, G as normalizeTableOfContentsConfig, H as LoomaTableOfContents, I as LoomaInlineImage, J as LoomaTabs, K as tableOfContentsTree, L as isLoomaImageName, M as MAX_MENTION_RESULT_LIMIT, N as filterLoomaMentionItems, O as siteRelativeHref, P as normalizeMentionResultLimit, Q as LOOMA_FOOTNOTE_LABEL, R as normalizeImageDimension, S as getActiveTableCellAlignment, T as setActiveTableCellBackground, U as getTableOfContentsEntries, V as imageDeliveryAttributes, W as navigateTableOfContents, X as LoomaLinkDefinition, Y as LoomaLineBlock, Z as LOOMA_FOOTNOTE_INSERTED, _ as getDefaultEditorExtensions, a as NO_TABLE_CAPABILITIES, at as revealLoomaExpandAt, b as LoomaTableCell, c as handleTableAction, ct as normalizeLoomaChipColor, d as normalizeActiveTableColumnWidths, dt as LOOMA_ACTIVE_BLOCK_CLASS, et as LoomaFootnoteReference, f as shouldShowTextFormattingToolbar, ft as LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, g as LoomaTableKit, h as selectedTableElement, i as getDefaultSlashCommands, it as LoomaExpand, j as DEFAULT_MENTION_RESULT_LIMIT, k as LoomaMentionSuggestionPluginKey, l as handleTableOverlayAction, lt as LoomaCallout, m as selectedTableCellElement, mt as LoomaActiveBlockPluginKey, n as createLoomaSlashCommandExtension, nt as LoomaFigcaption, o as focusTableOverlayTarget, ot as LOOMA_CHIP_COLORS, p as menuAnchorRect, pt as LoomaActiveBlock, q as LoomaTab, r as filterLoomaSlashCommands, rt as LoomaFigure, s as getActiveTableUiState, st as LoomaChip, t as LoomaSlashCommand, tt as findLoomaFootnote, u as insertTableAtRange, ut as LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, v as getLoomaTableExtensions, w as setActiveTableCellAlignment, x as LoomaTableHeader, y as LoomaTable, z as normalizeImagePlacement } from "./chunks/extensions.js";
|
|
@@ -2579,6 +2579,7 @@ var A$4 = [
|
|
|
2579
2579
|
"data-ui-button-state",
|
|
2580
2580
|
"data-ui-button-prop-align",
|
|
2581
2581
|
"data-ui-button-prop-disabled",
|
|
2582
|
+
"data-ui-button-prop-fit",
|
|
2582
2583
|
"data-ui-button-prop-href",
|
|
2583
2584
|
"data-ui-button-prop-interaction-tone",
|
|
2584
2585
|
"data-ui-button-prop-interaction-variant",
|
|
@@ -2618,6 +2619,7 @@ var A$4 = [
|
|
|
2618
2619
|
"data-ui-button-state",
|
|
2619
2620
|
"data-ui-button-prop-align",
|
|
2620
2621
|
"data-ui-button-prop-disabled",
|
|
2622
|
+
"data-ui-button-prop-fit",
|
|
2621
2623
|
"data-ui-button-prop-href",
|
|
2622
2624
|
"data-ui-button-prop-interaction-tone",
|
|
2623
2625
|
"data-ui-button-prop-interaction-variant",
|
|
@@ -2655,6 +2657,7 @@ var A$4 = [
|
|
|
2655
2657
|
"data-ui-button-state",
|
|
2656
2658
|
"data-ui-button-prop-align",
|
|
2657
2659
|
"data-ui-button-prop-disabled",
|
|
2660
|
+
"data-ui-button-prop-fit",
|
|
2658
2661
|
"data-ui-button-prop-href",
|
|
2659
2662
|
"data-ui-button-prop-interaction-tone",
|
|
2660
2663
|
"data-ui-button-prop-interaction-variant",
|
|
@@ -2694,6 +2697,7 @@ var A$4 = [
|
|
|
2694
2697
|
"data-ui-button-state",
|
|
2695
2698
|
"data-ui-button-prop-align",
|
|
2696
2699
|
"data-ui-button-prop-disabled",
|
|
2700
|
+
"data-ui-button-prop-fit",
|
|
2697
2701
|
"data-ui-button-prop-href",
|
|
2698
2702
|
"data-ui-button-prop-interaction-tone",
|
|
2699
2703
|
"data-ui-button-prop-interaction-variant",
|
|
@@ -2748,6 +2752,14 @@ var D$18 = {
|
|
|
2748
2752
|
j: 0,
|
|
2749
2753
|
m: "b"
|
|
2750
2754
|
},
|
|
2755
|
+
"fit": {
|
|
2756
|
+
"required": false,
|
|
2757
|
+
"default": false,
|
|
2758
|
+
c: checkBoolean,
|
|
2759
|
+
t: "boolean",
|
|
2760
|
+
j: 0,
|
|
2761
|
+
m: "b"
|
|
2762
|
+
},
|
|
2751
2763
|
"href": {
|
|
2752
2764
|
"required": false,
|
|
2753
2765
|
c: checkString,
|
|
@@ -2936,6 +2948,7 @@ function createUiButton(options = {}, html) {
|
|
|
2936
2948
|
const attributes = Object.fromEntries([...[], ...Object.entries(authoredAttributes)].filter(([name]) => ![
|
|
2937
2949
|
"align",
|
|
2938
2950
|
"disabled",
|
|
2951
|
+
"fit",
|
|
2939
2952
|
"href",
|
|
2940
2953
|
"interaction-tone",
|
|
2941
2954
|
"interaction-variant",
|
|
@@ -2974,6 +2987,7 @@ function createUiButton(options = {}, html) {
|
|
|
2974
2987
|
null,
|
|
2975
2988
|
null,
|
|
2976
2989
|
null,
|
|
2990
|
+
null,
|
|
2977
2991
|
null
|
|
2978
2992
|
];
|
|
2979
2993
|
let B = acceptProps(void 0, D$18, S$18.n, v, componentProps, [], html);
|
|
@@ -2985,22 +2999,23 @@ function createUiButton(options = {}, html) {
|
|
|
2985
2999
|
}
|
|
2986
3000
|
if (j === 3) return awaitInput(B, "align", true);
|
|
2987
3001
|
if (j === 4) return awaitInput(B, "disabled", true);
|
|
2988
|
-
if (j === 5) return awaitInput(B, "
|
|
2989
|
-
if (j === 6) return awaitInput(B, "
|
|
2990
|
-
if (j === 7) return awaitInput(B, "
|
|
2991
|
-
if (j === 8) return awaitInput(B, "
|
|
2992
|
-
if (j === 9) return awaitInput(B, "
|
|
2993
|
-
if (j === 10) return awaitInput(B, "
|
|
2994
|
-
if (j === 11) return awaitInput(B, "
|
|
2995
|
-
if (j === 12) return awaitInput(B, "
|
|
2996
|
-
if (j === 13) return awaitInput(B, "
|
|
2997
|
-
if (j === 14) return awaitInput(B, "
|
|
2998
|
-
if (j === 15) return awaitInput(B, "
|
|
2999
|
-
if (j === 16) return awaitInput(B, "
|
|
3000
|
-
if (j === 17) return awaitInput(B, "
|
|
3001
|
-
if (j === 18) return awaitInput(B, "
|
|
3002
|
-
if (j === 19) return awaitInput(B, "
|
|
3003
|
-
if (j === 20) return awaitInput(B, "
|
|
3002
|
+
if (j === 5) return awaitInput(B, "fit", true);
|
|
3003
|
+
if (j === 6) return awaitInput(B, "href", true);
|
|
3004
|
+
if (j === 7) return awaitInput(B, "interactionTone", true);
|
|
3005
|
+
if (j === 8) return awaitInput(B, "interactionVariant", true);
|
|
3006
|
+
if (j === 9) return awaitInput(B, "loading", true);
|
|
3007
|
+
if (j === 10) return awaitInput(B, "pending", true);
|
|
3008
|
+
if (j === 11) return awaitInput(B, "preset", true);
|
|
3009
|
+
if (j === 12) return awaitInput(B, "rel", true);
|
|
3010
|
+
if (j === 13) return awaitInput(B, "selected", true);
|
|
3011
|
+
if (j === 14) return awaitInput(B, "shape", true);
|
|
3012
|
+
if (j === 15) return awaitInput(B, "size", true);
|
|
3013
|
+
if (j === 16) return awaitInput(B, "square", true);
|
|
3014
|
+
if (j === 17) return awaitInput(B, "stretch", true);
|
|
3015
|
+
if (j === 18) return awaitInput(B, "target", true);
|
|
3016
|
+
if (j === 19) return awaitInput(B, "tone", true);
|
|
3017
|
+
if (j === 20) return awaitInput(B, "type", true);
|
|
3018
|
+
if (j === 21) return awaitInput(B, "variant", true);
|
|
3004
3019
|
return v[j] === void 0 ? UNRESOLVED_INPUT : READY_INPUT;
|
|
3005
3020
|
};
|
|
3006
3021
|
const X = {
|
|
@@ -3013,12 +3028,12 @@ function createUiButton(options = {}, html) {
|
|
|
3013
3028
|
const ke = [];
|
|
3014
3029
|
const K = [
|
|
3015
3030
|
() => readIndex({
|
|
3016
|
-
"none": inputRead(v[
|
|
3031
|
+
"none": inputRead(v[21], inputStatus(21)),
|
|
3017
3032
|
"primary": "solid",
|
|
3018
3033
|
"standard": "solid",
|
|
3019
3034
|
"quiet": "ghost",
|
|
3020
3035
|
"destructive": "solid"
|
|
3021
|
-
}, inputRead(v[
|
|
3036
|
+
}, inputRead(v[11], inputStatus(11))),
|
|
3022
3037
|
() => readIndex(recordValue([
|
|
3023
3038
|
"none",
|
|
3024
3039
|
"primary",
|
|
@@ -3028,13 +3043,13 @@ function createUiButton(options = {}, html) {
|
|
|
3028
3043
|
], [
|
|
3029
3044
|
readIndex({
|
|
3030
3045
|
"true": "danger",
|
|
3031
|
-
"false": inputRead(v[
|
|
3032
|
-
}, textCall("concat", [equalValue(inputRead(v[
|
|
3046
|
+
"false": inputRead(v[19], inputStatus(19))
|
|
3047
|
+
}, textCall("concat", [equalValue(inputRead(v[21], inputStatus(21)), "danger")])),
|
|
3033
3048
|
"accent",
|
|
3034
3049
|
"neutral",
|
|
3035
3050
|
"neutral",
|
|
3036
3051
|
"danger"
|
|
3037
|
-
]), inputRead(v[
|
|
3052
|
+
]), inputRead(v[11], inputStatus(11))),
|
|
3038
3053
|
() => readIndex({
|
|
3039
3054
|
"true": null,
|
|
3040
3055
|
"false": readIndex({
|
|
@@ -3042,8 +3057,8 @@ function createUiButton(options = {}, html) {
|
|
|
3042
3057
|
"outline": "outline",
|
|
3043
3058
|
"solid": "solid",
|
|
3044
3059
|
"ghost": "ghost"
|
|
3045
|
-
}, inputRead(v[
|
|
3046
|
-
}, textCall("concat", [truthy(equalValue(inputRead(v[
|
|
3060
|
+
}, inputRead(v[8], inputStatus(8)))
|
|
3061
|
+
}, textCall("concat", [truthy(equalValue(inputRead(v[7], inputStatus(7)), "inherit")) && truthy(equalValue(inputRead(v[8], inputStatus(8)), "inherit"))]))
|
|
3047
3062
|
];
|
|
3048
3063
|
const g = (j) => {
|
|
3049
3064
|
const i = j - 0;
|
|
@@ -3068,7 +3083,7 @@ function createUiButton(options = {}, html) {
|
|
|
3068
3083
|
}
|
|
3069
3084
|
return next;
|
|
3070
3085
|
};
|
|
3071
|
-
let a = truthy(equalValue(g(0), "card")) && truthy(equalValue(v[
|
|
3086
|
+
let a = truthy(equalValue(g(0), "card")) && truthy(equalValue(v[6], null, true)) ? 0 : truthy(equalValue(g(0), "card")) ? 1 : truthy(equalValue(v[6], null, true)) ? 2 : 3;
|
|
3072
3087
|
let element;
|
|
3073
3088
|
if (a === 0) {
|
|
3074
3089
|
element = document.createElement("a");
|
|
@@ -3243,7 +3258,7 @@ function createUiButton(options = {}, html) {
|
|
|
3243
3258
|
return r;
|
|
3244
3259
|
};
|
|
3245
3260
|
const p0 = (r, c, d) => {
|
|
3246
|
-
if (c &
|
|
3261
|
+
if (c & 1076641744) {
|
|
3247
3262
|
resetForwardedAttributes(r.n, attributes, r.v0);
|
|
3248
3263
|
r.v0 = forwardAttributes(r.n, attributes);
|
|
3249
3264
|
const x0 = g(0);
|
|
@@ -3257,8 +3272,8 @@ function createUiButton(options = {}, html) {
|
|
|
3257
3272
|
}
|
|
3258
3273
|
const x2 = readIndex({
|
|
3259
3274
|
"true": null,
|
|
3260
|
-
"false": v[
|
|
3261
|
-
}, textCall("concat", [equalValue(v[
|
|
3275
|
+
"false": v[7]
|
|
3276
|
+
}, textCall("concat", [equalValue(v[7], "inherit")]));
|
|
3262
3277
|
if (x2 !== NONCONFORMING) r.g3 = x2;
|
|
3263
3278
|
if (r.g3 !== NONCONFORMING) {
|
|
3264
3279
|
const s3 = toAttribute(r.g3, "data-interaction-tone");
|
|
@@ -3270,67 +3285,69 @@ function createUiButton(options = {}, html) {
|
|
|
3270
3285
|
const s4 = toAttribute(r.g4, "data-interaction-appearance");
|
|
3271
3286
|
writeAttribute(r.n, "data-interaction-appearance", r.v4 = s4);
|
|
3272
3287
|
}
|
|
3273
|
-
const x4 = v[
|
|
3288
|
+
const x4 = v[13];
|
|
3274
3289
|
const s5 = toAttribute(x4, "data-selected");
|
|
3275
3290
|
writeAttribute(r.n, "data-selected", r.v5 = s5);
|
|
3276
3291
|
const x5 = readIndex({
|
|
3277
3292
|
"true": null,
|
|
3278
|
-
"false": v[
|
|
3279
|
-
}, textCall("concat", [truthy(v[4]) || truthy(v[
|
|
3293
|
+
"false": v[6]
|
|
3294
|
+
}, textCall("concat", [truthy(v[4]) || truthy(v[9]) || truthy(v[10])]));
|
|
3280
3295
|
if (x5 !== NONCONFORMING) r.g6 = x5;
|
|
3281
3296
|
if (r.g6 !== NONCONFORMING) {
|
|
3282
3297
|
const s6 = toAttribute(r.g6, "href");
|
|
3283
3298
|
writeUrlAttribute(r.n, "href", r.v6 = s6);
|
|
3284
3299
|
}
|
|
3285
|
-
const x6 = v[
|
|
3300
|
+
const x6 = v[18];
|
|
3286
3301
|
const s7 = toAttribute(x6, "target");
|
|
3287
3302
|
writeAttribute(r.n, "target", r.v7 = s7);
|
|
3288
|
-
const x7 = v[
|
|
3303
|
+
const x7 = v[12];
|
|
3289
3304
|
const s8 = toAttribute(x7, "rel");
|
|
3290
3305
|
writeAttribute(r.n, "rel", r.v8 = s8);
|
|
3291
3306
|
const x8 = readIndex({
|
|
3292
3307
|
"true": "true",
|
|
3293
3308
|
"false": null
|
|
3294
|
-
}, textCall("concat", [truthy(v[4]) || truthy(v[
|
|
3309
|
+
}, textCall("concat", [truthy(v[4]) || truthy(v[9]) || truthy(v[10])]));
|
|
3295
3310
|
if (x8 !== NONCONFORMING) r.g9 = x8;
|
|
3296
3311
|
if (r.g9 !== NONCONFORMING) {
|
|
3297
3312
|
const s9 = toAttribute(r.g9, "aria-disabled");
|
|
3298
3313
|
writeAttribute(r.n, "aria-disabled", r.v9 = s9);
|
|
3299
3314
|
}
|
|
3300
|
-
const x9 = truthy(v[
|
|
3315
|
+
const x9 = truthy(v[9]) || truthy(v[10]);
|
|
3301
3316
|
const s10 = toAttribute(x9, "aria-busy");
|
|
3302
3317
|
writeAttribute(r.n, "aria-busy", r.v10 = s10);
|
|
3303
3318
|
const x10 = readIndex({
|
|
3304
3319
|
"true": "0",
|
|
3305
3320
|
"false": null
|
|
3306
|
-
}, textCall("concat", [(truthy(v[
|
|
3321
|
+
}, textCall("concat", [(truthy(v[9]) || truthy(v[10])) && !truthy(v[4])]));
|
|
3307
3322
|
if (x10 !== NONCONFORMING) r.g11 = x10;
|
|
3308
3323
|
if (r.g11 !== NONCONFORMING) {
|
|
3309
3324
|
const s11 = toAttribute(r.g11, "tabindex");
|
|
3310
3325
|
writeAttribute(r.n, "tabindex", r.v11 = s11);
|
|
3311
3326
|
}
|
|
3312
3327
|
}
|
|
3313
|
-
if (c &
|
|
3328
|
+
if (c & 247336) {
|
|
3314
3329
|
const s12 = hostState([
|
|
3315
3330
|
"align",
|
|
3316
3331
|
"stretch",
|
|
3317
3332
|
"size",
|
|
3318
3333
|
"shape",
|
|
3319
3334
|
"square",
|
|
3335
|
+
"fit",
|
|
3320
3336
|
"loading",
|
|
3321
3337
|
"pending"
|
|
3322
3338
|
], [
|
|
3323
3339
|
v[3],
|
|
3324
|
-
v[
|
|
3325
|
-
v[14],
|
|
3326
|
-
v[13],
|
|
3340
|
+
v[17],
|
|
3327
3341
|
v[15],
|
|
3328
|
-
v[
|
|
3329
|
-
v[
|
|
3342
|
+
v[14],
|
|
3343
|
+
v[16],
|
|
3344
|
+
v[5],
|
|
3345
|
+
v[9],
|
|
3346
|
+
v[10]
|
|
3330
3347
|
]);
|
|
3331
3348
|
if (s12 !== r.v12) writeAttribute(r.n, "data-ui-button-state", (r.v12 = s12) === "" ? null : s12);
|
|
3332
3349
|
}
|
|
3333
|
-
if (c &
|
|
3350
|
+
if (c & 1536 && !(truthy(v[9]) || truthy(v[10])) !== !r.b0) {
|
|
3334
3351
|
if (r.b0) {
|
|
3335
3352
|
r.b0 = void 0;
|
|
3336
3353
|
clearRegion(r.a1, r.e0);
|
|
@@ -3339,7 +3356,7 @@ function createUiButton(options = {}, html) {
|
|
|
3339
3356
|
r.e0.before(r.b0.n);
|
|
3340
3357
|
}
|
|
3341
3358
|
} else if (r.b0 !== void 0) r.b0;
|
|
3342
|
-
if (c &
|
|
3359
|
+
if (c & 1536 && !!(truthy(v[9]) || truthy(v[10])) !== !r.b1) {
|
|
3343
3360
|
if (r.b1) {
|
|
3344
3361
|
dispose(r.b1);
|
|
3345
3362
|
r.b1 = void 0;
|
|
@@ -3423,7 +3440,7 @@ function createUiButton(options = {}, html) {
|
|
|
3423
3440
|
return r;
|
|
3424
3441
|
};
|
|
3425
3442
|
const p6 = (r, c, d) => {
|
|
3426
|
-
if (c &
|
|
3443
|
+
if (c & 1077424016) {
|
|
3427
3444
|
resetForwardedAttributes(r.n, attributes, r.v0);
|
|
3428
3445
|
r.v0 = forwardAttributes(r.n, attributes);
|
|
3429
3446
|
const x0 = g(0);
|
|
@@ -3437,8 +3454,8 @@ function createUiButton(options = {}, html) {
|
|
|
3437
3454
|
}
|
|
3438
3455
|
const x2 = readIndex({
|
|
3439
3456
|
"true": null,
|
|
3440
|
-
"false": v[
|
|
3441
|
-
}, textCall("concat", [equalValue(v[
|
|
3457
|
+
"false": v[7]
|
|
3458
|
+
}, textCall("concat", [equalValue(v[7], "inherit")]));
|
|
3442
3459
|
if (x2 !== NONCONFORMING) r.g3 = x2;
|
|
3443
3460
|
if (r.g3 !== NONCONFORMING) {
|
|
3444
3461
|
const s3 = toAttribute(r.g3, "data-interaction-tone");
|
|
@@ -3450,10 +3467,10 @@ function createUiButton(options = {}, html) {
|
|
|
3450
3467
|
const s4 = toAttribute(r.g4, "data-interaction-appearance");
|
|
3451
3468
|
writeAttribute(r.n, "data-interaction-appearance", r.v4 = s4);
|
|
3452
3469
|
}
|
|
3453
|
-
const x4 = v[
|
|
3470
|
+
const x4 = v[13];
|
|
3454
3471
|
const s5 = toAttribute(x4, "data-selected");
|
|
3455
3472
|
writeAttribute(r.n, "data-selected", r.v5 = s5);
|
|
3456
|
-
const x5 = v[
|
|
3473
|
+
const x5 = v[20];
|
|
3457
3474
|
const s6 = toAttribute(x5, "type");
|
|
3458
3475
|
writeAttribute(r.n, "type", r.v6 = s6);
|
|
3459
3476
|
const x6 = v[4];
|
|
@@ -3462,37 +3479,39 @@ function createUiButton(options = {}, html) {
|
|
|
3462
3479
|
const x7 = readIndex({
|
|
3463
3480
|
"true": "true",
|
|
3464
3481
|
"false": null
|
|
3465
|
-
}, textCall("concat", [truthy(v[
|
|
3482
|
+
}, textCall("concat", [truthy(v[9]) || truthy(v[10])]));
|
|
3466
3483
|
if (x7 !== NONCONFORMING) r.g8 = x7;
|
|
3467
3484
|
if (r.g8 !== NONCONFORMING) {
|
|
3468
3485
|
const s8 = toAttribute(r.g8, "aria-disabled");
|
|
3469
3486
|
writeAttribute(r.n, "aria-disabled", r.v8 = s8);
|
|
3470
3487
|
}
|
|
3471
|
-
const x8 = truthy(v[
|
|
3488
|
+
const x8 = truthy(v[9]) || truthy(v[10]);
|
|
3472
3489
|
const s9 = toAttribute(x8, "aria-busy");
|
|
3473
3490
|
writeAttribute(r.n, "aria-busy", r.v9 = s9);
|
|
3474
3491
|
}
|
|
3475
|
-
if (c &
|
|
3492
|
+
if (c & 247336) {
|
|
3476
3493
|
const s10 = hostState([
|
|
3477
3494
|
"align",
|
|
3478
3495
|
"stretch",
|
|
3479
3496
|
"size",
|
|
3480
3497
|
"shape",
|
|
3481
3498
|
"square",
|
|
3499
|
+
"fit",
|
|
3482
3500
|
"loading",
|
|
3483
3501
|
"pending"
|
|
3484
3502
|
], [
|
|
3485
3503
|
v[3],
|
|
3486
|
-
v[
|
|
3487
|
-
v[14],
|
|
3488
|
-
v[13],
|
|
3504
|
+
v[17],
|
|
3489
3505
|
v[15],
|
|
3490
|
-
v[
|
|
3491
|
-
v[
|
|
3506
|
+
v[14],
|
|
3507
|
+
v[16],
|
|
3508
|
+
v[5],
|
|
3509
|
+
v[9],
|
|
3510
|
+
v[10]
|
|
3492
3511
|
]);
|
|
3493
3512
|
if (s10 !== r.v10) writeAttribute(r.n, "data-ui-button-state", (r.v10 = s10) === "" ? null : s10);
|
|
3494
3513
|
}
|
|
3495
|
-
if (c &
|
|
3514
|
+
if (c & 1536 && !(truthy(v[9]) || truthy(v[10])) !== !r.b0) {
|
|
3496
3515
|
if (r.b0) {
|
|
3497
3516
|
r.b0 = void 0;
|
|
3498
3517
|
clearRegion(r.a1, r.e0);
|
|
@@ -3501,7 +3520,7 @@ function createUiButton(options = {}, html) {
|
|
|
3501
3520
|
r.e0.before(r.b0.n);
|
|
3502
3521
|
}
|
|
3503
3522
|
} else if (r.b0 !== void 0) r.b0;
|
|
3504
|
-
if (c &
|
|
3523
|
+
if (c & 1536 && !!(truthy(v[9]) || truthy(v[10])) !== !r.b1) {
|
|
3505
3524
|
if (r.b1) {
|
|
3506
3525
|
dispose(r.b1);
|
|
3507
3526
|
r.b1 = void 0;
|
|
@@ -3583,7 +3602,7 @@ function createUiButton(options = {}, html) {
|
|
|
3583
3602
|
return r;
|
|
3584
3603
|
};
|
|
3585
3604
|
const p12 = (r, c, d) => {
|
|
3586
|
-
if (c &
|
|
3605
|
+
if (c & 1076641744) {
|
|
3587
3606
|
resetForwardedAttributes(r.n, attributes, r.v0);
|
|
3588
3607
|
r.v0 = forwardAttributes(r.n, attributes);
|
|
3589
3608
|
const x0 = g(0);
|
|
@@ -3597,8 +3616,8 @@ function createUiButton(options = {}, html) {
|
|
|
3597
3616
|
}
|
|
3598
3617
|
const x2 = readIndex({
|
|
3599
3618
|
"true": null,
|
|
3600
|
-
"false": v[
|
|
3601
|
-
}, textCall("concat", [equalValue(v[
|
|
3619
|
+
"false": v[7]
|
|
3620
|
+
}, textCall("concat", [equalValue(v[7], "inherit")]));
|
|
3602
3621
|
if (x2 !== NONCONFORMING) r.g3 = x2;
|
|
3603
3622
|
if (r.g3 !== NONCONFORMING) {
|
|
3604
3623
|
const s3 = toAttribute(r.g3, "data-interaction-tone");
|
|
@@ -3610,67 +3629,69 @@ function createUiButton(options = {}, html) {
|
|
|
3610
3629
|
const s4 = toAttribute(r.g4, "data-interaction-appearance");
|
|
3611
3630
|
writeAttribute(r.n, "data-interaction-appearance", r.v4 = s4);
|
|
3612
3631
|
}
|
|
3613
|
-
const x4 = v[
|
|
3632
|
+
const x4 = v[13];
|
|
3614
3633
|
const s5 = toAttribute(x4, "data-selected");
|
|
3615
3634
|
writeAttribute(r.n, "data-selected", r.v5 = s5);
|
|
3616
3635
|
const x5 = readIndex({
|
|
3617
3636
|
"true": null,
|
|
3618
|
-
"false": v[
|
|
3619
|
-
}, textCall("concat", [truthy(v[4]) || truthy(v[
|
|
3637
|
+
"false": v[6]
|
|
3638
|
+
}, textCall("concat", [truthy(v[4]) || truthy(v[9]) || truthy(v[10])]));
|
|
3620
3639
|
if (x5 !== NONCONFORMING) r.g6 = x5;
|
|
3621
3640
|
if (r.g6 !== NONCONFORMING) {
|
|
3622
3641
|
const s6 = toAttribute(r.g6, "href");
|
|
3623
3642
|
writeUrlAttribute(r.n, "href", r.v6 = s6);
|
|
3624
3643
|
}
|
|
3625
|
-
const x6 = v[
|
|
3644
|
+
const x6 = v[18];
|
|
3626
3645
|
const s7 = toAttribute(x6, "target");
|
|
3627
3646
|
writeAttribute(r.n, "target", r.v7 = s7);
|
|
3628
|
-
const x7 = v[
|
|
3647
|
+
const x7 = v[12];
|
|
3629
3648
|
const s8 = toAttribute(x7, "rel");
|
|
3630
3649
|
writeAttribute(r.n, "rel", r.v8 = s8);
|
|
3631
3650
|
const x8 = readIndex({
|
|
3632
3651
|
"true": "true",
|
|
3633
3652
|
"false": null
|
|
3634
|
-
}, textCall("concat", [truthy(v[4]) || truthy(v[
|
|
3653
|
+
}, textCall("concat", [truthy(v[4]) || truthy(v[9]) || truthy(v[10])]));
|
|
3635
3654
|
if (x8 !== NONCONFORMING) r.g9 = x8;
|
|
3636
3655
|
if (r.g9 !== NONCONFORMING) {
|
|
3637
3656
|
const s9 = toAttribute(r.g9, "aria-disabled");
|
|
3638
3657
|
writeAttribute(r.n, "aria-disabled", r.v9 = s9);
|
|
3639
3658
|
}
|
|
3640
|
-
const x9 = truthy(v[
|
|
3659
|
+
const x9 = truthy(v[9]) || truthy(v[10]);
|
|
3641
3660
|
const s10 = toAttribute(x9, "aria-busy");
|
|
3642
3661
|
writeAttribute(r.n, "aria-busy", r.v10 = s10);
|
|
3643
3662
|
const x10 = readIndex({
|
|
3644
3663
|
"true": "0",
|
|
3645
3664
|
"false": null
|
|
3646
|
-
}, textCall("concat", [(truthy(v[
|
|
3665
|
+
}, textCall("concat", [(truthy(v[9]) || truthy(v[10])) && !truthy(v[4])]));
|
|
3647
3666
|
if (x10 !== NONCONFORMING) r.g11 = x10;
|
|
3648
3667
|
if (r.g11 !== NONCONFORMING) {
|
|
3649
3668
|
const s11 = toAttribute(r.g11, "tabindex");
|
|
3650
3669
|
writeAttribute(r.n, "tabindex", r.v11 = s11);
|
|
3651
3670
|
}
|
|
3652
3671
|
}
|
|
3653
|
-
if (c &
|
|
3672
|
+
if (c & 247336) {
|
|
3654
3673
|
const s12 = hostState([
|
|
3655
3674
|
"align",
|
|
3656
3675
|
"stretch",
|
|
3657
3676
|
"size",
|
|
3658
3677
|
"shape",
|
|
3659
3678
|
"square",
|
|
3679
|
+
"fit",
|
|
3660
3680
|
"loading",
|
|
3661
3681
|
"pending"
|
|
3662
3682
|
], [
|
|
3663
3683
|
v[3],
|
|
3664
|
-
v[
|
|
3665
|
-
v[14],
|
|
3666
|
-
v[13],
|
|
3684
|
+
v[17],
|
|
3667
3685
|
v[15],
|
|
3668
|
-
v[
|
|
3669
|
-
v[
|
|
3686
|
+
v[14],
|
|
3687
|
+
v[16],
|
|
3688
|
+
v[5],
|
|
3689
|
+
v[9],
|
|
3690
|
+
v[10]
|
|
3670
3691
|
]);
|
|
3671
3692
|
if (s12 !== r.v12) writeAttribute(r.n, "data-ui-button-state", (r.v12 = s12) === "" ? null : s12);
|
|
3672
3693
|
}
|
|
3673
|
-
if (c &
|
|
3694
|
+
if (c & 1536 && !(truthy(v[9]) || truthy(v[10])) !== !r.b0) {
|
|
3674
3695
|
if (r.b0) {
|
|
3675
3696
|
r.b0 = void 0;
|
|
3676
3697
|
clearRegion(r.a1, r.e0);
|
|
@@ -3747,7 +3768,7 @@ function createUiButton(options = {}, html) {
|
|
|
3747
3768
|
return r;
|
|
3748
3769
|
};
|
|
3749
3770
|
const p16 = (r, c, d) => {
|
|
3750
|
-
if (c &
|
|
3771
|
+
if (c & 1077424016) {
|
|
3751
3772
|
resetForwardedAttributes(r.n, attributes, r.v0);
|
|
3752
3773
|
r.v0 = forwardAttributes(r.n, attributes);
|
|
3753
3774
|
const x0 = g(0);
|
|
@@ -3761,8 +3782,8 @@ function createUiButton(options = {}, html) {
|
|
|
3761
3782
|
}
|
|
3762
3783
|
const x2 = readIndex({
|
|
3763
3784
|
"true": null,
|
|
3764
|
-
"false": v[
|
|
3765
|
-
}, textCall("concat", [equalValue(v[
|
|
3785
|
+
"false": v[7]
|
|
3786
|
+
}, textCall("concat", [equalValue(v[7], "inherit")]));
|
|
3766
3787
|
if (x2 !== NONCONFORMING) r.g3 = x2;
|
|
3767
3788
|
if (r.g3 !== NONCONFORMING) {
|
|
3768
3789
|
const s3 = toAttribute(r.g3, "data-interaction-tone");
|
|
@@ -3774,10 +3795,10 @@ function createUiButton(options = {}, html) {
|
|
|
3774
3795
|
const s4 = toAttribute(r.g4, "data-interaction-appearance");
|
|
3775
3796
|
writeAttribute(r.n, "data-interaction-appearance", r.v4 = s4);
|
|
3776
3797
|
}
|
|
3777
|
-
const x4 = v[
|
|
3798
|
+
const x4 = v[13];
|
|
3778
3799
|
const s5 = toAttribute(x4, "data-selected");
|
|
3779
3800
|
writeAttribute(r.n, "data-selected", r.v5 = s5);
|
|
3780
|
-
const x5 = v[
|
|
3801
|
+
const x5 = v[20];
|
|
3781
3802
|
const s6 = toAttribute(x5, "type");
|
|
3782
3803
|
writeAttribute(r.n, "type", r.v6 = s6);
|
|
3783
3804
|
const x6 = v[4];
|
|
@@ -3786,37 +3807,39 @@ function createUiButton(options = {}, html) {
|
|
|
3786
3807
|
const x7 = readIndex({
|
|
3787
3808
|
"true": "true",
|
|
3788
3809
|
"false": null
|
|
3789
|
-
}, textCall("concat", [truthy(v[
|
|
3810
|
+
}, textCall("concat", [truthy(v[9]) || truthy(v[10])]));
|
|
3790
3811
|
if (x7 !== NONCONFORMING) r.g8 = x7;
|
|
3791
3812
|
if (r.g8 !== NONCONFORMING) {
|
|
3792
3813
|
const s8 = toAttribute(r.g8, "aria-disabled");
|
|
3793
3814
|
writeAttribute(r.n, "aria-disabled", r.v8 = s8);
|
|
3794
3815
|
}
|
|
3795
|
-
const x8 = truthy(v[
|
|
3816
|
+
const x8 = truthy(v[9]) || truthy(v[10]);
|
|
3796
3817
|
const s9 = toAttribute(x8, "aria-busy");
|
|
3797
3818
|
writeAttribute(r.n, "aria-busy", r.v9 = s9);
|
|
3798
3819
|
}
|
|
3799
|
-
if (c &
|
|
3820
|
+
if (c & 247336) {
|
|
3800
3821
|
const s10 = hostState([
|
|
3801
3822
|
"align",
|
|
3802
3823
|
"stretch",
|
|
3803
3824
|
"size",
|
|
3804
3825
|
"shape",
|
|
3805
3826
|
"square",
|
|
3827
|
+
"fit",
|
|
3806
3828
|
"loading",
|
|
3807
3829
|
"pending"
|
|
3808
3830
|
], [
|
|
3809
3831
|
v[3],
|
|
3810
|
-
v[
|
|
3811
|
-
v[14],
|
|
3812
|
-
v[13],
|
|
3832
|
+
v[17],
|
|
3813
3833
|
v[15],
|
|
3814
|
-
v[
|
|
3815
|
-
v[
|
|
3834
|
+
v[14],
|
|
3835
|
+
v[16],
|
|
3836
|
+
v[5],
|
|
3837
|
+
v[9],
|
|
3838
|
+
v[10]
|
|
3816
3839
|
]);
|
|
3817
3840
|
if (s10 !== r.v10) writeAttribute(r.n, "data-ui-button-state", (r.v10 = s10) === "" ? null : s10);
|
|
3818
3841
|
}
|
|
3819
|
-
if (c &
|
|
3842
|
+
if (c & 1536 && !(truthy(v[9]) || truthy(v[10])) !== !r.b0) {
|
|
3820
3843
|
if (r.b0) {
|
|
3821
3844
|
r.b0 = void 0;
|
|
3822
3845
|
clearRegion(r.a1, r.e0);
|
|
@@ -3872,8 +3895,8 @@ function createUiButton(options = {}, html) {
|
|
|
3872
3895
|
R = M[a](element, d);
|
|
3873
3896
|
return;
|
|
3874
3897
|
}
|
|
3875
|
-
if (c &
|
|
3876
|
-
const t = truthy(equalValue(g(0), "card")) && truthy(equalValue(v[
|
|
3898
|
+
if (c & 1075841088) {
|
|
3899
|
+
const t = truthy(equalValue(g(0), "card")) && truthy(equalValue(v[6], null, true)) ? 0 : truthy(equalValue(g(0), "card")) ? 1 : truthy(equalValue(v[6], null, true)) ? 2 : 3;
|
|
3877
3900
|
if (t !== a) {
|
|
3878
3901
|
dispose(R);
|
|
3879
3902
|
for (const key in I.r) delete I.r[key];
|
|
@@ -3907,6 +3930,7 @@ function createUiButton(options = {}, html) {
|
|
|
3907
3930
|
defineComponent("ui-button", createUiButton, [
|
|
3908
3931
|
"align",
|
|
3909
3932
|
"disabled",
|
|
3933
|
+
"fit",
|
|
3910
3934
|
"href",
|
|
3911
3935
|
"interactionTone",
|
|
3912
3936
|
"interactionVariant",
|
|
@@ -11948,14 +11972,14 @@ var tableOfContentsNodeView = ({ editor, node, getPos }) => {
|
|
|
11948
11972
|
};
|
|
11949
11973
|
//#endregion
|
|
11950
11974
|
//#region src/editor/heading-link.ts
|
|
11951
|
-
var sequence = 0;
|
|
11975
|
+
var sequence$1 = 0;
|
|
11952
11976
|
/**
|
|
11953
11977
|
* Copy affordance for an existing heading anchor.
|
|
11954
11978
|
* @ownership The caller appends `dom` beside heading content and calls `destroy` on removal.
|
|
11955
11979
|
* The current ID and page URL are read at activation, so edits and client navigation cannot leave a stale link.
|
|
11956
11980
|
*/
|
|
11957
11981
|
function createHeadingLink(heading) {
|
|
11958
|
-
const id = `looma-heading-link-${++sequence}`;
|
|
11982
|
+
const id = `looma-heading-link-${++sequence$1}`;
|
|
11959
11983
|
const icon = element(createUiIcon({
|
|
11960
11984
|
name: "link",
|
|
11961
11985
|
attributes: { "aria-hidden": "true" }
|
|
@@ -14119,75 +14143,185 @@ var dividerNodeView = ({ editor, getPos }) => {
|
|
|
14119
14143
|
};
|
|
14120
14144
|
};
|
|
14121
14145
|
//#endregion
|
|
14146
|
+
//#region src/editor/file-deletions.ts
|
|
14147
|
+
/** Remove one block optimistically; retain a mapped rollback anchor while transport runs. */
|
|
14148
|
+
async function deleteFileBlock(editor, position, file, services) {
|
|
14149
|
+
if (!services.enabled() || editor.isDestroyed || !editor.isEditable) return;
|
|
14150
|
+
const controller = new AbortController();
|
|
14151
|
+
const cancel = () => controller.abort();
|
|
14152
|
+
editor.on("destroy", cancel);
|
|
14153
|
+
let restore, unwatch;
|
|
14154
|
+
try {
|
|
14155
|
+
if (!await services.confirm(file, controller.signal) || controller.signal.aborted || editor.isDestroyed || !editor.isEditable) return;
|
|
14156
|
+
const at = position();
|
|
14157
|
+
if (at === void 0) return;
|
|
14158
|
+
const original = editor.state.doc.nodeAt(at);
|
|
14159
|
+
if (original?.type.name !== "loomaFileAttachment" || original.attrs.href !== file.href) return;
|
|
14160
|
+
editor.view.dispatch(closeHistory(editor.state.tr));
|
|
14161
|
+
editor.view.dispatch(editor.state.tr.delete(at, at + original.nodeSize));
|
|
14162
|
+
let anchor = at, valid = true;
|
|
14163
|
+
const map = ({ transaction }) => {
|
|
14164
|
+
const next = transaction.mapping.mapResult(anchor, -1);
|
|
14165
|
+
if (next.deletedAcross) valid = false;
|
|
14166
|
+
anchor = next.pos;
|
|
14167
|
+
};
|
|
14168
|
+
editor.on("transaction", map);
|
|
14169
|
+
unwatch = () => editor.off("transaction", map);
|
|
14170
|
+
restore = () => {
|
|
14171
|
+
if (valid && !editor.isDestroyed) editor.view.dispatch(editor.state.tr.insert(anchor, original).setMeta("addToHistory", false));
|
|
14172
|
+
};
|
|
14173
|
+
if (!await services.remove(file, controller.signal)) throw new Error("The file was not deleted. Please retry.");
|
|
14174
|
+
restore = void 0;
|
|
14175
|
+
if (!editor.isDestroyed) {
|
|
14176
|
+
setReferenceDisplay(editor, {
|
|
14177
|
+
...getReferenceDisplay(editor),
|
|
14178
|
+
[`attachment:${file.href}`]: {
|
|
14179
|
+
label: file.name,
|
|
14180
|
+
status: "deleted",
|
|
14181
|
+
deletable: false
|
|
14182
|
+
}
|
|
14183
|
+
});
|
|
14184
|
+
editor.view.dispatch(closeHistory(editor.state.tr));
|
|
14185
|
+
}
|
|
14186
|
+
} catch (error) {
|
|
14187
|
+
unwatch?.();
|
|
14188
|
+
unwatch = void 0;
|
|
14189
|
+
restore?.();
|
|
14190
|
+
if (!controller.signal.aborted) services.onError(error, file);
|
|
14191
|
+
} finally {
|
|
14192
|
+
unwatch?.();
|
|
14193
|
+
editor.off("destroy", cancel);
|
|
14194
|
+
}
|
|
14195
|
+
}
|
|
14196
|
+
//#endregion
|
|
14122
14197
|
//#region src/editor/node-views/file-attachment.ts
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14198
|
+
var sequence = 0;
|
|
14199
|
+
/** A compact native file link with a separate, permission-scoped deletion action. */
|
|
14200
|
+
var createFileAttachmentNodeView = (services) => ({ node, editor, getPos }) => {
|
|
14201
|
+
let current = node, pending = false;
|
|
14202
|
+
const metadata = () => {
|
|
14126
14203
|
try {
|
|
14127
|
-
return fileAttachmentAttrs(attrs);
|
|
14204
|
+
return fileAttachmentAttrs(current.attrs);
|
|
14128
14205
|
} catch {
|
|
14129
14206
|
return null;
|
|
14130
14207
|
}
|
|
14131
14208
|
};
|
|
14132
|
-
const
|
|
14133
|
-
const
|
|
14134
|
-
|
|
14209
|
+
const name = document.createTextNode(""), size = document.createTextNode("");
|
|
14210
|
+
const download = createUiIcon({
|
|
14211
|
+
name: "download",
|
|
14212
|
+
tone: "muted",
|
|
14213
|
+
attributes: { "aria-hidden": "true" }
|
|
14214
|
+
});
|
|
14215
|
+
const card = createUiButton({
|
|
14135
14216
|
variant: "card",
|
|
14136
14217
|
tone: "neutral",
|
|
14137
|
-
|
|
14138
|
-
|
|
14218
|
+
size: "sm",
|
|
14219
|
+
fit: true,
|
|
14220
|
+
href: "",
|
|
14139
14221
|
target: "_blank",
|
|
14140
14222
|
rel: "noopener noreferrer",
|
|
14141
|
-
attributes: {
|
|
14142
|
-
contenteditable: "false",
|
|
14143
|
-
"data-looma-file-attachment": ""
|
|
14144
|
-
},
|
|
14223
|
+
attributes: { "data-looma-file-attachment": "" },
|
|
14145
14224
|
slots: {
|
|
14146
14225
|
icon: [createUiIcon({
|
|
14147
14226
|
name: "file",
|
|
14148
14227
|
tone: "secondary",
|
|
14149
14228
|
attributes: { "aria-hidden": "true" }
|
|
14150
14229
|
})],
|
|
14151
|
-
action: [
|
|
14152
|
-
name: "download",
|
|
14153
|
-
tone: "secondary",
|
|
14154
|
-
attributes: { "aria-hidden": "true" }
|
|
14155
|
-
})]
|
|
14230
|
+
action: [download]
|
|
14156
14231
|
},
|
|
14157
14232
|
children: [createUiStack({
|
|
14158
|
-
gap: "
|
|
14233
|
+
gap: "none",
|
|
14159
14234
|
children: [createUiText({
|
|
14160
14235
|
as: "span",
|
|
14161
|
-
tone: "default",
|
|
14162
14236
|
weight: "medium",
|
|
14163
14237
|
wrap: "anywhere",
|
|
14238
|
+
attributes: { "data-looma-file-name": "" },
|
|
14164
14239
|
children: [name]
|
|
14165
14240
|
}), createUiText({
|
|
14166
14241
|
as: "span",
|
|
14167
|
-
size: "
|
|
14168
|
-
tone: "
|
|
14242
|
+
size: "xs",
|
|
14243
|
+
tone: "muted",
|
|
14244
|
+
attributes: { "data-looma-file-size": "" },
|
|
14169
14245
|
children: [size]
|
|
14170
14246
|
})]
|
|
14171
14247
|
})]
|
|
14172
14248
|
});
|
|
14249
|
+
const id = `looma-file-delete-${++sequence}`;
|
|
14250
|
+
const trash = createUiIconButton({
|
|
14251
|
+
label: "Delete file",
|
|
14252
|
+
variant: "ghost",
|
|
14253
|
+
tone: "neutral",
|
|
14254
|
+
size: "sm",
|
|
14255
|
+
attributes: {
|
|
14256
|
+
id,
|
|
14257
|
+
"data-looma-file-delete": ""
|
|
14258
|
+
},
|
|
14259
|
+
children: [createUiIcon({
|
|
14260
|
+
name: "trash",
|
|
14261
|
+
attributes: { "aria-hidden": "true" }
|
|
14262
|
+
})]
|
|
14263
|
+
});
|
|
14264
|
+
trash.addEventListener("click", async () => {
|
|
14265
|
+
const a = metadata();
|
|
14266
|
+
if (!a || pending) return;
|
|
14267
|
+
pending = true;
|
|
14268
|
+
render();
|
|
14269
|
+
try {
|
|
14270
|
+
await deleteFileBlock(editor, getPos, a, services);
|
|
14271
|
+
} finally {
|
|
14272
|
+
pending = false;
|
|
14273
|
+
render();
|
|
14274
|
+
}
|
|
14275
|
+
});
|
|
14276
|
+
const dom = createUiCluster({
|
|
14277
|
+
padding: "s",
|
|
14278
|
+
gap: "xs",
|
|
14279
|
+
wrap: "nowrap",
|
|
14280
|
+
attributes: {
|
|
14281
|
+
contenteditable: "false",
|
|
14282
|
+
"data-looma-file-block": ""
|
|
14283
|
+
},
|
|
14284
|
+
children: [
|
|
14285
|
+
card,
|
|
14286
|
+
trash,
|
|
14287
|
+
createUiTooltip({
|
|
14288
|
+
for: id,
|
|
14289
|
+
children: [document.createTextNode("Delete file")]
|
|
14290
|
+
})
|
|
14291
|
+
]
|
|
14292
|
+
});
|
|
14293
|
+
const render = () => {
|
|
14294
|
+
const a = metadata(), display = a ? getReferenceDisplay(editor)[`attachment:${a.href}`] : void 0;
|
|
14295
|
+
const deleted = display?.status === "deleted";
|
|
14296
|
+
name.data = a ? `${a.name}${deleted ? " (deleted)" : ""}` : "Unavailable attachment";
|
|
14297
|
+
size.data = a ? fileAttachmentSize(a.size) : "";
|
|
14298
|
+
componentRegistry.update(card, {
|
|
14299
|
+
href: a?.href ?? "",
|
|
14300
|
+
disabled: !a || deleted || display?.status === "pending"
|
|
14301
|
+
});
|
|
14302
|
+
download.hidden = deleted;
|
|
14303
|
+
trash.hidden = !a || deleted || display?.status === "pending" || display?.deletable === false || !editor.isEditable || !services.enabled();
|
|
14304
|
+
componentRegistry.update(trash, {
|
|
14305
|
+
loading: pending,
|
|
14306
|
+
label: `Delete ${a?.name ?? "file"}`
|
|
14307
|
+
});
|
|
14308
|
+
};
|
|
14309
|
+
const stop = observeReferenceDisplay(editor, render);
|
|
14310
|
+
render();
|
|
14173
14311
|
return {
|
|
14174
14312
|
dom,
|
|
14175
14313
|
update(next) {
|
|
14176
|
-
if (next.type !==
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
size.data = a ? fileAttachmentSize(a.size) : "";
|
|
14180
|
-
componentRegistry.update(dom, {
|
|
14181
|
-
href: a?.href ?? "",
|
|
14182
|
-
disabled: !a
|
|
14183
|
-
});
|
|
14314
|
+
if (next.type !== current.type) return false;
|
|
14315
|
+
current = next;
|
|
14316
|
+
render();
|
|
14184
14317
|
return true;
|
|
14185
14318
|
},
|
|
14319
|
+
destroy: stop,
|
|
14186
14320
|
selectNode() {
|
|
14187
|
-
componentRegistry.update(
|
|
14321
|
+
componentRegistry.update(card, { selected: true });
|
|
14188
14322
|
},
|
|
14189
14323
|
deselectNode() {
|
|
14190
|
-
componentRegistry.update(
|
|
14324
|
+
componentRegistry.update(card, { selected: false });
|
|
14191
14325
|
},
|
|
14192
14326
|
stopEvent: (event) => event.type === "click" || event.type === "keydown",
|
|
14193
14327
|
ignoreMutation: () => true
|
|
@@ -15503,7 +15637,9 @@ var EDITOR_REQUEST_NAMES = [
|
|
|
15503
15637
|
"link-search",
|
|
15504
15638
|
"link-resolve",
|
|
15505
15639
|
"image-upload",
|
|
15506
|
-
"file-upload"
|
|
15640
|
+
"file-upload",
|
|
15641
|
+
"file-delete-confirm",
|
|
15642
|
+
"file-delete"
|
|
15507
15643
|
];
|
|
15508
15644
|
var uploadProgressText = (progress, label = "Uploading image…") => progress && progress.total > 0 ? `${label} ${Math.round(Math.min(1, progress.loaded / progress.total) * 100)}%` : label;
|
|
15509
15645
|
var editorInstanceSequence = 0;
|
|
@@ -15792,9 +15928,11 @@ function createDocumentEditorSession(props, options) {
|
|
|
15792
15928
|
const arrived = (name) => current.has(name) && !responders.has(name);
|
|
15793
15929
|
const extensionsArrived = arrived("extensions");
|
|
15794
15930
|
const slashChanged = arrived("slash-commands") || current.has("image-upload") !== responders.has("image-upload") || current.has("file-upload") !== responders.has("file-upload");
|
|
15931
|
+
const fileDeletionChanged = current.has("file-delete") !== responders.has("file-delete") || current.has("file-delete-confirm") !== responders.has("file-delete-confirm");
|
|
15795
15932
|
responders = current;
|
|
15796
15933
|
if (extensionsArrived) askExtensions();
|
|
15797
15934
|
if (slashChanged) askSlashCommands();
|
|
15935
|
+
if (fileDeletionChanged && uiState.editor) setReferenceDisplay(uiState.editor, { ...getReferenceDisplay(uiState.editor) });
|
|
15798
15936
|
};
|
|
15799
15937
|
afterRender(checkResponders);
|
|
15800
15938
|
let stopAnnouncements;
|
|
@@ -15866,7 +16004,15 @@ function createDocumentEditorSession(props, options) {
|
|
|
15866
16004
|
headingNodeView,
|
|
15867
16005
|
expandNodeView,
|
|
15868
16006
|
dividerNodeView,
|
|
15869
|
-
fileAttachmentNodeView
|
|
16007
|
+
fileAttachmentNodeView: createFileAttachmentNodeView({
|
|
16008
|
+
enabled: () => answers("file-delete") && answers("file-delete-confirm"),
|
|
16009
|
+
confirm: async (file, signal) => (await ask("file-delete-confirm", { file }, { signal }))?.confirmed === true,
|
|
16010
|
+
remove: async (file, signal) => (await ask("file-delete", { file }, { signal }))?.deleted === true,
|
|
16011
|
+
onError: (error, file) => emit("file-delete-error", {
|
|
16012
|
+
error,
|
|
16013
|
+
file
|
|
16014
|
+
})
|
|
16015
|
+
}),
|
|
15870
16016
|
calloutNodeView,
|
|
15871
16017
|
imageNodeView,
|
|
15872
16018
|
inlineImageNodeView: imageNodeView
|
|
@@ -17354,4 +17500,4 @@ function createToolbarTooltip(onChange, delay = () => 400) {
|
|
|
17354
17500
|
};
|
|
17355
17501
|
}
|
|
17356
17502
|
//#endregion
|
|
17357
|
-
export { DEFAULT_MENTION_RESULT_LIMIT, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, LOOMA_ACTIVE_BLOCK_CLASS, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, LOOMA_CALLOUT_TONES, LOOMA_CHIP_COLORS, LOOMA_FOOTNOTE_LABEL, LOOMA_ICONS, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaChip, LoomaExpand, LoomaFigcaption, LoomaFigure, LoomaFileAttachment, LoomaFootnote, LoomaFootnoteReference, LoomaImage, LoomaInlineImage, LoomaLineBlock, LoomaLinkDefinition, LoomaMentionSuggestionPluginKey, LoomaReference, LoomaReferencePresentation, LoomaSlashCommand, LoomaSmartPaste, LoomaTab, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, LoomaTableOfContents, LoomaTabs, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_OPTIONS, TABLE_CELL_BACKGROUND_PRESETS, createDocumentEditorSession, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, createToolbarTooltip, filterLoomaMentionItems, filterLoomaSlashCommands, findLoomaFootnote, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getReferenceDisplay, getTableOfContentsEntries, getVisualViewportRect, handleTableAction, handleTableOverlayAction, imageSourceUrls, insertTableAtRange, loomaIconMarkup, mapImageSourceUrls, measureTableOverlayGeometry, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeImageSources, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, referenceDisplay, resolveTableCellAt, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, setReferenceDisplay, shouldShowTextFormattingToolbar, siteRelativeHref };
|
|
17503
|
+
export { DEFAULT_MENTION_RESULT_LIMIT, LOOMA_ACTIVE_BLOCK_BLUR_GRACE_MS, LOOMA_ACTIVE_BLOCK_CLASS, LOOMA_ACTIVE_BLOCK_TYPING_IDLE_MS, LOOMA_CALLOUT_TONES, LOOMA_CHIP_COLORS, LOOMA_FOOTNOTE_LABEL, LOOMA_ICONS, LoomaActiveBlock, LoomaActiveBlockPluginKey, LoomaCallout, LoomaChip, LoomaExpand, LoomaFigcaption, LoomaFigure, LoomaFileAttachment, LoomaFootnote, LoomaFootnoteReference, LoomaImage, LoomaInlineImage, LoomaLineBlock, LoomaLinkDefinition, LoomaMentionSuggestionPluginKey, LoomaReference, LoomaReferencePresentation, LoomaSlashCommand, LoomaSmartPaste, LoomaTab, LoomaTable, LoomaTableCell, LoomaTableHeader, LoomaTableKit, LoomaTableOfContents, LoomaTabs, MAX_MENTION_RESULT_LIMIT, TABLE_CELL_BACKGROUND_OPTIONS, TABLE_CELL_BACKGROUND_PRESETS, createDocumentEditorSession, createLoomaMentionExtension, createLoomaSlashCommandExtension, createSiteRelativeLinks, createToolbarTooltip, fileAttachmentSize, filterLoomaMentionItems, filterLoomaSlashCommands, findLoomaFootnote, getActiveTableCellAlignment, getActiveTableCellBackground, getActiveTableUiState, getDefaultEditorExtensions, getDefaultSlashCommands, getLoomaTableExtensions, getReferenceDisplay, getTableOfContentsEntries, getVisualViewportRect, handleTableAction, handleTableOverlayAction, imageSourceUrls, insertTableAtRange, loomaIconMarkup, mapImageSourceUrls, measureTableOverlayGeometry, normalizeActiveTableColumnWidths, normalizeImageDimension, normalizeImagePlacement, normalizeImageSources, normalizeLoomaChipColor, normalizeMentionResultLimit, normalizeTableOfContentsConfig, referenceDisplay, resolveTableCellAt, revealLoomaExpandAt, setActiveTableCellAlignment, setActiveTableCellBackground, setReferenceDisplay, shouldShowTextFormattingToolbar, siteRelativeHref };
|