5#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterUndoManagerPlugin.h"
7#pragma mark - UndoManager channel method names.
10#pragma mark - Undo State field names
31 [_undoManagerDelegate.undoManager removeAllActionsWithTarget:self];
35 NSString* method =
call.method;
38 [
self setUndoState:args];
46 [
self.undoManagerDelegate.undoManager removeAllActionsWithTarget:self];
49- (void)registerUndoWithDirection:(FlutterUndoRedoDirection)direction {
50 NSUndoManager* undoManager =
self.undoManagerDelegate.undoManager;
51 [undoManager beginUndoGrouping];
52 [undoManager registerUndoWithTarget:self
53 handler:^(FlutterUndoManagerPlugin* target) {
55 FlutterUndoRedoDirection newDirection =
56 (direction == FlutterUndoRedoDirectionRedo)
57 ? FlutterUndoRedoDirectionUndo
58 : FlutterUndoRedoDirectionRedo;
59 [target registerUndoWithDirection:newDirection];
61 [target.undoManagerDelegate handleUndoWithDirection:direction];
63 [undoManager endUndoGrouping];
67 NSUndoManager* undoManager =
self.undoManagerDelegate.undoManager;
68 [undoManager beginUndoGrouping];
69 [undoManager registerUndoWithTarget:self
70 handler:^(id target) {
72 [target registerUndoWithDirection:FlutterUndoRedoDirectionRedo];
74 [undoManager endUndoGrouping];
78- (void)setUndoState:(NSDictionary*)dictionary {
79 NSUndoManager* undoManager =
self.undoManagerDelegate.undoManager;
80 BOOL groupsByEvent = undoManager.groupsByEvent;
81 undoManager.groupsByEvent = NO;
82 BOOL canUndo = [dictionary[kCanUndo] boolValue];
83 BOOL canRedo = [dictionary[kCanRedo] boolValue];
85 [
self resetUndoManager];
88 [
self registerUndoWithDirection:FlutterUndoRedoDirectionUndo];
93 UIView<UITextInput>* textInputView =
self.undoManagerDelegate.activeTextInputView;
94 if (textInputView != nil) {
98 UITextInputAssistantItem* assistantItem = textInputView.inputAssistantItem;
99 assistantItem.leadingBarButtonGroups = assistantItem.leadingBarButtonGroups;
101 undoManager.groupsByEvent = groupsByEvent;
void(^ FlutterResult)(id _Nullable result)
FLUTTER_DARWIN_EXPORT NSObject const * FlutterMethodNotImplemented
static NSString *const kSetUndoStateMethod
static NSString *const kCanUndo
static NSString *const kCanRedo
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
id< FlutterUndoManagerDelegate > undoManagerDelegate