html file preview issues - text not wrapping etc.

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

User avatar
jimspoon
Bronze Member
Bronze Member
Posts: 161
Joined: 2002 Aug 22, 00:02

html file preview issues - text not wrapping etc.

Post by jimspoon »

Text in an HTML file is not wrapping in the Quick Preview pane either in Native or Draft view, though it does wrap properly when I load the html file in a browser. Below is an example (actually created by the Thunderbird ImportExportTools extension in exporting an email to an HTML file). The same thing happens in Directory Opus. In Windows File Explorer, nothing is displayed in its preview pane. So it's not unique to xplorer2, but I do wonder why it wraps properly in Chrome when I resize the Chrome window, but doesn't wrap in the xplorer2 preview pane.

Code: Select all

<!DOCTYPE html>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>SMS with Tom</title>
<link rel="important stylesheet" href="">
<style>div.headerdisplayname {font-weight:bold;}
</style></head>
<body>
<table border=0 cellspacing=0 cellpadding=0 width="100%" class="moz-header-part1 moz-main-header"><tr><td><div class="moz-header-display-name" style="display:inline;">Subject: </div>SMS with Tom</td></tr><tr><td><div class="moz-header-display-name" style="display:inline;">From: </div>jim@gmail.com</td></tr><tr><td><div class="moz-header-display-name" style="display:inline;">Date: </div>2024.07.13, 14.29.56</td></tr></table><table border=0 cellspacing=0 cellpadding=0 width="100%" class="moz-header-part2 moz-main-header"><tr><td><div class="moz-header-display-name" style="display:inline;">To: </div>Tom &lt;tom@gmail.com&gt;</td></tr></table><br>
<div class="moz-text-plain" wrap=true graphical-quote=false style="font-family: -moz-fixed; font-size: 14px;" lang="x-unicode"><pre wrap class="moz-quote-pre">
When Double Indemnity was released, David O. Selznick's was promoting Since You Went Away with trade magazine ads that claimed its title had become "the four most important words uttered in motion picture history since Gone with the Wind." Wilder riposted with an ad of his own claiming Double Indemnity were the two most important words uttered in motion picture history since Broken Blossoms. Selznick was not amused and threatened to stop advertising in any of the trades if they continued to run Wilder's ads. ... Alfred Hitchcock wrote to Wilder saying, "Since Double Indemnity, the two most important words in motion pictures are 'Billy' and 'Wilder'."

</pre></div></body>
</html>
</table></div>
Maybe it's controlled by the associated preview handler? I ran PreviewConfig.exe and it shows me the following info for the .html extension:

Code: Select all

Preview Handler information:
GUID        : {f8b8412b-dea3-4130-b36c-5e8be73106ac}
Description : CLSID_PreviewHtml
Module name : C:\Windows\System32\inetcomm.dll
Localserver :
Note: Preview Handler is registered on the ProgID (htmlfile)


another thing - unlike File Explorer / xplorer2 / Directory Opus, my Voidtools Everything preview pane was showing a "source code" type preview for HTML files. Later I learned that this was caused by Microsoft Powertoys. In Powertoys Settings > File Explorer Add-Ons > Preview Pane > Source Code files (Monaco), when I changed this setting from On to Off, Everything went immediately back to the standard HTML preview. And like xplorer2 and Directory Opus, the text was not wrapped as in Chrome browser. Now I'm wondering why the Powertoys Monaco previewer was activated in Everything but not xplorer2 / File Manager / Directory Opus!

Finally there is an issue that has annoyed me forever in File Explorer and I get the same thing in Everything - If I try to view a local HTML file that has an <IMG> tag linking to a local image file, the preview pane displays the message "Some pictures have been blocked to help prevent the sender from identifying your computer. Open this item to view the pictures." Somehow this does not happen in xplorer2, the image is acutally displayed in the preview pane, and I thank you for that. However the images can be too big to display in the preview pane, so that I have to use the scroll bar. If you could scale such images to fit in the preview pane, that would be great.
User avatar
nikos
Site Admin
Site Admin
Posts: 16344
Joined: 2002 Feb 07, 15:57
Location: UK

Re: html file preview issues - text not wrapping etc.

Post by nikos »

html wordwrap works for me both in draft and native mode. For draft right click on the preview and make sure word wrap is ticked from the menu

i am not aware of this monaco plugin but if it works at all it will be in NATIVE preview mode. If it doesn't it could be a 32/64 bit mismatch with your xplorer2
User avatar
jimspoon
Bronze Member
Bronze Member
Posts: 161
Joined: 2002 Aug 22, 00:02

Re: html file preview issues - text not wrapping etc.

Post by jimspoon »

I wondered if it was something in the HTML code I included in the code block in my original post. I saw this tag: <pre wrap class="moz-quote-pre"></pre> and thought it might be the problem. Sure enough when I removed it and then loaded the HTML file in xplorer2, the text wraps properly in the xplorer2 preview pane, and the wrapping changes according to the width of the preview pane. But even with this tag in the file, it wraps properly in Chrome, Firefox, and Edge - but not in the xplorer2, or Windows File Explorer preview pane. Next I loaded the page in Edge using in "Internet Explorer mode" - and sure enough, the text in the code that I pasted in my original message no longer wrapped. (I had to use "internet explorer mode" rather than running Internet Explorer itself, because when I try to run IE itself, Edge loads instead.) It seems that that <pre> tag prevents proper wrapping in Internet Explorer, but not the more up-to-date browsers. So I am guessing that the HTML Preview Handler used by xplorer2 / Windows File Explorer is still using IE code?

I searched for a different preview handler to associate with HTML files but I haven't found one to try out, other than the Powertoys Monaco previewer which shows the HTML as code, which is not what I want.

The Windows Powertoys "Monaco" preview add-on for HTML and other code files is described here:
https://learn.microsoft.com/en-us/windo ... e-explorer
I don't know how it works, but it causes an HTML code to be shown in the preview pane instead of a rendered web page.

On that same page you will see that the Powertoys File Explorer Add-On also includes a PDF previewer. I turned it on to try it out. I could tell that it was working because the preview looked a bit different when I had the Powertoys PDF previewer activated.
User avatar
nikos
Site Admin
Site Admin
Posts: 16344
Joined: 2002 Feb 07, 15:57
Location: UK

Re: html file preview issues - text not wrapping etc.

Post by nikos »

it must be this monaco because xplorer2 uses IE for html preview
User avatar
jimspoon
Bronze Member
Bronze Member
Posts: 161
Joined: 2002 Aug 22, 00:02

Re: html file preview issues - text not wrapping etc.

Post by jimspoon »

It's the IE previewer that doesn't wrap properly when it encounters the <pre> tag. Chrome, Firefox, Edge all wrap properly when the <pre> tag is there, but IE does not. Monaco shows HTML as "source code", not as a rendered web page, and I had it turned off. If there were a way to use Chrome/Firefox/Edge in the xplorer2 or the Windows File Explorer preview pane, I'd give that a try!
hajubu
Member
Member
Posts: 20
Joined: 2016 Aug 25, 06:40

Re: html file preview issues - text not wrapping etc.

Post by hajubu »

Hi Jim, Hi Nikos
@jimspoon::You are right! - IMHO - this behaviour is different form the rendering in the Browser.

" But even with this tag in the file, it wraps properly in Chrome, Firefox, and Edge - but not in the xplorer2, or Windows File Explorer preview pane. "

I found some notes for the "not-wrapping" situation in Explorer ( Win10,Win11) and the xplorer-2 preview ,
which both seems to be internally based on the old principles of the "old" IE style rules and not following the newer Chrome, Chromium, Firefox , etc ., which are rendering the text as wanted with wrap=true.

Taking your sample and added in the <pre>- element an additional element for the IE word-warp :: <pre wrap class="moz-quote-pre" style=word-wrap: break-word > will help as well as in the windows explorer preview (powertoys / Explorer Add-on :: monaco = OFF) , as well in the xplorer2 preview.

Fore more details you may have a look into following CSS style hints :
// <style>
// pre {
// white-space: pre-wrap; /* Since CSS 2.1 */
// white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
// white-space: -pre-wrap; /* Opera 4-6 */
// white-space: -o-pre-wrap; /* Opera 7 */

// word-wrap: break-word; /* Internet Explorer 5.5+ */

// // or use style=word-wrap: break-word as inline element - see below --> in
// // <pre wrap class="moz-quote-pre" style=word-wrap: break-word >
// // ref to -->
// // https://stackoverflow.com/questions/248 ... -a-pre-tag
// // https://developer.mozilla.org/en-US/doc ... aking_text
// }
// </style>

Hope that helps a little
b.r. Hans

P.S: If you like , use the plugins from " https://totalcmd.net/plugring/CodeViewer.html " , which can adapted to your options with right-click.
For installing TC-Plugins , please refer to Nikos Blog " https://www.zabkat.com/blog/tc-plugins.htm "
User avatar
jimspoon
Bronze Member
Bronze Member
Posts: 161
Joined: 2002 Aug 22, 00:02

Re: html file preview issues - text not wrapping etc.

Post by jimspoon »

Thanks Hans, I am presently studying CSS to re-learn how it works - in this case what the <pre> tag does, what the "wrap" and "class="moz-quote-pre" attributes do, and how the <style> tag affects what happens. The sample code HTML I included in the original post was generated by Thunderbird's ImportExportTools extension, in the course of converting emails to HTML; maybe I can figure out how to edit its results to produce proper wrapping in the preview panes. Thanks also for reminding me about TC plugins - maybe I'll find one to do what I want.