mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
Fix up some tools to not break on selection, added some test selection
stuff to sandbox Change-Id: Ic97144e634111c489507814c6634c66831726191
This commit is contained in:
parent
2439c0149a
commit
21ee17a192
|
@ -646,7 +646,13 @@ $(document).ready( function() {
|
|||
var sandboxEditor = new ve.Surface( '#content', HTML[0], options ),
|
||||
surfaceModel = sandboxEditor.getSurfaceModel(),
|
||||
documentModel = sandboxEditor.getDocumentModel(),
|
||||
parent = sandboxEditor.getParent();
|
||||
parent = sandboxEditor.getParent(),
|
||||
view = sandboxEditor.view;
|
||||
|
||||
/* Rob's test selection stuff */
|
||||
/*surfaceModel.setSelection( new ve.Range(0, documentModel.getData().length ) );
|
||||
view.showSelection ( surfaceModel.getSelection() );
|
||||
console.log (surfaceModel.getSelection().getLength());*/
|
||||
|
||||
|
||||
/* Sandbox Warning Message */
|
||||
|
|
|
@ -86,8 +86,8 @@ ve.FormatDropdownTool.prototype.updateState = function( annotations, nodes ) {
|
|||
'attributes': nodes[0].attributes
|
||||
};
|
||||
// Look for mismatches, in which case format should be null
|
||||
for ( i = 1; i < nodes[0].children.length; i++ ) {
|
||||
if ( format.type != nodes[0].children[i].getElementType() ||
|
||||
for ( i = 1; i < nodes.length; i++ ) {
|
||||
if ( format.type != nodes[i].getElementType() ||
|
||||
!ve.compareObjects( format.attributes, nodes.children[i].element.attributes ) ) {
|
||||
format = null;
|
||||
break;
|
||||
|
|
|
@ -78,7 +78,10 @@ ve.ui.IndentationButtonTool.prototype.outdent = function( listItems ) {
|
|||
ve.ui.IndentationButtonTool.prototype.updateState = function( annotations, nodes ) {
|
||||
function areListItems( nodes ) {
|
||||
for( var i = 0; i < nodes.length; i++ ) {
|
||||
if ( nodes[i].getParent().getElementType() !== 'listItem' ) {
|
||||
if (
|
||||
nodes[i].parent !== null &&
|
||||
nodes[i].getParent().getElementType() !== 'listItem' )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue