Skip to content
This repository
  • 13 commits
  • 10 files changed
  • 0 comments
  • 5 contributors
1  apps/kpi/cron.py
@@ -17,6 +17,7 @@ def update_l10n_metric():
17 17
     translations = Document.objects.exclude(locale='en-US')
18 18
     for translation in translations:
19 19
         if (hasattr(translation, 'modified') and
  20
+            hasattr(translation.parent, 'modified') and
20 21
             translation.modified > translation.parent.modified):
21 22
             up_to_date_translations += 1
22 23
 
2  apps/wiki/cron.py
@@ -99,7 +99,7 @@ def build_sitemaps():
99 99
             sitemap_url = ("https://%s/sitemaps/%s/sitemap.xml" % (
100 100
                 Site.objects.get_current().domain, locale))
101 101
             sitemap_index = sitemap_index + sitemap_element % (sitemap_url,
102  
-                time.strftime('%Y-%m-%dT%H:%M:%S', time.localtime()))
  102
+                time.strftime('%Y-%m-%dT%H:%M:%S+00:00', time.gmtime()))
103 103
 
104 104
     sitemap_index = sitemap_index + "</sitemapindex>"
105 105
     index_file = open('%s/sitemap.xml' % settings.MEDIA_ROOT, 'w')
4  apps/wiki/templates/wiki/ckeditor_config.js
@@ -88,8 +88,8 @@ CKEDITOR.mdn = {};
88 88
 
89 89
 CKEDITOR.editorConfig = function(config) {
90 90
 
91  
-    config.extraPlugins = 'autogrow,definitionlist,mdn-buttons,mdn-link,mdn-syntaxhighlighter,mdn-keystrokes,mdn-attachments,mdn-image,mdn-enterkey,mdn-wrapstyle,mdn-table,tablesort,mdn-sampler,mdn-sample-finder';
92  
-    config.removePlugins = 'link,image,tab,enterkey,table';
  91
+    config.extraPlugins = 'autogrow,definitionlist,mdn-buttons,mdn-link,mdn-syntaxhighlighter,mdn-keystrokes,mdn-attachments,mdn-image,mdn-enterkey,mdn-wrapstyle,mdn-table,tablesort,mdn-sampler,mdn-sample-finder,mdn-maximize';
  92
+    config.removePlugins = 'link,image,tab,enterkey,table,maximize';
93 93
     config.entities = false;
94 94
     
95 95
     config.toolbar_MDN = [
17  apps/wiki/tests/test_views.py
@@ -139,6 +139,8 @@ def test_json_view(self):
139 139
         url = reverse('wiki.json_slug', args=('article-title',),
140 140
                       locale=settings.WIKI_DEFAULT_LANGUAGE)
141 141
         resp = self.client.get(url)
  142
+        ok_('Access-Control-Allow-Origin' in resp)
  143
+        eq_('*', resp['Access-Control-Allow-Origin'])
142 144
         eq_(200, resp.status_code)
143 145
         data = json.loads(resp.content)
144 146
         eq_('an article title', data['title'])
@@ -158,6 +160,8 @@ def test_toc_view(self):
158 160
                       locale=settings.WIKI_DEFAULT_LANGUAGE)
159 161
 
160 162
         resp = self.client.get(url)
  163
+        ok_('Access-Control-Allow-Origin' in resp)
  164
+        eq_('*', resp['Access-Control-Allow-Origin'])
161 165
         eq_(resp.content, '<ol><li><a href="#Head_2" rel="internal">Head 2</a>'
162 166
                           '<ol><li><a href="#Head_3" rel="internal">Head 3</a>'
163 167
                           '</ol></li></ol>')
@@ -182,6 +186,8 @@ def _make_doc(title, slug, parent=None):
182 186
 
183 187
         resp = self.client.get(reverse('wiki.get_children', args=['Root'],
184 188
             locale=settings.WIKI_DEFAULT_LANGUAGE))
  189
+        ok_('Access-Control-Allow-Origin' in resp)
  190
+        eq_('*', resp['Access-Control-Allow-Origin'])
185 191
         json_obj = json.loads(resp.content)
186 192
 
187 193
         # Basic structure creation testing
@@ -1896,6 +1902,8 @@ def test_raw_source(self):
1896 1902
         response = client.get('%s?raw=true' %
1897 1903
                               reverse('wiki.document', args=[d.full_path]),
1898 1904
                               HTTP_X_REQUESTED_WITH='XMLHttpRequest')
  1905
+        ok_('Access-Control-Allow-Origin' in response)
  1906
+        eq_('*', response['Access-Control-Allow-Origin'])
1899 1907
         eq_(normalize_html(expected),
1900 1908
             normalize_html(response.content))
1901 1909
 
@@ -2285,8 +2293,8 @@ def test_section_edit_review_tags(self):
2285 2293
                                HTTP_X_REQUESTED_WITH='XMLHttpRequest')
2286 2294
         changed = Document.objects.get(pk=doc.id).current_revision
2287 2295
         ok_(rev.id != changed.id)
2288  
-        eq_(tags_to_save,
2289  
-            [t.name for t in changed.review_tags.all()])
  2296
+        eq_(set(tags_to_save),
  2297
+            set([t.name for t in changed.review_tags.all()]))
2290 2298
 
2291 2299
 
2292 2300
 class MindTouchRedirectTests(TestCaseBase):
@@ -2415,6 +2423,9 @@ def test_document_redirects(self):
2415 2423
         url = reverse('wiki.autosuggest_documents', locale=settings.WIKI_DEFAULT_LANGUAGE) + '?term=e'
2416 2424
         resp = self.client.get(url)
2417 2425
 
  2426
+        ok_('Access-Control-Allow-Origin' in resp)
  2427
+        eq_('*', resp['Access-Control-Allow-Origin'])
  2428
+
2418 2429
         eq_(200, resp.status_code)
2419 2430
         data = json.loads(resp.content)
2420 2431
         eq_(len(data), len(validDocuments))
@@ -2478,6 +2489,8 @@ def test_code_sample_1(self):
2478 2489
         response = client.get(reverse('wiki.code_sample',
2479 2490
                               args=[d.full_path, 'sample1']),
2480 2491
                               HTTP_HOST='testserver')
  2492
+        ok_('Access-Control-Allow-Origin' in response)
  2493
+        eq_('*', response['Access-Control-Allow-Origin'])
2481 2494
         eq_(200, response.status_code)
2482 2495
         eq_(normalize_html(expected),
2483 2496
             normalize_html(response.content))
17  apps/wiki/views.py
@@ -205,6 +205,17 @@ def _added_header(request, *args, **kwargs):
205 205
     return _added_header
206 206
 
207 207
 
  208
+def allow_CORS_GET(func):
  209
+    """Decorator to allow CORS for GET requests"""
  210
+    @wraps(func)
  211
+    def _added_header(request, *args, **kwargs):
  212
+        response = func(request, *args, **kwargs)
  213
+        if 'GET' == request.method:
  214
+            response['Access-Control-Allow-Origin'] = "*"
  215
+        return response
  216
+    return _added_header
  217
+
  218
+
208 219
 def _format_attachment_obj(attachments):
209 220
     attachments_list = []
210 221
     for attachment in attachments:
@@ -292,6 +303,7 @@ def _get_document_for_json(doc, addLocaleToTitle=False):
292 303
 
293 304
 @csrf_exempt
294 305
 @require_http_methods(['GET', 'PUT', 'HEAD'])
  306
+@allow_CORS_GET
295 307
 @accepts_auth_key
296 308
 @process_document_path
297 309
 @condition(last_modified_func=_document_last_modified)
@@ -1246,6 +1258,7 @@ def preview_revision(request):
1246 1258
 
1247 1259
 
1248 1260
 @require_GET
  1261
+@allow_CORS_GET
1249 1262
 @process_document_path
1250 1263
 def get_children(request, document_slug, document_locale):
1251 1264
     """Retrieves a document and returns its children in a JSON structure"""
@@ -1287,6 +1300,7 @@ def _make_doc_structure(d, level):
1287 1300
 
1288 1301
 
1289 1302
 @require_GET
  1303
+@allow_CORS_GET
1290 1304
 def autosuggest_documents(request):
1291 1305
     """Returns the closest title matches for front-end autosuggests"""
1292 1306
     partial_title = request.GET.get('term', '')
@@ -1678,6 +1692,7 @@ def unwatch_approved(request):
1678 1692
 
1679 1693
 
1680 1694
 @require_GET
  1695
+@allow_CORS_GET
1681 1696
 @process_document_path
1682 1697
 @prevent_indexing
1683 1698
 def json_view(request, document_slug=None, document_locale=None):
@@ -1705,6 +1720,7 @@ def json_view(request, document_slug=None, document_locale=None):
1705 1720
 
1706 1721
 
1707 1722
 @require_GET
  1723
+@allow_CORS_GET
1708 1724
 @process_document_path
1709 1725
 @prevent_indexing
1710 1726
 def toc_view(request, document_slug=None, document_locale=None):
@@ -1734,6 +1750,7 @@ def toc_view(request, document_slug=None, document_locale=None):
1734 1750
 
1735 1751
 
1736 1752
 @require_GET
  1753
+@allow_CORS_GET
1737 1754
 @process_document_path
1738 1755
 def code_sample(request, document_slug, document_locale, sample_id):
1739 1756
     """Extract a code sample from a document and render it as a standalone
1  configs/htaccess-without-mindtouch
@@ -29,7 +29,6 @@ RewriteRule ^En/JavaScript/Reference/Objects$ en-US/docs/JavaScript/Reference/Gl
29 29
 RewriteRule ^En/Core_JavaScript_1\.5_Reference/Objects/(.*) en-US/docs/JavaScript/Reference/Global_Objects/$1 [R=301,L,NC]
30 30
 RewriteRule ^En/Core_JavaScript_1\.5_Reference/(.*) en-US/docs/JavaScript/Reference/$1 [R=301,L,NC]
31 31
 RewriteRule ^([\w\-]*)/HTML5$ $1/docs/HTML/HTML5 [R=301,L,NC]
32  
-RewriteRule ^([\w\-]*)/apps$ $1/docs/apps [R=301,L,NC]
33 32
 RewriteRule web-tech/2008/09/12/css-transforms /docs/CSS/Using_CSS_transforms [R=301,L]
34 33
 
35 34
 # Off-site redirects
3  docs/installation-vagrant.rst
Source Rendered
@@ -72,8 +72,7 @@ Getting up and running
72 72
 
73 73
 -  Add developer-dev.mozilla.org to /etc/hosts::
74 74
 
75  
-       echo '192.168.10.55 developer-local.allizom.org
76  
-       mdn-local.mozillademos.org' >> /etc/hosts
  75
+       echo '192.168.10.55 developer-local.allizom.org mdn-local.mozillademos.org' >> /etc/hosts
77 76
 
78 77
 -  Everything should be working now, from the host side::
79 78
 
354  media/ckeditor/plugins/mdn-maximize/plugin.js
... ...
@@ -0,0 +1,354 @@
  1
+/*
  2
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
  3
+For licensing, see LICENSE.html or http://ckeditor.com/license
  4
+*/
  5
+
  6
+(function()
  7
+{
  8
+	function protectFormStyles( formElement )
  9
+	{
  10
+		if ( !formElement || formElement.type != CKEDITOR.NODE_ELEMENT || formElement.getName() != 'form' )
  11
+			return [];
  12
+
  13
+		var hijackRecord = [],
  14
+			hijackNames = [ 'style', 'className' ];
  15
+		for ( var i = 0 ; i < hijackNames.length ; i++ )
  16
+		{
  17
+			var name = hijackNames[i];
  18
+			var $node = formElement.$.elements.namedItem( name );
  19
+			if ( $node )
  20
+			{
  21
+				var hijackNode = new CKEDITOR.dom.element( $node );
  22
+				hijackRecord.push( [ hijackNode, hijackNode.nextSibling ] );
  23
+				hijackNode.remove();
  24
+			}
  25
+		}
  26
+
  27
+		return hijackRecord;
  28
+	}
  29
+
  30
+	function restoreFormStyles( formElement, hijackRecord )
  31
+	{
  32
+		if ( !formElement || formElement.type != CKEDITOR.NODE_ELEMENT || formElement.getName() != 'form' )
  33
+			return;
  34
+
  35
+		if ( hijackRecord.length > 0 )
  36
+		{
  37
+			for ( var i = hijackRecord.length - 1 ; i >= 0 ; i-- )
  38
+			{
  39
+				var node = hijackRecord[i][0];
  40
+				var sibling = hijackRecord[i][1];
  41
+				if ( sibling )
  42
+					node.insertBefore( sibling );
  43
+				else
  44
+					node.appendTo( formElement );
  45
+			}
  46
+		}
  47
+	}
  48
+
  49
+	function saveStyles( element, isInsideEditor )
  50
+	{
  51
+		var data = protectFormStyles( element );
  52
+		var retval = {};
  53
+
  54
+		var $element = element.$;
  55
+
  56
+		if ( !isInsideEditor )
  57
+		{
  58
+			retval[ 'class' ] = $element.className || '';
  59
+			$element.className = '';
  60
+		}
  61
+
  62
+		retval.inline = $element.style.cssText || '';
  63
+		if ( !isInsideEditor )		// Reset any external styles that might interfere. (#2474)
  64
+			$element.style.cssText = 'position: static; overflow: visible';
  65
+
  66
+		restoreFormStyles( data );
  67
+		return retval;
  68
+	}
  69
+
  70
+	function restoreStyles( element, savedStyles )
  71
+	{
  72
+		var data = protectFormStyles( element );
  73
+		var $element = element.$;
  74
+		if ( 'class' in savedStyles )
  75
+			$element.className = savedStyles[ 'class' ];
  76
+		if ( 'inline' in savedStyles )
  77
+			$element.style.cssText = savedStyles.inline;
  78
+		restoreFormStyles( data );
  79
+	}
  80
+
  81
+	function refreshCursor( editor )
  82
+	{
  83
+		// Refresh all editor instances on the page (#5724).
  84
+		var all = CKEDITOR.instances;
  85
+		for ( var i in all )
  86
+		{
  87
+			var one = all[ i ];
  88
+			if ( one.mode == 'wysiwyg' && !one.readOnly )
  89
+			{
  90
+				var body = one.document.getBody();
  91
+				// Refresh 'contentEditable' otherwise
  92
+				// DOM lifting breaks design mode. (#5560)
  93
+				body.setAttribute( 'contentEditable', false );
  94
+				body.setAttribute( 'contentEditable', true );
  95
+			}
  96
+		}
  97
+
  98
+		if ( editor.focusManager.hasFocus )
  99
+		{
  100
+			editor.toolbox.focus();
  101
+			editor.focus();
  102
+		}
  103
+	}
  104
+
  105
+	/**
  106
+	 * Adding an iframe shim to this element, OR removing the existing one if already applied.
  107
+	 * Note: This will only affect IE version below 7.
  108
+	 */
  109
+	 function createIframeShim( element )
  110
+	{
  111
+		if ( !CKEDITOR.env.ie || CKEDITOR.env.version > 6 )
  112
+			return null;
  113
+
  114
+		var shim = CKEDITOR.dom.element.createFromHtml( '<iframe frameborder="0" tabindex="-1"' +
  115
+					' src="javascript:' +
  116
+					   'void((function(){' +
  117
+						   'document.open();' +
  118
+						   ( CKEDITOR.env.isCustomDomain() ? 'document.domain=\'' + this.getDocument().$.domain + '\';' : '' ) +
  119
+						   'document.close();' +
  120
+					   '})())"' +
  121
+					' style="display:block;position:absolute;z-index:-1;' +
  122
+					'progid:DXImageTransform.Microsoft.Alpha(opacity=0);' +
  123
+					'"></iframe>' );
  124
+		return element.append( shim, true );
  125
+	}
  126
+
  127
+	CKEDITOR.plugins.add( 'mdn-maximize',
  128
+	{
  129
+		init : function( editor )
  130
+		{
  131
+			var lang = editor.lang;
  132
+			var mainDocument = CKEDITOR.document,
  133
+				mainWindow = mainDocument.getWindow();
  134
+
  135
+			// Saved selection and scroll position for the editing area.
  136
+			var savedSelection,
  137
+				savedScroll;
  138
+
  139
+			// Saved scroll position for the outer window.
  140
+			var outerScroll;
  141
+
  142
+			var shim;
  143
+
  144
+			// Saved resize handler function.
  145
+			function resizeHandler()
  146
+			{
  147
+				var viewPaneSize = mainWindow.getViewPaneSize();
  148
+				shim && shim.setStyles( { width : viewPaneSize.width + 'px', height : viewPaneSize.height + 'px' } );
  149
+				editor.resize( viewPaneSize.width, viewPaneSize.height, null, true );
  150
+			}
  151
+
  152
+			// Retain state after mode switches.
  153
+			var savedState = CKEDITOR.TRISTATE_OFF;
  154
+
  155
+			editor.addCommand( 'maximize',
  156
+				{
  157
+					// Disabled on iOS (#8307).
  158
+					modes : { wysiwyg : !CKEDITOR.env.iOS, source : !CKEDITOR.env.iOS },
  159
+					readOnly : 1,
  160
+					editorFocus : false,
  161
+					exec : function()
  162
+					{
  163
+						var container = editor.container.getChild( 1 );
  164
+						var contents = editor.getThemeSpace( 'contents' );
  165
+
  166
+						// Save current selection and scroll position in editing area.
  167
+						if ( editor.mode == 'wysiwyg' )
  168
+						{
  169
+							var selection = editor.getSelection();
  170
+							savedSelection = selection && selection.getRanges();
  171
+							savedScroll = mainWindow.getScrollPosition();
  172
+						}
  173
+						else
  174
+						{
  175
+							var $textarea = editor.textarea.$;
  176
+							savedSelection = !CKEDITOR.env.ie && [ $textarea.selectionStart, $textarea.selectionEnd ];
  177
+							savedScroll = [ $textarea.scrollLeft, $textarea.scrollTop ];
  178
+						}
  179
+
  180
+						if ( this.state == CKEDITOR.TRISTATE_OFF )		// Go fullscreen if the state is off.
  181
+						{
  182
+							// Add event handler for resizing.
  183
+							mainWindow.on( 'resize', resizeHandler );
  184
+
  185
+							// Save the scroll bar position.
  186
+							outerScroll = mainWindow.getScrollPosition();
  187
+
  188
+							// Save and reset the styles for the entire node tree.
  189
+							var currentNode = editor.container;
  190
+							while ( ( currentNode = currentNode.getParent() ) )
  191
+							{
  192
+								currentNode.setCustomData( 'maximize_saved_styles', saveStyles( currentNode ) );
  193
+								currentNode.setStyle( 'z-index', editor.config.baseFloatZIndex - 1 );
  194
+							}
  195
+							contents.setCustomData( 'maximize_saved_styles', saveStyles( contents, true ) );
  196
+							container.setCustomData( 'maximize_saved_styles', saveStyles( container, true ) );
  197
+
  198
+							// Hide scroll bars.
  199
+							var styles =
  200
+								{
  201
+									overflow : CKEDITOR.env.webkit ? '' : 'hidden',		// #6896
  202
+									width : 0,
  203
+									height : 0
  204
+								};
  205
+
  206
+							mainDocument.getDocumentElement().setStyles( styles );
  207
+							!CKEDITOR.env.gecko && mainDocument.getDocumentElement().setStyle( 'position', 'fixed' );
  208
+							!( CKEDITOR.env.gecko && CKEDITOR.env.quirks ) && mainDocument.getBody().setStyles( styles );
  209
+
  210
+							// Scroll to the top left (IE needs some time for it - #4923).
  211
+							CKEDITOR.env.ie ?
  212
+								setTimeout( function() { mainWindow.$.scrollTo( 0, 0 ); }, 0 ) :
  213
+								mainWindow.$.scrollTo( 0, 0 );
  214
+
  215
+							// Resize and move to top left.
  216
+							// Special treatment for FF Quirks (#7284)
  217
+							container.setStyle( 'position', CKEDITOR.env.gecko && CKEDITOR.env.quirks ? 'fixed' : 'absolute' );
  218
+							container.$.offsetLeft;			// SAFARI BUG: See #2066.
  219
+							container.setStyles(
  220
+								{
  221
+									'z-index' : editor.config.baseFloatZIndex - 1,
  222
+									left : '0px',
  223
+									top : '0px'
  224
+								} );
  225
+
  226
+							shim =  createIframeShim( container );		// IE6 select element penetration when maximized. (#4459)
  227
+
  228
+							// Add cke_maximized class before resize handle since that will change things sizes (#5580)
  229
+							container.addClass( 'cke_maximized' );
  230
+							jQuery(document.body).addClass('cke_maximized_editor');
  231
+							setTimeout(resizeHandler, 50);
  232
+
  233
+							// Still not top left? Fix it. (Bug #174)
  234
+							var offset = container.getDocumentPosition();
  235
+							container.setStyles(
  236
+								{
  237
+									left : ( -1 * offset.x ) + 'px',
  238
+									top : ( -1 * offset.y ) + 'px'
  239
+								} );
  240
+
  241
+							// Fixing positioning editor chrome in Firefox break design mode. (#5149)
  242
+							CKEDITOR.env.gecko && refreshCursor( editor );
  243
+
  244
+						}
  245
+						else if ( this.state == CKEDITOR.TRISTATE_ON )	// Restore from fullscreen if the state is on.
  246
+						{
  247
+							// Remove event handler for resizing.
  248
+							mainWindow.removeListener( 'resize', resizeHandler );
  249
+
  250
+							// Restore CSS styles for the entire node tree.
  251
+							var editorElements = [ contents, container ];
  252
+							for ( var i = 0 ; i < editorElements.length ; i++ )
  253
+							{
  254
+								restoreStyles( editorElements[i], editorElements[i].getCustomData( 'maximize_saved_styles' ) );
  255
+								editorElements[i].removeCustomData( 'maximize_saved_styles' );
  256
+							}
  257
+
  258
+							currentNode = editor.container;
  259
+							while ( ( currentNode = currentNode.getParent() ) )
  260
+							{
  261
+								restoreStyles( currentNode, currentNode.getCustomData( 'maximize_saved_styles' ) );
  262
+								currentNode.removeCustomData( 'maximize_saved_styles' );
  263
+							}
  264
+
  265
+							// Restore the window scroll position.
  266
+							CKEDITOR.env.ie ?
  267
+								setTimeout( function() { mainWindow.$.scrollTo( outerScroll.x, outerScroll.y ); }, 0 ) :
  268
+								mainWindow.$.scrollTo( outerScroll.x, outerScroll.y );
  269
+
  270
+							// Remove cke_maximized class.
  271
+							container.removeClass( 'cke_maximized' );
  272
+							jQuery(document.body).removeClass('cke_maximized_editor');
  273
+
  274
+							// Webkit requires a re-layout on editor chrome. (#6695)
  275
+							if ( CKEDITOR.env.webkit )
  276
+							{
  277
+								container.setStyle( 'display', 'inline' );
  278
+								setTimeout( function(){ container.setStyle( 'display', 'block' ); }, 0 );
  279
+							}
  280
+
  281
+							if ( shim )
  282
+							{
  283
+								shim.remove();
  284
+								shim = null;
  285
+							}
  286
+
  287
+							// Emit a resize event, because this time the size is modified in
  288
+							// restoreStyles.
  289
+							editor.fire( 'resize' );
  290
+						}
  291
+
  292
+						this.toggleState();
  293
+
  294
+						// Toggle button label.
  295
+						var button = this.uiItems[ 0 ];
  296
+						// Only try to change the button if it exists (#6166)
  297
+						if( button )
  298
+						{
  299
+							var label = ( this.state == CKEDITOR.TRISTATE_OFF )
  300
+								? lang.maximize : lang.minimize;
  301
+							var buttonNode = editor.element.getDocument().getById( button._.id );
  302
+							buttonNode.getChild( 1 ).setHtml( label );
  303
+							buttonNode.setAttribute( 'title', label );
  304
+							buttonNode.setAttribute( 'href', 'javascript:void("' + label + '");' );
  305
+						}
  306
+
  307
+						// Restore selection and scroll position in editing area.
  308
+						if ( editor.mode == 'wysiwyg' )
  309
+						{
  310
+							if ( savedSelection )
  311
+							{
  312
+								// Fixing positioning editor chrome in Firefox break design mode. (#5149)
  313
+								CKEDITOR.env.gecko && refreshCursor( editor );
  314
+
  315
+								editor.getSelection().selectRanges(savedSelection);
  316
+								var element = editor.getSelection().getStartElement();
  317
+								element && element.scrollIntoView( true );
  318
+							}
  319
+
  320
+							else
  321
+								mainWindow.$.scrollTo( savedScroll.x, savedScroll.y );
  322
+						}
  323
+						else
  324
+						{
  325
+							if ( savedSelection )
  326
+							{
  327
+								$textarea.selectionStart = savedSelection[0];
  328
+								$textarea.selectionEnd = savedSelection[1];
  329
+							}
  330
+							$textarea.scrollLeft = savedScroll[0];
  331
+							$textarea.scrollTop = savedScroll[1];
  332
+						}
  333
+
  334
+						savedSelection = savedScroll = null;
  335
+						savedState = this.state;
  336
+					},
  337
+					canUndo : false
  338
+				} );
  339
+
  340
+			editor.ui.addButton( 'Maximize',
  341
+				{
  342
+					label : lang.maximize,
  343
+					command : 'maximize'
  344
+				} );
  345
+
  346
+			// Restore the command state after mode change, unless it has been changed to disabled (#6467)
  347
+			editor.on( 'mode', function()
  348
+				{
  349
+					var command = editor.getCommand( 'maximize' );
  350
+					command.setState( command.state == CKEDITOR.TRISTATE_DISABLED ? CKEDITOR.TRISTATE_DISABLED : savedState );
  351
+				}, null, null, 100 );
  352
+		}
  353
+	} );
  354
+})();
12  media/css/wiki-screen.css
@@ -532,6 +532,18 @@ td.diff_header {
532 532
   height: 280px !important;
533 533
 }
534 534
 
  535
+/* Fixes autogrow + maximize issues */
  536
+.cke_maximized_editor #content-fields header {
  537
+  position: fixed !important;
  538
+  top: -200px !important;
  539
+}
  540
+.cke_maximized_editor div.cke_toolbox {
  541
+  position: relative !important;
  542
+  top: auto !important;
  543
+  width: auto !important;
  544
+}
  545
+
  546
+
535 547
 /* HTabs - Compatibility Tables */
536 548
 .htab { margin: auto; display: inline-block; width: auto; }
537 549
 .htab > ul > li { background-image: none; width:150px; height:30px; list-style-type:none; display:inline; padding-bottom:3px; border: 1px solid #ddd; padding-top:5px; text-align:left; font-size:13px; font-weight:bold; margin:auto; position:relative; padding-left:6px; padding-right:6px; border-bottom:none; opacity:.5; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50); cursor:pointer; }
8  media/js/wiki_ckeditor_translate.js
... ...
@@ -1,6 +1,7 @@
1 1
 (function ($) {
2 2
 
3  
-  var $body = $("body");
  3
+  var $body = $("body"),
  4
+      $window = $(window);
4 5
 
5 6
   // Callback functions after CKE is ready
6 7
   var setup_ckeditor = function () {
@@ -11,7 +12,6 @@
11 12
         $transcont = $("#content-fields"),
12 13
         $tools     = $("div.cke_toolbox"),
13 14
         $wikiArt   = $("#cke_wikiArticle"),
14  
-        $window    = $(window),
15 15
         contentTop = $("#content").offset(),
16 16
         transTop   = $transcont.offset(),
17 17
         headHeight = $head.height(),
@@ -23,8 +23,8 @@
23 23
     // Switch header and toolbar styles on scroll to keep them on screen
24 24
     $window.scroll(function() {
25 25
 
26  
-      var scrollTop = $window.scrollTop();
27  
-      transTop   = $transcont.offset();
  26
+      var scrollTop = $window.scrollTop(),
  27
+          transTop  = $transcont.offset();
28 28
           
29 29
     	if( scrollTop >= contentTop.top ) {
30 30
         if( !fixed ) {

No commit comments for this range

Something went wrong with that request. Please try again.