From 18cb9453193274f127cf416957cf3acfba28a45a Mon Sep 17 00:00:00 2001 From: Alex Sassmannshausen Date: Thu, 3 Oct 2019 15:36:26 +0200 Subject: [PATCH] Bug 17179: (follow-up) Correct typos, add default select. Correct error whereby object curCursor was invoked as a function. Added action whereby the most recent entry in the clipboard is selected after all copy and cut operations. Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer Signed-off-by: Katrin Fischer --- koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js index d3528eae88..5e39a43b75 100644 --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js +++ b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js @@ -163,6 +163,7 @@ define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], var curLine = cm.getLine( cm.getCursor().line ); $("#clipboard").prepend(''); + $("#clipboard option:first-child").prop('selected', true); cm.execCommand('deleteLine'); } @@ -197,10 +198,11 @@ define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], if ( !field ) return; var curCursor = cm.getCursor(); - var subfield = field.getSubfieldAt( curCursor().ch ); + var subfield = field.getSubfieldAt( curCursor.ch ); var subfieldText= cm.getRange({line:curCursor.line,ch:subfield.start},{line:curCursor.line,ch:subfield.end}); if ( subfield ) { $("#clipboard").prepend(''); + $("#clipboard option:first-child").prop('selected', true); subfield.delete(); } } @@ -210,6 +212,7 @@ define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], if ( cm.somethingSelected() ) return true; var curLine = cm.getLine( cm.getCursor().line ); $("#clipboard").prepend(''); + $("#clipboard option:first-child").prop('selected', true); } _editorKeys[copy_subfield] = function( cm ) { @@ -218,10 +221,11 @@ define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], if ( !field ) return; var curCursor = cm.getCursor(); - var subfield = field.getSubfieldAt( curCursor().ch ); + var subfield = field.getSubfieldAt( curCursor.ch ); var subfieldText= cm.getRange({line:curCursor.line,ch:subfield.start},{line:curCursor.line,ch:subfield.end}); if ( subfield ) { $("#clipboard").prepend(''); + $("#clipboard option:first-child").prop('selected', true); } } -- 2.11.0