File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -740,9 +740,15 @@ - (void)slk_addCustomMenuControllerItems
740740{
741741 UIMenuItem *undo = [[UIMenuItem alloc ] initWithTitle: NSLocalizedString(@" Undo" , nil ) action: @selector (slk_undo: )];
742742 UIMenuItem *redo = [[UIMenuItem alloc ] initWithTitle: NSLocalizedString(@" Redo" , nil ) action: @selector (slk_redo: )];
743- UIMenuItem *format = [[UIMenuItem alloc ] initWithTitle: NSLocalizedString(@" Format" , nil ) action: @selector (slk_presentFormattingMenu: )];
744743
745- [[UIMenuController sharedMenuController ] setMenuItems: @[undo, redo, format]];
744+ NSMutableArray *items = [NSMutableArray arrayWithObjects: undo, redo, nil ];
745+
746+ if (self.registeredFormattingTitles .count > 0 ) {
747+ UIMenuItem *format = [[UIMenuItem alloc ] initWithTitle: NSLocalizedString(@" Format" , nil ) action: @selector (slk_presentFormattingMenu: )];
748+ [items addObject: format];
749+ }
750+
751+ [[UIMenuController sharedMenuController ] setMenuItems: items];
746752}
747753
748754- (void )slk_undo : (id )sender
You can’t perform that action at this time.
0 commit comments