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 - Community Support Team mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,023
    Answers
    3976
    Vote Rating
    1364
      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
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    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
  •