Results 1 to 4 of 4

Thread: HTMLEditor: convert HTML to text and vice versa

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    234
    Vote Rating
    2
      0  

    Default HTMLEditor: convert HTML to text and vice versa

    I've got an HTMLEditor and I need:
    1. to save data in text format by setValue() function (without tags HTML and the tag <br> must be converted in #13)

    2. read the text data by getValue() function and transform the text in HTML

    Thanks!

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,026
    Vote Rating
    1367
      0  

    Default

    You can use RegExp to replace tags.
    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

  3. #3
    Sencha User sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,335
    Vote Rating
    91
      0  

    Default

    Hi nicolabaldo,
    you can use regex to replace the html tag like this.

    Ext.util.Format.stripTags(yourhtmleditor.ed.getContent({format: 'raw' }).replace(/<\/?p+>/gi, ' '))

    It will remove all html tag and also replace <p> tag with space.
    sword-it.com, Sencha Developer House in Turkey - Istanbul University Technopark Suite 204.

  4. #4
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    234
    Vote Rating
    2
      0  

    Default

    Ok thanks!

Posting Permissions

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