Open sunneytree opened 4 years ago
请问这个问题您有解决了吗
iam also getting same issue.did you solved this issue??
I'm struggling also with this.What's the fix? Thx! 😉
Solved by change the code in ZSSRichTextEditor.m
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
NSString *query = [navigationAction.request.URL query];
NSString *urlString = [navigationAction.request.URL absoluteString];
// decisionHandler(WKNavigationActionPolicyAllow);
NSLog(@"web request");
NSLog(@"%@", urlString);
NSLog(@"%@", query);
if (navigationAction.navigationType == WKNavigationTypeLinkActivated) {
//On the old UIWebView delegate it returned false Bool here
//TODO: what should we do now?
decisionHandler(WKNavigationActionPolicyCancel);
} else if ([urlString rangeOfString:@"callback://0/"].location != NSNotFound) {
// We recieved the callback
NSString *className = [urlString stringByReplacingOccurrencesOfString:@"callback://0/" withString:@""];
[self updateToolBarWithButtonName:className];
decisionHandler(WKNavigationActionPolicyCancel);
} else if ([urlString rangeOfString:@"debug://"].location != NSNotFound) {
NSLog(@"Debug Found");
// We recieved the callback
NSString *debug = [urlString stringByReplacingOccurrencesOfString:@"debug://" withString:@""];
debug = [debug stringByReplacingPercentEscapesUsingEncoding:NSStringEncodingConversionAllowLossy];
NSLog(@"%@", debug);
} else if ([urlString rangeOfString:@"scroll://"].location != NSNotFound) {
NSInteger position = [[urlString stringByReplacingOccurrencesOfString:@"scroll://" withString:@""] integerValue];
[self editorDidScrollWithPosition:position];
decisionHandler(WKNavigationActionPolicyCancel);
} else {
decisionHandler(WKNavigationActionPolicyAllow);
}
}
Can someone submit a pull request for this?
This solution solved my problem,thank you very much.
Solution working fine. Project Handler can implement this and close this issue.
这个解决方案解决了我的问题,非常感谢。
如何联系你 QQ 10944809 能加我吗 有些问题需请教
Solved by change the code in
ZSSRichTextEditor.m
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler { NSString *query = [navigationAction.request.URL query]; NSString *urlString = [navigationAction.request.URL absoluteString]; // decisionHandler(WKNavigationActionPolicyAllow); NSLog(@"web request"); NSLog(@"%@", urlString); NSLog(@"%@", query); if (navigationAction.navigationType == WKNavigationTypeLinkActivated) { //On the old UIWebView delegate it returned false Bool here //TODO: what should we do now? decisionHandler(WKNavigationActionPolicyCancel); } else if ([urlString rangeOfString:@"callback://0/"].location != NSNotFound) { // We recieved the callback NSString *className = [urlString stringByReplacingOccurrencesOfString:@"callback://0/" withString:@""]; [self updateToolBarWithButtonName:className]; decisionHandler(WKNavigationActionPolicyCancel); } else if ([urlString rangeOfString:@"debug://"].location != NSNotFound) { NSLog(@"Debug Found"); // We recieved the callback NSString *debug = [urlString stringByReplacingOccurrencesOfString:@"debug://" withString:@""]; debug = [debug stringByReplacingPercentEscapesUsingEncoding:NSStringEncodingConversionAllowLossy]; NSLog(@"%@", debug); } else if ([urlString rangeOfString:@"scroll://"].location != NSNotFound) { NSInteger position = [[urlString stringByReplacingOccurrencesOfString:@"scroll://" withString:@""] integerValue]; [self editorDidScrollWithPosition:position]; decisionHandler(WKNavigationActionPolicyCancel); } else { decisionHandler(WKNavigationActionPolicyAllow); } }
get crash
i use insertImage:alt: insert image url like https://stage-fs.lu***Mezx9.jpg . it's can't display . But I'll just write
in the editor HTML and can load it.
how can I solve this problem ?