@ant-design/agentic-ui 2.26.0 → 2.27.1
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.
|
@@ -276,12 +276,23 @@ import { getMediaType } from "../../utils/dom";
|
|
|
276
276
|
var _editorProps_image;
|
|
277
277
|
var editorProps = useEditorStore().editorProps;
|
|
278
278
|
var _React_useState = _sliced_to_array(React.useState(false), 2), error = _React_useState[0], setError = _React_useState[1];
|
|
279
|
+
console.log(editorProps);
|
|
279
280
|
// 图片加载失败时显示为链接
|
|
280
281
|
if (error) {
|
|
281
282
|
return /*#__PURE__*/ React.createElement("a", {
|
|
282
|
-
href: props.src,
|
|
283
283
|
target: "_blank",
|
|
284
284
|
rel: "noopener noreferrer",
|
|
285
|
+
onClick: function(e) {
|
|
286
|
+
var _editorProps_linkConfig, _editorProps_linkConfig1;
|
|
287
|
+
e.stopPropagation();
|
|
288
|
+
e.preventDefault();
|
|
289
|
+
if ((_editorProps_linkConfig = editorProps.linkConfig) === null || _editorProps_linkConfig === void 0 ? void 0 : _editorProps_linkConfig.onClick) {
|
|
290
|
+
if (editorProps.linkConfig.onClick(props.src || '') === false) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
window.open(props.src, (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_linkConfig1 = editorProps.linkConfig) === null || _editorProps_linkConfig1 === void 0 ? void 0 : _editorProps_linkConfig1.openInNewTab) ? '_blank' : '_self');
|
|
295
|
+
},
|
|
285
296
|
style: {
|
|
286
297
|
color: '#1890ff',
|
|
287
298
|
textDecoration: 'underline',
|
|
@@ -335,6 +346,7 @@ import { getMediaType } from "../../utils/dom";
|
|
|
335
346
|
"selected",
|
|
336
347
|
"defaultSize"
|
|
337
348
|
]);
|
|
349
|
+
var editorProps = useEditorStore().editorProps;
|
|
338
350
|
var _React_useState = _sliced_to_array(React.useState(true), 2), loading = _React_useState[0], setLoading = _React_useState[1];
|
|
339
351
|
var _React_useState1 = _sliced_to_array(React.useState(false), 2), error = _React_useState1[0], setError = _React_useState1[1];
|
|
340
352
|
var radio = useRef(1);
|
|
@@ -356,9 +368,19 @@ import { getMediaType } from "../../utils/dom";
|
|
|
356
368
|
// 如果图片加载失败,显示为链接
|
|
357
369
|
if (error) {
|
|
358
370
|
return /*#__PURE__*/ React.createElement("a", {
|
|
359
|
-
href: props.src,
|
|
360
371
|
target: "_blank",
|
|
361
372
|
rel: "noopener noreferrer",
|
|
373
|
+
onClick: function(e) {
|
|
374
|
+
var _editorProps_linkConfig, _editorProps_linkConfig1;
|
|
375
|
+
e.stopPropagation();
|
|
376
|
+
e.preventDefault();
|
|
377
|
+
if ((_editorProps_linkConfig = editorProps.linkConfig) === null || _editorProps_linkConfig === void 0 ? void 0 : _editorProps_linkConfig.onClick) {
|
|
378
|
+
if (editorProps.linkConfig.onClick(props.src || '') === false) {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
window.open(props.src, (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_linkConfig1 = editorProps.linkConfig) === null || _editorProps_linkConfig1 === void 0 ? void 0 : _editorProps_linkConfig1.openInNewTab) ? '_blank' : '_self');
|
|
383
|
+
},
|
|
362
384
|
style: {
|
|
363
385
|
color: '#1890ff',
|
|
364
386
|
textDecoration: 'underline',
|
|
@@ -382,10 +382,12 @@ export function Media(param) {
|
|
|
382
382
|
var _state, _state1;
|
|
383
383
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
384
384
|
var _useSelStatus = _sliced_to_array(useSelStatus(element), 2), _ = _useSelStatus[0], path = _useSelStatus[1];
|
|
385
|
+
var editorProps = useEditorStore().editorProps;
|
|
385
386
|
var _useEditorStore = useEditorStore(), markdownEditorRef = _useEditorStore.markdownEditorRef, readonly = _useEditorStore.readonly;
|
|
386
387
|
var locale = useContext(I18nContext).locale;
|
|
387
388
|
var htmlRef = React.useRef(null);
|
|
388
389
|
var _useState = _sliced_to_array(useState(false), 2), showAsText = _useState[0], setShowAsText = _useState[1];
|
|
390
|
+
console.log(editorProps);
|
|
389
391
|
var _useGetSetState = _sliced_to_array(useGetSetState({
|
|
390
392
|
height: element.height,
|
|
391
393
|
dragging: false,
|
|
@@ -594,11 +596,23 @@ export function Media(param) {
|
|
|
594
596
|
});
|
|
595
597
|
}
|
|
596
598
|
if (!state().loadSuccess) {
|
|
597
|
-
var _state1
|
|
599
|
+
var _state1;
|
|
598
600
|
return /*#__PURE__*/ React.createElement("a", {
|
|
599
|
-
href: ((_state1 = state()) === null || _state1 === void 0 ? void 0 : _state1.url) || (element === null || element === void 0 ? void 0 : element.url),
|
|
600
601
|
target: "_blank",
|
|
601
602
|
rel: "noopener noreferrer",
|
|
603
|
+
onClick: function(e) {
|
|
604
|
+
var _state, _editorProps_linkConfig, _state1, _editorProps_linkConfig1;
|
|
605
|
+
if (!((_state = state()) === null || _state === void 0 ? void 0 : _state.url)) return;
|
|
606
|
+
e.stopPropagation();
|
|
607
|
+
e.preventDefault();
|
|
608
|
+
if ((_editorProps_linkConfig = editorProps.linkConfig) === null || _editorProps_linkConfig === void 0 ? void 0 : _editorProps_linkConfig.onClick) {
|
|
609
|
+
var _state2;
|
|
610
|
+
if (editorProps.linkConfig.onClick(((_state2 = state()) === null || _state2 === void 0 ? void 0 : _state2.url) || '') === false) {
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
window.open((_state1 = state()) === null || _state1 === void 0 ? void 0 : _state1.url, (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_linkConfig1 = editorProps.linkConfig) === null || _editorProps_linkConfig1 === void 0 ? void 0 : _editorProps_linkConfig1.openInNewTab) ? '_blank' : '_self');
|
|
615
|
+
},
|
|
602
616
|
style: {
|
|
603
617
|
color: '#1890ff',
|
|
604
618
|
textDecoration: 'underline',
|
|
@@ -616,7 +630,7 @@ export function Media(param) {
|
|
|
616
630
|
style: {
|
|
617
631
|
color: '#faad14'
|
|
618
632
|
}
|
|
619
|
-
}), element.alt || ((
|
|
633
|
+
}), element.alt || ((_state1 = state()) === null || _state1 === void 0 ? void 0 : _state1.url) || (element === null || element === void 0 ? void 0 : element.url) || '视频链接');
|
|
620
634
|
}
|
|
621
635
|
return /*#__PURE__*/ React.createElement("video", {
|
|
622
636
|
"data-testid": "video-element",
|
|
@@ -645,7 +659,7 @@ export function Media(param) {
|
|
|
645
659
|
});
|
|
646
660
|
}
|
|
647
661
|
if (state().type === 'audio') {
|
|
648
|
-
var
|
|
662
|
+
var _state2;
|
|
649
663
|
// 如果是不完整状态
|
|
650
664
|
if (element.finished === false) {
|
|
651
665
|
// 如果 5 秒后仍未完成,显示为文本
|
|
@@ -688,11 +702,23 @@ export function Media(param) {
|
|
|
688
702
|
}, rawMarkdown || (element === null || element === void 0 ? void 0 : element.alt) || '音频加载中...'));
|
|
689
703
|
}
|
|
690
704
|
if (!state().loadSuccess) {
|
|
691
|
-
var
|
|
705
|
+
var _state3;
|
|
692
706
|
return /*#__PURE__*/ React.createElement("a", {
|
|
693
|
-
href: ((_state4 = state()) === null || _state4 === void 0 ? void 0 : _state4.url) || (element === null || element === void 0 ? void 0 : element.url),
|
|
694
707
|
target: "_blank",
|
|
695
708
|
rel: "noopener noreferrer",
|
|
709
|
+
onClick: function(e) {
|
|
710
|
+
var _state, _editorProps_linkConfig, _state1, _editorProps_linkConfig1;
|
|
711
|
+
if (!(((_state = state()) === null || _state === void 0 ? void 0 : _state.url) || (element === null || element === void 0 ? void 0 : element.url))) return;
|
|
712
|
+
e.stopPropagation();
|
|
713
|
+
e.preventDefault();
|
|
714
|
+
if ((_editorProps_linkConfig = editorProps.linkConfig) === null || _editorProps_linkConfig === void 0 ? void 0 : _editorProps_linkConfig.onClick) {
|
|
715
|
+
var _state2;
|
|
716
|
+
if (editorProps.linkConfig.onClick(((_state2 = state()) === null || _state2 === void 0 ? void 0 : _state2.url) || (element === null || element === void 0 ? void 0 : element.url) || '') === false) {
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
window.open(((_state1 = state()) === null || _state1 === void 0 ? void 0 : _state1.url) || (element === null || element === void 0 ? void 0 : element.url), (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_linkConfig1 = editorProps.linkConfig) === null || _editorProps_linkConfig1 === void 0 ? void 0 : _editorProps_linkConfig1.openInNewTab) ? '_blank' : '_self');
|
|
721
|
+
},
|
|
696
722
|
style: {
|
|
697
723
|
color: '#1890ff',
|
|
698
724
|
textDecoration: 'underline',
|
|
@@ -710,7 +736,7 @@ export function Media(param) {
|
|
|
710
736
|
style: {
|
|
711
737
|
color: '#faad14'
|
|
712
738
|
}
|
|
713
|
-
}), element.alt || ((
|
|
739
|
+
}), element.alt || ((_state3 = state()) === null || _state3 === void 0 ? void 0 : _state3.url) || (element === null || element === void 0 ? void 0 : element.url) || '音频链接');
|
|
714
740
|
}
|
|
715
741
|
return /*#__PURE__*/ React.createElement("audio", {
|
|
716
742
|
"data-testid": "audio-element",
|
|
@@ -719,7 +745,7 @@ export function Media(param) {
|
|
|
719
745
|
width: '100%',
|
|
720
746
|
height: 'auto'
|
|
721
747
|
},
|
|
722
|
-
src: ((
|
|
748
|
+
src: ((_state2 = state()) === null || _state2 === void 0 ? void 0 : _state2.url) || '',
|
|
723
749
|
onError: function() {
|
|
724
750
|
var _state;
|
|
725
751
|
console.warn('Audio failed to load:', (_state = state()) === null || _state === void 0 ? void 0 : _state.url);
|
|
@@ -730,7 +756,7 @@ export function Media(param) {
|
|
|
730
756
|
}, "Your browser does not support the", /*#__PURE__*/ React.createElement("code", null, "audio"), " element.");
|
|
731
757
|
}
|
|
732
758
|
if (state().type === 'attachment') {
|
|
733
|
-
var
|
|
759
|
+
var _state4, _element_alt, _element_alt1, _element_otherProps1, _element_otherProps_collaborators, _element_otherProps2, _element_otherProps3;
|
|
734
760
|
return /*#__PURE__*/ React.createElement("div", {
|
|
735
761
|
style: {
|
|
736
762
|
padding: 12,
|
|
@@ -762,7 +788,7 @@ export function Media(param) {
|
|
|
762
788
|
minWidth: 0
|
|
763
789
|
}
|
|
764
790
|
}, /*#__PURE__*/ React.createElement("a", {
|
|
765
|
-
href: (
|
|
791
|
+
href: (_state4 = state()) === null || _state4 === void 0 ? void 0 : _state4.url,
|
|
766
792
|
style: {
|
|
767
793
|
overflow: 'ellipsis',
|
|
768
794
|
textOverflow: 'ellipsis',
|