Your comments

I'll have a look. I'm already investigating Markdown support but that will probably require writing a different syntax highlighter.
Textastic now creates a file "file.php$$preview.html" so that the UIWebView interprets the file as html. It is deleted after the preview is loaded.

I tried various other ways to change the MIME type to "text/html", but then other things didn't work.

So the simple (but not so elegant) solution worked best.
As an alternative, this wouldn't happen when this features is implemented:

The width of the text would always be less than (or equal to) the view width of the editor and so it wouldn't scroll sideways.
Ah, ok, now I see what you mean.

I just had a look at the UIScrollView documentation. There is a property named "directionalLockEnabled":
"If this property is YES and the user begins dragging in one general direction (horizontally or vertically), the scroll view disables scrolling in the other direction. If the drag direction is diagonal, then scrolling will not be locked and the user can drag in any direction until the drag completes. The default value is NO"

I guess setting this to YES this would solve your issue, right? I'll test it and probably enable it for the next version.
Unfortunately, this is not possible on iOS. All fonts have to be registered in the Info.plist file of an app and this can't be changed once the app is on the App Store.