Packageardisia.components.richTextEditor
Classpublic class RichTextEditor
InheritanceRichTextEditor Inheritance spark.components.supportClasses.SkinnableComponent

Toolbar editor designed to manage the Text Layout Framework ("TLF") for RichEditableText based controls. All supported functions are routed through an EditManager so all functions can be undone/redone.

View the technical documentation on the Ardisia Labs website for more information.

DESIGN NOTES



Public Properties
 PropertyDefined By
  editManager : EditManager
[read-only] EditManager attached to the "target".
RichTextEditor
  enableKeyboardShortcuts : Boolean
True to enable keyboard shortcuts for certain functions when the target has focus.
RichTextEditor
  fontFamilies : Array
Array of font names to list in the fontFamilyPart list.
RichTextEditor
  indentPixels : Number = 48
The number of pixels to increment or decrement the indent for a textline when the relevant buttons are clicked.
RichTextEditor
  selectionHighlighting : String
The "selectionHighlighting" style that will be applied to the target.
RichTextEditor
  target : RichEditableText
The RichEditableText control to edit.
RichTextEditor
  undoManager : UndoManager
[read-only] UndoManager attached to the "target".
RichTextEditor
Public Methods
 MethodDefined By
  
exportAsHTML():Object
Return the target textflow as XML.
RichTextEditor
  
exportAsXML():Object
Return the target textflow as HTML.
RichTextEditor
  
Based on the current SelectionState.
RichTextEditor
Protected Methods
 MethodDefined By
  
autoKernPartHandler(event:Event):void
Handles events for the auto kern button skin part.
RichTextEditor
  
boldBtnPartHandler(event:Event):void
Handles events for the bold button skin part.
RichTextEditor
  
breakLinkBtnPartHandler(event:Event):void
Handles events for the break link skin part.
RichTextEditor
  
Change the indent after paragraphs.
RichTextEditor
  
Changes the kerning for the selected text.
RichTextEditor
  
Change the indent before a paragraph.
RichTextEditor
  
Change the color for the selected text.
RichTextEditor
  
changeFont():void
Change the font for the selected text.
RichTextEditor
  
Change the font for the selected text.
RichTextEditor
  
Change the font weight for the selected text.
RichTextEditor
  
changeIndent(increment:Boolean = true):void
Changes the textline indent.
RichTextEditor
  
Change the italic state for the selected text.
RichTextEditor
  
Changes the letter spacing for the selected text.
RichTextEditor
  
Changes the line height for the selected text.
RichTextEditor
  
changeLink(createLink:Boolean):void
Changes the hyperlinks applied to the selected text.
RichTextEditor
  
changeList(type:String):void
Add/remove lists.
RichTextEditor
  
Change the paragraph indent.
RichTextEditor
  
Change the strikethrough state for the selected text.
RichTextEditor
  
changeTextAlignment(alignment:String = null):void
Change the text alignment state for the selected text.
RichTextEditor
  
Change the underline state for the selected text.
RichTextEditor
  
clearBtnPartHandler(event:Event):void
Handles events for the clear formatting skin part.
RichTextEditor
  
Close the create link skin part.
RichTextEditor
  
colorPickerPartHandler(event:Event):void
Handles events for the color picker skin part.
RichTextEditor
  
Handles events for the decrement indent skin part.
RichTextEditor
  
fontFamilyPartHandler(event:Event):void
Handles events for the font family skin part.
RichTextEditor
  
fontSizePartHandler(event:Event):void
Handles events for the font size skin part.
RichTextEditor
  
Return an array of all the selected ParagraphElements.
RichTextEditor
  
Handles events for the increment indent skin part.
RichTextEditor
  
italicBtnPartHandler(event:Event):void
Handles events for the italic button skin part.
RichTextEditor
  
letterSpacingBtnPartHandler(event:Event):void
Handles events for the letter spacing button skin part.
RichTextEditor
  
lineHeightBtnPartHandler(event:Event):void
Handles events for the line height button skin part.
RichTextEditor
  
listDecimalBtnPartHandler(event:Event):void
Handles events for the list decimal skin part.
RichTextEditor
  
listDiscBtnPartHandler(event:Event):void
Handles events for the list disc skin part.
RichTextEditor
  
noListItems(paragraphs:Array):Boolean
Test whether all selected paragraphs are children of ListItemElement FlowElements.
RichTextEditor
  
Creates the create link panel skin part.
RichTextEditor
  
Handles events for the create link skin part.
RichTextEditor
  
paraIndentBtnPartHandler(event:Event):void
Handles events for the paragraph indent skin part.
RichTextEditor
  
redo():void
Redo the last undone change to state.
RichTextEditor
  
redoBtnPartHandler(event:Event):void
Handles events for the redo button skin part.
RichTextEditor
  
Removes the formatting applied to the selected text.
RichTextEditor
  
Handles events for the paragraph space skin part.
RichTextEditor
  
Handles events for the paragraph pre indent skin part.
RichTextEditor
  
strikeThroughBtnPartHandler(event:Event):void
Handles events for the strikethrough button skin part.
RichTextEditor
  
systemManagerHandler(event:Event):void
Handles events on the systemManager.
RichTextEditor
  
targetEventHandler(event:Event):void
Handles events on the target event dispatcher.
RichTextEditor
  
textAlignmentBarPartHandler(event:Event):void
Handles events for the text alignment button bar skin part.
RichTextEditor
  
underlineBtnPartHandler(event:Event):void
Handles events for the underline button skin part.
RichTextEditor
  
undo():void
Undo the last change to state.
RichTextEditor
  
undoBtnPartHandler(event:Event):void
Handles events for the undo button skin part.
RichTextEditor
  
Updates the font family skin part.
RichTextEditor
Styles
 Style Description Defined By
  
backgroundColor
Type: uint Format: Color CSS Inheritance: no
The color applied to the background.
RichTextEditor
  
borderAlpha
Type: Number CSS Inheritance: no
The alpha applied to the border. The default value is 1.
RichTextEditor
  
borderColor
Type: uint Format: Color CSS Inheritance: no
The color applied to the border.
RichTextEditor
  
borderVisible
Type: Boolean CSS Inheritance: no
Whether to display a border. The default value is true.
RichTextEditor
Skin Parts

This component uses skins made up of skin parts. Do not set the skin parts directly. The component's skin sets the skin parts.


 Skin Part Description Defined By
  
autoKernPart:spark.components.supportClasses.ToggleButtonBase
Required: false Part Type: Static
Checkbox to enable or disable automatic kerning.
RichTextEditor
  
boldBtnPart:spark.components.supportClasses.ToggleButtonBase
Required: false Part Type: Static
Button that changes the font weight property.
RichTextEditor
  
breakLinkBtnPart:spark.components.supportClasses.ButtonBase
Required: false Part Type: Static
Button that breaks the hyper link for the selected text.
RichTextEditor
  
clearBtnPart:spark.components.supportClasses.ButtonBase
Required: false Part Type: Static
Button that clears the formatting for the selected text.
RichTextEditor
  
colorPickerPart:ColorPicker
Required: false Part Type: Static
ColorPicker that changes the text color property.
RichTextEditor
  
createLinkPanelFactoryPart:mx.core.IFactory
Required: false Part Type: Dynamic
Dynamic skin part that allows the user to set the url and target for hyperlinks.

The IFactory must return an object of type ICreateLinkPanel
RichTextEditor
  
decrementIndentBtnPart:spark.components.supportClasses.ButtonBase
Required: false Part Type: Static
Button that decrements the indent for the selected state. Changes the indent by the number defined by the "indentPixels" property. TLF bug: for lists, the list element (E.G. the bullet point) will not indent along with the text. Use the "paraIndentBtnPart" to indent lists.
RichTextEditor
  
fontFamilyPart:spark.components.supportClasses.ListBase
Required: false Part Type: Static
List that changes the font for the selected text.
RichTextEditor
  
fontSizePart:SliderField
Required: false Part Type: Static
SliderField that changes the font size property.
RichTextEditor
  
incrementIndentBtnPart:spark.components.supportClasses.ButtonBase
Required: false Part Type: Static
Button that increments the line indent for the selected state. Changes the indent by the number defined by the "indentPixels" property. TLF bug: for lists, the list element (E.G. the bullet point) will not indent along with the text. Use the "paraIndentBtnPart" to indent lists.
RichTextEditor
  
italicBtnPart:spark.components.supportClasses.ToggleButtonBase
Required: false Part Type: Static
Button that changes the font style (italic) property.
RichTextEditor
  
letterSpacingBtnPart:SliderField
Required: false Part Type: Static
SliderField that changes the letter spacing for the selected text. Expresses spacing as a number of pixels.
RichTextEditor
  
lineHeightBtnPart:SliderField
Required: false Part Type: Static
SliderField that changes the line height of the selected text. Expresses line height in percentages.
RichTextEditor
  
listDecimalBtnPart:spark.components.supportClasses.ToggleButtonBase
Required: false Part Type: Static
Button that inserts a decimal list for the selected text.
RichTextEditor
  
listDiscBtnPart:spark.components.supportClasses.ToggleButtonBase
Required: false Part Type: Static
Button that inserts a disc list for the selected text.
RichTextEditor
  
openCreateLinkPanelBtnPart:spark.components.supportClasses.ButtonBase
Required: false Part Type: Static
Button that opens the control created by the createLinkPanelFactoryPart.
RichTextEditor
  
paraIndentBtnPart:SliderField
Required: false Part Type: Static
SliderField that changes the paragraph indent for the selected state. Only TLF property that indents lists. TextIndent will only indent the text contained within a ListItemElement, not the list disc itself. Use this property to indent the text and the disc.
RichTextEditor
  
redoBtnPart:spark.components.supportClasses.ButtonBase
Required: false Part Type: Static
Button that redos the last text operation.
RichTextEditor
  
spaceAfterParagraphBtnPart:SliderField
Required: false Part Type: Static
SliderField that changes the spacing after the end of a paragraph for the selected text.
RichTextEditor
  
spaceBeforeParagraphBtnPart:SliderField
Required: false Part Type: Static
SliderField that changes the spacing before the begin of a paragraph for the selected text.
RichTextEditor
  
strikeThroughBtnPart:spark.components.supportClasses.ToggleButtonBase
Required: false Part Type: Static
Button that changes the strikethrough property.
RichTextEditor
  
textAlignmentBarPart:spark.components.supportClasses.ButtonBarBase
Required: false Part Type: Static
Button bar that selects the text alignment.
RichTextEditor
  
underlineBtnPart:spark.components.supportClasses.ToggleButtonBase
Required: false Part Type: Static
Button that changes the font underline property.
RichTextEditor
  
undoBtnPart:spark.components.supportClasses.ButtonBase
Required: false Part Type: Static
Button that undos the last text operation.
RichTextEditor
Skin States

To skin the component, implement a skin that defines the following states. Although you must implement all skin states, a skin state can be empty. An empty skin state specifies no changes to the default skin state.


 Skin State Description Defined By
  
disabled
RichTextEditor
  
normal
RichTextEditor
Property Detail
editManagerproperty
editManager:EditManager  [read-only]

EditManager attached to the "target". Necessary to make the requested changes and to enable undo/redo.

The default value is EditManager.


Implementation
    public function get editManager():EditManager
enableKeyboardShortcutsproperty 
enableKeyboardShortcuts:Boolean

True to enable keyboard shortcuts for certain functions when the target has focus.

Shortcuts:

The default value is true.


Implementation
    public function get enableKeyboardShortcuts():Boolean
    public function set enableKeyboardShortcuts(value:Boolean):void
fontFamiliesproperty 
fontFamilies:Array

Array of font names to list in the fontFamilyPart list. Does not automatically add any listed embedded fonts.

The default value is ["Arial", "Georgia", "Times New Roman", "Verdana", "Tahoma"].


Implementation
    public function get fontFamilies():Array
    public function set fontFamilies(value:Array):void
indentPixelsproperty 
public var indentPixels:Number = 48

The number of pixels to increment or decrement the indent for a textline when the relevant buttons are clicked.

The default value is 48.

selectionHighlightingproperty 
selectionHighlighting:String

The "selectionHighlighting" style that will be applied to the target.

The default value is TextSelectionHighlighting.ALWAYS.


Implementation
    public function get selectionHighlighting():String
    public function set selectionHighlighting(value:String):void
targetproperty 
target:RichEditableText

The RichEditableText control to edit.

The default value is null.


Implementation
    public function get target():RichEditableText
    public function set target(value:RichEditableText):void
undoManagerproperty 
undoManager:UndoManager  [read-only]

UndoManager attached to the "target". Necessary to enable undo/redo.

The default value is UndoManager.


Implementation
    public function get undoManager():UndoManager
Method Detail
autoKernPartHandler()method
protected function autoKernPartHandler(event:Event):void

Handles events for the auto kern button skin part.

Parameters

event:Event — the Event that triggered the handler

boldBtnPartHandler()method 
protected function boldBtnPartHandler(event:Event):void

Handles events for the bold button skin part.

Parameters

event:Event — the Event that triggered the handler

breakLinkBtnPartHandler()method 
protected function breakLinkBtnPartHandler(event:Event):void

Handles events for the break link skin part.

Parameters

event:Event — the Event that triggered the handler

changeAfterParagraph()method 
protected function changeAfterParagraph():void

Change the indent after paragraphs.

changeAutoKern()method 
protected function changeAutoKern():void

Changes the kerning for the selected text.

changeBeforeParagraph()method 
protected function changeBeforeParagraph():void

Change the indent before a paragraph.

changeColor()method 
protected function changeColor():void

Change the color for the selected text.

changeFont()method 
protected function changeFont():void

Change the font for the selected text.

changeFontSize()method 
protected function changeFontSize():void

Change the font for the selected text.

changeFontWeight()method 
protected function changeFontWeight():void

Change the font weight for the selected text.

changeIndent()method 
protected function changeIndent(increment:Boolean = true):void

Changes the textline indent.

Parameters

increment:Boolean (default = true) — true to increment, false to decrement the indent

changeItalic()method 
protected function changeItalic():void

Change the italic state for the selected text.

changeLetterSpacing()method 
protected function changeLetterSpacing():void

Changes the letter spacing for the selected text.

changeLineHeight()method 
protected function changeLineHeight():void

Changes the line height for the selected text.

changeLink()method 
protected function changeLink(createLink:Boolean):void

Changes the hyperlinks applied to the selected text.

Parameters

createLink:Boolean — true to create a link, false to remove links

changeList()method 
protected function changeList(type:String):void

Add/remove lists. Supports listStyleType disc and decimal out of the box.

Parameters

type:String (default = NaN) — the type of list to create

changeParagraphIndent()method 
protected function changeParagraphIndent():void

Change the paragraph indent.

changeStrikeThrough()method 
protected function changeStrikeThrough():void

Change the strikethrough state for the selected text.

changeTextAlignment()method 
protected function changeTextAlignment(alignment:String = null):void

Change the text alignment state for the selected text.

Parameters

alignment:String (default = null) — the index in the textAlignmentBarPart to apply

changeUnderline()method 
protected function changeUnderline():void

Change the underline state for the selected text.

clearBtnPartHandler()method 
protected function clearBtnPartHandler(event:Event):void

Handles events for the clear formatting skin part.

Parameters

event:Event — the Event that triggered the handler

closeCreateLinkPanel()method 
protected function closeCreateLinkPanel():void

Close the create link skin part.

colorPickerPartHandler()method 
protected function colorPickerPartHandler(event:Event):void

Handles events for the color picker skin part.

Parameters

event:Event — the Event that triggered the handler

decrementIndentBtnPartHandler()method 
protected function decrementIndentBtnPartHandler(event:Event):void

Handles events for the decrement indent skin part.

Parameters

event:Event — the Event that triggered the handler

exportAsHTML()method 
public function exportAsHTML():Object

Return the target textflow as XML.

Returns
Object — Object XML string
exportAsXML()method 
public function exportAsXML():Object

Return the target textflow as HTML.

Returns
Object — Object HTML string
fontFamilyPartHandler()method 
protected function fontFamilyPartHandler(event:Event):void

Handles events for the font family skin part.

Parameters

event:Event — the Event that triggered the handler

fontSizePartHandler()method 
protected function fontSizePartHandler(event:Event):void

Handles events for the font size skin part.

Parameters

event:Event — the Event that triggered the handler

getSelectedParagraphs()method 
protected function getSelectedParagraphs():Array

Return an array of all the selected ParagraphElements.

Returns
Array — array of Paragraph flow elements
incrementIndentBtnPartHandler()method 
protected function incrementIndentBtnPartHandler(event:Event):void

Handles events for the increment indent skin part.

Parameters

event:Event — the Event that triggered the handler

italicBtnPartHandler()method 
protected function italicBtnPartHandler(event:Event):void

Handles events for the italic button skin part.

Parameters

event:Event — the Event that triggered the handler

letterSpacingBtnPartHandler()method 
protected function letterSpacingBtnPartHandler(event:Event):void

Handles events for the letter spacing button skin part.

Parameters

event:Event — the Event that triggered the handler

lineHeightBtnPartHandler()method 
protected function lineHeightBtnPartHandler(event:Event):void

Handles events for the line height button skin part.

Parameters

event:Event — the Event that triggered the handler

listDecimalBtnPartHandler()method 
protected function listDecimalBtnPartHandler(event:Event):void

Handles events for the list decimal skin part.

Parameters

event:Event — the Event that triggered the handler

listDiscBtnPartHandler()method 
protected function listDiscBtnPartHandler(event:Event):void

Handles events for the list disc skin part.

Parameters

event:Event — the Event that triggered the handler

noListItems()method 
protected function noListItems(paragraphs:Array):Boolean

Test whether all selected paragraphs are children of ListItemElement FlowElements.

Parameters

paragraphs:Array

Returns
Boolean — boolean
openCreateLinkPanel()method 
protected function openCreateLinkPanel():void

Creates the create link panel skin part.

openCreateLinkPanelBtnPartHandler()method 
protected function openCreateLinkPanelBtnPartHandler(event:Event):void

Handles events for the create link skin part.

Parameters

event:Event — the Event that triggered the handler

paraIndentBtnPartHandler()method 
protected function paraIndentBtnPartHandler(event:Event):void

Handles events for the paragraph indent skin part.

Parameters

event:Event — the Event that triggered the handler

redo()method 
protected function redo():void

Redo the last undone change to state.

redoBtnPartHandler()method 
protected function redoBtnPartHandler(event:Event):void

Handles events for the redo button skin part.

Parameters

event:Event — the Event that triggered the handler

removeFormatting()method 
protected function removeFormatting():void

Removes the formatting applied to the selected text.

spaceAfterParagraphBtnPartHandler()method 
protected function spaceAfterParagraphBtnPartHandler(event:Event):void

Handles events for the paragraph space skin part.

Parameters

event:Event — the Event that triggered the handler

spaceBeforeParagraphBtnPartHandler()method 
protected function spaceBeforeParagraphBtnPartHandler(event:Event):void

Handles events for the paragraph pre indent skin part.

Parameters

event:Event — the Event that triggered the handler

strikeThroughBtnPartHandler()method 
protected function strikeThroughBtnPartHandler(event:Event):void

Handles events for the strikethrough button skin part.

Parameters

event:Event — the Event that triggered the handler

systemManagerHandler()method 
protected function systemManagerHandler(event:Event):void

Handles events on the systemManager.

Parameters

event:Event — the Event that triggered the handler

targetEventHandler()method 
protected function targetEventHandler(event:Event):void

Handles events on the target event dispatcher.

Parameters

event:Event — the Event that triggered the handler

textAlignmentBarPartHandler()method 
protected function textAlignmentBarPartHandler(event:Event):void

Handles events for the text alignment button bar skin part.

Parameters

event:Event — the Event that triggered the handler

underlineBtnPartHandler()method 
protected function underlineBtnPartHandler(event:Event):void

Handles events for the underline button skin part.

Parameters

event:Event — the Event that triggered the handler

undo()method 
protected function undo():void

Undo the last change to state.

undoBtnPartHandler()method 
protected function undoBtnPartHandler(event:Event):void

Handles events for the undo button skin part.

Parameters

event:Event — the Event that triggered the handler

updateFontFamilyPart()method 
protected function updateFontFamilyPart():void

Updates the font family skin part.

updateToolbar()method 
public function updateToolbar():void

Based on the current SelectionState. All the buttons and controls are updated to reflect the selection's TextLayoutFormat.