Condensing HTML white space in the RichTextEditor control in Flex

by Peter deHaan on April 24, 2008

in RichTextEditor, TextArea

In a previous example, “Condensing HTML white space in the TextArea control in Flex”, we looked at how you could condense HTML formatted text in a TextArea control by setting the condenseWhite property.

The following example shows you how you can condense white space around HTML tags using the Flex RichTextEditor control, the htmlText property, and the condenseWhite property.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/04/24/condensing-html-white-space-in-the-richtexteditor-control-in-flex/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Script>
        <![CDATA[
            private function checkBox_change(evt:Event):void {
                richTextEditor.textArea.condenseWhite = checkBox.selected;
            }
        ]]>
    </mx:Script>

    <mx:String id="str" source="lorem.html" />

    <mx:ApplicationControlBar dock="true">
        <mx:Form styleName="plain">
            <mx:FormItem label="condenseWhite:">
                <mx:CheckBox id="checkBox"
                        change="checkBox_change(event);" />
            </mx:FormItem>
        </mx:Form>
    </mx:ApplicationControlBar>

    <mx:RichTextEditor id="richTextEditor"
            htmlText="{str}"
            width="100%"
            height="100%" />

</mx:Application>

View source is enabled in the following example.

{ 7 comments… read them below or add one }

1 Allen April 24, 2008 at 11:09 pm

Hi,Peter
I find there’s only few fontStyle in the comboBox of TextRichEditor,can I have more option? I just mean can I add some new fonts instead of the default ones…?
Thank you!
Sincerely

Reply

2 peterd April 24, 2008 at 11:37 pm
3 Chandrashekhar April 25, 2008 at 12:20 am

Hello,

This is very helpful example related to RichTextEditor …

Developing html editor in flex but when i need to insert image,tables into RichTextEditor it is not supporting for that.

Is there any reference for same? please advise

Thanks….

Chandrashekhar

Reply

4 DeGree April 25, 2008 at 2:30 am

Condense white resets formatting.

Reply

5 Mohd Imran Ahmed June 24, 2008 at 2:57 am

Hey,

You know I was under of stupid problem from last two days.Hey in just a minute u made my work easy.

Thanks for a helpfull topic

Bye

Reply

6 Steve January 29, 2009 at 5:33 pm

Its not sexy but you can manually delete white text and comments.

Reply

7 Devin Columbus February 13, 2009 at 5:56 pm

Hey,

Is there a way to remove formatting from selected text? It’s almost like as soon as you add any formatting, you’re screwed if you want to get rid of that formatting.

Reply

Leave a Comment

Sorry, this blog is terrible at eating HTML comments.
If you're pasting any HTML/XML/MXML code, you need to convert your < characters to &lt; and your > characters to &gt; .

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Anti-Spam Protection by WP-SpamFree

Previous post:

Next post: