• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to disable NSTextView's HTML rendering?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to disable NSTextView's HTML rendering?


  • Subject: Re: How to disable NSTextView's HTML rendering?
  • From: Douglas Davidson <email@hidden>
  • Date: Sat, 8 Jan 2005 13:32:07 -0800


On Jan 8, 2005, at 12:58 PM, John C. Daub wrote:


We do think that the HTML rendering is nifty and would like to keep it
around as it's a lot more meaningful for our needs (previewing). However, we
don't need side-effects like network connections being initiated. Is there
any way to disable this and keep this from happening (the network
connection)? I didn't see anything in docs nor mailing list archives nor
Google, but I may not have chosen the proper keywords. ;-)

If you are specifying that the text system should use WebKit for HTML importing, then you can specify a "WebResourceLoadDelegate" in your document options. See <AppKit/NSAttributedString.h> and the release notes for more information, and take a look at the WebKit documentation for WebResourceLoadDelegate. If you're not using WebKit, this should not be a problem anyway.



I don't know how NSTextView determines "this file is an HTML file" and thus
displays the file contents as rendered HTML instead of raw file contents.
But I'm wondering if there's a way to disable this or override it, so you
feed it a .html file and it just shows the raw HTML? I mean, I know I could
always read the file into an NSString instead of an NSAttributedString and
that would take care of it, but that would affect all files read in, and I'd
still like SimpleText files to render with their styles. So if the network
issue cannot be directly addressed, if there was some way to tell NSText to
not render HTML and instead just show the raw file contents, that'd work
too.

If you don't specify the document type, then the text system will attempt to determine it from the extension and contents of the file, and any other information available (such as HFS file type). If you don't want this, you can determine the type yourself and specify it. Unfortunately, I can't give you a precise specification for the text system's determination of file type; it is a best-effort mechanism that may change from release to release. However, roughly speaking, HTML is detected in a file's contents by looking at the first non-whitespace characters of the file for portions of certain HTML elements (e.g. <html, <!doctype html, <head, <title), or <?xml followed by an HTML doctype.


Douglas Davidson

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >How to disable NSTextView's HTML rendering? (From: "John C. Daub" <email@hidden>)

  • Prev by Date: Re: Variadic arguments to methods in Objective-C - How ?
  • Next by Date: Re: mouseExited: acts very unreliably?
  • Previous by thread: How to disable NSTextView's HTML rendering?
  • Next by thread: [OT] Library for sound manipulation
  • Index(es):
    • Date
    • Thread