@ant-design/agentic-ui 2.27.0 → 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";
|
|
@@ -276,11 +277,10 @@ import { getMediaType } from "../../utils/dom";
|
|
|
276
277
|
var _editorProps_image;
|
|
277
278
|
var editorProps = useEditorStore().editorProps;
|
|
278
279
|
var _React_useState = _sliced_to_array(React.useState(false), 2), error = _React_useState[0], setError = _React_useState[1];
|
|
280
|
+
console.log(editorProps);
|
|
279
281
|
// 图片加载失败时显示为链接
|
|
280
282
|
if (error) {
|
|
281
|
-
return /*#__PURE__*/ React.createElement("
|
|
282
|
-
target: "_blank",
|
|
283
|
-
rel: "noopener noreferrer",
|
|
283
|
+
return /*#__PURE__*/ React.createElement("span", {
|
|
284
284
|
onClick: function(e) {
|
|
285
285
|
var _editorProps_linkConfig, _editorProps_linkConfig1;
|
|
286
286
|
e.stopPropagation();
|
|
@@ -309,7 +309,7 @@ import { getMediaType } from "../../utils/dom";
|
|
|
309
309
|
style: {
|
|
310
310
|
color: '#faad14'
|
|
311
311
|
}
|
|
312
|
-
}), props.alt || props.src || '图片链接');
|
|
312
|
+
}), props.alt || props.src || '图片链接', /*#__PURE__*/ React.createElement(SquareArrowUpRight, null));
|
|
313
313
|
}
|
|
314
314
|
if (editorProps === null || editorProps === void 0 ? void 0 : (_editorProps_image = editorProps.image) === null || _editorProps_image === void 0 ? void 0 : _editorProps_image.render) {
|
|
315
315
|
var _editorProps_image_render, _editorProps_image1;
|
|
@@ -345,6 +345,7 @@ import { getMediaType } from "../../utils/dom";
|
|
|
345
345
|
"selected",
|
|
346
346
|
"defaultSize"
|
|
347
347
|
]);
|
|
348
|
+
var editorProps = useEditorStore().editorProps;
|
|
348
349
|
var _React_useState = _sliced_to_array(React.useState(true), 2), loading = _React_useState[0], setLoading = _React_useState[1];
|
|
349
350
|
var _React_useState1 = _sliced_to_array(React.useState(false), 2), error = _React_useState1[0], setError = _React_useState1[1];
|
|
350
351
|
var radio = useRef(1);
|
|
@@ -365,10 +366,18 @@ import { getMediaType } from "../../utils/dom";
|
|
|
365
366
|
}, 160);
|
|
366
367
|
// 如果图片加载失败,显示为链接
|
|
367
368
|
if (error) {
|
|
368
|
-
return /*#__PURE__*/ React.createElement("
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
369
|
+
return /*#__PURE__*/ React.createElement("span", {
|
|
370
|
+
onClick: function(e) {
|
|
371
|
+
var _editorProps_linkConfig, _editorProps_linkConfig1;
|
|
372
|
+
e.stopPropagation();
|
|
373
|
+
e.preventDefault();
|
|
374
|
+
if ((_editorProps_linkConfig = editorProps.linkConfig) === null || _editorProps_linkConfig === void 0 ? void 0 : _editorProps_linkConfig.onClick) {
|
|
375
|
+
if (editorProps.linkConfig.onClick(props.src || '') === false) {
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
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');
|
|
380
|
+
},
|
|
372
381
|
style: {
|
|
373
382
|
color: '#1890ff',
|
|
374
383
|
textDecoration: 'underline',
|
|
@@ -388,7 +397,7 @@ import { getMediaType } from "../../utils/dom";
|
|
|
388
397
|
style: {
|
|
389
398
|
color: '#faad14'
|
|
390
399
|
}
|
|
391
|
-
}), props.alt || props.src);
|
|
400
|
+
}), props.alt || props.src, /*#__PURE__*/ React.createElement(SquareArrowUpRight, null));
|
|
392
401
|
}
|
|
393
402
|
return /*#__PURE__*/ React.createElement("div", {
|
|
394
403
|
"data-testid": "resize-image-container",
|
|
@@ -491,7 +500,7 @@ export function EditorImage(param) {
|
|
|
491
500
|
var _state;
|
|
492
501
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
493
502
|
var _useSelStatus = _sliced_to_array(useSelStatus(element), 2), _ = _useSelStatus[0], path = _useSelStatus[1];
|
|
494
|
-
var _useEditorStore = useEditorStore(), markdownEditorRef = _useEditorStore.markdownEditorRef, readonly = _useEditorStore.readonly;
|
|
503
|
+
var _useEditorStore = useEditorStore(), markdownEditorRef = _useEditorStore.markdownEditorRef, readonly = _useEditorStore.readonly, editorProps = _useEditorStore.editorProps;
|
|
495
504
|
var htmlRef = React.useRef(null);
|
|
496
505
|
var _useState = _sliced_to_array(useState(false), 2), showAsText = _useState[0], setShowAsText = _useState[1];
|
|
497
506
|
var _useGetSetState = _sliced_to_array(useGetSetState({
|
|
@@ -600,11 +609,8 @@ export function EditorImage(param) {
|
|
|
600
609
|
}
|
|
601
610
|
// 如果图片加载失败,显示为链接
|
|
602
611
|
if (!state().loadSuccess) {
|
|
603
|
-
var _state2
|
|
604
|
-
return /*#__PURE__*/ React.createElement("
|
|
605
|
-
href: ((_state2 = state()) === null || _state2 === void 0 ? void 0 : _state2.url) || (element === null || element === void 0 ? void 0 : element.url),
|
|
606
|
-
target: "_blank",
|
|
607
|
-
rel: "noopener noreferrer",
|
|
612
|
+
var _state2;
|
|
613
|
+
return /*#__PURE__*/ React.createElement("span", {
|
|
608
614
|
style: {
|
|
609
615
|
color: '#1890ff',
|
|
610
616
|
textDecoration: 'underline',
|
|
@@ -619,12 +625,25 @@ export function EditorImage(param) {
|
|
|
619
625
|
backgroundColor: '#fafafa',
|
|
620
626
|
fontSize: '13px',
|
|
621
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');
|
|
622
641
|
}
|
|
623
642
|
}, /*#__PURE__*/ React.createElement(ExclamationCircleOutlined, {
|
|
624
643
|
style: {
|
|
625
644
|
color: '#faad14'
|
|
626
645
|
}
|
|
627
|
-
}), (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));
|
|
628
647
|
}
|
|
629
648
|
return !readonly ? /*#__PURE__*/ React.createElement(ResizeImage, {
|
|
630
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";
|
|
@@ -387,6 +388,7 @@ export function Media(param) {
|
|
|
387
388
|
var locale = useContext(I18nContext).locale;
|
|
388
389
|
var htmlRef = React.useRef(null);
|
|
389
390
|
var _useState = _sliced_to_array(useState(false), 2), showAsText = _useState[0], setShowAsText = _useState[1];
|
|
391
|
+
console.log(editorProps);
|
|
390
392
|
var _useGetSetState = _sliced_to_array(useGetSetState({
|
|
391
393
|
height: element.height,
|
|
392
394
|
dragging: false,
|
|
@@ -596,9 +598,7 @@ export function Media(param) {
|
|
|
596
598
|
}
|
|
597
599
|
if (!state().loadSuccess) {
|
|
598
600
|
var _state1;
|
|
599
|
-
return /*#__PURE__*/ React.createElement("
|
|
600
|
-
target: "_blank",
|
|
601
|
-
rel: "noopener noreferrer",
|
|
601
|
+
return /*#__PURE__*/ React.createElement("span", {
|
|
602
602
|
onClick: function(e) {
|
|
603
603
|
var _state, _editorProps_linkConfig, _state1, _editorProps_linkConfig1;
|
|
604
604
|
if (!((_state = state()) === null || _state === void 0 ? void 0 : _state.url)) return;
|
|
@@ -629,7 +629,7 @@ export function Media(param) {
|
|
|
629
629
|
style: {
|
|
630
630
|
color: '#faad14'
|
|
631
631
|
}
|
|
632
|
-
}), 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));
|
|
633
633
|
}
|
|
634
634
|
return /*#__PURE__*/ React.createElement("video", {
|
|
635
635
|
"data-testid": "video-element",
|
|
@@ -702,9 +702,7 @@ export function Media(param) {
|
|
|
702
702
|
}
|
|
703
703
|
if (!state().loadSuccess) {
|
|
704
704
|
var _state3;
|
|
705
|
-
return /*#__PURE__*/ React.createElement("
|
|
706
|
-
target: "_blank",
|
|
707
|
-
rel: "noopener noreferrer",
|
|
705
|
+
return /*#__PURE__*/ React.createElement("span", {
|
|
708
706
|
onClick: function(e) {
|
|
709
707
|
var _state, _editorProps_linkConfig, _state1, _editorProps_linkConfig1;
|
|
710
708
|
if (!(((_state = state()) === null || _state === void 0 ? void 0 : _state.url) || (element === null || element === void 0 ? void 0 : element.url))) return;
|
|
@@ -735,7 +733,7 @@ export function Media(param) {
|
|
|
735
733
|
style: {
|
|
736
734
|
color: '#faad14'
|
|
737
735
|
}
|
|
738
|
-
}), 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));
|
|
739
737
|
}
|
|
740
738
|
return /*#__PURE__*/ React.createElement("audio", {
|
|
741
739
|
"data-testid": "audio-element",
|