@@ -64,22 +64,22 @@ const Quote = () => {
64
64
) ;
65
65
} ;
66
66
67
- const ColumnIcon = ( ) => {
68
- return (
69
- < svg
70
- className = "ant-menu-item-icon"
71
- viewBox = "0 0 1024 1024"
72
- version = "1.1"
73
- width = "1em"
74
- height = "1em"
75
- >
76
- < path
77
- fill = "currentColor"
78
- d = "M880 112c17.7 0 32 14.3 32 32v736c0 17.7-14.3 32-32 32H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32z m-404 72H184v656h292V184z m364 0H548v656h292V184z"
79
- />
80
- </ svg >
81
- ) ;
82
- } ;
67
+ // const ColumnIcon = () => {
68
+ // return (
69
+ // <svg
70
+ // className="ant-menu-item-icon"
71
+ // viewBox="0 0 1024 1024"
72
+ // version="1.1"
73
+ // width="1em"
74
+ // height="1em"
75
+ // >
76
+ // <path
77
+ // fill="currentColor"
78
+ // d="M880 112c17.7 0 32 14.3 32 32v736c0 17.7-14.3 32-32 32H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32z m-404 72H184v656h292V184z m364 0H548v656h292V184z"
79
+ // />
80
+ // </svg>
81
+ // );
82
+ // };
83
83
84
84
export type InsertAutocompleteItem = {
85
85
label : string [ ] ;
@@ -130,12 +130,12 @@ export const getInsertOptions: (ctx: { isTop: boolean }) => InsertOptions[] = (
130
130
task : 'insertTable' ,
131
131
icon : < TableOutlined /> ,
132
132
} ,
133
- {
134
- label : [ '分栏' , 'Column' ] ,
135
- key : 'column' ,
136
- task : 'insertColumn' ,
137
- icon : < ColumnIcon /> ,
138
- } ,
133
+ // {
134
+ // label: ['分栏', 'Column'],
135
+ // key: 'column',
136
+ // task: 'insertColumn',
137
+ // icon: <ColumnIcon />,
138
+ // },
139
139
{
140
140
label : [ '引用' , 'Quote' ] ,
141
141
key : 'quote' ,
@@ -666,34 +666,47 @@ export const InsertAutocomplete: React.FC<InsertAutocompleteProps> = observer(
666
666
{ ! state . insertLink && ! state . insertAttachment && (
667
667
< >
668
668
< Menu
669
- items = { state . filterOptions . map ( ( l ) => {
670
- return {
671
- label : l ?. label ?. [ 0 ] ,
672
- key : l ?. key ,
673
- icon : l . children ?. [ 0 ] ?. icon ,
674
- children : l ?. children ?. map ( ( el ) => ( {
675
- label : el . label [ 0 ] ,
676
- key : el . key ,
677
- icon : el . icon ,
678
- onClick : ( _ ) => {
679
- _ . domEvent . stopPropagation ( ) ;
680
- _ . domEvent . preventDefault ( ) ;
681
- const task = state . options [ state . index ] ;
682
- if ( ! task ) {
683
- const myInsertOptions = props ?. insertOptions ?. find ?.(
684
- ( o ) => o . key === el . key ,
685
- ) ;
686
- if ( ! myInsertOptions ) return ;
687
- runInsertTask ( myInsertOptions , {
688
- isCustom : true ,
689
- } ) ;
690
- return ;
691
- }
692
- runInsertTask ( task ) ;
693
- } ,
694
- } ) ) ,
695
- } ;
696
- } ) }
669
+ items = { state . filterOptions
670
+ . map ( ( l ) => {
671
+ return {
672
+ label : l ?. label ?. [ 0 ] ,
673
+ key : l ?. key ,
674
+ icon : l . children ?. [ 0 ] ?. icon ,
675
+ children : l ?. children ?. map ( ( el ) => ( {
676
+ label : el . label [ 0 ] ,
677
+ key : el . key ,
678
+ icon : el . icon ,
679
+ onClick : ( _ : any ) => {
680
+ _ . domEvent . stopPropagation ( ) ;
681
+ _ . domEvent . preventDefault ( ) ;
682
+
683
+ const task = state . filterOptions
684
+ . map ( ( o ) => o . children )
685
+ . flat ( 1 )
686
+ . find ( ( o ) => {
687
+ return o . key === el . key ;
688
+ } ) ;
689
+ if ( ! task ) {
690
+ const myInsertOptions =
691
+ props ?. insertOptions ?. find ?.(
692
+ ( o ) => o . key === el . key ,
693
+ ) ;
694
+ if ( ! myInsertOptions ) return ;
695
+ runInsertTask ( myInsertOptions , {
696
+ isCustom : true ,
697
+ } ) ;
698
+ return ;
699
+ } else {
700
+ runInsertTask ( task ) ;
701
+ }
702
+ } ,
703
+ } ) ) ,
704
+ } ;
705
+ } )
706
+ . map ( ( l ) => {
707
+ return l . children ;
708
+ } )
709
+ . flat ( 1 ) }
697
710
/>
698
711
</ >
699
712
) }
0 commit comments