Insert break problem

Last post 10-19-2004, 11:34 AM by pnmcosta. 6 replies.
Sort Posts: Previous Next
  •  10-11-2004, 11:21 AM 2042

    Insert break problem

    Hi,

     
    I'm having a bit of a problem with CE, i have breakmode as paragraph but when i press enter on the Normal mode it is adding a paragraph with a space inside and for a reason unknown to me my browser IE 6 is rendering a  Â  character, this also appens with special symbols like the registered ®
     
    does anyone experienced this problem before?
     
    any suggestions?
  •  10-11-2004, 11:08 PM 2048 in reply to 2042

    Re: Insert break problem

     
    This problem had something to do with wrong encodings which makes   coming out as Â.
     
    Is the site online so can you provide its URL? 

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  10-12-2004, 9:16 AM 2051 in reply to 2048

    Re: Insert break problem

    Adam,

     
    I'm sorry but i can't provide any online link to it because it is still in development,
     
    i can just tell you that what i'm doing is direct edition on the page, for example the page default.aspx, i open the editable region pass it to the CE, change and then save the file with the new changes..
     
    is it possible to force the paragraph to be without space, or do u reckon it is better to change browser or page settings?
     
    what i eventually could do is send u a zip file with an output and the Web Custom Control that i created to use CE.
     
     
    Speak Soon,
  •  10-12-2004, 11:08 AM 2054 in reply to 2051

    Re: Insert break problem

  •  10-13-2004, 11:03 AM 2063 in reply to 2054

    Re: Insert break problem

    This is my CE Web Custom Control

     
    Code Behind :
     

        Public Class HTMLEditor
            Inherits System.Web.UI.UserControl


    #Region " Web Form Designer Generated Code "

            'This call is required by the Web Form Designer.
            <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

            End Sub

            'NOTE: The following placeholder declaration is required by the Web Form Designer.
            'Do not delete or move it.
            Private designerPlaceholderDeclaration As System.Object
            Protected WithEvents pageEditing As System.Web.UI.WebControls.Literal
            Protected WithEvents lnkSave As System.Web.UI.WebControls.LinkButton
            Protected WithEvents lnkClose As System.Web.UI.WebControls.LinkButton
            Protected WithEvents txtPagePath As System.Web.UI.WebControls.Label
            Protected WithEvents txtPage As System.Web.UI.WebControls.Label
            Protected WithEvents Editor1 As CuteEditor.Editor

            Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
                'CODEGEN: This method call is required by the Web Form Designer
                'Do not modify it using the code editor.
                InitializeComponent()
            End Sub

    #End Region

            Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
                If Not Page.IsPostBack Then
                    GetPageHTML()
                End If
                BindEditor()
            End Sub
            WriteOnly Property editpage() As String
                Set(ByVal Value As String)
                    pageEditing.Text = Value
                    txtPagePath.Text = Server.MapPath(Value)
                    txtPage.Text = GetFileContents(txtPagePath.Text)
                End Set
            End Property
            Function GetPageHTML() As String
                Dim InS As Integer = txtPage.Text.IndexOf("<!--EDITABLE-->") + 15
                Dim tmpHTML As String = txtPage.Text.Substring(InS)
                Dim FiS As Integer = tmpHTML.IndexOf("<!--ENDEDITABLE-->")
                tmpHTML = tmpHTML.Substring(0, FiS)
                Editor1.Text = tmpHTML
            End Function
            Function BindEditor()
                Editor1.FilesPath = Global.GetApplicationPath(Request) & "/CuteEditor_Files"
                Editor1.DisableItemList = "New, Delete, Help, Save"
                Editor1.ShowHtmlMode = False
                Editor1.CssClass = Global.GetApplicationPath(Request) & "/style/mserv1.css"
                Editor1.breakMode = CuteEditor.BreakMode.UseParagrapOnCarriage
            End Function
            Function SetPageHTML(ByVal html As String)
                Dim InS As Integer = txtPage.Text.IndexOf("<!--EDITABLE-->") + 15
                Dim Top As String = txtPage.Text.Substring(0, InS)
                Dim Bottom As String = txtPage.Text.Substring(InS)
                Dim FiS As Integer = Bottom.IndexOf("<!--ENDEDITABLE-->")
                Bottom = Bottom.Substring(FiS)
                txtPage.Text = Top & html & Bottom
                SaveTextToFile(txtPage.Text, txtPagePath.Text)
                Page.RegisterStartupScript("ScriptSave", "<script language='javascript'>retLogout = confirm('Changes Saved\n\rDo you wish to close this window?');if(retLogout) parent.CloseWindow(); </script>")
            End Function
            Private Function GetFileContents(ByVal FullPath As String, _
           Optional ByRef ErrInfo As String = "") As String

                Dim strContents As String
                Dim objReader As StreamReader
                Try
                    objReader = New StreamReader(FullPath)
                    strContents = objReader.ReadToEnd()
                    objReader.Close()
                    Return strContents
                Catch Ex As Exception
                    ErrInfo = Ex.Message
                End Try
            End Function

            Private Function SaveTextToFile(ByVal strData As String, _
             ByVal FullPath As String, _
               Optional ByVal ErrInfo As String = "") As Boolean

                Dim Contents As String
                Dim bAns As Boolean = False
                Dim objReader As StreamWriter
                Try
                    objReader = New StreamWriter(FullPath)
                    objReader.Write(strData)
                    objReader.Close()
                    bAns = True
                Catch Ex As Exception
                    ErrInfo = Ex.Message
                End Try
                Return bAns
            End Function

            Private Sub lnkSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkSave.Click
                SetPageHTML(Editor1.XHTML)
            End Sub

            Private Sub lnkClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkClose.Click
                Dim CloseWindow As String = "<script language=""javascript"">parent.CloseWindow()</script>"
                Page.RegisterStartupScript("CloseWindow", CloseWindow)
            End Sub
        End Class

     
    Fore Code :
     
    <table cellSpacing="0" cellPadding="0" width="100%" align="center">
     <tr>
      <td><h5><font color="#aaaaaa">Currently editing page
         <asp:Literal ID="pageEditing" Runat="server"></asp:Literal></font></h5>
      </td>
     </tr>
     <tr>
      <td align="center"><CE:EDITOR id="Editor1" runat="server" EnableFancyDropDownMenu="true"
        ShowLogo="False" ShowBottomBar="True" Width="780px" ></CE:EDITOR></td>
     </tr>
     <tr>
      <td align="center" class="content"><BR>
       <asp:LinkButton id="lnkSave" runat="server">Save Changes</asp:LinkButton>&nbsp;¦&nbsp;
       <asp:LinkButton id="lnkClose" runat="server">Close Window</asp:LinkButton>
       <asp:label id="txtPage" runat="server" Visible="False"></asp:label>
       <asp:label id="txtPagePath" runat="server" Visible="False"></asp:label></td>
     </tr>
    </table>
    What i then do is load the control setting the property  editpage to the absolute path of the page.
    it will open the code inside the tags <!--EDITABLE--><!--ENDEDITABLE--> to edit.
     
    Thats it..
     
    whenever i save it, it shows the A's when it should be paragraphs.
     
    Regards,
     
  •  10-19-2004, 9:57 AM 2131 in reply to 2063

    Re: Insert break problem

    At least i could find a solution to one of the problems, i'm using <div> on pressing return.
     
    but i still have the problem with special symbols like ® on rendering the page is adding  before the symbol
     
    Could someone please help me on this, i can't find a solution to this problem.
     
     
    Please...
  •  10-19-2004, 11:34 AM 2137 in reply to 2131

    Re: Insert break problem

    ok, i've put a patch on it...

     
    i've noticed that when returning the code from the editor the special symbols come like a symbol instead of the HTML code representing them i.e. (&amp;) what i've done is replace the symbol by it's HTML code.
     
    Something you might think usefull to had on the next version.
     
     
     
View as RSS news feed in XML