r106249 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106248‎ | r106249 | r106250 >
Date:21:58, 14 December 2011
Author:neilk
Status:ok
Tags:
Comment:
MFT r106123, r106124, r106127, r106157, r106224, r106230 misc fixes to commonly-reported bugs in VisualEditor, particularly input methods and links
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/VisualEditor (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/VisualEditor/VisualEditor.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/models/es.DocumentModel.js (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/tools/es.AnnotationButtonTool.js (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/views/es.SurfaceView.js (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/VisualEditor/modules/sandbox/base.php (modified) (history)
  • /branches/wmf/1.18wmf1/extensions/VisualEditor/modules/sandbox/special.js (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/VisualEditor/VisualEditor.php
@@ -57,6 +57,7 @@
5858 'dependencies' => array(
5959 'ext.visualEditor.sandbox',
6060 'mediawiki.feedback',
 61+ 'mediawiki.Uri',
6162 )
6263 ),
6364 'ext.visualEditor.sandbox' => $wgVisualEditorResourceTemplate + array(
Index: branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/tools/es.AnnotationButtonTool.js
@@ -26,8 +26,13 @@
2727 if ( surfaceView.getModel().getSelection().getLength() ) {
2828 this.toolbar.getSurfaceView().getContextView().openInspector( this.inspector );
2929 } else {
30 - if ( !this.active ) {
31 - surfaceView.annotate( 'set', this.annotation );
 30+ if ( this.active ) {
 31+ var surfaceModel = surfaceView.getModel(),
 32+ documentModel = surfaceModel.getDocument(),
 33+ selection = surfaceModel.getSelection(),
 34+ range = documentModel.getAnnotationBoundaries( selection.from, this.annotation, true );
 35+ surfaceModel.select( range );
 36+ this.toolbar.getSurfaceView().getContextView().openInspector( this.inspector );
3237 }
3338 }
3439 } else {
Index: branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/models/es.DocumentModel.js
@@ -682,11 +682,11 @@
683683 * @param {Object} annotation Annotation to test for coverage with
684684 * @returns {es.Range|null} Range of content covered by annotation, or null if offset is not covered
685685 */
686 -es.DocumentModel.prototype.getAnnotationBoundaries = function( offset, annotation ) {
 686+es.DocumentModel.prototype.getAnnotationBoundaries = function( offset, annotation, typeOnly ) {
687687 if ( annotation.hash === undefined ) {
688688 annotation.hash = es.DocumentModel.getHash( annotation );
689689 }
690 - if ( es.DocumentModel.getIndexOfAnnotation( this.data[offset], annotation ) === -1 ) {
 690+ if ( es.DocumentModel.getIndexOfAnnotation( this.data[offset], annotation, typeOnly ) === -1 ) {
691691 return null;
692692 }
693693 var start = offset,
@@ -694,13 +694,13 @@
695695 item;
696696 while ( start > 0 ) {
697697 start--;
698 - if ( es.DocumentModel.getIndexOfAnnotation( this.data[start], annotation ) === -1 ) {
 698+ if ( es.DocumentModel.getIndexOfAnnotation( this.data[start], annotation, typeOnly ) === -1 ) {
699699 start++;
700700 break;
701701 }
702702 }
703703 while ( end < this.data.length ) {
704 - if ( es.DocumentModel.getIndexOfAnnotation( this.data[end], annotation ) === -1 ) {
 704+ if ( es.DocumentModel.getIndexOfAnnotation( this.data[end], annotation, typeOnly ) === -1 ) {
705705 break;
706706 }
707707 end++;
Index: branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
@@ -23,7 +23,7 @@
2424 this.$ = $container
2525 .addClass( 'es-surfaceView' )
2626 .append( this.documentView.$ );
27 - this.$input = $( '<textarea class="es-surfaceView-textarea" />' )
 27+ this.$input = $( '<textarea class="es-surfaceView-textarea" autocapitalize="off" />' )
2828 .appendTo( 'body' );
2929 this.$cursor = $( '<div class="es-surfaceView-cursor"></div>' )
3030 .appendTo( 'body' );
@@ -132,29 +132,34 @@
133133 }, 0 );
134134 }
135135 } );
136 - $window.resize( function() {
137 - // Re-render when resizing horizontally
138 - // TODO: Instead of re-rendering on every single 'resize' event wait till user is done with
139 - // resizing - can be implemented with setTimeout
140 - _this.hideCursor();
141 - _this.dimensions.height = $window.height();
142 - // XXX: This is a dirty hack!
143 - _this.dimensions.toolbarHeight = $( '#es-toolbar' ).height();
144 - var width = _this.$.width();
145 - if ( _this.dimensions.width !== width ) {
146 - _this.dimensions.width = width;
147 - _this.documentView.renderContent();
148 - _this.emitUpdate( 25 );
149 - }
150 - } );
151 - $window.scroll( function() {
152 - _this.dimensions.scrollTop = $window.scrollTop();
153 - if ( _this.contextView ) {
154 - if ( _this.currentSelection.getLength() && !_this.mouse.selectingMode ) {
155 - _this.contextView.set();
156 - } else {
157 - _this.contextView.clear();
 136+ $window.bind( {
 137+ 'resize': function() {
 138+ // Re-render when resizing horizontally
 139+ // TODO: Instead of re-rendering on every single 'resize' event wait till user is done
 140+ // with resizing - can be implemented with setTimeout
 141+ _this.hideCursor();
 142+ _this.dimensions.height = $window.height();
 143+ // XXX: This is a dirty hack!
 144+ _this.dimensions.toolbarHeight = $( '#es-toolbar' ).height();
 145+ var width = _this.$.width();
 146+ if ( _this.dimensions.width !== width ) {
 147+ _this.dimensions.width = width;
 148+ _this.documentView.renderContent();
 149+ _this.emitUpdate( 25 );
158150 }
 151+ },
 152+ 'scroll': function() {
 153+ _this.dimensions.scrollTop = $window.scrollTop();
 154+ if ( _this.contextView ) {
 155+ if ( _this.currentSelection.getLength() && !_this.mouse.selectingMode ) {
 156+ _this.contextView.set();
 157+ } else {
 158+ _this.contextView.clear();
 159+ }
 160+ }
 161+ },
 162+ 'blur': function() {
 163+ _this.keyboard.keys.shift = false;
159164 }
160165 } );
161166
@@ -626,6 +631,14 @@
627632 case 75:
628633 if ( this.currentSelection.getLength() ) {
629634 this.contextView.openInspector( 'link' );
 635+ } else {
 636+ var range = this.model.getDocument().getAnnotationBoundaries(
 637+ this.currentSelection.from, { 'type': 'link/internal' }, true
 638+ );
 639+ if ( range ) {
 640+ this.model.select( range );
 641+ this.contextView.openInspector( 'link' );
 642+ }
630643 }
631644 return false;
632645 }
Index: branches/wmf/1.18wmf1/extensions/VisualEditor/modules/sandbox/base.php
@@ -33,21 +33,21 @@
3434 <div class="es-help-shortcuts-title">Clipboard</div>
3535 <div class="es-help-shortcut">
3636 <span class="es-help-keys">
37 - <span class="es-help-key">Ctl <span class="es-help-key-or">or</span> &#8984;</span> +
 37+ <span class="es-help-key">Ctrl <span class="es-help-key-or">or</span> &#8984;</span> +
3838 <span class="es-help-key">C</span>
3939 </span>
4040 Copy selected text
4141 </div>
4242 <div class="es-help-shortcut">
4343 <span class="es-help-keys">
44 - <span class="es-help-key">Ctl <span class="es-help-key-or">or</span> &#8984;</span> +
 44+ <span class="es-help-key">Ctrl <span class="es-help-key-or">or</span> &#8984;</span> +
4545 <span class="es-help-key">X</span>
4646 </span>
4747 Cut selected text
4848 </div>
4949 <div class="es-help-shortcut">
5050 <span class="es-help-keys">
51 - <span class="es-help-key">Ctl <span class="es-help-key-or">or</span> &#8984;</span> +
 51+ <span class="es-help-key">Ctrl <span class="es-help-key-or">or</span> &#8984;</span> +
5252 <span class="es-help-key">V</span>
5353 </span>
5454 Paste text at the cursor
@@ -55,21 +55,21 @@
5656 <div class="es-help-shortcuts-title">History navigation</div>
5757 <div class="es-help-shortcut">
5858 <span class="es-help-keys">
59 - <span class="es-help-key">Ctl <span class="es-help-key-or">or</span> &#8984;</span> +
 59+ <span class="es-help-key">Ctrl <span class="es-help-key-or">or</span> &#8984;</span> +
6060 <span class="es-help-key">Z</span>
6161 </span>
6262 Undo
6363 </div>
6464 <div class="es-help-shortcut">
6565 <span class="es-help-keys">
66 - <span class="es-help-key">Ctl <span class="es-help-key-or">or</span> &#8984;</span> +
 66+ <span class="es-help-key">Ctrl <span class="es-help-key-or">or</span> &#8984;</span> +
6767 <span class="es-help-key">Y</span>
6868 </span>
6969 Redo
7070 </div>
7171 <div class="es-help-shortcut">
7272 <span class="es-help-keys">
73 - <span class="es-help-key">Ctl <span class="es-help-key-or">or</span> &#8984;</span> +
 73+ <span class="es-help-key">Ctrl <span class="es-help-key-or">or</span> &#8984;</span> +
7474 <span class="es-help-key">&#8679;</span> +
7575 <span class="es-help-key">Z</span>
7676 </span>
@@ -78,21 +78,21 @@
7979 <div class="es-help-shortcuts-title">Formatting</div>
8080 <div class="es-help-shortcut">
8181 <span class="es-help-keys">
82 - <span class="es-help-key">Ctl <span class="es-help-key-or">or</span> &#8984;</span> +
 82+ <span class="es-help-key">Ctrl <span class="es-help-key-or">or</span> &#8984;</span> +
8383 <span class="es-help-key">B</span>
8484 </span>
8585 Make selected text bold
8686 </div>
8787 <div class="es-help-shortcut">
8888 <span class="es-help-keys">
89 - <span class="es-help-key">Ctl <span class="es-help-key-or">or</span> &#8984;</span> +
 89+ <span class="es-help-key">Ctrl <span class="es-help-key-or">or</span> &#8984;</span> +
9090 <span class="es-help-key">I</span>
9191 </span>
9292 Make selected text italic
9393 </div>
9494 <div class="es-help-shortcut">
9595 <span class="es-help-keys">
96 - <span class="es-help-key">Ctl <span class="es-help-key-or">or</span> &#8984;</span> +
 96+ <span class="es-help-key">Ctrl <span class="es-help-key-or">or</span> &#8984;</span> +
9797 <span class="es-help-key">K</span>
9898 </span>
9999 Make selected text a link
@@ -107,14 +107,14 @@
108108 </div>
109109 <div class="es-help-shortcut">
110110 <span class="es-help-keys">
111 - <span class="es-help-key">Alt</span> +
 111+ <span class="es-help-key">Ctrl <span class="es-help-key-or">or</span> &#x2325;</span> +
112112 <span class="es-help-key">Arrow</span>
113113 </span>
114114 Move cursor by words or blocks
115115 </div>
116116 <div class="es-help-shortcut">
117117 <span class="es-help-keys">
118 - <span class="es-help-key">Alt</span> +
 118+ <span class="es-help-key">Ctrl <span class="es-help-key-or">or</span> &#x2325;</span> +
119119 <span class="es-help-key">&#8679;</span> +
120120 <span class="es-help-key">Arrow</span>
121121 </span>
Index: branches/wmf/1.18wmf1/extensions/VisualEditor/modules/sandbox/special.js
@@ -6,7 +6,9 @@
77
88 var feedback = new mw.Feedback( {
99 'title': new mw.Title( 'Visual editor/Feedback' ),
10 - 'dialogTitleMessageKey': 'visualeditor-feedback-dialog-title'
 10+ 'dialogTitleMessageKey': 'visualeditor-feedback-dialog-title',
 11+ 'bugsLink': new mw.Uri( '//bugzilla.wikimedia.org/enter_bug.cgi?product=MediaWiki%20extensions&component=VisualEditor' ),
 12+ 'bugsListLink': new mw.Uri( '//bugzilla.wikimedia.org/buglist.cgi?query_format=advanced&component=VisualEditor&resolution=---&resolution=LATER&resolution=DUPLICATE&product=MediaWiki%20extensions' )
1113 } );
1214
1315 $feedbackLink = $( '<a></a>' )
Property changes on: branches/wmf/1.18wmf1/extensions/VisualEditor
___________________________________________________________________
Added: svn:mergeinfo
1416 Merged /branches/new-installer/phase3/extensions/VisualEditor:r43664-66004
1517 Merged /branches/REL1_15/phase3/extensions/VisualEditor:r51646
1618 Merged /branches/REL1_18/extensions/VisualEditor:r101758,103190
1719 Merged /branches/REL1_17/phase3/extensions/VisualEditor:r81445,81448
1820 Merged /trunk/extensions/VisualEditor:r99592,99653,100092,100419,100686,100692,100699,103669,104337,104736,104863,106123-106124,106127,106157,106224,106230
1921 Merged /branches/sqlite/extensions/VisualEditor:r58211-58321
2022 Merged /trunk/phase3/extensions/VisualEditor:r92580,92634,92713,92762,92765,92791,92854,92884,92886-92887,92894,92898,92907,92932,92958,93141,93149,93151,93233-93234,93258,93266,93303,93516-93518,93520,93818-93822,93847,93858,93891,93935-93936,94058,94062,94068,94107,94155,94235,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94995-94997,95023,95042,95072-95073,95155,95327,95332,95410,95422,95426,95442,95468,95601,95812,98578,98598,98656

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106123- Added auto-link selection when opening the link editor without selecting an...tparscal23:12, 13 December 2011
r106124Fixes issue with r106123 where creating new links wasn't working anymore with...tparscal23:15, 13 December 2011
r106127Added blur handler for window which resets the shift key trackertparscal23:22, 13 December 2011
r106157add buglist ang bug reporting links to feedback formneilk01:32, 14 December 2011
r106224Added autocapitalize="off" attribute to text area input so IOS doesn't capita...tparscal18:54, 14 December 2011
r106230Fixed help panel content where we claimed the alt key was to be used for word...tparscal19:15, 14 December 2011

Status & tagging log