Fixed: <rdar://problem/3778785> REGRESSION (Mail): copying from MS word and pasting...
authorcblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Sep 2004 23:12:27 +0000 (23:12 +0000)
committercblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Sep 2004 23:12:27 +0000 (23:12 +0000)
        Reviewed by NOBODY (OOPS!).

        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView _documentFragmentFromPasteboard:allowPlainText:]): ignore Microsoft's header meta data

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7491 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebView.subproj/WebHTMLView.m

index 7c766e62d3f056906632a6e7d9d5a93411f8f6e0..726c15e25d9899f8f3aa90b23a0c37ae31018185 100644 (file)
@@ -1,3 +1,12 @@
+2004-09-08  Chris Blumenberg  <cblu@apple.com>
+
+       Fixed: <rdar://problem/3778785> REGRESSION (Mail): copying from MS word and pasting into editable region leaves internal clipboard data
+
+        Reviewed by NOBODY (OOPS!).
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView _documentFragmentFromPasteboard:allowPlainText:]): ignore Microsoft's header meta data
+
 2004-09-08  Chris Blumenberg  <cblu@apple.com>
 
        Fixed: <rdar://problem/3792893> WebBaseResourceHandleDelegate always returns cached data for subresource loads
index 55b1b208a6853044a5e8886972b8ac1e59429308..7516f3f44e92629f0d74cc724f7bb447a3dc6f5b 100644 (file)
@@ -266,7 +266,17 @@ static BOOL forceRealHitTest = NO;
     NSURL *URL;
     
     if ([types containsObject:NSHTMLPboardType]) {
-        return [[self _bridge] documentFragmentWithMarkupString:[pasteboard stringForType:NSHTMLPboardType] baseURLString:nil];
+        NSString *HTMLString = [pasteboard stringForType:NSHTMLPboardType];
+        // This is a hack to make Microsoft's HTML pasteboard data work. See 3778785.
+        if ([HTMLString hasPrefix:@"Version:"]) {
+            NSRange range = [HTMLString rangeOfString:@"<html" options:NSCaseInsensitiveSearch];
+            if (range.location != NSNotFound) {
+                HTMLString = [HTMLString substringFromIndex:range.location];
+            }
+        }
+        if ([HTMLString length] != 0) {
+            return [[self _bridge] documentFragmentWithMarkupString:HTMLString baseURLString:nil];
+        }
     }
     
     if ([types containsObject:NSTIFFPboardType]) {