From 4d9f5ec8a8b1a37b6c4f5aebae66434015a0d3b5 Mon Sep 17 00:00:00 2001 From: Cori Lynn Arnold Date: Fri, 21 Feb 2020 19:31:11 +0000 Subject: [PATCH] Bug 24709: Advanced editor - show space after delimiter visually This patch updates the JavaScript and CSS for the advanced MARC editor so that a space immediately following a delimiter will be detected and highlighted (green). 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), add a space immediately following the delimiter the space and delimiter should be highlighted green. - Remove the extra space and confirm that the highlight disappears. Signed-off-by: David Nind --- koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-mode.js | 4 ++++ koha-tmpl/intranet-tmpl/prog/css/cateditor.css | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) 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 8b67815980..6d3e13a0ec 100644 --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-mode.js +++ b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-mode.js @@ -132,6 +132,8 @@ CodeMirror.defineMode( 'marc', function( config, modeConfig ) { return 'end-space'; } else if ( stream.match( /\s{2,}/ ) ) { return 'double-space'; + } else if ( stream.match( /\‡.\s/ ) ) { + return 'space-after-delimiter'; } else if ( stream.match( /[^ \t‡]+/ ) || stream.match( /[ \t]+/ ) ) { return; } @@ -160,6 +162,8 @@ CodeMirror.defineMode( 'marc', function( config, modeConfig ) { return 'end-space'; } else if ( stream.match( /\s{2,}/ ) ) { return 'double-space'; + } else if ( stream.match( /\‡.\s/ ) ) { + return 'space-after-delimiter'; } 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 ba7de2e5b2..37a52bceb0 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/cateditor.css +++ b/koha-tmpl/intranet-tmpl/prog/css/cateditor.css @@ -110,6 +110,10 @@ body { border-bottom: 2px dotted #CC3333; } +.cm-space-after-delimiter { + background-color: #33cc33; +} + #editor .modified-line-gutter { width: 10px; } @@ -477,4 +481,4 @@ body { .ui-keyboard-accept { display: none; -} \ No newline at end of file +} -- 2.11.0