From 5a5d759e34403314381e771ea1e05e5a55ec6061 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 5 Feb 2018 18:04:12 -0500 Subject: [PATCH] LP#1691263: discourage input of newlines in MARC editor This patch catches and discards enter keydown events when the focus is in a contenteditable subfield value div; otherwise, newlines can infect the MARC record. Signed-off-by: Galen Charlton Signed-off-by: Kathy Lussier --- Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js index 4411098a68..24a08c1619 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js +++ b/Open-ILS/web/js/ui/default/staff/cat/services/marcedit.js @@ -954,6 +954,12 @@ angular.module('egMarcMod', ['egCoreMod', 'ui.bootstrap']) addDatafield(event, event.shiftKey); // shift key inserts before event_return = false; + } else if (event.which == 13 && + ($(event.target).hasClass('marcsf') || $(event.target.parentNode).hasClass('marcsf')) + ) { + // bare return; don't allow it + event_return = false; + } else if (event.which == 46 && event.ctrlKey) { // ctrl+del, remove field deleteDatafield(event); event_return = false; -- 2.11.0