Skip to content

Commit 813d813

Browse files
committed
refactor: Order context menu by target instead of actions
1 parent 1e96e87 commit 813d813

File tree

1 file changed

+41
-61
lines changed

1 file changed

+41
-61
lines changed

source/common/modules/markdown-editor/table-editor/context-menu.ts

Lines changed: 41 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export function displayTableContextMenu (event: MouseEvent, callback: (clickedID
66
const template: AnyMenuItem[] = [
77
{
88
type: 'submenu',
9-
label: trans('Insert'),
9+
label: trans('Row'),
1010
id: '',
1111
enabled: true,
1212
submenu: [
@@ -25,34 +25,47 @@ export function displayTableContextMenu (event: MouseEvent, callback: (clickedID
2525
{ type: 'separator' },
2626
{
2727
type: 'normal',
28-
label: trans('Insert new column left'),
29-
id: 'insert.col.left',
28+
label: trans('Move row up'),
29+
id: 'move.row.up',
3030
enabled: true
3131
},
3232
{
3333
type: 'normal',
34-
label: trans('Insert new column right'),
35-
id: 'insert.col.right',
34+
label: trans('Move row down'),
35+
id: 'move.row.down',
36+
enabled: true
37+
},
38+
{ type: 'separator' },
39+
{
40+
type: 'normal',
41+
label: trans('Clear row'),
42+
id: 'clear.row',
43+
enabled: true
44+
},
45+
{
46+
type: 'normal',
47+
label: trans('Delete row'),
48+
id: 'delete.row',
3649
enabled: true
3750
}
3851
]
3952
},
4053
{
4154
type: 'submenu',
42-
label: trans('Move'),
55+
label: trans('Column'),
4356
id: '',
4457
enabled: true,
4558
submenu: [
4659
{
4760
type: 'normal',
48-
label: trans('Move row up'),
49-
id: 'move.row.up',
61+
label: trans('Insert new column left'),
62+
id: 'insert.col.left',
5063
enabled: true
5164
},
5265
{
5366
type: 'normal',
54-
label: trans('Move row down'),
55-
id: 'move.row.down',
67+
label: trans('Insert new column right'),
68+
id: 'insert.col.right',
5669
enabled: true
5770
},
5871
{ type: 'separator' },
@@ -67,35 +80,8 @@ export function displayTableContextMenu (event: MouseEvent, callback: (clickedID
6780
label: trans('Move column right'),
6881
id: 'move.col.right',
6982
enabled: true
70-
}
71-
]
72-
},
73-
{
74-
type: 'submenu',
75-
label: trans('Sort'),
76-
id: '',
77-
enabled: true,
78-
submenu: [
79-
{
80-
type: 'normal',
81-
label: trans('Sort column A-Z'),
82-
id: 'sort.col.asc',
83-
enabled: true
8483
},
85-
{
86-
type: 'normal',
87-
label: trans('Sort column Z-A'),
88-
id: 'sort.col.desc',
89-
enabled: true
90-
}
91-
]
92-
},
93-
{
94-
type: 'submenu',
95-
label: trans('Align'),
96-
id: '',
97-
enabled: true,
98-
submenu: [
84+
{ type: 'separator' },
9985
{
10086
type: 'normal',
10187
label: trans('Align column text left'),
@@ -113,21 +99,21 @@ export function displayTableContextMenu (event: MouseEvent, callback: (clickedID
11399
label: trans('Align column text right'),
114100
id: 'align.col.right',
115101
enabled: true
116-
}
117-
]
118-
},
119-
{
120-
type: 'submenu',
121-
label: trans('Clear'),
122-
id: '',
123-
enabled: true,
124-
submenu: [
102+
},
103+
{ type: 'separator' },
125104
{
126105
type: 'normal',
127-
label: trans('Clear row'),
128-
id: 'clear.row',
106+
label: trans('Sort column A-Z'),
107+
id: 'sort.col.asc',
129108
enabled: true
130109
},
110+
{
111+
type: 'normal',
112+
label: trans('Sort column Z-A'),
113+
id: 'sort.col.desc',
114+
enabled: true
115+
},
116+
{ type: 'separator' },
131117
{
132118
type: 'normal',
133119
label: trans('Clear column'),
@@ -136,28 +122,22 @@ export function displayTableContextMenu (event: MouseEvent, callback: (clickedID
136122
},
137123
{
138124
type: 'normal',
139-
label: trans('Clear table'),
140-
id: 'clear.table',
125+
label: trans('Delete column'),
126+
id: 'delete.col',
141127
enabled: true
142-
},
128+
}
143129
]
144130
},
145131
{
146132
type: 'submenu',
147-
label: trans('Delete'),
133+
label: trans('Table'),
148134
id: '',
149135
enabled: true,
150136
submenu: [
151137
{
152138
type: 'normal',
153-
label: trans('Delete row'),
154-
id: 'delete.row',
155-
enabled: true
156-
},
157-
{
158-
type: 'normal',
159-
label: trans('Delete column'),
160-
id: 'delete.col',
139+
label: trans('Clear table'),
140+
id: 'clear.table',
161141
enabled: true
162142
},
163143
{

0 commit comments

Comments
 (0)