Permalink
Browse files

fix problem where size is not transferred to attachment

  • Loading branch information...
1 parent 2f4fc23 commit baecbac9e3640a5b9fa2c4ba510706c1c90d9232 @odrobnik odrobnik committed Dec 30, 2012
Showing with 6 additions and 0 deletions.
  1. +6 −0 Core/Source/DTHTMLElement.m
@@ -849,6 +849,9 @@ - (void)applyStyleDictionary:(NSDictionary *)styles
_size.height = [heightString pixelSizeOfCSSMeasureRelativeToCurrentTextSize:self.fontDescriptor.pointSize textScale:_textScale];
}
+ // if this has an attachment set its size too
+ _textAttachment.displaySize = _size;
+
NSString *whitespaceString = [styles objectForKey:@"white-space"];
if ([whitespaceString hasPrefix:@"pre"])
{
@@ -1160,6 +1163,9 @@ - (void)setTextAttachment:(DTTextAttachment *)textAttachment
// transfer link GUID
_textAttachment.hyperLinkGUID = _linkGUID;
+
+ // transfer size
+ _textAttachment.displaySize = _size;
}
- (void)setLink:(NSURL *)link

3 comments on commit baecbac

Contributor

minorblend commented on baecbac Jan 8, 2013

after this patch, tag MUST have both of height and width attributes. Otherwise attachment's height or width becomes 0. is it intended?

Collaborator

odrobnik replied Jan 8, 2013

@minorblend nope. in DTTextAttachment.m:138 the attachment inspects a local file if width or height are 0.

Contributor

minorblend replied Jan 11, 2013

@Cocoanetics the problem I've mentioned occurrs when tag like has a style. I've made a pull request to fix it. plz, review it. :)

Please sign in to comment.