Skip to content

Commit

Permalink
fix undo
Browse files Browse the repository at this point in the history
  • Loading branch information
tewe authored and scrod committed Jun 1, 2011
1 parent 5118730 commit 30b451c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions LinkingEditor.m
Expand Up @@ -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]];

Expand Down

0 comments on commit 30b451c

Please sign in to comment.