@uzum-tech/ui 2.4.6 → 2.4.8
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 +320 -91
- package/dist/index.mjs +320 -91
- package/dist/index.prod.js +2 -2
- package/dist/index.prod.mjs +3 -3
- package/es/chat/src/styles/index.cssr.mjs +1 -1
- package/es/components.d.ts +99 -10
- package/es/dynamic-tags/index.d.ts +3 -3
- package/es/dynamic-tags/index.mjs +2 -1
- package/es/dynamic-tags/src/DynamicTags.d.ts +74 -1177
- package/es/dynamic-tags/src/DynamicTags.mjs +150 -107
- package/es/dynamic-tags/src/interface.d.ts +1146 -6
- package/es/dynamic-tags/src/interface.mjs +34 -1
- package/es/dynamic-tags/src/styles/index.cssr.mjs +35 -3
- package/es/dynamic-tags/styles/dark.mjs +4 -2
- package/es/dynamic-tags/styles/light.d.ts +2 -0
- package/es/dynamic-tags/styles/light.mjs +4 -2
- 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 +99 -10
- package/lib/dynamic-tags/index.d.ts +3 -3
- package/lib/dynamic-tags/index.js +3 -2
- package/lib/dynamic-tags/src/DynamicTags.d.ts +74 -1177
- package/lib/dynamic-tags/src/DynamicTags.js +142 -77
- package/lib/dynamic-tags/src/interface.d.ts +1146 -6
- package/lib/dynamic-tags/src/interface.js +24 -0
- package/lib/dynamic-tags/src/styles/index.cssr.js +34 -2
- package/lib/dynamic-tags/styles/dark.js +4 -2
- package/lib/dynamic-tags/styles/light.d.ts +2 -0
- package/lib/dynamic-tags/styles/light.js +4 -2
- 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 +31 -2
|
@@ -1 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
import { useTheme } from "../../_mixins/index.mjs";
|
|
2
|
+
import commonProps from "../../tag/src/common-props.mjs";
|
|
3
|
+
export const dynamicTagsProps = Object.assign(Object.assign(Object.assign({}, useTheme.props), commonProps), {
|
|
4
|
+
size: {
|
|
5
|
+
type: String,
|
|
6
|
+
default: 'medium'
|
|
7
|
+
},
|
|
8
|
+
closable: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: true
|
|
11
|
+
},
|
|
12
|
+
draggable: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false
|
|
15
|
+
},
|
|
16
|
+
defaultValue: {
|
|
17
|
+
type: Array,
|
|
18
|
+
default: () => []
|
|
19
|
+
},
|
|
20
|
+
value: Array,
|
|
21
|
+
inputStyle: [String, Object],
|
|
22
|
+
inputProps: Object,
|
|
23
|
+
max: Number,
|
|
24
|
+
tagStyle: [String, Object],
|
|
25
|
+
renderTag: Function,
|
|
26
|
+
onCreate: {
|
|
27
|
+
type: Function,
|
|
28
|
+
default: label => label
|
|
29
|
+
},
|
|
30
|
+
'onUpdate:value': [Function, Array],
|
|
31
|
+
onUpdateValue: [Function, Array],
|
|
32
|
+
// deprecated
|
|
33
|
+
onChange: [Function, Array]
|
|
34
|
+
});
|
|
@@ -1,6 +1,38 @@
|
|
|
1
|
-
import { cB } from "../../../_utils/cssr/index.mjs";
|
|
1
|
+
import { c, cB, cE, cM } from "../../../_utils/cssr/index.mjs";
|
|
2
2
|
// vars:
|
|
3
|
-
// --input-width
|
|
3
|
+
// --u-input-width
|
|
4
|
+
// --u-dragging-opacity
|
|
5
|
+
// --u-drop-indicator-color
|
|
4
6
|
export default cB('dynamic-tags', [cB('input', {
|
|
5
7
|
minWidth: 'var(--u-input-width)'
|
|
6
|
-
})
|
|
8
|
+
}), cE('tag-wrapper', `
|
|
9
|
+
display: flex;
|
|
10
|
+
position: relative;
|
|
11
|
+
cursor: default;
|
|
12
|
+
`, [c('& > *', `
|
|
13
|
+
cursor: inherit;
|
|
14
|
+
`)]), cE('tag', [cM('draggable', `
|
|
15
|
+
cursor: grab;
|
|
16
|
+
user-select: none;
|
|
17
|
+
`), cM('dragging', `
|
|
18
|
+
opacity: var(--u-dragging-opacity);
|
|
19
|
+
cursor: grabbing;
|
|
20
|
+
`), cM('drop-before', [c('&::before', `
|
|
21
|
+
content: '';
|
|
22
|
+
position: absolute;
|
|
23
|
+
top: 0;
|
|
24
|
+
bottom: 0;
|
|
25
|
+
left: -5px;
|
|
26
|
+
width: 2px;
|
|
27
|
+
border-radius: 2px;
|
|
28
|
+
background-color: var(--u-drop-indicator-color);
|
|
29
|
+
`)]), cM('drop-after', [c('&::after', `
|
|
30
|
+
content: '';
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 0;
|
|
33
|
+
bottom: 0;
|
|
34
|
+
right: -5px;
|
|
35
|
+
width: 2px;
|
|
36
|
+
border-radius: 2px;
|
|
37
|
+
background-color: var(--u-drop-indicator-color);
|
|
38
|
+
`)])])]);
|
|
@@ -13,9 +13,11 @@ const dynamicTagsLight = createTheme({
|
|
|
13
13
|
Tag: tagLight,
|
|
14
14
|
Space: spaceLight
|
|
15
15
|
},
|
|
16
|
-
self() {
|
|
16
|
+
self(vars) {
|
|
17
17
|
return {
|
|
18
|
-
inputWidth: '64px'
|
|
18
|
+
inputWidth: '64px',
|
|
19
|
+
draggingOpacity: '0.5',
|
|
20
|
+
dropIndicatorColor: vars.elementsPrimary
|
|
19
21
|
};
|
|
20
22
|
}
|
|
21
23
|
});
|
package/es/editor/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export type { SendButtonProps } from './src/EditorParts/SendButton/interface';
|
|
|
6
6
|
export type { ToolbarButtonProps } from './src/EditorParts/ToolbarButton/interface';
|
|
7
7
|
export { createEditorExtensions } from './src/extensions';
|
|
8
8
|
export { editorInjectionKey, editorProps } from './src/interface';
|
|
9
|
-
export type { EditorInst, EditorNodeProps, EditorProps, EditorSlots, EditorToolbar, EditorToolbarItemKey } from './src/interface';
|
|
9
|
+
export type { EditorCountSlotProps, EditorInst, EditorNodeProps, EditorProps, EditorSlots, EditorToolbar, EditorToolbarItemKey } from './src/interface';
|
|
10
10
|
export type { Editor } from '@tiptap/vue-3';
|
|
@@ -34,6 +34,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
34
34
|
readonly autofocus: BooleanConstructor;
|
|
35
35
|
readonly maxLength: NumberConstructor;
|
|
36
36
|
readonly maxRows: NumberConstructor;
|
|
37
|
+
readonly showCount: BooleanConstructor;
|
|
37
38
|
readonly toolbarButtonProps: import("vue").PropType<Partial<import("../..").ButtonProps>>;
|
|
38
39
|
readonly toolbarIconProps: import("vue").PropType<Partial<import("../..").IconProps>>;
|
|
39
40
|
readonly toolbarDropdownProps: import("vue").PropType<Partial<import("../..").SelectProps>>;
|
|
@@ -98,6 +99,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
98
99
|
markdownH2LineHeight: string;
|
|
99
100
|
markdownH3LineHeight: string;
|
|
100
101
|
markdownTextLineHeight: string;
|
|
102
|
+
countTextColor: string;
|
|
103
|
+
countFontSize: string;
|
|
104
|
+
countLineHeight: string;
|
|
101
105
|
}, {
|
|
102
106
|
Button: import("../../_mixins").Theme<"Button", {
|
|
103
107
|
heightTiny: string;
|
|
@@ -733,6 +737,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
733
737
|
markdownH2LineHeight: string;
|
|
734
738
|
markdownH3LineHeight: string;
|
|
735
739
|
markdownTextLineHeight: string;
|
|
740
|
+
countTextColor: string;
|
|
741
|
+
countFontSize: string;
|
|
742
|
+
countLineHeight: string;
|
|
736
743
|
}, {
|
|
737
744
|
Button: import("../../_mixins").Theme<"Button", {
|
|
738
745
|
heightTiny: string;
|
|
@@ -1368,6 +1375,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1368
1375
|
markdownH2LineHeight: string;
|
|
1369
1376
|
markdownH3LineHeight: string;
|
|
1370
1377
|
markdownTextLineHeight: string;
|
|
1378
|
+
countTextColor: string;
|
|
1379
|
+
countFontSize: string;
|
|
1380
|
+
countLineHeight: string;
|
|
1371
1381
|
}, {
|
|
1372
1382
|
Button: import("../../_mixins").Theme<"Button", {
|
|
1373
1383
|
heightTiny: string;
|
|
@@ -2006,6 +2016,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2006
2016
|
readonly autofocus: BooleanConstructor;
|
|
2007
2017
|
readonly maxLength: NumberConstructor;
|
|
2008
2018
|
readonly maxRows: NumberConstructor;
|
|
2019
|
+
readonly showCount: BooleanConstructor;
|
|
2009
2020
|
readonly toolbarButtonProps: import("vue").PropType<Partial<import("../..").ButtonProps>>;
|
|
2010
2021
|
readonly toolbarIconProps: import("vue").PropType<Partial<import("../..").IconProps>>;
|
|
2011
2022
|
readonly toolbarDropdownProps: import("vue").PropType<Partial<import("../..").SelectProps>>;
|
|
@@ -2070,6 +2081,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2070
2081
|
markdownH2LineHeight: string;
|
|
2071
2082
|
markdownH3LineHeight: string;
|
|
2072
2083
|
markdownTextLineHeight: string;
|
|
2084
|
+
countTextColor: string;
|
|
2085
|
+
countFontSize: string;
|
|
2086
|
+
countLineHeight: string;
|
|
2073
2087
|
}, {
|
|
2074
2088
|
Button: import("../../_mixins").Theme<"Button", {
|
|
2075
2089
|
heightTiny: string;
|
|
@@ -2705,6 +2719,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2705
2719
|
markdownH2LineHeight: string;
|
|
2706
2720
|
markdownH3LineHeight: string;
|
|
2707
2721
|
markdownTextLineHeight: string;
|
|
2722
|
+
countTextColor: string;
|
|
2723
|
+
countFontSize: string;
|
|
2724
|
+
countLineHeight: string;
|
|
2708
2725
|
}, {
|
|
2709
2726
|
Button: import("../../_mixins").Theme<"Button", {
|
|
2710
2727
|
heightTiny: string;
|
|
@@ -3340,6 +3357,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
3340
3357
|
markdownH2LineHeight: string;
|
|
3341
3358
|
markdownH3LineHeight: string;
|
|
3342
3359
|
markdownTextLineHeight: string;
|
|
3360
|
+
countTextColor: string;
|
|
3361
|
+
countFontSize: string;
|
|
3362
|
+
countLineHeight: string;
|
|
3343
3363
|
}, {
|
|
3344
3364
|
Button: import("../../_mixins").Theme<"Button", {
|
|
3345
3365
|
heightTiny: string;
|
|
@@ -3932,6 +3952,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
3932
3952
|
readonly disabled: boolean;
|
|
3933
3953
|
readonly readonly: boolean;
|
|
3934
3954
|
readonly autofocus: boolean;
|
|
3955
|
+
readonly showCount: boolean;
|
|
3935
3956
|
readonly toolbar: import("./interface").EditorToolbar;
|
|
3936
3957
|
readonly showSendButton: boolean;
|
|
3937
3958
|
readonly sendOnEnter: boolean;
|
package/es/editor/src/Editor.mjs
CHANGED
|
@@ -46,7 +46,7 @@ export default defineComponent({
|
|
|
46
46
|
markdownOptions: props.markdownOptions,
|
|
47
47
|
extensions: props.extensions,
|
|
48
48
|
nodeProps: props.nodeProps,
|
|
49
|
-
maxLength: props.maxLength,
|
|
49
|
+
maxLength: () => props.maxLength,
|
|
50
50
|
onSendShortcut: props.sendOnEnter ? handleSend : undefined
|
|
51
51
|
}),
|
|
52
52
|
editable: editableRef.value,
|
|
@@ -203,6 +203,8 @@ export default defineComponent({
|
|
|
203
203
|
contentPropsRef: toRef(props, 'contentProps'),
|
|
204
204
|
maxRowsRef: toRef(props, 'maxRows'),
|
|
205
205
|
showSendButtonRef: toRef(props, 'showSendButton'),
|
|
206
|
+
showCountRef: toRef(props, 'showCount'),
|
|
207
|
+
maxLengthRef: toRef(props, 'maxLength'),
|
|
206
208
|
sendDisabledRef,
|
|
207
209
|
sendTooltipRef: mergedSendTooltipRef,
|
|
208
210
|
disabledRef: toRef(props, 'disabled'),
|
|
@@ -236,7 +238,8 @@ export default defineComponent({
|
|
|
236
238
|
class: [`${this.mergedClsPrefix}-editor`, this.themeClass],
|
|
237
239
|
style: this.inlineThemeDisabled ? undefined : this.cssVars
|
|
238
240
|
}, (_d = (_c = (_b = this.$slots).toolbar) === null || _c === void 0 ? void 0 : _c.call(_b)) !== null && _d !== void 0 ? _d : h(EditorToolbar, null), (_g = (_f = (_e = this.$slots).content) === null || _f === void 0 ? void 0 : _f.call(_e)) !== null && _g !== void 0 ? _g : h(EditorContent, null, {
|
|
239
|
-
sendIcon: this.$slots.sendIcon
|
|
241
|
+
sendIcon: this.$slots.sendIcon,
|
|
242
|
+
count: this.$slots.count
|
|
240
243
|
}));
|
|
241
244
|
}
|
|
242
245
|
});
|
|
@@ -13,6 +13,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
13
13
|
};
|
|
14
14
|
readonly sendDisabled: BooleanConstructor;
|
|
15
15
|
readonly maxRows: NumberConstructor;
|
|
16
|
+
readonly showCount: BooleanConstructor;
|
|
17
|
+
readonly maxLength: NumberConstructor;
|
|
16
18
|
readonly sendTooltip: StringConstructor;
|
|
17
19
|
readonly disabled: BooleanConstructor;
|
|
18
20
|
readonly sendButtonProps: import("vue").PropType<Partial<import("../../../..").ButtonProps>>;
|
|
@@ -67,6 +69,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
67
69
|
markdownH2LineHeight: string;
|
|
68
70
|
markdownH3LineHeight: string;
|
|
69
71
|
markdownTextLineHeight: string;
|
|
72
|
+
countTextColor: string;
|
|
73
|
+
countFontSize: string;
|
|
74
|
+
countLineHeight: string;
|
|
70
75
|
}, {
|
|
71
76
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
72
77
|
heightTiny: string;
|
|
@@ -702,6 +707,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
702
707
|
markdownH2LineHeight: string;
|
|
703
708
|
markdownH3LineHeight: string;
|
|
704
709
|
markdownTextLineHeight: string;
|
|
710
|
+
countTextColor: string;
|
|
711
|
+
countFontSize: string;
|
|
712
|
+
countLineHeight: string;
|
|
705
713
|
}, {
|
|
706
714
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
707
715
|
heightTiny: string;
|
|
@@ -1337,6 +1345,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1337
1345
|
markdownH2LineHeight: string;
|
|
1338
1346
|
markdownH3LineHeight: string;
|
|
1339
1347
|
markdownTextLineHeight: string;
|
|
1348
|
+
countTextColor: string;
|
|
1349
|
+
countFontSize: string;
|
|
1350
|
+
countLineHeight: string;
|
|
1340
1351
|
}, {
|
|
1341
1352
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
1342
1353
|
heightTiny: string;
|
|
@@ -2157,6 +2168,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2157
2168
|
mergedSendButtonProps: import("vue").ComputedRef<Partial<import("../../../..").ButtonProps> | undefined>;
|
|
2158
2169
|
mergedSendIconProps: import("vue").ComputedRef<Partial<import("../../../..").IconProps> | undefined>;
|
|
2159
2170
|
mergedContentProps: import("vue").ComputedRef<import("vue").HTMLAttributes | undefined>;
|
|
2171
|
+
mergedShowCount: import("vue").ComputedRef<boolean>;
|
|
2172
|
+
mergedMaxLength: import("vue").ComputedRef<number | undefined>;
|
|
2173
|
+
countAvailable: import("vue").ComputedRef<boolean>;
|
|
2174
|
+
characterCount: import("vue").Ref<number, number>;
|
|
2160
2175
|
scrollbarInstRef: import("vue").Ref<{
|
|
2161
2176
|
$el: HTMLElement;
|
|
2162
2177
|
containerRef: HTMLElement | null;
|
|
@@ -2203,6 +2218,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2203
2218
|
};
|
|
2204
2219
|
readonly sendDisabled: BooleanConstructor;
|
|
2205
2220
|
readonly maxRows: NumberConstructor;
|
|
2221
|
+
readonly showCount: BooleanConstructor;
|
|
2222
|
+
readonly maxLength: NumberConstructor;
|
|
2206
2223
|
readonly sendTooltip: StringConstructor;
|
|
2207
2224
|
readonly disabled: BooleanConstructor;
|
|
2208
2225
|
readonly sendButtonProps: import("vue").PropType<Partial<import("../../../..").ButtonProps>>;
|
|
@@ -2257,6 +2274,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2257
2274
|
markdownH2LineHeight: string;
|
|
2258
2275
|
markdownH3LineHeight: string;
|
|
2259
2276
|
markdownTextLineHeight: string;
|
|
2277
|
+
countTextColor: string;
|
|
2278
|
+
countFontSize: string;
|
|
2279
|
+
countLineHeight: string;
|
|
2260
2280
|
}, {
|
|
2261
2281
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
2262
2282
|
heightTiny: string;
|
|
@@ -2892,6 +2912,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2892
2912
|
markdownH2LineHeight: string;
|
|
2893
2913
|
markdownH3LineHeight: string;
|
|
2894
2914
|
markdownTextLineHeight: string;
|
|
2915
|
+
countTextColor: string;
|
|
2916
|
+
countFontSize: string;
|
|
2917
|
+
countLineHeight: string;
|
|
2895
2918
|
}, {
|
|
2896
2919
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
2897
2920
|
heightTiny: string;
|
|
@@ -3527,6 +3550,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
3527
3550
|
markdownH2LineHeight: string;
|
|
3528
3551
|
markdownH3LineHeight: string;
|
|
3529
3552
|
markdownTextLineHeight: string;
|
|
3553
|
+
countTextColor: string;
|
|
3554
|
+
countFontSize: string;
|
|
3555
|
+
countLineHeight: string;
|
|
3530
3556
|
}, {
|
|
3531
3557
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
3532
3558
|
heightTiny: string;
|
|
@@ -4116,6 +4142,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
4116
4142
|
}>>>;
|
|
4117
4143
|
}>> & Readonly<{}>, {
|
|
4118
4144
|
readonly disabled: boolean;
|
|
4145
|
+
readonly showCount: boolean;
|
|
4119
4146
|
readonly showSendButton: boolean;
|
|
4120
4147
|
readonly sendDisabled: boolean;
|
|
4121
4148
|
}, SlotsType<EditorSlots>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -2,6 +2,7 @@ import { EditorContent } from '@tiptap/vue-3';
|
|
|
2
2
|
import { computed, defineComponent, h, inject, onBeforeUnmount, ref, watch } from 'vue';
|
|
3
3
|
import { UScrollbar } from "../../../../_internal/index.mjs";
|
|
4
4
|
import { useConfig, useTheme, useThemeClass } from "../../../../_mixins/index.mjs";
|
|
5
|
+
import { resolveSlotWithProps } from "../../../../_utils/index.mjs";
|
|
5
6
|
import { createSendButtonThemeOverrides } from "../../../../chat/styles/light.mjs";
|
|
6
7
|
import { editorLight } from "../../../styles/index.mjs";
|
|
7
8
|
import useEditorCssVars from "../../composables/use-editor-css-vars.mjs";
|
|
@@ -34,6 +35,7 @@ export default defineComponent({
|
|
|
34
35
|
const sendButtonThemeOverridesRef = computed(() => createSendButtonThemeOverrides(themeVarsRef.value));
|
|
35
36
|
const scrollbarInstRef = ref(null);
|
|
36
37
|
const contentInstRef = ref(null);
|
|
38
|
+
const characterCountRef = ref(0);
|
|
37
39
|
const mergedMaxRowsRef = computed(() => {
|
|
38
40
|
var _a;
|
|
39
41
|
return (_a = UEditor === null || UEditor === void 0 ? void 0 : UEditor.maxRowsRef.value) !== null && _a !== void 0 ? _a : props.maxRows;
|
|
@@ -54,15 +56,26 @@ export default defineComponent({
|
|
|
54
56
|
var _a;
|
|
55
57
|
(_a = scrollbarInstRef.value) === null || _a === void 0 ? void 0 : _a.syncUnifiedContainer();
|
|
56
58
|
}
|
|
59
|
+
function syncCharacterCount() {
|
|
60
|
+
var _a, _b, _c;
|
|
61
|
+
characterCountRef.value = (_c = (_b = (_a = editorInstanceRef.value) === null || _a === void 0 ? void 0 : _a.storage.characterCount) === null || _b === void 0 ? void 0 : _b.characters()) !== null && _c !== void 0 ? _c : 0;
|
|
62
|
+
}
|
|
63
|
+
function handleTransaction({
|
|
64
|
+
transaction
|
|
65
|
+
}) {
|
|
66
|
+
syncScrollbar();
|
|
67
|
+
if (transaction.docChanged) syncCharacterCount();
|
|
68
|
+
}
|
|
57
69
|
function unsubscribe() {
|
|
58
|
-
subscribed === null || subscribed === void 0 ? void 0 : subscribed.off('transaction',
|
|
70
|
+
subscribed === null || subscribed === void 0 ? void 0 : subscribed.off('transaction', handleTransaction);
|
|
59
71
|
subscribed = undefined;
|
|
60
72
|
}
|
|
61
73
|
watch(editorInstanceRef, editor => {
|
|
62
74
|
unsubscribe();
|
|
75
|
+
syncCharacterCount();
|
|
63
76
|
if (!editor) return;
|
|
64
77
|
subscribed = editor;
|
|
65
|
-
editor.on('transaction',
|
|
78
|
+
editor.on('transaction', handleTransaction);
|
|
66
79
|
}, {
|
|
67
80
|
immediate: true
|
|
68
81
|
});
|
|
@@ -108,6 +121,19 @@ export default defineComponent({
|
|
|
108
121
|
var _a;
|
|
109
122
|
return (_a = UEditor === null || UEditor === void 0 ? void 0 : UEditor.contentPropsRef.value) !== null && _a !== void 0 ? _a : props.contentProps;
|
|
110
123
|
}),
|
|
124
|
+
mergedShowCount: computed(() => {
|
|
125
|
+
var _a;
|
|
126
|
+
return (_a = UEditor === null || UEditor === void 0 ? void 0 : UEditor.showCountRef.value) !== null && _a !== void 0 ? _a : props.showCount;
|
|
127
|
+
}),
|
|
128
|
+
mergedMaxLength: computed(() => {
|
|
129
|
+
var _a;
|
|
130
|
+
return (_a = UEditor === null || UEditor === void 0 ? void 0 : UEditor.maxLengthRef.value) !== null && _a !== void 0 ? _a : props.maxLength;
|
|
131
|
+
}),
|
|
132
|
+
countAvailable: computed(() => {
|
|
133
|
+
var _a;
|
|
134
|
+
return !!((_a = editorInstanceRef.value) === null || _a === void 0 ? void 0 : _a.storage.characterCount);
|
|
135
|
+
}),
|
|
136
|
+
characterCount: characterCountRef,
|
|
111
137
|
scrollbarInstRef,
|
|
112
138
|
contentInstRef,
|
|
113
139
|
mergedMaxRows: mergedMaxRowsRef,
|
|
@@ -120,7 +146,7 @@ export default defineComponent({
|
|
|
120
146
|
render() {
|
|
121
147
|
var _a;
|
|
122
148
|
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
123
|
-
const
|
|
149
|
+
const contentWrapper = h("div", {
|
|
124
150
|
class: [`${this.mergedClsPrefix}-editor__content-wrapper`, this.isStandalone && `${this.mergedClsPrefix}-editor__content-wrapper--standalone`]
|
|
125
151
|
}, h(UScrollbar, {
|
|
126
152
|
ref: "scrollbarInstRef",
|
|
@@ -145,6 +171,14 @@ export default defineComponent({
|
|
|
145
171
|
}, {
|
|
146
172
|
icon: this.$slots.sendIcon
|
|
147
173
|
}));
|
|
174
|
+
const content = this.mergedShowCount ? h("div", {
|
|
175
|
+
class: `${this.mergedClsPrefix}-editor__body`
|
|
176
|
+
}, contentWrapper, this.countAvailable && h("span", {
|
|
177
|
+
class: `${this.mergedClsPrefix}-editor__count`
|
|
178
|
+
}, resolveSlotWithProps(this.$slots.count, {
|
|
179
|
+
count: this.characterCount,
|
|
180
|
+
maxLength: this.mergedMaxLength
|
|
181
|
+
}, () => [this.mergedMaxLength === undefined ? this.characterCount : `${this.characterCount} / ${this.mergedMaxLength}`]))) : contentWrapper;
|
|
148
182
|
if (!this.isStandalone) return content;
|
|
149
183
|
return h("div", {
|
|
150
184
|
class: [`${this.mergedClsPrefix}-editor`, this.themeClass],
|
|
@@ -13,6 +13,8 @@ export declare const editorContentProps: {
|
|
|
13
13
|
};
|
|
14
14
|
readonly sendDisabled: BooleanConstructor;
|
|
15
15
|
readonly maxRows: NumberConstructor;
|
|
16
|
+
readonly showCount: BooleanConstructor;
|
|
17
|
+
readonly maxLength: NumberConstructor;
|
|
16
18
|
readonly sendTooltip: StringConstructor;
|
|
17
19
|
readonly disabled: BooleanConstructor;
|
|
18
20
|
readonly sendButtonProps: PropType<Partial<ButtonProps>>;
|
|
@@ -67,6 +69,9 @@ export declare const editorContentProps: {
|
|
|
67
69
|
markdownH2LineHeight: string;
|
|
68
70
|
markdownH3LineHeight: string;
|
|
69
71
|
markdownTextLineHeight: string;
|
|
72
|
+
countTextColor: string;
|
|
73
|
+
countFontSize: string;
|
|
74
|
+
countLineHeight: string;
|
|
70
75
|
}, {
|
|
71
76
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
72
77
|
heightTiny: string;
|
|
@@ -702,6 +707,9 @@ export declare const editorContentProps: {
|
|
|
702
707
|
markdownH2LineHeight: string;
|
|
703
708
|
markdownH3LineHeight: string;
|
|
704
709
|
markdownTextLineHeight: string;
|
|
710
|
+
countTextColor: string;
|
|
711
|
+
countFontSize: string;
|
|
712
|
+
countLineHeight: string;
|
|
705
713
|
}, {
|
|
706
714
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
707
715
|
heightTiny: string;
|
|
@@ -1337,6 +1345,9 @@ export declare const editorContentProps: {
|
|
|
1337
1345
|
markdownH2LineHeight: string;
|
|
1338
1346
|
markdownH3LineHeight: string;
|
|
1339
1347
|
markdownTextLineHeight: string;
|
|
1348
|
+
countTextColor: string;
|
|
1349
|
+
countFontSize: string;
|
|
1350
|
+
countLineHeight: string;
|
|
1340
1351
|
}, {
|
|
1341
1352
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
1342
1353
|
heightTiny: string;
|
|
@@ -67,6 +67,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
67
67
|
markdownH2LineHeight: string;
|
|
68
68
|
markdownH3LineHeight: string;
|
|
69
69
|
markdownTextLineHeight: string;
|
|
70
|
+
countTextColor: string;
|
|
71
|
+
countFontSize: string;
|
|
72
|
+
countLineHeight: string;
|
|
70
73
|
}, {
|
|
71
74
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
72
75
|
heightTiny: string;
|
|
@@ -702,6 +705,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
702
705
|
markdownH2LineHeight: string;
|
|
703
706
|
markdownH3LineHeight: string;
|
|
704
707
|
markdownTextLineHeight: string;
|
|
708
|
+
countTextColor: string;
|
|
709
|
+
countFontSize: string;
|
|
710
|
+
countLineHeight: string;
|
|
705
711
|
}, {
|
|
706
712
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
707
713
|
heightTiny: string;
|
|
@@ -1337,6 +1343,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1337
1343
|
markdownH2LineHeight: string;
|
|
1338
1344
|
markdownH3LineHeight: string;
|
|
1339
1345
|
markdownTextLineHeight: string;
|
|
1346
|
+
countTextColor: string;
|
|
1347
|
+
countFontSize: string;
|
|
1348
|
+
countLineHeight: string;
|
|
1340
1349
|
}, {
|
|
1341
1350
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
1342
1351
|
heightTiny: string;
|
|
@@ -2762,6 +2771,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
2762
2771
|
markdownH2LineHeight: string;
|
|
2763
2772
|
markdownH3LineHeight: string;
|
|
2764
2773
|
markdownTextLineHeight: string;
|
|
2774
|
+
countTextColor: string;
|
|
2775
|
+
countFontSize: string;
|
|
2776
|
+
countLineHeight: string;
|
|
2765
2777
|
}, {
|
|
2766
2778
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
2767
2779
|
heightTiny: string;
|
|
@@ -3397,6 +3409,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
3397
3409
|
markdownH2LineHeight: string;
|
|
3398
3410
|
markdownH3LineHeight: string;
|
|
3399
3411
|
markdownTextLineHeight: string;
|
|
3412
|
+
countTextColor: string;
|
|
3413
|
+
countFontSize: string;
|
|
3414
|
+
countLineHeight: string;
|
|
3400
3415
|
}, {
|
|
3401
3416
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
3402
3417
|
heightTiny: string;
|
|
@@ -4032,6 +4047,9 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
4032
4047
|
markdownH2LineHeight: string;
|
|
4033
4048
|
markdownH3LineHeight: string;
|
|
4034
4049
|
markdownTextLineHeight: string;
|
|
4050
|
+
countTextColor: string;
|
|
4051
|
+
countFontSize: string;
|
|
4052
|
+
countLineHeight: string;
|
|
4035
4053
|
}, {
|
|
4036
4054
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
4037
4055
|
heightTiny: string;
|
|
@@ -73,6 +73,9 @@ export declare const editorToolbarProps: {
|
|
|
73
73
|
markdownH2LineHeight: string;
|
|
74
74
|
markdownH3LineHeight: string;
|
|
75
75
|
markdownTextLineHeight: string;
|
|
76
|
+
countTextColor: string;
|
|
77
|
+
countFontSize: string;
|
|
78
|
+
countLineHeight: string;
|
|
76
79
|
}, {
|
|
77
80
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
78
81
|
heightTiny: string;
|
|
@@ -708,6 +711,9 @@ export declare const editorToolbarProps: {
|
|
|
708
711
|
markdownH2LineHeight: string;
|
|
709
712
|
markdownH3LineHeight: string;
|
|
710
713
|
markdownTextLineHeight: string;
|
|
714
|
+
countTextColor: string;
|
|
715
|
+
countFontSize: string;
|
|
716
|
+
countLineHeight: string;
|
|
711
717
|
}, {
|
|
712
718
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
713
719
|
heightTiny: string;
|
|
@@ -1343,6 +1349,9 @@ export declare const editorToolbarProps: {
|
|
|
1343
1349
|
markdownH2LineHeight: string;
|
|
1344
1350
|
markdownH3LineHeight: string;
|
|
1345
1351
|
markdownTextLineHeight: string;
|
|
1352
|
+
countTextColor: string;
|
|
1353
|
+
countFontSize: string;
|
|
1354
|
+
countLineHeight: string;
|
|
1346
1355
|
}, {
|
|
1347
1356
|
Button: import("../../../../_mixins").Theme<"Button", {
|
|
1348
1357
|
heightTiny: string;
|
|
@@ -43,7 +43,10 @@ export default function useEditorCssVars(themeRef, themeVarsRef) {
|
|
|
43
43
|
markdownH1LineHeight,
|
|
44
44
|
markdownH2LineHeight,
|
|
45
45
|
markdownH3LineHeight,
|
|
46
|
-
markdownTextLineHeight
|
|
46
|
+
markdownTextLineHeight,
|
|
47
|
+
countTextColor,
|
|
48
|
+
countFontSize,
|
|
49
|
+
countLineHeight
|
|
47
50
|
} = themeVarsRef.value;
|
|
48
51
|
return {
|
|
49
52
|
'--u-bezier': cubicBezierEaseInOut,
|
|
@@ -83,7 +86,10 @@ export default function useEditorCssVars(themeRef, themeVarsRef) {
|
|
|
83
86
|
'--u-editor-markdown-h1-line-height': markdownH1LineHeight,
|
|
84
87
|
'--u-editor-markdown-h2-line-height': markdownH2LineHeight,
|
|
85
88
|
'--u-editor-markdown-h3-line-height': markdownH3LineHeight,
|
|
86
|
-
'--u-editor-markdown-text-line-height': markdownTextLineHeight
|
|
89
|
+
'--u-editor-markdown-text-line-height': markdownTextLineHeight,
|
|
90
|
+
'--u-editor-count-text-color': countTextColor,
|
|
91
|
+
'--u-editor-count-font-size': countFontSize,
|
|
92
|
+
'--u-editor-count-line-height': countLineHeight
|
|
87
93
|
};
|
|
88
94
|
});
|
|
89
95
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Extensions } from '@tiptap/core';
|
|
2
|
-
import type { CreateEditorExtensionsOptions, MarkdownPasteOptions, SendShortcutOptions } from './interface';
|
|
2
|
+
import type { CharacterLimitOptions, CreateEditorExtensionsOptions, MarkdownPasteOptions, SendShortcutOptions } from './interface';
|
|
3
3
|
import { Extension } from '@tiptap/core';
|
|
4
4
|
export declare const MarkdownSource: Extension<any, any>;
|
|
5
|
+
export declare const CharacterLimit: Extension<CharacterLimitOptions, any>;
|
|
5
6
|
export declare const SendShortcut: Extension<SendShortcutOptions, any>;
|
|
6
7
|
export declare const MarkdownPaste: Extension<MarkdownPasteOptions, any>;
|
|
7
8
|
export declare function createEditorExtensions({ placeholder, markdownOptions, extensions, nodeProps, maxLength, onSendShortcut }?: CreateEditorExtensionsOptions): Extensions;
|
|
@@ -21,6 +21,36 @@ export const MarkdownSource = Extension.create({
|
|
|
21
21
|
}];
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
export const CharacterLimit = Extension.create({
|
|
25
|
+
name: 'characterLimit',
|
|
26
|
+
addOptions: () => ({
|
|
27
|
+
getLimit: () => undefined
|
|
28
|
+
}),
|
|
29
|
+
addProseMirrorPlugins() {
|
|
30
|
+
const {
|
|
31
|
+
getLimit
|
|
32
|
+
} = this.options;
|
|
33
|
+
const count = node => this.editor.storage.characterCount.characters({
|
|
34
|
+
node
|
|
35
|
+
});
|
|
36
|
+
return [new Plugin({
|
|
37
|
+
filterTransaction: (transaction, state) => {
|
|
38
|
+
const limit = getLimit();
|
|
39
|
+
if (!transaction.docChanged || transaction.getMeta('preventUpdate') || !limit) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
const oldSize = count(state.doc);
|
|
43
|
+
const newSize = count(transaction.doc);
|
|
44
|
+
if (newSize <= limit) return true;
|
|
45
|
+
if (oldSize > limit) return newSize <= oldSize;
|
|
46
|
+
if (!transaction.getMeta('paste')) return false;
|
|
47
|
+
const pos = transaction.selection.$head.pos;
|
|
48
|
+
transaction.deleteRange(pos - (newSize - limit), pos);
|
|
49
|
+
return count(transaction.doc) <= limit;
|
|
50
|
+
}
|
|
51
|
+
})];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
24
54
|
export const SendShortcut = Extension.create({
|
|
25
55
|
name: 'sendShortcut',
|
|
26
56
|
priority: 1000,
|
|
@@ -77,7 +107,7 @@ export const MarkdownPaste = Extension.create({
|
|
|
77
107
|
}
|
|
78
108
|
const single = document.childCount === 1 && ((_b = document.firstChild) === null || _b === void 0 ? void 0 : _b.type.name) === 'paragraph';
|
|
79
109
|
const slice = single ? new Slice(document.content, 1, 1) : new Slice(document.content, 0, 0);
|
|
80
|
-
view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView());
|
|
110
|
+
view.dispatch(view.state.tr.replaceSelection(slice).scrollIntoView().setMeta('paste', true).setMeta('uiEvent', 'paste'));
|
|
81
111
|
return true;
|
|
82
112
|
}
|
|
83
113
|
}
|
|
@@ -125,9 +155,9 @@ export function createEditorExtensions({
|
|
|
125
155
|
}
|
|
126
156
|
}), Placeholder.configure({
|
|
127
157
|
placeholder
|
|
128
|
-
}),
|
|
129
|
-
|
|
130
|
-
})
|
|
158
|
+
}), CharacterCount, CharacterLimit.configure({
|
|
159
|
+
getLimit: typeof maxLength === 'function' ? maxLength : () => maxLength
|
|
160
|
+
}), MarkdownSource, MarkdownPaste.configure({
|
|
131
161
|
markdownOptions
|
|
132
162
|
}), ...(onSendShortcut ? [SendShortcut.configure({
|
|
133
163
|
onSend: onSendShortcut
|