Skip to content

Commit 8702397

Browse files
buzzertmdznr
authored andcommitted
Fixes issue MacDownApp#1104 (Rendering pane flashing)
For issue MacDownApp#747, a change was introduced that uses private API to disable caching on the preview pane's web view. This was ostensibly to make it so that if images referenced in the markdown document are changed on disk, their changes are reflected in the preview pane. Unfortunately, perhaps due to some underlying changes to WebKit/WebView, disabling caching will also disable caching for all sorts of other things like stylesheets and the base html document loaded from disk. This results in a momentary flash of empty content if one is typing quickly. Reverting the changes for MacDownApp#747 resolves the flashing issue, but does regress the issue regarding images being persistently cached. However, the flashing issue appears to be bothering more people than the image issue, so I believe it would be appropriate to temporarily regress the image caching bug to resolve the flashing bug. Supposedly, a plan exists to migrate to WKWebView, which would hopefully resolve both of these issues simultaneously.
1 parent bcd5f81 commit 8702397

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

MacDown/Code/Application/MPMainController.m

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,6 @@ @implementation MPMainController
102102

103103
- (void)applicationDidFinishLaunching:(NSNotification *)notification
104104
{
105-
// Using private API [WebCache setDisabled:YES] to disable WebView's cache
106-
id webCacheClass = (id)NSClassFromString(@"WebCache");
107-
if (webCacheClass) {
108-
// Ignoring "undeclared selector" warning
109-
#pragma clang diagnostic push
110-
#pragma clang diagnostic ignored "-Wundeclared-selector"
111-
BOOL setDisabledValue = YES;
112-
NSMethodSignature *signature = [webCacheClass methodSignatureForSelector:@selector(setDisabled:)];
113-
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:signature];
114-
invocation.selector = @selector(setDisabled:);
115-
invocation.target = [webCacheClass class];
116-
[invocation setArgument:&setDisabledValue atIndex:2];
117-
[invocation invoke];
118-
#pragma clang diagnostic pop
119-
}
120105
[[NSAppleEventManager sharedAppleEventManager]
121106
setEventHandler:self
122107
andSelector:@selector(openUrlSchemeAppleEvent:withReplyEvent:)

0 commit comments

Comments
 (0)