Remove separator when none of undo and redo button are visible
This commit is contained in:
parent
1e822fd5ce
commit
0d2f3a60cd
@ -55,9 +55,11 @@ webContents.on('context-menu', (event, props) => {
|
|||||||
|
|
||||||
// Text clipboard
|
// Text clipboard
|
||||||
if (editFlags.canUndo || editFlags.canRedo || editFlags.canCut || editFlags.canCopy || editFlags.canPaste || editFlags.canDelete) {
|
if (editFlags.canUndo || editFlags.canRedo || editFlags.canCut || editFlags.canCopy || editFlags.canPaste || editFlags.canDelete) {
|
||||||
|
if (editFlags.canUndo || editFlags.canRedo) {
|
||||||
if (menu.items.length > 0) {
|
if (menu.items.length > 0) {
|
||||||
menu.append(new MenuItem({type: 'separator'}));
|
menu.append(new MenuItem({type: 'separator'}));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editFlags.canUndo) {
|
if (editFlags.canUndo) {
|
||||||
menu.append(new MenuItem({
|
menu.append(new MenuItem({
|
||||||
label: 'Undo',
|
label: 'Undo',
|
||||||
@ -70,10 +72,12 @@ webContents.on('context-menu', (event, props) => {
|
|||||||
role: 'redo',
|
role: 'redo',
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (menu.items.length > 0) {
|
if (menu.items.length > 0) {
|
||||||
menu.append(new MenuItem({type: 'separator'}));
|
menu.append(new MenuItem({type: 'separator'}));
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.append(new MenuItem({
|
menu.append(new MenuItem({
|
||||||
label: 'Cut',
|
label: 'Cut',
|
||||||
role: 'cut',
|
role: 'cut',
|
||||||
|
Loading…
Reference in New Issue
Block a user