@ray-js/t-agent-ui-ray 0.2.5-beta-3 → 0.2.5-beta-5

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.
@@ -2,7 +2,7 @@ import './index.less';
2
2
  import './theme/dark.less';
3
3
  import './theme/light.less';
4
4
  import React from 'react';
5
- import { MarkdownBlock } from '../types';
5
+ import { MarkdownBlock, TTTAction } from '../types';
6
6
  interface Props {
7
7
  theme: string;
8
8
  prefix: string;
@@ -11,6 +11,7 @@ interface Props {
11
11
  renderBlock: (block: MarkdownBlock) => React.ReactNode;
12
12
  className?: string;
13
13
  style?: React.CSSProperties;
14
+ sendAction?: (action: TTTAction) => void;
14
15
  }
15
16
  declare const _default: React.MemoExoticComponent<(props: Props) => React.JSX.Element>;
16
17
  export default _default;
@@ -8,7 +8,6 @@ import React, { useEffect, useMemo, useState } from 'react';
8
8
  import { RichText } from '@ray-js/ray';
9
9
  import { View } from '@ray-js/components';
10
10
  import { BlockParser } from './BlockParser';
11
- import { useSendAction } from '../hooks';
12
11
  const MarkdownRender = props => {
13
12
  const {
14
13
  theme,
@@ -19,6 +18,9 @@ const MarkdownRender = props => {
19
18
  className,
20
19
  style
21
20
  } = props;
21
+ const sendAction = props.sendAction || (action => {
22
+ console.warn('sendAction is not provided', action);
23
+ });
22
24
  const [parser, setParser] = useState(() => {
23
25
  return new BlockParser(prefix, customBlockTypes, "h2w__main h2w__".concat(theme));
24
26
  });
@@ -28,7 +30,6 @@ const MarkdownRender = props => {
28
30
  const blocks = useMemo(() => {
29
31
  return parser.parse(text);
30
32
  }, [text, parser]);
31
- const sendAction = useSendAction();
32
33
  return /*#__PURE__*/React.createElement(View, {
33
34
  className: "t-agent-markdown-render ".concat(className || ''),
34
35
  style: style
@@ -381,6 +381,10 @@
381
381
  opacity: 1;
382
382
  height: calc(100% + 150rpx);
383
383
  }
384
+
385
+ &.t-agent-message-input-ptt-overlay-cancel {
386
+ color: var(--app-M1_2);
387
+ }
384
388
  }
385
389
 
386
390
  .t-agent-message-input-ptt-active-text-top {
@@ -229,10 +229,6 @@ export function useAttachmentInput() {
229
229
  }
230
230
  await Promise.all(files.map(async file => {
231
231
  const id = generateId();
232
- setUploaded(prev => [...prev, {
233
- id,
234
- type: 'loading'
235
- }]);
236
232
  try {
237
233
  if (local) {
238
234
  setUploaded(prev => [...prev, {
@@ -243,6 +239,10 @@ export function useAttachmentInput() {
243
239
  size: file.size
244
240
  }]);
245
241
  } else {
242
+ setUploaded(prev => [...prev, {
243
+ id,
244
+ type: 'loading'
245
+ }]);
246
246
  const [thumb, video] = await Promise.all([uploadImage(file.thumbTempFilePath, getStaticResourceBizType(file.thumbTempFilePath, 'videoThumb:upload')), uploadVideo(file.tempFilePath, getStaticResourceBizType(file.tempFilePath, 'video:upload'))]);
247
247
  setUploaded(prev => prev.map(item => item.id === id ? {
248
248
  id,
@@ -258,9 +258,6 @@ export function useLongPress() {
258
258
  item.action();
259
259
  handleCloseMenu();
260
260
  }, [handleCloseMenu]);
261
- const getMenuItemLabel = useCallback(item => {
262
- return t("t-agent.message.action.".concat(item.key)) || item.label;
263
- }, [t]);
264
261
  return {
265
262
  longPressProps: {
266
263
  onLongPress: handleLongPress
@@ -272,7 +269,7 @@ export function useLongPress() {
272
269
  handleCloseMenu,
273
270
  handleMenuItemClick,
274
271
  menuItems: menuItems.map(item => _objectSpread(_objectSpread({}, item), {}, {
275
- displayLabel: getMenuItemLabel(item)
272
+ displayLabel: item.label
276
273
  }))
277
274
  }
278
275
  };
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { View } from '@ray-js/components';
3
3
  import './index.less';
4
4
  import MarkdownRender from '../../MarkdownRender';
5
- import { useRenderOptions } from '../../hooks';
5
+ import { useRenderOptions, useSendAction } from '../../hooks';
6
6
  import { systemInfo } from '../../utils';
7
7
  const TextTile = props => {
8
8
  const {
@@ -14,12 +14,14 @@ const TextTile = props => {
14
14
  customBlockTypes
15
15
  } = useRenderOptions();
16
16
  const theme = systemInfo.theme;
17
+ const sendAction = useSendAction();
17
18
  return markdown ? /*#__PURE__*/React.createElement(MarkdownRender, {
18
19
  theme: theme,
19
20
  text: text,
20
21
  prefix: props.tile.id,
21
22
  customBlockTypes: customBlockTypes,
22
- renderBlock: renderCustomBlockAs
23
+ renderBlock: renderCustomBlockAs,
24
+ sendAction: sendAction
23
25
  }) : /*#__PURE__*/React.createElement(View, {
24
26
  className: "t-agent-text-tile"
25
27
  }, text);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/t-agent-ui-ray",
3
- "version": "0.2.5-beta-3",
3
+ "version": "0.2.5-beta-5",
4
4
  "author": "Tuya.inc",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -40,5 +40,5 @@
40
40
  "@types/echarts": "^4.9.22",
41
41
  "@types/markdown-it": "^14.1.1"
42
42
  },
43
- "gitHead": "99cc77a0257a83aae0203fd870df4163355b1f19"
43
+ "gitHead": "5e337015b6c5a690e55834b45e652f34ee338d01"
44
44
  }