-
Notifications
You must be signed in to change notification settings - Fork 8
/
WKTextView.j
852 lines (704 loc) · 21.1 KB
/
WKTextView.j
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
/*
* WKTextView.j
* WKTextView
*
* Created by Alexander Ljungberg, WireLoad Inc.
*/
@import <AppKit/AppKit.j>
@import <Foundation/CPTimer.j>
@implementation _WKWebView : CPWebView
- (DOMWindow)DOMWindow
{
var contentWindow = nil;
try
{
contentWindow = [super DOMWindow];
}
catch (e)
{
// Do nothing. When the Web View is not added to the DOM, it booms.
// Just ignore the boom because WKTextView checks multiple times.
}
return contentWindow;
}
@end
WKTextCursorHeightFactor = 0.2;
WKTextViewDefaultFont = "Verdana";
var _CancelEvent = function(ev) {
if (!ev)
ev = window.event;
if (ev && ev.stopPropagation)
ev.stopPropagation();
else if (ev && ev.cancelBubble)
ev.cancelBubble = true;
};
var _EditorEvents = [
'onmousedown',
'onmouseup',
'onkeypress',
'onkeydown',
'onkeyup'
];
/*!
A closure editor based rich text editor widget.
Beware of the load times. Wait for the load event.
*/
@implementation WKTextView : _WKWebView
{
id delegate @accessors;
CPTimer loadTimer;
Object editor;
Object _scrollDiv;
BOOL shouldFocusAfterAction;
BOOL suppressAutoFocus;
BOOL editable;
BOOL enabled;
BOOL autohidesScrollers @accessors;
CPString lastFont;
CPString lastColorString;
CPColor lastColor;
CPDictionary eventHandlerSwizzler;
CPScroller _verticalScroller;
float _verticalLineScroll;
float _verticalPageScroll;
boolean _cursorPlaced;
boolean _isTryingToBecomeFirstResponder;
}
+ (CPString)defaultThemeClass
{
return "wktextview";
}
+ (id)themeAttributes
{
return [CPDictionary dictionaryWithObjects:[CGInsetMake(4.0, 4.0, 4.0, 4.0)]
forKeys:[@"content-inset"]];
}
- (id)initWithFrame:(CGRect)aFrame
{
if (self = [super initWithFrame:aFrame])
{
lastColor = [CPColor blackColor];
_verticalPageScroll = 10;
_verticalLineScroll = 10;
autohidesScrollers = YES;
[self setDrawsBackground:NO];
[self setBackgroundColor:[CPColor whiteColor]];
eventHandlerSwizzler = [[CPDictionary alloc] init];
shouldFocusAfterAction = YES;
[self setEditable: YES];
[self setEnabled: YES];
[self setScrollMode:CPWebViewScrollNative];
[self setMainFrameURL:[[CPBundle bundleForClass:[self class]] pathForResource:"WKTextView/editor.html"]];
_verticalScroller = [[CPScroller alloc] initWithFrame:CGRectMake(0.0, 0.0, [CPScroller scrollerWidth], MAX(CGRectGetHeight([self bounds]), [CPScroller scrollerWidth] + 1))];
[_verticalScroller setAutoresizingMask:CPViewMinXMargin];
[_verticalScroller setTarget:self];
[_verticalScroller setAction:@selector(_verticalScrollerDidScroll:)];
[_verticalScroller setStyle:[CPScrollView globalScrollerStyle]];
[self addSubview:_verticalScroller];
[self _updateScrollbar];
// Check if the document was loaded immediately. This could happen if we're loaded from
// a file URL.
[self checkLoad];
}
return self;
}
- (void)_startedLoading
{
// If the frame reloads for whatever reason, the editor is gone.
editor = nil;
_cursorPlaced = NO;
[super _startedLoading];
}
- (void)viewDidHide
{
// Editor can't be used at all while hidden due to the iframe unloading.
editor = nil;
_cursorPlaced = NO;
}
- (void)viewDidUnhide
{
if (editor === nil)
[self checkLoad];
else
[self _actualizeEnabledState];
}
- (void)_finishedLoading
{
[super _finishedLoading];
[self checkLoad];
}
- (void)checkLoad
{
// We can't load if hidden. Load checking will be resumed by viewDidUnhide later.
if ([self isHiddenOrHasHiddenAncestor])
return;
// Is the editor ready?
var maybeEditor = [self objectByEvaluatingJavaScriptFromString:"typeof(__closure_editor) != 'undefined' ? __closure_editor : null"];
if (maybeEditor)
{
_scrollDiv = maybeEditor.__scroll_div;
[self setEditor:maybeEditor];
if (loadTimer)
{
[loadTimer invalidate];
loadTimer = nil;
}
if (_html != nil)
[self setHtmlValue:_html];
if ([delegate respondsToSelector:@selector(textViewDidLoad:)])
[delegate textViewDidLoad:self];
return;
}
// If we still don't have an editor, check again later.
if (!loadTimer || ![loadTimer isValid])
loadTimer = [CPTimer scheduledTimerWithTimeInterval:0.1 target:self selector:"checkLoad" userInfo:nil repeats:NO];
}
- (BOOL)acceptsFirstResponder
{
return [self isEditable] && [self isEnabled];
}
- (BOOL)becomeFirstResponder
{
[self _didBeginEditing];
if (editor)
{
if (_cursorPlaced)
editor.focus();
else
{
editor.focusAndPlaceCursorAtStart();
_cursorPlaced = YES;
}
}
// ...if !editor this method will be called again once the editor is ready.
return YES;
}
- (BOOL)resignFirstResponder
{
window.focus();
[self _didEndEditing];
return YES;
}
/*!
Sets whether or not the receiver text view can be edited.
*/
- (void)setEditable:(BOOL)shouldBeEditable
{
editable = shouldBeEditable;
}
/*!
Returns \c YES if the text view is currently editable by the user.
*/
- (BOOL)isEditable
{
return editable;
}
/*!
Sets whether or not the receiver text view is enabled.
*/
- (void)setEnabled:(BOOL)shouldBeEnabled
{
if (enabled === shouldBeEnabled)
return;
enabled = shouldBeEnabled;
[self _actualizeEnabledState];
}
- (void)_actualizeEnabledState
{
if (editor)
{
var isEnabled = !editor.isUneditable();
if (!isEnabled && enabled)
editor.makeEditable();
else if (isEnabled && !enabled)
editor.makeUneditable();
// When contentEditable is off we must disable wysihat event handlers
// or they'll cause errors e.g. if a user clicks a disabled WKTextView.
/*var t = editor;
for(var i=0; i<_EditorEvents.length; i++) {
var ev = _EditorEvents[i];
if (!enabled && t[ev] !== _CancelEvent)
{
[eventHandlerSwizzler setObject:t[ev] forKey:ev];
t[ev] = _CancelEvent;
}
else if (enabled && t[ev] === _CancelEvent)
{
t[ev] = [eventHandlerSwizzler objectForKey:ev];
}
}*/
}
}
- (void)_actualizeTheme
{
if (!editor || !editor.__padder_div)
return;
var contentInset = [self currentValueForThemeAttribute:@"content-inset"];
editor.__padder_div.style.padding = "" + (contentInset.top || 0) + "px " + (contentInset.right || 0) + "px " + (contentInset.bottom || 0) + "px " + (contentInset.left || 0) + "px";
// The new padding might require a different minimum height.
[self _resizeWebFrame];
}
- (void)layoutSubviews
{
[super layoutSubviews];
[self _actualizeTheme];
}
- (void)setAutohidesScrollers:(BOOL)aFlag
{
if (autohidesScrollers === aFlag)
return;
autohidesScrollers = aFlag;
[self _updateScrollbar];
}
/*!
Returns \c YES if the text view is currently enabled.
*/
- (BOOL)isEnabled
{
return enabled;
}
/*!
Sets whether the editor should automatically take focus after an action
method is invoked such as boldSelection or setFont. This is useful when
binding to a toolbar.
*/
- (void)setShouldFocusAfterAction:(BOOL)aFlag
{
shouldFocusAfterAction = aFlag;
}
- (BOOL)shouldFocusAfterAction
{
return shouldFocusAfterAction;
}
- (BOOL)tryToBecomeFirstResponder
{
if (_isTryingToBecomeFirstResponder)
return YES;
var win = [self window];
if ([win firstResponder] === self)
return YES;
// We have to emulate select pieces of CPWindow's event handling
// here since the iframe bypasses the regular event handling.
var becameFirst = false;
_isTryingToBecomeFirstResponder = YES;
try
{
if ([self acceptsFirstResponder])
{
becameFirst = [win makeFirstResponder:self];
if (becameFirst)
{
if (![win isKeyWindow])
[win makeKeyAndOrderFront:self];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}
}
} finally
{
_isTryingToBecomeFirstResponder = NO;
}
return becameFirst;
}
- (void)setEditor:(Object)anEditor
{
if (editor === anEditor)
return;
if (![self DOMWindow])
return;
editor = anEditor;
_iframe.allowTransparency = true;
[self DOMWindow].document.body.style.backgroundColor = 'transparent';
// FIXME execCommand doesn't work well without the view having been focused
// on at least once.
// editor.focus();
suppressAutoFocus = YES;
//[self setFontNameForSelection:WKTextViewDefaultFont];
suppressAutoFocus = NO;
if (editor['WKTextView_Installed'] === undefined)
{
var win = [self DOMWindow],
doc = win.document;
var onmousedown = function(ev) {
// If selection was successful, allow the event to continue propagate so that the
// cursor is placed in the right spot.
return [self tryToBecomeFirstResponder];
}
defaultKeydown = doc.onkeydown;
var onkeydown = function(ev) {
if (!ev)
ev = window.event;
var key = ev.keyCode;
if (!key)
key = ev.which;
// Shift+Tab
if (ev.shiftKey && key == 9)
{
setTimeout(function()
{
[[self window] selectPreviousKeyView:self];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
}, 0.0);
return false;
}
else
{
if (defaultKeydown)
return defaultKeydown(ev);
return true;
}
};
var onscroll = function(ev) {
if (!ev)
ev = window.event;
[self _updateScrollbar];
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
return true;
}
if (doc.addEventListener)
{
doc.addEventListener('mousedown', onmousedown, true);
editor.addEventListener('keydown', onkeydown, true);
doc.body.addEventListener('scroll', onscroll, true);
}
else if (doc.attachEvent)
{
doc.attachEvent('onmousedown', onmousedown);
doc.attachEvent('onkeydown', onkeydown);
doc.body.attachEvent('scroll', onscroll);
}
editor.__fieldChangeExternal = function() {
[self _didChange];
// The normal run loop doesn't react to iframe events, so force immediate processing.
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
};
editor.__selectionChangeExternal = function()
{
[self _cursorDidMove];
// Workaround for Firefox not firing our iframe mousedown handler - we have
// to do the first responder promotion here instead.
[self tryToBecomeFirstResponder];
// The normal run loop doesn't react to iframe events, so force immediate processing.
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
};
editor['WKTextView_Installed'] = true;
}
[self _actualizeTheme];
[self _actualizeEnabledState];
[self _resizeWebFrame];
if ([[self window] firstResponder] === self)
[self becomeFirstResponder];
}
- (JSObject)editor
{
// editor can never be active while hidden.
return [self isHiddenOrHasHiddenAncestor] ? nil : editor;
}
- (void)_updateScrollbar
{
if (!_verticalScroller)
return;
var scrollTop = 0,
height = 1,
frameHeight = CGRectGetHeight([self bounds]),
scrollerWidth = CGRectGetWidth([_verticalScroller bounds]);
if (_scrollDiv)
{
scrollTop = _scrollDiv.scrollTop;
height = _scrollDiv.scrollHeight;
}
height = MAX(1, height);
var difference = height - frameHeight,
proportion = frameHeight / height;
// Avoid showing the scrollbar when it would nearly fill the bar anyhow.
// This avoids the bar flickering like crazy when animating the text field
// growing or shrinking, as could otherwise happen due to the inner height
// not having updated yet to fit to the outter height when the scroll bar
// update happens.
if (proportion > 0.99)
proportion = 1;
// Additionally, hide the scroller if there is no need to show one.
[_verticalScroller setHidden:autohidesScrollers && proportion == 1];
[_verticalScroller setFloatValue:scrollTop / difference];
[_verticalScroller setKnobProportion:proportion];
[_verticalScroller setFrame:CGRectMake(CGRectGetMaxX([self bounds]) - scrollerWidth, 0, scrollerWidth, frameHeight)];
}
- (void)_verticalScrollerDidScroll:(CPScroller)aScroller
{
if (!_scrollDiv)
return; // Shouldn't happen. No editor means no scrollbar.
// Based on CPScrollView _verticalScrollerDidScroll
var scrollTop = _scrollDiv.scrollTop,
height = _scrollDiv.scrollHeight,
frameHeight = CGRectGetHeight([self bounds]),
value = [aScroller floatValue];
switch ([_verticalScroller hitPart])
{
case CPScrollerDecrementLine: scrollTop -= _verticalLineScroll;
break;
case CPScrollerIncrementLine: scrollTop += _verticalLineScroll;
break;
case CPScrollerDecrementPage: scrollTop -= frameHeight - _verticalPageScroll;
break;
case CPScrollerIncrementPage: scrollTop += frameHeight - _verticalPageScroll;
break;
case CPScrollerKnobSlot:
case CPScrollerKnob:
// We want integral bounds!
default: scrollTop = ROUND(value * (height - frameHeight));
}
_scrollDiv.scrollTop = scrollTop;
}
- (void)_didChange
{
// When the text changes, the height of the content may change.
[self _updateScrollbar];
if ([delegate respondsToSelector:@selector(textViewDidChange:)])
{
[delegate textViewDidChange:self];
}
}
- (void)_didBeginEditing
{
if ([delegate respondsToSelector:@selector(textViewDidBeginEditing:)])
[delegate textViewDidBeginEditing:self];
}
- (void)_didEndEditing
{
if ([delegate respondsToSelector:@selector(textViewDidEndEditing:)])
[delegate textViewDidEndEditing:self];
}
- (void)_cursorDidMove
{
if (![self DOMWindow])
return;
if ([delegate respondsToSelector:@selector(textViewCursorDidMove:)])
{
[delegate textViewCursorDidMove:self];
}
}
- (void)_resizeWebFrame
{
if (editor && editor.getElement())
{
var contentInset = [self currentValueForThemeAttribute:@"content-inset"];
//editor.setMinHeight([self bounds].size.height - contentInset.top - contentInset.bottom);
editor.getElement().style.minHeight = (CGRectGetHeight([self bounds]) - contentInset.top - contentInset.bottom) + "px";
}
[self _updateScrollbar];
}
- (void)_loadMainFrameURL
{
[self _startedLoading];
_ignoreLoadStart = YES;
_ignoreLoadEnd = NO;
_url = _mainFrameURL;
_html = null;
[self _load];
}
- (void)_addKeypressHandler:(Function)aFunction
{
if ([self editor])
{
var doc = [self DOMWindow].document;
if (doc.addEventListener)
{
doc.addEventListener('keypress', aFunction, true);
}
else if (doc.attachEvent)
{
doc.attachEvent('onkeypress',
function() { aFunction([self editor].event) });
//This needs to be tested in IE. I have no idea if [self editor] will have an event
}
}
}
- (CPString)htmlValue
{
if (![self editor])
return _html;
return [self editor].getCleanContents();
}
- (void)setHtmlValue:(CPString)html
{
if ([self editor] != nil)
editor.setHtml(false, html, false, false);
else
_html = html;
_cursorPlaced = NO;
[self _didChange];
}
- (void)_didPerformAction
{
if (shouldFocusAfterAction && !suppressAutoFocus)
{
[self DOMWindow].focus();
editor.focus();
}
}
- (@action)clearText:(id)sender
{
[self setHtmlValue:""];
[self _didChange];
[self _didPerformAction];
}
- (void)insertHtml:(CPString)html
{
[CPException raise:CPUnsupportedMethodException reason:"not available with google-closure editor yet"];
/*[self editor].insertHTML(html);
[self _didChange];
[self _didPerformAction];*/
}
- (@action)boldSelection:(id)sender
{
editor.execCommand(editor.Command.BOLD, null);
[self _didPerformAction];
}
- (@action)underlineSelection:(id)sender
{
editor.execCommand(editor.Command.UNDERLINE, null);
[self _didPerformAction];
}
- (@action)italicSelection:(id)sender
{
editor.execCommand(editor.Command.ITALIC, null);
[self _didPerformAction];
}
- (@action)strikethroughSelection:(id)sender
{
editor.execCommand(editor.Command.STRIKE_THROUGH, null);
[self _didPerformAction];
}
- (@action)alignSelectionLeft:(id)sender
{
editor.execCommand(editor.Command.JUSTIFY_LEFT, null);
[self _didPerformAction];
}
- (@action)alignSelectionRight:(id)sender
{
editor.execCommand(editor.Command.JUSTIFY_RIGHT, null);
[self _didPerformAction];
}
- (@action)alignSelectionCenter:(id)sender
{
editor.execCommand(editor.Command.JUSTIFY_CENTER, null);
[self _didPerformAction];
}
- (@action)alignSelectionFull:(id)sender
{
editor.execCommand(editor.Command.JUSTIFY_FULL, null);
[self _didPerformAction];
}
- (@action)linkSelection:(id)sender
{
// TODO Show a sheet asking for a URL to link to.
editor.execCommand(editor.Command.LINK, "http://www.wireload.net");
[self _didPerformAction];
}
- (void)linkSelectionToURL:(CPString)aUrl
{
var appWindow = editor.getAppWindow(),
prompt = appWindow['prompt'];
appWindow['prompt'] = function() {
return aUrl;
};
editor.execCommand(editor.Command.LINK, null);
appWindow['prompt'] = prompt;
[self _didPerformAction];
}
- (void)unlinkSelection:(id)sender
{
[self linkSelectionToURL:nil];
}
- (@action)insertOrderedList:(id)sender
{
editor.execCommand(editor.Command.ORDERED_LIST, null);
[self _didPerformAction];
}
- (@action)insertUnorderedList:(id)sender
{
editor.execCommand(editor.Command.UNORDERED_LIST, null);
[self _didPerformAction];
}
- (@action)insertImage:(id)sender
{
// TODO Show a sheet asking for an image URL.
}
- (void)insertImageWithURL:(CPString)aUrl
{
editor.execCommand(editor.Command.IMAGE, aUrl);
[self _didPerformAction];
}
- (void)setFontNameForSelection:(CPString)aFont
{
lastFont = aFont;
editor.execCommand(editor.Command.FONT_FACE, aFont);
[self _didPerformAction];
}
- (int)fontSizeRaw
{
try {
return editor.queryCommandValue(editor.Command.FONT_SIZE);
} catch(e) {
return "16px";
}
}
- (int)fontSize
{
// Strangely we get font sizes back in pixels.
var size = parseInt([self fontSizeRaw]),
sizeMap = { 10:1, 13:2, 16:3, 18:4, 24:5, 32:6, 48:7};
if (size <= 7)
return size;
else if (size in sizeMap)
return sizeMap[size];
else
return 3;
}
/*!
Set the font size for the selected text. Size is specified
as a number between 1-6 which corresponds to small through xx-large.
*/
- (void)setFontSizeForSelection:(int)aSize
{
editor.execCommand(editor.Command.FONT_SIZE, aSize);
[self _didPerformAction];
}
- (CPString)font
{
try
{
var fontName = editor.queryCommandValue(editor.Command.FONT_FACE);
} catch(e) {
return lastFont;
}
// The font name may come through with quotes e.g. 'Apple Chancery'
var format = /'(.*?)'/,
r = fontName ? fontName.match(new RegExp(format)) : nil;
if (r && r.length == 2)
lastFont = r[1];
else if (fontName)
lastFont = fontName;
return lastFont;
}
- (CPColor)color
{
var colorString;
try {
colorString = editor.queryCommandValue(editor.Command.FONT_COLOR);
} catch(e) {
CPLog.warning(e);
}
// Avoid creating a new Color instance every time the cursor moves by reusing the last
// instance.
if (!colorString || colorString == lastColorString)
return lastColor;
lastColor = [[CPColor alloc] _initWithCSSString:colorString];
lastColorString = colorString;
return lastColor;
}
- (void)setColorForSelection:(CPColor)aColor
{
editor.execCommand(editor.Command.FONT_COLOR, [aColor hexString]);
[self _didPerformAction];
}
@end