@ant-design/agentic-ui 2.25.0 → 2.26.0
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.
|
@@ -1058,7 +1058,8 @@ var defaultAllowedTypes = [
|
|
|
1058
1058
|
comment: props === null || props === void 0 ? void 0 : props.comment,
|
|
1059
1059
|
children: leafComponentProps.children,
|
|
1060
1060
|
hashId: hashId,
|
|
1061
|
-
tagInputProps: props.tagInputProps
|
|
1061
|
+
tagInputProps: props.tagInputProps,
|
|
1062
|
+
linkConfig: props.linkConfig
|
|
1062
1063
|
}));
|
|
1063
1064
|
if (!props.leafRender) return defaultDom;
|
|
1064
1065
|
return props.leafRender(_object_spread_props(_object_spread({}, leafComponentProps), {
|
|
@@ -21,5 +21,6 @@ export declare const MLeaf: React.MemoExoticComponent<(props: RenderLeafProps &
|
|
|
21
21
|
comment: MarkdownEditorProps['comment'];
|
|
22
22
|
fncProps: MarkdownEditorProps['fncProps'];
|
|
23
23
|
tagInputProps: MarkdownEditorProps['tagInputProps'];
|
|
24
|
+
linkConfig: MarkdownEditorProps['linkConfig'];
|
|
24
25
|
}) => React.JSX.Element>;
|
|
25
26
|
export { Blockquote, Break, Code, Head, Hr, InlineKatex, Katex, List, ListItem, Media, Mermaid, Paragraph, Schema, };
|
|
@@ -455,7 +455,7 @@ var MLeafComponent = function(props) {
|
|
|
455
455
|
draggable: false,
|
|
456
456
|
onDragStart: dragStart,
|
|
457
457
|
onClick: function(e) {
|
|
458
|
-
var _props_fncProps;
|
|
458
|
+
var _props_fncProps, _props_linkConfig, _props_linkConfig1, _props_linkConfig2;
|
|
459
459
|
// 在手机上,如果是 fnc,阻止点击事件(使用长按代替)
|
|
460
460
|
if (isMobile && hasFnc) {
|
|
461
461
|
e.preventDefault();
|
|
@@ -467,9 +467,19 @@ var MLeafComponent = function(props) {
|
|
|
467
467
|
if ((_props_fncProps = props.fncProps) === null || _props_fncProps === void 0 ? void 0 : _props_fncProps.onOriginUrlClick) {
|
|
468
468
|
props.fncProps.onOriginUrlClick(leaf === null || leaf === void 0 ? void 0 : leaf.identifier);
|
|
469
469
|
}
|
|
470
|
-
if (
|
|
470
|
+
if ((_props_linkConfig = props.linkConfig) === null || _props_linkConfig === void 0 ? void 0 : _props_linkConfig.onClick) {
|
|
471
|
+
var _props_linkConfig3;
|
|
472
|
+
var res = (_props_linkConfig3 = props.linkConfig) === null || _props_linkConfig3 === void 0 ? void 0 : _props_linkConfig3.onClick(leaf.url);
|
|
473
|
+
if (res === false) {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
if (leaf.url && ((_props_linkConfig1 = props.linkConfig) === null || _props_linkConfig1 === void 0 ? void 0 : _props_linkConfig1.openInNewTab) !== false) {
|
|
471
478
|
window.open(leaf.url, '_blank');
|
|
472
479
|
}
|
|
480
|
+
if (leaf.url && ((_props_linkConfig2 = props.linkConfig) === null || _props_linkConfig2 === void 0 ? void 0 : _props_linkConfig2.openInNewTab) === false) {
|
|
481
|
+
window.location.href = leaf.url;
|
|
482
|
+
}
|
|
473
483
|
},
|
|
474
484
|
onTouchStart: hasFnc ? handleTouchStart : undefined,
|
|
475
485
|
onTouchEnd: hasFnc ? handleTouchEnd : undefined,
|
|
@@ -1381,7 +1381,8 @@ export var EditorStoreContext = createContext(null);
|
|
|
1381
1381
|
value: /**
|
|
1382
1382
|
* 判断是否是简单文本单元格
|
|
1383
1383
|
*/ function isSimpleTextCell(newChildren, oldChildren) {
|
|
1384
|
-
|
|
1384
|
+
var _newChildren_, _oldChildren_;
|
|
1385
|
+
return newChildren.length === 1 && oldChildren.length === 1 && typeof (newChildren === null || newChildren === void 0 ? void 0 : (_newChildren_ = newChildren[0]) === null || _newChildren_ === void 0 ? void 0 : _newChildren_.text) === 'string' && typeof (oldChildren === null || oldChildren === void 0 ? void 0 : (_oldChildren_ = oldChildren[0]) === null || _oldChildren_ === void 0 ? void 0 : _oldChildren_.text) === 'string';
|
|
1385
1386
|
}
|
|
1386
1387
|
},
|
|
1387
1388
|
{
|
|
@@ -1389,14 +1390,16 @@ export var EditorStoreContext = createContext(null);
|
|
|
1389
1390
|
value: /**
|
|
1390
1391
|
* 比较简单文本单元格
|
|
1391
1392
|
*/ function compareSimpleTextCell(newChildren, oldChildren, path, operations) {
|
|
1393
|
+
var _newChildren_, _oldChildren_;
|
|
1392
1394
|
// 只有文本内容变化
|
|
1393
|
-
if (newChildren[0].text !== oldChildren[0].text) {
|
|
1395
|
+
if ((newChildren === null || newChildren === void 0 ? void 0 : (_newChildren_ = newChildren[0]) === null || _newChildren_ === void 0 ? void 0 : _newChildren_.text) !== (oldChildren === null || oldChildren === void 0 ? void 0 : (_oldChildren_ = oldChildren[0]) === null || _oldChildren_ === void 0 ? void 0 : _oldChildren_.text)) {
|
|
1396
|
+
var _newChildren_1;
|
|
1394
1397
|
operations.push({
|
|
1395
1398
|
type: 'text',
|
|
1396
1399
|
path: _to_consumable_array(path).concat([
|
|
1397
1400
|
0
|
|
1398
1401
|
]),
|
|
1399
|
-
text: newChildren[0].text,
|
|
1402
|
+
text: (newChildren === null || newChildren === void 0 ? void 0 : (_newChildren_1 = newChildren[0]) === null || _newChildren_1 === void 0 ? void 0 : _newChildren_1.text) || '',
|
|
1400
1403
|
priority: 8
|
|
1401
1404
|
});
|
|
1402
1405
|
}
|
|
@@ -302,6 +302,12 @@ export type MarkdownEditorProps = {
|
|
|
302
302
|
* 自定义 markdown 转 HTML 的 remark 插件配置,格式类似 Babel 插件数组
|
|
303
303
|
*/
|
|
304
304
|
markdownToHtmlOptions?: MarkdownToHtmlOptions;
|
|
305
|
+
linkConfig?: {
|
|
306
|
+
/** 是否在新标签页打开链接 */
|
|
307
|
+
openInNewTab?: boolean;
|
|
308
|
+
/** 自定义链接渲染函数 */
|
|
309
|
+
onClick?: (url?: string) => boolean | void;
|
|
310
|
+
};
|
|
305
311
|
/**
|
|
306
312
|
* 其他属性
|
|
307
313
|
*/
|