Browse Source

综合-页面范围报错问题(还需设计补充token)

tangchao 1 year ago
parent
commit
9281c274ff

+ 16 - 0
PDF Office/PDF Master.xcodeproj/xcuserdata/kdanmobile.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -228,5 +228,21 @@
             landmarkType = "7">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            uuid = "78CFDBB9-CB4F-4A83-A7F9-393F3E6BB727"
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "PDF Master/Class/ComponentLibrary/Category/KMDesignToken+Action.swift"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "671"
+            endingLineNumber = "671"
+            landmarkName = "selectDesignToken(bgToken:textToken:textbgToken:heightConstraint:control:state:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 3 - 0
PDF Office/PDF Master/Class/Merge/OCPart/KMFileAttribute.h

@@ -35,4 +35,7 @@ typedef NS_OPTIONS(NSUInteger, KMPDFSelectPageStringType) {
 @property (nonatomic) BOOL isLocked;
 @property (nonatomic,retain) NSString *password;
 @property (nonatomic,assign) KMPDFSelectPageStringType pagesType;
+
+@property (nonatomic, assign) BOOL pageRangeError;
+
 @end

+ 30 - 1
PDF Office/PDF Master/Class/Merge/OCPart/KMPDFEditAppendWindow.m

@@ -811,6 +811,9 @@ static KMPDFEditAppendWindow *windowController = nil;
         cell.layer.backgroundColor = [NSColor clearColor].CGColor;
         cell.pageCount = pdf.pageCount;
         [cell updatePageRange:fileAttribute.pagesType pageStrings:fileAttribute.pagesString];
+//        if (fileAttribute.pageRangeError) {
+//            [cell updateRageRangeState:10];
+//        }
         
         __weak typeof(self) weakSelf = self;
         cell.callback = ^(NSInteger index) {
@@ -821,8 +824,34 @@ static KMPDFEditAppendWindow *windowController = nil;
                 return;
             }
             
-            [[weakSelf.files objectAtIndex:row] setPagesString:string];
+            KMFileAttribute *file = [weakSelf.files objectAtIndex:row];
+            [file setPagesString:string];
+//            file.pageRangeError = NO;
+//            dispatch_async(dispatch_get_main_queue(), ^{
+//                [weakSelf.tableView reloadData];
+//            });
+            
         };
+//        cell.textDidEndEdit = ^(NSString * _Nonnull string) {
+//            if (row >= weakSelf.files.count) {
+//                return;
+//            }
+//
+//            KMFileAttribute *file = [weakSelf.files objectAtIndex:row];
+//            if (!file.selectPages) {
+//                file.pageRangeError = YES;
+//                dispatch_async(dispatch_get_main_queue(), ^{
+//                    [weakSelf.tableView reloadData];
+//                    NSAlert *alert = [[NSAlert alloc] init];
+//                    [alert setAlertStyle:NSAlertStyleCritical];
+//                    [alert setMessageText:[NSString stringWithFormat:@"%@ %@",[file.filePath lastPathComponent],NSLocalizedString(@"Invalid page range or the page number is out of range. Please try again.", nil)]];
+//                    [alert runModal];
+//
+//                    file.pagesString = @"";
+//                    [weakSelf.tableView reloadData];
+//                });
+//            }
+//        };
         
         return cell;
     }

+ 2 - 0
PDF Office/PDF Master/Class/Merge/OCPart/KMPDFMergeFileNameTabelViewCell.h

@@ -25,8 +25,10 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, copy) void(^callback)(NSInteger index);
 @property (nonatomic, copy) void(^textDidChange)(NSString *string);
+@property (nonatomic, copy) void(^textDidEndEdit)(NSString *string);
 
 - (void)updatePageRange:(KMPDFSelectPageStringType)pageRange pageStrings:(NSString *)pageStrings;
+- (void)updateRageRangeState:(NSInteger)state;
 
 @end
 

+ 11 - 1
PDF Office/PDF Master/Class/Merge/OCPart/KMPDFMergeFileNameTabelViewCell.m

@@ -135,6 +135,14 @@
     }
 }
 
+- (void)updateRageRangeState:(NSInteger)state {
+    if (state == 9) {
+        self.comboBox.state = KMDesignTokenStateError_def;
+    } else if (state == 10) {
+        self.comboBox.state = KMDesignTokenStateError_focus;
+    }
+}
+
 - (void)layout {
     [super layout];
     
@@ -176,7 +184,9 @@
 }
 
 - (void)km_controlTextDidEndEditing:(KMDesignSelect *)obj {
-    
+    if (self.textDidEndEdit) {
+        self.textDidEndEdit(obj.stringValue);
+    }
 }
 
 - (void)km_SelectPopoverWillShow:(KMDesignSelect *)obj {