Show annotations on nodes in demo debugger

Change-Id: I41948e8549345c713f1bd0762b08807b8f7617da
This commit is contained in:
Catrope 2012-11-23 12:12:48 -08:00 committed by Trevor Parscal
parent 49963c75fd
commit 4303e9f30c

View file

@ -286,16 +286,21 @@ $html = '<div>' . file_get_contents( $page ) . '</div>';
for ( var i = 0; i < ve.instances[0].documentModel.data.length; i++ ) {
$li = $('<li>');
element = ve.instances[0].documentModel.data[i];
if( element.type ) {
if ( element.type ) {
text = element.type;
annotations = element.annotations;
} else if ( element.length > 1 ){
annotations = [];
$.each(element[1].arr, function(index, val) {
annotations.push( val.name );
});
text = element[0] + ' [' + annotations.join(', ') + ']';
text = element[0];
annotations = element[1];
} else {
text = element;
annotations = undefined;
}
if ( annotations ) {
text += ' [' + annotations.get().map(
function( ann ) {
return ann.name;
} ).join(', ') + ']';
}
$li.text( text );