From 27f11e62f3c7d9c8330729d57e04d103addd652e 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. --- 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 511a2bad84a..8b678159801 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 277a1b1aa6c..ba7de2e5b27 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.11.0