https://www.mediawiki.org/wiki/Special:Code/MediaWiki/106249
Revision: 106249
Author: neilk
Date: 2011-12-14 21:58:49 +0000 (Wed, 14 Dec 2011)
Log Message:
-----------
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/VisualEditor.php
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/models/es.DocumentModel.js
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/tools/es.AnnotationButtonTool.js
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/sandbox/base.php
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/sandbox/special.js
Property Changed:
----------------
branches/wmf/1.18wmf1/extensions/VisualEditor/
Property changes on: branches/wmf/1.18wmf1/extensions/VisualEditor
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/REL1_15/phase3/extensions/VisualEditor:51646
/branches/REL1_17/phase3/extensions/VisualEditor:81445,81448
/branches/REL1_18/extensions/VisualEditor:101758,103190
/branches/new-installer/phase3/extensions/VisualEditor:43664-66004
/branches/sqlite/extensions/VisualEditor:58211-58321
/trunk/extensions/VisualEditor:99592,99653,100092,100419,100686,100692,100699,103669,104337,104736,104863,106123-106124,106127,106157,106224,106230
/trunk/phase3/extensions/VisualEditor:92580,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
Modified: branches/wmf/1.18wmf1/extensions/VisualEditor/VisualEditor.php
===================================================================
--- branches/wmf/1.18wmf1/extensions/VisualEditor/VisualEditor.php
2011-12-14 21:53:47 UTC (rev 106248)
+++ branches/wmf/1.18wmf1/extensions/VisualEditor/VisualEditor.php
2011-12-14 21:58:49 UTC (rev 106249)
@@ -57,6 +57,7 @@
'dependencies' => array(
'ext.visualEditor.sandbox',
'mediawiki.feedback',
+ 'mediawiki.Uri',
)
),
'ext.visualEditor.sandbox' => $wgVisualEditorResourceTemplate + array(
Modified:
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/models/es.DocumentModel.js
===================================================================
---
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/models/es.DocumentModel.js
2011-12-14 21:53:47 UTC (rev 106248)
+++
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/models/es.DocumentModel.js
2011-12-14 21:58:49 UTC (rev 106249)
@@ -682,11 +682,11 @@
* @param {Object} annotation Annotation to test for coverage with
* @returns {es.Range|null} Range of content covered by annotation, or null if
offset is not covered
*/
-es.DocumentModel.prototype.getAnnotationBoundaries = function( offset,
annotation ) {
+es.DocumentModel.prototype.getAnnotationBoundaries = function( offset,
annotation, typeOnly ) {
if ( annotation.hash === undefined ) {
annotation.hash = es.DocumentModel.getHash( annotation );
}
- if ( es.DocumentModel.getIndexOfAnnotation( this.data[offset],
annotation ) === -1 ) {
+ if ( es.DocumentModel.getIndexOfAnnotation( this.data[offset],
annotation, typeOnly ) === -1 ) {
return null;
}
var start = offset,
@@ -694,13 +694,13 @@
item;
while ( start > 0 ) {
start--;
- if ( es.DocumentModel.getIndexOfAnnotation( this.data[start],
annotation ) === -1 ) {
+ if ( es.DocumentModel.getIndexOfAnnotation( this.data[start],
annotation, typeOnly ) === -1 ) {
start++;
break;
}
}
while ( end < this.data.length ) {
- if ( es.DocumentModel.getIndexOfAnnotation( this.data[end],
annotation ) === -1 ) {
+ if ( es.DocumentModel.getIndexOfAnnotation( this.data[end],
annotation, typeOnly ) === -1 ) {
break;
}
end++;
Modified:
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/tools/es.AnnotationButtonTool.js
===================================================================
---
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/tools/es.AnnotationButtonTool.js
2011-12-14 21:53:47 UTC (rev 106248)
+++
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/tools/es.AnnotationButtonTool.js
2011-12-14 21:58:49 UTC (rev 106249)
@@ -26,8 +26,13 @@
if ( surfaceView.getModel().getSelection().getLength() ) {
this.toolbar.getSurfaceView().getContextView().openInspector( this.inspector );
} else {
- if ( !this.active ) {
- surfaceView.annotate( 'set', this.annotation );
+ if ( this.active ) {
+ var surfaceModel = surfaceView.getModel(),
+ documentModel =
surfaceModel.getDocument(),
+ selection = surfaceModel.getSelection(),
+ range =
documentModel.getAnnotationBoundaries( selection.from, this.annotation, true );
+ surfaceModel.select( range );
+
this.toolbar.getSurfaceView().getContextView().openInspector( this.inspector );
}
}
} else {
Modified:
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
===================================================================
---
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
2011-12-14 21:53:47 UTC (rev 106248)
+++
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
2011-12-14 21:58:49 UTC (rev 106249)
@@ -23,7 +23,7 @@
this.$ = $container
.addClass( 'es-surfaceView' )
.append( this.documentView.$ );
- this.$input = $( '<textarea class="es-surfaceView-textarea" />' )
+ this.$input = $( '<textarea class="es-surfaceView-textarea"
autocapitalize="off" />' )
.appendTo( 'body' );
this.$cursor = $( '<div class="es-surfaceView-cursor"></div>' )
.appendTo( 'body' );
@@ -132,29 +132,34 @@
}, 0 );
}
} );
- $window.resize( function() {
- // Re-render when resizing horizontally
- // TODO: Instead of re-rendering on every single 'resize' event
wait till user is done with
- // resizing - can be implemented with setTimeout
- _this.hideCursor();
- _this.dimensions.height = $window.height();
- // XXX: This is a dirty hack!
- _this.dimensions.toolbarHeight = $( '#es-toolbar' ).height();
- var width = _this.$.width();
- if ( _this.dimensions.width !== width ) {
- _this.dimensions.width = width;
- _this.documentView.renderContent();
- _this.emitUpdate( 25 );
- }
- } );
- $window.scroll( function() {
- _this.dimensions.scrollTop = $window.scrollTop();
- if ( _this.contextView ) {
- if ( _this.currentSelection.getLength() &&
!_this.mouse.selectingMode ) {
- _this.contextView.set();
- } else {
- _this.contextView.clear();
+ $window.bind( {
+ 'resize': function() {
+ // Re-render when resizing horizontally
+ // TODO: Instead of re-rendering on every single
'resize' event wait till user is done
+ // with resizing - can be implemented with setTimeout
+ _this.hideCursor();
+ _this.dimensions.height = $window.height();
+ // XXX: This is a dirty hack!
+ _this.dimensions.toolbarHeight = $( '#es-toolbar'
).height();
+ var width = _this.$.width();
+ if ( _this.dimensions.width !== width ) {
+ _this.dimensions.width = width;
+ _this.documentView.renderContent();
+ _this.emitUpdate( 25 );
}
+ },
+ 'scroll': function() {
+ _this.dimensions.scrollTop = $window.scrollTop();
+ if ( _this.contextView ) {
+ if ( _this.currentSelection.getLength() &&
!_this.mouse.selectingMode ) {
+ _this.contextView.set();
+ } else {
+ _this.contextView.clear();
+ }
+ }
+ },
+ 'blur': function() {
+ _this.keyboard.keys.shift = false;
}
} );
@@ -626,6 +631,14 @@
case 75:
if (
this.currentSelection.getLength() ) {
this.contextView.openInspector( 'link' );
+ } else {
+ var range =
this.model.getDocument().getAnnotationBoundaries(
+
this.currentSelection.from, { 'type': 'link/internal' }, true
+ );
+ if ( range ) {
+
this.model.select( range );
+
this.contextView.openInspector( 'link' );
+ }
}
return false;
}
Modified: branches/wmf/1.18wmf1/extensions/VisualEditor/modules/sandbox/base.php
===================================================================
--- branches/wmf/1.18wmf1/extensions/VisualEditor/modules/sandbox/base.php
2011-12-14 21:53:47 UTC (rev 106248)
+++ branches/wmf/1.18wmf1/extensions/VisualEditor/modules/sandbox/base.php
2011-12-14 21:58:49 UTC (rev 106249)
@@ -33,21 +33,21 @@
<div
class="es-help-shortcuts-title">Clipboard</div>
<div class="es-help-shortcut">
<span class="es-help-keys">
- <span class="es-help-key">Ctl
<span class="es-help-key-or">or</span> ⌘</span> +
+ <span class="es-help-key">Ctrl
<span class="es-help-key-or">or</span> ⌘</span> +
<span
class="es-help-key">C</span>
</span>
Copy selected text
</div>
<div class="es-help-shortcut">
<span class="es-help-keys">
- <span class="es-help-key">Ctl
<span class="es-help-key-or">or</span> ⌘</span> +
+ <span class="es-help-key">Ctrl
<span class="es-help-key-or">or</span> ⌘</span> +
<span
class="es-help-key">X</span>
</span>
Cut selected text
</div>
<div class="es-help-shortcut">
<span class="es-help-keys">
- <span class="es-help-key">Ctl
<span class="es-help-key-or">or</span> ⌘</span> +
+ <span class="es-help-key">Ctrl
<span class="es-help-key-or">or</span> ⌘</span> +
<span
class="es-help-key">V</span>
</span>
Paste text at the cursor
@@ -55,21 +55,21 @@
<div class="es-help-shortcuts-title">History
navigation</div>
<div class="es-help-shortcut">
<span class="es-help-keys">
- <span class="es-help-key">Ctl
<span class="es-help-key-or">or</span> ⌘</span> +
+ <span class="es-help-key">Ctrl
<span class="es-help-key-or">or</span> ⌘</span> +
<span
class="es-help-key">Z</span>
</span>
Undo
</div>
<div class="es-help-shortcut">
<span class="es-help-keys">
- <span class="es-help-key">Ctl
<span class="es-help-key-or">or</span> ⌘</span> +
+ <span class="es-help-key">Ctrl
<span class="es-help-key-or">or</span> ⌘</span> +
<span
class="es-help-key">Y</span>
</span>
Redo
</div>
<div class="es-help-shortcut">
<span class="es-help-keys">
- <span class="es-help-key">Ctl
<span class="es-help-key-or">or</span> ⌘</span> +
+ <span class="es-help-key">Ctrl
<span class="es-help-key-or">or</span> ⌘</span> +
<span
class="es-help-key">⇧</span> +
<span
class="es-help-key">Z</span>
</span>
@@ -78,21 +78,21 @@
<div
class="es-help-shortcuts-title">Formatting</div>
<div class="es-help-shortcut">
<span class="es-help-keys">
- <span class="es-help-key">Ctl
<span class="es-help-key-or">or</span> ⌘</span> +
+ <span class="es-help-key">Ctrl
<span class="es-help-key-or">or</span> ⌘</span> +
<span
class="es-help-key">B</span>
</span>
Make selected text bold
</div>
<div class="es-help-shortcut">
<span class="es-help-keys">
- <span class="es-help-key">Ctl
<span class="es-help-key-or">or</span> ⌘</span> +
+ <span class="es-help-key">Ctrl
<span class="es-help-key-or">or</span> ⌘</span> +
<span
class="es-help-key">I</span>
</span>
Make selected text italic
</div>
<div class="es-help-shortcut">
<span class="es-help-keys">
- <span class="es-help-key">Ctl
<span class="es-help-key-or">or</span> ⌘</span> +
+ <span class="es-help-key">Ctrl
<span class="es-help-key-or">or</span> ⌘</span> +
<span
class="es-help-key">K</span>
</span>
Make selected text a link
@@ -107,14 +107,14 @@
</div>
<div class="es-help-shortcut">
<span class="es-help-keys">
- <span
class="es-help-key">Alt</span> +
+ <span class="es-help-key">Ctrl
<span class="es-help-key-or">or</span> ⌥</span> +
<span
class="es-help-key">Arrow</span>
</span>
Move cursor by words or blocks
</div>
<div class="es-help-shortcut">
<span class="es-help-keys">
- <span
class="es-help-key">Alt</span> +
+ <span class="es-help-key">Ctrl
<span class="es-help-key-or">or</span> ⌥</span> +
<span
class="es-help-key">⇧</span> +
<span
class="es-help-key">Arrow</span>
</span>
Modified:
branches/wmf/1.18wmf1/extensions/VisualEditor/modules/sandbox/special.js
===================================================================
--- branches/wmf/1.18wmf1/extensions/VisualEditor/modules/sandbox/special.js
2011-12-14 21:53:47 UTC (rev 106248)
+++ branches/wmf/1.18wmf1/extensions/VisualEditor/modules/sandbox/special.js
2011-12-14 21:58:49 UTC (rev 106249)
@@ -6,7 +6,9 @@
var feedback = new mw.Feedback( {
'title': new mw.Title( 'Visual editor/Feedback' ),
- 'dialogTitleMessageKey':
'visualeditor-feedback-dialog-title'
+ 'dialogTitleMessageKey':
'visualeditor-feedback-dialog-title',
+ 'bugsLink': new mw.Uri(
'//bugzilla.wikimedia.org/enter_bug.cgi?product=MediaWiki%20extensions&component=VisualEditor'
),
+ 'bugsListLink': new mw.Uri(
'//bugzilla.wikimedia.org/buglist.cgi?query_format=advanced&component=VisualEditor&resolution=---&resolution=LATER&resolution=DUPLICATE&product=MediaWiki%20extensions'
)
} );
$feedbackLink = $( '<a></a>' )
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs