Results 1 to 2 of 2

Thread: HtmlEditor replace <br> with <br/>

  1. #1
    Ext JS Premium Member
    Join Date
    Jan 2011
    Posts
    52
    Answers
    1
    Vote Rating
    0
      0  

    Default HtmlEditor replace <br> with <br/>

    When a newline is created in the HtmlEditor field, it is done by wrapping a <br> inside a div block. Due to a backend component requirement, I need to ensure the <br> is closed (i.e. insert <br/> instead). Unfortunately I can't post-process the field on the server to achieve this.

    Is there any way I can override the HtmlEditor field's behaviour to insert a <br/> instead of a <br>? Is this even something that HtmlEditor does? Perhaps it's default browser behaviour ... if so, how would I go about handling that? Check for the browser type and capture <enter> events, ... then? :-)

    Thanks in advance!

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      0  

    Default

    We actually don't control the line breaks (unless it's IE). The html that is inserted into the textarea actually comes from a body.innerHTML call which comes directly from the browser. You can see this in the syncValue method of the HtmlEditor.

    To do this yourself, you can override the cleanHtml method and return the new html so you can replace <br> with <br />
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •