2025-12-19 19:21:08 +08:00
|
|
|
|
//
|
|
|
|
|
|
// KBBackspaceUndoManager.h
|
|
|
|
|
|
// CustomKeyboard
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
|
|
|
|
extern NSNotificationName const KBBackspaceUndoStateDidChangeNotification;
|
|
|
|
|
|
|
|
|
|
|
|
@interface KBBackspaceUndoManager : NSObject
|
|
|
|
|
|
|
|
|
|
|
|
@property (nonatomic, readonly) BOOL hasUndo;
|
|
|
|
|
|
|
|
|
|
|
|
+ (instancetype)shared;
|
|
|
|
|
|
|
2025-12-23 18:05:01 +08:00
|
|
|
|
/// 记录一次删除前的快照(不改变撤销按钮显示)。
|
|
|
|
|
|
- (void)recordDeletionSnapshotBefore:(NSString *)before after:(NSString *)after;
|
|
|
|
|
|
|
|
|
|
|
|
/// 记录一次“立刻清空”删除的内容(基于 documentContextBeforeInput/AfterInput)。
|
|
|
|
|
|
- (void)recordClearWithContextBefore:(NSString *)before after:(NSString *)after;
|
2025-12-19 19:21:08 +08:00
|
|
|
|
|
|
|
|
|
|
/// 在指定 responder 处执行撤销(向光标处插回删除的内容)
|
|
|
|
|
|
- (void)performUndoFromResponder:(UIResponder *)responder;
|
|
|
|
|
|
|
2025-12-23 18:05:01 +08:00
|
|
|
|
/// 非删除行为触发时,清理撤销状态
|
2025-12-19 19:21:08 +08:00
|
|
|
|
- (void)registerNonClearAction;
|
|
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|