Bug and Fix - The preview button on the HTML\Text editor does not work

Last post 07-13-2005 10:04 PM by robaxx. 8 replies.

Sort Posts:

  • Bug and Fix - The preview button on the HTML\Text editor does not work

    06-07-2004, 1:34 AM
    • Contributor
      4,075 point Contributor
    • bertcord
    • Member since 10-24-2002, 2:36 PM
    • Posts 813
    I have posted in ardvark - issue 518 - The rich text editor stores the HTML text as Encodeed HTML. The preview button code html encodes the data again and causes the preview function to not work.
    Fix - EditHtml.ascx.vb Replace 144-147 with the following.

    'strDesktopHTML = Server.HtmlEncode(TextEditor1.Text)
    'lblPreview.Text = ManageUploadDirectory(Server.HtmlDecode(strDesktopHTML), PortalSettings.UploadDirectory)


    Bert
  • Re: Bug and Fix - The preview button on the HTML\Text editor does not work

    06-07-2004, 2:01 AM
    • Member
      485 point Member
    • BlueFrog
    • Member since 11-08-2003, 4:26 AM
    • Seoul, Korea
    • Posts 97
  • Re: Bug and Fix - The preview button on the HTML\Text editor does not work

    06-07-2004, 3:33 AM
    • Star
      10,052 point Star
    • Geert
    • Member since 06-18-2002, 11:43 AM
    • The Netherlands
    • Posts 2,011
    Bert,

    I believe this has been fixed already by Shane

    strDesktopHTML = TextEditor1.Text

    http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=594733#594741
    Geert Veenstra
  • Re: Bug and Fix - The preview button on the HTML\Text editor does not work

    06-07-2004, 7:14 AM
    • Contributor
      4,075 point Contributor
    • bertcord
    • Member since 10-24-2002, 2:36 PM
    • Posts 813
    http://support.dotnetnuke.com/logon.asp login is guest\guest

    Geert: strDesktopHTML = TextEditor1.Text doesnt work for me....unless I am doing something else worng.

    bert


  • Re: Bug and Fix - The preview button on the HTML\Text editor does not work

    06-07-2004, 9:38 AM
    • Contributor
      2,568 point Contributor
    • otherones
    • Member since 09-26-2002, 1:19 PM
    • Posts 509
    There is a second part to the fix that I just realized.

    strDesktopHTML = TextEditor1.Text in EditHtml.aspx.vb is the correct code, because <dnn:texteditor> has a property 'HTMLEncode=True/False' that should handle the Encoding instead of making the mod dev handle it (if they want to handle it, they HTMLEncode=False (it defaults True).

    However there was a bug in TextEditor.ascx.vb that was only Encoding when in RichText mode... the fixes:

    TextEditor.ascx.vb - LINE 87 - 108
    *****************

    Public Property Text() As String
    Get
    If optView.SelectedItem.Value = "B" Then
    If optRender.SelectedItem.Value = "T" Then
    Text = Encode(FormatHtml(txtDesktopHTML.Text))
    Else
    Text = Encode(txtDesktopHTML.Text)
    End If
    Else
    Text = Encode(RichText.Text)
    End If
    End Get
    Set(ByVal Value As String)
    If Value <> "" Then
    txtDesktopHTML.Text = Decode(FormatText(Value))
    RichText.Text = Decode(Value)
    Else
    RichText.Text = "Add Content..."
    txtDesktopHTML.Text = "Add Content..."
    End If
    End Set
    End Property



    EditHTML.ascx.vb - LINE 144-147 should look like
    *****************

    strDesktopHTML = TextEditor1.Text

    lblPreview.Text = ManageUploadDirectory(Server.HtmlDecode(strDesktopHTML), PortalSettings.UploadDirectory)

    -Shane
  • Re: Bug and Fix - The preview button on the HTML\Text editor does not work

    06-07-2004, 10:00 AM
    • Contributor
      4,075 point Contributor
    • bertcord
    • Member since 10-24-2002, 2:36 PM
    • Posts 813
    Thanks Shane

    I have a couple of other questiosn about the HTML provider.

    1. any thoughts on the ManageUploadDirectory function.

    I have posted this in ardvark - issue 519

    I came across this when creating a HTML provider for the telerik control.

    Images appear fine in Edit and preview but show up as a red x in view mode
    Bug Description – The telerik editor adds images with relative links and will automatically add the portal directory when adding images. For example <IMG src="Portals/0/approved_508.gif" border=0> The ManageUploadDirectory function on HtmlModule.ascx.vb causes this. This function parses the HTML data and examines all tags that have a src attribute. If the path does not start with a “/” the function adds the portal upload directory path to any tags. Since the telerik tags do not have a leading “/” the portal upload path is re-added. This fix will need to be addressed if the telerik editor is used to select files from a folder other than the portals upload directory.
    Fix – Edit the ManageUploadDirectory functions also check if the upload path is part of the image path, if so skip it. Line 107 of HtmlModule.ascx.vb

    'If InStr(1, strSRC, "://") = 0 And Left(strSRC, 1) <> "/" Then
    If InStr(1, strSRC, "://") = 0 And Left(strSRC, 1) <> "/" And strSRC.IndexOf(strUploadDirectory.Substring(strUploadDirectory.IndexOf("Portals/"))) = -1 Then

    2. Access the containing module control. I currently use the following code

    Dim modulecontrol As PortalModuleControl = FindControlRecursive(Me.HtmlEditorControl, "ModuleContent").Controls(0)

    Is this the correct way to do this?

    Bert




    bert
  • Re: Bug and Fix - The preview button on the HTML\Text editor does not work

    06-15-2004, 3:49 PM
    • Participant
      1,335 point Participant
    • nitro001
    • Member since 07-28-2003, 11:32 AM
    • Kent, OH
    • Posts 267
    All,

    I upgraded to 2.1.2 this morning and I am receiving the following error when trying to edit data in the HTML\Text module, I saw this thread and tried the changes thinking maybe they weren't in 2.1.2 but I still get this result:

    Server Error in '/DotNetNuke' Application.
    --------------------------------------------------------------------------------

    Object reference not set to an instance of an object.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:


    Line 115: txtDesktopHTML.Text = Decode(FormatText(Value))
    Line 116:
    Line 117: RichText.Text = Decode(Value)
    Line 118:
    Line 119: Else


    Source File: C:\Inetpub\DotNetNuke_2.0\controls\TextEditor.ascx.vb Line: 117

    Is anyone else getting this and has anyone come up with a solution?

    Thanks,
    Nathan

    ntruhan@kent.edu
  • Re: Bug and Fix - The preview button on the HTML\Text editor does not work

    06-15-2004, 4:06 PM
    • Contributor
      4,075 point Contributor
    • bertcord
    • Member since 10-24-2002, 2:36 PM
    • Posts 813
    I have a fresh install of 2.1.2 and can not reproduce... Are you sure you copied all of the new files to your server?
    Bert
  • Re: Bug and Fix - The preview button on the HTML\Text editor does not work

    07-13-2005, 10:04 PM
    • Participant
      1,415 point Participant
    • robaxx
    • Member since 09-04-2004, 5:14 PM
    • New Zealand
    • Posts 283
     bertcord wrote:
    I came across this when creating a HTML provider for the telerik control. Images appear fine in Edit and preview but show up as a red x in view mode


    Hi all, the above year-old post is the nearest one that the forum search engine gave me regarding today's DNN issue. It is not entirely accurate, but is probably the same issue. Essentially, images inserted into the editor appear as red X's when Preview at the bottom of the editing page is clicked. Upon examining the code, I can see a double-slash '//' in the image path.

    Does anyone know if there is a fix or workaround for this?  3.1 still has the problem described.

    I've gone looking for it on that DNN bug site, but there's nothing about it there under what I'd assume was the relevant section; editor. Perhaps it's somewhere else?

    Thanks for any info on this one,
    Rob

Page 1 of 1 (9 items)