https://www.mediawiki.org/wiki/Special:Code/MediaWiki/103414
Revision: 103414
Author: inez
Date: 2011-11-16 23:34:58 +0000 (Wed, 16 Nov 2011)
Log Message:
-----------
Added support for enter key in elements with attributes - like headings,
listitems.
Modified Paths:
--------------
trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
Modified: trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
===================================================================
--- trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
2011-11-16 23:33:33 UTC (rev 103413)
+++ trunk/extensions/VisualEditor/modules/es/views/es.SurfaceView.js
2011-11-16 23:34:58 UTC (rev 103414)
@@ -364,9 +364,13 @@
while ( node ) {
nodeType = node.getElementType();
- stack.push(nodeType);
+ stack.splice(
+ stack.length / 2,
+ 0,
+ { 'type': '/' + nodeType },
+ { 'type': nodeType,
'attributes': es.copyObject( node.element.attributes ) }
+ );
node = node.getParent();
-
if ( es.DocumentView.splitRules[
nodeType ].self === true ) {
nodeType =
node.getElementType();
if (
es.DocumentView.splitRules[ nodeType ].children === true) {
@@ -374,16 +378,8 @@
}
}
}
-
- var temp = [];
- for ( var i = 0; i < stack.length; i++ ) {
- temp.push( { 'type' : '/' + stack[i] }
);
- }
- for ( var i = stack.length - 1; i >= 0; i-- ) {
- temp.push( { 'type' : stack[i] } );
- }
- var tx =
this.documentView.model.prepareInsertion( this.selection.to, temp );
+ var tx =
this.documentView.model.prepareInsertion( this.selection.to, stack );
this.documentView.model.commit( tx );
this.selection.from = this.selection.to =
this.documentView.getModel().getRelativeContentOffset( this.selection.to, 1 );
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs