@ant-design/agentic-ui 2.27.1 → 2.27.2
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.
|
@@ -251,6 +251,7 @@ import { BlockOutlined, DeleteFilled, ExclamationCircleOutlined, LoadingOutlined
|
|
|
251
251
|
import { Image, Modal, Popover, Skeleton, Space } from "antd";
|
|
252
252
|
import React, { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
253
253
|
import { useDebounceFn } from "@ant-design/pro-components";
|
|
254
|
+
import { SquareArrowUpRight } from "@sofa-design/icons";
|
|
254
255
|
import { Rnd } from "react-rnd";
|
|
255
256
|
import { Path, Transforms } from "slate";
|
|
256
257
|
import { ActionIconBox } from "../../../../Components/ActionIconBox";
|
|
@@ -279,9 +280,7 @@ import { getMediaType } from "../../utils/dom";
|
|
|
279
280
|
console.log(editorProps);
|
|
280
281
|
// 图片加载失败时显示为链接
|
|
281
282
|
if (error) {
|
|
282
|
-
return /*#__PURE__*/ React.createElement("
|
|
283
|
-
target: "_blank",
|
|
284
|
-
rel: "noopener noreferrer",
|
|
283
|
+
return /*#__PURE__*/ React.createElement("span", {
|
|
285
284
|
onClick: function(e) {
|
|
286
285
|
var _editorProps_linkConfig, _editorProps_linkConfig1;
|
|
287
286
|
e.stopPropagation();
|
|
@@ -310,7 +309,7 @@ import { getMediaType } from "../../utils/dom";
|
|
|
310
309
|
style: {
|
|
311
310
|
color: '#faad14'
|
|
312
311
|
}
|
|
313
|
-
}), props.alt || props.src || '图片链接');
|
|
312
|
+
}), props.alt || props.src || '图片链接', /*#__PURE__*/ React.createElement(SquareArrowUpRight, null));
|
|
314
313
|
}
|
|
315
314
|
if (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_image = editorProps.image) === null || _editorProps_image === void 0 ? void 0 : _editorProps_image.render) {
|
|
316
315
|
var _editorProps_image_render, _editorProps_image1;
|
|
@@ -367,9 +366,7 @@ import { getMediaType } from "../../utils/dom";
|
|
|
367
366
|
}, 160);
|
|
368
367
|
// 如果图片加载失败,显示为链接
|
|
369
368
|
if (error) {
|
|
370
|
-
return /*#__PURE__*/ React.createElement("
|
|
371
|
-
target: "_blank",
|
|
372
|
-
rel: "noopener noreferrer",
|
|
369
|
+
return /*#__PURE__*/ React.createElement("span", {
|
|
373
370
|
onClick: function(e) {
|
|
374
371
|
var _editorProps_linkConfig, _editorProps_linkConfig1;
|
|
375
372
|
e.stopPropagation();
|
|
@@ -400,7 +397,7 @@ import { getMediaType } from "../../utils/dom";
|
|
|
400
397
|
style: {
|
|
401
398
|
color: '#faad14'
|
|
402
399
|
}
|
|
403
|
-
}), props.alt || props.src);
|
|
400
|
+
}), props.alt || props.src, /*#__PURE__*/ React.createElement(SquareArrowUpRight, null));
|
|
404
401
|
}
|
|
405
402
|
return /*#__PURE__*/ React.createElement("div", {
|
|
406
403
|
"data-testid": "resize-image-container",
|
|
@@ -503,7 +500,7 @@ export function EditorImage(param) {
|
|
|
503
500
|
var _state;
|
|
504
501
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
505
502
|
var _useSelStatus = _sliced_to_array(useSelStatus(element), 2), _ = _useSelStatus[0], path = _useSelStatus[1];
|
|
506
|
-
var _useEditorStore = useEditorStore(), markdownEditorRef = _useEditorStore.markdownEditorRef, readonly = _useEditorStore.readonly;
|
|
503
|
+
var _useEditorStore = useEditorStore(), markdownEditorRef = _useEditorStore.markdownEditorRef, readonly = _useEditorStore.readonly, editorProps = _useEditorStore.editorProps;
|
|
507
504
|
var htmlRef = React.useRef(null);
|
|
508
505
|
var _useState = _sliced_to_array(useState(false), 2), showAsText = _useState[0], setShowAsText = _useState[1];
|
|
509
506
|
var _useGetSetState = _sliced_to_array(useGetSetState({
|
|
@@ -612,11 +609,8 @@ export function EditorImage(param) {
|
|
|
612
609
|
}
|
|
613
610
|
// 如果图片加载失败,显示为链接
|
|
614
611
|
if (!state().loadSuccess) {
|
|
615
|
-
var _state2
|
|
616
|
-
return /*#__PURE__*/ React.createElement("
|
|
617
|
-
href: ((_state2 = state()) === null || _state2 === void 0 ? void 0 : _state2.url) || (element === null || element === void 0 ? void 0 : element.url),
|
|
618
|
-
target: "_blank",
|
|
619
|
-
rel: "noopener noreferrer",
|
|
612
|
+
var _state2;
|
|
613
|
+
return /*#__PURE__*/ React.createElement("span", {
|
|
620
614
|
style: {
|
|
621
615
|
color: '#1890ff',
|
|
622
616
|
textDecoration: 'underline',
|
|
@@ -631,12 +625,25 @@ export function EditorImage(param) {
|
|
|
631
625
|
backgroundColor: '#fafafa',
|
|
632
626
|
fontSize: '13px',
|
|
633
627
|
lineHeight: '1.5'
|
|
628
|
+
},
|
|
629
|
+
onClick: function(e) {
|
|
630
|
+
var _state, _editorProps_linkConfig, _state1, _editorProps_linkConfig1;
|
|
631
|
+
if (!(((_state = state()) === null || _state === void 0 ? void 0 : _state.url) || (element === null || element === void 0 ? void 0 : element.url))) return;
|
|
632
|
+
e.stopPropagation();
|
|
633
|
+
e.preventDefault();
|
|
634
|
+
if ((_editorProps_linkConfig = editorProps.linkConfig) === null || _editorProps_linkConfig === void 0 ? void 0 : _editorProps_linkConfig.onClick) {
|
|
635
|
+
var _state2;
|
|
636
|
+
if (editorProps.linkConfig.onClick(((_state2 = state()) === null || _state2 === void 0 ? void 0 : _state2.url) || (element === null || element === void 0 ? void 0 : element.url) || '') === false) {
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
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');
|
|
634
641
|
}
|
|
635
642
|
}, /*#__PURE__*/ React.createElement(ExclamationCircleOutlined, {
|
|
636
643
|
style: {
|
|
637
644
|
color: '#faad14'
|
|
638
645
|
}
|
|
639
|
-
}), (element === null || element === void 0 ? void 0 : element.alt) || ((
|
|
646
|
+
}), (element === null || element === void 0 ? void 0 : element.alt) || ((_state2 = state()) === null || _state2 === void 0 ? void 0 : _state2.url) || (element === null || element === void 0 ? void 0 : element.url) || '图片链接', /*#__PURE__*/ React.createElement(SquareArrowUpRight, null));
|
|
640
647
|
}
|
|
641
648
|
return !readonly ? /*#__PURE__*/ React.createElement(ResizeImage, {
|
|
642
649
|
defaultSize: {
|
|
@@ -227,6 +227,7 @@ import { DeleteFilled, ExclamationCircleOutlined, EyeOutlined, LoadingOutlined }
|
|
|
227
227
|
import { Modal, Popover, Skeleton } from "antd";
|
|
228
228
|
import React, { useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
229
229
|
import { useDebounceFn } from "@ant-design/pro-components";
|
|
230
|
+
import { SquareArrowUpRight } from "@sofa-design/icons";
|
|
230
231
|
import { Rnd } from "react-rnd";
|
|
231
232
|
import { Transforms } from "slate";
|
|
232
233
|
import { ActionIconBox } from "../../../Components/ActionIconBox";
|
|
@@ -597,9 +598,7 @@ export function Media(param) {
|
|
|
597
598
|
}
|
|
598
599
|
if (!state().loadSuccess) {
|
|
599
600
|
var _state1;
|
|
600
|
-
return /*#__PURE__*/ React.createElement("
|
|
601
|
-
target: "_blank",
|
|
602
|
-
rel: "noopener noreferrer",
|
|
601
|
+
return /*#__PURE__*/ React.createElement("span", {
|
|
603
602
|
onClick: function(e) {
|
|
604
603
|
var _state, _editorProps_linkConfig, _state1, _editorProps_linkConfig1;
|
|
605
604
|
if (!((_state = state()) === null || _state === void 0 ? void 0 : _state.url)) return;
|
|
@@ -630,7 +629,7 @@ export function Media(param) {
|
|
|
630
629
|
style: {
|
|
631
630
|
color: '#faad14'
|
|
632
631
|
}
|
|
633
|
-
}), element.alt || ((_state1 = state()) === null || _state1 === void 0 ? void 0 : _state1.url) || (element === null || element === void 0 ? void 0 : element.url) || '视频链接');
|
|
632
|
+
}), element.alt || ((_state1 = state()) === null || _state1 === void 0 ? void 0 : _state1.url) || (element === null || element === void 0 ? void 0 : element.url) || '视频链接', /*#__PURE__*/ React.createElement(SquareArrowUpRight, null));
|
|
634
633
|
}
|
|
635
634
|
return /*#__PURE__*/ React.createElement("video", {
|
|
636
635
|
"data-testid": "video-element",
|
|
@@ -703,9 +702,7 @@ export function Media(param) {
|
|
|
703
702
|
}
|
|
704
703
|
if (!state().loadSuccess) {
|
|
705
704
|
var _state3;
|
|
706
|
-
return /*#__PURE__*/ React.createElement("
|
|
707
|
-
target: "_blank",
|
|
708
|
-
rel: "noopener noreferrer",
|
|
705
|
+
return /*#__PURE__*/ React.createElement("span", {
|
|
709
706
|
onClick: function(e) {
|
|
710
707
|
var _state, _editorProps_linkConfig, _state1, _editorProps_linkConfig1;
|
|
711
708
|
if (!(((_state = state()) === null || _state === void 0 ? void 0 : _state.url) || (element === null || element === void 0 ? void 0 : element.url))) return;
|
|
@@ -736,7 +733,7 @@ export function Media(param) {
|
|
|
736
733
|
style: {
|
|
737
734
|
color: '#faad14'
|
|
738
735
|
}
|
|
739
|
-
}), element.alt || ((_state3 = state()) === null || _state3 === void 0 ? void 0 : _state3.url) || (element === null || element === void 0 ? void 0 : element.url) || '音频链接');
|
|
736
|
+
}), element.alt || ((_state3 = state()) === null || _state3 === void 0 ? void 0 : _state3.url) || (element === null || element === void 0 ? void 0 : element.url) || '音频链接', /*#__PURE__*/ React.createElement(SquareArrowUpRight, null));
|
|
740
737
|
}
|
|
741
738
|
return /*#__PURE__*/ React.createElement("audio", {
|
|
742
739
|
"data-testid": "audio-element",
|