r110908 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110907‎ | r110908 | r110909 >
Date:02:12, 8 February 2012
Author:christian
Status:deferred
Tags:
Comment:
cut support
Modified paths:
  • /trunk/extensions/VisualEditor/demos/ce/main.js (modified) (history)
  • /trunk/extensions/VisualEditor/modules/ve/ce/ve.es.Surface.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/demos/ce/main.js
@@ -8,12 +8,76 @@
99 'content': { 'text': 'Having real-world metaphors for objects and actions can make it easier for a user to learn and use an interface (some might say that the interface is more natural or intuitive), and rapid, incremental feedback allows a user to make fewer errors and complete tasks in less time, because they can see the results of an action before completing the action, thus evaluating the output and compensating for mistakes.' }
1010 },
1111 {
 12+ 'type': 'table',
 13+ 'attributes': { 'html/style': 'width: 300px; float: left; margin: 0 1em 1em 0; border: solid 1px;' },
 14+ 'children': [
 15+ {
 16+ 'type': 'tableRow',
 17+ 'children': [
 18+ {
 19+ 'type': 'tableCell',
 20+ 'attributes': { 'html/style': 'border: solid 1px;' },
 21+ 'children': [
 22+ {
 23+ 'type': 'paragraph',
 24+ 'content': { 'text': 'row 1 & cell 1' }
 25+ }
 26+ ]
 27+ },
 28+ {
 29+ 'type': 'tableCell',
 30+ 'attributes': { 'html/style': 'border: solid 1px;' },
 31+ 'children': [
 32+ {
 33+ 'type': 'paragraph',
 34+ 'content': { 'text': 'row 1 & cell 2' }
 35+ }
 36+ ]
 37+ }
 38+ ]
 39+ },
 40+ {
 41+ 'type': 'tableRow',
 42+ 'children': [
 43+ {
 44+ 'type': 'tableCell',
 45+ 'attributes': { 'html/style': 'border: solid 1px;' },
 46+ 'children': [
 47+ {
 48+ 'type': 'paragraph',
 49+ 'content': { 'text': 'row 2 & cell 1' }
 50+ }
 51+ ]
 52+ },
 53+ {
 54+ 'type': 'tableCell',
 55+ 'attributes': { 'html/style': 'border: solid 1px;' },
 56+ 'children': [
 57+ {
 58+ 'type': 'paragraph',
 59+ 'content': { 'text': 'row 2 & cell 2' }
 60+ }
 61+ ]
 62+ }
 63+ ]
 64+ }
 65+ ]
 66+ },
 67+ {
1268 'type': 'paragraph',
1369 'content': { 'text': 'Test 1' }
1470 },
1571 {
1672 'type': 'paragraph',
1773 'content': { 'text': 'Test 2' }
 74+ },
 75+ {
 76+ 'type': 'paragraph',
 77+ 'content': { 'text': 'Having real-world metaphors for objects and actions can make it easier for a user to learn and use an interface (some might say that the interface is more natural or intuitive), and rapid, incremental feedback allows a user to make fewer errors and complete tasks in less time, because they can see the results of an action before completing the action, thus evaluating the output and compensating for mistakes.' }
 78+ },
 79+ {
 80+ 'type': 'paragraph',
 81+ 'content': { 'text': 'Having real-world metaphors for objects and actions can make it easier for a user to learn and use an interface (some might say that the interface is more natural or intuitive), and rapid, incremental feedback allows a user to make fewer errors and complete tasks in less time, because they can see the results of an action before completing the action, thus evaluating the output and compensating for mistakes.' }
1882 }
1983 ]
2084 },
Index: trunk/extensions/VisualEditor/modules/ve/ce/ve.es.Surface.js
@@ -37,27 +37,25 @@
3838 _this.paste[key] = ve.copyArray( _this.documentView.model.getData( _this.getSelection() ) );
3939
4040 if (event.type == 'cut') {
41 - //not supported yet
42 - return;
43 -
44 - var range = _this.getSelection();
45 - if ( range.start != range.end ) {
46 - event.preventDefault();
47 - var tx = _this.model.getDocument().prepareRemoval( range );
48 - _this.model.transact( tx );
49 - }
 41+ var selection = _this.getSelection();
5042
 43+ setTimeout(function() {
 44+ var tx = _this.model.getDocument().prepareRemoval( selection );
 45+ _this.model.transact( tx );
 46+ _this.showCursorAt(selection.start);
 47+ }, 1);
5148 }
 49+
5250 })
5351 .on('beforepaste paste', function(event) {
54 - var insertionPoint = _this.getSelection().to;
 52+ var insertionPoint = _this.getSelection().start;
5553
5654 $('#paste').html('');
5755 $('#paste').focus();
5856
5957 setTimeout(function() {
6058 var key = $('#paste').text().replace(/( |\r\n|\n|\r|\t)/gm,"");
61 -
 59+
6260 if (_this.paste[key]) {
6361 var tx = _this.documentView.model.prepareInsertion( insertionPoint, _this.paste[key]);
6462 _this.documentView.model.commit(tx);

Status & tagging log