mako 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -7
- data/bin/mako +1 -1
- data/lib/mako/data/flash_widget_dev_core/src/materia/questionStorage/Question.as +6 -4
- data/lib/mako/data/flash_widget_dev_core/src/nm/gameServ/common/Question.as +2 -0
- metadata +123 -133
- data/lib/mako/data/html/thistest.html +0 -0
- data/lib/mako/data/template_creator/src/Creator.mxml +0 -138
- data/lib/mako/data/template_creator/src/assets/images/RichTextEditor.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/DefaultError.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/barbgfill.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/barshadow.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/bold.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/bullets.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/center.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/close-x.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/fullscreenPopup_close.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/importIcon.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/italic.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/justify.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/left.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/oml-href-disabled.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/oml-href.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/oml-pagelink-disabled.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/oml-pagelink.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/oml-tooltip-delete.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/oml-tooltip-disabled.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/oml-tooltip-edit.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/oml-tooltip.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/pencil.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/right.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/underline.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/videoPlayButton.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/videoPlayerPauseButton.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/videoPlayerPauseButton_over.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/videoPlayerPlayButton.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/videoPlayerPlayButton_over.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/videoPlayerSoundButton.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/images/videoPlayerSoundButton_over.png +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/styles/creatorStyle.css +0 -63
- data/lib/mako/data/template_creator/src/assets/materia/styles/style.css +0 -1127
- data/lib/mako/data/template_creator/src/assets/materia/swf/embeddedfonts.swf +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/swf/helpBubble.swf +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/swf/kogneatoSymbols.swf +0 -0
- data/lib/mako/data/template_creator/src/assets/materia/swf/videobg.swf +0 -0
- data/lib/mako/data/template_creator/src/components/SmallRichTextEditor.mxml +0 -678
- data/lib/mako/data/template_creator/src/components/SmallRichTextEditorToolbar.mxml +0 -133
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,678 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!--
|
3
|
-
|
4
|
-
ADOBE SYSTEMS INCORPORATED
|
5
|
-
Copyright 2005-2007 Adobe Systems Incorporated
|
6
|
-
All Rights Reserved.
|
7
|
-
|
8
|
-
NOTICE: Adobe permits you to use, modify, and distribute this file
|
9
|
-
in accordance with the terms of the license agreement accompanying it.
|
10
|
-
|
11
|
-
-->
|
12
|
-
|
13
|
-
<mx:VBox verticalScrollPolicy="off" xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" width="325" height="300" verticalGap="0" xmlns:components="components.*" >
|
14
|
-
<mx:Style>
|
15
|
-
.alignStyle
|
16
|
-
{
|
17
|
-
buttonStyleName: "toggleButtonBarButtonStyle";
|
18
|
-
}
|
19
|
-
|
20
|
-
.toggleButtonBarButtonStyle
|
21
|
-
{
|
22
|
-
cornerRadius: 0px;
|
23
|
-
}
|
24
|
-
</mx:Style>
|
25
|
-
|
26
|
-
<mx:Metadata>
|
27
|
-
|
28
|
-
[Event(name="change", type="flash.events.Event")]
|
29
|
-
|
30
|
-
[DefaultTriggerEvent("change")]
|
31
|
-
|
32
|
-
/**
|
33
|
-
* Name of the CSS Style declaration to use for the styles for the TextArea.
|
34
|
-
* By default, the TextArea uses the RichTextEditor control's inheritable styles.
|
35
|
-
*/
|
36
|
-
[Style(name="textAreaStyleName", type="String", inherit="no")]
|
37
|
-
|
38
|
-
[IconFile("/assets/images/RichTextEditor.png")]
|
39
|
-
|
40
|
-
[Exclude(name="alignButtons", kind="property")]
|
41
|
-
[Exclude(name="boldButton", kind="property")]
|
42
|
-
[Exclude(name="bulletButton", kind="property")]
|
43
|
-
[Exclude(name="colorPicker", kind="property")]
|
44
|
-
[Exclude(name="defaultButton", kind="property")]
|
45
|
-
[Exclude(name="fontFamilyArray", kind="property")]
|
46
|
-
[Exclude(name="fontFamilyCombo", kind="property")]
|
47
|
-
[Exclude(name="fontSizeArray", kind="property")]
|
48
|
-
[Exclude(name="fontSizeCombo", kind="property")]
|
49
|
-
[Exclude(name="icon", kind="property")]
|
50
|
-
[Exclude(name="italicButton", kind="property")]
|
51
|
-
[Exclude(name="label", kind="property")]
|
52
|
-
[Exclude(name="layout", kind="property")]
|
53
|
-
[Exclude(name="linkTextInput", kind="property")]
|
54
|
-
[Exclude(name="toolBar", kind="property")]
|
55
|
-
[Exclude(name="toolBar2", kind="property")]
|
56
|
-
[Exclude(name="underlineButton", kind="property")]
|
57
|
-
|
58
|
-
</mx:Metadata>
|
59
|
-
|
60
|
-
<mx:Array id="fontFamilyArray">
|
61
|
-
<mx:String>_sans</mx:String>
|
62
|
-
<mx:String>_serif</mx:String>
|
63
|
-
<mx:String>_typewriter</mx:String>
|
64
|
-
<mx:String>Arial</mx:String>
|
65
|
-
<mx:String>Courier</mx:String>
|
66
|
-
<mx:String>Courier New</mx:String>
|
67
|
-
<mx:String>Geneva</mx:String>
|
68
|
-
<mx:String>Georgia</mx:String>
|
69
|
-
<mx:String>Helvetica</mx:String>
|
70
|
-
<mx:String>Times New Roman</mx:String>
|
71
|
-
<mx:String>Times</mx:String>
|
72
|
-
<mx:String>Verdana</mx:String>
|
73
|
-
</mx:Array>
|
74
|
-
|
75
|
-
<mx:Array id="fontSizeArray">
|
76
|
-
<mx:String>8</mx:String>
|
77
|
-
<mx:String>9</mx:String>
|
78
|
-
<mx:String>10</mx:String>
|
79
|
-
<mx:String>11</mx:String>
|
80
|
-
<mx:String>12</mx:String>
|
81
|
-
<mx:String>14</mx:String>
|
82
|
-
<mx:String>16</mx:String>
|
83
|
-
<mx:String>18</mx:String>
|
84
|
-
<mx:String>20</mx:String>
|
85
|
-
<mx:String>22</mx:String>
|
86
|
-
<mx:String>24</mx:String>
|
87
|
-
<mx:String>26</mx:String>
|
88
|
-
<mx:String>28</mx:String>
|
89
|
-
<mx:String>36</mx:String>
|
90
|
-
<mx:String>48</mx:String>
|
91
|
-
<mx:String>72</mx:String>
|
92
|
-
</mx:Array>
|
93
|
-
|
94
|
-
<mx:Script>
|
95
|
-
<![CDATA[
|
96
|
-
import components.SmallRichTextEditorToolbar;
|
97
|
-
|
98
|
-
import mx.controls.ComboBox;
|
99
|
-
import mx.controls.textClasses.TextRange;
|
100
|
-
import mx.core.IUITextField;
|
101
|
-
import mx.core.UITextFormat;
|
102
|
-
import mx.core.mx_internal;
|
103
|
-
|
104
|
-
use namespace mx_internal;
|
105
|
-
|
106
|
-
public var fontFamilyToolTip:String = "Font Family";
|
107
|
-
public var fontSizeToolTip:String = "Font Size";
|
108
|
-
public var boldToolTip:String = "Bold";
|
109
|
-
public var italicToolTip:String = "Italic";
|
110
|
-
public var underlineToolTip:String = "Underline";
|
111
|
-
public var colorPickerToolTip:String = "Color";
|
112
|
-
public var alignToolTip:String = "Align";
|
113
|
-
public var bulletToolTip:String = "Bullet";
|
114
|
-
public var linkToolTip:String = "Link";
|
115
|
-
|
116
|
-
private var linkTextCommitted:Boolean = false;
|
117
|
-
private var showControlBarChanged:Boolean = false;
|
118
|
-
private var showToolTipsChanged:Boolean = false;
|
119
|
-
private var textChanged:Boolean = false;
|
120
|
-
private var htmlTextChanged:Boolean = false;
|
121
|
-
private var previousTextFormat:TextFormat = null;
|
122
|
-
private var textFormatChanged:Boolean = false;
|
123
|
-
// -1 is used to force updation of the ToolBar styles
|
124
|
-
public var lastCaretIndex:int = -1;
|
125
|
-
private var invalidateToolBarFlag:Boolean = false;
|
126
|
-
private var firstTime:Boolean = true;
|
127
|
-
|
128
|
-
//--------------------------------------------------------------------------
|
129
|
-
//
|
130
|
-
// Properties
|
131
|
-
//
|
132
|
-
//--------------------------------------------------------------------------
|
133
|
-
|
134
|
-
[Bindable] public var showFont:Boolean = true;
|
135
|
-
[Bindable] public var showFontSize:Boolean = true;
|
136
|
-
[Bindable] public var showFormatting:Boolean = true;
|
137
|
-
[Bindable] public var showColor:Boolean = true;
|
138
|
-
[Bindable] public var showAlign:Boolean = true;
|
139
|
-
[Bindable] public var showBullets:Boolean = true;
|
140
|
-
[Bindable] public var showLink:Boolean = true;
|
141
|
-
|
142
|
-
//@HACK
|
143
|
-
public function forceFocus():void
|
144
|
-
{
|
145
|
-
stage.focus = TextField(textArea.getTextField());
|
146
|
-
textArea.setSelection(textArea.htmlText.length, textArea.htmlText.length);
|
147
|
-
}
|
148
|
-
|
149
|
-
public function getSelectedTextFormatURL():String
|
150
|
-
{
|
151
|
-
if(!textArea) return '';
|
152
|
-
|
153
|
-
var tf:TextFormat;
|
154
|
-
|
155
|
-
var beginIndex:int = textArea.getTextField().selectionBeginIndex;
|
156
|
-
var endIndex:int = textArea.getTextField().selectionEndIndex;
|
157
|
-
|
158
|
-
if (beginIndex == endIndex)
|
159
|
-
{
|
160
|
-
tf = textArea.getTextField().defaultTextFormat;
|
161
|
-
if (tf.url != "")
|
162
|
-
{
|
163
|
-
var carIndex:int = textArea.getTextField().caretIndex;
|
164
|
-
if (carIndex < textArea.getTextField().length)
|
165
|
-
{
|
166
|
-
var tfNext:TextFormat=textArea.getTextField().getTextFormat(carIndex, carIndex + 1);
|
167
|
-
if (!tfNext.url || tfNext.url == "")
|
168
|
-
tf.url = tf.target = "";
|
169
|
-
}
|
170
|
-
else
|
171
|
-
tf.url = tf.target = "";
|
172
|
-
}
|
173
|
-
}
|
174
|
-
else
|
175
|
-
{
|
176
|
-
tf = textArea.getTextField().getTextFormat(beginIndex,endIndex);
|
177
|
-
}
|
178
|
-
|
179
|
-
return tf.url;
|
180
|
-
}
|
181
|
-
|
182
|
-
/*** End custom OML functions ***/
|
183
|
-
|
184
|
-
public function setEditingElements(font:Boolean = true, fontSize:Boolean = true, formatting:Boolean = true, color:Boolean = true, vrule1:Boolean = true, align:Boolean = true, vrule2:Boolean = true, bullets:Boolean = true):void
|
185
|
-
{
|
186
|
-
toolbar.setEditingElements(font, fontSize, formatting, color, vrule1, align, vrule2, bullets);
|
187
|
-
}
|
188
|
-
|
189
|
-
public function set editingControls(val:Boolean):void
|
190
|
-
{
|
191
|
-
if(val && !editingControls) addChild(controlBar);
|
192
|
-
if(!val && editingControls) removeChild(controlBar);
|
193
|
-
}
|
194
|
-
|
195
|
-
public function get editingControls():Boolean
|
196
|
-
{
|
197
|
-
return getChildAt(numChildren - 1) == controlBar;
|
198
|
-
}
|
199
|
-
|
200
|
-
//----------------------------------
|
201
|
-
// defaultLinkProtocol
|
202
|
-
//----------------------------------
|
203
|
-
|
204
|
-
private var _defaultLinkProtocol:String = "http://";
|
205
|
-
|
206
|
-
[Inspectable(defaultValue="http://")]
|
207
|
-
|
208
|
-
public function get defaultLinkProtocol():String
|
209
|
-
{
|
210
|
-
return _defaultLinkProtocol;
|
211
|
-
}
|
212
|
-
|
213
|
-
public function set defaultLinkProtocol(value:String):void
|
214
|
-
{
|
215
|
-
_defaultLinkProtocol = value;
|
216
|
-
|
217
|
-
//if (linkTextInput)
|
218
|
-
// linkTextInput.text = _defaultLinkProtocol;
|
219
|
-
}
|
220
|
-
|
221
|
-
//----------------------------------
|
222
|
-
// showControlBar
|
223
|
-
//----------------------------------
|
224
|
-
|
225
|
-
private var _showControlBar:Boolean = true;
|
226
|
-
|
227
|
-
[Inspectable(category="General", defaultValue="true")]
|
228
|
-
|
229
|
-
public function get showControlBar():Boolean
|
230
|
-
{
|
231
|
-
return _showControlBar;
|
232
|
-
}
|
233
|
-
|
234
|
-
public function set showControlBar(value:Boolean):void
|
235
|
-
{
|
236
|
-
_showControlBar = value;
|
237
|
-
showControlBarChanged = true;
|
238
|
-
invalidateProperties();
|
239
|
-
}
|
240
|
-
|
241
|
-
//----------------------------------
|
242
|
-
// showToolTips
|
243
|
-
//----------------------------------
|
244
|
-
|
245
|
-
private var _showToolTips:Boolean = false;
|
246
|
-
|
247
|
-
[Inspectable(defaultValue="false")]
|
248
|
-
|
249
|
-
public function get showToolTips():Boolean
|
250
|
-
{
|
251
|
-
return _showToolTips;
|
252
|
-
}
|
253
|
-
|
254
|
-
public function set showToolTips(value:Boolean):void
|
255
|
-
{
|
256
|
-
_showToolTips = value;
|
257
|
-
showToolTipsChanged = true;
|
258
|
-
invalidateProperties();
|
259
|
-
}
|
260
|
-
|
261
|
-
//----------------------------------
|
262
|
-
// selection
|
263
|
-
//----------------------------------
|
264
|
-
|
265
|
-
/**
|
266
|
-
* The selected text.
|
267
|
-
*/
|
268
|
-
public function get selection():TextRange
|
269
|
-
{
|
270
|
-
return new TextRange(this, true);
|
271
|
-
}
|
272
|
-
|
273
|
-
//----------------------------------
|
274
|
-
// text
|
275
|
-
//----------------------------------
|
276
|
-
|
277
|
-
private var _text:String = "";
|
278
|
-
|
279
|
-
[Bindable("valueCommit")]
|
280
|
-
[CollapseWhiteSpace]
|
281
|
-
[NonCommittingChangeEvent("change")]
|
282
|
-
[Inspectable(category="General")]
|
283
|
-
|
284
|
-
public function get text():String
|
285
|
-
{
|
286
|
-
return textArea ? textArea.text : _text;
|
287
|
-
}
|
288
|
-
|
289
|
-
public function set text(value:String):void
|
290
|
-
{
|
291
|
-
_text = value;
|
292
|
-
textChanged = true;
|
293
|
-
invalidateProperties();
|
294
|
-
}
|
295
|
-
|
296
|
-
//----------------------------------
|
297
|
-
// htmlText
|
298
|
-
//----------------------------------
|
299
|
-
|
300
|
-
private var _htmlText:String = "";
|
301
|
-
|
302
|
-
[Bindable("valueCommit")]
|
303
|
-
[CollapseWhiteSpace]
|
304
|
-
[NonCommittingChangeEvent("change")]
|
305
|
-
[Inspectable(category="General")]
|
306
|
-
|
307
|
-
public function get htmlText():String
|
308
|
-
{
|
309
|
-
return textArea ? textArea.htmlText : _htmlText;
|
310
|
-
}
|
311
|
-
|
312
|
-
public function set htmlText(value:String):void
|
313
|
-
{
|
314
|
-
_htmlText = value;
|
315
|
-
htmlTextChanged = true;
|
316
|
-
invalidateProperties();
|
317
|
-
}
|
318
|
-
|
319
|
-
//--------------------------------------------------------------------------
|
320
|
-
//
|
321
|
-
// Overridden methods
|
322
|
-
//
|
323
|
-
//--------------------------------------------------------------------------
|
324
|
-
|
325
|
-
override protected function commitProperties():void
|
326
|
-
{
|
327
|
-
super.commitProperties();
|
328
|
-
|
329
|
-
if (firstTime)
|
330
|
-
{
|
331
|
-
firstTime = false;
|
332
|
-
var textAreaStyleName:String = getStyle(
|
333
|
-
"textAreaStyleName");
|
334
|
-
if (textAreaStyleName)
|
335
|
-
textArea.styleName = textAreaStyleName;
|
336
|
-
textArea.getTextField().alwaysShowSelection = true;
|
337
|
-
}
|
338
|
-
|
339
|
-
if (showControlBarChanged)
|
340
|
-
{
|
341
|
-
if (_showControlBar)
|
342
|
-
{
|
343
|
-
|
344
|
-
controlBar.height = NaN;
|
345
|
-
controlBar.visible = true;
|
346
|
-
}
|
347
|
-
else
|
348
|
-
{
|
349
|
-
controlBar.height = 0;
|
350
|
-
controlBar.visible = false;
|
351
|
-
}
|
352
|
-
showControlBarChanged = false;
|
353
|
-
}
|
354
|
-
|
355
|
-
if (showToolTipsChanged)
|
356
|
-
{
|
357
|
-
if (_showToolTips)
|
358
|
-
{
|
359
|
-
toolbar.fontFamilyCombo.toolTip = fontFamilyToolTip;
|
360
|
-
toolbar.fontSizeCombo.toolTip = fontSizeToolTip;
|
361
|
-
toolbar.boldButton.toolTip = boldToolTip;
|
362
|
-
toolbar.italicButton.toolTip = italicToolTip;
|
363
|
-
toolbar.underlineButton.toolTip = underlineToolTip;
|
364
|
-
toolbar.colorPicker.toolTip = colorPickerToolTip;
|
365
|
-
toolbar.alignButtons.toolTip = alignToolTip;
|
366
|
-
toolbar.bulletButton.toolTip = bulletToolTip;
|
367
|
-
//linkTextInput.toolTip = linkToolTip;
|
368
|
-
}
|
369
|
-
else
|
370
|
-
{
|
371
|
-
toolbar.fontFamilyCombo.toolTip = "";
|
372
|
-
toolbar.fontSizeCombo.toolTip = "";
|
373
|
-
toolbar.boldButton.toolTip = "";
|
374
|
-
toolbar.italicButton.toolTip = "";
|
375
|
-
toolbar.underlineButton.toolTip = "";
|
376
|
-
toolbar.colorPicker.toolTip = "";
|
377
|
-
toolbar.alignButtons.toolTip = "";
|
378
|
-
toolbar.bulletButton.toolTip = "";
|
379
|
-
//linkTextInput.toolTip = "";
|
380
|
-
}
|
381
|
-
showToolTipsChanged = false;
|
382
|
-
}
|
383
|
-
|
384
|
-
if (textChanged || htmlTextChanged)
|
385
|
-
{
|
386
|
-
// Revert previously set TextFormat.
|
387
|
-
var tf:UITextFormat = IUITextField(textArea.getTextField()).getUITextFormat();
|
388
|
-
// bullet style is not exposed in flex
|
389
|
-
// hence has to be explicitly defaulted.
|
390
|
-
tf.bullet = false;
|
391
|
-
textArea.getTextField().defaultTextFormat = tf;
|
392
|
-
if (textChanged)
|
393
|
-
{
|
394
|
-
if (_text !== null)
|
395
|
-
textArea.text = _text;
|
396
|
-
textChanged = false;
|
397
|
-
}
|
398
|
-
else
|
399
|
-
{
|
400
|
-
if (_htmlText !== null)
|
401
|
-
textArea.htmlText = _htmlText;
|
402
|
-
htmlTextChanged = false;
|
403
|
-
}
|
404
|
-
}
|
405
|
-
}
|
406
|
-
|
407
|
-
override protected function measure():void
|
408
|
-
{
|
409
|
-
// Called only when explicitWidth and
|
410
|
-
// explicitHeight are set to NaN, since
|
411
|
-
// we have set width and height explicitly
|
412
|
-
// for RTE's panel.
|
413
|
-
super.measure();
|
414
|
-
measuredMinWidth = 220;
|
415
|
-
measuredWidth = 320;
|
416
|
-
measuredMinHeight = 0; //200;
|
417
|
-
measuredHeight = 300;
|
418
|
-
}
|
419
|
-
|
420
|
-
/**
|
421
|
-
* @private
|
422
|
-
*/
|
423
|
-
override public function styleChanged(styleProp:String):void
|
424
|
-
{
|
425
|
-
super.styleChanged(styleProp);
|
426
|
-
|
427
|
-
if (styleProp == null || styleProp == "textAreaStyleName")
|
428
|
-
{
|
429
|
-
if (textArea)
|
430
|
-
{
|
431
|
-
var textAreaStyleName:String = getStyle("textAreaStyleName");
|
432
|
-
textArea.styleName = textAreaStyleName;
|
433
|
-
}
|
434
|
-
}
|
435
|
-
|
436
|
-
if (!invalidateToolBarFlag)
|
437
|
-
{
|
438
|
-
invalidateToolBarFlag = true;
|
439
|
-
callLater(getTextStyles);
|
440
|
-
}
|
441
|
-
}
|
442
|
-
|
443
|
-
//--------------------------------------------------------------------------
|
444
|
-
//
|
445
|
-
// Methods
|
446
|
-
//
|
447
|
-
//--------------------------------------------------------------------------
|
448
|
-
|
449
|
-
public function setTextStyles(type:String, value:Object = null):void
|
450
|
-
{
|
451
|
-
var tf:TextFormat;
|
452
|
-
|
453
|
-
var beginIndex:int = textArea.getTextField().selectionBeginIndex;
|
454
|
-
var endIndex:int = textArea.getTextField().selectionEndIndex;
|
455
|
-
|
456
|
-
if (beginIndex == endIndex)
|
457
|
-
{
|
458
|
-
tf = previousTextFormat;
|
459
|
-
}
|
460
|
-
else
|
461
|
-
tf = new TextFormat();
|
462
|
-
|
463
|
-
if (type == "bold" || type == "italic" || type == "underline")
|
464
|
-
{
|
465
|
-
tf[type] = value;
|
466
|
-
}
|
467
|
-
else if (type == "align" || type == "bullet")
|
468
|
-
{
|
469
|
-
if (beginIndex == endIndex)
|
470
|
-
{
|
471
|
-
tf = new TextFormat();
|
472
|
-
}
|
473
|
-
|
474
|
-
// Apply the paragraph styles to the whole paragraph instead of just
|
475
|
-
// the selected text
|
476
|
-
beginIndex = textArea.getTextField().getFirstCharInParagraph(beginIndex) - 1;
|
477
|
-
beginIndex = Math.max(0, beginIndex);
|
478
|
-
endIndex = textArea.getTextField().getFirstCharInParagraph(endIndex) +
|
479
|
-
textArea.getTextField().getParagraphLength(endIndex) - 1;
|
480
|
-
tf[type] = value;
|
481
|
-
previousTextFormat[type] = value;
|
482
|
-
if (!endIndex)
|
483
|
-
textArea.getTextField().defaultTextFormat = tf;
|
484
|
-
}
|
485
|
-
else if (type == "font")
|
486
|
-
{
|
487
|
-
tf[type] = toolbar.fontFamilyCombo.text;
|
488
|
-
}
|
489
|
-
else if (type == "size")
|
490
|
-
{
|
491
|
-
var fontSize:uint = uint(toolbar.fontSizeCombo.text);
|
492
|
-
if (fontSize > 0)
|
493
|
-
tf[type] = fontSize;
|
494
|
-
}
|
495
|
-
else if (type == "color")
|
496
|
-
{
|
497
|
-
tf[type] = uint(toolbar.colorPicker.selectedColor);
|
498
|
-
}
|
499
|
-
else if (type == "url")
|
500
|
-
{
|
501
|
-
if (value != defaultLinkProtocol && value != "")
|
502
|
-
{
|
503
|
-
tf[type] = value;
|
504
|
-
tf["target"] = "_blank";
|
505
|
-
}
|
506
|
-
else if (tf[type] != "")
|
507
|
-
{
|
508
|
-
tf[type] = "";
|
509
|
-
tf["target"] = "";
|
510
|
-
}
|
511
|
-
}
|
512
|
-
|
513
|
-
textFormatChanged = true;
|
514
|
-
|
515
|
-
if (beginIndex == endIndex)
|
516
|
-
{
|
517
|
-
previousTextFormat = tf;
|
518
|
-
}
|
519
|
-
else
|
520
|
-
{
|
521
|
-
textArea.getTextField().setTextFormat(tf,beginIndex,endIndex);
|
522
|
-
}
|
523
|
-
|
524
|
-
dispatchEvent(new Event("change"));
|
525
|
-
|
526
|
-
var caretIndex:int = textArea.getTextField().caretIndex;
|
527
|
-
var lineIndex:int = textArea.getTextField().getLineIndexOfChar(caretIndex);
|
528
|
-
|
529
|
-
textArea.invalidateDisplayList();
|
530
|
-
textArea.validateDisplayList();
|
531
|
-
|
532
|
-
// Scroll to make the line containing the caret under viewable area
|
533
|
-
while (lineIndex >= textArea.getTextField().bottomScrollV)
|
534
|
-
{
|
535
|
-
textArea.verticalScrollPosition++;
|
536
|
-
}
|
537
|
-
|
538
|
-
callLater(textArea.setFocus);
|
539
|
-
}
|
540
|
-
|
541
|
-
public function getTextStyles():void
|
542
|
-
{
|
543
|
-
if (!textArea)
|
544
|
-
return;
|
545
|
-
|
546
|
-
var tf:TextFormat;
|
547
|
-
|
548
|
-
var beginIndex:int = textArea.getTextField().selectionBeginIndex;
|
549
|
-
var endIndex:int = textArea.getTextField().selectionEndIndex;
|
550
|
-
|
551
|
-
if (textFormatChanged)
|
552
|
-
previousTextFormat = null;
|
553
|
-
|
554
|
-
if (beginIndex == endIndex)
|
555
|
-
{
|
556
|
-
tf = textArea.getTextField().defaultTextFormat;
|
557
|
-
if (tf.url != "")
|
558
|
-
{
|
559
|
-
var carIndex:int = textArea.getTextField().caretIndex;
|
560
|
-
if (carIndex < textArea.getTextField().length)
|
561
|
-
{
|
562
|
-
var tfNext:TextFormat=textArea.getTextField().getTextFormat(carIndex, carIndex + 1);
|
563
|
-
if (!tfNext.url || tfNext.url == "")
|
564
|
-
tf.url = tf.target = "";
|
565
|
-
}
|
566
|
-
else
|
567
|
-
tf.url = tf.target = "";
|
568
|
-
}
|
569
|
-
}
|
570
|
-
else
|
571
|
-
tf = textArea.getTextField().getTextFormat(beginIndex,endIndex);
|
572
|
-
|
573
|
-
if (!previousTextFormat || previousTextFormat.font != tf.font)
|
574
|
-
setComboSelection(toolbar.fontFamilyCombo, tf.font ? tf.font : "");
|
575
|
-
if (!previousTextFormat || previousTextFormat.size != tf.size)
|
576
|
-
setComboSelection(toolbar.fontSizeCombo, tf.size ? String(tf.size) : "");
|
577
|
-
if (!previousTextFormat || previousTextFormat.color != tf.color)
|
578
|
-
toolbar.colorPicker.selectedColor = Number(tf.color);
|
579
|
-
|
580
|
-
if (!previousTextFormat || previousTextFormat.bold != tf.bold)
|
581
|
-
toolbar.boldButton.selected = tf.bold;
|
582
|
-
if (!previousTextFormat || previousTextFormat.italic != tf.italic)
|
583
|
-
toolbar.italicButton.selected = tf.italic;
|
584
|
-
if (!previousTextFormat || previousTextFormat.underline != tf.underline)
|
585
|
-
toolbar.underlineButton.selected = tf.underline;
|
586
|
-
|
587
|
-
if (!previousTextFormat || previousTextFormat.align != tf.align)
|
588
|
-
{
|
589
|
-
if (tf.align == "left")
|
590
|
-
toolbar.alignButtons.selectedIndex = 0;
|
591
|
-
else if (tf.align == "center")
|
592
|
-
toolbar.alignButtons.selectedIndex = 1;
|
593
|
-
else if (tf.align == "right")
|
594
|
-
toolbar.alignButtons.selectedIndex = 2;
|
595
|
-
else if (tf.align == "justify")
|
596
|
-
toolbar.alignButtons.selectedIndex = 3;
|
597
|
-
}
|
598
|
-
if (!previousTextFormat || previousTextFormat.bullet != tf.bullet)
|
599
|
-
toolbar.bulletButton.selected = tf.bullet;
|
600
|
-
//if (!previousTextFormat || previousTextFormat.url != tf.url)
|
601
|
-
// linkTextInput.text = (tf.url == "" || tf.url == null) ? defaultLinkProtocol : tf.url;
|
602
|
-
|
603
|
-
if (textArea.getTextField().defaultTextFormat != tf)
|
604
|
-
textArea.getTextField().defaultTextFormat = tf;
|
605
|
-
previousTextFormat = tf;
|
606
|
-
textFormatChanged = false;
|
607
|
-
|
608
|
-
lastCaretIndex = textArea.getTextField().caretIndex;
|
609
|
-
invalidateToolBarFlag = false;
|
610
|
-
}
|
611
|
-
|
612
|
-
private function setComboSelection(combo:ComboBox,val:String):void
|
613
|
-
{
|
614
|
-
var length:uint = combo.dataProvider.length;
|
615
|
-
|
616
|
-
for (var i:uint = 0; i < length; i++)
|
617
|
-
{
|
618
|
-
if (combo.dataProvider.getItemAt(i).toLowerCase() == val.toLowerCase())
|
619
|
-
{
|
620
|
-
combo.selectedIndex = i;
|
621
|
-
return;
|
622
|
-
}
|
623
|
-
}
|
624
|
-
combo.selectedIndex = -1;
|
625
|
-
combo.validateNow();
|
626
|
-
combo.text = val;
|
627
|
-
}
|
628
|
-
|
629
|
-
/**
|
630
|
-
* @private
|
631
|
-
* This method is called when the user clicks on the textArea, drags
|
632
|
-
* out of it and releases the mouse button outside the TextArea.
|
633
|
-
*/
|
634
|
-
private function systemManager_mouseUpHandler(event:MouseEvent):void
|
635
|
-
{
|
636
|
-
if (lastCaretIndex != textArea.getTextField().caretIndex)
|
637
|
-
{
|
638
|
-
getTextStyles();
|
639
|
-
}
|
640
|
-
systemManager.removeEventListener(
|
641
|
-
MouseEvent.MOUSE_UP, systemManager_mouseUpHandler, true);
|
642
|
-
}
|
643
|
-
|
644
|
-
public function get toolbar():SmallRichTextEditorToolbar
|
645
|
-
{
|
646
|
-
return _toolbar;
|
647
|
-
}
|
648
|
-
|
649
|
-
public function set toolbar(newToolbar:SmallRichTextEditorToolbar):void
|
650
|
-
{
|
651
|
-
controlBar.removeAllChildren();
|
652
|
-
_toolbar = newToolbar;
|
653
|
-
_toolbar.rte = this;
|
654
|
-
}
|
655
|
-
|
656
|
-
]]>
|
657
|
-
</mx:Script>
|
658
|
-
|
659
|
-
<mx:TextArea id="textArea" minHeight="0" minWidth="0"
|
660
|
-
change="dispatchEvent(event);"
|
661
|
-
valueCommit="dispatchEvent(event);"
|
662
|
-
keyUp="getTextStyles()"
|
663
|
-
keyDown="if (textFormatChanged)
|
664
|
-
{
|
665
|
-
textArea.getTextField().defaultTextFormat=previousTextFormat;
|
666
|
-
textFormatChanged = false;
|
667
|
-
}"
|
668
|
-
mouseDown="systemManager.addEventListener(
|
669
|
-
MouseEvent.MOUSE_UP, systemManager_mouseUpHandler, true);"
|
670
|
-
left="0" right="0" top="0" bottom="46" width="100%" height="100%"/>
|
671
|
-
|
672
|
-
<mx:Canvas id="controlBar" bottom="0" left="0" right="0" width="100%" fontSize="10" backgroundColor="0xCCCCCC" verticalScrollPolicy="off" horizontalScrollPolicy="off">
|
673
|
-
|
674
|
-
<components:SmallRichTextEditorToolbar paddingTop="2" paddingLeft="2" paddingRight="2" paddingBottom="2" id="_toolbar" rte="{this}"/>
|
675
|
-
|
676
|
-
</mx:Canvas>
|
677
|
-
|
678
|
-
</mx:VBox>
|