Bug 24452: Advanced editor - show multiple spaces visually

This patch updates the JavaScript and CSS for the advanced MARC editor
so that multiple consecutive spaces within a line will be detected and
highlighted.

To test the EnableAdvancedCatalogingEditor system preference should be
enabled. Apply the patch and clear your browser cache if necessary.

 - Go to Cataloging -> Advanced editor.
 - On any text entry line (e.g. 245), enter some words with one, two,
   and more spaces in between them. When there are two or more spaces
   between words the spaces between the words should have a dotted red
   underline.
 - Remove the extra spaces and confirm that the dotted line disappears.

Signed-off-by: Cori Lynn Arnold <carnold@dgiinc.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Owen Leonard 2020-01-17 15:00:31 +00:00 committed by Joy Nelson
parent caba8dafb8
commit f33f46e6cd
2 changed files with 8 additions and 0 deletions

View File

@ -130,6 +130,8 @@ CodeMirror.defineMode( 'marc', function( config, modeConfig ) {
// matching.
if ( stream.match( /[ \t]+$/ ) ) {
return 'end-space';
} else if ( stream.match( /\s{2,}/ ) ) {
return 'double-space';
} else if ( stream.match( /[^ \t‡]+/ ) || stream.match( /[ \t]+/ ) ) {
return;
}
@ -156,6 +158,8 @@ CodeMirror.defineMode( 'marc', function( config, modeConfig ) {
// Match space at end of line
if ( stream.match( /[ \t]+$/ ) ) {
return 'end-space';
} else if ( stream.match( /\s{2,}/ ) ) {
return 'double-space';
} else {
stream.match( /[ \t]+/ );
}

View File

@ -106,6 +106,10 @@ body {
background-color: #DDDDBB;
}
.cm-double-space {
border-bottom: 2px dotted #CC3333;
}
#editor .modified-line-gutter {
width: 10px;
}