From 9308a03c21642584f97166444324b574a473ac9b Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 17 Jan 2020 15:00:31 +0000 Subject: [PATCH] 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 Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize (cherry picked from commit f33f46e6cde96b996739cbcce02e98c0bb6a2ca0) Signed-off-by: Lucas Gass --- koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-mode.js | 4 ++++ koha-tmpl/intranet-tmpl/prog/css/cateditor.css | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-mode.js b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-mode.js index 511a2bad84..8b67815980 100644 --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-mode.js +++ b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-mode.js @@ -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]+/ ); } diff --git a/koha-tmpl/intranet-tmpl/prog/css/cateditor.css b/koha-tmpl/intranet-tmpl/prog/css/cateditor.css index c2c0e05531..d2c5f65a7a 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/cateditor.css +++ b/koha-tmpl/intranet-tmpl/prog/css/cateditor.css @@ -106,6 +106,10 @@ body { background-color: #DDDDBB; } +.cm-double-space { + border-bottom: 2px dotted #CC3333; +} + #editor .modified-line-gutter { width: 10px; } -- 2.39.5