@@ -, +, @@ subfield code as well --- .../intranet-tmpl/lib/koha/cateditor/marc-editor.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js +++ a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js @@ -86,6 +86,22 @@ define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], editor.overwriteMode = newState; } + function doubleClickSubfield( cm ) { + var field = cm.marceditor.getCurrentField(); + if ( !field ) return; + + var curCursor = cm.getCursor(); + var subfield = field.getSubfieldAt( curCursor.ch ); + var subfieldText = cm.getRange({line:curCursor.line,ch:subfield.contentsStart},{line:curCursor.line,ch:subfield.end}); + var textArea = document.createElement("TEXTAREA"); + textArea.value = subfieldText; + textArea.style.background = 'transparent'; + document.body.appendChild(textArea); + textArea.select(); + document.execCommand("Copy"); + document.body.removeChild(textArea); + } + // Editor helper functions function activateTabPosition( cm, pos, idx ) { // Allow tabbing to as-yet-nonexistent positions @@ -625,6 +641,7 @@ define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], this.cm.on( 'changes', editorChanges ); this.cm.on( 'cursorActivity', editorCursorActivity ); this.cm.on( 'overwriteToggle', editorSetOverwriteMode ); + this.cm.on( 'dblclick', doubleClickSubfield ); this.onCursorActivity = options.onCursorActivity; --