@ni/nimble-components 29.1.3 → 29.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-components-bundle.js +587 -148
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +3618 -3573
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/anchor/index.d.ts +6 -0
- package/dist/esm/anchor/index.js +4 -1
- package/dist/esm/anchor/index.js.map +1 -1
- package/dist/esm/anchor/template.js +1 -0
- package/dist/esm/anchor/template.js.map +1 -1
- package/dist/esm/button/index.d.ts +6 -0
- package/dist/esm/button/index.js +6 -2
- package/dist/esm/button/index.js.map +1 -1
- package/dist/esm/button/template.d.ts +4 -0
- package/dist/esm/button/template.js +49 -0
- package/dist/esm/button/template.js.map +1 -0
- package/dist/esm/checkbox/index.d.ts +10 -0
- package/dist/esm/checkbox/index.js +14 -1
- package/dist/esm/checkbox/index.js.map +1 -1
- package/dist/esm/checkbox/template.d.ts +4 -0
- package/dist/esm/checkbox/template.js +32 -0
- package/dist/esm/checkbox/template.js.map +1 -0
- package/dist/esm/menu-button/index.d.ts +1 -0
- package/dist/esm/menu-button/index.js +4 -1
- package/dist/esm/menu-button/index.js.map +1 -1
- package/dist/esm/menu-button/template.js +1 -0
- package/dist/esm/menu-button/template.js.map +1 -1
- package/dist/esm/toggle-button/index.d.ts +10 -0
- package/dist/esm/toggle-button/index.js +11 -1
- package/dist/esm/toggle-button/index.js.map +1 -1
- package/dist/esm/toggle-button/template.js +17 -7
- package/dist/esm/toggle-button/template.js.map +1 -1
- package/package.json +1 -1
|
@@ -7541,41 +7541,6 @@
|
|
|
7541
7541
|
let Card$1 = class Card extends FoundationElement {
|
|
7542
7542
|
};
|
|
7543
7543
|
|
|
7544
|
-
/**
|
|
7545
|
-
* The template for the {@link @microsoft/fast-foundation#(Checkbox:class)} component.
|
|
7546
|
-
* @public
|
|
7547
|
-
*/
|
|
7548
|
-
const checkboxTemplate = (context, definition) => html `
|
|
7549
|
-
<template
|
|
7550
|
-
role="checkbox"
|
|
7551
|
-
aria-checked="${x => x.checked}"
|
|
7552
|
-
aria-required="${x => x.required}"
|
|
7553
|
-
aria-disabled="${x => x.disabled}"
|
|
7554
|
-
aria-readonly="${x => x.readOnly}"
|
|
7555
|
-
tabindex="${x => (x.disabled ? null : 0)}"
|
|
7556
|
-
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
7557
|
-
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
7558
|
-
class="${x => (x.readOnly ? "readonly" : "")} ${x => x.checked ? "checked" : ""} ${x => (x.indeterminate ? "indeterminate" : "")}"
|
|
7559
|
-
>
|
|
7560
|
-
<div part="control" class="control">
|
|
7561
|
-
<slot name="checked-indicator">
|
|
7562
|
-
${definition.checkedIndicator || ""}
|
|
7563
|
-
</slot>
|
|
7564
|
-
<slot name="indeterminate-indicator">
|
|
7565
|
-
${definition.indeterminateIndicator || ""}
|
|
7566
|
-
</slot>
|
|
7567
|
-
</div>
|
|
7568
|
-
<label
|
|
7569
|
-
part="label"
|
|
7570
|
-
class="${x => x.defaultSlottedNodes && x.defaultSlottedNodes.length
|
|
7571
|
-
? "label"
|
|
7572
|
-
: "label label__hidden"}"
|
|
7573
|
-
>
|
|
7574
|
-
<slot ${slotted("defaultSlottedNodes")}></slot>
|
|
7575
|
-
</label>
|
|
7576
|
-
</template>
|
|
7577
|
-
`;
|
|
7578
|
-
|
|
7579
7544
|
class _Checkbox extends FoundationElement {
|
|
7580
7545
|
}
|
|
7581
7546
|
/**
|
|
@@ -16339,7 +16304,7 @@
|
|
|
16339
16304
|
|
|
16340
16305
|
/**
|
|
16341
16306
|
* Do not edit directly
|
|
16342
|
-
* Generated on
|
|
16307
|
+
* Generated on Tue, 21 May 2024 22:41:18 GMT
|
|
16343
16308
|
*/
|
|
16344
16309
|
|
|
16345
16310
|
const Information100DarkUi = "#a46eff";
|
|
@@ -16770,7 +16735,7 @@
|
|
|
16770
16735
|
return `${prefix}${uniqueIdCounter++}`;
|
|
16771
16736
|
}
|
|
16772
16737
|
|
|
16773
|
-
const template$
|
|
16738
|
+
const template$H = html `<slot></slot>`;
|
|
16774
16739
|
|
|
16775
16740
|
const styles$$ = css `
|
|
16776
16741
|
${display('contents')}
|
|
@@ -16888,7 +16853,7 @@
|
|
|
16888
16853
|
const nimbleDesignSystemProvider = ThemeProvider.compose({
|
|
16889
16854
|
baseName: 'theme-provider',
|
|
16890
16855
|
styles: styles$$,
|
|
16891
|
-
template: template$
|
|
16856
|
+
template: template$H
|
|
16892
16857
|
});
|
|
16893
16858
|
DesignSystem.getOrCreate()
|
|
16894
16859
|
.withPrefix('nimble')
|
|
@@ -17152,7 +17117,7 @@
|
|
|
17152
17117
|
`;
|
|
17153
17118
|
|
|
17154
17119
|
// prettier-ignore
|
|
17155
|
-
const template$
|
|
17120
|
+
const template$G = (_context, definition) => html `${
|
|
17156
17121
|
/* top-container div is necessary because setting contenteditable directly on the native anchor instead
|
|
17157
17122
|
leaves it focusable, unlike the behavior you get when the anchor is _within_ a contenteditable element.
|
|
17158
17123
|
*/ ''}<div
|
|
@@ -17169,6 +17134,7 @@
|
|
|
17169
17134
|
rel="${x => x.rel}"
|
|
17170
17135
|
target="${x => x.target}"
|
|
17171
17136
|
type="${x => x.type}"
|
|
17137
|
+
tabindex="${x => x.tabIndex}"
|
|
17172
17138
|
aria-atomic="${x => x.ariaAtomic}"
|
|
17173
17139
|
aria-busy="${x => x.ariaBusy}"
|
|
17174
17140
|
aria-controls="${x => x.ariaControls}"
|
|
@@ -17244,6 +17210,9 @@
|
|
|
17244
17210
|
__decorate$1([
|
|
17245
17211
|
attr
|
|
17246
17212
|
], Anchor.prototype, "appearance", void 0);
|
|
17213
|
+
__decorate$1([
|
|
17214
|
+
attr({ attribute: 'tabindex', converter: nullableNumberConverter })
|
|
17215
|
+
], Anchor.prototype, "tabIndex", void 0);
|
|
17247
17216
|
__decorate$1([
|
|
17248
17217
|
attr({ attribute: 'contenteditable' })
|
|
17249
17218
|
], Anchor.prototype, "contentEditable", void 0);
|
|
@@ -17251,7 +17220,7 @@
|
|
|
17251
17220
|
const nimbleAnchor = Anchor.compose({
|
|
17252
17221
|
baseName: 'anchor',
|
|
17253
17222
|
baseClass: Anchor$1,
|
|
17254
|
-
template: template$
|
|
17223
|
+
template: template$G,
|
|
17255
17224
|
styles: styles$_,
|
|
17256
17225
|
shadowOptions: {
|
|
17257
17226
|
delegatesFocus: true
|
|
@@ -17654,7 +17623,7 @@
|
|
|
17654
17623
|
}
|
|
17655
17624
|
`;
|
|
17656
17625
|
|
|
17657
|
-
const template$
|
|
17626
|
+
const template$F = (context, definition) => html `
|
|
17658
17627
|
<a
|
|
17659
17628
|
class="control"
|
|
17660
17629
|
part="control"
|
|
@@ -17736,7 +17705,7 @@
|
|
|
17736
17705
|
], AnchorButton.prototype, "disabled", void 0);
|
|
17737
17706
|
const nimbleAnchorButton = AnchorButton.compose({
|
|
17738
17707
|
baseName: 'anchor-button',
|
|
17739
|
-
template: template$
|
|
17708
|
+
template: template$F,
|
|
17740
17709
|
styles: styles$Y,
|
|
17741
17710
|
shadowOptions: {
|
|
17742
17711
|
delegatesFocus: true
|
|
@@ -17829,7 +17798,7 @@
|
|
|
17829
17798
|
}
|
|
17830
17799
|
`;
|
|
17831
17800
|
|
|
17832
|
-
const template$
|
|
17801
|
+
const template$E = (context, definition) => html `
|
|
17833
17802
|
<template
|
|
17834
17803
|
role="menuitem"
|
|
17835
17804
|
class="${x => (typeof x.startColumnCount === 'number'
|
|
@@ -17930,7 +17899,7 @@
|
|
|
17930
17899
|
// FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
|
|
17931
17900
|
const nimbleAnchorMenuItem = AnchorMenuItem.compose({
|
|
17932
17901
|
baseName: 'anchor-menu-item',
|
|
17933
|
-
template: template$
|
|
17902
|
+
template: template$E,
|
|
17934
17903
|
styles: styles$X,
|
|
17935
17904
|
shadowOptions: {
|
|
17936
17905
|
delegatesFocus: true
|
|
@@ -18058,7 +18027,7 @@
|
|
|
18058
18027
|
}
|
|
18059
18028
|
`;
|
|
18060
18029
|
|
|
18061
|
-
const template$
|
|
18030
|
+
const template$D = (context, definition) => html `
|
|
18062
18031
|
<template slot="anchortab" role="tab" aria-disabled="${x => x.disabled}">
|
|
18063
18032
|
<a
|
|
18064
18033
|
download="${x => x.download}"
|
|
@@ -18110,7 +18079,7 @@
|
|
|
18110
18079
|
// FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
|
|
18111
18080
|
const nimbleAnchorTab = AnchorTab.compose({
|
|
18112
18081
|
baseName: 'anchor-tab',
|
|
18113
|
-
template: template$
|
|
18082
|
+
template: template$D,
|
|
18114
18083
|
styles: styles$W,
|
|
18115
18084
|
shadowOptions: {
|
|
18116
18085
|
delegatesFocus: true
|
|
@@ -18140,7 +18109,7 @@
|
|
|
18140
18109
|
}
|
|
18141
18110
|
`;
|
|
18142
18111
|
|
|
18143
|
-
const template$
|
|
18112
|
+
const template$C = (context, definition) => html `
|
|
18144
18113
|
${startSlotTemplate(context, definition)}
|
|
18145
18114
|
<div ${ref('tablist')} class="tablist" part="tablist" role="tablist">
|
|
18146
18115
|
<slot name="anchortab" ${slotted('tabs')}></slot>
|
|
@@ -18346,7 +18315,7 @@
|
|
|
18346
18315
|
applyMixins(AnchorTabs, StartEnd);
|
|
18347
18316
|
const nimbleAnchorTabs = AnchorTabs.compose({
|
|
18348
18317
|
baseName: 'anchor-tabs',
|
|
18349
|
-
template: template$
|
|
18318
|
+
template: template$C,
|
|
18350
18319
|
styles: styles$V,
|
|
18351
18320
|
shadowOptions: {
|
|
18352
18321
|
delegatesFocus: false
|
|
@@ -18469,7 +18438,7 @@
|
|
|
18469
18438
|
}
|
|
18470
18439
|
`;
|
|
18471
18440
|
|
|
18472
|
-
const template$
|
|
18441
|
+
const template$B = (context, definition) => html `
|
|
18473
18442
|
<template
|
|
18474
18443
|
role="treeitem"
|
|
18475
18444
|
slot="${x => (x.isNestedItem() ? 'item' : null)}"
|
|
@@ -18606,7 +18575,7 @@
|
|
|
18606
18575
|
// FoundationAnchor already applies the StartEnd mixin, so we don't need to do it here.
|
|
18607
18576
|
const nimbleAnchorTreeItem = AnchorTreeItem.compose({
|
|
18608
18577
|
baseName: 'anchor-tree-item',
|
|
18609
|
-
template: template$
|
|
18578
|
+
template: template$B,
|
|
18610
18579
|
styles: styles$U,
|
|
18611
18580
|
shadowOptions: {
|
|
18612
18581
|
delegatesFocus: true
|
|
@@ -18882,6 +18851,53 @@
|
|
|
18882
18851
|
${buttonAppearanceVariantStyles}
|
|
18883
18852
|
`;
|
|
18884
18853
|
|
|
18854
|
+
const template$A = (context, definition) => html `
|
|
18855
|
+
<button
|
|
18856
|
+
class="control"
|
|
18857
|
+
part="control"
|
|
18858
|
+
?autofocus="${x => x.autofocus}"
|
|
18859
|
+
?disabled="${x => x.disabled}"
|
|
18860
|
+
form="${x => x.formId}"
|
|
18861
|
+
formaction="${x => x.formaction}"
|
|
18862
|
+
formenctype="${x => x.formenctype}"
|
|
18863
|
+
formmethod="${x => x.formmethod}"
|
|
18864
|
+
formnovalidate="${x => x.formnovalidate}"
|
|
18865
|
+
formtarget="${x => x.formtarget}"
|
|
18866
|
+
name="${x => x.name}"
|
|
18867
|
+
type="${x => x.type}"
|
|
18868
|
+
value="${x => x.value}"
|
|
18869
|
+
tabindex="${x => x.tabIndex}"
|
|
18870
|
+
aria-atomic="${x => x.ariaAtomic}"
|
|
18871
|
+
aria-busy="${x => x.ariaBusy}"
|
|
18872
|
+
aria-controls="${x => x.ariaControls}"
|
|
18873
|
+
aria-current="${x => x.ariaCurrent}"
|
|
18874
|
+
aria-describedby="${x => x.ariaDescribedby}"
|
|
18875
|
+
aria-details="${x => x.ariaDetails}"
|
|
18876
|
+
aria-disabled="${x => x.ariaDisabled}"
|
|
18877
|
+
aria-errormessage="${x => x.ariaErrormessage}"
|
|
18878
|
+
aria-expanded="${x => x.ariaExpanded}"
|
|
18879
|
+
aria-flowto="${x => x.ariaFlowto}"
|
|
18880
|
+
aria-haspopup="${x => x.ariaHaspopup}"
|
|
18881
|
+
aria-hidden="${x => x.ariaHidden}"
|
|
18882
|
+
aria-invalid="${x => x.ariaInvalid}"
|
|
18883
|
+
aria-keyshortcuts="${x => x.ariaKeyshortcuts}"
|
|
18884
|
+
aria-label="${x => x.ariaLabel}"
|
|
18885
|
+
aria-labelledby="${x => x.ariaLabelledby}"
|
|
18886
|
+
aria-live="${x => x.ariaLive}"
|
|
18887
|
+
aria-owns="${x => x.ariaOwns}"
|
|
18888
|
+
aria-pressed="${x => x.ariaPressed}"
|
|
18889
|
+
aria-relevant="${x => x.ariaRelevant}"
|
|
18890
|
+
aria-roledescription="${x => x.ariaRoledescription}"
|
|
18891
|
+
${ref('control')}
|
|
18892
|
+
>
|
|
18893
|
+
${startSlotTemplate(context, definition)}
|
|
18894
|
+
<span class="content" part="content">
|
|
18895
|
+
<slot ${slotted('defaultSlottedContent')}></slot>
|
|
18896
|
+
</span>
|
|
18897
|
+
${endSlotTemplate(context, definition)}
|
|
18898
|
+
</button>
|
|
18899
|
+
`;
|
|
18900
|
+
|
|
18885
18901
|
/**
|
|
18886
18902
|
* A nimble-styled HTML button
|
|
18887
18903
|
*/
|
|
@@ -18911,6 +18927,9 @@
|
|
|
18911
18927
|
__decorate$1([
|
|
18912
18928
|
attr({ attribute: 'content-hidden', mode: 'boolean' })
|
|
18913
18929
|
], Button.prototype, "contentHidden", void 0);
|
|
18930
|
+
__decorate$1([
|
|
18931
|
+
attr({ attribute: 'tabindex', converter: nullableNumberConverter })
|
|
18932
|
+
], Button.prototype, "tabIndex", void 0);
|
|
18914
18933
|
/**
|
|
18915
18934
|
* A function that returns a nimble-button registration for configuring the component with a DesignSystem.
|
|
18916
18935
|
* Implements {@link @microsoft/fast-foundation#buttonTemplate}
|
|
@@ -18923,7 +18942,7 @@
|
|
|
18923
18942
|
const nimbleButton = Button.compose({
|
|
18924
18943
|
baseName: 'button',
|
|
18925
18944
|
baseClass: Button$1,
|
|
18926
|
-
template:
|
|
18945
|
+
template: template$A,
|
|
18927
18946
|
styles: styles$R,
|
|
18928
18947
|
shadowOptions: {
|
|
18929
18948
|
delegatesFocus: true
|
|
@@ -19675,7 +19694,7 @@
|
|
|
19675
19694
|
};
|
|
19676
19695
|
|
|
19677
19696
|
// Avoiding any whitespace in the template because this is an inline element
|
|
19678
|
-
const template$
|
|
19697
|
+
const template$z = html `<div
|
|
19679
19698
|
class="icon"
|
|
19680
19699
|
aria-hidden="true"
|
|
19681
19700
|
:innerHTML=${x => x.icon.data}
|
|
@@ -19734,7 +19753,7 @@
|
|
|
19734
19753
|
const registerIcon = (baseName, iconClass) => {
|
|
19735
19754
|
const composedIcon = iconClass.compose({
|
|
19736
19755
|
baseName,
|
|
19737
|
-
template: template$
|
|
19756
|
+
template: template$z,
|
|
19738
19757
|
styles: styles$Q
|
|
19739
19758
|
});
|
|
19740
19759
|
DesignSystem.getOrCreate().withPrefix('nimble').register(composedIcon());
|
|
@@ -19848,7 +19867,7 @@
|
|
|
19848
19867
|
}).withDefault(coreLabelDefaults.filterNoResultsLabel);
|
|
19849
19868
|
|
|
19850
19869
|
// prettier-ignore
|
|
19851
|
-
const template$
|
|
19870
|
+
const template$y = html `
|
|
19852
19871
|
<div class="container"
|
|
19853
19872
|
role="status"
|
|
19854
19873
|
aria-atomic="${x => x.ariaAtomic}"
|
|
@@ -19964,7 +19983,7 @@
|
|
|
19964
19983
|
applyMixins(Banner, ARIAGlobalStatesAndProperties);
|
|
19965
19984
|
const nimbleBanner = Banner.compose({
|
|
19966
19985
|
baseName: 'banner',
|
|
19967
|
-
template: template$
|
|
19986
|
+
template: template$y,
|
|
19968
19987
|
styles: styles$S
|
|
19969
19988
|
});
|
|
19970
19989
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleBanner());
|
|
@@ -20123,7 +20142,7 @@
|
|
|
20123
20142
|
}
|
|
20124
20143
|
`;
|
|
20125
20144
|
|
|
20126
|
-
const template$
|
|
20145
|
+
const template$x = html `
|
|
20127
20146
|
<section aria-labelledby="title-slot">
|
|
20128
20147
|
<span id="title-slot"><slot name="title"></slot></span>
|
|
20129
20148
|
<slot></slot>
|
|
@@ -20138,7 +20157,7 @@
|
|
|
20138
20157
|
const nimbleCard = Card.compose({
|
|
20139
20158
|
baseName: 'card',
|
|
20140
20159
|
baseClass: Card$1,
|
|
20141
|
-
template: template$
|
|
20160
|
+
template: template$x,
|
|
20142
20161
|
styles: styles$N
|
|
20143
20162
|
});
|
|
20144
20163
|
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleCard());
|
|
@@ -20418,15 +20437,56 @@
|
|
|
20418
20437
|
}
|
|
20419
20438
|
`;
|
|
20420
20439
|
|
|
20440
|
+
const template$w = (_context, definition) => html `
|
|
20441
|
+
<template
|
|
20442
|
+
role="checkbox"
|
|
20443
|
+
aria-checked="${x => x.checked}"
|
|
20444
|
+
aria-required="${x => x.required}"
|
|
20445
|
+
aria-disabled="${x => x.disabled}"
|
|
20446
|
+
aria-readonly="${x => x.readOnly}"
|
|
20447
|
+
tabindex="${x => x.resolvedTabindex}"
|
|
20448
|
+
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
20449
|
+
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
20450
|
+
class="${x => (x.readOnly ? 'readonly' : '')} ${x => (x.checked ? 'checked' : '')} ${x => (x.indeterminate ? 'indeterminate' : '')}"
|
|
20451
|
+
>
|
|
20452
|
+
<div part="control" class="control">
|
|
20453
|
+
<slot name="checked-indicator">
|
|
20454
|
+
${definition.checkedIndicator || ''}
|
|
20455
|
+
</slot>
|
|
20456
|
+
<slot name="indeterminate-indicator">
|
|
20457
|
+
${definition.indeterminateIndicator || ''}
|
|
20458
|
+
</slot>
|
|
20459
|
+
</div>
|
|
20460
|
+
<label
|
|
20461
|
+
part="label"
|
|
20462
|
+
class="${x => (x.defaultSlottedNodes?.length
|
|
20463
|
+
? 'label'
|
|
20464
|
+
: 'label label__hidden')}"
|
|
20465
|
+
>
|
|
20466
|
+
<slot ${slotted('defaultSlottedNodes')}></slot>
|
|
20467
|
+
</label>
|
|
20468
|
+
</template>
|
|
20469
|
+
`;
|
|
20470
|
+
|
|
20421
20471
|
/**
|
|
20422
20472
|
* A nimble-styled checkbox control.
|
|
20423
20473
|
*/
|
|
20424
20474
|
class Checkbox extends Checkbox$1 {
|
|
20475
|
+
/**
|
|
20476
|
+
* @internal
|
|
20477
|
+
*/
|
|
20478
|
+
get resolvedTabindex() {
|
|
20479
|
+
const tabIndex = this.tabIndex ?? 0;
|
|
20480
|
+
return this.disabled ? undefined : `${tabIndex}`;
|
|
20481
|
+
}
|
|
20425
20482
|
}
|
|
20483
|
+
__decorate$1([
|
|
20484
|
+
attr({ attribute: 'tabindex', converter: nullableNumberConverter })
|
|
20485
|
+
], Checkbox.prototype, "tabIndex", void 0);
|
|
20426
20486
|
const nimbleCheckbox = Checkbox.compose({
|
|
20427
20487
|
baseName: 'checkbox',
|
|
20428
20488
|
baseClass: Checkbox$1,
|
|
20429
|
-
template:
|
|
20489
|
+
template: template$w,
|
|
20430
20490
|
styles: styles$L,
|
|
20431
20491
|
checkedIndicator: check16X16.data,
|
|
20432
20492
|
indeterminateIndicator: minus16X16.data
|
|
@@ -20482,23 +20542,32 @@
|
|
|
20482
20542
|
}
|
|
20483
20543
|
`));
|
|
20484
20544
|
|
|
20545
|
+
/* eslint-disable @typescript-eslint/indent */
|
|
20546
|
+
// prettier-ignore
|
|
20485
20547
|
const template$v = (context, definition) => html `
|
|
20486
20548
|
<div
|
|
20487
20549
|
role="button"
|
|
20488
20550
|
part="control"
|
|
20489
|
-
tabindex="${x =>
|
|
20551
|
+
tabindex="${x => x.resolvedTabindex}"
|
|
20490
20552
|
@keypress="${(x, c) => x.keypressHandler(c.event)}"
|
|
20491
20553
|
@click="${(x, c) => x.clickHandler(c.event)}"
|
|
20492
20554
|
class="control ${x => (x.checked ? 'checked' : '')}"
|
|
20493
|
-
|
|
20494
|
-
|
|
20495
|
-
|
|
20496
|
-
|
|
20555
|
+
${''
|
|
20556
|
+
/**
|
|
20557
|
+
* Configure aria-disabled, aria-readonly, and aria-pressed based on the
|
|
20558
|
+
* toggle button's state to keep the ARIA attributes consistent with the component's
|
|
20559
|
+
* state without a client having to configure ARIA attributes directly
|
|
20560
|
+
*/
|
|
20561
|
+
}
|
|
20497
20562
|
aria-disabled="${x => x.disabled}"
|
|
20498
20563
|
aria-readonly="${x => x.readOnly}"
|
|
20499
20564
|
aria-pressed="${x => x.checked}"
|
|
20500
|
-
${''
|
|
20501
|
-
|
|
20565
|
+
${''
|
|
20566
|
+
/**
|
|
20567
|
+
* Configure all other ARIA attributes based on the aria attributes
|
|
20568
|
+
* configured on the toggle button
|
|
20569
|
+
*/
|
|
20570
|
+
}
|
|
20502
20571
|
aria-atomic="${x => x.ariaAtomic}"
|
|
20503
20572
|
aria-busy="${x => x.ariaBusy}"
|
|
20504
20573
|
aria-controls="${x => x.ariaControls}"
|
|
@@ -20527,6 +20596,7 @@
|
|
|
20527
20596
|
${endSlotTemplate(context, definition)}
|
|
20528
20597
|
</div>
|
|
20529
20598
|
`;
|
|
20599
|
+
/* eslint-enable @typescript-eslint/indent */
|
|
20530
20600
|
|
|
20531
20601
|
/**
|
|
20532
20602
|
* A nimble-styled toggle button control.
|
|
@@ -20547,6 +20617,13 @@
|
|
|
20547
20617
|
*/
|
|
20548
20618
|
this.contentHidden = false;
|
|
20549
20619
|
}
|
|
20620
|
+
/**
|
|
20621
|
+
* @internal
|
|
20622
|
+
*/
|
|
20623
|
+
get resolvedTabindex() {
|
|
20624
|
+
const tabIndex = this.tabIndex ?? 0;
|
|
20625
|
+
return this.disabled ? undefined : `${tabIndex}`;
|
|
20626
|
+
}
|
|
20550
20627
|
}
|
|
20551
20628
|
__decorate$1([
|
|
20552
20629
|
attr
|
|
@@ -20557,6 +20634,9 @@
|
|
|
20557
20634
|
__decorate$1([
|
|
20558
20635
|
attr({ attribute: 'content-hidden', mode: 'boolean' })
|
|
20559
20636
|
], ToggleButton.prototype, "contentHidden", void 0);
|
|
20637
|
+
__decorate$1([
|
|
20638
|
+
attr({ attribute: 'tabindex', converter: nullableNumberConverter })
|
|
20639
|
+
], ToggleButton.prototype, "tabIndex", void 0);
|
|
20560
20640
|
applyMixins(ToggleButton, StartEnd, DelegatesARIAButton);
|
|
20561
20641
|
const nimbleToggleButton = ToggleButton.compose({
|
|
20562
20642
|
baseName: 'toggle-button',
|
|
@@ -25206,6 +25286,7 @@
|
|
|
25206
25286
|
?content-hidden="${x => x.contentHidden}"
|
|
25207
25287
|
?checked="${x => x.open}"
|
|
25208
25288
|
?disabled="${x => x.disabled}"
|
|
25289
|
+
tabindex="${x => x.tabIndex}"
|
|
25209
25290
|
aria-haspopup="true"
|
|
25210
25291
|
aria-expanded="${x => x.open}"
|
|
25211
25292
|
@change="${(x, c) => x.toggleButtonCheckedChangeHandler(c.event)}"
|
|
@@ -25423,6 +25504,9 @@
|
|
|
25423
25504
|
__decorate$1([
|
|
25424
25505
|
attr({ attribute: 'content-hidden', mode: 'boolean' })
|
|
25425
25506
|
], MenuButton.prototype, "contentHidden", void 0);
|
|
25507
|
+
__decorate$1([
|
|
25508
|
+
attr({ attribute: 'tabindex', converter: nullableNumberConverter })
|
|
25509
|
+
], MenuButton.prototype, "tabIndex", void 0);
|
|
25426
25510
|
__decorate$1([
|
|
25427
25511
|
attr({ mode: 'boolean' })
|
|
25428
25512
|
], MenuButton.prototype, "open", void 0);
|
|
@@ -28455,6 +28539,12 @@
|
|
|
28455
28539
|
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
|
|
28456
28540
|
*/
|
|
28457
28541
|
constructor(spec) {
|
|
28542
|
+
/**
|
|
28543
|
+
The [linebreak
|
|
28544
|
+
replacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement) node defined
|
|
28545
|
+
in this schema, if any.
|
|
28546
|
+
*/
|
|
28547
|
+
this.linebreakReplacement = null;
|
|
28458
28548
|
/**
|
|
28459
28549
|
An object for storing whatever values modules may want to
|
|
28460
28550
|
compute and cache per schema. (If you want to store something
|
|
@@ -28476,6 +28566,13 @@
|
|
|
28476
28566
|
type.contentMatch = contentExprCache[contentExpr] ||
|
|
28477
28567
|
(contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));
|
|
28478
28568
|
type.inlineContent = type.contentMatch.inlineContent;
|
|
28569
|
+
if (type.spec.linebreakReplacement) {
|
|
28570
|
+
if (this.linebreakReplacement)
|
|
28571
|
+
throw new RangeError("Multiple linebreak nodes defined");
|
|
28572
|
+
if (!type.isInline || !type.isLeaf)
|
|
28573
|
+
throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
28574
|
+
this.linebreakReplacement = type;
|
|
28575
|
+
}
|
|
28479
28576
|
type.markSet = markExpr == "_" ? null :
|
|
28480
28577
|
markExpr ? gatherMarks(this, markExpr.split(" ")) :
|
|
28481
28578
|
markExpr == "" || !type.inlineContent ? [] : null;
|
|
@@ -30325,7 +30422,8 @@
|
|
|
30325
30422
|
}
|
|
30326
30423
|
map(mapping) {
|
|
30327
30424
|
let from = mapping.mapResult(this.from, 1), to = mapping.mapResult(this.to, -1);
|
|
30328
|
-
let gapFrom =
|
|
30425
|
+
let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);
|
|
30426
|
+
let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
|
|
30329
30427
|
if ((from.deletedAcross && to.deletedAcross) || gapFrom < from.pos || gapTo > to.pos)
|
|
30330
30428
|
return null;
|
|
30331
30429
|
return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
|
|
@@ -30437,7 +30535,7 @@
|
|
|
30437
30535
|
});
|
|
30438
30536
|
matched.forEach(m => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));
|
|
30439
30537
|
}
|
|
30440
|
-
function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch) {
|
|
30538
|
+
function clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {
|
|
30441
30539
|
let node = tr.doc.nodeAt(pos);
|
|
30442
30540
|
let replSteps = [], cur = pos + 1;
|
|
30443
30541
|
for (let i = 0; i < node.childCount; i++) {
|
|
@@ -30451,7 +30549,7 @@
|
|
|
30451
30549
|
for (let j = 0; j < child.marks.length; j++)
|
|
30452
30550
|
if (!parentType.allowsMarkType(child.marks[j].type))
|
|
30453
30551
|
tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
|
|
30454
|
-
if (child.isText &&
|
|
30552
|
+
if (clearNewlines && child.isText && parentType.whitespace != "pre") {
|
|
30455
30553
|
let m, newline = /\r?\n|\r/g, slice;
|
|
30456
30554
|
while (m = newline.exec(child.text)) {
|
|
30457
30555
|
if (!slice)
|
|
@@ -30576,15 +30674,46 @@
|
|
|
30576
30674
|
let mapFrom = tr.steps.length;
|
|
30577
30675
|
tr.doc.nodesBetween(from, to, (node, pos) => {
|
|
30578
30676
|
if (node.isTextblock && !node.hasMarkup(type, attrs) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {
|
|
30677
|
+
let convertNewlines = null;
|
|
30678
|
+
if (type.schema.linebreakReplacement) {
|
|
30679
|
+
let pre = type.whitespace == "pre", supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);
|
|
30680
|
+
if (pre && !supportLinebreak)
|
|
30681
|
+
convertNewlines = false;
|
|
30682
|
+
else if (!pre && supportLinebreak)
|
|
30683
|
+
convertNewlines = true;
|
|
30684
|
+
}
|
|
30579
30685
|
// Ensure all markup that isn't allowed in the new node type is cleared
|
|
30580
|
-
|
|
30686
|
+
if (convertNewlines === false)
|
|
30687
|
+
replaceLinebreaks(tr, node, pos, mapFrom);
|
|
30688
|
+
clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, undefined, convertNewlines === null);
|
|
30581
30689
|
let mapping = tr.mapping.slice(mapFrom);
|
|
30582
30690
|
let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
|
|
30583
30691
|
tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrs, null, node.marks)), 0, 0), 1, true));
|
|
30692
|
+
if (convertNewlines === true)
|
|
30693
|
+
replaceNewlines(tr, node, pos, mapFrom);
|
|
30584
30694
|
return false;
|
|
30585
30695
|
}
|
|
30586
30696
|
});
|
|
30587
30697
|
}
|
|
30698
|
+
function replaceNewlines(tr, node, pos, mapFrom) {
|
|
30699
|
+
node.forEach((child, offset) => {
|
|
30700
|
+
if (child.isText) {
|
|
30701
|
+
let m, newline = /\r?\n|\r/g;
|
|
30702
|
+
while (m = newline.exec(child.text)) {
|
|
30703
|
+
let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);
|
|
30704
|
+
tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
|
|
30705
|
+
}
|
|
30706
|
+
}
|
|
30707
|
+
});
|
|
30708
|
+
}
|
|
30709
|
+
function replaceLinebreaks(tr, node, pos, mapFrom) {
|
|
30710
|
+
node.forEach((child, offset) => {
|
|
30711
|
+
if (child.type == child.type.schema.linebreakReplacement) {
|
|
30712
|
+
let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);
|
|
30713
|
+
tr.replaceWith(start, start + 1, node.type.schema.text("\n"));
|
|
30714
|
+
}
|
|
30715
|
+
});
|
|
30716
|
+
}
|
|
30588
30717
|
function canChangeType(doc, pos, type) {
|
|
30589
30718
|
let $pos = doc.resolve(pos), index = $pos.index();
|
|
30590
30719
|
return $pos.parent.canReplaceWith(index, index + 1, type);
|
|
@@ -39183,6 +39312,11 @@
|
|
|
39183
39312
|
};
|
|
39184
39313
|
}
|
|
39185
39314
|
|
|
39315
|
+
/**
|
|
39316
|
+
* Takes a Transaction & Editor State and turns it into a chainable state object
|
|
39317
|
+
* @param config The transaction and state to create the chainable state from
|
|
39318
|
+
* @returns A chainable Editor state object
|
|
39319
|
+
*/
|
|
39186
39320
|
function createChainableState(config) {
|
|
39187
39321
|
const { state, transaction } = config;
|
|
39188
39322
|
let { selection } = transaction;
|
|
@@ -39349,6 +39483,13 @@
|
|
|
39349
39483
|
}
|
|
39350
39484
|
}
|
|
39351
39485
|
|
|
39486
|
+
/**
|
|
39487
|
+
* Returns a field from an extension
|
|
39488
|
+
* @param extension The Tiptap extension
|
|
39489
|
+
* @param field The field, for example `renderHTML` or `priority`
|
|
39490
|
+
* @param context The context object that should be passed as `this` into the function
|
|
39491
|
+
* @returns The field value
|
|
39492
|
+
*/
|
|
39352
39493
|
function getExtensionField(extension, field, context) {
|
|
39353
39494
|
if (extension.config[field] === undefined && extension.parent) {
|
|
39354
39495
|
return getExtensionField(extension.parent, field, context);
|
|
@@ -39593,6 +39734,12 @@
|
|
|
39593
39734
|
return value !== null && value !== undefined;
|
|
39594
39735
|
}));
|
|
39595
39736
|
}
|
|
39737
|
+
/**
|
|
39738
|
+
* Creates a new Prosemirror schema based on the given extensions.
|
|
39739
|
+
* @param extensions An array of Tiptap extensions
|
|
39740
|
+
* @param editor The editor instance
|
|
39741
|
+
* @returns A Prosemirror schema
|
|
39742
|
+
*/
|
|
39596
39743
|
function getSchemaByResolvedExtensions(extensions, editor) {
|
|
39597
39744
|
var _a;
|
|
39598
39745
|
const allAttributes = getAttributesFromExtensions(extensions);
|
|
@@ -39694,6 +39841,12 @@
|
|
|
39694
39841
|
});
|
|
39695
39842
|
}
|
|
39696
39843
|
|
|
39844
|
+
/**
|
|
39845
|
+
* Tries to get a node or mark type by its name.
|
|
39846
|
+
* @param name The name of the node or mark type
|
|
39847
|
+
* @param schema The Prosemiror schema to search in
|
|
39848
|
+
* @returns The node or mark type, or null if it doesn't exist
|
|
39849
|
+
*/
|
|
39697
39850
|
function getSchemaTypeByName(name, schema) {
|
|
39698
39851
|
return schema.nodes[name] || schema.marks[name] || null;
|
|
39699
39852
|
}
|
|
@@ -39710,6 +39863,12 @@
|
|
|
39710
39863
|
return enabled;
|
|
39711
39864
|
}
|
|
39712
39865
|
|
|
39866
|
+
/**
|
|
39867
|
+
* Returns the text content of a resolved prosemirror position
|
|
39868
|
+
* @param $from The resolved position to get the text content from
|
|
39869
|
+
* @param maxMatch The maximum number of characters to match
|
|
39870
|
+
* @returns The text content
|
|
39871
|
+
*/
|
|
39713
39872
|
const getTextContentFromNodes = ($from, maxMatch = 500) => {
|
|
39714
39873
|
let textBefore = '';
|
|
39715
39874
|
const sliceEndPos = $from.parentOffset;
|
|
@@ -39917,6 +40076,10 @@
|
|
|
39917
40076
|
return typeof value === 'number';
|
|
39918
40077
|
}
|
|
39919
40078
|
|
|
40079
|
+
/**
|
|
40080
|
+
* Paste rules are used to react to pasted content.
|
|
40081
|
+
* @see https://tiptap.dev/guide/custom-extensions/#paste-rules
|
|
40082
|
+
*/
|
|
39920
40083
|
class PasteRule {
|
|
39921
40084
|
constructor(config) {
|
|
39922
40085
|
this.find = config.find;
|
|
@@ -40115,57 +40278,14 @@
|
|
|
40115
40278
|
this.editor = editor;
|
|
40116
40279
|
this.extensions = ExtensionManager.resolve(extensions);
|
|
40117
40280
|
this.schema = getSchemaByResolvedExtensions(this.extensions, editor);
|
|
40118
|
-
this.
|
|
40119
|
-
var _a;
|
|
40120
|
-
// store extension storage in editor
|
|
40121
|
-
this.editor.extensionStorage[extension.name] = extension.storage;
|
|
40122
|
-
const context = {
|
|
40123
|
-
name: extension.name,
|
|
40124
|
-
options: extension.options,
|
|
40125
|
-
storage: extension.storage,
|
|
40126
|
-
editor: this.editor,
|
|
40127
|
-
type: getSchemaTypeByName(extension.name, this.schema),
|
|
40128
|
-
};
|
|
40129
|
-
if (extension.type === 'mark') {
|
|
40130
|
-
const keepOnSplit = (_a = callOrReturn(getExtensionField(extension, 'keepOnSplit', context))) !== null && _a !== void 0 ? _a : true;
|
|
40131
|
-
if (keepOnSplit) {
|
|
40132
|
-
this.splittableMarks.push(extension.name);
|
|
40133
|
-
}
|
|
40134
|
-
}
|
|
40135
|
-
const onBeforeCreate = getExtensionField(extension, 'onBeforeCreate', context);
|
|
40136
|
-
if (onBeforeCreate) {
|
|
40137
|
-
this.editor.on('beforeCreate', onBeforeCreate);
|
|
40138
|
-
}
|
|
40139
|
-
const onCreate = getExtensionField(extension, 'onCreate', context);
|
|
40140
|
-
if (onCreate) {
|
|
40141
|
-
this.editor.on('create', onCreate);
|
|
40142
|
-
}
|
|
40143
|
-
const onUpdate = getExtensionField(extension, 'onUpdate', context);
|
|
40144
|
-
if (onUpdate) {
|
|
40145
|
-
this.editor.on('update', onUpdate);
|
|
40146
|
-
}
|
|
40147
|
-
const onSelectionUpdate = getExtensionField(extension, 'onSelectionUpdate', context);
|
|
40148
|
-
if (onSelectionUpdate) {
|
|
40149
|
-
this.editor.on('selectionUpdate', onSelectionUpdate);
|
|
40150
|
-
}
|
|
40151
|
-
const onTransaction = getExtensionField(extension, 'onTransaction', context);
|
|
40152
|
-
if (onTransaction) {
|
|
40153
|
-
this.editor.on('transaction', onTransaction);
|
|
40154
|
-
}
|
|
40155
|
-
const onFocus = getExtensionField(extension, 'onFocus', context);
|
|
40156
|
-
if (onFocus) {
|
|
40157
|
-
this.editor.on('focus', onFocus);
|
|
40158
|
-
}
|
|
40159
|
-
const onBlur = getExtensionField(extension, 'onBlur', context);
|
|
40160
|
-
if (onBlur) {
|
|
40161
|
-
this.editor.on('blur', onBlur);
|
|
40162
|
-
}
|
|
40163
|
-
const onDestroy = getExtensionField(extension, 'onDestroy', context);
|
|
40164
|
-
if (onDestroy) {
|
|
40165
|
-
this.editor.on('destroy', onDestroy);
|
|
40166
|
-
}
|
|
40167
|
-
});
|
|
40281
|
+
this.setupExtensions();
|
|
40168
40282
|
}
|
|
40283
|
+
/**
|
|
40284
|
+
* Returns a flattened and sorted extension list while
|
|
40285
|
+
* also checking for duplicated extensions and warns the user.
|
|
40286
|
+
* @param extensions An array of Tiptap extensions
|
|
40287
|
+
* @returns An flattened and sorted array of Tiptap extensions
|
|
40288
|
+
*/
|
|
40169
40289
|
static resolve(extensions) {
|
|
40170
40290
|
const resolvedExtensions = ExtensionManager.sort(ExtensionManager.flatten(extensions));
|
|
40171
40291
|
const duplicatedNames = findDuplicates(resolvedExtensions.map(extension => extension.name));
|
|
@@ -40176,6 +40296,11 @@
|
|
|
40176
40296
|
}
|
|
40177
40297
|
return resolvedExtensions;
|
|
40178
40298
|
}
|
|
40299
|
+
/**
|
|
40300
|
+
* Create a flattened array of extensions by traversing the `addExtensions` field.
|
|
40301
|
+
* @param extensions An array of Tiptap extensions
|
|
40302
|
+
* @returns A flattened array of Tiptap extensions
|
|
40303
|
+
*/
|
|
40179
40304
|
static flatten(extensions) {
|
|
40180
40305
|
return (extensions
|
|
40181
40306
|
.map(extension => {
|
|
@@ -40193,6 +40318,11 @@
|
|
|
40193
40318
|
// `Infinity` will break TypeScript so we set a number that is probably high enough
|
|
40194
40319
|
.flat(10));
|
|
40195
40320
|
}
|
|
40321
|
+
/**
|
|
40322
|
+
* Sort extensions by priority.
|
|
40323
|
+
* @param extensions An array of Tiptap extensions
|
|
40324
|
+
* @returns A sorted array of Tiptap extensions by priority
|
|
40325
|
+
*/
|
|
40196
40326
|
static sort(extensions) {
|
|
40197
40327
|
const defaultPriority = 100;
|
|
40198
40328
|
return extensions.sort((a, b) => {
|
|
@@ -40207,6 +40337,10 @@
|
|
|
40207
40337
|
return 0;
|
|
40208
40338
|
});
|
|
40209
40339
|
}
|
|
40340
|
+
/**
|
|
40341
|
+
* Get all commands from the extensions.
|
|
40342
|
+
* @returns An object with all commands where the key is the command name and the value is the command function
|
|
40343
|
+
*/
|
|
40210
40344
|
get commands() {
|
|
40211
40345
|
return this.extensions.reduce((commands, extension) => {
|
|
40212
40346
|
const context = {
|
|
@@ -40226,6 +40360,10 @@
|
|
|
40226
40360
|
};
|
|
40227
40361
|
}, {});
|
|
40228
40362
|
}
|
|
40363
|
+
/**
|
|
40364
|
+
* Get all registered Prosemirror plugins from the extensions.
|
|
40365
|
+
* @returns An array of Prosemirror plugins
|
|
40366
|
+
*/
|
|
40229
40367
|
get plugins() {
|
|
40230
40368
|
const { editor } = this;
|
|
40231
40369
|
// With ProseMirror, first plugins within an array are executed first.
|
|
@@ -40288,9 +40426,17 @@
|
|
|
40288
40426
|
...allPlugins,
|
|
40289
40427
|
];
|
|
40290
40428
|
}
|
|
40429
|
+
/**
|
|
40430
|
+
* Get all attributes from the extensions.
|
|
40431
|
+
* @returns An array of attributes
|
|
40432
|
+
*/
|
|
40291
40433
|
get attributes() {
|
|
40292
40434
|
return getAttributesFromExtensions(this.extensions);
|
|
40293
40435
|
}
|
|
40436
|
+
/**
|
|
40437
|
+
* Get all node views from the extensions.
|
|
40438
|
+
* @returns An object with all node views where the key is the node name and the value is the node view function
|
|
40439
|
+
*/
|
|
40294
40440
|
get nodeViews() {
|
|
40295
40441
|
const { editor } = this;
|
|
40296
40442
|
const { nodeExtensions } = splitExtensions(this.extensions);
|
|
@@ -40323,6 +40469,62 @@
|
|
|
40323
40469
|
return [extension.name, nodeview];
|
|
40324
40470
|
}));
|
|
40325
40471
|
}
|
|
40472
|
+
/**
|
|
40473
|
+
* Go through all extensions, create extension storages & setup marks
|
|
40474
|
+
* & bind editor event listener.
|
|
40475
|
+
*/
|
|
40476
|
+
setupExtensions() {
|
|
40477
|
+
this.extensions.forEach(extension => {
|
|
40478
|
+
var _a;
|
|
40479
|
+
// store extension storage in editor
|
|
40480
|
+
this.editor.extensionStorage[extension.name] = extension.storage;
|
|
40481
|
+
const context = {
|
|
40482
|
+
name: extension.name,
|
|
40483
|
+
options: extension.options,
|
|
40484
|
+
storage: extension.storage,
|
|
40485
|
+
editor: this.editor,
|
|
40486
|
+
type: getSchemaTypeByName(extension.name, this.schema),
|
|
40487
|
+
};
|
|
40488
|
+
if (extension.type === 'mark') {
|
|
40489
|
+
const keepOnSplit = (_a = callOrReturn(getExtensionField(extension, 'keepOnSplit', context))) !== null && _a !== void 0 ? _a : true;
|
|
40490
|
+
if (keepOnSplit) {
|
|
40491
|
+
this.splittableMarks.push(extension.name);
|
|
40492
|
+
}
|
|
40493
|
+
}
|
|
40494
|
+
const onBeforeCreate = getExtensionField(extension, 'onBeforeCreate', context);
|
|
40495
|
+
const onCreate = getExtensionField(extension, 'onCreate', context);
|
|
40496
|
+
const onUpdate = getExtensionField(extension, 'onUpdate', context);
|
|
40497
|
+
const onSelectionUpdate = getExtensionField(extension, 'onSelectionUpdate', context);
|
|
40498
|
+
const onTransaction = getExtensionField(extension, 'onTransaction', context);
|
|
40499
|
+
const onFocus = getExtensionField(extension, 'onFocus', context);
|
|
40500
|
+
const onBlur = getExtensionField(extension, 'onBlur', context);
|
|
40501
|
+
const onDestroy = getExtensionField(extension, 'onDestroy', context);
|
|
40502
|
+
if (onBeforeCreate) {
|
|
40503
|
+
this.editor.on('beforeCreate', onBeforeCreate);
|
|
40504
|
+
}
|
|
40505
|
+
if (onCreate) {
|
|
40506
|
+
this.editor.on('create', onCreate);
|
|
40507
|
+
}
|
|
40508
|
+
if (onUpdate) {
|
|
40509
|
+
this.editor.on('update', onUpdate);
|
|
40510
|
+
}
|
|
40511
|
+
if (onSelectionUpdate) {
|
|
40512
|
+
this.editor.on('selectionUpdate', onSelectionUpdate);
|
|
40513
|
+
}
|
|
40514
|
+
if (onTransaction) {
|
|
40515
|
+
this.editor.on('transaction', onTransaction);
|
|
40516
|
+
}
|
|
40517
|
+
if (onFocus) {
|
|
40518
|
+
this.editor.on('focus', onFocus);
|
|
40519
|
+
}
|
|
40520
|
+
if (onBlur) {
|
|
40521
|
+
this.editor.on('blur', onBlur);
|
|
40522
|
+
}
|
|
40523
|
+
if (onDestroy) {
|
|
40524
|
+
this.editor.on('destroy', onDestroy);
|
|
40525
|
+
}
|
|
40526
|
+
});
|
|
40527
|
+
}
|
|
40326
40528
|
}
|
|
40327
40529
|
|
|
40328
40530
|
// see: https://github.com/mesqueeb/is-what/blob/88d6e4ca92fb2baab6003c54e02eedf4e729e5ab/src/index.ts
|
|
@@ -40356,6 +40558,10 @@
|
|
|
40356
40558
|
return output;
|
|
40357
40559
|
}
|
|
40358
40560
|
|
|
40561
|
+
/**
|
|
40562
|
+
* The Extension class is the base class for all extensions.
|
|
40563
|
+
* @see https://tiptap.dev/api/extensions#create-a-new-extension
|
|
40564
|
+
*/
|
|
40359
40565
|
class Extension {
|
|
40360
40566
|
constructor(config = {}) {
|
|
40361
40567
|
this.type = 'extension';
|
|
@@ -40393,6 +40599,7 @@
|
|
|
40393
40599
|
// return a new instance so we can use the same extension
|
|
40394
40600
|
// with different calls of `configure`
|
|
40395
40601
|
const extension = this.extend();
|
|
40602
|
+
extension.parent = this.parent;
|
|
40396
40603
|
extension.options = mergeDeep(this.options, options);
|
|
40397
40604
|
extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
|
|
40398
40605
|
name: extension.name,
|
|
@@ -40419,19 +40626,25 @@
|
|
|
40419
40626
|
}
|
|
40420
40627
|
}
|
|
40421
40628
|
|
|
40629
|
+
/**
|
|
40630
|
+
* Gets the text between two positions in a Prosemirror node
|
|
40631
|
+
* and serializes it using the given text serializers and block separator (see getText)
|
|
40632
|
+
* @param startNode The Prosemirror node to start from
|
|
40633
|
+
* @param range The range of the text to get
|
|
40634
|
+
* @param options Options for the text serializer & block separator
|
|
40635
|
+
* @returns The text between the two positions
|
|
40636
|
+
*/
|
|
40422
40637
|
function getTextBetween(startNode, range, options) {
|
|
40423
40638
|
const { from, to } = range;
|
|
40424
40639
|
const { blockSeparator = '\n\n', textSerializers = {} } = options || {};
|
|
40425
40640
|
let text = '';
|
|
40426
|
-
let separated = true;
|
|
40427
40641
|
startNode.nodesBetween(from, to, (node, pos, parent, index) => {
|
|
40428
40642
|
var _a;
|
|
40643
|
+
if (node.isBlock && pos > from) {
|
|
40644
|
+
text += blockSeparator;
|
|
40645
|
+
}
|
|
40429
40646
|
const textSerializer = textSerializers === null || textSerializers === void 0 ? void 0 : textSerializers[node.type.name];
|
|
40430
40647
|
if (textSerializer) {
|
|
40431
|
-
if (node.isBlock && !separated) {
|
|
40432
|
-
text += blockSeparator;
|
|
40433
|
-
separated = true;
|
|
40434
|
-
}
|
|
40435
40648
|
if (parent) {
|
|
40436
40649
|
text += textSerializer({
|
|
40437
40650
|
node,
|
|
@@ -40446,16 +40659,16 @@
|
|
|
40446
40659
|
}
|
|
40447
40660
|
if (node.isText) {
|
|
40448
40661
|
text += (_a = node === null || node === void 0 ? void 0 : node.text) === null || _a === void 0 ? void 0 : _a.slice(Math.max(from, pos) - pos, to - pos); // eslint-disable-line
|
|
40449
|
-
separated = false;
|
|
40450
|
-
}
|
|
40451
|
-
else if (node.isBlock && !separated) {
|
|
40452
|
-
text += blockSeparator;
|
|
40453
|
-
separated = true;
|
|
40454
40662
|
}
|
|
40455
40663
|
});
|
|
40456
40664
|
return text;
|
|
40457
40665
|
}
|
|
40458
40666
|
|
|
40667
|
+
/**
|
|
40668
|
+
* Find text serializers `toText` in a Prosemirror schema
|
|
40669
|
+
* @param schema The Prosemirror schema to search in
|
|
40670
|
+
* @returns A record of text serializers by node name
|
|
40671
|
+
*/
|
|
40459
40672
|
function getTextSerializersFromSchema(schema) {
|
|
40460
40673
|
return Object.fromEntries(Object.entries(schema.nodes)
|
|
40461
40674
|
.filter(([, node]) => node.spec.toText)
|
|
@@ -40838,15 +41051,26 @@
|
|
|
40838
41051
|
return removeWhitespaces(html);
|
|
40839
41052
|
}
|
|
40840
41053
|
|
|
41054
|
+
/**
|
|
41055
|
+
* Takes a JSON or HTML content and creates a Prosemirror node or fragment from it.
|
|
41056
|
+
* @param content The JSON or HTML content to create the node from
|
|
41057
|
+
* @param schema The Prosemirror schema to use for the node
|
|
41058
|
+
* @param options Options for the parser
|
|
41059
|
+
* @returns The created Prosemirror node or fragment
|
|
41060
|
+
*/
|
|
40841
41061
|
function createNodeFromContent(content, schema, options) {
|
|
40842
41062
|
options = {
|
|
40843
41063
|
slice: true,
|
|
40844
41064
|
parseOptions: {},
|
|
40845
41065
|
...options,
|
|
40846
41066
|
};
|
|
40847
|
-
|
|
41067
|
+
const isJSONContent = typeof content === 'object' && content !== null;
|
|
41068
|
+
const isTextContent = typeof content === 'string';
|
|
41069
|
+
if (isJSONContent) {
|
|
40848
41070
|
try {
|
|
40849
|
-
|
|
41071
|
+
const isArrayContent = Array.isArray(content) && content.length > 0;
|
|
41072
|
+
// if the JSON Content is an array of nodes, create a fragment for each node
|
|
41073
|
+
if (isArrayContent) {
|
|
40850
41074
|
return Fragment.fromArray(content.map(item => schema.nodeFromJSON(item)));
|
|
40851
41075
|
}
|
|
40852
41076
|
return schema.nodeFromJSON(content);
|
|
@@ -40856,7 +41080,7 @@
|
|
|
40856
41080
|
return createNodeFromContent('', schema, options);
|
|
40857
41081
|
}
|
|
40858
41082
|
}
|
|
40859
|
-
if (
|
|
41083
|
+
if (isTextContent) {
|
|
40860
41084
|
const parser = DOMParser.fromSchema(schema);
|
|
40861
41085
|
return options.slice
|
|
40862
41086
|
? parser.parseSlice(elementFromString(content), options.parseOptions).content
|
|
@@ -41156,6 +41380,12 @@
|
|
|
41156
41380
|
return newlineInCode$1(state, dispatch);
|
|
41157
41381
|
};
|
|
41158
41382
|
|
|
41383
|
+
/**
|
|
41384
|
+
* Get the type of a schema item by its name.
|
|
41385
|
+
* @param name The name of the schema item
|
|
41386
|
+
* @param schema The Prosemiror schema to search in
|
|
41387
|
+
* @returns The type of the schema item (`node` or `mark`), or null if it doesn't exist
|
|
41388
|
+
*/
|
|
41159
41389
|
function getSchemaTypeNameByName(name, schema) {
|
|
41160
41390
|
if (schema.nodes[name]) {
|
|
41161
41391
|
return 'node';
|
|
@@ -41253,6 +41483,13 @@
|
|
|
41253
41483
|
return selectTextblockStart$1(state, dispatch);
|
|
41254
41484
|
};
|
|
41255
41485
|
|
|
41486
|
+
/**
|
|
41487
|
+
* Create a new Prosemirror document node from content.
|
|
41488
|
+
* @param content The JSON or HTML content to create the document from
|
|
41489
|
+
* @param schema The Prosemirror schema to use for the document
|
|
41490
|
+
* @param parseOptions Options for the parser
|
|
41491
|
+
* @returns The created Prosemirror document node
|
|
41492
|
+
*/
|
|
41256
41493
|
function createDocument(content, schema, parseOptions = {}) {
|
|
41257
41494
|
return createNodeFromContent(content, schema, { slice: false, parseOptions });
|
|
41258
41495
|
}
|
|
@@ -41290,6 +41527,9 @@
|
|
|
41290
41527
|
|
|
41291
41528
|
/**
|
|
41292
41529
|
* Returns a new `Transform` based on all steps of the passed transactions.
|
|
41530
|
+
* @param oldDoc The Prosemirror node to start from
|
|
41531
|
+
* @param transactions The transactions to combine
|
|
41532
|
+
* @returns A new `Transform` with all steps of the passed transactions
|
|
41293
41533
|
*/
|
|
41294
41534
|
function combineTransactionSteps(oldDoc, transactions) {
|
|
41295
41535
|
const transform = new Transform$1(oldDoc);
|
|
@@ -41301,6 +41541,11 @@
|
|
|
41301
41541
|
return transform;
|
|
41302
41542
|
}
|
|
41303
41543
|
|
|
41544
|
+
/**
|
|
41545
|
+
* Gets the default block type at a given match
|
|
41546
|
+
* @param match The content match to get the default block type from
|
|
41547
|
+
* @returns The default block type or null
|
|
41548
|
+
*/
|
|
41304
41549
|
function defaultBlockAt(match) {
|
|
41305
41550
|
for (let i = 0; i < match.edgeCount; i += 1) {
|
|
41306
41551
|
const { type } = match.edge(i);
|
|
@@ -41313,6 +41558,10 @@
|
|
|
41313
41558
|
|
|
41314
41559
|
/**
|
|
41315
41560
|
* Same as `findChildren` but searches only within a `range`.
|
|
41561
|
+
* @param node The Prosemirror node to search in
|
|
41562
|
+
* @param range The range to search in
|
|
41563
|
+
* @param predicate The predicate to match
|
|
41564
|
+
* @returns An array of nodes with their positions
|
|
41316
41565
|
*/
|
|
41317
41566
|
function findChildrenInRange(node, range, predicate) {
|
|
41318
41567
|
const nodesWithPos = [];
|
|
@@ -41336,6 +41585,15 @@
|
|
|
41336
41585
|
return nodesWithPos;
|
|
41337
41586
|
}
|
|
41338
41587
|
|
|
41588
|
+
/**
|
|
41589
|
+
* Finds the closest parent node to a resolved position that matches a predicate.
|
|
41590
|
+
* @param $pos The resolved position to search from
|
|
41591
|
+
* @param predicate The predicate to match
|
|
41592
|
+
* @returns The closest parent node to the resolved position that matches the predicate
|
|
41593
|
+
* @example ```js
|
|
41594
|
+
* findParentNodeClosestToPos($from, node => node.type.name === 'paragraph')
|
|
41595
|
+
* ```
|
|
41596
|
+
*/
|
|
41339
41597
|
function findParentNodeClosestToPos($pos, predicate) {
|
|
41340
41598
|
for (let i = $pos.depth; i > 0; i -= 1) {
|
|
41341
41599
|
const node = $pos.node(i);
|
|
@@ -41350,6 +41608,14 @@
|
|
|
41350
41608
|
}
|
|
41351
41609
|
}
|
|
41352
41610
|
|
|
41611
|
+
/**
|
|
41612
|
+
* Finds the closest parent node to the current selection that matches a predicate.
|
|
41613
|
+
* @param predicate The predicate to match
|
|
41614
|
+
* @returns A command that finds the closest parent node to the current selection that matches the predicate
|
|
41615
|
+
* @example ```js
|
|
41616
|
+
* findParentNode(node => node.type.name === 'paragraph')
|
|
41617
|
+
* ```
|
|
41618
|
+
*/
|
|
41353
41619
|
function findParentNode(predicate) {
|
|
41354
41620
|
return (selection) => findParentNodeClosestToPos(selection.$from, predicate);
|
|
41355
41621
|
}
|
|
@@ -41362,6 +41628,15 @@
|
|
|
41362
41628
|
return container.innerHTML;
|
|
41363
41629
|
}
|
|
41364
41630
|
|
|
41631
|
+
/**
|
|
41632
|
+
* Gets the text of a Prosemirror node
|
|
41633
|
+
* @param node The Prosemirror node
|
|
41634
|
+
* @param options Options for the text serializer & block separator
|
|
41635
|
+
* @returns The text of the node
|
|
41636
|
+
* @example ```js
|
|
41637
|
+
* const text = getText(node, { blockSeparator: '\n' })
|
|
41638
|
+
* ```
|
|
41639
|
+
*/
|
|
41365
41640
|
function getText(node, options) {
|
|
41366
41641
|
const range = {
|
|
41367
41642
|
from: 0,
|
|
@@ -41384,6 +41659,12 @@
|
|
|
41384
41659
|
return { ...node.attrs };
|
|
41385
41660
|
}
|
|
41386
41661
|
|
|
41662
|
+
/**
|
|
41663
|
+
* Get node or mark attributes by type or name on the current editor state
|
|
41664
|
+
* @param state The current editor state
|
|
41665
|
+
* @param typeOrName The node or mark type or name
|
|
41666
|
+
* @returns The attributes of the node or mark or an empty object
|
|
41667
|
+
*/
|
|
41387
41668
|
function getAttributes(state, typeOrName) {
|
|
41388
41669
|
const schemaType = getSchemaTypeNameByName(typeof typeOrName === 'string' ? typeOrName : typeOrName.name, state.schema);
|
|
41389
41670
|
if (schemaType === 'node') {
|
|
@@ -41505,6 +41786,13 @@
|
|
|
41505
41786
|
return marks;
|
|
41506
41787
|
}
|
|
41507
41788
|
|
|
41789
|
+
/**
|
|
41790
|
+
* Return attributes of an extension that should be splitted by keepOnSplit flag
|
|
41791
|
+
* @param extensionAttributes Array of extension attributes
|
|
41792
|
+
* @param typeName The type of the extension
|
|
41793
|
+
* @param attributes The attributes of the extension
|
|
41794
|
+
* @returns The splitted attributes
|
|
41795
|
+
*/
|
|
41508
41796
|
function getSplittedAttributes(extensionAttributes, typeName, attributes) {
|
|
41509
41797
|
return Object.fromEntries(Object
|
|
41510
41798
|
.entries(attributes)
|
|
@@ -42293,7 +42581,12 @@
|
|
|
42293
42581
|
const isAtStart = (parentIsIsolating && $parentPos.parent.childCount === 1)
|
|
42294
42582
|
? parentPos === $anchor.pos
|
|
42295
42583
|
: Selection$2.atStart(doc).from === pos;
|
|
42296
|
-
if (!empty
|
|
42584
|
+
if (!empty
|
|
42585
|
+
|| !parent.type.isTextblock
|
|
42586
|
+
|| parent.textContent.length
|
|
42587
|
+
|| !isAtStart
|
|
42588
|
+
|| (isAtStart && $anchor.parent.type.name === 'paragraph') // prevent clearNodes when no nodes to clear, otherwise history stack is appended
|
|
42589
|
+
) {
|
|
42297
42590
|
return false;
|
|
42298
42591
|
}
|
|
42299
42592
|
return commands.clearNodes();
|
|
@@ -42545,28 +42838,30 @@
|
|
|
42545
42838
|
}
|
|
42546
42839
|
querySelectorAll(selector, attributes = {}, firstItemOnly = false) {
|
|
42547
42840
|
let nodes = [];
|
|
42548
|
-
// iterate through children recursively finding all nodes which match the selector with the node name
|
|
42549
42841
|
if (!this.children || this.children.length === 0) {
|
|
42550
42842
|
return nodes;
|
|
42551
42843
|
}
|
|
42844
|
+
const attrKeys = Object.keys(attributes);
|
|
42845
|
+
/**
|
|
42846
|
+
* Finds all children recursively that match the selector and attributes
|
|
42847
|
+
* If firstItemOnly is true, it will return the first item found
|
|
42848
|
+
*/
|
|
42552
42849
|
this.children.forEach(childPos => {
|
|
42850
|
+
// If we already found a node and we only want the first item, we dont need to keep going
|
|
42851
|
+
if (firstItemOnly && nodes.length > 0) {
|
|
42852
|
+
return;
|
|
42853
|
+
}
|
|
42553
42854
|
if (childPos.node.type.name === selector) {
|
|
42554
|
-
|
|
42555
|
-
|
|
42556
|
-
|
|
42557
|
-
for (let index = 0; index < attrKeys.length; index += 1) {
|
|
42558
|
-
const key = attrKeys[index];
|
|
42559
|
-
if (nodeAttributes[key] !== attributes[key]) {
|
|
42560
|
-
return;
|
|
42561
|
-
}
|
|
42562
|
-
}
|
|
42563
|
-
}
|
|
42564
|
-
nodes.push(childPos);
|
|
42565
|
-
if (firstItemOnly) {
|
|
42566
|
-
return;
|
|
42855
|
+
const doesAllAttributesMatch = attrKeys.every(key => attributes[key] === childPos.node.attrs[key]);
|
|
42856
|
+
if (doesAllAttributesMatch) {
|
|
42857
|
+
nodes.push(childPos);
|
|
42567
42858
|
}
|
|
42568
42859
|
}
|
|
42569
|
-
|
|
42860
|
+
// If we already found a node and we only want the first item, we can stop here and skip the recursion
|
|
42861
|
+
if (firstItemOnly && nodes.length > 0) {
|
|
42862
|
+
return;
|
|
42863
|
+
}
|
|
42864
|
+
nodes = nodes.concat(childPos.querySelectorAll(selector, attributes, firstItemOnly));
|
|
42570
42865
|
});
|
|
42571
42866
|
return nodes;
|
|
42572
42867
|
}
|
|
@@ -43053,6 +43348,7 @@ img.ProseMirror-separator {
|
|
|
43053
43348
|
/**
|
|
43054
43349
|
* Build an input rule that adds a mark when the
|
|
43055
43350
|
* matched text is typed into it.
|
|
43351
|
+
* @see https://tiptap.dev/guide/custom-extensions/#input-rules
|
|
43056
43352
|
*/
|
|
43057
43353
|
function markInputRule(config) {
|
|
43058
43354
|
return new InputRule({
|
|
@@ -43106,6 +43402,7 @@ img.ProseMirror-separator {
|
|
|
43106
43402
|
* two nodes. You can pass a join predicate, which takes a regular
|
|
43107
43403
|
* expression match and the node before the wrapped node, and can
|
|
43108
43404
|
* return a boolean to indicate whether a join should happen.
|
|
43405
|
+
* @see https://tiptap.dev/guide/custom-extensions/#input-rules
|
|
43109
43406
|
*/
|
|
43110
43407
|
function wrappingInputRule(config) {
|
|
43111
43408
|
return new InputRule({
|
|
@@ -43145,6 +43442,10 @@ img.ProseMirror-separator {
|
|
|
43145
43442
|
});
|
|
43146
43443
|
}
|
|
43147
43444
|
|
|
43445
|
+
/**
|
|
43446
|
+
* The Mark class is used to create custom mark extensions.
|
|
43447
|
+
* @see https://tiptap.dev/api/extensions#create-a-new-extension
|
|
43448
|
+
*/
|
|
43148
43449
|
class Mark {
|
|
43149
43450
|
constructor(config = {}) {
|
|
43150
43451
|
this.type = 'mark';
|
|
@@ -43228,6 +43529,10 @@ img.ProseMirror-separator {
|
|
|
43228
43529
|
}
|
|
43229
43530
|
}
|
|
43230
43531
|
|
|
43532
|
+
/**
|
|
43533
|
+
* The Node class is used to create custom node extensions.
|
|
43534
|
+
* @see https://tiptap.dev/api/extensions#create-a-new-extension
|
|
43535
|
+
*/
|
|
43231
43536
|
let Node$1 = class Node {
|
|
43232
43537
|
constructor(config = {}) {
|
|
43233
43538
|
this.type = 'node';
|
|
@@ -43294,6 +43599,7 @@ img.ProseMirror-separator {
|
|
|
43294
43599
|
/**
|
|
43295
43600
|
* Build an paste rule that adds a mark when the
|
|
43296
43601
|
* matched text is pasted into it.
|
|
43602
|
+
* @see https://tiptap.dev/guide/custom-extensions/#paste-rules
|
|
43297
43603
|
*/
|
|
43298
43604
|
function markPasteRule(config) {
|
|
43299
43605
|
return new PasteRule({
|
|
@@ -43340,6 +43646,10 @@ img.ProseMirror-separator {
|
|
|
43340
43646
|
return string.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
43341
43647
|
}
|
|
43342
43648
|
|
|
43649
|
+
/**
|
|
43650
|
+
* This extension allows you to insert hard breaks.
|
|
43651
|
+
* @see https://www.tiptap.dev/api/nodes/hard-break
|
|
43652
|
+
*/
|
|
43343
43653
|
const HardBreak = Node$1.create({
|
|
43344
43654
|
name: 'hardBreak',
|
|
43345
43655
|
addOptions() {
|
|
@@ -54023,10 +54333,26 @@ img.ProseMirror-separator {
|
|
|
54023
54333
|
observable
|
|
54024
54334
|
], RichText.prototype, "configuration", void 0);
|
|
54025
54335
|
|
|
54336
|
+
/**
|
|
54337
|
+
* Matches bold text via `**` as input.
|
|
54338
|
+
*/
|
|
54026
54339
|
const starInputRegex$1 = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/;
|
|
54340
|
+
/**
|
|
54341
|
+
* Matches bold text via `**` while pasting.
|
|
54342
|
+
*/
|
|
54027
54343
|
const starPasteRegex$1 = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g;
|
|
54344
|
+
/**
|
|
54345
|
+
* Matches bold text via `__` as input.
|
|
54346
|
+
*/
|
|
54028
54347
|
const underscoreInputRegex$1 = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/;
|
|
54348
|
+
/**
|
|
54349
|
+
* Matches bold text via `__` while pasting.
|
|
54350
|
+
*/
|
|
54029
54351
|
const underscorePasteRegex$1 = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g;
|
|
54352
|
+
/**
|
|
54353
|
+
* This extension allows you to mark text as bold.
|
|
54354
|
+
* @see https://tiptap.dev/api/marks/bold
|
|
54355
|
+
*/
|
|
54030
54356
|
const Bold = Mark.create({
|
|
54031
54357
|
name: 'bold',
|
|
54032
54358
|
addOptions() {
|
|
@@ -54097,6 +54423,10 @@ img.ProseMirror-separator {
|
|
|
54097
54423
|
},
|
|
54098
54424
|
});
|
|
54099
54425
|
|
|
54426
|
+
/**
|
|
54427
|
+
* This extension allows you to create list items.
|
|
54428
|
+
* @see https://www.tiptap.dev/api/nodes/list-item
|
|
54429
|
+
*/
|
|
54100
54430
|
const ListItem$2 = Node$1.create({
|
|
54101
54431
|
name: 'listItem',
|
|
54102
54432
|
addOptions() {
|
|
@@ -54127,6 +54457,11 @@ img.ProseMirror-separator {
|
|
|
54127
54457
|
},
|
|
54128
54458
|
});
|
|
54129
54459
|
|
|
54460
|
+
/**
|
|
54461
|
+
* This extension allows you to create text styles. It is required by default
|
|
54462
|
+
* for the `textColor` and `backgroundColor` extensions.
|
|
54463
|
+
* @see https://www.tiptap.dev/api/marks/text-style
|
|
54464
|
+
*/
|
|
54130
54465
|
const TextStyle$1 = Mark.create({
|
|
54131
54466
|
name: 'textStyle',
|
|
54132
54467
|
addOptions() {
|
|
@@ -54165,7 +54500,16 @@ img.ProseMirror-separator {
|
|
|
54165
54500
|
},
|
|
54166
54501
|
});
|
|
54167
54502
|
|
|
54503
|
+
/**
|
|
54504
|
+
* Matches a bullet list to a dash or asterisk.
|
|
54505
|
+
*/
|
|
54168
54506
|
const inputRegex$1 = /^\s*([-+*])\s$/;
|
|
54507
|
+
/**
|
|
54508
|
+
* This extension allows you to create bullet lists.
|
|
54509
|
+
* This requires the ListItem extension
|
|
54510
|
+
* @see https://tiptap.dev/api/nodes/bullet-list
|
|
54511
|
+
* @see https://tiptap.dev/api/nodes/list-item.
|
|
54512
|
+
*/
|
|
54169
54513
|
const BulletList = Node$1.create({
|
|
54170
54514
|
name: 'bulletList',
|
|
54171
54515
|
addOptions() {
|
|
@@ -54224,6 +54568,10 @@ img.ProseMirror-separator {
|
|
|
54224
54568
|
},
|
|
54225
54569
|
});
|
|
54226
54570
|
|
|
54571
|
+
/**
|
|
54572
|
+
* The default document node which represents the top level node of the editor.
|
|
54573
|
+
* @see https://tiptap.dev/api/nodes/document
|
|
54574
|
+
*/
|
|
54227
54575
|
const Document$1 = Node$1.create({
|
|
54228
54576
|
name: 'doc',
|
|
54229
54577
|
topNode: true,
|
|
@@ -54844,6 +55192,15 @@ img.ProseMirror-separator {
|
|
|
54844
55192
|
*/
|
|
54845
55193
|
const redo = buildCommand(true, true);
|
|
54846
55194
|
|
|
55195
|
+
/**
|
|
55196
|
+
* This extension allows you to undo and redo recent changes.
|
|
55197
|
+
* @see https://www.tiptap.dev/api/extensions/history
|
|
55198
|
+
*
|
|
55199
|
+
* **Important**: If the `@tiptap/extension-collaboration` package is used, make sure to remove
|
|
55200
|
+
* the `history` extension, as it is not compatible with the `collaboration` extension.
|
|
55201
|
+
*
|
|
55202
|
+
* `@tiptap/extension-collaboration` uses its own history implementation.
|
|
55203
|
+
*/
|
|
54847
55204
|
const History = Extension.create({
|
|
54848
55205
|
name: 'history',
|
|
54849
55206
|
addOptions() {
|
|
@@ -54879,10 +55236,26 @@ img.ProseMirror-separator {
|
|
|
54879
55236
|
},
|
|
54880
55237
|
});
|
|
54881
55238
|
|
|
55239
|
+
/**
|
|
55240
|
+
* Matches an italic to a *italic* on input.
|
|
55241
|
+
*/
|
|
54882
55242
|
const starInputRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/;
|
|
55243
|
+
/**
|
|
55244
|
+
* Matches an italic to a *italic* on paste.
|
|
55245
|
+
*/
|
|
54883
55246
|
const starPasteRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g;
|
|
55247
|
+
/**
|
|
55248
|
+
* Matches an italic to a _italic_ on input.
|
|
55249
|
+
*/
|
|
54884
55250
|
const underscoreInputRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/;
|
|
55251
|
+
/**
|
|
55252
|
+
* Matches an italic to a _italic_ on paste.
|
|
55253
|
+
*/
|
|
54885
55254
|
const underscorePasteRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g;
|
|
55255
|
+
/**
|
|
55256
|
+
* This extension allows you to create italic text.
|
|
55257
|
+
* @see https://www.tiptap.dev/api/marks/italic
|
|
55258
|
+
*/
|
|
54886
55259
|
const Italic = Mark.create({
|
|
54887
55260
|
name: 'italic',
|
|
54888
55261
|
addOptions() {
|
|
@@ -56717,12 +57090,27 @@ img.ProseMirror-separator {
|
|
|
56717
57090
|
}
|
|
56718
57091
|
return false;
|
|
56719
57092
|
}
|
|
57093
|
+
/**
|
|
57094
|
+
* This plugin allows you to automatically add links to your editor.
|
|
57095
|
+
* @param options The plugin options
|
|
57096
|
+
* @returns The plugin instance
|
|
57097
|
+
*/
|
|
56720
57098
|
function autolink(options) {
|
|
56721
57099
|
return new Plugin({
|
|
56722
57100
|
key: new PluginKey('autolink'),
|
|
56723
57101
|
appendTransaction: (transactions, oldState, newState) => {
|
|
57102
|
+
/**
|
|
57103
|
+
* Does the transaction change the document?
|
|
57104
|
+
*/
|
|
56724
57105
|
const docChanges = transactions.some(transaction => transaction.docChanged) && !oldState.doc.eq(newState.doc);
|
|
57106
|
+
/**
|
|
57107
|
+
* Prevent autolink if the transaction is not a document change or if the transaction has the meta `preventAutolink`.
|
|
57108
|
+
*/
|
|
56725
57109
|
const preventAutolink = transactions.some(transaction => transaction.getMeta('preventAutolink'));
|
|
57110
|
+
/**
|
|
57111
|
+
* Prevent autolink if the transaction is not a document change
|
|
57112
|
+
* or if the transaction has the meta `preventAutolink`.
|
|
57113
|
+
*/
|
|
56726
57114
|
if (!docChanges || preventAutolink) {
|
|
56727
57115
|
return;
|
|
56728
57116
|
}
|
|
@@ -56862,6 +57250,10 @@ img.ProseMirror-separator {
|
|
|
56862
57250
|
},
|
|
56863
57251
|
});
|
|
56864
57252
|
}
|
|
57253
|
+
/**
|
|
57254
|
+
* This extension allows you to create links.
|
|
57255
|
+
* @see https://www.tiptap.dev/api/marks/link
|
|
57256
|
+
*/
|
|
56865
57257
|
const Link = Mark.create({
|
|
56866
57258
|
name: 'link',
|
|
56867
57259
|
priority: 1000,
|
|
@@ -56996,6 +57388,10 @@ img.ProseMirror-separator {
|
|
|
56996
57388
|
},
|
|
56997
57389
|
});
|
|
56998
57390
|
|
|
57391
|
+
/**
|
|
57392
|
+
* This extension allows you to create list items.
|
|
57393
|
+
* @see https://www.tiptap.dev/api/nodes/list-item
|
|
57394
|
+
*/
|
|
56999
57395
|
const ListItem$1 = Node$1.create({
|
|
57000
57396
|
name: 'listItem',
|
|
57001
57397
|
addOptions() {
|
|
@@ -57026,6 +57422,10 @@ img.ProseMirror-separator {
|
|
|
57026
57422
|
},
|
|
57027
57423
|
});
|
|
57028
57424
|
|
|
57425
|
+
/**
|
|
57426
|
+
* This extension allows you to create list items.
|
|
57427
|
+
* @see https://www.tiptap.dev/api/nodes/list-item
|
|
57428
|
+
*/
|
|
57029
57429
|
const ListItem = Node$1.create({
|
|
57030
57430
|
name: 'listItem',
|
|
57031
57431
|
addOptions() {
|
|
@@ -57056,6 +57456,11 @@ img.ProseMirror-separator {
|
|
|
57056
57456
|
},
|
|
57057
57457
|
});
|
|
57058
57458
|
|
|
57459
|
+
/**
|
|
57460
|
+
* This extension allows you to create text styles. It is required by default
|
|
57461
|
+
* for the `textColor` and `backgroundColor` extensions.
|
|
57462
|
+
* @see https://www.tiptap.dev/api/marks/text-style
|
|
57463
|
+
*/
|
|
57059
57464
|
const TextStyle = Mark.create({
|
|
57060
57465
|
name: 'textStyle',
|
|
57061
57466
|
addOptions() {
|
|
@@ -57094,7 +57499,16 @@ img.ProseMirror-separator {
|
|
|
57094
57499
|
},
|
|
57095
57500
|
});
|
|
57096
57501
|
|
|
57502
|
+
/**
|
|
57503
|
+
* Matches an ordered list to a 1. on input (or any number followed by a dot).
|
|
57504
|
+
*/
|
|
57097
57505
|
const inputRegex = /^(\d+)\.\s$/;
|
|
57506
|
+
/**
|
|
57507
|
+
* This extension allows you to create ordered lists.
|
|
57508
|
+
* This requires the ListItem extension
|
|
57509
|
+
* @see https://www.tiptap.dev/api/nodes/ordered-list
|
|
57510
|
+
* @see https://www.tiptap.dev/api/nodes/list-item
|
|
57511
|
+
*/
|
|
57098
57512
|
const OrderedList = Node$1.create({
|
|
57099
57513
|
name: 'orderedList',
|
|
57100
57514
|
addOptions() {
|
|
@@ -57173,6 +57587,10 @@ img.ProseMirror-separator {
|
|
|
57173
57587
|
},
|
|
57174
57588
|
});
|
|
57175
57589
|
|
|
57590
|
+
/**
|
|
57591
|
+
* This extension allows you to create paragraphs.
|
|
57592
|
+
* @see https://www.tiptap.dev/api/nodes/paragraph
|
|
57593
|
+
*/
|
|
57176
57594
|
const Paragraph = Node$1.create({
|
|
57177
57595
|
name: 'paragraph',
|
|
57178
57596
|
priority: 1000,
|
|
@@ -57205,6 +57623,11 @@ img.ProseMirror-separator {
|
|
|
57205
57623
|
},
|
|
57206
57624
|
});
|
|
57207
57625
|
|
|
57626
|
+
/**
|
|
57627
|
+
* This extension allows you to add a placeholder to your editor.
|
|
57628
|
+
* A placeholder is a text that appears when the editor or a node is empty.
|
|
57629
|
+
* @see https://www.tiptap.dev/api/extensions/placeholder
|
|
57630
|
+
*/
|
|
57208
57631
|
const Placeholder = Extension.create({
|
|
57209
57632
|
name: 'placeholder',
|
|
57210
57633
|
addOptions() {
|
|
@@ -57273,6 +57696,10 @@ img.ProseMirror-separator {
|
|
|
57273
57696
|
},
|
|
57274
57697
|
});
|
|
57275
57698
|
|
|
57699
|
+
/**
|
|
57700
|
+
* This extension allows you to create text nodes.
|
|
57701
|
+
* @see https://www.tiptap.dev/api/nodes/text
|
|
57702
|
+
*/
|
|
57276
57703
|
const Text = Node$1.create({
|
|
57277
57704
|
name: 'text',
|
|
57278
57705
|
group: 'inline',
|
|
@@ -57327,6 +57754,10 @@ img.ProseMirror-separator {
|
|
|
57327
57754
|
}
|
|
57328
57755
|
|
|
57329
57756
|
const SuggestionPluginKey = new PluginKey('suggestion');
|
|
57757
|
+
/**
|
|
57758
|
+
* This utility allows you to create suggestions.
|
|
57759
|
+
* @see https://tiptap.dev/api/utilities/suggestion
|
|
57760
|
+
*/
|
|
57330
57761
|
function Suggestion({ pluginKey = SuggestionPluginKey, editor, char = '@', allowSpaces = false, allowedPrefixes = [' '], startOfLine = false, decorationTag = 'span', decorationClass = 'suggestion', command = () => null, items = () => [], render = () => ({}), allow = () => true, findSuggestionMatch: findSuggestionMatch$1 = findSuggestionMatch, }) {
|
|
57331
57762
|
let props;
|
|
57332
57763
|
const renderer = render === null || render === void 0 ? void 0 : render();
|
|
@@ -57503,7 +57934,15 @@ img.ProseMirror-separator {
|
|
|
57503
57934
|
return plugin;
|
|
57504
57935
|
}
|
|
57505
57936
|
|
|
57937
|
+
/**
|
|
57938
|
+
* The plugin key for the mention plugin.
|
|
57939
|
+
* @default 'mention'
|
|
57940
|
+
*/
|
|
57506
57941
|
const MentionPluginKey = new PluginKey('mention');
|
|
57942
|
+
/**
|
|
57943
|
+
* This extension allows you to insert mentions into the editor.
|
|
57944
|
+
* @see https://www.tiptap.dev/api/extensions/mention
|
|
57945
|
+
*/
|
|
57507
57946
|
const Mention = Node$1.create({
|
|
57508
57947
|
name: 'mention',
|
|
57509
57948
|
addOptions() {
|