Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityCommunity Membe...Community Membe...V4.4.1 Text/HTML Module "Fix"V4.4.1 Text/HTML Module "Fix"
Previous
 
Next
New Post
4/8/2007 8:46 AM
 
I know many of you use the WYSIWYG editor on your DNN sites but... call me backward, I actually like the normal text editor best for most of my day to day data input.

That said, it doesn't work like it used to so I "fixed" it.

In DNN V2.0 the text editor defaulted to "BASIC" and if you typed in a bunch of lines then went back in to edit it later the formatting would be preserved.

Starting with something like DNN V3.0 we see that DNN switches the default to "RICH" so I've been switching it back to "BASIC" which was not an issue. But then a funny thing happened - when I go back in to change something it defaults to the HTML view NOT the text view... which drives my crazy.

I had been dealiing with this for about a year or so until I finally "lost it" and decided to figure out what the *&%^ is up with this.

It turned out to be 2 things I needed to tweak to get it to work right.

1) A bad regular expression in htmlutils.vb
2) A bogus TextRenderMode default setting in texteditor.vb

And there may be something more involved (underlying) concerning # 2 (like why doesnt it factor in what mode of basic I am in there) but hey... it now works so I stopped digging.

Here's what I changed - my stuff is bold:

HTMLUtils.vb

The match string used did not work for all variants of the break tag... my new one does but it may not actually be the best regular expression in the world (I am no expert)


Public Shared Function FormatText(ByVal HTML As String, ByVal RetainSpace As Boolean) As String

'Dim brMatch As String = "\s*<\s*[bB][rR]\s*/\s*>\s*"
Dim brMatch As String = "\s*<\s*[bB][rR]\s*[/ ]\s*>|<\s*[bB][rR]\s*>\s*"

'Set up Replacement String
Dim RepString As String
If RetainSpace Then
RepString = " "
Else
RepString = ""
End If

'Replace Tags by replacement String and return mofified string
Return System.Text.RegularExpressions.Regex.Replace(HTML, brMatch, ControlChars.Lf)
End Function


TextEditor.VB

The render mode was default to html but always defaulting to Text in the radio button (this is really the problem to be solved) so I just default it to text to go with the flow and all works nice.



Public Property TextRenderMode() As String
Get
TextRenderMode = CType(Me.ViewState.Item("textrender"), String)
End Get
Set(ByVal Value As String)
Dim strMode As String

strMode = Value.ToUpper.Substring(0, 1)
If strMode <> "R" And strMode <> "H" And strMode <> "T" Then
'strMode = "H"
strMode = "T"
End If

Me.ViewState.Item("textrender") = strMode
End Set
End Property


You can get my compiled V4.4.1 dotnetnuke.dll and texteditor.vb and htmlutils.vb source at http://www.sdcsol.com/ftp/DotNetNuke_4_4_1.zip

One other note: my code (in the download) also defaults the text editor back to basic (back to the stone age) if you dont like that see function "DefaultMode" in texteditor.vb and switch it back.

If you're gonna use the dll directly from the download zip remember to BACKUP your copy of dotnetnuke.dll before you copy this one into your bin directory!

I make no claims that any of this code will work - use at your own risk!
 
New Post
4/9/2007 6:51 AM
 
A couple notes on my "fix" here...

If you have the white-space filter on it breaks it :( This has got to be a regex issue - anyone know off the top of their head how to resolve this?

Also - I changed the regex in htmlutils.vb as follows to handle the all variants of the

tag which is now in my download:

\s*<\s*[bB][rR]\s*/\s*>|<\s*[bB][rR]\s*>|<[Pp]\s*>|<\s*/\s*[Pp]\s*>\s*

 
Previous
 
Next
HomeHomeOur CommunityOur CommunityCommunity Membe...Community Membe...V4.4.1 Text/HTML Module "Fix"V4.4.1 Text/HTML Module "Fix"


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out