@uzum-tech/ui 2.4.6 → 2.4.7
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/index.js +109 -19
- package/dist/index.mjs +109 -19
- package/dist/index.prod.js +2 -2
- package/dist/index.prod.mjs +2 -2
- package/es/chat/src/styles/index.cssr.mjs +1 -1
- package/es/components.d.ts +66 -0
- package/es/editor/index.d.ts +1 -1
- package/es/editor/src/Editor.d.ts +21 -0
- package/es/editor/src/Editor.mjs +5 -2
- package/es/editor/src/EditorParts/EditorContent/EditorContent.d.ts +27 -0
- package/es/editor/src/EditorParts/EditorContent/EditorContent.mjs +37 -3
- package/es/editor/src/EditorParts/EditorContent/interface.d.ts +11 -0
- package/es/editor/src/EditorParts/EditorContent/interface.mjs +2 -0
- package/es/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +18 -0
- package/es/editor/src/EditorParts/EditorToolbar/interface.d.ts +9 -0
- package/es/editor/src/composables/use-editor-css-vars.mjs +8 -2
- package/es/editor/src/extensions.d.ts +2 -1
- package/es/editor/src/extensions.mjs +34 -4
- package/es/editor/src/interface.d.ts +22 -2
- package/es/editor/src/interface.mjs +1 -0
- package/es/editor/src/styles/index.cssr.mjs +21 -4
- package/es/editor/styles/dark.d.ts +3 -0
- package/es/editor/styles/light.d.ts +6 -0
- package/es/editor/styles/light.mjs +6 -1
- package/es/message-bubble/src/styles/index.cssr.mjs +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/lib/chat/src/styles/index.cssr.js +1 -1
- package/lib/components.d.ts +66 -0
- package/lib/editor/index.d.ts +1 -1
- package/lib/editor/src/Editor.d.ts +21 -0
- package/lib/editor/src/Editor.js +4 -2
- package/lib/editor/src/EditorParts/EditorContent/EditorContent.d.ts +27 -0
- package/lib/editor/src/EditorParts/EditorContent/EditorContent.js +30 -3
- package/lib/editor/src/EditorParts/EditorContent/interface.d.ts +11 -0
- package/lib/editor/src/EditorParts/EditorContent/interface.js +1 -1
- package/lib/editor/src/EditorParts/EditorToolbar/EditorToolbar.d.ts +18 -0
- package/lib/editor/src/EditorParts/EditorToolbar/interface.d.ts +9 -0
- package/lib/editor/src/composables/use-editor-css-vars.js +5 -2
- package/lib/editor/src/extensions.d.ts +2 -1
- package/lib/editor/src/extensions.js +41 -5
- package/lib/editor/src/interface.d.ts +22 -2
- package/lib/editor/src/interface.js +1 -1
- package/lib/editor/src/styles/index.cssr.js +21 -4
- package/lib/editor/styles/dark.d.ts +3 -0
- package/lib/editor/styles/light.d.ts +6 -0
- package/lib/editor/styles/light.js +5 -2
- package/lib/message-bubble/src/styles/index.cssr.js +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/web-types.json +21 -2
package/dist/index.js
CHANGED
|
@@ -54542,6 +54542,8 @@
|
|
|
54542
54542
|
lineHeightTitleSmall,
|
|
54543
54543
|
lineHeightBodyLarge,
|
|
54544
54544
|
lineHeightBodyMedium,
|
|
54545
|
+
fontBodySmall,
|
|
54546
|
+
lineHeightBodySmall,
|
|
54545
54547
|
surfacePrimary,
|
|
54546
54548
|
elementsQuaternary,
|
|
54547
54549
|
elementsQuinary,
|
|
@@ -54598,7 +54600,10 @@
|
|
|
54598
54600
|
markdownH1LineHeight: lineHeightTitleMedium,
|
|
54599
54601
|
markdownH2LineHeight: lineHeightTitleSmall,
|
|
54600
54602
|
markdownH3LineHeight: lineHeightBodyLarge,
|
|
54601
|
-
markdownTextLineHeight: lineHeightBodyMedium
|
|
54603
|
+
markdownTextLineHeight: lineHeightBodyMedium,
|
|
54604
|
+
countTextColor: textTertiary,
|
|
54605
|
+
countFontSize: fontBodySmall,
|
|
54606
|
+
countLineHeight: lineHeightBodySmall
|
|
54602
54607
|
};
|
|
54603
54608
|
}
|
|
54604
54609
|
const editorLight = createTheme$1({
|
|
@@ -60869,7 +60874,7 @@
|
|
|
60869
60874
|
border-radius: var(--u-message-bubble-border-radius);
|
|
60870
60875
|
font-size: 14px;
|
|
60871
60876
|
line-height: 20px;
|
|
60872
|
-
|
|
60877
|
+
overflow-wrap: anywhere;
|
|
60873
60878
|
background-color: var(--u-message-bubble-background-color-other);
|
|
60874
60879
|
color: var(--u-message-bubble-text-color-other);
|
|
60875
60880
|
border-bottom-left-radius: 6px;
|
|
@@ -61954,7 +61959,7 @@
|
|
|
61954
61959
|
border-radius: 18px;
|
|
61955
61960
|
font-size: 14px;
|
|
61956
61961
|
line-height: 20px;
|
|
61957
|
-
|
|
61962
|
+
overflow-wrap: anywhere;
|
|
61958
61963
|
background-color: var(--u-message-bubble-background-color-other);
|
|
61959
61964
|
color: var(--u-message-bubble-text-color-other);
|
|
61960
61965
|
border-bottom-left-radius: 6px;
|
|
@@ -82948,7 +82953,10 @@ img.ProseMirror-separator {
|
|
|
82948
82953
|
markdownH1LineHeight,
|
|
82949
82954
|
markdownH2LineHeight,
|
|
82950
82955
|
markdownH3LineHeight,
|
|
82951
|
-
markdownTextLineHeight
|
|
82956
|
+
markdownTextLineHeight,
|
|
82957
|
+
countTextColor,
|
|
82958
|
+
countFontSize,
|
|
82959
|
+
countLineHeight
|
|
82952
82960
|
} = themeVarsRef.value;
|
|
82953
82961
|
return {
|
|
82954
82962
|
"--u-bezier": cubicBezierEaseInOut,
|
|
@@ -82988,7 +82996,10 @@ img.ProseMirror-separator {
|
|
|
82988
82996
|
"--u-editor-markdown-h1-line-height": markdownH1LineHeight,
|
|
82989
82997
|
"--u-editor-markdown-h2-line-height": markdownH2LineHeight,
|
|
82990
82998
|
"--u-editor-markdown-h3-line-height": markdownH3LineHeight,
|
|
82991
|
-
"--u-editor-markdown-text-line-height": markdownTextLineHeight
|
|
82999
|
+
"--u-editor-markdown-text-line-height": markdownTextLineHeight,
|
|
83000
|
+
"--u-editor-count-text-color": countTextColor,
|
|
83001
|
+
"--u-editor-count-font-size": countFontSize,
|
|
83002
|
+
"--u-editor-count-line-height": countLineHeight
|
|
82992
83003
|
};
|
|
82993
83004
|
});
|
|
82994
83005
|
}
|
|
@@ -83028,6 +83039,7 @@ img.ProseMirror-separator {
|
|
|
83028
83039
|
autofocus: Boolean,
|
|
83029
83040
|
maxLength: Number,
|
|
83030
83041
|
maxRows: Number,
|
|
83042
|
+
showCount: Boolean,
|
|
83031
83043
|
toolbarButtonProps: Object,
|
|
83032
83044
|
toolbarIconProps: Object,
|
|
83033
83045
|
toolbarDropdownProps: Object,
|
|
@@ -83063,7 +83075,11 @@ img.ProseMirror-separator {
|
|
|
83063
83075
|
margin: 0;
|
|
83064
83076
|
`), cE("toolbar-block-type", `
|
|
83065
83077
|
width: 71px;
|
|
83066
|
-
`)]), cE("
|
|
83078
|
+
`)]), cE("body", `
|
|
83079
|
+
display: flex;
|
|
83080
|
+
flex-direction: column;
|
|
83081
|
+
gap: 4px;
|
|
83082
|
+
`), cE("content-wrapper", `
|
|
83067
83083
|
position: relative;
|
|
83068
83084
|
box-sizing: border-box;
|
|
83069
83085
|
display: flex;
|
|
@@ -83085,7 +83101,14 @@ img.ProseMirror-separator {
|
|
|
83085
83101
|
right: 6px;
|
|
83086
83102
|
top: 6px;
|
|
83087
83103
|
flex-shrink: 0;
|
|
83088
|
-
`)]), cE("
|
|
83104
|
+
`)]), cE("count", `
|
|
83105
|
+
align-self: flex-end;
|
|
83106
|
+
font-size: var(--u-editor-count-font-size);
|
|
83107
|
+
line-height: var(--u-editor-count-line-height);
|
|
83108
|
+
color: var(--u-editor-count-text-color);
|
|
83109
|
+
white-space: nowrap;
|
|
83110
|
+
padding-right: 10px;
|
|
83111
|
+
`), cE("content", `
|
|
83089
83112
|
white-space: normal;
|
|
83090
83113
|
width: 100%;
|
|
83091
83114
|
min-width: 0;
|
|
@@ -83093,7 +83116,7 @@ img.ProseMirror-separator {
|
|
|
83093
83116
|
color: var(--u-editor-content-text-color);
|
|
83094
83117
|
font-size: var(--u-editor-markdown-text-font-size);
|
|
83095
83118
|
line-height: var(--u-editor-markdown-text-line-height);
|
|
83096
|
-
|
|
83119
|
+
overflow-wrap: anywhere;
|
|
83097
83120
|
`, [cM("scrollable", `
|
|
83098
83121
|
overflow-y: auto;
|
|
83099
83122
|
scrollbar-width: none;
|
|
@@ -83101,7 +83124,10 @@ img.ProseMirror-separator {
|
|
|
83101
83124
|
width: 0;
|
|
83102
83125
|
height: 0;
|
|
83103
83126
|
display: none;
|
|
83104
|
-
`)]), cE("editable",
|
|
83127
|
+
`)]), cE("editable", `
|
|
83128
|
+
outline: none;
|
|
83129
|
+
overflow-wrap: anywhere;
|
|
83130
|
+
`, [c$1(".is-editor-empty:first-child::before", `
|
|
83105
83131
|
content: attr(data-placeholder);
|
|
83106
83132
|
float: left;
|
|
83107
83133
|
height: 0;
|
|
@@ -83192,6 +83218,8 @@ img.ProseMirror-separator {
|
|
|
83192
83218
|
},
|
|
83193
83219
|
sendDisabled: Boolean,
|
|
83194
83220
|
maxRows: Number,
|
|
83221
|
+
showCount: Boolean,
|
|
83222
|
+
maxLength: Number,
|
|
83195
83223
|
sendTooltip: String,
|
|
83196
83224
|
disabled: Boolean,
|
|
83197
83225
|
sendButtonProps: Object,
|
|
@@ -83227,6 +83255,7 @@ img.ProseMirror-separator {
|
|
|
83227
83255
|
const sendButtonThemeOverridesRef = vue.computed(() => createSendButtonThemeOverrides(themeVarsRef.value));
|
|
83228
83256
|
const scrollbarInstRef = vue.ref(null);
|
|
83229
83257
|
const contentInstRef = vue.ref(null);
|
|
83258
|
+
const characterCountRef = vue.ref(0);
|
|
83230
83259
|
const mergedMaxRowsRef = vue.computed(
|
|
83231
83260
|
() => UEditor?.maxRowsRef.value ?? props.maxRows
|
|
83232
83261
|
);
|
|
@@ -83245,18 +83274,27 @@ img.ProseMirror-separator {
|
|
|
83245
83274
|
function syncScrollbar() {
|
|
83246
83275
|
scrollbarInstRef.value?.syncUnifiedContainer();
|
|
83247
83276
|
}
|
|
83277
|
+
function syncCharacterCount() {
|
|
83278
|
+
characterCountRef.value = editorInstanceRef.value?.storage.characterCount?.characters() ?? 0;
|
|
83279
|
+
}
|
|
83280
|
+
function handleTransaction({ transaction }) {
|
|
83281
|
+
syncScrollbar();
|
|
83282
|
+
if (transaction.docChanged)
|
|
83283
|
+
syncCharacterCount();
|
|
83284
|
+
}
|
|
83248
83285
|
function unsubscribe() {
|
|
83249
|
-
subscribed?.off("transaction",
|
|
83286
|
+
subscribed?.off("transaction", handleTransaction);
|
|
83250
83287
|
subscribed = void 0;
|
|
83251
83288
|
}
|
|
83252
83289
|
vue.watch(
|
|
83253
83290
|
editorInstanceRef,
|
|
83254
83291
|
(editor) => {
|
|
83255
83292
|
unsubscribe();
|
|
83293
|
+
syncCharacterCount();
|
|
83256
83294
|
if (!editor)
|
|
83257
83295
|
return;
|
|
83258
83296
|
subscribed = editor;
|
|
83259
|
-
editor.on("transaction",
|
|
83297
|
+
editor.on("transaction", handleTransaction);
|
|
83260
83298
|
},
|
|
83261
83299
|
{ immediate: true }
|
|
83262
83300
|
);
|
|
@@ -83295,6 +83333,16 @@ img.ProseMirror-separator {
|
|
|
83295
83333
|
mergedContentProps: vue.computed(
|
|
83296
83334
|
() => UEditor?.contentPropsRef.value ?? props.contentProps
|
|
83297
83335
|
),
|
|
83336
|
+
mergedShowCount: vue.computed(
|
|
83337
|
+
() => UEditor?.showCountRef.value ?? props.showCount
|
|
83338
|
+
),
|
|
83339
|
+
mergedMaxLength: vue.computed(
|
|
83340
|
+
() => UEditor?.maxLengthRef.value ?? props.maxLength
|
|
83341
|
+
),
|
|
83342
|
+
countAvailable: vue.computed(
|
|
83343
|
+
() => !!editorInstanceRef.value?.storage.characterCount
|
|
83344
|
+
),
|
|
83345
|
+
characterCount: characterCountRef,
|
|
83298
83346
|
scrollbarInstRef,
|
|
83299
83347
|
contentInstRef,
|
|
83300
83348
|
mergedMaxRows: mergedMaxRowsRef,
|
|
@@ -83306,7 +83354,7 @@ img.ProseMirror-separator {
|
|
|
83306
83354
|
},
|
|
83307
83355
|
render() {
|
|
83308
83356
|
this.onRender?.();
|
|
83309
|
-
const
|
|
83357
|
+
const contentWrapper = /* @__PURE__ */ vue.h(
|
|
83310
83358
|
"div",
|
|
83311
83359
|
{
|
|
83312
83360
|
class: [
|
|
@@ -83352,6 +83400,16 @@ img.ProseMirror-separator {
|
|
|
83352
83400
|
{ icon: this.$slots.sendIcon }
|
|
83353
83401
|
)
|
|
83354
83402
|
);
|
|
83403
|
+
const content = this.mergedShowCount ? /* @__PURE__ */ vue.h("div", { class: `${this.mergedClsPrefix}-editor__body` }, contentWrapper, this.countAvailable && /* @__PURE__ */ vue.h("span", { class: `${this.mergedClsPrefix}-editor__count` }, resolveSlotWithProps(
|
|
83404
|
+
this.$slots.count,
|
|
83405
|
+
{
|
|
83406
|
+
count: this.characterCount,
|
|
83407
|
+
maxLength: this.mergedMaxLength
|
|
83408
|
+
},
|
|
83409
|
+
() => [
|
|
83410
|
+
this.mergedMaxLength === void 0 ? this.characterCount : `${this.characterCount} / ${this.mergedMaxLength}`
|
|
83411
|
+
]
|
|
83412
|
+
))) : contentWrapper;
|
|
83355
83413
|
if (!this.isStandalone)
|
|
83356
83414
|
return content;
|
|
83357
83415
|
return /* @__PURE__ */ vue.h(
|
|
@@ -93300,6 +93358,36 @@ img.ProseMirror-separator {
|
|
|
93300
93358
|
}];
|
|
93301
93359
|
}
|
|
93302
93360
|
});
|
|
93361
|
+
const CharacterLimit = Extension.create({
|
|
93362
|
+
name: "characterLimit",
|
|
93363
|
+
addOptions: () => ({
|
|
93364
|
+
getLimit: () => void 0
|
|
93365
|
+
}),
|
|
93366
|
+
addProseMirrorPlugins() {
|
|
93367
|
+
const {
|
|
93368
|
+
getLimit
|
|
93369
|
+
} = this.options;
|
|
93370
|
+
const count = node => this.editor.storage.characterCount.characters({
|
|
93371
|
+
node
|
|
93372
|
+
});
|
|
93373
|
+
return [new Plugin({
|
|
93374
|
+
filterTransaction: (transaction, state) => {
|
|
93375
|
+
const limit = getLimit();
|
|
93376
|
+
if (!transaction.docChanged || transaction.getMeta("preventUpdate") || !limit) {
|
|
93377
|
+
return true;
|
|
93378
|
+
}
|
|
93379
|
+
const oldSize = count(state.doc);
|
|
93380
|
+
const newSize = count(transaction.doc);
|
|
93381
|
+
if (newSize <= limit) return true;
|
|
93382
|
+
if (oldSize > limit) return newSize <= oldSize;
|
|
93383
|
+
if (!transaction.getMeta("paste")) return false;
|
|
93384
|
+
const pos = transaction.selection.$head.pos;
|
|
93385
|
+
transaction.deleteRange(pos - (newSize - limit), pos);
|
|
93386
|
+
return count(transaction.doc) <= limit;
|
|
93387
|
+
}
|
|
93388
|
+
})];
|
|
93389
|
+
}
|
|
93390
|
+
});
|
|
93303
93391
|
const SendShortcut = Extension.create({
|
|
93304
93392
|
name: "sendShortcut",
|
|
93305
93393
|
priority: 1e3,
|
|
@@ -93355,7 +93443,7 @@ img.ProseMirror-separator {
|
|
|
93355
93443
|
}
|
|
93356
93444
|
const single = document.childCount === 1 && document.firstChild?.type.name === "paragraph";
|
|
93357
93445
|
const slice = single ? new Slice(document.content, 1, 1) : new Slice(document.content, 0, 0);
|
|
93358
|
-
view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView());
|
|
93446
|
+
view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste"));
|
|
93359
93447
|
return true;
|
|
93360
93448
|
}
|
|
93361
93449
|
}
|
|
@@ -93402,9 +93490,9 @@ img.ProseMirror-separator {
|
|
|
93402
93490
|
}
|
|
93403
93491
|
}), Placeholder.configure({
|
|
93404
93492
|
placeholder
|
|
93405
|
-
}),
|
|
93406
|
-
|
|
93407
|
-
})
|
|
93493
|
+
}), CharacterCount, CharacterLimit.configure({
|
|
93494
|
+
getLimit: typeof maxLength === "function" ? maxLength : () => maxLength
|
|
93495
|
+
}), MarkdownSource, MarkdownPaste.configure({
|
|
93408
93496
|
markdownOptions
|
|
93409
93497
|
}), ...(onSendShortcut ? [SendShortcut.configure({
|
|
93410
93498
|
onSend: onSendShortcut
|
|
@@ -93510,7 +93598,7 @@ img.ProseMirror-separator {
|
|
|
93510
93598
|
markdownOptions: props.markdownOptions,
|
|
93511
93599
|
extensions: props.extensions,
|
|
93512
93600
|
nodeProps: props.nodeProps,
|
|
93513
|
-
maxLength: props.maxLength,
|
|
93601
|
+
maxLength: () => props.maxLength,
|
|
93514
93602
|
onSendShortcut: props.sendOnEnter ? handleSend : void 0
|
|
93515
93603
|
}),
|
|
93516
93604
|
editable: editableRef.value,
|
|
@@ -93658,6 +93746,8 @@ img.ProseMirror-separator {
|
|
|
93658
93746
|
contentPropsRef: vue.toRef(props, "contentProps"),
|
|
93659
93747
|
maxRowsRef: vue.toRef(props, "maxRows"),
|
|
93660
93748
|
showSendButtonRef: vue.toRef(props, "showSendButton"),
|
|
93749
|
+
showCountRef: vue.toRef(props, "showCount"),
|
|
93750
|
+
maxLengthRef: vue.toRef(props, "maxLength"),
|
|
93661
93751
|
sendDisabledRef,
|
|
93662
93752
|
sendTooltipRef: mergedSendTooltipRef,
|
|
93663
93753
|
disabledRef: vue.toRef(props, "disabled"),
|
|
@@ -93693,7 +93783,7 @@ img.ProseMirror-separator {
|
|
|
93693
93783
|
style: this.inlineThemeDisabled ? void 0 : this.cssVars
|
|
93694
93784
|
},
|
|
93695
93785
|
this.$slots.toolbar?.() ?? /* @__PURE__ */ vue.h(_UEditorToolbar, null),
|
|
93696
|
-
this.$slots.content?.() ?? /* @__PURE__ */ vue.h(_UEditorContent, null, { sendIcon: this.$slots.sendIcon })
|
|
93786
|
+
this.$slots.content?.() ?? /* @__PURE__ */ vue.h(_UEditorContent, null, { sendIcon: this.$slots.sendIcon, count: this.$slots.count })
|
|
93697
93787
|
);
|
|
93698
93788
|
}
|
|
93699
93789
|
});
|
|
@@ -155098,7 +155188,7 @@ ${icon.label}`.toLowerCase()
|
|
|
155098
155188
|
});
|
|
155099
155189
|
}
|
|
155100
155190
|
|
|
155101
|
-
var version = "2.4.
|
|
155191
|
+
var version = "2.4.7";
|
|
155102
155192
|
|
|
155103
155193
|
function create({
|
|
155104
155194
|
componentPrefix = "U",
|
package/dist/index.mjs
CHANGED
|
@@ -54538,6 +54538,8 @@ function self$M(vars) {
|
|
|
54538
54538
|
lineHeightTitleSmall,
|
|
54539
54539
|
lineHeightBodyLarge,
|
|
54540
54540
|
lineHeightBodyMedium,
|
|
54541
|
+
fontBodySmall,
|
|
54542
|
+
lineHeightBodySmall,
|
|
54541
54543
|
surfacePrimary,
|
|
54542
54544
|
elementsQuaternary,
|
|
54543
54545
|
elementsQuinary,
|
|
@@ -54594,7 +54596,10 @@ function self$M(vars) {
|
|
|
54594
54596
|
markdownH1LineHeight: lineHeightTitleMedium,
|
|
54595
54597
|
markdownH2LineHeight: lineHeightTitleSmall,
|
|
54596
54598
|
markdownH3LineHeight: lineHeightBodyLarge,
|
|
54597
|
-
markdownTextLineHeight: lineHeightBodyMedium
|
|
54599
|
+
markdownTextLineHeight: lineHeightBodyMedium,
|
|
54600
|
+
countTextColor: textTertiary,
|
|
54601
|
+
countFontSize: fontBodySmall,
|
|
54602
|
+
countLineHeight: lineHeightBodySmall
|
|
54598
54603
|
};
|
|
54599
54604
|
}
|
|
54600
54605
|
const editorLight = createTheme$1({
|
|
@@ -60865,7 +60870,7 @@ var style$1a = cB("message-bubble", `
|
|
|
60865
60870
|
border-radius: var(--u-message-bubble-border-radius);
|
|
60866
60871
|
font-size: 14px;
|
|
60867
60872
|
line-height: 20px;
|
|
60868
|
-
|
|
60873
|
+
overflow-wrap: anywhere;
|
|
60869
60874
|
background-color: var(--u-message-bubble-background-color-other);
|
|
60870
60875
|
color: var(--u-message-bubble-text-color-other);
|
|
60871
60876
|
border-bottom-left-radius: 6px;
|
|
@@ -61950,7 +61955,7 @@ var style$19 = cB("chat", `
|
|
|
61950
61955
|
border-radius: 18px;
|
|
61951
61956
|
font-size: 14px;
|
|
61952
61957
|
line-height: 20px;
|
|
61953
|
-
|
|
61958
|
+
overflow-wrap: anywhere;
|
|
61954
61959
|
background-color: var(--u-message-bubble-background-color-other);
|
|
61955
61960
|
color: var(--u-message-bubble-text-color-other);
|
|
61956
61961
|
border-bottom-left-radius: 6px;
|
|
@@ -82944,7 +82949,10 @@ function useEditorCssVars(themeRef, themeVarsRef) {
|
|
|
82944
82949
|
markdownH1LineHeight,
|
|
82945
82950
|
markdownH2LineHeight,
|
|
82946
82951
|
markdownH3LineHeight,
|
|
82947
|
-
markdownTextLineHeight
|
|
82952
|
+
markdownTextLineHeight,
|
|
82953
|
+
countTextColor,
|
|
82954
|
+
countFontSize,
|
|
82955
|
+
countLineHeight
|
|
82948
82956
|
} = themeVarsRef.value;
|
|
82949
82957
|
return {
|
|
82950
82958
|
"--u-bezier": cubicBezierEaseInOut,
|
|
@@ -82984,7 +82992,10 @@ function useEditorCssVars(themeRef, themeVarsRef) {
|
|
|
82984
82992
|
"--u-editor-markdown-h1-line-height": markdownH1LineHeight,
|
|
82985
82993
|
"--u-editor-markdown-h2-line-height": markdownH2LineHeight,
|
|
82986
82994
|
"--u-editor-markdown-h3-line-height": markdownH3LineHeight,
|
|
82987
|
-
"--u-editor-markdown-text-line-height": markdownTextLineHeight
|
|
82995
|
+
"--u-editor-markdown-text-line-height": markdownTextLineHeight,
|
|
82996
|
+
"--u-editor-count-text-color": countTextColor,
|
|
82997
|
+
"--u-editor-count-font-size": countFontSize,
|
|
82998
|
+
"--u-editor-count-line-height": countLineHeight
|
|
82988
82999
|
};
|
|
82989
83000
|
});
|
|
82990
83001
|
}
|
|
@@ -83024,6 +83035,7 @@ const editorProps = {
|
|
|
83024
83035
|
autofocus: Boolean,
|
|
83025
83036
|
maxLength: Number,
|
|
83026
83037
|
maxRows: Number,
|
|
83038
|
+
showCount: Boolean,
|
|
83027
83039
|
toolbarButtonProps: Object,
|
|
83028
83040
|
toolbarIconProps: Object,
|
|
83029
83041
|
toolbarDropdownProps: Object,
|
|
@@ -83059,7 +83071,11 @@ var style$16 = c$1([cB("editor", `
|
|
|
83059
83071
|
margin: 0;
|
|
83060
83072
|
`), cE("toolbar-block-type", `
|
|
83061
83073
|
width: 71px;
|
|
83062
|
-
`)]), cE("
|
|
83074
|
+
`)]), cE("body", `
|
|
83075
|
+
display: flex;
|
|
83076
|
+
flex-direction: column;
|
|
83077
|
+
gap: 4px;
|
|
83078
|
+
`), cE("content-wrapper", `
|
|
83063
83079
|
position: relative;
|
|
83064
83080
|
box-sizing: border-box;
|
|
83065
83081
|
display: flex;
|
|
@@ -83081,7 +83097,14 @@ var style$16 = c$1([cB("editor", `
|
|
|
83081
83097
|
right: 6px;
|
|
83082
83098
|
top: 6px;
|
|
83083
83099
|
flex-shrink: 0;
|
|
83084
|
-
`)]), cE("
|
|
83100
|
+
`)]), cE("count", `
|
|
83101
|
+
align-self: flex-end;
|
|
83102
|
+
font-size: var(--u-editor-count-font-size);
|
|
83103
|
+
line-height: var(--u-editor-count-line-height);
|
|
83104
|
+
color: var(--u-editor-count-text-color);
|
|
83105
|
+
white-space: nowrap;
|
|
83106
|
+
padding-right: 10px;
|
|
83107
|
+
`), cE("content", `
|
|
83085
83108
|
white-space: normal;
|
|
83086
83109
|
width: 100%;
|
|
83087
83110
|
min-width: 0;
|
|
@@ -83089,7 +83112,7 @@ var style$16 = c$1([cB("editor", `
|
|
|
83089
83112
|
color: var(--u-editor-content-text-color);
|
|
83090
83113
|
font-size: var(--u-editor-markdown-text-font-size);
|
|
83091
83114
|
line-height: var(--u-editor-markdown-text-line-height);
|
|
83092
|
-
|
|
83115
|
+
overflow-wrap: anywhere;
|
|
83093
83116
|
`, [cM("scrollable", `
|
|
83094
83117
|
overflow-y: auto;
|
|
83095
83118
|
scrollbar-width: none;
|
|
@@ -83097,7 +83120,10 @@ var style$16 = c$1([cB("editor", `
|
|
|
83097
83120
|
width: 0;
|
|
83098
83121
|
height: 0;
|
|
83099
83122
|
display: none;
|
|
83100
|
-
`)]), cE("editable",
|
|
83123
|
+
`)]), cE("editable", `
|
|
83124
|
+
outline: none;
|
|
83125
|
+
overflow-wrap: anywhere;
|
|
83126
|
+
`, [c$1(".is-editor-empty:first-child::before", `
|
|
83101
83127
|
content: attr(data-placeholder);
|
|
83102
83128
|
float: left;
|
|
83103
83129
|
height: 0;
|
|
@@ -83188,6 +83214,8 @@ const editorContentProps = {
|
|
|
83188
83214
|
},
|
|
83189
83215
|
sendDisabled: Boolean,
|
|
83190
83216
|
maxRows: Number,
|
|
83217
|
+
showCount: Boolean,
|
|
83218
|
+
maxLength: Number,
|
|
83191
83219
|
sendTooltip: String,
|
|
83192
83220
|
disabled: Boolean,
|
|
83193
83221
|
sendButtonProps: Object,
|
|
@@ -83223,6 +83251,7 @@ var _UEditorContent = defineComponent({
|
|
|
83223
83251
|
const sendButtonThemeOverridesRef = computed(() => createSendButtonThemeOverrides(themeVarsRef.value));
|
|
83224
83252
|
const scrollbarInstRef = ref(null);
|
|
83225
83253
|
const contentInstRef = ref(null);
|
|
83254
|
+
const characterCountRef = ref(0);
|
|
83226
83255
|
const mergedMaxRowsRef = computed(
|
|
83227
83256
|
() => UEditor?.maxRowsRef.value ?? props.maxRows
|
|
83228
83257
|
);
|
|
@@ -83241,18 +83270,27 @@ var _UEditorContent = defineComponent({
|
|
|
83241
83270
|
function syncScrollbar() {
|
|
83242
83271
|
scrollbarInstRef.value?.syncUnifiedContainer();
|
|
83243
83272
|
}
|
|
83273
|
+
function syncCharacterCount() {
|
|
83274
|
+
characterCountRef.value = editorInstanceRef.value?.storage.characterCount?.characters() ?? 0;
|
|
83275
|
+
}
|
|
83276
|
+
function handleTransaction({ transaction }) {
|
|
83277
|
+
syncScrollbar();
|
|
83278
|
+
if (transaction.docChanged)
|
|
83279
|
+
syncCharacterCount();
|
|
83280
|
+
}
|
|
83244
83281
|
function unsubscribe() {
|
|
83245
|
-
subscribed?.off("transaction",
|
|
83282
|
+
subscribed?.off("transaction", handleTransaction);
|
|
83246
83283
|
subscribed = void 0;
|
|
83247
83284
|
}
|
|
83248
83285
|
watch(
|
|
83249
83286
|
editorInstanceRef,
|
|
83250
83287
|
(editor) => {
|
|
83251
83288
|
unsubscribe();
|
|
83289
|
+
syncCharacterCount();
|
|
83252
83290
|
if (!editor)
|
|
83253
83291
|
return;
|
|
83254
83292
|
subscribed = editor;
|
|
83255
|
-
editor.on("transaction",
|
|
83293
|
+
editor.on("transaction", handleTransaction);
|
|
83256
83294
|
},
|
|
83257
83295
|
{ immediate: true }
|
|
83258
83296
|
);
|
|
@@ -83291,6 +83329,16 @@ var _UEditorContent = defineComponent({
|
|
|
83291
83329
|
mergedContentProps: computed(
|
|
83292
83330
|
() => UEditor?.contentPropsRef.value ?? props.contentProps
|
|
83293
83331
|
),
|
|
83332
|
+
mergedShowCount: computed(
|
|
83333
|
+
() => UEditor?.showCountRef.value ?? props.showCount
|
|
83334
|
+
),
|
|
83335
|
+
mergedMaxLength: computed(
|
|
83336
|
+
() => UEditor?.maxLengthRef.value ?? props.maxLength
|
|
83337
|
+
),
|
|
83338
|
+
countAvailable: computed(
|
|
83339
|
+
() => !!editorInstanceRef.value?.storage.characterCount
|
|
83340
|
+
),
|
|
83341
|
+
characterCount: characterCountRef,
|
|
83294
83342
|
scrollbarInstRef,
|
|
83295
83343
|
contentInstRef,
|
|
83296
83344
|
mergedMaxRows: mergedMaxRowsRef,
|
|
@@ -83302,7 +83350,7 @@ var _UEditorContent = defineComponent({
|
|
|
83302
83350
|
},
|
|
83303
83351
|
render() {
|
|
83304
83352
|
this.onRender?.();
|
|
83305
|
-
const
|
|
83353
|
+
const contentWrapper = /* @__PURE__ */ h$1(
|
|
83306
83354
|
"div",
|
|
83307
83355
|
{
|
|
83308
83356
|
class: [
|
|
@@ -83348,6 +83396,16 @@ var _UEditorContent = defineComponent({
|
|
|
83348
83396
|
{ icon: this.$slots.sendIcon }
|
|
83349
83397
|
)
|
|
83350
83398
|
);
|
|
83399
|
+
const content = this.mergedShowCount ? /* @__PURE__ */ h$1("div", { class: `${this.mergedClsPrefix}-editor__body` }, contentWrapper, this.countAvailable && /* @__PURE__ */ h$1("span", { class: `${this.mergedClsPrefix}-editor__count` }, resolveSlotWithProps(
|
|
83400
|
+
this.$slots.count,
|
|
83401
|
+
{
|
|
83402
|
+
count: this.characterCount,
|
|
83403
|
+
maxLength: this.mergedMaxLength
|
|
83404
|
+
},
|
|
83405
|
+
() => [
|
|
83406
|
+
this.mergedMaxLength === void 0 ? this.characterCount : `${this.characterCount} / ${this.mergedMaxLength}`
|
|
83407
|
+
]
|
|
83408
|
+
))) : contentWrapper;
|
|
83351
83409
|
if (!this.isStandalone)
|
|
83352
83410
|
return content;
|
|
83353
83411
|
return /* @__PURE__ */ h$1(
|
|
@@ -93296,6 +93354,36 @@ const MarkdownSource = Extension.create({
|
|
|
93296
93354
|
}];
|
|
93297
93355
|
}
|
|
93298
93356
|
});
|
|
93357
|
+
const CharacterLimit = Extension.create({
|
|
93358
|
+
name: "characterLimit",
|
|
93359
|
+
addOptions: () => ({
|
|
93360
|
+
getLimit: () => void 0
|
|
93361
|
+
}),
|
|
93362
|
+
addProseMirrorPlugins() {
|
|
93363
|
+
const {
|
|
93364
|
+
getLimit
|
|
93365
|
+
} = this.options;
|
|
93366
|
+
const count = node => this.editor.storage.characterCount.characters({
|
|
93367
|
+
node
|
|
93368
|
+
});
|
|
93369
|
+
return [new Plugin({
|
|
93370
|
+
filterTransaction: (transaction, state) => {
|
|
93371
|
+
const limit = getLimit();
|
|
93372
|
+
if (!transaction.docChanged || transaction.getMeta("preventUpdate") || !limit) {
|
|
93373
|
+
return true;
|
|
93374
|
+
}
|
|
93375
|
+
const oldSize = count(state.doc);
|
|
93376
|
+
const newSize = count(transaction.doc);
|
|
93377
|
+
if (newSize <= limit) return true;
|
|
93378
|
+
if (oldSize > limit) return newSize <= oldSize;
|
|
93379
|
+
if (!transaction.getMeta("paste")) return false;
|
|
93380
|
+
const pos = transaction.selection.$head.pos;
|
|
93381
|
+
transaction.deleteRange(pos - (newSize - limit), pos);
|
|
93382
|
+
return count(transaction.doc) <= limit;
|
|
93383
|
+
}
|
|
93384
|
+
})];
|
|
93385
|
+
}
|
|
93386
|
+
});
|
|
93299
93387
|
const SendShortcut = Extension.create({
|
|
93300
93388
|
name: "sendShortcut",
|
|
93301
93389
|
priority: 1e3,
|
|
@@ -93351,7 +93439,7 @@ const MarkdownPaste = Extension.create({
|
|
|
93351
93439
|
}
|
|
93352
93440
|
const single = document.childCount === 1 && document.firstChild?.type.name === "paragraph";
|
|
93353
93441
|
const slice = single ? new Slice(document.content, 1, 1) : new Slice(document.content, 0, 0);
|
|
93354
|
-
view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView());
|
|
93442
|
+
view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView().setMeta("paste", true).setMeta("uiEvent", "paste"));
|
|
93355
93443
|
return true;
|
|
93356
93444
|
}
|
|
93357
93445
|
}
|
|
@@ -93398,9 +93486,9 @@ function createEditorExtensions({
|
|
|
93398
93486
|
}
|
|
93399
93487
|
}), Placeholder.configure({
|
|
93400
93488
|
placeholder
|
|
93401
|
-
}),
|
|
93402
|
-
|
|
93403
|
-
})
|
|
93489
|
+
}), CharacterCount, CharacterLimit.configure({
|
|
93490
|
+
getLimit: typeof maxLength === "function" ? maxLength : () => maxLength
|
|
93491
|
+
}), MarkdownSource, MarkdownPaste.configure({
|
|
93404
93492
|
markdownOptions
|
|
93405
93493
|
}), ...(onSendShortcut ? [SendShortcut.configure({
|
|
93406
93494
|
onSend: onSendShortcut
|
|
@@ -93506,7 +93594,7 @@ var _UEditor = defineComponent({
|
|
|
93506
93594
|
markdownOptions: props.markdownOptions,
|
|
93507
93595
|
extensions: props.extensions,
|
|
93508
93596
|
nodeProps: props.nodeProps,
|
|
93509
|
-
maxLength: props.maxLength,
|
|
93597
|
+
maxLength: () => props.maxLength,
|
|
93510
93598
|
onSendShortcut: props.sendOnEnter ? handleSend : void 0
|
|
93511
93599
|
}),
|
|
93512
93600
|
editable: editableRef.value,
|
|
@@ -93654,6 +93742,8 @@ var _UEditor = defineComponent({
|
|
|
93654
93742
|
contentPropsRef: toRef(props, "contentProps"),
|
|
93655
93743
|
maxRowsRef: toRef(props, "maxRows"),
|
|
93656
93744
|
showSendButtonRef: toRef(props, "showSendButton"),
|
|
93745
|
+
showCountRef: toRef(props, "showCount"),
|
|
93746
|
+
maxLengthRef: toRef(props, "maxLength"),
|
|
93657
93747
|
sendDisabledRef,
|
|
93658
93748
|
sendTooltipRef: mergedSendTooltipRef,
|
|
93659
93749
|
disabledRef: toRef(props, "disabled"),
|
|
@@ -93689,7 +93779,7 @@ var _UEditor = defineComponent({
|
|
|
93689
93779
|
style: this.inlineThemeDisabled ? void 0 : this.cssVars
|
|
93690
93780
|
},
|
|
93691
93781
|
this.$slots.toolbar?.() ?? /* @__PURE__ */ h$1(_UEditorToolbar, null),
|
|
93692
|
-
this.$slots.content?.() ?? /* @__PURE__ */ h$1(_UEditorContent, null, { sendIcon: this.$slots.sendIcon })
|
|
93782
|
+
this.$slots.content?.() ?? /* @__PURE__ */ h$1(_UEditorContent, null, { sendIcon: this.$slots.sendIcon, count: this.$slots.count })
|
|
93693
93783
|
);
|
|
93694
93784
|
}
|
|
93695
93785
|
});
|
|
@@ -155094,7 +155184,7 @@ function useThemeVars() {
|
|
|
155094
155184
|
});
|
|
155095
155185
|
}
|
|
155096
155186
|
|
|
155097
|
-
var version = "2.4.
|
|
155187
|
+
var version = "2.4.7";
|
|
155098
155188
|
|
|
155099
155189
|
function create({
|
|
155100
155190
|
componentPrefix = "U",
|