mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-24 02:48:18 +00:00
Debug: Fix signature range higlighting
Change-Id: Ieb5af739bb98761d8473edb87f1eb752dc386ea1
This commit is contained in:
parent
a082535e02
commit
15cb419f56
|
@ -8,22 +8,23 @@ var
|
|||
|
||||
highlighter.markThreads( threads );
|
||||
|
||||
// TODO: Use comment.signatureRanges to mark up signatures/timestamps
|
||||
comments.forEach( function ( comment ) {
|
||||
var signature, emptySignature, node, match;
|
||||
comment.signatureRanges.forEach( function ( signatureRange ) {
|
||||
var signature, emptySignature, node, match;
|
||||
|
||||
node = comment.range.endContainer;
|
||||
match = parser.findTimestamp( node, timestampRegexps );
|
||||
if ( !match ) {
|
||||
return;
|
||||
}
|
||||
signature = parser.findSignature( node )[ 0 ];
|
||||
emptySignature = signature.length === 1 && signature[ 0 ] === node;
|
||||
// Note that additional content may follow the timestamp (e.g. in some voting formats), but we
|
||||
// don't care about it. The code below doesn't mark that due to now the text nodes are sliced,
|
||||
// but we might need to take care to use the matched range of node in other cases.
|
||||
highlighter.markTimestamp( parser, node, match );
|
||||
if ( !emptySignature ) {
|
||||
highlighter.markSignature( signature );
|
||||
}
|
||||
node = signatureRange.endContainer;
|
||||
match = parser.findTimestamp( node, timestampRegexps );
|
||||
if ( !match ) {
|
||||
return;
|
||||
}
|
||||
signature = parser.findSignature( node )[ 0 ];
|
||||
emptySignature = signature.length === 1 && signature[ 0 ] === node;
|
||||
// Note that additional content may follow the timestamp (e.g. in some voting formats), but we
|
||||
// don't care about it. The code below doesn't mark that due to now the text nodes are sliced,
|
||||
// but we might need to take care to use the matched range of node in other cases.
|
||||
highlighter.markTimestamp( parser, node, match );
|
||||
if ( !emptySignature ) {
|
||||
highlighter.markSignature( signature );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue