@@ -26,6 +26,7 @@ jQuery.noConflict();
26
26
, GTT_DOMAIN_REGEX = / t r a n s l a t e .g o o g l e .c o m /
27
27
, OUTLOOK_DOMAIN_REGEX = / m a i l .l i v e .c o m /
28
28
, MAILCHIMP_DOMAIN_REGEX = / a d m i n .m a i l c h i m p .c o m /
29
+ , ATLASSIAN_DOMAIN_REGEX = / a t l a s s i a n .n e t /
29
30
30
31
, EVENT_NAME_KEYPRESS = 'keypress.auto-expander'
31
32
, EVENT_NAME_KEYUP = 'keyup.auto-expander'
@@ -43,6 +44,7 @@ jQuery.noConflict();
43
44
, SELECTOR_OUTLOOK_EDIT = '#ComposeRteEditor_surface' // Outlook web editor
44
45
, SELECTOR_EVERNOTE_EDIT = 'gwt-debug-noteEditor' // Evernote web note editor
45
46
, SELECTOR_BASECAMP_EDIT = 'iframe.wysihtml5-sandbox' // Basecamp message editor
47
+ , SELECTOR_ATLASSIAN_EDIT = 'iframe#wysiwygTextarea_ifr' // Confluence editor
46
48
;
47
49
48
50
var typingBuffer = [ ] ; // Keep track of what's been typed before timeout
@@ -220,7 +222,9 @@ jQuery.noConflict();
220
222
} else if ( MAILCHIMP_DOMAIN_REGEX . test ( domain ) ) {
221
223
replaceTextMailchimp ( shortcut , autotext ) ;
222
224
} else if ( GTT_DOMAIN_REGEX . test ( domain ) ) {
223
- replaceTextTranslate ( shortcut , autotext ) ;
225
+ replaceTextGTT ( shortcut , autotext ) ;
226
+ } else if ( ATLASSIAN_DOMAIN_REGEX . test ( domain ) ) {
227
+ replaceTextAtlassian ( shortcut , autotext ) ;
224
228
} else if ( BASECAMP_DOMAIN_REGEX . test ( domain ) ) {
225
229
replaceTextBasecamp ( shortcut , autotext ) ;
226
230
} else {
@@ -370,8 +374,8 @@ jQuery.noConflict();
370
374
replaceTextContentEditable ( shortcut , autotext , node , iframeWindow ) ;
371
375
}
372
376
373
- // Specific handler for Google Translate iframe replacements
374
- function replaceTextTranslate ( shortcut , autotext )
377
+ // Specific handler for Google Translate iframe text replacements
378
+ function replaceTextGTT ( shortcut , autotext )
375
379
{
376
380
debugLog ( "Domain: Google Translate" ) ;
377
381
@@ -385,6 +389,20 @@ jQuery.noConflict();
385
389
replaceTextContentEditable ( shortcut , autotext , node , iframeWindow ) ;
386
390
}
387
391
392
+ // Specific handler for Atlassian frame editor text replacements
393
+ function replaceTextAtlassian ( shortcut , autotext )
394
+ {
395
+ debugLog ( "Domain: Atlassian" ) ;
396
+
397
+ // Get the focused / selected text node
398
+ var iframeWindow = document . querySelector ( SELECTOR_ATLASSIAN_EDIT ) . contentWindow ;
399
+ var node = findFocusedNode ( iframeWindow ) ;
400
+ debugLog ( "node:" , node ) ;
401
+
402
+ // Pass onto editable iframe text handler
403
+ replaceTextContentEditable ( shortcut , autotext , node , iframeWindow ) ;
404
+ }
405
+
388
406
// Reusable handler for editable iframe text replacements
389
407
function replaceTextContentEditable ( shortcut , autotext , node , win )
390
408
{
@@ -895,6 +913,21 @@ jQuery.noConflict();
895
913
} , TIME_EDITOR_CHECK ) ;
896
914
}
897
915
916
+ // Special case for Atlassian
917
+ if ( ATLASSIAN_DOMAIN_REGEX . test ( domain ) )
918
+ {
919
+ debugLog ( "Domain: Atlassian" ) ;
920
+
921
+ // SUPER annoying, need to continually check for existence of editor iframe
922
+ // because the iframe gets recreated each time and starts with cross-origin
923
+ var editorCheck = setInterval ( function ( ) {
924
+ var $target = $ ( SELECTOR_ATLASSIAN_EDIT ) ;
925
+ if ( $target . length ) {
926
+ addListenersToIframe ( $target ) ;
927
+ }
928
+ } , TIME_EDITOR_CHECK ) ;
929
+ }
930
+
898
931
// Special case for Mailchimp
899
932
if ( MAILCHIMP_DOMAIN_REGEX . test ( domain ) )
900
933
{
0 commit comments