1. #1
    Ext JS Premium Member
    Join Date
    Dec 2011
    Posts
    203
    Vote Rating
    0
    nicolabaldo is on a distinguished road

      0  

    Default HTMLEditor: convert HTML to text and vice versa

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,656
    Vote Rating
    435
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    You can use RegExp to replace tags.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

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

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha - Community Support Team sword-it's Avatar
    Join Date
    May 2012
    Location
    Istanbul
    Posts
    1,331
    Vote Rating
    76
    sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough sword-it is a jewel in the rough

      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
    203
    Vote Rating
    0
    nicolabaldo is on a distinguished road

      0  

    Default


    Ok thanks!