Skip to content

Commit

Permalink
Improve drag & drop, copy & paste pasteboard
Browse files Browse the repository at this point in the history
To avoid having default font Times New Roman in Mail.app, I specify
style "font-family:sans-serif" in template.
Remove markup in type string pasteboard items.
  • Loading branch information
barijaona committed Jul 8, 2023
1 parent 9f85685 commit 739392c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Vienna/Sources/Main window/ArticleListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,8 @@ -(BOOL)copyTableSelection:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)
}

// Open the HTML string
[fullHTMLText appendString:@"<html><body>"];
[fullHTMLText appendString:@"<html style=\"font-family:sans-serif;\">"
"<head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"></head><body>"];

// Get all the articles that are being dragged
NSUInteger msgIndex = rowIndexes.firstIndex;
Expand All @@ -1507,10 +1508,11 @@ -(BOOL)copyTableSelection:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)
[arrayOfArticles addObject:articleDict];

// Plain text
[fullPlainText appendFormat:@"%@\n%@\n\n", msgTitle, msgText];
[fullPlainText appendFormat:@"%@\n%@\n\n", msgTitle, thisArticle.summary];

// Add HTML version too.
[fullHTMLText appendFormat:@"<a href=\"%@\">%@</a><br />%@<br /><br />", msgLink, msgTitle, msgText];
[fullHTMLText appendFormat:@"<div class=\"info\"><a href=\"%@\">%@</a><div>"
"<div class=\"articleBodyStyle\">%@</div><br>", msgLink, msgTitle, msgText];

if (count == 1) {
[pboard setString:msgLink forType:NSPasteboardTypeURL];
Expand Down
8 changes: 5 additions & 3 deletions Vienna/Sources/Main window/UnifiedDisplayView.m
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,8 @@ -(BOOL)copyIndexesSelection:(NSIndexSet*)rowIndexes toPasteboard:(NSPasteboard *
}

// Open the HTML string
[fullHTMLText appendString:@"<html><body>"];
[fullHTMLText appendString:@"<html style=\"font-family:sans-serif;\">"
"<head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\"></head><body>"];

// Get all the articles that are being dragged
NSUInteger msgIndex = rowIndexes.firstIndex;
Expand All @@ -628,10 +629,11 @@ -(BOOL)copyIndexesSelection:(NSIndexSet*)rowIndexes toPasteboard:(NSPasteboard *
[arrayOfArticles addObject:articleDict];

// Plain text
[fullPlainText appendFormat:@"%@\n%@\n\n", msgTitle, msgText];
[fullPlainText appendFormat:@"%@\n%@\n\n", msgTitle, thisArticle.summary];

// Add HTML version too.
[fullHTMLText appendFormat:@"<a href=\"%@\">%@</a><br />%@<br /><br />", msgLink, msgTitle, msgText];
[fullHTMLText appendFormat:@"<div class=\"info\"><a href=\"%@\">%@</a><div>"
"<div class=\"articleBodyStyle\">%@</div><br>", msgLink, msgTitle, msgText];

if (count == 1) {
[pboard setString:msgLink forType:NSPasteboardTypeURL];
Expand Down

0 comments on commit 739392c

Please sign in to comment.