ZSSRichTextEditor icon indicating copy to clipboard operation
ZSSRichTextEditor copied to clipboard

receiveEditorDidChangeEvents causes massive delay

Open MartinSchultz opened this issue 8 years ago • 4 comments

I've enabled receiveEditorDidChangeEvents = YES so that I get a change event for the text to be able to be able to use a "dirty" flag for the text. Works fine if you don't add any image. But adding an image from the photo roll makes this so slow that after entering a single new character the device hangs for a second or so. (on iOS 10, iPhone 6).

Any idea how to solve this?

Thanks Martin

MartinSchultz avatar Dec 31 '16 01:12 MartinSchultz

@MartinSchultz looks like we need to filter what gets passed when change events happen as images shouldn't need to be passed, if you get this solved then feel free to submit a pull request, if not then I will get working on a fix for this asap.

willptswan avatar Jan 03 '17 22:01 willptswan

I haven't solved it, would love to see a fix from you. 👍

MartinSchultz avatar Jan 04 '17 05:01 MartinSchultz

any update on this issue? @william205

sqsw avatar Jul 31 '17 08:07 sqsw

I solved the problem of extreme delay by eliminating the call to -tidyHTML in -getHTML:

- (void)getHTML:(void (^ _Nullable)(_Nullable id, NSError * _Nullable error))completionHandler {
    
    [self.editorView evaluateJavaScript:ZSSEditorHTML completionHandler:^(NSString *result, NSError *error) {
        
        if (error != NULL) {
            NSLog(@"HTML Parsing Error: %@", error);
        }
        
        NSString *html = [self removeQuotesFromHTML:result];
        
//        [self tidyHTML:html completionHandler:^(NSString *result, NSError *error) {
//            completionHandler(result, error);
//        }];
        completionHandler(result, error);
    }];
}

101airborne avatar Oct 20 '21 13:10 101airborne