[TxMt Plugins] Dialog Plugin: HTMLTip problem
Hans-Joerg Bibiko
bibiko at eva.mpg.de
Mon Sep 24 14:40:05 UTC 2007
On 24 Sep 2007, at 15:10, Hans-Joerg Bibiko wrote:
>
> Hi,
>
> some days ago I downloaded the Ciarán Walsh's code for the new
> HTMLTip.
> I compiled it and I had the problem that:
>
> [webView stringByEvaluatingJavaScriptFromString:@"return
> document.body.offsetHeight + document.body.offsetTop;"];
>
I fixed this for Safari 3.0.3!
Instead of using 'stringByEvaluatingJavaScriptFromString' I use now
'[[webView windowScriptObject] evaluateWebScript]' and it works.
- (void)sizeToContent
{
NSPoint pos = NSMakePoint([[self window] frame].origin.x, [[self
window] frame].origin.y + [[self window] frame].size.height);
// int height = [[webView
stringByEvaluatingJavaScriptFromString:@"return
document.body.offsetHeight + document.body.offsetTop;"] intValue];
// int width = [[webView
stringByEvaluatingJavaScriptFromString:@"return
document.body.offsetWidth + document.body.offsetLeft;"] intValue];
id wsc = [webView windowScriptObject];
int height = [[wsc evaluateWebScript:@"document.body.offsetHeight +
document.body.offsetTop;"] intValue];
int width = [[wsc evaluateWebScript:@"document.body.offsetWidth +
document.body.offsetLeft;"] intValue];
[[self window] setContentSize:NSMakeSize(width, height)];
....
--Hans
More information about the textmate-plugins
mailing list