Permalink
Browse files

fix undo

  • Loading branch information...
1 parent 5118730 commit 30b451c574dd773ac7682d101cc6a34467ab97ac tewe committed with May 29, 2011
Showing with 8 additions and 8 deletions.
  1. +8 −8 LinkingEditor.m
View
@@ -368,17 +368,17 @@ - (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard type:(NSString *)type
@selector(initWithHTML:documentAttributes:) : @selector(initWithRTF:documentAttributes:)
withObject:[pboard dataForType:type] withObject:nil] autorelease];
if ([newString length]) {
+ if (![type isEqualToString:NVPTFPboardType]) {
+ //remove the link attribute, because it will be re-added after we paste, and restyleText would preserve it otherwise
+ //and we only want real URLs to be linked
+ [newString removeAttribute:NSLinkAttributeName range:NSMakeRange(0, [newString length])];
+ [newString indentTextLists];
+ [newString restyleTextToFont:[prefsController noteBodyFont] usingBaseFont:nil];
+ }
+
NSRange selectedRange = [self rangeForUserTextChange];
if ([self shouldChangeTextInRange:selectedRange replacementString:[newString string]]) {
- if (![type isEqualToString:NVPTFPboardType]) {
- //remove the link attribute, because it will be re-added after we paste, and restyleText would preserve it otherwise
- //and we only want real URLs to be linked
- [newString removeAttribute:NSLinkAttributeName range:NSMakeRange(0, [newString length])];
- [newString indentTextLists];
- [newString restyleTextToFont:[prefsController noteBodyFont] usingBaseFont:nil];
- }
-
[self replaceCharactersInRange:selectedRange withRTF:[newString RTFFromRange:
NSMakeRange(0, [newString length]) documentAttributes:nil]];

0 comments on commit 30b451c

Please sign in to comment.